You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ah...@apache.org on 2019/12/12 17:49:46 UTC

[commons-numbers] branch master updated: Remove reference to ofReal in ComplexUtils.

This is an automated email from the ASF dual-hosted git repository.

aherbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-numbers.git


The following commit(s) were added to refs/heads/master by this push:
     new ebf1e3c  Remove reference to ofReal in ComplexUtils.
ebf1e3c is described below

commit ebf1e3c55cdbbc08011e98ca0b5e32a8a378919b
Author: aherbert <ah...@apache.org>
AuthorDate: Thu Dec 12 17:49:43 2019 +0000

    Remove reference to ofReal in ComplexUtils.
---
 .../apache/commons/numbers/complex/streams/ComplexUtils.java |  8 ++++----
 .../commons/numbers/complex/streams/ComplexUtilsTest.java    | 12 ++++++------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/commons-numbers-complex-streams/src/main/java/org/apache/commons/numbers/complex/streams/ComplexUtils.java b/commons-numbers-complex-streams/src/main/java/org/apache/commons/numbers/complex/streams/ComplexUtils.java
index a90ef83..fb1ea4c 100644
--- a/commons-numbers-complex-streams/src/main/java/org/apache/commons/numbers/complex/streams/ComplexUtils.java
+++ b/commons-numbers-complex-streams/src/main/java/org/apache/commons/numbers/complex/streams/ComplexUtils.java
@@ -128,7 +128,7 @@ public final class ComplexUtils {
      * @return {@code Complex}.
      */
     public static Complex extractComplexFromRealArray(double[] real, int index) {
-        return Complex.ofReal(real[index]);
+        return Complex.ofCartesian(real[index], 0);
     }
 
     /**
@@ -140,7 +140,7 @@ public final class ComplexUtils {
      * @return {@code Complex} array
      */
     public static Complex extractComplexFromRealArray(float[] real, int index) {
-        return Complex.ofReal(real[index]);
+        return Complex.ofCartesian(real[index], 0);
     }
 
     /**
@@ -273,7 +273,7 @@ public final class ComplexUtils {
         int index = 0;
         final Complex[] c = new Complex[real.length];
         for (final double d : real) {
-            c[index] = Complex.ofReal(d);
+            c[index] = Complex.ofCartesian(d, 0);
             index++;
         }
         return c;
@@ -289,7 +289,7 @@ public final class ComplexUtils {
         int index = 0;
         final Complex[] c = new Complex[real.length];
         for (final float d : real) {
-            c[index] = Complex.ofReal(d);
+            c[index] = Complex.ofCartesian(d, 0);
             index++;
         }
         return c;
diff --git a/commons-numbers-complex-streams/src/test/java/org/apache/commons/numbers/complex/streams/ComplexUtilsTest.java b/commons-numbers-complex-streams/src/test/java/org/apache/commons/numbers/complex/streams/ComplexUtilsTest.java
index ca692ae..3c43298 100644
--- a/commons-numbers-complex-streams/src/test/java/org/apache/commons/numbers/complex/streams/ComplexUtilsTest.java
+++ b/commons-numbers-complex-streams/src/test/java/org/apache/commons/numbers/complex/streams/ComplexUtilsTest.java
@@ -119,7 +119,7 @@ public class ComplexUtilsTest {
 
             // Complex arrays
             c[halfI] = Complex.ofCartesian(i, i + 1);
-            cr[halfI] = Complex.ofReal(halfI);
+            cr[halfI] = Complex.ofCartesian(halfI, 0);
             ci[halfI] = Complex.ofCartesian(0, halfI);
 
             // standalone - split equivalent to c
@@ -146,7 +146,7 @@ public class ComplexUtilsTest {
 
                 // Complex arrays
                 c2d[i][halfJ] = Complex.ofCartesian(real, imaginary);
-                cr2d[i][halfJ] = Complex.ofReal(real);
+                cr2d[i][halfJ] = Complex.ofCartesian(real, 0);
                 ci2d[i][halfJ] = Complex.ofCartesian(0, imaginary);
 
                 // standalone - split equivalent to c2d, standalone equivalent to cr2d or ci2d
@@ -175,7 +175,7 @@ public class ComplexUtilsTest {
 
                     // Complex arrays
                     c3d[i][j][halfK] = Complex.ofCartesian(real, imaginary);
-                    cr3d[i][j][halfK] = Complex.ofReal(real);
+                    cr3d[i][j][halfK] = Complex.ofCartesian(real, 0);
                     ci3d[i][j][halfK] = Complex.ofCartesian(0, imaginary);
 
                     // standalone - split equivalent to c3d, standalone equivalent to cr3d or ci3d
@@ -210,7 +210,7 @@ public class ComplexUtilsTest {
 
                         // Complex arrays
                         c4d[i][j][k][halfL] = Complex.ofCartesian(real, imaginary);
-                        cr4d[i][j][k][halfL] = Complex.ofReal(real);
+                        cr4d[i][j][k][halfL] = Complex.ofCartesian(real, 0);
                         ci4d[i][j][k][halfL] = Complex.ofCartesian(0, imaginary);
 
                         // standalone - split equivalent to c4d, standalone equivalent to cr4d or ci4d
@@ -375,9 +375,9 @@ public class ComplexUtilsTest {
     public void testExtractionMethods() {
         setArrays();
         // Extract complex from real double array, index 3
-        TestUtils.assertSame(Complex.ofReal(3), ComplexUtils.extractComplexFromRealArray(d, 3));
+        TestUtils.assertSame(Complex.ofCartesian(3, 0), ComplexUtils.extractComplexFromRealArray(d, 3));
         // Extract complex from real float array, index 3
-        TestUtils.assertSame(Complex.ofReal(3), ComplexUtils.extractComplexFromRealArray(f, 3));
+        TestUtils.assertSame(Complex.ofCartesian(3, 0), ComplexUtils.extractComplexFromRealArray(f, 3));
         // Extract complex from real double array, index 3
         TestUtils.assertSame(Complex.ofCartesian(0, 3), ComplexUtils.extractComplexFromImaginaryArray(d, 3));
         // Extract complex from real float array, index 3