@Test public void testBroadcast() { IComplexNDArray arr = Nd4j.complexLinSpace(1, 5, 5); IComplexNDArray arrs = arr.broadcast(new int[] {5, 5}); IComplexNDArray arrs3 = Nd4j.createComplex(5, 5); assertTrue(Arrays.equals(arrs.shape(), arrs3.shape())); for (int i = 0; i < arrs.slices(); i++) arrs3.putSlice(i, arr); assertEquals(arrs3, arrs); }
@Test public void testPermute() { IComplexNDArray arr = Nd4j.complexLinSpace(1, 8, 8).reshape(2, 2, 2); IComplexNDArray permute = arr.permute(2, 1, 0); IComplexNDArray assertion = Nd4j.createComplex(2, 2, 2); IComplexNDArray assertionSlice1 = Nd4j.createComplex(Nd4j.create(new double[][] {{1, 2}, {3, 4}})); IComplexNDArray assertionSlice2 = Nd4j.createComplex(Nd4j.create(new double[][] {{5, 6}, {7, 8}})); assertion.putSlice(0, assertionSlice1); assertion.putSlice(1, assertionSlice2); assertEquals(assertion, permute); }