commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject [4/7] [math] Removed static imports.
Date Tue, 03 Nov 2015 20:37:10 GMT
Removed static imports.

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

Branch: refs/heads/MATH_3_X
Commit: 99cbfc28e2ad3d1064c6583fdd46e357be803f02
Parents: a8bf634
Author: Luc Maisonobe <luc@apache.org>
Authored: Tue Nov 3 15:58:57 2015 +0100
Committer: Luc Maisonobe <luc@apache.org>
Committed: Tue Nov 3 15:58:57 2015 +0100

----------------------------------------------------------------------
 .../stat/inference/KolmogorovSmirnovTest.java   | 28 +++++++++-----------
 1 file changed, 13 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/99cbfc28/src/main/java/org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.java
b/src/main/java/org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.java
index bec7294..aaab914 100644
--- a/src/main/java/org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.java
+++ b/src/main/java/org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.java
@@ -41,9 +41,7 @@ import org.apache.commons.math3.random.Well19937c;
 import org.apache.commons.math3.util.CombinatoricsUtils;
 import org.apache.commons.math3.util.FastMath;
 import org.apache.commons.math3.util.MathArrays;
-
-import static org.apache.commons.math3.util.MathUtils.PI_SQUARED;
-import static org.apache.commons.math3.util.FastMath.PI;
+import org.apache.commons.math3.util.MathUtils;
 
 /**
  * Implementation of the <a href="http://en.wikipedia.org/wiki/Kolmogorov-Smirnov_test">
@@ -540,7 +538,7 @@ public class KolmogorovSmirnovTest {
         double sum = 0;
         double increment = 0;
         double kTerm = 0;
-        double z2Term = PI_SQUARED / (8 * z2);
+        double z2Term = MathUtils.PI_SQUARED / (8 * z2);
         int k = 1;
         for (; k < MAXIMUM_PARTIAL_SUM_COUNT; k++) {
             kTerm = 2 * k - 1;
@@ -565,7 +563,7 @@ public class KolmogorovSmirnovTest {
         for (k = 0; k < MAXIMUM_PARTIAL_SUM_COUNT; k++) {
             kTerm = k + 0.5;
             kTerm2 = kTerm * kTerm;
-            increment = (PI_SQUARED * kTerm2 - z2) * FastMath.exp(-PI_SQUARED * kTerm2 /
twoZ2);
+            increment = (MathUtils.PI_SQUARED * kTerm2 - z2) * FastMath.exp(-MathUtils.PI_SQUARED
* kTerm2 / twoZ2);
             sum += increment;
             if (FastMath.abs(increment) < PG_SUM_RELATIVE_ERROR * FastMath.abs(sum)) {
                 break;
@@ -574,7 +572,7 @@ public class KolmogorovSmirnovTest {
         if (k == MAXIMUM_PARTIAL_SUM_COUNT) {
             throw new TooManyIterationsException(MAXIMUM_PARTIAL_SUM_COUNT);
         }
-        final double sqrtHalfPi = FastMath.sqrt(PI / 2);
+        final double sqrtHalfPi = FastMath.sqrt(FastMath.PI / 2);
         // Instead of doubling sum, divide by 3 instead of 6
         ret += sum * sqrtHalfPi / (3 * z4 * sqrtN);
 
@@ -583,15 +581,15 @@ public class KolmogorovSmirnovTest {
         final double z4Term = 2 * z4;
         final double z6Term = 6 * z6;
         z2Term = 5 * z2;
-        final double pi4 = PI_SQUARED * PI_SQUARED;
+        final double pi4 = MathUtils.PI_SQUARED * MathUtils.PI_SQUARED;
         sum = 0;
         kTerm = 0;
         kTerm2 = 0;
         for (k = 0; k < MAXIMUM_PARTIAL_SUM_COUNT; k++) {
             kTerm = k + 0.5;
             kTerm2 = kTerm * kTerm;
-            increment =  (z6Term + z4Term + PI_SQUARED * (z4Term - z2Term) * kTerm2 +
-                    pi4 * (1 - twoZ2) * kTerm2 * kTerm2) * FastMath.exp(-PI_SQUARED * kTerm2
/ twoZ2);
+            increment =  (z6Term + z4Term + MathUtils.PI_SQUARED * (z4Term - z2Term) * kTerm2
+
+                    pi4 * (1 - twoZ2) * kTerm2 * kTerm2) * FastMath.exp(-MathUtils.PI_SQUARED
* kTerm2 / twoZ2);
             sum += increment;
             if (FastMath.abs(increment) < PG_SUM_RELATIVE_ERROR * FastMath.abs(sum)) {
                 break;
@@ -604,7 +602,7 @@ public class KolmogorovSmirnovTest {
         kTerm2 = 0;
         for (k = 1; k < MAXIMUM_PARTIAL_SUM_COUNT; k++) {
             kTerm2 = k * k;
-            increment = PI_SQUARED * kTerm2 * FastMath.exp(-PI_SQUARED * kTerm2 / twoZ2);
+            increment = MathUtils.PI_SQUARED * kTerm2 * FastMath.exp(-MathUtils.PI_SQUARED
* kTerm2 / twoZ2);
             sum2 += increment;
             if (FastMath.abs(increment) < PG_SUM_RELATIVE_ERROR * FastMath.abs(sum2))
{
                 break;
@@ -618,7 +616,7 @@ public class KolmogorovSmirnovTest {
 
         // K_3(z) One more time with feeling - two doubly infinite sums, all k powers even.
         // Multiply coefficient denominators by 2, so omit doubling sums.
-        final double pi6 = pi4 * PI_SQUARED;
+        final double pi6 = pi4 * MathUtils.PI_SQUARED;
         sum = 0;
         double kTerm4 = 0;
         double kTerm6 = 0;
@@ -628,8 +626,8 @@ public class KolmogorovSmirnovTest {
             kTerm4 = kTerm2 * kTerm2;
             kTerm6 = kTerm4 * kTerm2;
             increment = (pi6 * kTerm6 * (5 - 30 * z2) + pi4 * kTerm4 * (-60 * z2 + 212 *
z4) +
-                    PI_SQUARED * kTerm2 * (135 * z4 - 96 * z6) - 30 * z6 - 90 * z8) *
-                    FastMath.exp(-PI_SQUARED * kTerm2 / twoZ2);
+                            MathUtils.PI_SQUARED * kTerm2 * (135 * z4 - 96 * z6) - 30 * z6
- 90 * z8) *
+                    FastMath.exp(-MathUtils.PI_SQUARED * kTerm2 / twoZ2);
             sum += increment;
             if (FastMath.abs(increment) < PG_SUM_RELATIVE_ERROR * FastMath.abs(sum)) {
                 break;
@@ -642,8 +640,8 @@ public class KolmogorovSmirnovTest {
         for (k = 1; k < MAXIMUM_PARTIAL_SUM_COUNT; k++) {
             kTerm2 = k * k;
             kTerm4 = kTerm2 * kTerm2;
-            increment = (-pi4 * kTerm4 + 3 * PI_SQUARED * kTerm2 * z2) *
-                    FastMath.exp(-PI_SQUARED * kTerm2 / twoZ2);
+            increment = (-pi4 * kTerm4 + 3 * MathUtils.PI_SQUARED * kTerm2 * z2) *
+                    FastMath.exp(-MathUtils.PI_SQUARED * kTerm2 / twoZ2);
             sum2 += increment;
             if (FastMath.abs(increment) < PG_SUM_RELATIVE_ERROR * FastMath.abs(sum2))
{
                 break;


Mime
View raw message