commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject [4/8] [math] Made class fields "private".
Date Wed, 10 May 2017 13:37:23 GMT
Made class fields "private".


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

Branch: refs/heads/master
Commit: d71ead41fb685431dad02d4bb7cb5675e196b8f2
Parents: 6568bb2
Author: Gilles <erans@apache.org>
Authored: Wed May 10 15:23:07 2017 +0200
Committer: Gilles <erans@apache.org>
Committed: Wed May 10 15:23:07 2017 +0200

----------------------------------------------------------------------
 .../math4/stat/inference/KolmogorovSmirnovTest.java     | 11 ++++-------
 .../math4/stat/inference/KolmogorovSmirnovTestTest.java | 12 +++++++-----
 2 files changed, 11 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/d71ead41/src/main/java/org/apache/commons/math4/stat/inference/KolmogorovSmirnovTest.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/inference/KolmogorovSmirnovTest.java
b/src/main/java/org/apache/commons/math4/stat/inference/KolmogorovSmirnovTest.java
index dad7535..3f699fb 100644
--- a/src/main/java/org/apache/commons/math4/stat/inference/KolmogorovSmirnovTest.java
+++ b/src/main/java/org/apache/commons/math4/stat/inference/KolmogorovSmirnovTest.java
@@ -115,23 +115,20 @@ import org.apache.commons.math4.util.MathUtils;
  * @since 3.3
  */
 public class KolmogorovSmirnovTest {
-
     /**
      * Bound on the number of partial sums in {@link #ksSum(double, double, int)}
      */
-    protected static final int MAXIMUM_PARTIAL_SUM_COUNT = 100000;
-
+    private static final int MAXIMUM_PARTIAL_SUM_COUNT = 100000;
     /** Convergence criterion for {@link #ksSum(double, double, int)} */
-    protected static final double KS_SUM_CAUCHY_CRITERION = 1E-20;
-
+    private static final double KS_SUM_CAUCHY_CRITERION = 1e-20;
     /** Convergence criterion for the sums in #pelzGood(double, double, int)} */
-    protected static final double PG_SUM_RELATIVE_ERROR = 1.0e-10;
+    private static final double PG_SUM_RELATIVE_ERROR = 1e-10;
 
     /**
      * When product of sample sizes exceeds this value, 2-sample K-S test uses asymptotic
      * distribution to compute the p-value.
      */
-    protected static final int LARGE_SAMPLE_PRODUCT = 10000;
+    private static final int LARGE_SAMPLE_PRODUCT = 10000;
 
     /**
      * Computes the <i>p-value</i>, or <i>observed significance level</i>,
of a one-sample <a

http://git-wip-us.apache.org/repos/asf/commons-math/blob/d71ead41/src/test/java/org/apache/commons/math4/stat/inference/KolmogorovSmirnovTestTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/inference/KolmogorovSmirnovTestTest.java
b/src/test/java/org/apache/commons/math4/stat/inference/KolmogorovSmirnovTestTest.java
index 46b8764..ba87205 100644
--- a/src/test/java/org/apache/commons/math4/stat/inference/KolmogorovSmirnovTestTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/inference/KolmogorovSmirnovTestTest.java
@@ -40,6 +40,8 @@ import org.junit.Test;
 public class KolmogorovSmirnovTestTest {
 
     protected static final double TOLERANCE = 10e-10;
+    private static final int MONTE_CARLO_ITERATIONS = 1000000;
+    private static final int LARGE_SAMPLE_PRODUCT = 10000;
 
     // Random N(0,1) values generated using R rnorm
     protected static final double[] gaussian = {
@@ -337,9 +339,9 @@ public class KolmogorovSmirnovTestTest {
             double exactPStrict = test.exactP(dv, sampleSize, sampleSize, true);
             double exactPNonStrict = test.exactP(dv, sampleSize, sampleSize, false);
             double montePStrict = test.monteCarloP(dv, sampleSize, sampleSize, true,
-                                                   KolmogorovSmirnovTest.MONTE_CARLO_ITERATIONS,
rng);
+                                                   MONTE_CARLO_ITERATIONS, rng);
             double montePNonStrict = test.monteCarloP(dv, sampleSize, sampleSize, false,
-                                                      KolmogorovSmirnovTest.MONTE_CARLO_ITERATIONS,
rng);
+                                                      MONTE_CARLO_ITERATIONS, rng);
             Assert.assertEquals(exactPStrict, montePStrict, tol);
             Assert.assertEquals(exactPNonStrict, montePNonStrict, tol);
         }
@@ -356,7 +358,7 @@ public class KolmogorovSmirnovTestTest {
         final double tol = 1e-2;
         Assert.assertEquals(test.exactP(d, sampleSize1, sampleSize2, strict),
                             test.monteCarloP(d, sampleSize1, sampleSize2, strict,
-                                             KolmogorovSmirnovTest.MONTE_CARLO_ITERATIONS,
rng),
+                                             MONTE_CARLO_ITERATIONS, rng),
                             tol);
     }
 
@@ -366,12 +368,12 @@ public class KolmogorovSmirnovTestTest {
     // @Test
     public void testTwoSampleMonteCarloPerformance() {
         int numIterations = 100_000;
-        int N = (int)Math.sqrt(KolmogorovSmirnovTest.LARGE_SAMPLE_PRODUCT);
+        int N = (int)Math.sqrt(LARGE_SAMPLE_PRODUCT);
         final KolmogorovSmirnovTest test = new KolmogorovSmirnovTest();
         final UniformRandomProvider rng = RandomSource.create(RandomSource.WELL_19937_C,
1000);
         for (int n = 2; n <= N; ++n) {
             long startMillis = System.currentTimeMillis();
-            int m = KolmogorovSmirnovTest.LARGE_SAMPLE_PRODUCT/n;
+            int m = LARGE_SAMPLE_PRODUCT/n;
             Assert.assertEquals(0d, test.monteCarloP(Double.POSITIVE_INFINITY, n, m, true,
numIterations, rng), 0d);
             long endMillis = System.currentTimeMillis();
             System.out.println("n=" + n + ", m=" + m + ", time=" + (endMillis-startMillis)/1000d
+ "s");


Mime
View raw message