TableConverter { public float[][] floatMatrix() { return floatMatrix(table.numericColumns()); } TableConverter(Relation table); double[][] doubleMatrix(); double[][] doubleMatrix(int... columnIndicies); double[][] doubleMatrix(String... columnNames); float[][] floatMatrix(); float[][] floatMatrix(int... columnIndicies); float[][] floatMatrix(String... columnNames); int[][] intMatrix(); int[][] intMatrix(int... columnIndicies); int[][] intMatrix(String... columnNames);  }
@Test public void asFloatMatrix() { double[] array1 = {0, 1, 2}; double[] array2 = {0, 1, 2}; DoubleColumn c1 = DoubleColumn.create("1", array1); DoubleColumn c2 = DoubleColumn.create("2", array2); Table table = Table.create("test", c1, c2); float[][] expected = {{0.0f, 0.0f}, {1.0f, 1.0f}, {2.0f, 2.0f}}; float[][] results = table.as().floatMatrix(); assertTrue(Arrays.deepEquals(expected, results)); }
@Test public void asFloatMatrixColArgs() { double[] array1 = {0, 1, 1}; double[] array2 = {0, 1, 2}; double[] array3 = {0, 1, 3}; DoubleColumn c1 = DoubleColumn.create("1", array1); DoubleColumn c2 = DoubleColumn.create("2", array2); DoubleColumn c3 = DoubleColumn.create("3", array3); Table table = Table.create("test", c1, c2, c3); float[][] expected = {{0.0f, 0.0f}, {1.0f, 1.0f}, {1.0f, 3.0f}}; float[][] results = table.as().floatMatrix("1", "3"); assertTrue(Arrays.deepEquals(expected, results)); }