@Test public void testFlatten() throws Exception { double[][] arr2d = new double[][] { { 1, 2, 3 }, { 4, 5 }, { 6, 7, 8, 9 }, {} }; double[] arr1d = new double[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 }; Assert.assertArrayEquals(arr1d, ArrayUtils.flatten(arr2d), 0); }
public static double[] flatten(double[][] arr) { double[] result = new double[numElements(arr)]; int index = 0; for (int i = 0; i < arr.length; ++i) { for (int j = 0; j < arr[i].length; ++j) { result[index++] = arr[i][j]; } } return result; }
ArrayUtils { public static double[] flatten(double[][] arr) { double[] result = new double[numElements(arr)]; int index = 0; for (int i = 0; i < arr.length; ++i) { for (int j = 0; j < arr[i].length; ++j) { result[index++] = arr[i][j]; } } return result; } }
ArrayUtils { public static double[] flatten(double[][] arr) { double[] result = new double[numElements(arr)]; int index = 0; for (int i = 0; i < arr.length; ++i) { for (int j = 0; j < arr[i].length; ++j) { result[index++] = arr[i][j]; } } return result; }  }
ArrayUtils { public static double[] flatten(double[][] arr) { double[] result = new double[numElements(arr)]; int index = 0; for (int i = 0; i < arr.length; ++i) { for (int j = 0; j < arr[i].length; ++j) { result[index++] = arr[i][j]; } } return result; }  static String toJavaArray(int[][] arr); static String toJavaArray(int[] arr); static String toJavaArray(double[] arr); static double[] flatten(double[][] arr); static int[] flatten(int[][] arr); static int[][] transposed(int[][] arr); static int[] sorted(int[] arr); static int[] sorted(int[] arr, int numElements); static double sum(double[] arr); static double mean(double[] arr); static double absmax(double[] arr); static double[] normalized(double[] arr); static double[] fromPythonString(String string); static String toPythonString(double[] arr); static double[] add(double[] a, double[] b); static double[] subtract(double[] a, double[] b); static double[] multiplied(double[] a, double multiplier); static double[] toDoubleArray(float[] arr); static float[] toFloatArray(double[] arr); }
ArrayUtils { public static double[] flatten(double[][] arr) { double[] result = new double[numElements(arr)]; int index = 0; for (int i = 0; i < arr.length; ++i) { for (int j = 0; j < arr[i].length; ++j) { result[index++] = arr[i][j]; } } return result; }  static String toJavaArray(int[][] arr); static String toJavaArray(int[] arr); static String toJavaArray(double[] arr); static double[] flatten(double[][] arr); static int[] flatten(int[][] arr); static int[][] transposed(int[][] arr); static int[] sorted(int[] arr); static int[] sorted(int[] arr, int numElements); static double sum(double[] arr); static double mean(double[] arr); static double absmax(double[] arr); static double[] normalized(double[] arr); static double[] fromPythonString(String string); static String toPythonString(double[] arr); static double[] add(double[] a, double[] b); static double[] subtract(double[] a, double[] b); static double[] multiplied(double[] a, double multiplier); static double[] toDoubleArray(float[] arr); static float[] toFloatArray(double[] arr);  }