Method name changed from "ofCartesian" to "ofReal".

See issue NUMBERS-53 on JIRA.
This commit is contained in:
Gilles 2018-03-31 02:38:47 +02:00
parent c5512b7d69
commit d9b0be1c9a
3 changed files with 12 additions and 12 deletions

View File

@ -137,7 +137,7 @@ public class ComplexUtils {
* @since 4.0 * @since 4.0
*/ */
public static Complex extractComplexFromRealArray(double[] real, int index) { public static Complex extractComplexFromRealArray(double[] real, int index) {
return Complex.ofCartesian(real[index]); return Complex.ofReal(real[index]);
} }
/** /**
@ -151,7 +151,7 @@ public class ComplexUtils {
* @since 4.0 * @since 4.0
*/ */
public static Complex extractComplexFromRealArray(float[] real, int index) { public static Complex extractComplexFromRealArray(float[] real, int index) {
return Complex.ofCartesian(real[index]); return Complex.ofReal(real[index]);
} }
/** /**
@ -436,7 +436,7 @@ public class ComplexUtils {
int index = 0; int index = 0;
final Complex c[] = new Complex[real.length]; final Complex c[] = new Complex[real.length];
for (double d : real) { for (double d : real) {
c[index] = Complex.ofCartesian(d); c[index] = Complex.ofReal(d);
index++; index++;
} }
return c; return c;
@ -454,7 +454,7 @@ public class ComplexUtils {
int index = 0; int index = 0;
final Complex c[] = new Complex[real.length]; final Complex c[] = new Complex[real.length];
for (float d : real) { for (float d : real) {
c[index] = Complex.ofCartesian(d); c[index] = Complex.ofReal(d);
index++; index++;
} }
return c; return c;

View File

@ -117,7 +117,7 @@ public class ComplexUtilsTest {
fi[i] = i; fi[i] = i;
fi[i + 1] = i + 1; fi[i + 1] = i + 1;
c[i / 2] = Complex.ofCartesian(i, i + 1); c[i / 2] = Complex.ofCartesian(i, i + 1);
cr[i / 2] = Complex.ofCartesian(i / 2); cr[i / 2] = Complex.ofReal(i / 2);
ci[i / 2] = Complex.ofCartesian(0, i / 2); ci[i / 2] = Complex.ofCartesian(0, i / 2);
sr[i / 2] = i; sr[i / 2] = i;
si[i / 2] = i + 1; si[i / 2] = i + 1;
@ -137,7 +137,7 @@ public class ComplexUtilsTest {
fi2d[i][j] = 10 * i + j; fi2d[i][j] = 10 * i + j;
fi2d[i][j + 1] = 10 * i + j + 1; fi2d[i][j + 1] = 10 * i + j + 1;
c2d[i][j / 2] = Complex.ofCartesian(10 * i + j, 10 * i + j + 1); c2d[i][j / 2] = Complex.ofCartesian(10 * i + j, 10 * i + j + 1);
cr2d[i][j / 2] = Complex.ofCartesian(10 * i + j / 2); cr2d[i][j / 2] = Complex.ofReal(10 * i + j / 2);
ci2d[i][j / 2] = Complex.ofCartesian(0, 10 * i + j / 2); ci2d[i][j / 2] = Complex.ofCartesian(0, 10 * i + j / 2);
} }
} }
@ -155,13 +155,13 @@ public class ComplexUtilsTest {
fi3d[i][j][k] = 100 * i + 10 * j + k; fi3d[i][j][k] = 100 * i + 10 * j + k;
fi3d[i][j][k + 1] = 100 * i + 10 * j + k + 1; fi3d[i][j][k + 1] = 100 * i + 10 * j + k + 1;
c3d[i][j][k / 2] = Complex.ofCartesian(100 * i + 10 * j + k, 100 * i + 10 * j + k + 1); c3d[i][j][k / 2] = Complex.ofCartesian(100 * i + 10 * j + k, 100 * i + 10 * j + k + 1);
cr3d[i][j][k / 2] = Complex.ofCartesian(100 * i + 10 * j + k / 2); cr3d[i][j][k / 2] = Complex.ofReal(100 * i + 10 * j + k / 2);
ci3d[i][j][k / 2] = Complex.ofCartesian(0, 100 * i + 10 * j + k / 2); ci3d[i][j][k / 2] = Complex.ofCartesian(0, 100 * i + 10 * j + k / 2);
} }
} }
} }
ansArrayc1r = new Complex[] { Complex.ofCartesian(3), Complex.ofCartesian(4), Complex.ofCartesian(5), Complex.ofCartesian(6), Complex.ofCartesian(7) }; ansArrayc1r = new Complex[] { Complex.ofReal(3), Complex.ofReal(4), Complex.ofReal(5), Complex.ofReal(6), Complex.ofReal(7) };
ansArrayc2r = new Complex[] { Complex.ofCartesian(3), Complex.ofCartesian(5), Complex.ofCartesian(7) }; ansArrayc2r = new Complex[] { Complex.ofReal(3), Complex.ofReal(5), Complex.ofReal(7) };
ansArrayc1i = new Complex[] { Complex.ofCartesian(0, 3), Complex.ofCartesian(0, 4), Complex.ofCartesian(0, 5), Complex.ofCartesian(0, 6), ansArrayc1i = new Complex[] { Complex.ofCartesian(0, 3), Complex.ofCartesian(0, 4), Complex.ofCartesian(0, 5), Complex.ofCartesian(0, 6),
Complex.ofCartesian(0, 7) }; Complex.ofCartesian(0, 7) };
ansArrayc2i = new Complex[] { Complex.ofCartesian(0, 3), Complex.ofCartesian(0, 5), Complex.ofCartesian(0, 7) }; ansArrayc2i = new Complex[] { Complex.ofCartesian(0, 3), Complex.ofCartesian(0, 5), Complex.ofCartesian(0, 7) };
@ -251,9 +251,9 @@ public class ComplexUtilsTest {
public void testExtractionMethods() { public void testExtractionMethods() {
setArrays(); setArrays();
// Extract complex from real double array, index 3 // Extract complex from real double array, index 3
TestUtils.assertSame(Complex.ofCartesian(3), ComplexUtils.extractComplexFromRealArray(d, 3)); TestUtils.assertSame(Complex.ofReal(3), ComplexUtils.extractComplexFromRealArray(d, 3));
// Extract complex from real float array, index 3 // Extract complex from real float array, index 3
TestUtils.assertSame(Complex.ofCartesian(3), ComplexUtils.extractComplexFromRealArray(f, 3)); TestUtils.assertSame(Complex.ofReal(3), ComplexUtils.extractComplexFromRealArray(f, 3));
// Extract real double from complex array, index 3 // Extract real double from complex array, index 3
TestUtils.assertSame(6, ComplexUtils.extractRealFromComplexArray(c, 3)); TestUtils.assertSame(6, ComplexUtils.extractRealFromComplexArray(c, 3));
// Extract real float from complex array, index 3 // Extract real float from complex array, index 3

View File

@ -301,7 +301,7 @@ public final class FastFourierTransformerTest {
final Complex[] x = new Complex[n]; final Complex[] x = new Complex[n];
for (int i = 0; i < n; i++) { for (int i = 0; i < n; i++) {
final double t = min + i * (max - min) / n; final double t = min + i * (max - min) / n;
x[i] = Complex.ofCartesian(f.value(t)); x[i] = Complex.ofReal(f.value(t));
} }
final Complex[] expected; final Complex[] expected;
final double s; final double s;