Repository: commons-math
Updated Branches:
  refs/heads/master 44ab25696 -> b81be1fea


MATH-1416: Depend on "Commons Numbers" (module "commons-numbers-gamma").


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/7f747082
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/7f747082
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/7f747082

Branch: refs/heads/master
Commit: 7f74708201c2ab9f5d1f83c7052487116b8f7114
Parents: 44ab256
Author: Gilles <er...@apache.org>
Authored: Mon May 15 01:15:09 2017 +0200
Committer: Gilles <er...@apache.org>
Committed: Mon May 15 01:15:09 2017 +0200

----------------------------------------------------------------------
 .../commons/math4/distribution/LevyDistribution.java      |  7 ++++---
 .../commons/math4/distribution/LogNormalDistribution.java |  7 ++++---
 .../commons/math4/distribution/NormalDistribution.java    | 10 ++++++----
 3 files changed, 14 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/7f747082/src/main/java/org/apache/commons/math4/distribution/LevyDistribution.java
----------------------------------------------------------------------
diff --git 
a/src/main/java/org/apache/commons/math4/distribution/LevyDistribution.java 
b/src/main/java/org/apache/commons/math4/distribution/LevyDistribution.java
index 1986cac..5f99f8e 100644
--- a/src/main/java/org/apache/commons/math4/distribution/LevyDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/LevyDistribution.java
@@ -17,7 +17,8 @@
 package org.apache.commons.math4.distribution;
 
 import org.apache.commons.math4.exception.OutOfRangeException;
-import org.apache.commons.math4.special.Erf;
+import org.apache.commons.numbers.gamma.Erfc;
+import org.apache.commons.numbers.gamma.InverseErfc;
 import org.apache.commons.math4.util.FastMath;
 
 /**
@@ -105,7 +106,7 @@ public class LevyDistribution extends 
AbstractRealDistribution {
         if (x < mu) {
             return Double.NaN;
         }
-        return Erf.erfc(FastMath.sqrt(halfC / (x - mu)));
+        return Erfc.value(FastMath.sqrt(halfC / (x - mu)));
     }
 
     /** {@inheritDoc} */
@@ -114,7 +115,7 @@ public class LevyDistribution extends 
AbstractRealDistribution {
         if (p < 0.0 || p > 1.0) {
             throw new OutOfRangeException(p, 0, 1);
         }
-        final double t = Erf.erfcInv(p);
+        final double t = InverseErfc.value(p);
         return mu + halfC / (t * t);
     }
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/7f747082/src/main/java/org/apache/commons/math4/distribution/LogNormalDistribution.java
----------------------------------------------------------------------
diff --git 
a/src/main/java/org/apache/commons/math4/distribution/LogNormalDistribution.java
 
b/src/main/java/org/apache/commons/math4/distribution/LogNormalDistribution.java
index b5d4bf0..3025417 100644
--- 
a/src/main/java/org/apache/commons/math4/distribution/LogNormalDistribution.java
+++ 
b/src/main/java/org/apache/commons/math4/distribution/LogNormalDistribution.java
@@ -20,7 +20,8 @@ package org.apache.commons.math4.distribution;
 import org.apache.commons.math4.exception.NotStrictlyPositiveException;
 import org.apache.commons.math4.exception.NumberIsTooLargeException;
 import org.apache.commons.math4.exception.util.LocalizedFormats;
-import org.apache.commons.math4.special.Erf;
+import org.apache.commons.numbers.gamma.Erf;
+import org.apache.commons.numbers.gamma.ErfDifference;
 import org.apache.commons.math4.util.FastMath;
 import org.apache.commons.rng.UniformRandomProvider;
 import org.apache.commons.rng.sampling.distribution.ContinuousSampler;
@@ -200,7 +201,7 @@ public class LogNormalDistribution extends 
AbstractRealDistribution {
         if (FastMath.abs(dev) > 40 * shape) {
             return dev < 0 ? 0.0d : 1.0d;
         }
-        return 0.5 + 0.5 * Erf.erf(dev / (shape * SQRT2));
+        return 0.5 + 0.5 * Erf.value(dev / (shape * SQRT2));
     }
 
     /** {@inheritDoc} */
@@ -218,7 +219,7 @@ public class LogNormalDistribution extends 
AbstractRealDistribution {
         final double denom = shape * SQRT2;
         final double v0 = (FastMath.log(x0) - scale) / denom;
         final double v1 = (FastMath.log(x1) - scale) / denom;
-        return 0.5 * Erf.erf(v0, v1);
+        return 0.5 * ErfDifference.value(v0, v1);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/commons-math/blob/7f747082/src/main/java/org/apache/commons/math4/distribution/NormalDistribution.java
----------------------------------------------------------------------
diff --git 
a/src/main/java/org/apache/commons/math4/distribution/NormalDistribution.java 
b/src/main/java/org/apache/commons/math4/distribution/NormalDistribution.java
index da4c65c..76c41a3 100644
--- 
a/src/main/java/org/apache/commons/math4/distribution/NormalDistribution.java
+++ 
b/src/main/java/org/apache/commons/math4/distribution/NormalDistribution.java
@@ -21,7 +21,9 @@ import 
org.apache.commons.math4.exception.NotStrictlyPositiveException;
 import org.apache.commons.math4.exception.NumberIsTooLargeException;
 import org.apache.commons.math4.exception.OutOfRangeException;
 import org.apache.commons.math4.exception.util.LocalizedFormats;
-import org.apache.commons.math4.special.Erf;
+import org.apache.commons.numbers.gamma.Erfc;
+import org.apache.commons.numbers.gamma.InverseErf;
+import org.apache.commons.numbers.gamma.ErfDifference;
 import org.apache.commons.math4.util.FastMath;
 import org.apache.commons.rng.UniformRandomProvider;
 import org.apache.commons.rng.sampling.distribution.ContinuousSampler;
@@ -142,7 +144,7 @@ public class NormalDistribution extends 
AbstractRealDistribution {
         if (FastMath.abs(dev) > 40 * standardDeviation) {
             return dev < 0 ? 0.0d : 1.0d;
         }
-        return 0.5 * Erf.erfc(-dev / (standardDeviation * SQRT2));
+        return 0.5 * Erfc.value(-dev / (standardDeviation * SQRT2));
     }
 
     /** {@inheritDoc}
@@ -153,7 +155,7 @@ public class NormalDistribution extends 
AbstractRealDistribution {
         if (p < 0.0 || p > 1.0) {
             throw new OutOfRangeException(p, 0, 1);
         }
-        return mean + standardDeviation * SQRT2 * Erf.erfInv(2 * p - 1);
+        return mean + standardDeviation * SQRT2 * InverseErf.value(2 * p - 1);
     }
 
     /** {@inheritDoc} */
@@ -168,7 +170,7 @@ public class NormalDistribution extends 
AbstractRealDistribution {
         final double denom = standardDeviation * SQRT2;
         final double v0 = (x0 - mean) / denom;
         final double v1 = (x1 - mean) / denom;
-        return 0.5 * Erf.erf(v0, v1);
+        return 0.5 * ErfDifference.value(v0, v1);
     }
 
     /** {@inheritDoc} */

Reply via email to