コード例 #1
0
 @Test
 public void testMmulOffset() {
   IComplexNDArray arr = Nd4j.complexLinSpace(1, 4, 4).reshape(2, 2);
   IComplexNDArray row1 = arr.getRow(1);
   IComplexNDArray arrT = row1.transpose();
   assertEquals(row1, arrT);
 }
コード例 #2
0
  @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);
  }