@Test public void testArray() { final double[] original = new double[]{ 1D, 2D, 3D, 4D, 5D, 6D }; final Matrix matrix = Matrix.array(original, 2); assertNotSame(original, matrix.getArray()); assertEquals(matrix.getRow(), 2); assertEquals(matrix.getCol(), 3); }
public static Matrix array(@NonNull double[][] arrays) { verifyArrays(arrays); final int row = arrays.length; final int col = arrays[0].length; final double[] array = new double[row * col]; for (int i = 0; i < row; ++i) { System.arraycopy(arrays[i], 0, array, i * col, col); } return Matrix.array(array, row); }
Matrix implements Serializable { public static Matrix array(@NonNull double[][] arrays) { verifyArrays(arrays); final int row = arrays.length; final int col = arrays[0].length; final double[] array = new double[row * col]; for (int i = 0; i < row; ++i) { System.arraycopy(arrays[i], 0, array, i * col, col); } return Matrix.array(array, row); } }
Matrix implements Serializable { public static Matrix array(@NonNull double[][] arrays) { verifyArrays(arrays); final int row = arrays.length; final int col = arrays[0].length; final double[] array = new double[row * col]; for (int i = 0; i < row; ++i) { System.arraycopy(arrays[i], 0, array, i * col, col); } return Matrix.array(array, row); } private  Matrix(double[] array, int row, int  col); }
Matrix implements Serializable { public static Matrix array(@NonNull double[][] arrays) { verifyArrays(arrays); final int row = arrays.length; final int col = arrays[0].length; final double[] array = new double[row * col]; for (int i = 0; i < row; ++i) { System.arraycopy(arrays[i], 0, array, i * col, col); } return Matrix.array(array, row); } private  Matrix(double[] array, int row, int  col); int[] shape(); double[] getArray(); double[][] getArrays(); Matrix copy(); int getRow(); int getCol(); double get(int i, int j); void set(int i, int j, double value); Matrix times(@NonNull Matrix matrix); Matrix times(double num); Matrix timesTo(double num); Matrix timesTo(@NonNull Matrix matrix); Matrix plus(@NonNull Matrix matrix); Matrix plusTo(@NonNull Matrix matrix); Matrix minus(@NonNull Matrix matrix); Matrix minusTo(@NonNull Matrix matrix); Matrix dot(@NonNull Matrix matrix); Matrix transpose(); static Matrix array(@NonNull double[][] arrays); static Matrix array(@NonNull double[] array, int row); static Matrix randn(int row, int col); static Matrix plus(@NonNull Matrix a, @NonNull Matrix b); static Matrix plusTo(@NonNull Matrix a,@NonNull Matrix b); static Matrix minus(@NonNull Matrix a,@NonNull Matrix b); static Matrix minusTo(@NonNull Matrix a, @NonNull Matrix b); static Matrix times(@NonNull Matrix a, @NonNull Matrix b); static Matrix times(@NonNull Matrix matrix, double num); static Matrix timesTo(@NonNull Matrix matrix, double num); static Matrix timesTo(@NonNull Matrix a, @NonNull Matrix b); static Matrix dot(@NonNull Matrix a, @NonNull Matrix b); static Matrix transpose(@NonNull Matrix a); static Matrix zeroLike(Matrix matrix); static Matrix zeros(@NonNull int... shape); }
Matrix implements Serializable { public static Matrix array(@NonNull double[][] arrays) { verifyArrays(arrays); final int row = arrays.length; final int col = arrays[0].length; final double[] array = new double[row * col]; for (int i = 0; i < row; ++i) { System.arraycopy(arrays[i], 0, array, i * col, col); } return Matrix.array(array, row); } private  Matrix(double[] array, int row, int  col); int[] shape(); double[] getArray(); double[][] getArrays(); Matrix copy(); int getRow(); int getCol(); double get(int i, int j); void set(int i, int j, double value); Matrix times(@NonNull Matrix matrix); Matrix times(double num); Matrix timesTo(double num); Matrix timesTo(@NonNull Matrix matrix); Matrix plus(@NonNull Matrix matrix); Matrix plusTo(@NonNull Matrix matrix); Matrix minus(@NonNull Matrix matrix); Matrix minusTo(@NonNull Matrix matrix); Matrix dot(@NonNull Matrix matrix); Matrix transpose(); static Matrix array(@NonNull double[][] arrays); static Matrix array(@NonNull double[] array, int row); static Matrix randn(int row, int col); static Matrix plus(@NonNull Matrix a, @NonNull Matrix b); static Matrix plusTo(@NonNull Matrix a,@NonNull Matrix b); static Matrix minus(@NonNull Matrix a,@NonNull Matrix b); static Matrix minusTo(@NonNull Matrix a, @NonNull Matrix b); static Matrix times(@NonNull Matrix a, @NonNull Matrix b); static Matrix times(@NonNull Matrix matrix, double num); static Matrix timesTo(@NonNull Matrix matrix, double num); static Matrix timesTo(@NonNull Matrix a, @NonNull Matrix b); static Matrix dot(@NonNull Matrix a, @NonNull Matrix b); static Matrix transpose(@NonNull Matrix a); static Matrix zeroLike(Matrix matrix); static Matrix zeros(@NonNull int... shape);  }