You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2020/05/18 10:00:15 UTC

[commons-math] branch master updated (bbfe7e4 -> b05b3b9)

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

erans pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-math.git.


    from bbfe7e4  MATH-1531: Avoid spurious exception.
     new bd43adb  Update call to "Commons Geometry" API.
     new cd003cb  MATH-1533: Add unit test.
     new b05b3b9  Avoid "static" import.

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../EnumeratedIntegerDistributionTest.java          | 21 +++++++++++++++++----
 .../GaussNewtonOptimizerWithSVDTest.java            |  5 +++--
 2 files changed, 20 insertions(+), 6 deletions(-)


[commons-math] 01/03: Update call to "Commons Geometry" API.

Posted by er...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit bd43adb57f0f709a28b00cada7c0142b1067c971
Author: Gilles Sadowski <gi...@gmail.com>
AuthorDate: Mon May 18 11:47:19 2020 +0200

    Update call to "Commons Geometry" API.
---
 .../math4/fitting/leastsquares/GaussNewtonOptimizerWithSVDTest.java  | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/test/java/org/apache/commons/math4/fitting/leastsquares/GaussNewtonOptimizerWithSVDTest.java b/src/test/java/org/apache/commons/math4/fitting/leastsquares/GaussNewtonOptimizerWithSVDTest.java
index 8583f1a..5c7e415 100644
--- a/src/test/java/org/apache/commons/math4/fitting/leastsquares/GaussNewtonOptimizerWithSVDTest.java
+++ b/src/test/java/org/apache/commons/math4/fitting/leastsquares/GaussNewtonOptimizerWithSVDTest.java
@@ -18,6 +18,7 @@
 package org.apache.commons.math4.fitting.leastsquares;
 
 import org.apache.commons.geometry.euclidean.threed.Plane;
+import org.apache.commons.geometry.euclidean.threed.Planes;
 import org.apache.commons.geometry.euclidean.threed.Vector3D;
 import org.apache.commons.geometry.core.precision.EpsilonDoublePrecisionContext;
 import org.apache.commons.math4.exception.ConvergenceException;
@@ -141,8 +142,8 @@ public class GaussNewtonOptimizerWithSVDTest
 
         Optimum optimum = optimizer.optimize(problem.getBuilder().build());
 
-        Plane span = Plane.fromPoints(Vector3D.ZERO, Vector3D.of(1, 2, -3), Vector3D.of(2, 1, 0),
-                                      new EpsilonDoublePrecisionContext(TOl));
+        Plane span = Planes.fromPoints(Vector3D.ZERO, Vector3D.of(1, 2, -3), Vector3D.of(2, 1, 0),
+                                       new EpsilonDoublePrecisionContext(TOl));
         double expected = FastMath.abs(span.offset(Vector3D.of(1, 1, 1)));
         double actual = optimum.getResiduals().getNorm();
 


[commons-math] 02/03: MATH-1533: Add unit test.

Posted by er...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit cd003cb29fe11d0ab08500e067863b9e1a1bd3fe
Author: Gilles Sadowski <gi...@gmail.com>
AuthorDate: Mon May 18 11:49:23 2020 +0200

    MATH-1533: Add unit test.
    
    Issue reported does not exist in the development version.
---
 .../distribution/EnumeratedIntegerDistributionTest.java   | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/test/java/org/apache/commons/math4/distribution/EnumeratedIntegerDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/EnumeratedIntegerDistributionTest.java
index 0725e51..3a32f98 100644
--- a/src/test/java/org/apache/commons/math4/distribution/EnumeratedIntegerDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/EnumeratedIntegerDistributionTest.java
@@ -18,6 +18,7 @@ package org.apache.commons.math4.distribution;
 
 import static org.junit.Assert.assertEquals;
 
+import java.util.Arrays;
 import org.apache.commons.statistics.distribution.DiscreteDistribution;
 import org.apache.commons.math4.distribution.EnumeratedIntegerDistribution;
 import org.apache.commons.math4.exception.DimensionMismatchException;
@@ -183,4 +184,18 @@ public class EnumeratedIntegerDistributionTest {
         assertEquals(0.5, distribution.probability(2), 0);
         assertEquals(0.5, distribution.cumulativeProbability(1), 0);
     }
+
+    @Test
+    public void testMath1533() {
+        final EnumeratedIntegerDistribution d1 = new EnumeratedIntegerDistribution(new int[] {1, 2},
+                                                                                   new double[] {0.3, 0.7});
+        final EnumeratedIntegerDistribution d2 = new EnumeratedIntegerDistribution(new int[] {2, 1},
+                                                                                   new double[] {0.7, 0.3});
+
+        final int len = 24;
+        final RandomSource r = RandomSource.WELL_19937_C;
+        final int s = 42;
+        Assert.assertTrue(Arrays.equals(AbstractIntegerDistribution.sample(len, d1.createSampler(RandomSource.create(r, s))),
+                                        AbstractIntegerDistribution.sample(len, d2.createSampler(RandomSource.create(r, s)))));
+    }
 }


[commons-math] 03/03: Avoid "static" import.

Posted by er...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit b05b3b9a90956293ae0cd4c423635bf8bdfb12f1
Author: Gilles Sadowski <gi...@gmail.com>
AuthorDate: Mon May 18 11:59:00 2020 +0200

    Avoid "static" import.
---
 .../math4/distribution/EnumeratedIntegerDistributionTest.java       | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/test/java/org/apache/commons/math4/distribution/EnumeratedIntegerDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/EnumeratedIntegerDistributionTest.java
index 3a32f98..1b03bee 100644
--- a/src/test/java/org/apache/commons/math4/distribution/EnumeratedIntegerDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/EnumeratedIntegerDistributionTest.java
@@ -16,8 +16,6 @@
  */
 package org.apache.commons.math4.distribution;
 
-import static org.junit.Assert.assertEquals;
-
 import java.util.Arrays;
 import org.apache.commons.statistics.distribution.DiscreteDistribution;
 import org.apache.commons.math4.distribution.EnumeratedIntegerDistribution;
@@ -181,8 +179,8 @@ public class EnumeratedIntegerDistributionTest {
     public void testCreateFromIntegers() {
         final int[] data = new int[] {0, 1, 1, 2, 2, 2};
         EnumeratedIntegerDistribution distribution = new EnumeratedIntegerDistribution(data);
-        assertEquals(0.5, distribution.probability(2), 0);
-        assertEquals(0.5, distribution.cumulativeProbability(1), 0);
+        Assert.assertEquals(0.5, distribution.probability(2), 0);
+        Assert.assertEquals(0.5, distribution.cumulativeProbability(1), 0);
     }
 
     @Test