BlockMatrix64F matrix = new BlockMatrix64F(10, 10); matrix.set(0,1,10); matrix.set(1,0,20); matrix.set(1,1,30); System.out.println("Value="+matrix.get(1,0));
public void reshape(int numRows, int numCols, int blockLength , boolean saveValues) { this.blockLength = blockLength; this.reshape(numRows,numCols,saveValues); }
@Override public double unsafe_get( int row, int col) { return data[ getIndex(row,col)]; }
public BlockMatrix64F copy() { BlockMatrix64F A = new BlockMatrix64F(numRows,numCols,blockLength); A.set(this); return A; } }
public static BlockMatrix64F wrap( double data[] , int numRows , int numCols , int blockLength ) { BlockMatrix64F ret = new BlockMatrix64F(); ret.data = data; ret.numRows = numRows; ret.numCols = numCols; ret.blockLength = blockLength; return ret; }
@Override public BlockMatrix64F getT(BlockMatrix64F T) { if( T == null ) return this.T; T.set(this.T); return T; }
@Override public void reshape(int numRows, int numCols, boolean saveValues) { if( numRows*numCols <= data.length ) { this.numRows = numRows; this.numCols = numCols; } else { double[] data = new double[ numRows*numCols ]; if( saveValues ) { System.arraycopy(this.data,0,data,0,getNumElements()); } this.numRows = numRows; this.numCols = numCols; this.data = data; } }
public static BlockMatrix64F wrap( double data[] , int numRows , int numCols , int blockLength ) { BlockMatrix64F ret = new BlockMatrix64F(); ret.data = data; ret.numRows = numRows; ret.numCols = numCols; ret.blockLength = blockLength; return ret; }
public BlockMatrix64F copy() { BlockMatrix64F A = new BlockMatrix64F(numRows,numCols,blockLength); A.set(this); return A; } }
@Override public BlockMatrix64F getT(BlockMatrix64F T) { if( T == null ) return this.T; T.set(this.T); return T; }
@Override public void reshape(int numRows, int numCols, boolean saveValues) { if( numRows*numCols <= data.length ) { this.numRows = numRows; this.numCols = numCols; } else { double[] data = new double[ numRows*numCols ]; if( saveValues ) { System.arraycopy(this.data,0,data,0,getNumElements()); } this.numRows = numRows; this.numCols = numCols; this.data = data; } }
@Override public BlockMatrix64F getT(BlockMatrix64F T) { if( T == null ) { T = new BlockMatrix64F(A.numRows,A.numCols,A.blockLength); } else { if( T.numRows != A.numRows || T.numCols != A.numCols ) throw new IllegalArgumentException("T must have the same dimensions as the input matrix"); CommonOps.fill(T, 0); } T.set(0,0,A.data[0]); for( int i = 1; i < A.numRows; i++ ) { double d = A.get(i-1,i); T.set(i,i,A.get(i,i)); T.set(i-1,i,d); T.set(i,i-1,d); } return T; }
public static BlockMatrix64F createRandom( int numRows , int numCols , double min , double max , Random rand , int blockLength ) { BlockMatrix64F ret = new BlockMatrix64F(numRows,numCols,blockLength); RandomMatrices.setRandom(ret,min,max,rand); return ret; }
public void reshape(int numRows, int numCols, int blockLength , boolean saveValues) { this.blockLength = blockLength; this.reshape(numRows,numCols,saveValues); }
@Override public BlockMatrix64F getT(BlockMatrix64F T) { if( T == null ) return this.T; T.set(this.T); return T; }
@Override public void unsafe_set( int row, int col, double val) { data[ getIndex(row,col)] = val; }
@Override public BlockMatrix64F getT(BlockMatrix64F T) { if( T == null ) { T = new BlockMatrix64F(A.numRows,A.numCols,A.blockLength); } else { if( T.numRows != A.numRows || T.numCols != A.numCols ) throw new IllegalArgumentException("T must have the same dimensions as the input matrix"); CommonOps.fill(T, 0); } T.set(0,0,A.data[0]); for( int i = 1; i < A.numRows; i++ ) { double d = A.get(i-1,i); T.set(i,i,A.get(i,i)); T.set(i-1,i,d); T.set(i,i-1,d); } return T; }