idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
157,500 | public static SVGPath drawFakeVoronoi ( Projection2D proj , List < double [ ] > means ) { CanvasSize viewport = proj . estimateViewport ( ) ; final SVGPath path = new SVGPath ( ) ; final double [ ] dirv = VMath . minus ( means . get ( 1 ) , means . get ( 0 ) ) ; VMath . rotate90Equals ( dirv ) ; double [ ] dir = proj .... | Fake Voronoi diagram . For two means only |
157,501 | public void select ( Segment segment , boolean addToSelection ) { if ( segment . isNone ( ) ) { return ; } if ( ! addToSelection ) { deselectAllSegments ( ) ; } if ( segment . isUnpaired ( ) ) { if ( addToSelection ) { boolean allSegmentsSelected = true ; for ( Segment other : segments . getPairedSegments ( segment ) )... | Adds or removes the given segment to the selection . Depending on the clustering and cluster selected and the addToSelection option given the current selection will be modified . This method is called by clicking on a segment and ring and the CTRL - button status . |
157,502 | protected void deselectSegment ( Segment segment ) { if ( segment . isUnpaired ( ) ) { ArrayList < Segment > remove = new ArrayList < > ( ) ; for ( Entry < Segment , Segment > entry : indirectSelections . entrySet ( ) ) { if ( entry . getValue ( ) == segment ) { remove . add ( entry . getKey ( ) ) ; } } for ( Segment o... | Deselect a segment |
157,503 | protected void selectSegment ( Segment segment ) { if ( segment . isUnpaired ( ) ) { for ( Segment other : segments . getPairedSegments ( segment ) ) { indirectSelections . put ( other , segment ) ; selectSegment ( other ) ; } } else { if ( ! selectedSegments . contains ( segment ) ) { selectedSegments . add ( segment ... | Select a segment |
157,504 | private boolean checkSupertypes ( Class < ? > cls ) { for ( Class < ? > c : knownParameterizables ) { if ( c . isAssignableFrom ( cls ) ) { return true ; } } return false ; } | Check all supertypes of a class . |
157,505 | private State checkV3Parameterization ( Class < ? > cls , State state ) throws NoClassDefFoundError { for ( Class < ? > inner : cls . getDeclaredClasses ( ) ) { if ( AbstractParameterizer . class . isAssignableFrom ( inner ) ) { try { Class < ? extends AbstractParameterizer > pcls = inner . asSubclass ( AbstractParamet... | Check for a V3 constructor . |
157,506 | private State checkDefaultConstructor ( Class < ? > cls , State state ) throws NoClassDefFoundError { try { cls . getConstructor ( ) ; return State . DEFAULT_INSTANTIABLE ; } catch ( Exception e ) { } return state ; } | Check for a default constructor . |
157,507 | public static double logpdf ( double x , double k , double theta , double shift ) { x = ( x - shift ) ; if ( x <= 0. ) { return Double . NEGATIVE_INFINITY ; } final double log1px = FastMath . log1p ( x ) ; return k * FastMath . log ( theta ) - GammaDistribution . logGamma ( k ) - ( theta + 1. ) * log1px + ( k - 1 ) * F... | LogGamma distribution logPDF |
157,508 | protected void plotGray ( SVGPlot plot , Element parent , double x , double y , double size ) { Element marker = plot . svgCircle ( x , y , size * .5 ) ; SVGUtil . setStyle ( marker , SVGConstants . CSS_FILL_PROPERTY + ":" + greycolor ) ; parent . appendChild ( marker ) ; } | Plot a replacement marker when an object is to be plotted as disabled usually gray . |
157,509 | protected void plotUncolored ( SVGPlot plot , Element parent , double x , double y , double size ) { Element marker = plot . svgCircle ( x , y , size * .5 ) ; SVGUtil . setStyle ( marker , SVGConstants . CSS_FILL_PROPERTY + ":" + dotcolor ) ; parent . appendChild ( marker ) ; } | Plot a replacement marker when no color is set ; usually black |
157,510 | public int truePositives ( ) { int tp = 0 ; for ( int i = 0 ; i < confusion . length ; i ++ ) { tp += truePositives ( i ) ; } return tp ; } | The number of correctly classified instances . |
157,511 | public int trueNegatives ( int classindex ) { int tn = 0 ; for ( int i = 0 ; i < confusion . length ; i ++ ) { for ( int j = 0 ; j < confusion [ i ] . length ; j ++ ) { if ( i != classindex && j != classindex ) { tn += confusion [ i ] [ j ] ; } } } return tn ; } | The number of true negatives of the specified class . |
157,512 | public int falsePositives ( int classindex ) { int fp = 0 ; for ( int i = 0 ; i < confusion [ classindex ] . length ; i ++ ) { if ( i != classindex ) { fp += confusion [ classindex ] [ i ] ; } } return fp ; } | The false positives for the specified class . |
157,513 | public int falseNegatives ( int classindex ) { int fn = 0 ; for ( int i = 0 ; i < confusion . length ; i ++ ) { if ( i != classindex ) { fn += confusion [ i ] [ classindex ] ; } } return fn ; } | The false negatives for the specified class . |
157,514 | public int totalInstances ( ) { int total = 0 ; for ( int i = 0 ; i < confusion . length ; i ++ ) { for ( int j = 0 ; j < confusion [ i ] . length ; j ++ ) { total += confusion [ i ] [ j ] ; } } return total ; } | The total number of instances covered by this confusion matrix . |
157,515 | protected static < A > double [ ] computeDistances ( NumberArrayAdapter < ? , A > adapter , A data ) { final int size = adapter . size ( data ) ; double [ ] dMatrix = new double [ ( size * ( size + 1 ) ) >> 1 ] ; for ( int i = 0 , c = 0 ; i < size ; i ++ ) { for ( int j = 0 ; j < i ; j ++ ) { double dx = adapter . getD... | Compute the double - centered delta matrix . |
157,516 | public static void doubleCenterMatrix ( double [ ] dMatrix , int size ) { double [ ] rowMean = new double [ size ] ; for ( int i = 0 , c = 0 ; i < size ; i ++ ) { for ( int j = 0 ; j < i ; j ++ ) { double v = dMatrix [ c ++ ] ; rowMean [ i ] += v ; rowMean [ j ] += v ; } assert ( dMatrix [ c ] == 0. ) ; c ++ ; } double... | Computes the distance variance matrix of one axis . |
157,517 | public HyperBoundingBox determineAlphaMinMax ( HyperBoundingBox interval ) { final int dim = vec . getDimensionality ( ) ; if ( interval . getDimensionality ( ) != dim - 1 ) { throw new IllegalArgumentException ( "Interval needs to have dimensionality d=" + ( dim - 1 ) + ", read: " + interval . getDimensionality ( ) ) ... | Determines the alpha values where this function has a minumum and maximum value in the given interval . |
157,518 | private ExtremumType extremumType ( int n , double [ ] alpha_extreme , HyperBoundingBox interval ) { if ( n == alpha_extreme . length - 1 ) { return extremumType ; } double [ ] alpha_extreme_l = new double [ alpha_extreme . length ] ; double [ ] alpha_extreme_r = new double [ alpha_extreme . length ] ; double [ ] alpha... | Returns the type of the extremum at the specified alpha values . |
157,519 | private double determineAlphaMin ( int n , double [ ] alpha_min , HyperBoundingBox interval ) { double alpha_n = extremum_alpha_n ( n , alpha_min ) ; double lower = interval . getMin ( n ) ; double upper = interval . getMax ( n ) ; double [ ] alpha_extreme = new double [ alpha_min . length ] ; System . arraycopy ( alph... | Determines the n - th alpha value where this function has a minimum in the specified interval . |
157,520 | public static double sinusProduct ( int start , int end , double [ ] alpha ) { double result = 1 ; for ( int j = start ; j < end ; j ++ ) { result *= FastMath . sin ( alpha [ j ] ) ; } return result ; } | Computes the product of all sinus values of the specified angles from start to end index . |
157,521 | private void determineGlobalExtremum ( ) { alphaExtremum = new double [ vec . getDimensionality ( ) - 1 ] ; for ( int n = alphaExtremum . length - 1 ; n >= 0 ; n -- ) { alphaExtremum [ n ] = extremum_alpha_n ( n , alphaExtremum ) ; if ( Double . isNaN ( alphaExtremum [ n ] ) ) { throw new IllegalStateException ( "Houst... | Determines the global extremum of this parameterization function . |
157,522 | private void determineGlobalExtremumType ( ) { final double f = function ( alphaExtremum ) ; double [ ] alpha_1 = new double [ alphaExtremum . length ] ; double [ ] alpha_2 = new double [ alphaExtremum . length ] ; for ( int i = 0 ; i < alphaExtremum . length ; i ++ ) { alpha_1 [ i ] = Math . random ( ) * Math . PI ; a... | Determines the type of the global extremum . |
157,523 | public void setParameters ( Parameterization config ) { TrackParameters track = new TrackParameters ( config ) ; configureStep ( track ) ; { parameterTable . setEnabled ( false ) ; parameterTable . clear ( ) ; for ( TrackedParameter pair : track . getAllParameters ( ) ) { parameterTable . addParameter ( pair . getOwner... | Do the actual setParameters invocation . |
157,524 | protected void reportErrors ( Parameterization config ) { StringBuilder buf = new StringBuilder ( ) ; for ( ParameterException e : config . getErrors ( ) ) { if ( e instanceof UnspecifiedParameterException ) { continue ; } buf . append ( e . getMessage ( ) ) . append ( FormatUtil . NEWLINE ) ; } if ( buf . length ( ) >... | Report errors in a single error log record . |
157,525 | public boolean canRun ( ) { Status status = getStatus ( ) ; return Status . STATUS_READY . equals ( status ) || Status . STATUS_COMPLETE . equals ( status ) ; } | Test if this tab is ready - to - run |
157,526 | public SVGPath lineTo ( double x , double y ) { return append ( PATH_LINE_TO ) . append ( x ) . append ( y ) ; } | Draw a line to the given coordinates . |
157,527 | public SVGPath relativeLineTo ( double x , double y ) { return append ( PATH_LINE_TO_RELATIVE ) . append ( x ) . append ( y ) ; } | Draw a line to the given relative coordinates . |
157,528 | public SVGPath moveTo ( double x , double y ) { return append ( PATH_MOVE ) . append ( x ) . append ( y ) ; } | Move to the given coordinates . |
157,529 | public SVGPath relativeMoveTo ( double x , double y ) { return append ( PATH_MOVE_RELATIVE ) . append ( x ) . append ( y ) ; } | Move to the given relative coordinates . |
157,530 | public SVGPath smoothQuadTo ( double x , double y ) { return append ( PATH_SMOOTH_QUAD_TO ) . append ( x ) . append ( y ) ; } | Smooth quadratic Bezier line to the given coordinates . |
157,531 | public SVGPath relativeSmoothQuadTo ( double x , double y ) { return append ( PATH_SMOOTH_QUAD_TO_RELATIVE ) . append ( x ) . append ( y ) ; } | Smooth quadratic Bezier line to the given relative coordinates . |
157,532 | private SVGPath append ( char action ) { assert lastaction != 0 || action == PATH_MOVE : "Paths must begin with a move to the initial position!" ; if ( lastaction != action ) { buf . append ( action ) ; lastaction = action ; } return this ; } | Append an action to the current path . |
157,533 | private SVGPath append ( double x ) { if ( ! Double . isFinite ( x ) ) { throw new IllegalArgumentException ( "Cannot draw an infinite/NaN position." ) ; } if ( x >= 0 ) { final int l = buf . length ( ) ; if ( l > 0 ) { char c = buf . charAt ( l - 1 ) ; assert c != 'e' && c != 'E' : "Invalid exponential in path" ; if (... | Append a value to the current path . |
157,534 | public SVGPath close ( ) { assert lastaction != 0 : "Paths must begin with a move to the initial position!" ; if ( lastaction != PATH_CLOSE ) { buf . append ( ' ' ) . append ( PATH_CLOSE ) ; lastaction = PATH_CLOSE ; } return this ; } | Close the path . |
157,535 | public Element makeElement ( SVGPlot plot ) { Element elem = plot . svgElement ( SVGConstants . SVG_PATH_TAG ) ; elem . setAttribute ( SVGConstants . SVG_D_ATTRIBUTE , buf . toString ( ) ) ; return elem ; } | Turn the path buffer into an SVG element . |
157,536 | public void setParameters ( Parameterization config ) { logTab . setParameters ( config ) ; inputTab . setParameters ( config ) ; algTab . setParameters ( config ) ; evalTab . setParameters ( config ) ; outTab . setParameters ( config ) ; } | Set the parameters . |
157,537 | public ArrayList < String > serializeParameters ( ) { ListParameterization params = new ListParameterization ( ) ; logTab . appendParameters ( params ) ; inputTab . appendParameters ( params ) ; algTab . appendParameters ( params ) ; evalTab . appendParameters ( params ) ; outTab . appendParameters ( params ) ; return ... | Get the serialized parameters |
157,538 | public static void main ( final String [ ] args ) { GUIUtil . logUncaughtExceptions ( LOG ) ; GUIUtil . setLookAndFeel ( ) ; OutputStep . setDefaultHandlerVisualizer ( ) ; javax . swing . SwingUtilities . invokeLater ( new Runnable ( ) { public void run ( ) { try { final MultiStepGUI gui = new MultiStepGUI ( ) ; gui . ... | Main method that just spawns the UI . |
157,539 | protected static boolean match ( Object ref , Object test ) { if ( ref == null ) { return false ; } if ( ref == test ) { return true ; } if ( ref instanceof LabelList && test instanceof LabelList ) { final LabelList lref = ( LabelList ) ref ; final LabelList ltest = ( LabelList ) test ; final int s1 = lref . size ( ) ,... | Test whether two relation agree . |
157,540 | private void findMatches ( ModifiableDBIDs posn , Relation < ? > lrelation , Object label ) { posn . clear ( ) ; for ( DBIDIter ri = lrelation . iterDBIDs ( ) ; ri . valid ( ) ; ri . advance ( ) ) { if ( match ( label , lrelation . get ( ri ) ) ) { posn . add ( ri ) ; } } } | Find all matching objects . |
157,541 | private void computeDistances ( ModifiableDoubleDBIDList nlist , DBIDIter query , final DistanceQuery < O > distQuery , Relation < O > relation ) { nlist . clear ( ) ; O qo = relation . get ( query ) ; for ( DBIDIter ri = relation . iterDBIDs ( ) ; ri . valid ( ) ; ri . advance ( ) ) { if ( ! includeSelf && DBIDUtil . ... | Compute the distances to the neighbor objects . |
157,542 | private PrintStream newStream ( String name ) throws IOException { if ( LOG . isDebuggingFiner ( ) ) { LOG . debugFiner ( "Requested stream: " + name ) ; } if ( ! basename . exists ( ) ) { basename . mkdirs ( ) ; } String fn = basename . getAbsolutePath ( ) + File . separator + name + EXTENSION ; fn = usegzip ? fn + GZ... | Open a new stream of the given name |
157,543 | protected < N extends Page & Externalizable > PageFile < N > makePageFile ( Class < N > cls ) { @ SuppressWarnings ( "unchecked" ) final PageFileFactory < N > castFactory = ( PageFileFactory < N > ) pageFileFactory ; return castFactory . newPageFile ( cls ) ; } | Make the page file for this index . |
157,544 | public static boolean isAngularDistance ( AbstractMaterializeKNNPreprocessor < ? > kNN ) { DistanceFunction < ? > distanceFunction = kNN . getDistanceQuery ( ) . getDistanceFunction ( ) ; return CosineDistanceFunction . class . isInstance ( distanceFunction ) || ArcCosineDistanceFunction . class . isInstance ( distance... | Test whether the given preprocessor used an angular distance function |
157,545 | public static Element drawCosine ( SVGPlot svgp , Projection2D proj , NumberVector mid , double angle ) { double [ ] pointOfOrigin = proj . fastProjectDataToRenderSpace ( new double [ proj . getInputDimensionality ( ) ] ) ; double [ ] selPoint = proj . fastProjectDataToRenderSpace ( mid ) ; double [ ] range1 , range2 ;... | Visualizes Cosine and ArcCosine distance functions |
157,546 | public void splitupNoSort ( ArrayModifiableDBIDs ind , int begin , int end , int dim , Random rand ) { final int nele = end - begin ; dim = dim % projectedPoints . length ; DoubleDataStore tpro = projectedPoints [ dim ] ; if ( nele > minSplitSize * ( 1 - sizeTolerance ) && nele < minSplitSize * ( 1 + sizeTolerance ) ) ... | Recursively splits entire point set until the set is below a threshold |
157,547 | public int splitRandomly ( ArrayModifiableDBIDs ind , int begin , int end , DoubleDataStore tpro , Random rand ) { final int nele = end - begin ; DBIDArrayIter it = ind . iter ( ) ; double rs = tpro . doubleValue ( it . seek ( begin + rand . nextInt ( nele ) ) ) ; int minInd = begin , maxInd = end - 1 ; while ( minInd ... | Split the data set randomly . |
157,548 | public int splitByDistance ( ArrayModifiableDBIDs ind , int begin , int end , DoubleDataStore tpro , Random rand ) { DBIDArrayIter it = ind . iter ( ) ; double rmin = Double . MAX_VALUE * .5 , rmax = - Double . MAX_VALUE * .5 ; int minInd = begin , maxInd = end - 1 ; for ( it . seek ( begin ) ; it . getOffset ( ) < end... | Split the data set by distances . |
157,549 | public DataStore < ? extends DBIDs > getNeighs ( ) { final DBIDs ids = points . getDBIDs ( ) ; WritableDataStore < ModifiableDBIDs > neighs = DataStoreUtil . makeStorage ( ids , DataStoreFactory . HINT_HOT , ModifiableDBIDs . class ) ; for ( DBIDIter it = ids . iter ( ) ; it . valid ( ) ; it . advance ( ) ) { neighs . ... | Compute list of neighbors for each point from sets resulting from projection |
157,550 | public DoubleDataStore computeAverageDistInSet ( ) { WritableDoubleDataStore davg = DataStoreUtil . makeDoubleStorage ( points . getDBIDs ( ) , DataStoreFactory . HINT_HOT ) ; WritableIntegerDataStore nDists = DataStoreUtil . makeIntegerStorage ( points . getDBIDs ( ) , DataStoreFactory . HINT_HOT | DataStoreFactory . ... | Compute for each point a density estimate as inverse of average distance to a point in a projected set |
157,551 | public boolean containedIn ( SparseNumberVector bv ) { int i1 = this . iter ( ) , i2 = bv . iter ( ) ; while ( this . iterValid ( i1 ) ) { if ( ! bv . iterValid ( i2 ) ) { return false ; } int d1 = this . iterDim ( i1 ) , d2 = bv . iterDim ( i2 ) ; if ( d1 < d2 ) { return false ; } if ( d1 == d2 ) { if ( bv . iterDoubl... | Test whether the itemset is contained in a bit vector . |
157,552 | public static long [ ] toBitset ( Itemset i , long [ ] bits ) { for ( int it = i . iter ( ) ; i . iterValid ( it ) ; it = i . iterAdvance ( it ) ) { BitsUtil . setI ( bits , i . iterDim ( it ) ) ; } return bits ; } | Get the items . |
157,553 | protected static int compareLexicographical ( Itemset a , Itemset o ) { int i1 = a . iter ( ) , i2 = o . iter ( ) ; while ( a . iterValid ( i1 ) && o . iterValid ( i2 ) ) { int v1 = a . iterDim ( i1 ) , v2 = o . iterDim ( i2 ) ; if ( v1 < v2 ) { return - 1 ; } if ( v2 < v1 ) { return + 1 ; } i1 = a . iterAdvance ( i1 )... | Robust compare using the iterators lexicographical only! |
157,554 | public final StringBuilder appendTo ( StringBuilder buf , VectorFieldTypeInformation < BitVector > meta ) { appendItemsTo ( buf , meta ) ; return buf . append ( ": " ) . append ( support ) ; } | Append items and support to a string buffer . |
157,555 | public StringBuilder appendItemsTo ( StringBuilder buf , VectorFieldTypeInformation < BitVector > meta ) { int it = this . iter ( ) ; if ( this . iterValid ( it ) ) { while ( true ) { int v = this . iterDim ( it ) ; String lbl = ( meta != null ) ? meta . getLabel ( v ) : null ; if ( lbl == null ) { buf . append ( v ) ;... | Only append the items to a string buffer . |
157,556 | public double getWeight ( double distance , double max , double stddev ) { if ( max <= 0 ) { return 1.0 ; } double relativedistance = distance / max ; return FastMath . exp ( - 2.3025850929940455 * relativedistance * relativedistance ) ; } | Get Gaussian weight . stddev is not used scaled using max . |
157,557 | public void writePage ( int pageID , P page ) { if ( page . isDirty ( ) ) { try { countWrite ( ) ; byte [ ] array = pageToByteArray ( page ) ; file . getRecordBuffer ( pageID ) . put ( array ) ; page . setDirty ( false ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } } | Write page to disk . |
157,558 | private byte [ ] pageToByteArray ( P page ) { try { if ( page == null ) { ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; ObjectOutputStream oos = new ObjectOutputStream ( baos ) ; oos . writeInt ( EMPTY_PAGE ) ; oos . close ( ) ; baos . close ( ) ; byte [ ] array = baos . toByteArray ( ) ; byte [ ] result... | Serializes an object into a byte array . |
157,559 | public static SinCosTable make ( int steps ) { if ( ( steps & 0x3 ) == 0 ) { return new QuarterTable ( steps ) ; } if ( ( steps & 0x1 ) == 0 ) { return new HalfTable ( steps ) ; } return new FullTable ( steps ) ; } | Make a table for the given number of steps . |
157,560 | protected void process ( DBIDRef id , ArrayDBIDs ids , DBIDArrayIter it , int n , WritableDBIDDataStore pi , WritableDoubleDataStore lambda , WritableDoubleDataStore m ) { clinkstep3 ( id , it , n , pi , lambda , m ) ; clinkstep4567 ( id , ids , it , n , pi , lambda , m ) ; clinkstep8 ( id , it , n , pi , lambda , m ) ... | CLINK main loop based on the SLINK main loop . |
157,561 | private void clinkstep8 ( DBIDRef id , DBIDArrayIter it , int n , WritableDBIDDataStore pi , WritableDoubleDataStore lambda , WritableDoubleDataStore m ) { DBIDVar p_i = DBIDUtil . newVar ( ) , pp_i = DBIDUtil . newVar ( ) ; for ( it . seek ( 0 ) ; it . getOffset ( ) < n ; it . advance ( ) ) { p_i . from ( pi , it ) ; ... | Update hierarchy . |
157,562 | public static int levenshteinDistance ( String o1 , String o2 ) { if ( o1 . length ( ) > o2 . length ( ) ) { return levenshteinDistance ( o2 , o1 ) ; } final int l1 = o1 . length ( ) , l2 = o2 . length ( ) ; if ( l1 == l2 && o1 . hashCode ( ) == o2 . hashCode ( ) && o1 . equals ( o2 ) ) { return 0 ; } final int prefix ... | Levenshtein distance for two strings . |
157,563 | private static int prefixLen ( String o1 , String o2 ) { final int l1 = o1 . length ( ) , l2 = o2 . length ( ) , l = l1 < l2 ? l1 : l2 ; int prefix = 0 ; while ( prefix < l && ( o1 . charAt ( prefix ) == o2 . charAt ( prefix ) ) ) { prefix ++ ; } return prefix ; } | Compute the length of the prefix . |
157,564 | private static int postfixLen ( String o1 , String o2 , int prefix ) { int postfix = 0 ; int p1 = o1 . length ( ) , p2 = o2 . length ( ) ; while ( p1 > prefix && p2 > prefix && ( o1 . charAt ( -- p1 ) == o2 . charAt ( -- p2 ) ) ) { ++ postfix ; } return postfix ; } | Compute the postfix length . |
157,565 | public static int levenshteinDistance ( String o1 , String o2 , int prefix , int postfix ) { final int l1 = o1 . length ( ) , l2 = o2 . length ( ) ; int [ ] buf = new int [ ( l2 + 1 - ( prefix + postfix ) ) << 1 ] ; for ( int j = 0 ; j < buf . length ; j += 2 ) { buf [ j ] = j >> 1 ; } int inter = 1 ; for ( int i = pre... | Compute the Levenshtein distance except for prefix and postfix . |
157,566 | private static int nextSep ( String str , int start ) { int next = str . indexOf ( ',' , start ) ; return next == - 1 ? str . length ( ) : next ; } | Find the next separator . |
157,567 | public static double [ ] [ ] computeWeightMatrix ( final int quanth , final int quants , final int quantb ) { final int dim = quanth * quants * quantb ; final DoubleWrapper tmp = new DoubleWrapper ( ) ; assert ( dim > 0 ) ; final double [ ] [ ] m = new double [ dim ] [ dim ] ; for ( int x = 0 ; x < dim ; x ++ ) { final... | Compute the weight matrix for HSB similarity . |
157,568 | public static double [ ] plus ( final double [ ] v1 , final double [ ] v2 ) { assert v1 . length == v2 . length : ERR_VEC_DIMENSIONS ; final double [ ] result = new double [ v1 . length ] ; for ( int i = 0 ; i < result . length ; i ++ ) { result [ i ] = v1 [ i ] + v2 [ i ] ; } return result ; } | Computes component - wise v1 + v2 for vectors . |
157,569 | public static double [ ] plusEquals ( final double [ ] v1 , final double [ ] v2 ) { assert v1 . length == v2 . length : ERR_VEC_DIMENSIONS ; for ( int i = 0 ; i < v1 . length ; i ++ ) { v1 [ i ] += v2 [ i ] ; } return v1 ; } | Computes component - wise v1 = v1 + v2 overwriting the vector v1 . |
157,570 | public static double [ ] plus ( final double [ ] v1 , final double s1 ) { final double [ ] result = new double [ v1 . length ] ; for ( int i = 0 ; i < result . length ; i ++ ) { result [ i ] = v1 [ i ] + s1 ; } return result ; } | Computes component - wise v1 + s1 . |
157,571 | public static double [ ] plusEquals ( final double [ ] v1 , final double s1 ) { for ( int i = 0 ; i < v1 . length ; i ++ ) { v1 [ i ] += s1 ; } return v1 ; } | Computes component - wise v1 = v1 + s1 overwriting the vector v1 . |
157,572 | public static double [ ] minus ( final double [ ] v1 , final double [ ] v2 ) { assert v1 . length == v2 . length : ERR_VEC_DIMENSIONS ; final double [ ] sub = new double [ v1 . length ] ; for ( int i = 0 ; i < v1 . length ; i ++ ) { sub [ i ] = v1 [ i ] - v2 [ i ] ; } return sub ; } | Computes component - wise v1 - v2 . |
157,573 | public static double [ ] minusEquals ( final double [ ] v1 , final double [ ] v2 ) { assert v1 . length == v2 . length : ERR_VEC_DIMENSIONS ; for ( int i = 0 ; i < v1 . length ; i ++ ) { v1 [ i ] -= v2 [ i ] ; } return v1 ; } | Computes component - wise v1 = v1 - v2 overwriting the vector v1 . |
157,574 | public static double [ ] minus ( final double [ ] v1 , final double s1 ) { final double [ ] result = new double [ v1 . length ] ; for ( int i = 0 ; i < v1 . length ; i ++ ) { result [ i ] = v1 [ i ] - s1 ; } return result ; } | Subtract component - wise v1 - s1 . |
157,575 | public static double [ ] minusEquals ( final double [ ] v1 , final double s1 ) { for ( int i = 0 ; i < v1 . length ; i ++ ) { v1 [ i ] -= s1 ; } return v1 ; } | Subtract component - wise in - place v1 = v1 - s1 overwriting the vector v1 . |
157,576 | public static double sum ( final double [ ] v1 ) { double acc = 0. ; for ( int row = 0 ; row < v1 . length ; row ++ ) { acc += v1 [ row ] ; } return acc ; } | Sum of the vector components . |
157,577 | public static int argmax ( double [ ] v ) { assert ( v . length > 0 ) ; int maxIndex = 0 ; double currentMax = v [ 0 ] ; for ( int i = 1 ; i < v . length ; i ++ ) { final double x = v [ i ] ; if ( x > currentMax ) { maxIndex = i ; currentMax = x ; } } return maxIndex ; } | Find the maximum value . |
157,578 | public static double [ ] normalize ( final double [ ] v1 ) { final double norm = 1. / euclideanLength ( v1 ) ; double [ ] re = new double [ v1 . length ] ; if ( norm < Double . POSITIVE_INFINITY ) { for ( int row = 0 ; row < v1 . length ; row ++ ) { re [ row ] = v1 [ row ] * norm ; } } return re ; } | Normalizes v1 to the length of 1 . 0 . |
157,579 | public static double [ ] normalizeEquals ( final double [ ] v1 ) { final double norm = 1. / euclideanLength ( v1 ) ; if ( norm < Double . POSITIVE_INFINITY ) { for ( int row = 0 ; row < v1 . length ; row ++ ) { v1 [ row ] *= norm ; } } return v1 ; } | Normalizes v1 to the length of 1 . 0 in place . |
157,580 | public static void clear ( final double [ ] [ ] m ) { for ( int i = 0 ; i < m . length ; i ++ ) { Arrays . fill ( m [ i ] , 0.0 ) ; } } | Reset the matrix to 0 . |
157,581 | public static double [ ] rotate90Equals ( final double [ ] v1 ) { assert v1 . length == 2 : "rotate90Equals is only valid for 2d vectors." ; final double temp = v1 [ 0 ] ; v1 [ 0 ] = v1 [ 1 ] ; v1 [ 1 ] = - temp ; return v1 ; } | Rotate the two - dimensional vector by 90 degrees . |
157,582 | public static double [ ] [ ] diagonal ( final double [ ] v1 ) { final int dim = v1 . length ; final double [ ] [ ] result = new double [ dim ] [ dim ] ; for ( int i = 0 ; i < dim ; i ++ ) { result [ i ] [ i ] = v1 [ i ] ; } return result ; } | Returns a quadratic matrix consisting of zeros and of the given values on the diagonal . |
157,583 | public static double [ ] [ ] copy ( final double [ ] [ ] m1 ) { final int rowdim = m1 . length , coldim = getColumnDimensionality ( m1 ) ; final double [ ] [ ] X = new double [ rowdim ] [ coldim ] ; for ( int i = 0 ; i < rowdim ; i ++ ) { System . arraycopy ( m1 [ i ] , 0 , X [ i ] , 0 , coldim ) ; } return X ; } | Make a deep copy of a matrix . |
157,584 | public static double [ ] getCol ( double [ ] [ ] m1 , int col ) { double [ ] ret = new double [ m1 . length ] ; for ( int i = 0 ; i < ret . length ; i ++ ) { ret [ i ] = m1 [ i ] [ col ] ; } return ret ; } | Get a column from a matrix as vector . |
157,585 | public static double [ ] getDiagonal ( final double [ ] [ ] m1 ) { final int dim = Math . min ( getColumnDimensionality ( m1 ) , m1 . length ) ; final double [ ] diagonal = new double [ dim ] ; for ( int i = 0 ; i < dim ; i ++ ) { diagonal [ i ] = m1 [ i ] [ i ] ; } return diagonal ; } | getDiagonal returns array of diagonal - elements . |
157,586 | public static void normalizeColumns ( final double [ ] [ ] m1 ) { final int columndimension = getColumnDimensionality ( m1 ) ; for ( int col = 0 ; col < columndimension ; col ++ ) { double norm = 0.0 ; for ( int row = 0 ; row < m1 . length ; row ++ ) { final double v = m1 [ row ] [ col ] ; norm += v * v ; } if ( norm >... | Normalizes the columns of this matrix to length of 1 . 0 . |
157,587 | public static double [ ] [ ] appendColumns ( final double [ ] [ ] m1 , final double [ ] [ ] m2 ) { final int columndimension = getColumnDimensionality ( m1 ) ; final int ccolumndimension = getColumnDimensionality ( m2 ) ; assert m1 . length == m2 . length : "m.getRowDimension() != column.getRowDimension()" ; final int ... | Returns a matrix which consists of this matrix and the specified columns . |
157,588 | public static double [ ] [ ] orthonormalize ( final double [ ] [ ] m1 ) { final int columndimension = getColumnDimensionality ( m1 ) ; final double [ ] [ ] v = copy ( m1 ) ; for ( int i = 1 ; i < columndimension ; i ++ ) { final double [ ] u_i = getCol ( m1 , i ) ; final double [ ] sum = new double [ m1 . length ] ; fo... | Returns an orthonormalization of this matrix . |
157,589 | public static double [ ] [ ] inverse ( double [ ] [ ] A ) { final int rows = A . length , cols = A [ 0 ] . length ; return rows == cols ? ( new LUDecomposition ( A , rows , cols ) ) . inverse ( ) : ( new QRDecomposition ( A , rows , cols ) ) . inverse ( ) ; } | Matrix inverse or pseudoinverse |
157,590 | public static boolean almostEquals ( final double [ ] m1 , final double [ ] m2 , final double maxdelta ) { if ( m1 == m2 ) { return true ; } if ( m1 == null || m2 == null ) { return false ; } final int rowdim = m1 . length ; if ( rowdim != m2 . length ) { return false ; } for ( int i = 0 ; i < rowdim ; i ++ ) { if ( Ma... | Compare two matrices with a delta parameter to take numerical errors into account . |
157,591 | public static double angle ( double [ ] v1 , double [ ] v2 ) { final int mindim = ( v1 . length <= v2 . length ) ? v1 . length : v2 . length ; double s = 0 , e1 = 0 , e2 = 0 ; for ( int k = 0 ; k < mindim ; k ++ ) { final double r1 = v1 [ k ] , r2 = v2 [ k ] ; s += r1 * r2 ; e1 += r1 * r1 ; e2 += r2 * r2 ; } for ( int ... | Compute the cosine of the angle between two vectors where the smaller angle between those vectors is viewed . |
157,592 | protected void updateFromSelection ( ) { DBIDSelection sel = context . getSelection ( ) ; if ( sel != null ) { this . dbids = DBIDUtil . newArray ( sel . getSelectedIds ( ) ) ; this . dbids . sort ( ) ; } else { this . dbids = DBIDUtil . newArray ( ) ; } } | Update our selection |
157,593 | public static DataStoreEvent insertionEvent ( DBIDs inserts ) { return new DataStoreEvent ( inserts , DBIDUtil . EMPTYDBIDS , DBIDUtil . EMPTYDBIDS ) ; } | Insertion event . |
157,594 | public static DataStoreEvent removalEvent ( DBIDs removals ) { return new DataStoreEvent ( DBIDUtil . EMPTYDBIDS , removals , DBIDUtil . EMPTYDBIDS ) ; } | Removal event . |
157,595 | public static DataStoreEvent updateEvent ( DBIDs updates ) { return new DataStoreEvent ( DBIDUtil . EMPTYDBIDS , DBIDUtil . EMPTYDBIDS , updates ) ; } | Update event . |
157,596 | private Visualization instantiateVisualization ( VisualizationTask task ) { try { Visualization v = task . getFactory ( ) . makeVisualization ( context , task , this , width , height , item . proj ) ; if ( task . has ( RenderFlag . NO_EXPORT ) ) { v . getLayer ( ) . setAttribute ( NO_EXPORT_ATTRIBUTE , NO_EXPORT_ATTRIB... | Instantiate a visualization . |
157,597 | public void destroy ( ) { context . removeVisualizationListener ( this ) ; context . removeResultListener ( this ) ; for ( Entry < VisualizationTask , Visualization > v : taskmap . entrySet ( ) ) { Visualization vis = v . getValue ( ) ; if ( vis != null ) { vis . destroy ( ) ; } } taskmap . clear ( ) ; } | Cleanup function . To remove listeners . |
157,598 | private void lazyRefresh ( ) { Runnable pr = new Runnable ( ) { public void run ( ) { if ( pendingRefresh . compareAndSet ( this , null ) ) { refresh ( ) ; } } } ; pendingRefresh . set ( pr ) ; scheduleUpdate ( pr ) ; } | Trigger a refresh . |
157,599 | public boolean nextLine ( ) throws IOException { while ( reader . readLine ( buf . delete ( 0 , buf . length ( ) ) ) ) { ++ lineNumber ; if ( lengthWithoutLinefeed ( buf ) > 0 ) { return true ; } } return false ; } | Read the next line . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.