public static void extract(DMatrix src, int srcY0, int srcX0, DMatrix dst, int dstY0, int dstX0, int numRows, int numCols ) { for( int y = 0; y < numRows; y++ ) { for( int x = 0; x < numCols; x++ ) { double v = src.get(y+srcY0,x+srcX0); dst.set(dstY0+y , dstX0 +x, v); } } } }
public static void setRandom(DMatrix a , double min , double max , Random rand ) { for( int i = 0; i < a.getNumRows(); i++ ) { for( int j = 0; j < a.getNumCols(); j++ ) { double val = rand.nextDouble()*(max-min)+min; a.set(i,j,val); } } } }
public static void copy(DMatrix from , DMatrix to ) { int numCols = from.getNumCols(); int numRows = from.getNumRows(); for( int i = 0; i < numRows; i++ ) { for( int j = 0; j < numCols; j++ ) { to.set(i,j,from.get(i,j)); } } }