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 .