use of org.nd4j.linalg.api.complex.IComplexDouble in project nd4j by deeplearning4j.
the class ComplexNumberTests method testLogarithmFloat.
@Test
public void testLogarithmFloat() {
IComplexDouble test = Nd4j.createDouble(1, 1);
IComplexDouble test2 = Nd4j.createDouble(1, 1);
IComplexNumber result = test.pow(test2);
assertEquals(result.realComponent(), 0.3465736);
assertEquals(result.imaginaryComponent(), 0.7853982);
}
use of org.nd4j.linalg.api.complex.IComplexDouble in project nd4j by deeplearning4j.
the class ComplexNumberTests method testScalar.
@Test
public void testScalar() {
IComplexDouble test = Nd4j.createDouble(1, 1);
test.addi(1);
assertEquals(2, test.realComponent().doubleValue(), 1e-1);
assertEquals(1, test.imaginaryComponent(), 1e-1);
test.subi(1);
assertEquals(1, test.realComponent().doubleValue(), 1e-1);
assertEquals(getFailureMessage(), 1, test.imaginaryComponent(), 1e-1);
test.muli(2);
assertEquals(2, test.realComponent().doubleValue(), 1e-1);
assertEquals(2, test.imaginaryComponent(), 1e-1);
test.divi(2);
assertEquals(1, test.realComponent().doubleValue(), 1e-1);
assertEquals(1, test.imaginaryComponent(), 1e-1);
test.addi(Nd4j.createDouble(1, 1));
assertEquals(2, test.realComponent().doubleValue(), 1e-1);
assertEquals(2, test.imaginaryComponent(), 1e-1);
test.rdivi(1);
assertEquals(0.5d, test.realComponent().doubleValue(), 1e-1);
assertEquals(2.0d, test.imaginaryComponent(), 1e-1);
}
use of org.nd4j.linalg.api.complex.IComplexDouble in project nd4j by deeplearning4j.
the class ComplexNumberTests method testExponentDouble.
@Test
public void testExponentDouble() {
IComplexDouble test = Nd4j.createDouble(1, 1);
assertEquals(test.realComponent(), 1.4686939399158851, 1e-3);
assertEquals(test.imaginaryComponent(), 2.2873552871788423, 1e-3);
}
use of org.nd4j.linalg.api.complex.IComplexDouble in project nd4j by deeplearning4j.
the class ComplexNumberTests method testLogarithmDouble.
@Test
public void testLogarithmDouble() {
IComplexDouble test = Nd4j.createDouble(1, 1);
IComplexDouble test2 = Nd4j.createDouble(1, 1);
IComplexNumber result = test.pow(test2);
assertEquals(result.realComponent(), 0.3465735902799727);
assertEquals(result.imaginaryComponent(), 0.7853981633974483);
}
use of org.nd4j.linalg.api.complex.IComplexDouble in project nd4j by deeplearning4j.
the class ComplexNumberTests method testPowerFloat.
@Test
public void testPowerFloat() {
IComplexDouble test = Nd4j.createDouble(1, 1);
IComplexDouble test2 = Nd4j.createDouble(1, 1);
IComplexNumber result = test.pow(test2);
assertEquals(result.realComponent(), 0.2739572);
assertEquals(result.imaginaryComponent(), 0.583700);
}
Aggregations