@Test public void transformTest() { Function<Double, Double> square = (d) -> Math.pow(d, 2d); double[][] expected = new double[][] { {1d, 4d}, {1d, 9d}, {1d, Double.NaN} }; double[][] actual = transform(MATRIX, square); assertMatrixEquals(expected, actual); }
public static double[][] transform(double[][] matrix, Function<Double, Double> transformation ) { double[][] transformed = new double[matrix.length][matrix[0].length]; for (int i = 0; i < matrix.length; i++) { transformed[i] = of(matrix[i]).map(transformation::apply).toArray(); } return transformed; }
MatrixUtils { public static double[][] transform(double[][] matrix, Function<Double, Double> transformation ) { double[][] transformed = new double[matrix.length][matrix[0].length]; for (int i = 0; i < matrix.length; i++) { transformed[i] = of(matrix[i]).map(transformation::apply).toArray(); } return transformed; } }
MatrixUtils { public static double[][] transform(double[][] matrix, Function<Double, Double> transformation ) { double[][] transformed = new double[matrix.length][matrix[0].length]; for (int i = 0; i < matrix.length; i++) { transformed[i] = of(matrix[i]).map(transformation::apply).toArray(); } return transformed; }  }
MatrixUtils { public static double[][] transform(double[][] matrix, Function<Double, Double> transformation ) { double[][] transformed = new double[matrix.length][matrix[0].length]; for (int i = 0; i < matrix.length; i++) { transformed[i] = of(matrix[i]).map(transformation::apply).toArray(); } return transformed; }  static double max(double[][] matrix); static double max(double[] array); static double min(double[][] matrix); static double min(double[] array); static double[][] transform(double[][] matrix,
		Function<Double, Double> transformation
	); static double[][] center(double[][] matrix,
		BiFunction<double[], Boolean, Double> centering, boolean excludeNan
	); static double mean(double[] data, boolean excludeNan); static double median(double[] data, boolean excludeNan); static Object[][] removeColumn(int column, Object[][] data); static String[][] asStringMatrix(Object[][] matrix); static double[] asPrimitiveArray(List<Double> list); }
MatrixUtils { public static double[][] transform(double[][] matrix, Function<Double, Double> transformation ) { double[][] transformed = new double[matrix.length][matrix[0].length]; for (int i = 0; i < matrix.length; i++) { transformed[i] = of(matrix[i]).map(transformation::apply).toArray(); } return transformed; }  static double max(double[][] matrix); static double max(double[] array); static double min(double[][] matrix); static double min(double[] array); static double[][] transform(double[][] matrix,
		Function<Double, Double> transformation
	); static double[][] center(double[][] matrix,
		BiFunction<double[], Boolean, Double> centering, boolean excludeNan
	); static double mean(double[] data, boolean excludeNan); static double median(double[] data, boolean excludeNan); static Object[][] removeColumn(int column, Object[][] data); static String[][] asStringMatrix(Object[][] matrix); static double[] asPrimitiveArray(List<Double> list);  }