idx int64 0 41.2k | question stringlengths 74 4.04k | target stringlengths 7 750 |
|---|---|---|
36,200 | private void setup ( ) { st = new StreamTokenizer ( this ) ; st . resetSyntax ( ) ; st . eolIsSignificant ( false ) ; st . lowerCaseMode ( true ) ; st . wordChars ( '0' , '9' ) ; st . wordChars ( '-' , '.' ) ; st . wordChars ( '\u0000' , '\u00FF' ) ; st . commentChar ( '%' ) ; st . whitespaceChars ( ' ' , ' ' ) ; st . ... | Sets up the stream tokenizer |
36,201 | public void add ( int num , int [ ] indices ) { for ( int i = 0 ; i < indices . length ; ++ i ) indices [ i ] += num ; } | Shifts the indices . Useful for converting between 0 - and 1 - based indicing . |
36,202 | private String readTrimmedLine ( ) throws IOException { String line = readLine ( ) ; if ( line != null ) return line . trim ( ) ; else throw new EOFException ( ) ; } | Reads a line and trims it of surrounding whitespace |
36,203 | public MatrixInfo readMatrixInfo ( ) throws IOException { String [ ] component = readTrimmedLine ( ) . split ( " +" ) ; if ( component . length != 5 ) throw new IOException ( "Current line unparsable. It must consist of 5 tokens" ) ; if ( ! component [ 0 ] . equalsIgnoreCase ( "%%MatrixMarket" ) ) throw new IOException... | Reads the matrix info for the Matrix Market exchange format . The line must consist of exactly 5 space - separated entries the first being %%MatrixMarket |
36,204 | public VectorInfo readVectorInfo ( ) throws IOException { String [ ] component = readTrimmedLine ( ) . split ( " +" ) ; if ( component . length != 4 ) throw new IOException ( "Current line unparsable. It must consist of 4 tokens" ) ; if ( ! component [ 0 ] . equalsIgnoreCase ( "%%MatrixMarket" ) ) throw new IOException... | Reads the vector info for the Matrix Market exchange format . The line must consist of exactly 4 space - separated entries the first being %%MatrixMarket |
36,205 | public MatrixSize readMatrixSize ( MatrixInfo info ) throws IOException { int numRows = getInt ( ) , numColumns = getInt ( ) ; if ( info . isDense ( ) ) return new MatrixSize ( numRows , numColumns , info ) ; else { int numEntries = getInt ( ) ; return new MatrixSize ( numRows , numColumns , numEntries ) ; } } | Reads in the size of a matrix . Skips initial comments |
36,206 | public MatrixSize readArraySize ( ) throws IOException { int numRows = getInt ( ) , numColumns = getInt ( ) ; return new MatrixSize ( numRows , numColumns , numRows * numColumns ) ; } | Reads in the size of an array matrix . Skips initial comments |
36,207 | public MatrixSize readCoordinateSize ( ) throws IOException { int numRows = getInt ( ) , numColumns = getInt ( ) , numEntries = getInt ( ) ; return new MatrixSize ( numRows , numColumns , numEntries ) ; } | Reads in the size of a coordinate matrix . Skips initial comments |
36,208 | public VectorSize readVectorSize ( VectorInfo info ) throws IOException { int size = getInt ( ) ; if ( info . isDense ( ) ) return new VectorSize ( size ) ; else { int numEntries = getInt ( ) ; return new VectorSize ( size , numEntries ) ; } } | Reads in the size of a vector . Skips initial comments |
36,209 | public VectorSize readVectorCoordinateSize ( ) throws IOException { int size = getInt ( ) , numEntries = getInt ( ) ; return new VectorSize ( size , numEntries ) ; } | Reads in the size of a coordinate vector . Skips initial comments |
36,210 | public void readArray ( double [ ] dataR , double [ ] dataI ) throws IOException { int size = dataR . length ; if ( size != dataI . length ) throw new IllegalArgumentException ( "All arrays must be of the same size" ) ; for ( int i = 0 ; i < size ; ++ i ) { dataR [ i ] = getDouble ( ) ; dataI [ i ] = getDouble ( ) ; } ... | Reads the array data . The first array will contain real entries while the second contain imaginary entries |
36,211 | public void readCoordinate ( int [ ] index , double [ ] data ) throws IOException { int size = index . length ; if ( size != data . length ) throw new IllegalArgumentException ( "All arrays must be of the same size" ) ; for ( int i = 0 ; i < size ; ++ i ) { index [ i ] = getInt ( ) ; data [ i ] = getDouble ( ) ; } } | Reads a coordinate vector |
36,212 | public void readCoordinate ( int [ ] index , float [ ] dataR , float [ ] dataI ) throws IOException { int size = index . length ; if ( size != dataR . length || size != dataI . length ) throw new IllegalArgumentException ( "All arrays must be of the same size" ) ; for ( int i = 0 ; i < size ; ++ i ) { index [ i ] = get... | Reads a coordinate vector . First data array contains real entries and the second contains imaginary entries |
36,213 | public void readPattern ( int [ ] index ) throws IOException { int size = index . length ; for ( int i = 0 ; i < size ; ++ i ) index [ i ] = getInt ( ) ; } | Reads a pattern vector |
36,214 | public void readCoordinate ( int [ ] row , int [ ] column , double [ ] data ) throws IOException { int size = row . length ; if ( size != column . length || size != data . length ) throw new IllegalArgumentException ( "All arrays must be of the same size" ) ; for ( int i = 0 ; i < size ; ++ i ) { row [ i ] = getInt ( )... | Reads a coordinate matrix |
36,215 | public void readPattern ( int [ ] row , int [ ] column ) throws IOException { int size = row . length ; if ( size != column . length ) throw new IllegalArgumentException ( "All arrays must be of the same size" ) ; for ( int i = 0 ; i < size ; ++ i ) { row [ i ] = getInt ( ) ; column [ i ] = getInt ( ) ; } } | Reads a pattern matrix |
36,216 | public void readCoordinate ( int [ ] row , int [ ] column , double [ ] dataR , double [ ] dataI ) throws IOException { int size = row . length ; if ( size != column . length || size != dataR . length || size != dataI . length ) throw new IllegalArgumentException ( "All arrays must be of the same size" ) ; for ( int i =... | Reads a coordinate matrix . First data array contains real entries and the second contains imaginary entries |
36,217 | private float getFloat ( ) throws IOException { st . nextToken ( ) ; if ( st . ttype == StreamTokenizer . TT_WORD ) return Float . parseFloat ( st . sval ) ; else if ( st . ttype == StreamTokenizer . TT_EOF ) throw new EOFException ( "End-of-File encountered during parsing" ) ; else throw new IOException ( "Unknown tok... | Reads a float |
36,218 | private int getDiagSize ( int diagonal ) { if ( diagonal < 0 ) return Math . min ( numRows + diagonal , numColumns ) ; else return Math . min ( numRows , numColumns - diagonal ) ; } | Finds the size of the requested diagonal to be allocated |
36,219 | public PermutationMatrix getP ( ) { PermutationMatrix perm = PermutationMatrix . fromPartialPivots ( piv ) ; perm . transpose ( ) ; return perm ; } | Returns the permutation matrix . |
36,220 | public QRP factor ( Matrix A ) { if ( Q . numRows ( ) != A . numRows ( ) ) throw new IllegalArgumentException ( "Q.numRows() != A.numRows()" ) ; else if ( R . numColumns ( ) != A . numColumns ( ) ) throw new IllegalArgumentException ( "R.numColumns() != A.numColumns()" ) ; Afact . zero ( ) ; for ( MatrixEntry e : A ) {... | Executes a QR factorization for the given matrix . |
36,221 | public void apply ( Matrix H , int column , int i1 , int i2 ) { double temp = c * H . get ( i1 , column ) + s * H . get ( i2 , column ) ; H . set ( i2 , column , - s * H . get ( i1 , column ) + c * H . get ( i2 , column ) ) ; H . set ( i1 , column , temp ) ; } | Applies the Givens rotation to two elements in a matrix column |
36,222 | public void apply ( Vector x , int i1 , int i2 ) { double temp = c * x . get ( i1 ) + s * x . get ( i2 ) ; x . set ( i2 , - s * x . get ( i1 ) + c * x . get ( i2 ) ) ; x . set ( i1 , temp ) ; } | Applies the Givens rotation to two elements of a vector |
36,223 | public static LQ factorize ( Matrix A ) { return new LQ ( A . numRows ( ) , A . numColumns ( ) ) . factor ( new DenseMatrix ( A ) ) ; } | Convenience method to compute a LQ decomposition |
36,224 | private void validate ( ) { if ( isDense ( ) && isPattern ( ) ) throw new IllegalArgumentException ( "Matrix cannot be dense with pattern storage" ) ; if ( isReal ( ) && isHermitian ( ) ) throw new IllegalArgumentException ( "Data cannot be real with hermitian symmetry" ) ; if ( ! isComplex ( ) && isHermitian ( ) ) thr... | Validates the representation |
36,225 | public static RQ factorize ( Matrix A ) { return new RQ ( A . numRows ( ) , A . numColumns ( ) ) . factor ( new DenseMatrix ( A ) ) ; } | Convenience method to compute an RQ decomposition |
36,226 | public void setRestart ( int restart ) { this . restart = restart ; if ( restart <= 0 ) throw new IllegalArgumentException ( "restart must be a positive integer" ) ; s = new DenseVector ( restart + 1 ) ; H = new DenseMatrix ( restart + 1 , restart ) ; rotation = new GivensRotation [ restart + 1 ] ; v = new Vector [ res... | Sets the restart parameter |
36,227 | private static void scatter ( SparseVector v , double [ ] z ) { int [ ] index = v . getIndex ( ) ; int used = v . getUsed ( ) ; double [ ] data = v . getData ( ) ; Arrays . fill ( z , 0 ) ; for ( int i = 0 ; i < used ; ++ i ) z [ index [ i ] ] = data [ i ] ; } | Copies the sparse vector into a dense array |
36,228 | private void gather ( double [ ] z , SparseVector v , double taui , int d ) { int nl = 0 , nu = 0 ; for ( VectorEntry e : v ) { if ( e . index ( ) < d ) nl ++ ; else if ( e . index ( ) > d ) nu ++ ; } v . zero ( ) ; lower . clear ( ) ; for ( int i = 0 ; i < d ; ++ i ) if ( Math . abs ( z [ i ] ) > taui ) lower . add ( ... | Copies the dense array back into the sparse vector applying a numerical dropping rule and keeping only a given number of entries |
36,229 | public void setEigenvalues ( double eigmin , double eigmax ) { this . eigmin = eigmin ; this . eigmax = eigmax ; if ( eigmin <= 0 ) throw new IllegalArgumentException ( "eigmin <= 0" ) ; if ( eigmax <= 0 ) throw new IllegalArgumentException ( "eigmax <= 0" ) ; if ( eigmin > eigmax ) throw new IllegalArgumentException (... | Sets the eigenvalue estimates . |
36,230 | private static void checkKhatriRaoArguments ( Matrix A , Matrix B ) { if ( A . numColumns ( ) != B . numColumns ( ) ) throw new IndexOutOfBoundsException ( "A.numColumns != B.numColumns (" + A . numColumns ( ) + " != " + B . numColumns ( ) + ")" ) ; } | Tests if the matrices have an equal number of columns . |
36,231 | public void printMatrixSize ( MatrixSize size , MatrixInfo info ) { format ( Locale . ENGLISH , "%10d %10d" , size . numRows ( ) , size . numColumns ( ) ) ; if ( info . isCoordinate ( ) ) format ( Locale . ENGLISH , " %19d" , size . numEntries ( ) ) ; println ( ) ; } | Prints the matrix size |
36,232 | public void printMatrixSize ( MatrixSize size ) { format ( Locale . ENGLISH , "%10d %10d %19d%n" , size . numRows ( ) , size . numColumns ( ) , size . numEntries ( ) ) ; } | Prints the matrix size . Assumes coordinate format |
36,233 | public void printVectorSize ( VectorSize size , VectorInfo info ) { format ( Locale . ENGLISH , "%10d" , size . size ( ) ) ; if ( info . isCoordinate ( ) ) format ( Locale . ENGLISH , " %19d" , size . numEntries ( ) ) ; println ( ) ; } | Prints the vector size |
36,234 | public void printVectorSize ( VectorSize size ) { format ( Locale . ENGLISH , "%10d %19d%n" , size . size ( ) , size . numEntries ( ) ) ; } | Prints the vector size . Assumes coordinate format |
36,235 | public void printArray ( double [ ] data ) { for ( int i = 0 ; i < data . length ; ++ i ) format ( Locale . ENGLISH , "% .12e%n" , data [ i ] ) ; } | Prints an array to the underlying stream . One entry per line . |
36,236 | public void printArray ( float [ ] dataR , float [ ] dataI ) { int size = dataR . length ; if ( size != dataI . length ) throw new IllegalArgumentException ( "All arrays must be of the same size" ) ; for ( int i = 0 ; i < size ; ++ i ) format ( Locale . ENGLISH , "% .12e % .12e%n" , dataR [ i ] , dataI [ i ] ) ; } | Prints an array to the underlying stream . One entry per line . The first array specifies the real entries and the second is the imaginary entries |
36,237 | public void printCoordinate ( int [ ] index , long [ ] data , int offset ) { int size = index . length ; if ( size != data . length ) throw new IllegalArgumentException ( "All arrays must be of the same size" ) ; for ( int i = 0 ; i < size ; ++ i ) format ( Locale . ENGLISH , "%10d %10d%n" , index [ i ] + offset , data... | Prints the coordinate format to the underlying stream . One index and entry on each line . The offset is added to the index typically this can transform from a 0 - based indicing to a 1 - based . |
36,238 | public void printCoordinate ( int [ ] index , float [ ] dataR , float [ ] dataI , int offset ) { int size = index . length ; if ( size != dataR . length || size != dataI . length ) throw new IllegalArgumentException ( "All arrays must be of the same size" ) ; for ( int i = 0 ; i < size ; ++ i ) format ( Locale . ENGLIS... | Prints the coordinate format to the underlying stream . One index and entry on each line . The offset is added to each index typically this can transform from a 0 - based indicing to a 1 - based . The first float array specifies the real entries and the second is the imaginary entries |
36,239 | public void printCoordinate ( int [ ] row , int [ ] column , float [ ] dataR , float [ ] dataI , int offset ) { int size = row . length ; if ( size != column . length || size != dataR . length || size != dataI . length ) throw new IllegalArgumentException ( "All arrays must be of the same size" ) ; for ( int i = 0 ; i ... | Prints the coordinate format to the underlying stream . One index pair and entry on each line . The offset is added to each index typically this can transform from a 0 - based indicing to a 1 - based . The first float array specifies the real entries and the second is the imaginary entries |
36,240 | public void printCoordinate ( int [ ] row , int [ ] column , long [ ] data , int offset ) { int size = row . length ; if ( size != column . length || size != data . length ) throw new IllegalArgumentException ( "All arrays must be of the same size" ) ; for ( int i = 0 ; i < size ; ++ i ) format ( Locale . ENGLISH , "%1... | Prints the coordinate format to the underlying stream . One index pair and entry on each line . The offset is added to each index typically this can transform from a 0 - based indicing to a 1 - based . |
36,241 | public void printPattern ( int [ ] row , int [ ] column , int offset ) { int size = row . length ; if ( size != column . length ) throw new IllegalArgumentException ( "All arrays must be of the same size" ) ; for ( int i = 0 ; i < size ; ++ i ) format ( Locale . ENGLISH , "%10d %10d%n" , row [ i ] + offset , column [ i... | Prints the coordinates to the underlying stream . One index pair on each line . The offset is added to each index typically this can transform from a 0 - based indicing to a 1 - based . |
36,242 | public void printPattern ( int [ ] index , int offset ) { int size = index . length ; for ( int i = 0 ; i < size ; ++ i ) format ( Locale . ENGLISH , "%10d%n" , index [ i ] + offset ) ; } | Prints the coordinates to the underlying stream . One index on each line . The offset is added to each index typically this can transform from a 0 - based indicing to a 1 - based . |
36,243 | public void printCoordinate ( int [ ] row , int [ ] column , float [ ] dataR , float [ ] dataI ) { printCoordinate ( row , column , dataR , dataI , 0 ) ; } | Prints the coordinate format to the underlying stream . One index pair and entry on each line . The first double array specifies the real entries and the second is the imaginary entries |
36,244 | public static QL factorize ( Matrix A ) { return new QL ( A . numRows ( ) , A . numColumns ( ) ) . factor ( new DenseMatrix ( A ) ) ; } | Convenience method to compute a QL decomposition |
36,245 | private static int [ ] findDiagonalIndices ( CompRowMatrix A ) { int [ ] rowptr = A . getRowPointers ( ) ; int [ ] colind = A . getColumnIndices ( ) ; int [ ] diagIndices = new int [ A . numRows ( ) ] ; for ( int i = 0 ; i < A . numRows ( ) ; ++ i ) { diagIndices [ i ] = no . uib . cipr . matrix . sparse . Arrays . bin... | Finds the diagonal indices of the matrix |
36,246 | private List < Set < Integer > > findNodeNeighborhood ( CompRowMatrix A , int [ ] diagind , double eps ) { N = new ArrayList < Set < Integer > > ( A . numRows ( ) ) ; int [ ] rowptr = A . getRowPointers ( ) ; int [ ] colind = A . getColumnIndices ( ) ; double [ ] data = A . getData ( ) ; for ( int i = 0 ; i < A . numRo... | Finds the strongly coupled node neighborhoods |
36,247 | private static boolean [ ] createInitialR ( CompRowMatrix A ) { boolean [ ] R = new boolean [ A . numRows ( ) ] ; int [ ] rowptr = A . getRowPointers ( ) ; int [ ] colind = A . getColumnIndices ( ) ; double [ ] data = A . getData ( ) ; for ( int i = 0 ; i < A . numRows ( ) ; ++ i ) { boolean hasOffDiagonal = false ; fo... | Creates the initial R - set by including only the connected nodes |
36,248 | private List < Set < Integer > > createInitialAggregates ( List < Set < Integer > > N , boolean [ ] R ) { C = new ArrayList < Set < Integer > > ( ) ; for ( int i = 0 ; i < R . length ; ++ i ) { if ( ! R [ i ] ) continue ; boolean free = true ; for ( int j : N . get ( i ) ) free &= R [ j ] ; if ( free ) { C . add ( new ... | Creates the initial aggregates |
36,249 | private static List < Set < Integer > > enlargeAggregates ( List < Set < Integer > > C , List < Set < Integer > > N , boolean [ ] R ) { List < List < Integer > > belong = new ArrayList < List < Integer > > ( R . length ) ; for ( int i = 0 ; i < R . length ; ++ i ) belong . add ( new ArrayList < Integer > ( ) ) ; for ( ... | Enlarges the aggregates |
36,250 | private static List < Set < Integer > > createFinalAggregates ( List < Set < Integer > > C , List < Set < Integer > > N , boolean [ ] R ) { for ( int i = 0 ; i < R . length ; ++ i ) { if ( ! R [ i ] ) continue ; Set < Integer > Cn = new HashSet < Integer > ( ) ; for ( int j : N . get ( i ) ) if ( R [ j ] ) { R [ j ] = ... | Creates final aggregates from the remaining unallocated nodes |
36,251 | public static SVD factorize ( Matrix A ) throws NotConvergedException { return new SVD ( A . numRows ( ) , A . numColumns ( ) ) . factor ( new DenseMatrix ( A ) ) ; } | Convenience method for computing a full SVD |
36,252 | public SVD factor ( DenseMatrix A ) throws NotConvergedException { if ( A . numRows ( ) != m ) throw new IllegalArgumentException ( "A.numRows() != m" ) ; else if ( A . numColumns ( ) != n ) throw new IllegalArgumentException ( "A.numColumns() != n" ) ; intW info = new intW ( 0 ) ; LAPACK . getInstance ( ) . dgesdd ( j... | Computes an SVD |
36,253 | public static int binarySearchGreater ( int [ ] index , int key , int begin , int end ) { return binarySearchInterval ( index , key , begin , end , true ) ; } | Searches for a key in a sorted array and returns an index to an element which is greater than or equal key . |
36,254 | public static int binarySearchSmaller ( int [ ] index , int key , int begin , int end ) { return binarySearchInterval ( index , key , begin , end , false ) ; } | Searches for a key in a sorted array and returns an index to an element which is smaller than or equal key . |
36,255 | public static int binarySearch ( int [ ] index , int key , int begin , int end ) { return java . util . Arrays . binarySearch ( index , begin , end , key ) ; } | Searches for a key in a subset of a sorted array . |
36,256 | public static int [ ] bandwidth ( int num , int [ ] ind ) { int [ ] nz = new int [ num ] ; for ( int i = 0 ; i < ind . length ; ++ i ) nz [ ind [ i ] ] ++ ; return nz ; } | Finds the number of repeated entries |
36,257 | public void setColumn ( int i , SparseVector x ) { if ( x . size ( ) != numRows ) throw new IllegalArgumentException ( "New column must be of the same size as existing column" ) ; colD [ i ] = x ; } | Sets the given column equal the passed vector |
36,258 | public void setRow ( int i , SparseVector x ) { if ( x . size ( ) != numColumns ) throw new IllegalArgumentException ( "New row must be of the same size as existing row" ) ; rowD [ i ] = x ; } | Sets the given row equal the passed vector |
36,259 | public double rcond ( Matrix A ) { if ( n != A . numRows ( ) ) throw new IllegalArgumentException ( "n != A.numRows()" ) ; if ( ! A . isSquare ( ) ) throw new IllegalArgumentException ( "!A.isSquare()" ) ; double anorm = A . norm ( Norm . One ) ; double [ ] work = new double [ 3 * n ] ; int [ ] iwork = new int [ n ] ; ... | Computes the reciprocal condition number |
36,260 | public static EVD factorize ( Matrix A ) throws NotConvergedException { return new EVD ( A . numRows ( ) ) . factor ( new DenseMatrix ( A ) ) ; } | Convenience method for computing the complete eigenvalue decomposition of the given matrix |
36,261 | public Matrix calcOrig ( ) { if ( ! Coordinates . equals ( getSource ( ) . getSize ( ) , getSize ( ) ) ) { throw new RuntimeException ( "Cannot change Matrix size. Use calc(Ret.NEW) or calc(Ret.LINK) instead." ) ; } long [ ] newCoordinates = new long [ position . length ] ; for ( long [ ] c : newContent . allCoordinate... | not the whole matrix |
36,262 | public Rectangle getCellRect ( int row , int column , boolean includeSpacing ) { Rectangle r = new Rectangle ( ) ; boolean valid = true ; if ( row < 0 ) { valid = false ; } else if ( row >= getRowCount ( ) ) { r . y = getHeight ( ) ; valid = false ; } else { r . height = getRowHeight ( row ) ; r . y = row * r . height ... | must be override otherwise it will iterate over all columns |
36,263 | public void addEvents ( Matrix events ) { int seriesCount = getSeriesCount ( ) ; for ( int r = 0 ; r < events . getRowCount ( ) ; r ++ ) { long timestamp = events . getAsLong ( r , 0 ) ; for ( int c = 1 ; c < events . getColumnCount ( ) ; c ++ ) { double value = events . getAsDouble ( r , c ) ; addEvent ( timestamp , s... | Adds the events of a new Matrix to the time series . The first column of the matrix must contain the timestamps . |
36,264 | public void fill ( final double [ ] [ ] data , final int startRow , final int startCol ) { final int rows = data . length ; final int cols = data [ 0 ] . length ; verifyTrue ( startRow < rows && startRow < getRowCount ( ) , "illegal startRow: %s" , startRow ) ; verifyTrue ( startCol < cols && startCol < getColumnCount ... | Populate matrix with given data . |
36,265 | double [ ] getBlockData ( int row , int column ) { int blockNumber = layout . getBlockNumber ( row , column ) ; double [ ] block = data [ blockNumber ] ; if ( null == block ) { block = new double [ layout . getBlockSize ( row , column ) ] ; data [ blockNumber ] = block ; } return data [ blockNumber ] ; } | Get block holding the specified row and column . If none exist create one . |
36,266 | public Matrix mtimes ( Matrix m2 ) { if ( m2 instanceof DenseDoubleMatrix2D ) { final DenseDoubleMatrix2D result = new BlockDenseDoubleMatrix2D ( ( int ) getRowCount ( ) , ( int ) m2 . getColumnCount ( ) , layout . blockStripe , BlockOrder . ROWMAJOR ) ; Mtimes . DENSEDOUBLEMATRIX2D . calc ( this , ( DenseDoubleMatrix2... | Shortcut to create a BlockMatrix for target |
36,267 | public static final int nextInteger ( int min , int max ) { return min == max ? min : min + getRandom ( ) . nextInt ( max - min ) ; } | Returns a random value in the desired interval |
36,268 | public final < V > SynchronizedGenericMatrix < V > synchronizedMatrix ( GenericMatrix < V > matrix ) { return new SynchronizedGenericMatrix < V > ( matrix ) ; } | Wraps another Matrix so that all methods are executed synchronized . |
36,269 | public static boolean canSwapRows ( Matrix matrix , int row1 , int row2 , int col1 ) { boolean response = true ; for ( int col = 0 ; col < col1 ; ++ col ) { if ( 0 == matrix . getAsDouble ( row1 , col ) ) { if ( 0 != matrix . getAsDouble ( row2 , col ) ) { response = false ; break ; } } } return response ; } | Check to see if a non - zero and a zero value in the rows leading up to this column can be swapped . This is part of the bandwidth reduction algorithm . |
36,270 | public static boolean canSwapCols ( Matrix matrix , int col1 , int col2 , int row1 ) { boolean response = true ; for ( int row = row1 + 1 ; row < matrix . getRowCount ( ) ; ++ row ) { if ( 0 == matrix . getAsDouble ( row , col1 ) ) { if ( 0 != matrix . getAsDouble ( row , col2 ) ) { response = false ; break ; } } } ret... | Check to see if columns can be swapped - part of the bandwidth reduction algorithm . |
36,271 | public static Matrix reduce ( Matrix source ) { Matrix response = Matrix . Factory . zeros ( source . getRowCount ( ) , 1 ) ; for ( int row = 0 ; row < source . getRowCount ( ) ; ++ row ) { response . setAsDouble ( row , row , 0 ) ; } return source . getRowCount ( ) == source . getColumnCount ( ) ? Ginv . reduce ( sour... | Mathematical operator to reduce the bandwidth of a HusoMatrix . The HusoMatrix must be a square HusoMatrix or no operations are performed . |
36,272 | public Matrix [ ] svd ( ) { GMatrix m = ( GMatrix ) matrix . clone ( ) ; int nrows = ( int ) getRowCount ( ) ; int ncols = ( int ) getColumnCount ( ) ; GMatrix u = new GMatrix ( nrows , nrows ) ; GMatrix s = new GMatrix ( nrows , ncols ) ; GMatrix v = new GMatrix ( ncols , ncols ) ; m . SVD ( u , s , v ) ; Matrix U = n... | in S all entries on the diagonal are 1 |
36,273 | public Matrix [ ] lu ( ) { if ( isSquare ( ) ) { GMatrix m = ( GMatrix ) matrix . clone ( ) ; GMatrix lu = ( GMatrix ) matrix . clone ( ) ; GVector piv = new GVector ( matrix . getNumCol ( ) ) ; m . LUD ( lu , piv ) ; Matrix l = new VecMathDenseDoubleMatrix2D ( lu ) . tril ( Ret . NEW , 0 ) ; for ( int i = ( int ) l . ... | non - singular matrices only |
36,274 | private int selectBlocksPerTaskDimJ ( int blockStripe , int iMax , int jMax , int kMax ) { int adjust = ( jMax % blockStripe > 0 ) ? 1 : 0 ; if ( jMax < ( 5 * blockStripe ) || jMax <= iMax ) { return jMax / blockStripe + adjust ; } else { return Math . max ( 1 , ( jMax / blockStripe + adjust ) / 2 ) ; } } | - if set too large then may not fully exploit parallelism |
36,275 | public String initializedGroupStatus ( ) throws Exception { String status = null ; if ( clusteringEnabled ) { initClusterNodeStatus ( ) ; status = updateNodeStatus ( ) ; } return status ; } | Called from ClusterSyncManagerLeaderListener |
36,276 | @ SuppressWarnings ( "unchecked" ) protected void restoreState ( Object [ ] objects ) { if ( objects != null && objects . length != 0 ) { variable = ( Variable ) objects [ 0 ] ; constants = ( List < Variable > ) objects [ 1 ] ; lastObjectHash = ( Map < String , Object > ) objects [ 2 ] ; } } | This method is used to restore from the persisted state |
36,277 | private static final long gatherLongLE ( final byte [ ] data , final int index ) { int i1 = gatherIntLE ( data , index ) ; long l2 = gatherIntLE ( data , index + 4 ) ; return uintToLong ( i1 ) | ( l2 << 32 ) ; } | gather a long from the specified index into the byte array |
36,278 | private static final long gatherPartialLongLE ( final byte [ ] data , final int index , final int available ) { if ( available >= 4 ) { int i = gatherIntLE ( data , index ) ; long l = uintToLong ( i ) ; int left = available - 4 ; if ( left == 0 ) { return l ; } int i2 = gatherPartialIntLE ( data , index + 4 , left ) ; ... | gather a partial long from the specified index using the specified number of bytes into the byte array |
36,279 | private static final int gatherIntLE ( final byte [ ] data , final int index ) { int i = data [ index ] & 0xFF ; i |= ( data [ index + 1 ] & 0xFF ) << 8 ; i |= ( data [ index + 2 ] & 0xFF ) << 16 ; i |= ( data [ index + 3 ] << 24 ) ; return i ; } | gather an int from the specified index into the byte array |
36,280 | private static final int gatherPartialIntLE ( final byte [ ] data , final int index , final int available ) { int i = data [ index ] & 0xFF ; if ( available > 1 ) { i |= ( data [ index + 1 ] & 0xFF ) << 8 ; if ( available > 2 ) { i |= ( data [ index + 2 ] & 0xFF ) << 16 ; } } return i ; } | gather a partial int from the specified index using the specified number of bytes into the byte array |
36,281 | public static Map < Method , Method > findManagedMethods ( Class < ? > clazz ) { Map < Method , Method > result = new HashMap < > ( ) ; for ( Method method : clazz . getMethods ( ) ) { if ( method . isSynthetic ( ) || method . isBridge ( ) ) { continue ; } Method managedMethod = findManagedMethod ( clazz , method . get... | Find methods that are tagged as managed somewhere in the hierarchy |
36,282 | public Map < String , Exception > unexportAllAndReportMissing ( ) { Map < String , Exception > errors = new HashMap < > ( ) ; synchronized ( exportedObjects ) { List < ObjectName > toRemove = new ArrayList < > ( exportedObjects . size ( ) ) ; for ( ObjectName objectName : exportedObjects . keySet ( ) ) { try { server .... | Unexports all MBeans that have been exported through this MBeanExporter . |
36,283 | public static int byteArrayToInt ( final byte [ ] byteArray , final int startPos , final int length ) { if ( byteArray == null ) { throw new IllegalArgumentException ( "Parameter 'byteArray' cannot be null" ) ; } if ( length <= 0 || length > 4 ) { throw new IllegalArgumentException ( "Length must be between 1 and 4. Le... | Method used to convert byte array to int |
36,284 | private static String formatByte ( final byte [ ] pByte , final boolean pSpace , final boolean pTruncate ) { String result ; if ( pByte == null ) { result = "" ; } else { int i = 0 ; if ( pTruncate ) { while ( i < pByte . length && pByte [ i ] == 0 ) { i ++ ; } } if ( i < pByte . length ) { int sizeMultiplier = pSpace ... | Private method to format bytes to hexa string |
36,285 | public static byte [ ] fromString ( final String pData ) { if ( pData == null ) { throw new IllegalArgumentException ( "Argument can't be null" ) ; } StringBuilder sb = new StringBuilder ( pData ) ; int j = 0 ; for ( int i = 0 ; i < sb . length ( ) ; i ++ ) { if ( ! Character . isWhitespace ( sb . charAt ( i ) ) ) { sb... | Method to get bytes form string |
36,286 | public static boolean matchBitByBitIndex ( final int pVal , final int pBitIndex ) { if ( pBitIndex < 0 || pBitIndex > MAX_BIT_INTEGER ) { throw new IllegalArgumentException ( "parameter 'pBitIndex' must be between 0 and 31. pBitIndex=" + pBitIndex ) ; } return ( pVal & 1 << pBitIndex ) != 0 ; } | Test if bit at given index of given value is = 1 . |
36,287 | public static byte setBit ( final byte pData , final int pBitIndex , final boolean pOn ) { if ( pBitIndex < 0 || pBitIndex > 7 ) { throw new IllegalArgumentException ( "parameter 'pBitIndex' must be between 0 and 7. pBitIndex=" + pBitIndex ) ; } byte ret = pData ; if ( pOn ) { ret |= 1 << pBitIndex ; } else { ret &= ~ ... | Method used to set a bit index to 1 or 0 . |
36,288 | public static String toBinary ( final byte [ ] pBytes ) { String ret = null ; if ( pBytes != null && pBytes . length > 0 ) { BigInteger val = new BigInteger ( bytesToStringNoSpace ( pBytes ) , HEXA ) ; StringBuilder build = new StringBuilder ( val . toString ( 2 ) ) ; for ( int i = build . length ( ) ; i < pBytes . len... | Convert byte array to binary String |
36,289 | public byte [ ] getData ( ) { byte [ ] ret = new byte [ byteTab . length ] ; System . arraycopy ( byteTab , 0 , ret , 0 , byteTab . length ) ; return ret ; } | Method to get all data |
36,290 | public byte getMask ( final int pIndex , final int pLength ) { byte ret = ( byte ) DEFAULT_VALUE ; ret = ( byte ) ( ret << pIndex ) ; ret = ( byte ) ( ( ret & DEFAULT_VALUE ) >> pIndex ) ; int dec = BYTE_SIZE - ( pLength + pIndex ) ; if ( dec > 0 ) { ret = ( byte ) ( ret >> dec ) ; ret = ( byte ) ( ret << dec ) ; } ret... | This method is used to get a mask dynamically |
36,291 | public byte [ ] getNextByte ( final int pSize , final boolean pShift ) { byte [ ] tab = new byte [ ( int ) Math . ceil ( pSize / BYTE_SIZE_F ) ] ; if ( currentBitIndex % BYTE_SIZE != 0 ) { int index = 0 ; int max = currentBitIndex + pSize ; while ( currentBitIndex < max ) { int mod = currentBitIndex % BYTE_SIZE ; int m... | Method to get The next bytes with the specified size |
36,292 | public Date getNextDate ( final int pSize , final String pPattern , final boolean pUseBcd ) { Date date = null ; SimpleDateFormat sdf = new SimpleDateFormat ( pPattern ) ; String dateTxt = null ; if ( pUseBcd ) { dateTxt = getNextHexaString ( pSize ) ; } else { dateTxt = getNextString ( pSize ) ; } try { date = sdf . p... | Method to get the next date |
36,293 | public long getNextLongSigned ( final int pLength ) { if ( pLength > Long . SIZE ) { throw new IllegalArgumentException ( "Long overflow with length > 64" ) ; } long decimal = getNextLong ( pLength ) ; long signMask = 1 << pLength - 1 ; if ( ( decimal & signMask ) != 0 ) { return - ( signMask - ( signMask ^ decimal ) )... | Method used to get get a signed long with the specified size |
36,294 | public long getNextLong ( final int pLength ) { ByteBuffer buffer = ByteBuffer . allocate ( BYTE_SIZE * 2 ) ; long finalValue = 0 ; long currentValue = 0 ; int readSize = pLength ; int max = currentBitIndex + pLength ; while ( currentBitIndex < max ) { int mod = currentBitIndex % BYTE_SIZE ; currentValue = byteTab [ cu... | This method is used to get a long with the specified size |
36,295 | public String getNextString ( final int pSize , final Charset pCharset ) { return new String ( getNextByte ( pSize , true ) , pCharset ) ; } | This method is used to get the next String with the specified size |
36,296 | public void resetNextBits ( final int pLength ) { int max = currentBitIndex + pLength ; while ( currentBitIndex < max ) { int mod = currentBitIndex % BYTE_SIZE ; int length = Math . min ( max - currentBitIndex , BYTE_SIZE - mod ) ; byteTab [ currentBitIndex / BYTE_SIZE ] &= ~ getMask ( mod , length ) ; currentBitIndex ... | Set to 0 the next N bits |
36,297 | public void setNextByte ( final byte [ ] pValue , final int pLength , final boolean pPadBefore ) { int totalSize = ( int ) Math . ceil ( pLength / BYTE_SIZE_F ) ; ByteBuffer buffer = ByteBuffer . allocate ( totalSize ) ; int size = Math . max ( totalSize - pValue . length , 0 ) ; if ( pPadBefore ) { for ( int i = 0 ; i... | Method to write bytes with the max length |
36,298 | public void setNextDate ( final Date pValue , final String pPattern , final boolean pUseBcd ) { SimpleDateFormat sdf = new SimpleDateFormat ( pPattern ) ; String value = sdf . format ( pValue ) ; if ( pUseBcd ) { setNextHexaString ( value , value . length ( ) * 4 ) ; } else { setNextString ( value , value . length ( ) ... | Method to write a date |
36,299 | public void setNextLong ( final long pValue , final int pLength ) { if ( pLength > Long . SIZE ) { throw new IllegalArgumentException ( "Long overflow with length > 64" ) ; } setNextValue ( pValue , pLength , Long . SIZE - 1 ) ; } | Add Long to the current position with the specified size |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.