@Test
  public void testLeadingOnes() {
    IComplexNDArray complexRand = Nd4j.complexRand(100, 1, 28, 28);
    assertArrayEquals(new int[] {100, 1, 28, 28}, complexRand.shape());
    IComplexNDArray arr = complexRand.linearView();
    for (int i = 0; i < arr.length(); i++) {
      arr.putScalar(i, arr.getComplex(i));
    }

    IComplexNDArray complexRand2 = Nd4j.complexRand(28, 28, 1);
    assertArrayEquals(new int[] {28, 28, 1}, complexRand2.shape());
    IComplexNDArray arr2 = complexRand.linearView();
    for (int i = 0; i < arr2.length(); i++) {
      arr2.putScalar(i, arr2.getComplex(i));
    }
  }
  @Test
  public void testPutAndGet() {
    IComplexNDArray multiRow = Nd4j.createComplex(2, 2);
    multiRow.putScalar(0, 0, Nd4j.createComplexNumber(1, 0));
    multiRow.putScalar(0, 1, Nd4j.createComplexNumber(2, 0));
    multiRow.putScalar(1, 0, Nd4j.createComplexNumber(3, 0));
    multiRow.putScalar(1, 1, Nd4j.createComplexNumber(4, 0));
    assertEquals(Nd4j.createComplexNumber(1, 0), multiRow.getComplex(0, 0));
    assertEquals(Nd4j.createComplexNumber(2, 0), multiRow.getComplex(0, 1));
    assertEquals(Nd4j.createComplexNumber(3, 0), multiRow.getComplex(1, 0));
    assertEquals(Nd4j.createComplexNumber(4, 0), multiRow.getComplex(1, 1));

    IComplexNDArray arr =
        Nd4j.createComplex(Nd4j.create(new double[] {1, 2, 3, 4}, new int[] {2, 2}));
    assertEquals(4, arr.length());
    assertEquals(8, arr.data().length());
    arr.put(1, 1, Nd4j.scalar(5.0));

    IComplexNumber n1 = arr.getComplex(1, 1);
    IComplexNumber n2 = arr.getComplex(1, 1);

    assertEquals(getFailureMessage(), 5.0, n1.realComponent().doubleValue(), 1e-1);
    assertEquals(getFailureMessage(), 0.0, n2.imaginaryComponent().doubleValue(), 1e-1);
  }