@Test public void meanCenteringTest() { double[][] actual = center(MATRIX, MatrixUtils::mean, true); double[][] expected = new double[][] { {-0.5d , 0.5d}, {-1d , 1d}, {0d , Double.NaN} }; assertMatrixEquals(expected, actual); }
public static double[][] center(double[][] matrix, BiFunction<double[], Boolean, Double> centering, boolean excludeNan ) { double[][] centered = new double[matrix.length][matrix[0].length]; for (int i = 0; i < matrix.length; i++) { centered[i] = center(matrix[i], centering, excludeNan); } return centered; }
MatrixUtils { public static double[][] center(double[][] matrix, BiFunction<double[], Boolean, Double> centering, boolean excludeNan ) { double[][] centered = new double[matrix.length][matrix[0].length]; for (int i = 0; i < matrix.length; i++) { centered[i] = center(matrix[i], centering, excludeNan); } return centered; } }
MatrixUtils { public static double[][] center(double[][] matrix, BiFunction<double[], Boolean, Double> centering, boolean excludeNan ) { double[][] centered = new double[matrix.length][matrix[0].length]; for (int i = 0; i < matrix.length; i++) { centered[i] = center(matrix[i], centering, excludeNan); } return centered; }  }
MatrixUtils { public static double[][] center(double[][] matrix, BiFunction<double[], Boolean, Double> centering, boolean excludeNan ) { double[][] centered = new double[matrix.length][matrix[0].length]; for (int i = 0; i < matrix.length; i++) { centered[i] = center(matrix[i], centering, excludeNan); } return centered; }  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[][] center(double[][] matrix, BiFunction<double[], Boolean, Double> centering, boolean excludeNan ) { double[][] centered = new double[matrix.length][matrix[0].length]; for (int i = 0; i < matrix.length; i++) { centered[i] = center(matrix[i], centering, excludeNan); } return centered; }  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);  }