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 15:32:24 UTC

[commons-numbers] 02/02: Remove square()

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

commit 05da007bfe455297f014a6d82e407b80d2474fd7
Author: aherbert <ah...@apache.org>
AuthorDate: Thu Dec 12 15:32:18 2019 +0000

    Remove square()
---
 .../java/org/apache/commons/numbers/complex/Complex.java  |  9 ---------
 .../org/apache/commons/numbers/complex/ComplexTest.java   | 15 ---------------
 2 files changed, 24 deletions(-)

diff --git a/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/Complex.java b/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/Complex.java
index a817e64..f4cb63f 100644
--- a/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/Complex.java
+++ b/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/Complex.java
@@ -1416,15 +1416,6 @@ public final class Complex implements Serializable  {
     }
 
     /**
-     * Compute the square of this complex number.
-     *
-     * @return square of this complex number
-     */
-    public Complex square() {
-        return multiply(this);
-    }
-
-    /**
      * Compute the
      * <a href="http://mathworld.wolfram.com/Cosine.html">
      * cosine</a> of this complex number.
diff --git a/commons-numbers-complex/src/test/java/org/apache/commons/numbers/complex/ComplexTest.java b/commons-numbers-complex/src/test/java/org/apache/commons/numbers/complex/ComplexTest.java
index 72efedd..28490b1 100644
--- a/commons-numbers-complex/src/test/java/org/apache/commons/numbers/complex/ComplexTest.java
+++ b/commons-numbers-complex/src/test/java/org/apache/commons/numbers/complex/ComplexTest.java
@@ -1538,19 +1538,4 @@ public class ComplexTest {
         Assertions.assertEquals(0.54930614433405489, c.getReal());
         Assertions.assertEquals(1.5707963267948966, c.getImaginary());
     }
-
-    @Test
-    public void testSquare() {
-        final UniformRandomProvider rng = RandomSource.create(RandomSource.SPLIT_MIX_64);
-        final double min = -5;
-        final double range = -2 * min;
-        for (int i = 0; i < 10; i++) {
-            final Complex z = Complex.ofCartesian(min + range * rng.nextDouble(),
-                                                  min + range * rng.nextDouble());
-            final Complex c1 = z.multiply(z);
-            final Complex c2 = z.square();
-            Assertions.assertEquals(c1.getReal(), c2.getReal(), "real");
-            Assertions.assertEquals(c1.getImaginary(), c2.getImaginary(), "imaginary");
-        }
-    }
 }