@Test public void testColumnWithReshape() { IComplexNDArray ones = Nd4j.complexOnes(4).reshape(2, 2); IComplexNDArray column = Nd4j.createComplex(new float[] {2, 0, 6, 0}); ones.putColumn(1, column); assertEquals(column, ones.getColumn(1)); }
@Test public void testVectorGet() { IComplexNDArray arr = Nd4j.createComplex(Nd4j.create(Nd4j.linspace(1, 8, 8).data(), new int[] {1, 8})); for (int i = 0; i < arr.length(); i++) { IComplexNumber curr = arr.getComplex(i); assertEquals(Nd4j.createDouble(i + 1, 0), curr); } IComplexNDArray matrix = Nd4j.createComplex(Nd4j.create(Nd4j.linspace(1, 8, 8).data(), new int[] {2, 4})); IComplexNDArray row = matrix.getRow(1); IComplexNDArray column = matrix.getColumn(1); IComplexNDArray validate = Nd4j.createComplex(Nd4j.create(new double[] {2, 4, 6, 8}, new int[] {1, 4})); IComplexNumber d = row.getComplex(3); assertEquals(Nd4j.createDouble(8, 0), d); assertEquals(row, validate); IComplexNumber d2 = column.getComplex(1); assertEquals(Nd4j.createDouble(4, 0), d2); }