@Test public void testcopy() { Matrix M = new Matrix(11, 10); M.randomize(); boolean[] rsel = new boolean[M.getRowsCount()]; boolean[] csel = new boolean[M.getColumnsCount()]; for (int i = 0; i < rsel.length; ++i) { if (i % 3 == 0) { rsel[i] = true; } } for (int i = 0; i < csel.length; ++i) { if (i % 2 == 0) { csel[i] = true; } } Matrix M2 = M.clone(); int[] irsel = new int[]{1, 2, 3, 5}; int[] icsel = new int[]{1, 3, 5, 8}; Matrix mr = Matrix.selectRows(M.subMatrix(), rsel); M2.subMatrix().copyRows(mr.subMatrix(), rsel); assertTrue(M2.equals(M)); Matrix mc = Matrix.selectColumns(M.subMatrix(), csel); M2.subMatrix().copyColumns(mc.subMatrix(), csel); assertTrue(M2.equals(M)); Matrix m = Matrix.select(M.subMatrix(), rsel, csel); M2.subMatrix().copy(m.subMatrix(), rsel, csel); assertTrue(M2.equals(M)); mr = Matrix.selectRows(M.subMatrix(), irsel); M2.subMatrix().copyRows(mr.subMatrix(), irsel); assertTrue(M2.equals(M)); mc = Matrix.selectColumns(M.subMatrix(), icsel); M2.subMatrix().copyColumns(mc.subMatrix(), icsel); assertTrue(M2.equals(M)); m = Matrix.select(M.subMatrix(), irsel, icsel); M2.subMatrix().copy(m.subMatrix(), irsel, icsel); assertTrue(M2.equals(M)); }
public void copy(Matrix C) { System.arraycopy(C.data_, 0, data_, 0, data_.length); }
Matrix implements Cloneable { public void copy(Matrix C) { System.arraycopy(C.data_, 0, data_, 0, data_.length); } }
Matrix implements Cloneable { public void copy(Matrix C) { System.arraycopy(C.data_, 0, data_, 0, data_.length); } Matrix(final double[] data, final int nrows, final int ncols);  Matrix(final int nrows, final int ncols);  Matrix(final SubMatrix sm); }
Matrix implements Cloneable { public void copy(Matrix C) { System.arraycopy(C.data_, 0, data_, 0, data_.length); } Matrix(final double[] data, final int nrows, final int ncols);  Matrix(final int nrows, final int ncols);  Matrix(final SubMatrix sm); static Matrix diagonal(final double[] d); static Matrix diagonal(final IReadDataBlock d); static Matrix diff(int n, int lag, int d); static Matrix diff(int n, Polynomial D); static Matrix identity(final int n); static Matrix square(final int n); static Matrix select(SubMatrix m, boolean[] rsel, boolean[] csel); static Matrix select(SubMatrix m, int[] rsel, int[] csel); static Matrix selectRows(SubMatrix m, boolean[] rsel); static Matrix selectRows(SubMatrix m, int[] rsel); static Matrix selectColumns(SubMatrix m, boolean[] csel); static Matrix selectColumns(SubMatrix m, int[] csel); void add(final double r); void add(final int row, final int col, final double val); void add(final Matrix M); void chs(); void clean(double epsilon); void clear(); @Override Matrix clone(); DataBlock column(final int col); List<DataBlock> columnList(); DataBlockIterator columns(); void copyTo(final double[] buffer, final int start); DataBlock diagonal(); DataBlock subDiagonal(int pos); DataBlock skewDiagonal(int pos); double get(final int row, final int col); int getColumnsCount(); int getRowsCount(); double[] internalStorage(); boolean isZero(double eps); boolean isDiagonal(double eps); boolean isZero(); boolean isDiagonal(); boolean isSquare(); Matrix minus(final double r); Matrix minus(final Matrix Y); void mul(final double r); void mul(final int row, final int col, final double val); double nrm2(); Matrix plus(final double r); Matrix plus(final Matrix Y); void randomize(); void randomize(int seed); DataBlock row(final int row); List<DataBlock> rowList(); DataBlockIterator rows(); void set(double value); void set(final int row, final int col, final double value); void set(MatrixFunction fn); void set(MatrixRelativeFunction fn); void add(MatrixFunction fn); void add(MatrixRelativeFunction fn); double ssq(); void sub(final double r); void sub(final Matrix M); SubMatrix all(); @Deprecated SubMatrix subMatrix(); SubMatrix subMatrix(final int r0, final int r1, final int c0,
            final int c1); double sum(); Matrix times(final double r); Matrix times(final Matrix Y); double dot(Matrix m); static Matrix rsolve(SubMatrix S, SubMatrix B); static Matrix lsolve(SubMatrix S, SubMatrix B); void toLower(); void toUpper(); Matrix transpose(); void addAY(double a, Matrix Y); void addXaXt(double a, DataBlock x); void addXaYt(double a, DataBlock x, DataBlock y); boolean isEmpty(); @Override String toString(); String toString(String fmt); @Override boolean equals(Object obj); boolean equals(Matrix other); boolean equals(Matrix other, double eps); @Override int hashCode(); int rank(); void permuteColumns(final int i, final int j); void permuteRows(final int i, final int j); void copy(Matrix C); double distance(Matrix m); void smooth(double eps); SubMatrix topLeft(); SubMatrix topLeft(int nr, int nc); SubMatrix bottomRight(); SubMatrix bottomRight(int nr, int nc); }
Matrix implements Cloneable { public void copy(Matrix C) { System.arraycopy(C.data_, 0, data_, 0, data_.length); } Matrix(final double[] data, final int nrows, final int ncols);  Matrix(final int nrows, final int ncols);  Matrix(final SubMatrix sm); static Matrix diagonal(final double[] d); static Matrix diagonal(final IReadDataBlock d); static Matrix diff(int n, int lag, int d); static Matrix diff(int n, Polynomial D); static Matrix identity(final int n); static Matrix square(final int n); static Matrix select(SubMatrix m, boolean[] rsel, boolean[] csel); static Matrix select(SubMatrix m, int[] rsel, int[] csel); static Matrix selectRows(SubMatrix m, boolean[] rsel); static Matrix selectRows(SubMatrix m, int[] rsel); static Matrix selectColumns(SubMatrix m, boolean[] csel); static Matrix selectColumns(SubMatrix m, int[] csel); void add(final double r); void add(final int row, final int col, final double val); void add(final Matrix M); void chs(); void clean(double epsilon); void clear(); @Override Matrix clone(); DataBlock column(final int col); List<DataBlock> columnList(); DataBlockIterator columns(); void copyTo(final double[] buffer, final int start); DataBlock diagonal(); DataBlock subDiagonal(int pos); DataBlock skewDiagonal(int pos); double get(final int row, final int col); int getColumnsCount(); int getRowsCount(); double[] internalStorage(); boolean isZero(double eps); boolean isDiagonal(double eps); boolean isZero(); boolean isDiagonal(); boolean isSquare(); Matrix minus(final double r); Matrix minus(final Matrix Y); void mul(final double r); void mul(final int row, final int col, final double val); double nrm2(); Matrix plus(final double r); Matrix plus(final Matrix Y); void randomize(); void randomize(int seed); DataBlock row(final int row); List<DataBlock> rowList(); DataBlockIterator rows(); void set(double value); void set(final int row, final int col, final double value); void set(MatrixFunction fn); void set(MatrixRelativeFunction fn); void add(MatrixFunction fn); void add(MatrixRelativeFunction fn); double ssq(); void sub(final double r); void sub(final Matrix M); SubMatrix all(); @Deprecated SubMatrix subMatrix(); SubMatrix subMatrix(final int r0, final int r1, final int c0,
            final int c1); double sum(); Matrix times(final double r); Matrix times(final Matrix Y); double dot(Matrix m); static Matrix rsolve(SubMatrix S, SubMatrix B); static Matrix lsolve(SubMatrix S, SubMatrix B); void toLower(); void toUpper(); Matrix transpose(); void addAY(double a, Matrix Y); void addXaXt(double a, DataBlock x); void addXaYt(double a, DataBlock x, DataBlock y); boolean isEmpty(); @Override String toString(); String toString(String fmt); @Override boolean equals(Object obj); boolean equals(Matrix other); boolean equals(Matrix other, double eps); @Override int hashCode(); int rank(); void permuteColumns(final int i, final int j); void permuteRows(final int i, final int j); void copy(Matrix C); double distance(Matrix m); void smooth(double eps); SubMatrix topLeft(); SubMatrix topLeft(int nr, int nc); SubMatrix bottomRight(); SubMatrix bottomRight(int nr, int nc);  }