You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by lu...@apache.org on 2015/12/09 17:00:58 UTC

[01/21] [math] Added bootstrap method to KolmogorovSmirnovTest. JIRA: MATH-1246.

Repository: commons-math
Updated Branches:
  refs/heads/field-ode b713e4ca0 -> 10c271f2c


Added bootstrap method to KolmogorovSmirnovTest. JIRA: MATH-1246.


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

Branch: refs/heads/field-ode
Commit: fbc327e9e30093acdc0fc325b1719cae4ea8bac1
Parents: d391146
Author: Phil Steitz <ph...@gmail.com>
Authored: Sun Nov 22 12:41:00 2015 -0700
Committer: Phil Steitz <ph...@gmail.com>
Committed: Sun Nov 22 12:41:00 2015 -0700

----------------------------------------------------------------------
 src/changes/changes.xml                         |  3 +
 .../stat/inference/KolmogorovSmirnovTest.java   | 60 ++++++++++++++++++++
 src/test/R/KolmogorovSmirnovTestCases.R         | 48 ++++++++++++----
 .../inference/KolmogorovSmirnovTestTest.java    | 35 ++++++++++++
 4 files changed, 134 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/fbc327e9/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 202f368..7dfacc5 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -51,6 +51,9 @@ If the output is not quite correct, check for invisible trailing spaces!
   </properties>
   <body>
     <release version="3.6" date="XXXX-XX-XX" description="">
+      <action dev="psteitz" type="update" issue="MATH-1246">
+        Added bootstrap method to KolmogorovSmirnov test.
+      </action>
       <action dev="psteitz" type="update" issue="MATH-1287">
         Added constructors taking sample data as arguments to enumerated real and integer distributions.
       </action>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/fbc327e9/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 0b8332e..7c19b1a 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
@@ -21,6 +21,7 @@ import java.math.BigDecimal;
 import java.util.Arrays;
 import java.util.Iterator;
 
+import org.apache.commons.math3.distribution.EnumeratedRealDistribution;
 import org.apache.commons.math3.distribution.RealDistribution;
 import org.apache.commons.math3.exception.InsufficientDataException;
 import org.apache.commons.math3.exception.MathArithmeticException;
@@ -376,6 +377,65 @@ public class KolmogorovSmirnovTest {
     }
 
     /**
+     * Estimates the <i>p-value</i> of a two-sample
+     * <a href="http://en.wikipedia.org/wiki/Kolmogorov-Smirnov_test"> Kolmogorov-Smirnov test</a>
+     * evaluating the null hypothesis that {@code x} and {@code y} are samples drawn from the same
+     * probability distribution. This method estimates the p-value by repeatedly sampling sets of size
+     * {@code x.length} and {@code y.length} from the empirical distribution of the combined sample.
+     * When {@code strict} is true, this is equivalent to the algorithm implemented in the R function
+     * ks.boot, described in <pre>
+     * Jasjeet S. Sekhon. 2011. `Multivariate and Propensity Score Matching
+     * Software with Automated Balance Optimization: The Matching package for R.`
+     * Journal of Statistical Software, 42(7): 1-52.
+     * </pre>
+     * @param x first sample
+     * @param y second sample
+     * @param iterations number of bootstrap resampling iterations
+     * @param strict whether or not the null hypothesis is expressed as a strict inequality
+     * @return estimated p-value
+     */
+    public double bootstrap(double[] x, double[] y, int iterations, boolean strict) {
+        final int xLength = x.length;
+        final int yLength = y.length;
+        final double[] combined = new double[xLength + yLength];
+        System.arraycopy(x, 0, combined, 0, xLength);
+        System.arraycopy(y, 0, combined, xLength, yLength);
+        final EnumeratedRealDistribution dist = new EnumeratedRealDistribution(combined);
+        final long d = integralKolmogorovSmirnovStatistic(x, y);
+        int greaterCount = 0;
+        int equalCount = 0;
+        double[] curX;
+        double[] curY;
+        long curD;
+        for (int i = 0; i < iterations; i++) {
+            curX = dist.sample(xLength);
+            curY = dist.sample(yLength);
+            curD = integralKolmogorovSmirnovStatistic(curX, curY);
+            if (curD > d) {
+                greaterCount++;
+            } else if (curD == d) {
+                equalCount++;
+            }
+        }
+        return strict ? greaterCount / (double) iterations :
+            (greaterCount + equalCount) / (double) iterations;
+    }
+
+    /**
+     * Computes {@code bootstrap(x, y, iterations, true)}.
+     * This is equivalent to ks.boot(x,y, nboots=iterations) using the R Matching
+     * package function. See #bootstrap(double[], double[], int, boolean).
+     *
+     * @param x first sample
+     * @param y second sample
+     * @param iterations number of bootstrap resampling iterations
+     * @return estimated p-value
+     */
+    public double bootstrap(double[] x, double[] y, int iterations) {
+        return bootstrap(x, y, iterations, true);
+    }
+
+    /**
      * Calculates \(P(D_n < d)\) using the method described in [1] with quick decisions for extreme
      * values given in [2] (see above). The result is not exact as with
      * {@link #cdfExact(double, int)} because calculations are based on

http://git-wip-us.apache.org/repos/asf/commons-math/blob/fbc327e9/src/test/R/KolmogorovSmirnovTestCases.R
----------------------------------------------------------------------
diff --git a/src/test/R/KolmogorovSmirnovTestCases.R b/src/test/R/KolmogorovSmirnovTestCases.R
index 6b70155..3146325 100644
--- a/src/test/R/KolmogorovSmirnovTestCases.R
+++ b/src/test/R/KolmogorovSmirnovTestCases.R
@@ -21,12 +21,20 @@
 # into the same directory, launch R from this directory and then enter
 # source("<name-of-this-file>")
 #
+# NOTE: the 2-sample bootstrap test requires the "Matching" library
+## https://cran.r-project.org/web/packages/Matching/index.html
+## See http://sekhon.berkeley.edu/matching for additional documentation.
+## Jasjeet S. Sekhon. 2011. ``Multivariate and Propensity Score Matching
+## Software with Automated Balance Optimization: The Matching package for R.''
+## Journal of Statistical Software, 42(7): 1-52.
+#
 #------------------------------------------------------------------------------
 tol <- 1E-14                     # error tolerance for tests
 #------------------------------------------------------------------------------
 # Function definitions
 
 source("testFunctions")           # utility test functions
+require("Matching")               # for ks.boot
 
 verifyOneSampleGaussian <- function(data, expectedP, expectedD, mean, sigma, exact, tol, desc) {
     results <- ks.test(data, "pnorm", mean, sigma, exact = exact)
@@ -34,12 +42,12 @@ verifyOneSampleGaussian <- function(data, expectedP, expectedD, mean, sigma, exa
         displayPadded(c(desc," p-value test"), SUCCEEDED, WIDTH)
     } else {
         displayPadded(c(desc, " p-value test"), FAILED, WIDTH)
-    } 
+    }
     if (assertEquals(expectedD, results$statistic, tol, "D statistic value")) {
         displayPadded(c(desc," D statistic test"), SUCCEEDED, WIDTH)
     } else {
         displayPadded(c(desc, " D statistic test"), FAILED, WIDTH)
-    } 
+    }
 }
 
 verifyOneSampleUniform <- function(data, expectedP, expectedD, min, max, exact, tol, desc) {
@@ -48,12 +56,12 @@ verifyOneSampleUniform <- function(data, expectedP, expectedD, min, max, exact,
         displayPadded(c(desc," p-value test"), SUCCEEDED, WIDTH)
     } else {
         displayPadded(c(desc, " p-value test"), FAILED, WIDTH)
-    } 
+    }
     if (assertEquals(expectedD, results$statistic, tol, "D statistic value")) {
         displayPadded(c(desc," D statistic test"), SUCCEEDED, WIDTH)
     } else {
         displayPadded(c(desc, " D statistic test"), FAILED, WIDTH)
-    } 
+    }
 }
 
 verifyTwoSampleLargeSamples <- function(sample1, sample2, expectedP, expectedD, tol, desc) {
@@ -62,12 +70,12 @@ verifyTwoSampleLargeSamples <- function(sample1, sample2, expectedP, expectedD,
         displayPadded(c(desc," p-value test"), SUCCEEDED, WIDTH)
     } else {
         displayPadded(c(desc, " p-value test"), FAILED, WIDTH)
-    } 
+    }
     if (assertEquals(expectedD, results$statistic, tol, "D statistic value")) {
         displayPadded(c(desc," D statistic test"), SUCCEEDED, WIDTH)
     } else {
         displayPadded(c(desc, " D statistic test"), FAILED, WIDTH)
-    } 
+    }
 }
 
 verifyTwoSampleSmallSamplesExact <- function(sample1, sample2, expectedP, expectedD, tol, desc) {
@@ -76,14 +84,22 @@ verifyTwoSampleSmallSamplesExact <- function(sample1, sample2, expectedP, expect
         displayPadded(c(desc," p-value test"), SUCCEEDED, WIDTH)
     } else {
         displayPadded(c(desc, " p-value test"), FAILED, WIDTH)
-    } 
+    }
     if (assertEquals(expectedD, results$statistic, tol, "D statistic value")) {
         displayPadded(c(desc," D statistic test"), SUCCEEDED, WIDTH)
     } else {
         displayPadded(c(desc, " D statistic test"), FAILED, WIDTH)
-    } 
+    }
 }
 
+verifyTwoSampleBootstrap <- function(sample1, sample2, expectedP, tol, desc) {
+    results <- ks.boot(sample1, sample2,nboots=10000 )
+    if (assertEquals(expectedP, results$ks.boot.pvalue, tol, "p-value")) {
+        displayPadded(c(desc, " p-value test"), SUCCEEDED, WIDTH)
+    } else {
+        displayPadded(c(desc, " p-value test"), FAILED, WIDTH)
+    }
+}
 
 cat("KolmogorovSmirnovTest test cases\n")
 
@@ -100,7 +116,7 @@ gaussian <- c(0.26055895, -0.63665233, 1.51221323, 0.61246988, -0.03013003, -1.7
    0.25165971, -0.04125231, -0.23756244, -0.93389975, 0.75551407, 0.08347445, -0.27482228, -0.4717632,
   -0.1867746, -0.1166976, 0.5763333, 0.1307952, 0.7630584, -0.3616248, 2.1383790,-0.7946630,
    0.0231885, 0.7919195, 1.6057144, -0.3802508, 0.1229078, 1.5252901, -0.8543149, 0.3025040)
-   
+
 shortGaussian <- gaussian[1:50]
 
 gaussian2 <- c(2.88041498038308, -0.632349445671017, 0.402121295225571, 0.692626364613243, 1.30693446815426,
@@ -137,10 +153,14 @@ uniform <- c(0.7930305, 0.6424382, 0.8747699, 0.7156518, 0.1845909, 0.2022326,
    0.85201008, 0.02945562, 0.26200374, 0.11382818, 0.17238856, 0.36449473, 0.69688273, 0.96216330,
    0.4859432,0.4503438, 0.1917656, 0.8357845, 0.9957812, 0.4633570, 0.8654599, 0.4597996,
    0.68190289, 0.58887855, 0.09359396, 0.98081979, 0.73659533, 0.89344777, 0.18903099, 0.97660425)
-   
+
 smallSample1 <- c(6, 7, 9, 13, 19, 21, 22, 23, 24)
 smallSample2 <- c(10, 11, 12, 16, 20, 27, 28, 32, 44, 54)
- 
+bootSample1 <- c(0, 2, 4, 6, 8, 8, 10, 15, 22, 30, 33, 36, 38)
+bootSample2 <- c(9, 17, 20, 33, 40, 51, 60, 60, 72, 90, 101)
+roundingSample1 <- c(2,4,6,8,9,10,11,12,13)
+roundingSample2 <- c(0,1,3,5,7)
+
 shortUniform <- uniform[1:20]
 
 verifyOneSampleGaussian(gaussian, 0.3172069207622391, 0.0932947561266756, 0, 1,
@@ -167,6 +187,10 @@ verifyTwoSampleLargeSamples(gaussian, gaussian2, 0.0319983962391632, 0.202352941
 verifyTwoSampleSmallSamplesExact(smallSample1, smallSample2, 0.105577085453247, .5, tol,
 "Two sample small samples exact")
 
+verifyTwoSampleBootstrap(bootSample1, bootSample2, 0.0059, 1E-3, "Two sample bootstrap - isolated failures possible")
+verifyTwoSampleBootstrap(gaussian, gaussian2, 0.0237, 1E-2, "Two sample bootstrap - isolated failures possible")
+verifyTwoSampleBootstrap(roundingSample1, roundingSample2, 0.06303, 1E-2, "Two sample bootstrap - isolated failures possible")
+
 displayDashes(WIDTH)
-            
+
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/fbc327e9/src/test/java/org/apache/commons/math3/stat/inference/KolmogorovSmirnovTestTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/inference/KolmogorovSmirnovTestTest.java b/src/test/java/org/apache/commons/math3/stat/inference/KolmogorovSmirnovTestTest.java
index 808c0d4..609a0fd 100644
--- a/src/test/java/org/apache/commons/math3/stat/inference/KolmogorovSmirnovTestTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/inference/KolmogorovSmirnovTestTest.java
@@ -532,6 +532,41 @@ public class KolmogorovSmirnovTestTest {
     }
 
     /**
+     * Test an example with ties in the data.  Reference data is R 3.2.0,
+     * ks.boot implemented in Matching (Version 4.8-3.4, Build Date: 2013/10/28)
+     */
+    @Test
+    public void testBootstrapSmallSamplesWithTies() {
+        final double[] x = {0, 2, 4, 6, 8, 8, 10, 15, 22, 30, 33, 36, 38};
+        final double[] y = {9, 17, 20, 33, 40, 51, 60, 60, 72, 90, 101};
+        final KolmogorovSmirnovTest test = new KolmogorovSmirnovTest(new Well19937c(2000));
+        Assert.assertEquals(0.0059, test.bootstrap(x, y, 10000, false), 1E-3);
+    }
+
+    /**
+     * Reference data is R 3.2.0, ks.boot implemented in
+     * Matching (Version 4.8-3.4, Build Date: 2013/10/28)
+     */
+    @Test
+    public void testBootstrapLargeSamples() {
+        final KolmogorovSmirnovTest test = new KolmogorovSmirnovTest(new Well19937c(1000));
+        Assert.assertEquals(0.0237, test.bootstrap(gaussian, gaussian2, 10000), 1E-2);
+    }
+
+    /**
+     * Test an example where D-values are close (subject to rounding).
+     * Reference data is R 3.2.0, ks.boot implemented in
+     * Matching (Version 4.8-3.4, Build Date: 2013/10/28)
+     */
+    @Test
+    public void testBootstrapRounding() {
+        final double[] x = {2,4,6,8,9,10,11,12,13};
+        final double[] y = {0,1,3,5,7};
+        final KolmogorovSmirnovTest test = new KolmogorovSmirnovTest(new Well19937c(1000));
+        Assert.assertEquals(0.06303, test.bootstrap(x, y, 10000, false), 1E-2);
+    }
+
+    /**
      * Verifies the inequality exactP(criticalValue, n, m, true) < alpha < exactP(criticalValue, n,
      * m, false).
      *


[18/21] [math] Merge branch 'MATH_3_X' into field-ode

Posted by lu...@apache.org.
Merge branch 'MATH_3_X' into field-ode

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

Branch: refs/heads/field-ode
Commit: 2291c26cf91f8eb66d278ed73b7d9a5b69ea62cb
Parents: 01026aa c23e9fb
Author: Luc Maisonobe <lu...@apache.org>
Authored: Wed Dec 9 16:19:43 2015 +0100
Committer: Luc Maisonobe <lu...@apache.org>
Committed: Wed Dec 9 16:19:43 2015 +0100

----------------------------------------------------------------------
 src/changes/changes.xml                         |  17 ++
 .../analysis/polynomials/PolynomialsUtils.java  |  10 +-
 .../math3/optim/univariate/BracketFinder.java   |   4 +-
 .../math3/random/JDKRandomGenerator.java        |  17 ++
 .../stat/descriptive/DescriptiveStatistics.java |  17 +-
 .../math3/stat/descriptive/moment/Skewness.java |   5 +
 .../stat/inference/KolmogorovSmirnovTest.java   | 196 ++++++++++++++++++-
 .../apache/commons/math3/util/MathArrays.java   |  58 ++++++
 src/test/R/ChiSquareDistributionTestCases.R     |   8 +-
 src/test/R/FDistributionTestCases.R             |   8 +-
 src/test/R/GammaDistributionTestCases.R         |   8 +-
 .../R/KolmogorovSmirnovDistributionTestCases.R  |   6 +-
 src/test/R/KolmogorovSmirnovTestCases.R         |  48 +++--
 src/test/R/LevyDistributionTestCases.R          |   5 +-
 src/test/R/README.txt                           |  72 +++----
 src/test/R/TDistributionTestCases.R             |   8 +-
 src/test/R/TTestCases                           |  20 +-
 src/test/R/WeibullDistributionTestCases.R       |   8 +-
 src/test/R/anovaTestCases                       |   8 +-
 src/test/R/binomialTestCases                    |   8 +-
 src/test/R/cauchyTestCases.R                    |   6 +-
 src/test/R/chiSquareTestCases                   |  20 +-
 src/test/R/correlationTestCases                 |  16 +-
 src/test/R/covarianceTestCases                  |  16 +-
 src/test/R/descriptiveTestCases                 |   6 +-
 src/test/R/exponentialTestCases                 |   8 +-
 src/test/R/geometricTestCases                   |  10 +-
 src/test/R/hypergeometricTestCases              |  12 +-
 src/test/R/multipleOLSRegressionTestCases       |  32 +--
 src/test/R/nakagamiTestCases.R                  |   6 +-
 src/test/R/normalTestCases                      |   8 +-
 src/test/R/paretoTestCases                      |  11 +-
 src/test/R/pascalTestCases                      |   6 +-
 src/test/R/poissonTestCases                     |  12 +-
 src/test/R/regressionTestCases                  |  24 +--
 src/test/R/testAll                              |  14 +-
 src/test/R/testFunctions                        |   6 +-
 src/test/R/zipfTestCases                        |   6 +-
 .../math3/analysis/FunctionUtilsTest.java       |   8 +-
 .../DerivativeStructureTest.java                |  16 +-
 .../FiniteDifferencesDifferentiatorTest.java    |  14 +-
 .../differentiation/GradientFunctionTest.java   |   4 +-
 .../differentiation/JacobianFunctionTest.java   |   4 +-
 .../differentiation/SparseGradientTest.java     |   4 +-
 .../math3/analysis/function/GaussianTest.java   |   2 +-
 .../math3/analysis/function/LogisticTest.java   |   8 +-
 .../math3/analysis/function/SigmoidTest.java    |   2 +-
 .../analysis/function/StepFunctionTest.java     |   8 +-
 .../integration/MidPointIntegratorTest.java     |   4 +-
 .../BicubicSplineInterpolatingFunctionTest.java |  18 +-
 .../BicubicSplineInterpolatorTest.java          |   6 +-
 ...PolynomialBicubicSplineInterpolatorTest.java |   8 +-
 .../TricubicInterpolatingFunctionTest.java      |   4 +-
 ...TricubicSplineInterpolatingFunctionTest.java |  16 +-
 .../TricubicSplineInterpolatorTest.java         |  12 +-
 .../PolynomialSplineFunctionTest.java           |   2 +-
 .../polynomials/PolynomialsUtilsTest.java       |   2 +-
 .../commons/math3/complex/QuaternionTest.java   |   2 +-
 .../apache/commons/math3/dfp/DfpDecTest.java    |   6 +-
 .../apache/commons/math3/dfp/DfpMathTest.java   | 122 ++++++------
 .../distribution/BinomialDistributionTest.java  |   4 +-
 .../ConstantRealDistributionTest.java           |   4 +-
 .../EnumeratedIntegerDistributionTest.java      |   2 +-
 .../EnumeratedRealDistributionTest.java         |   8 +-
 .../distribution/GeometricDistributionTest.java |   2 +-
 .../HypergeometricDistributionTest.java         |  14 +-
 .../KolmogorovSmirnovDistributionTest.java      |   8 +-
 .../distribution/LevyDistributionTest.java      |   2 +-
 .../MultivariateNormalDistributionTest.java     |   2 +-
 .../distribution/PoissonDistributionTest.java   |   2 +-
 .../RealDistributionAbstractTest.java           |  12 +-
 .../math3/distribution/TDistributionTest.java   |   4 +-
 .../UniformRealDistributionTest.java            |  10 +-
 ...ormalMixtureExpectationMaximizationTest.java |  10 +-
 .../DimensionMismatchExceptionTest.java         |   2 +-
 .../MaxCountExceededExceptionTest.java          |   2 +-
 .../NonMonotonicSequenceExceptionTest.java      |   2 +-
 .../exception/NotPositiveExceptionTest.java     |   2 +-
 .../NotStrictlyPositiveExceptionTest.java       |   2 +-
 .../NumberIsTooLargeExceptionTest.java          |   2 +-
 .../NumberIsTooSmallExceptionTest.java          |   2 +-
 .../exception/OutOfRangeExceptionTest.java      |   2 +-
 .../TooManyEvaluationsExceptionTest.java        |   2 +-
 .../math3/exception/util/ArgUtilsTest.java      |   2 +-
 .../exception/util/ExceptionContextTest.java    |   2 +-
 .../commons/math3/filter/KalmanFilterTest.java  |  50 ++---
 .../math3/fitting/GaussianCurveFitterTest.java  |  16 +-
 .../math3/fitting/GaussianFitterTest.java       |  16 +-
 .../math3/fitting/HarmonicCurveFitterTest.java  |   2 +-
 .../fitting/PolynomialCurveFitterTest.java      |   2 +-
 .../math3/fitting/SimpleCurveFitterTest.java    |   2 +-
 .../fitting/leastsquares/CircleProblem.java     |   2 +-
 .../fitting/leastsquares/CircleVectorial.java   |   2 +-
 .../math3/fitting/leastsquares/MinpackTest.java |   4 +-
 .../commons/math3/fraction/BigFractionTest.java |   4 +-
 .../math3/genetics/CycleCrossoverTest.java      |   4 +-
 .../math3/genetics/DummyListChromosome.java     |   2 +-
 .../genetics/ElitisticListPopulationTest.java   |  10 +-
 .../math3/genetics/ListPopulationTest.java      |  26 +--
 .../math3/genetics/NPointCrossoverTest.java     |  16 +-
 .../math3/genetics/OrderedCrossoverTest.java    |   6 +-
 .../commons/math3/genetics/RandomKeyTest.java   |   2 +-
 .../math3/genetics/UniformCrossoverTest.java    |  14 +-
 .../euclidean/threed/FieldVector3DTest.java     |   6 +-
 .../geometry/euclidean/threed/LineTest.java     |   2 +-
 .../euclidean/threed/PolyhedronsSetTest.java    |  26 +--
 .../geometry/euclidean/threed/RotationTest.java |   2 +-
 .../euclidean/threed/SphereGeneratorTest.java   |   2 +-
 .../threed/SphericalCoordinatesTest.java        |   2 +-
 .../geometry/euclidean/threed/SubLineTest.java  |   2 +-
 .../geometry/euclidean/threed/Vector3DTest.java |   6 +-
 .../euclidean/twod/DiskGeneratorTest.java       |   2 +-
 .../euclidean/twod/PolygonsSetTest.java         |  12 +-
 .../geometry/euclidean/twod/Vector2DTest.java   |   6 +-
 .../hull/ConvexHullGenerator2DAbstractTest.java |  18 +-
 .../geometry/partitioning/RegionDumper.java     |   2 +-
 .../geometry/partitioning/RegionParser.java     |   2 +-
 .../geometry/spherical/twod/CircleTest.java     |   4 +-
 .../math3/linear/Array2DRowRealMatrixTest.java  |   2 +-
 .../math3/linear/DiagonalMatrixTest.java        |   6 +-
 .../math3/linear/EigenDecompositionTest.java    |  20 +-
 .../math3/linear/HessenbergTransformerTest.java |  10 +-
 .../MatrixDimensionMismatchExceptionTest.java   |   2 +-
 .../commons/math3/linear/MatrixUtilsTest.java   |  16 +-
 .../math3/linear/QRDecompositionTest.java       |   2 +-
 .../commons/math3/linear/RRQRSolverTest.java    |   4 +-
 .../RectangularCholeskyDecompositionTest.java   |   2 +-
 .../math3/linear/SchurTransformerTest.java      |   6 +-
 .../ml/clustering/DBSCANClustererTest.java      |  10 +-
 .../clustering/KMeansPlusPlusClustererTest.java |  12 +-
 .../MultiKMeansPlusPlusClustererTest.java       |   2 +-
 .../evaluation/SumOfClusterVariancesTest.java   |   4 +-
 .../commons/math3/ml/neuralnet/NetworkTest.java |   4 +-
 .../ml/neuralnet/OffsetFeatureInitializer.java  |   2 +-
 .../neuralnet/sofm/KohonenTrainingTaskTest.java |   2 +-
 .../sofm/TravellingSalesmanSolver.java          |   2 +-
 .../commons/math3/ode/JacobianMatricesTest.java |   2 +-
 .../math3/ode/events/EventStateTest.java        |  16 +-
 .../nonstiff/HighamHall54IntegratorTest.java    |   2 +-
 .../sampling/StepNormalizerOutputTestBase.java  |   8 +-
 .../math3/optim/SimplePointCheckerTest.java     |   2 +-
 .../math3/optim/SimpleValueCheckerTest.java     |   2 +-
 .../math3/optim/linear/SimplexSolverTest.java   |  40 ++--
 .../scalar/noderiv/BOBYQAOptimizerTest.java     |  40 ++--
 .../scalar/noderiv/CMAESOptimizerTest.java      |  12 +-
 ...stractLeastSquaresOptimizerAbstractTest.java |   2 +-
 .../vector/jacobian/CircleProblem.java          |   2 +-
 .../nonlinear/vector/jacobian/MinpackTest.java  |   2 +-
 .../optim/univariate/BrentOptimizerTest.java    |   2 +-
 .../MultiStartUnivariateOptimizerTest.java      |   2 +-
 .../SimpleUnivariateValueCheckerTest.java       |   2 +-
 .../optimization/SimplePointCheckerTest.java    |   2 +-
 .../optimization/SimpleValueCheckerTest.java    |   2 +-
 .../direct/BOBYQAOptimizerTest.java             |  40 ++--
 .../optimization/direct/CMAESOptimizerTest.java |  14 +-
 .../fitting/GaussianFitterTest.java             |  16 +-
 ...stractLeastSquaresOptimizerAbstractTest.java |   2 +-
 ...NonLinearConjugateGradientOptimizerTest.java |   2 +-
 .../optimization/linear/SimplexSolverTest.java  |  26 +--
 .../univariate/BrentOptimizerTest.java          |   2 +-
 .../SimpleUnivariateValueCheckerTest.java       |   2 +-
 .../UnivariateMultiStartOptimizerTest.java      |   2 +-
 .../apache/commons/math3/primes/PrimesTest.java |   2 +-
 .../random/AbstractRandomGeneratorTest.java     |   4 +-
 .../math3/random/BitsStreamGeneratorTest.java   |  16 +-
 .../CorrelatedRandomVectorGeneratorTest.java    |   8 +-
 .../math3/random/EmpiricalDistributionTest.java |  60 +++---
 .../random/HaltonSequenceGeneratorTest.java     |   4 +-
 .../math3/random/MersenneTwisterTest.java       |   4 +-
 .../commons/math3/random/RandomAdaptorTest.java |   6 +-
 .../random/RandomGeneratorAbstractTest.java     |   2 +-
 .../random/SobolSequenceGeneratorTest.java      |   8 +-
 .../math3/random/StableRandomGeneratorTest.java |   6 +-
 .../UnitSphereRandomVectorGeneratorTest.java    |   2 +-
 .../commons/math3/random/ValueServerTest.java   |   8 +-
 .../commons/math3/random/Well19937aTest.java    |   2 +-
 .../commons/math3/random/Well19937cTest.java    |   2 +-
 .../commons/math3/random/Well44497aTest.java    |   4 +-
 .../commons/math3/random/Well44497bTest.java    |   4 +-
 .../commons/math3/random/Well512aTest.java      |   2 +-
 .../commons/math3/special/BesselJTest.java      |   6 +-
 .../apache/commons/math3/special/ErfTest.java   |  54 ++---
 .../commons/math3/stat/FrequencyTest.java       |  36 ++--
 .../commons/math3/stat/StatUtilsTest.java       |  16 +-
 .../stat/clustering/DBSCANClustererTest.java    |  10 +-
 .../clustering/KMeansPlusPlusClustererTest.java |   8 +-
 .../SpearmansRankCorrelationTest.java           |   4 +-
 .../correlation/StorelessCovarianceTest.java    |  10 +-
 .../descriptive/DescriptiveStatisticsTest.java  |   2 +-
 .../StatisticalSummaryValuesTest.java           |   2 +-
 ...torelessUnivariateStatisticAbstractTest.java |   2 +-
 .../stat/descriptive/SummaryStatisticsTest.java |  20 +-
 .../UnivariateStatisticAbstractTest.java        |   4 +-
 .../descriptive/rank/PSquarePercentileTest.java |   4 +-
 .../stat/descriptive/rank/PercentileTest.java   |   4 +-
 .../stat/descriptive/summary/ProductTest.java   |   2 +-
 .../stat/descriptive/summary/SumLogTest.java    |   4 +-
 .../stat/descriptive/summary/SumSqTest.java     |   2 +-
 .../math3/stat/descriptive/summary/SumTest.java |   2 +-
 .../commons/math3/stat/inference/GTestTest.java |  14 +-
 .../inference/KolmogorovSmirnovTestTest.java    | 141 +++++++++++--
 .../stat/inference/MannWhitneyUTestTest.java    |  14 +-
 .../math3/stat/inference/TestUtilsTest.java     |   6 +-
 .../inference/WilcoxonSignedRankTestTest.java   |  36 ++--
 .../stat/interval/AgrestiCoullIntervalTest.java |   2 +-
 .../BinomialConfidenceIntervalAbstractTest.java |   4 +-
 .../interval/ClopperPearsonIntervalTest.java    |   2 +-
 .../math3/stat/interval/IntervalUtilsTest.java  |   4 +-
 .../NormalApproximationIntervalTest.java        |   2 +-
 .../stat/interval/WilsonScoreIntervalTest.java  |   2 +-
 .../math3/stat/ranking/NaturalRankingTest.java  |  14 +-
 .../GLSMultipleLinearRegressionTest.java        |  44 ++---
 .../MillerUpdatingRegressionTest.java           |  34 ++--
 .../MultipleLinearRegressionAbstractTest.java   |  20 +-
 .../OLSMultipleLinearRegressionTest.java        |  88 ++++-----
 .../stat/regression/SimpleRegressionTest.java   |   2 +-
 .../commons/math3/util/CombinationsTest.java    |   4 +-
 .../apache/commons/math3/util/FastMathTest.java |  26 +--
 .../commons/math3/util/IncrementorTest.java     |   2 +-
 .../commons/math3/util/MathArraysTest.java      |  95 +++++++--
 .../math3/util/ResizableDoubleArrayTest.java    |  18 +-
 221 files changed, 1585 insertions(+), 1081 deletions(-)
----------------------------------------------------------------------



[07/21] [math] Removed trailing spaces. No code change.

Posted by lu...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/FrequencyTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/FrequencyTest.java b/src/test/java/org/apache/commons/math3/stat/FrequencyTest.java
index 6e4b56d..e2e73a8 100644
--- a/src/test/java/org/apache/commons/math3/stat/FrequencyTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/FrequencyTest.java
@@ -254,7 +254,7 @@ public final class FrequencyTest {
         Assert.assertEquals("Integer 1 cumPct", 0.5, f.getCumPct(1), TOLERANCE);
         Assert.assertEquals("Integer 1 cumPct", 0.5, f.getCumPct(Long.valueOf(1)), TOLERANCE);
         Assert.assertEquals("Integer 1 cumPct", 0.5, f.getCumPct(Integer.valueOf(1)), TOLERANCE);
-        
+
         f.incrementValue(ONE, -2);
         f.incrementValue(THREE, 5);
 
@@ -264,7 +264,7 @@ public final class FrequencyTest {
         Iterator<?> it = f.valuesIterator();
         while (it.hasNext()) {
             Assert.assertTrue(it.next() instanceof Long);
-        }        
+        }
     }
 
     @Test
@@ -275,7 +275,7 @@ public final class FrequencyTest {
         f.addValue(TWO);
         Assert.assertEquals(f, TestUtils.serializeAndRecover(f));
     }
-    
+
     @Test
     public void testGetUniqueCount() {
         Assert.assertEquals(0, f.getUniqueCount());
@@ -286,7 +286,7 @@ public final class FrequencyTest {
         f.addValue(TWO);
         Assert.assertEquals(2, f.getUniqueCount());
     }
-    
+
     @Test
     public void testIncrement() {
         Assert.assertEquals(0, f.getUniqueCount());
@@ -295,10 +295,10 @@ public final class FrequencyTest {
 
         f.incrementValue(ONE_LONG, 4);
         Assert.assertEquals(5, f.getCount(ONE_LONG));
-        
+
         f.incrementValue(ONE_LONG, -5);
         Assert.assertEquals(0, f.getCount(ONE_LONG));
-        
+
         try {
             f.incrementValue(CHAR_A, 1);
             Assert.fail("Expecting IllegalArgumentException");
@@ -308,7 +308,7 @@ public final class FrequencyTest {
 
         f = new Frequency();
         f.incrementValue(CHAR_A, 2);
-        
+
         Assert.assertEquals(2, f.getCount(CHAR_A));
 
         try {
@@ -317,12 +317,12 @@ public final class FrequencyTest {
         } catch (IllegalArgumentException ex) {
             // expected
         }
-        
+
         f.incrementValue(CHAR_A, 3);
         Assert.assertEquals(5, f.getCount(CHAR_A));
 
     }
-    
+
     @Test
     public void testMerge() {
         Assert.assertEquals(0, f.getUniqueCount());
@@ -330,7 +330,7 @@ public final class FrequencyTest {
         f.addValue(TWO_LONG);
         f.addValue(ONE);
         f.addValue(TWO);
-        
+
         Assert.assertEquals(2, f.getUniqueCount());
         Assert.assertEquals(2, f.getCount(ONE));
         Assert.assertEquals(2, f.getCount(TWO));
@@ -345,18 +345,18 @@ public final class FrequencyTest {
         Assert.assertEquals(2, g.getCount(THREE));
 
         f.merge(g);
-        
+
         Assert.assertEquals(3, f.getUniqueCount());
         Assert.assertEquals(3, f.getCount(ONE));
         Assert.assertEquals(2, f.getCount(TWO));
-        Assert.assertEquals(2, f.getCount(THREE));        
+        Assert.assertEquals(2, f.getCount(THREE));
     }
-    
+
     @Test
     public void testMergeCollection() {
         Assert.assertEquals(0, f.getUniqueCount());
         f.addValue(ONE_LONG);
-        
+
         Assert.assertEquals(1, f.getUniqueCount());
         Assert.assertEquals(1, f.getCount(ONE));
         Assert.assertEquals(0, f.getCount(TWO));
@@ -366,18 +366,18 @@ public final class FrequencyTest {
 
         Frequency h = new Frequency();
         h.addValue(THREE_LONG);
-        
+
         List<Frequency> coll = new ArrayList<Frequency>();
         coll.add(g);
         coll.add(h);
         f.merge(coll);
-        
+
         Assert.assertEquals(3, f.getUniqueCount());
         Assert.assertEquals(1, f.getCount(ONE));
         Assert.assertEquals(1, f.getCount(TWO));
-        Assert.assertEquals(1, f.getCount(THREE));        
+        Assert.assertEquals(1, f.getCount(THREE));
     }
-    
+
     @Test
     public void testMode() {
         List<Comparable<?>> mode;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/StatUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/StatUtilsTest.java b/src/test/java/org/apache/commons/math3/stat/StatUtilsTest.java
index dccb7b6..1a76482 100644
--- a/src/test/java/org/apache/commons/math3/stat/StatUtilsTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/StatUtilsTest.java
@@ -269,7 +269,7 @@ public final class StatUtilsTest {
         x = new double[] {ONE, TWO, TWO, THREE};
         TestUtils.assertEquals(0.5, StatUtils.variance(x,2.5, 2, 2), TOLERANCE);
     }
-    
+
     @Test
     public void testPopulationVariance() {
         double[] x = null;
@@ -461,10 +461,10 @@ public final class StatUtilsTest {
         Assert.assertEquals(FastMath.exp(0.5 * StatUtils.sumLog(test, 0, 2)),
                 StatUtils.geometricMean(test, 0, 2), Double.MIN_VALUE);
     }
-    
-    
+
+
     /**
-     * Run the test with the values 50 and 100 and assume standardized values    
+     * Run the test with the values 50 and 100 and assume standardized values
      */
 
     @Test
@@ -485,7 +485,7 @@ public final class StatUtilsTest {
 
     @Test
     public void testNormalize2() {
-        // create an sample with 77 values    
+        // create an sample with 77 values
         int length = 77;
         double sample[] = new double[length];
         for (int i = 0; i < length; i++) {
@@ -499,14 +499,14 @@ public final class StatUtilsTest {
         for (int i = 0; i < length; i++) {
             stats.addValue(standardizedSample[i]);
         }
-        // the calculations do have a limited precision    
+        // the calculations do have a limited precision
         double distance = 1E-10;
         // check the mean an standard deviation
         Assert.assertEquals(0.0, stats.getMean(), distance);
         Assert.assertEquals(1.0, stats.getStandardDeviation(), distance);
 
     }
-    
+
     @Test
     public void testMode() {
         final double[] singleMode = {0, 1, 0, 2, 7, 11, 12};
@@ -542,7 +542,7 @@ public final class StatUtilsTest {
         final double[] nansOnly = {Double.NaN, Double.NaN};
         final double[] modeNansOnly = StatUtils.mode(nansOnly);
         Assert.assertEquals(0, modeNansOnly.length);
-        
+
         final double[] nullArray = null;
         try {
             StatUtils.mode(nullArray);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/clustering/DBSCANClustererTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/clustering/DBSCANClustererTest.java b/src/test/java/org/apache/commons/math3/stat/clustering/DBSCANClustererTest.java
index 657e2de..1c10490 100644
--- a/src/test/java/org/apache/commons/math3/stat/clustering/DBSCANClustererTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/clustering/DBSCANClustererTest.java
@@ -147,19 +147,19 @@ public class DBSCANClustererTest {
                 new EuclideanIntegerPoint(new int[] {14, 8}), // C
                 new EuclideanIntegerPoint(new int[] {7, 15}), // N - Noise, should not be present
                 new EuclideanIntegerPoint(new int[] {17, 8}), // D - single-link connected to C should not be present
-                
+
         };
-        
+
         final DBSCANClusterer<EuclideanIntegerPoint> clusterer = new DBSCANClusterer<EuclideanIntegerPoint>(3, 3);
         List<Cluster<EuclideanIntegerPoint>> clusters = clusterer.cluster(Arrays.asList(points));
-        
+
         Assert.assertEquals(1, clusters.size());
-        
+
         final List<EuclideanIntegerPoint> clusterOne =
                 Arrays.asList(points[0], points[1], points[2], points[3], points[4], points[5], points[6], points[7]);
         Assert.assertTrue(clusters.get(0).getPoints().containsAll(clusterOne));
     }
-    
+
     @Test
     public void testGetEps() {
         final DBSCANClusterer<EuclideanDoublePoint> transformer = new DBSCANClusterer<EuclideanDoublePoint>(2.0, 5);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/clustering/KMeansPlusPlusClustererTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/clustering/KMeansPlusPlusClustererTest.java b/src/test/java/org/apache/commons/math3/stat/clustering/KMeansPlusPlusClustererTest.java
index d14f77b..4247992 100644
--- a/src/test/java/org/apache/commons/math3/stat/clustering/KMeansPlusPlusClustererTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/clustering/KMeansPlusPlusClustererTest.java
@@ -248,16 +248,16 @@ public class KMeansPlusPlusClustererTest {
         }
         Assert.assertTrue(uniquePointIsCenter);
     }
-    
+
     /**
      * 2 variables cannot be clustered into 3 clusters. See issue MATH-436.
      */
     @Test(expected=NumberIsTooSmallException.class)
     public void testPerformClusterAnalysisToManyClusters() {
-        KMeansPlusPlusClusterer<EuclideanIntegerPoint> transformer = 
+        KMeansPlusPlusClusterer<EuclideanIntegerPoint> transformer =
             new KMeansPlusPlusClusterer<EuclideanIntegerPoint>(
                     new Random(1746432956321l));
-        
+
         EuclideanIntegerPoint[] points = new EuclideanIntegerPoint[] {
             new EuclideanIntegerPoint(new int[] {
                 1959, 325100
@@ -265,7 +265,7 @@ public class KMeansPlusPlusClustererTest {
                 1960, 373200
             })
         };
-        
+
         transformer.cluster(Arrays.asList(points), 3, 1);
 
     }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/correlation/SpearmansRankCorrelationTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/correlation/SpearmansRankCorrelationTest.java b/src/test/java/org/apache/commons/math3/stat/correlation/SpearmansRankCorrelationTest.java
index 36b0c56..e75b0b9 100644
--- a/src/test/java/org/apache/commons/math3/stat/correlation/SpearmansRankCorrelationTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/correlation/SpearmansRankCorrelationTest.java
@@ -127,7 +127,7 @@ public class SpearmansRankCorrelationTest extends PearsonsCorrelationTest {
 
         NaturalRanking ranking = new NaturalRanking(NaNStrategy.REMOVED);
         SpearmansCorrelation spearman = new SpearmansCorrelation(ranking);
-        
+
         Assert.assertEquals(0.5, spearman.correlation(xArray, yArray), Double.MIN_VALUE);
     }
 
@@ -145,7 +145,7 @@ public class SpearmansRankCorrelationTest extends PearsonsCorrelationTest {
         // compute correlation
         NaturalRanking ranking = new NaturalRanking(NaNStrategy.REMOVED);
         SpearmansCorrelation spearman = new SpearmansCorrelation(matrix, ranking);
-        
+
         Assert.assertEquals(0.5, spearman.getCorrelationMatrix().getEntry(0, 1), Double.MIN_VALUE);
     }
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/correlation/StorelessCovarianceTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/correlation/StorelessCovarianceTest.java b/src/test/java/org/apache/commons/math3/stat/correlation/StorelessCovarianceTest.java
index 06052e9..b8b85a8 100644
--- a/src/test/java/org/apache/commons/math3/stat/correlation/StorelessCovarianceTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/correlation/StorelessCovarianceTest.java
@@ -221,7 +221,7 @@ public class StorelessCovarianceTest {
             }
         }
     }
-    
+
     /**
      * Test equality of covariance. chk: covariance of two
      * samples separately and adds them together. cov: computes
@@ -232,22 +232,22 @@ public class StorelessCovarianceTest {
         int num_sets = 2;
         StorelessBivariateCovariance cov = new StorelessBivariateCovariance();// covariance of the superset
         StorelessBivariateCovariance chk = new StorelessBivariateCovariance();// check covariance made by appending covariance of subsets
-        
+
         ISAACRandom rand = new ISAACRandom(10L);// Seed can be changed
         for (int s = 0; s < num_sets; s++) {// loop through sets of samlpes
             StorelessBivariateCovariance covs = new StorelessBivariateCovariance();
             for (int i = 0; i < 5; i++) { // loop through individual samlpes.
                 double x = rand.nextDouble();
                 double y = rand.nextDouble();
-                covs.increment(x, y);// add sample to the subset 
+                covs.increment(x, y);// add sample to the subset
                 cov.increment(x, y);// add sample to the superset
             }
            chk.append(covs);
         }
-        
+
         TestUtils.assertEquals("covariance subset test", chk.getResult(), cov.getResult(), 10E-7);
     }
-  
+
     protected RealMatrix createRealMatrix(double[] data, int nRows, int nCols) {
         double[][] matrixData = new double[nRows][nCols];
         int ptr = 0;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/descriptive/DescriptiveStatisticsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/descriptive/DescriptiveStatisticsTest.java b/src/test/java/org/apache/commons/math3/stat/descriptive/DescriptiveStatisticsTest.java
index d9e6aa9..f573b19 100644
--- a/src/test/java/org/apache/commons/math3/stat/descriptive/DescriptiveStatisticsTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/descriptive/DescriptiveStatisticsTest.java
@@ -224,7 +224,7 @@ public class DescriptiveStatisticsTest {
         checkremoval(dstat, DescriptiveStatistics.INFINITE_WINDOW, 3.5, 2.5, 3.0);
 
     }
-    
+
     @Test
     public void testSummaryConsistency() {
         final DescriptiveStatistics dstats = new DescriptiveStatistics();

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/descriptive/StatisticalSummaryValuesTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/descriptive/StatisticalSummaryValuesTest.java b/src/test/java/org/apache/commons/math3/stat/descriptive/StatisticalSummaryValuesTest.java
index e3b766e..581c97b 100644
--- a/src/test/java/org/apache/commons/math3/stat/descriptive/StatisticalSummaryValuesTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/descriptive/StatisticalSummaryValuesTest.java
@@ -64,7 +64,7 @@ public final class StatisticalSummaryValuesTest {
         TestUtils.assertEquals("min",s.getMin(),u.getMin(), 0);
         TestUtils.assertEquals("max",s.getMax(),u.getMax(), 0);
     }
-    
+
     @Test
     public void testToString() {
         StatisticalSummaryValues u  = new StatisticalSummaryValues(4.5, 16, 10, 5, 4, 45);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/descriptive/StorelessUnivariateStatisticAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/descriptive/StorelessUnivariateStatisticAbstractTest.java b/src/test/java/org/apache/commons/math3/stat/descriptive/StorelessUnivariateStatisticAbstractTest.java
index c42b80e..4deca7e 100644
--- a/src/test/java/org/apache/commons/math3/stat/descriptive/StorelessUnivariateStatisticAbstractTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/descriptive/StorelessUnivariateStatisticAbstractTest.java
@@ -74,7 +74,7 @@ public abstract class StorelessUnivariateStatisticAbstractTest
     protected void checkClearValue(StorelessUnivariateStatistic statistic){
         Assert.assertTrue(Double.isNaN(statistic.getResult()));
     }
-    
+
     @Test
     public void testSerialization() {
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/descriptive/SummaryStatisticsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/descriptive/SummaryStatisticsTest.java b/src/test/java/org/apache/commons/math3/stat/descriptive/SummaryStatisticsTest.java
index e1a1f98..90786ec 100644
--- a/src/test/java/org/apache/commons/math3/stat/descriptive/SummaryStatisticsTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/descriptive/SummaryStatisticsTest.java
@@ -296,7 +296,7 @@ public class SummaryStatisticsTest {
             // expected
         }
     }
-    
+
     @Test
     public void testQuadraticMean() {
         final double[] values = { 1.2, 3.4, 5.6, 7.89 };
@@ -314,7 +314,7 @@ public class SummaryStatisticsTest {
 
         Assert.assertEquals(expected, stats.getQuadraticMean(), Math.ulp(expected));
     }
-    
+
     /**
      * JIRA: MATH-691
      */
@@ -326,31 +326,31 @@ public class SummaryStatisticsTest {
         for(double i : scores) {
           stats.addValue(i);
         }
-        Assert.assertEquals((new Variance(false)).evaluate(scores),stats.getVariance(), 0); 
+        Assert.assertEquals((new Variance(false)).evaluate(scores),stats.getVariance(), 0);
     }
-    
+
     @Test
     public void testOverrideMeanWithMathClass() {
         double[] scores = {1, 2, 3, 4};
         SummaryStatistics stats = new SummaryStatistics();
-        stats.setMeanImpl(new Mean()); 
+        stats.setMeanImpl(new Mean());
         for(double i : scores) {
           stats.addValue(i);
         }
-        Assert.assertEquals((new Mean()).evaluate(scores),stats.getMean(), 0); 
+        Assert.assertEquals((new Mean()).evaluate(scores),stats.getMean(), 0);
     }
-    
+
     @Test
     public void testOverrideGeoMeanWithMathClass() {
         double[] scores = {1, 2, 3, 4};
         SummaryStatistics stats = new SummaryStatistics();
-        stats.setGeoMeanImpl(new GeometricMean()); 
+        stats.setGeoMeanImpl(new GeometricMean());
         for(double i : scores) {
           stats.addValue(i);
         }
-        Assert.assertEquals((new GeometricMean()).evaluate(scores),stats.getGeometricMean(), 0); 
+        Assert.assertEquals((new GeometricMean()).evaluate(scores),stats.getGeometricMean(), 0);
     }
-    
+
     @Test
     public void testToString() {
         SummaryStatistics u = createSummaryStatistics();

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/descriptive/UnivariateStatisticAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/descriptive/UnivariateStatisticAbstractTest.java b/src/test/java/org/apache/commons/math3/stat/descriptive/UnivariateStatisticAbstractTest.java
index ac15c85..2d8d2d8 100644
--- a/src/test/java/org/apache/commons/math3/stat/descriptive/UnivariateStatisticAbstractTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/descriptive/UnivariateStatisticAbstractTest.java
@@ -100,7 +100,7 @@ public abstract class UnivariateStatisticAbstractTest {
             getUnivariateStatistic().evaluate(testArray),
             getTolerance());
     }
-    
+
     @Test
     public void testEvaluateArraySegment() {
         final UnivariateStatistic stat = getUnivariateStatistic();
@@ -114,7 +114,7 @@ public abstract class UnivariateStatisticAbstractTest {
         System.arraycopy(testArray, testArray.length - 5, arrayEnd, 0, 5);
         Assert.assertEquals(stat.evaluate(arrayEnd), stat.evaluate(testArray, testArray.length - 5, 5), 0);
     }
-    
+
     @Test
     public void testEvaluateArraySegmentWeighted() {
         // See if this statistic computes weighted statistics

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/descriptive/rank/PSquarePercentileTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/descriptive/rank/PSquarePercentileTest.java b/src/test/java/org/apache/commons/math3/stat/descriptive/rank/PSquarePercentileTest.java
index 8f7295a..68d9e08 100644
--- a/src/test/java/org/apache/commons/math3/stat/descriptive/rank/PSquarePercentileTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/descriptive/rank/PSquarePercentileTest.java
@@ -41,7 +41,7 @@ import org.junit.Test;
 
 /**
  * Test cases for the {@link PSquarePercentile} class which naturally extends
- * {@link StorelessUnivariateStatisticAbstractTest}. 
+ * {@link StorelessUnivariateStatisticAbstractTest}.
  */
 public class PSquarePercentileTest extends
         StorelessUnivariateStatisticAbstractTest {
@@ -49,7 +49,7 @@ public class PSquarePercentileTest extends
     protected double percentile5 = 8.2299d;
     protected double percentile95 = 16.72195;// 20.82d; this is approximation
     protected double tolerance = 10E-12;
-    
+
     private final RandomGenerator randomGenerator = new Well19937c(1000);
 
     @Override

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/descriptive/rank/PercentileTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/descriptive/rank/PercentileTest.java b/src/test/java/org/apache/commons/math3/stat/descriptive/rank/PercentileTest.java
index 5381213..b380417 100644
--- a/src/test/java/org/apache/commons/math3/stat/descriptive/rank/PercentileTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/descriptive/rank/PercentileTest.java
@@ -785,12 +785,12 @@ public class PercentileTest extends UnivariateStatisticAbstractTest{
         Assert.assertEquals(2d,new Percentile(50d).withEstimationType(Percentile.EstimationType.R_1).withNaNStrategy(NaNStrategy.REMOVED).evaluate(specialValues),0d);
         Assert.assertEquals(Double.NaN,new Percentile(50d).withEstimationType(Percentile.EstimationType.R_5).withNaNStrategy(NaNStrategy.REMOVED).evaluate(new double[] {Double.NaN,Double.NaN,Double.NaN}),0d);
         Assert.assertEquals(50d,new Percentile(50d).withEstimationType(Percentile.EstimationType.R_7).withNaNStrategy(NaNStrategy.MINIMAL).evaluate(new double[] {50d,50d,50d},1,2),0d);
-        
+
         specialValues = new double[] { 0d, 1d, 2d, 3d, 4d, Double.NaN, Double.NaN };
         Assert.assertEquals(3.5,new Percentile().evaluate(specialValues, 3, 4),0d);
         Assert.assertEquals(4d,new Percentile().evaluate(specialValues, 4, 3),0d);
         Assert.assertTrue(Double.isNaN(new Percentile().evaluate(specialValues, 5, 2)));
-        
+
         specialValues = new double[] { 0d, 1d, 2d, 3d, 4d, Double.NaN, Double.NaN, 5d, 6d };
         Assert.assertEquals(4.5,new Percentile().evaluate(specialValues, 3, 6),0d);
         Assert.assertEquals(5d,new Percentile().evaluate(specialValues, 4, 5),0d);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/descriptive/summary/ProductTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/descriptive/summary/ProductTest.java b/src/test/java/org/apache/commons/math3/stat/descriptive/summary/ProductTest.java
index 7dcaa7c..106286b 100644
--- a/src/test/java/org/apache/commons/math3/stat/descriptive/summary/ProductTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/descriptive/summary/ProductTest.java
@@ -80,7 +80,7 @@ public class ProductTest extends StorelessUnivariateStatisticAbstractTest{
         Assert.assertEquals(expectedWeightedValue(), product.evaluate(testArray, testWeightsArray, 0, testArray.length),getTolerance());
         Assert.assertEquals(expectedValue(), product.evaluate(testArray, unitWeightsArray, 0, testArray.length), getTolerance());
     }
-    
+
     @Override
     protected void checkClearValue(StorelessUnivariateStatistic statistic){
         Assert.assertEquals(1, statistic.getResult(), 0);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/descriptive/summary/SumLogTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/descriptive/summary/SumLogTest.java b/src/test/java/org/apache/commons/math3/stat/descriptive/summary/SumLogTest.java
index ad3576a..bab0577 100644
--- a/src/test/java/org/apache/commons/math3/stat/descriptive/summary/SumLogTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/descriptive/summary/SumLogTest.java
@@ -75,11 +75,11 @@ public class SumLogTest extends StorelessUnivariateStatisticAbstractTest{
         sum.increment(-2d);
         Assert.assertTrue(Double.isNaN(sum.getResult()));
     }
-    
+
     @Override
     protected void checkClearValue(StorelessUnivariateStatistic statistic){
         Assert.assertEquals(0, statistic.getResult(), 0);
     }
-    
+
 
 }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/descriptive/summary/SumSqTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/descriptive/summary/SumSqTest.java b/src/test/java/org/apache/commons/math3/stat/descriptive/summary/SumSqTest.java
index b19ca4e..d0760a6 100644
--- a/src/test/java/org/apache/commons/math3/stat/descriptive/summary/SumSqTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/descriptive/summary/SumSqTest.java
@@ -61,7 +61,7 @@ public class SumSqTest extends StorelessUnivariateStatisticAbstractTest{
         sumSq.increment(1);
         Assert.assertTrue(Double.isNaN(sumSq.getResult()));
     }
-    
+
     @Override
     protected void checkClearValue(StorelessUnivariateStatistic statistic){
         Assert.assertEquals(0, statistic.getResult(), 0);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/descriptive/summary/SumTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/descriptive/summary/SumTest.java b/src/test/java/org/apache/commons/math3/stat/descriptive/summary/SumTest.java
index 87a3f5e..08a13f3 100644
--- a/src/test/java/org/apache/commons/math3/stat/descriptive/summary/SumTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/descriptive/summary/SumTest.java
@@ -70,7 +70,7 @@ public class SumTest extends StorelessUnivariateStatisticAbstractTest{
         Assert.assertEquals(expectedWeightedValue(), sum.evaluate(testArray, testWeightsArray, 0, testArray.length), getTolerance());
         Assert.assertEquals(expectedValue(), sum.evaluate(testArray, unitWeightsArray, 0, testArray.length), getTolerance());
     }
-    
+
     @Override
     protected void checkClearValue(StorelessUnivariateStatistic statistic){
         Assert.assertEquals(0, statistic.getResult(), 0);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/inference/GTestTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/inference/GTestTest.java b/src/test/java/org/apache/commons/math3/stat/inference/GTestTest.java
index 228f0ce..ef606f4 100644
--- a/src/test/java/org/apache/commons/math3/stat/inference/GTestTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/inference/GTestTest.java
@@ -180,7 +180,7 @@ public class GTestTest {
             // expected
         }
     }
-    
+
     @Test
     public void testUnmatchedArrays() {
         final long[] observed = { 0, 1, 2, 3 };
@@ -199,7 +199,7 @@ public class GTestTest {
             // expected
         }
     }
-    
+
     @Test
     public void testNegativeObservedCounts() {
         final long[] observed = { 0, 1, 2, -3 };
@@ -216,9 +216,9 @@ public class GTestTest {
             Assert.fail("negative observed count, NotPositiveException expected");
         } catch (NotPositiveException ex) {
             // expected
-        } 
+        }
     }
-    
+
     @Test
     public void testZeroExpectedCounts() {
         final long[] observed = { 0, 1, 2, -3 };
@@ -230,7 +230,7 @@ public class GTestTest {
             // expected
         }
     }
-    
+
     @Test
     public void testBadAlpha() {
         final long[] observed = { 0, 1, 2, 3 };
@@ -247,9 +247,9 @@ public class GTestTest {
             Assert.fail("zero expected count, NotStrictlyPositiveException expected");
         } catch (OutOfRangeException ex) {
             // expected
-        }  
+        }
     }
-    
+
     @Test
     public void testScaling() {
       final long[] observed = {9, 11, 10, 8, 12};

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/inference/MannWhitneyUTestTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/inference/MannWhitneyUTestTest.java b/src/test/java/org/apache/commons/math3/stat/inference/MannWhitneyUTestTest.java
index e46f8c5..e72d1a6 100644
--- a/src/test/java/org/apache/commons/math3/stat/inference/MannWhitneyUTestTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/inference/MannWhitneyUTestTest.java
@@ -37,11 +37,11 @@ public class MannWhitneyUTestTest {
          * x <- c(19, 22, 16, 29, 24)
          * y <- c(20, 11, 17, 12)
          * wilcox.test(x, y, alternative = "two.sided", mu = 0, paired = FALSE, exact = FALSE, correct = FALSE)
-         * W = 17, p-value = 0.08641 
+         * W = 17, p-value = 0.08641
          */
         final double x[] = {19, 22, 16, 29, 24};
         final double y[] = {20, 11, 17, 12};
-        
+
         Assert.assertEquals(17, testStatistic.mannWhitneyU(x, y), 1e-10);
         Assert.assertEquals(0.08641, testStatistic.mannWhitneyUTest(x, y), 1e-5);
     }
@@ -74,14 +74,14 @@ public class MannWhitneyUTestTest {
         } catch (NullArgumentException ex) {
             // expected
         }
-        
+
         try {
             testStatistic.mannWhitneyUTest(null, null);
             Assert.fail("x and y is null (asymptotic), NullArgumentException expected");
         } catch (NullArgumentException ex) {
             // expected
         }
-        
+
         /*
          * x or y is null
          */
@@ -91,7 +91,7 @@ public class MannWhitneyUTestTest {
         } catch (NullArgumentException ex) {
             // expected
         }
-        
+
         try {
             testStatistic.mannWhitneyUTest(new double[] { 1.0 }, null);
             Assert.fail("y is null (exact), NullArgumentException expected");
@@ -99,7 +99,7 @@ public class MannWhitneyUTestTest {
             // expected
         }
     }
-    
+
     @Test
     public void testBigDataSet() {
         double[] d1 = new double[1500];
@@ -111,7 +111,7 @@ public class MannWhitneyUTestTest {
         double result = testStatistic.mannWhitneyUTest(d1, d2);
         Assert.assertTrue(result > 0.1);
     }
-    
+
     @Test
     public void testBigDataSetOverflow() {
         // MATH-1145

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/inference/TestUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/inference/TestUtilsTest.java b/src/test/java/org/apache/commons/math3/stat/inference/TestUtilsTest.java
index 69bd58a..d3785f5 100644
--- a/src/test/java/org/apache/commons/math3/stat/inference/TestUtilsTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/inference/TestUtilsTest.java
@@ -528,7 +528,7 @@ public class TestUtilsTest {
         Assert.assertEquals(FastMath.sqrt(5734.343), TestUtils.rootLogLikelihoodRatio(1000, 1000, 1000, 100000), 0.001);
         Assert.assertEquals(FastMath.sqrt(5714.932), TestUtils.rootLogLikelihoodRatio(1000, 1000, 1000, 99000), 0.001);
     }
-    
+
     @Test
     public void testKSOneSample() throws Exception {
        final NormalDistribution unitNormal = new NormalDistribution(0d, 1d);
@@ -537,7 +537,7 @@ public class TestUtilsTest {
        Assert.assertEquals(0.3172069207622391, TestUtils.kolmogorovSmirnovTest(unitNormal, sample), tol);
        Assert.assertEquals(0.0932947561266756, TestUtils.kolmogorovSmirnovStatistic(unitNormal, sample), tol);
     }
-    
+
     @Test
     public void testKSTwoSample() throws Exception {
         final double tol = KolmogorovSmirnovTestTest.TOLERANCE;
@@ -552,6 +552,6 @@ public class TestUtilsTest {
         final double d = TestUtils.kolmogorovSmirnovStatistic(smallSample1, smallSample2);
         Assert.assertEquals(0.5, d, tol);
         Assert
-        .assertEquals(0.105577085453247, TestUtils.exactP(d, smallSample1.length,smallSample2.length, false), tol); 
+        .assertEquals(0.105577085453247, TestUtils.exactP(d, smallSample1.length,smallSample2.length, false), tol);
     }
 }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/inference/WilcoxonSignedRankTestTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/inference/WilcoxonSignedRankTestTest.java b/src/test/java/org/apache/commons/math3/stat/inference/WilcoxonSignedRankTestTest.java
index 23ad58b..b273ecb 100644
--- a/src/test/java/org/apache/commons/math3/stat/inference/WilcoxonSignedRankTestTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/inference/WilcoxonSignedRankTestTest.java
@@ -41,28 +41,28 @@ public class WilcoxonSignedRankTestTest {
          */
         final double x[] = {1.83, 0.50, 1.62, 2.48, 1.68, 1.88, 1.55, 3.06, 1.30};
         final double y[] = {0.878, 0.647, 0.598, 2.05, 1.06, 1.29, 1.06, 3.14, 1.29};
-        
+
         /* EXACT:
          * wilcox.test(x, y, alternative = "two.sided", mu = 0, paired = TRUE, exact = TRUE, correct = FALSE)
          * V = 40, p-value = 0.03906
-         * 
+         *
          * Corresponds to the value obtained in R.
          */
         Assert.assertEquals(40, testStatistic.wilcoxonSignedRank(x, y), 1e-10);
-        Assert.assertEquals(0.03906, testStatistic.wilcoxonSignedRankTest(x, y, true), 1e-5);        
-        
+        Assert.assertEquals(0.03906, testStatistic.wilcoxonSignedRankTest(x, y, true), 1e-5);
+
         /* ASYMPTOTIC:
          * wilcox.test(x, y, alternative = "two.sided", mu = 0, paired = TRUE, exact = FALSE, correct = FALSE)
          * V = 40, p-value = 0.03815
-         * 
-         * This is not entirely the same due to different corrects, 
+         *
+         * This is not entirely the same due to different corrects,
          * e.g. http://mlsc.lboro.ac.uk/resources/statistics/wsrt.pdf
          * and src/library/stats/R/wilcox.test.R in the R source
          */
         Assert.assertEquals(40, testStatistic.wilcoxonSignedRank(x, y), 1e-10);
         Assert.assertEquals(0.0329693812, testStatistic.wilcoxonSignedRankTest(x, y, false), 1e-10);
     }
-    
+
     @Test
     public void testWilcoxonSignedRankInputValidation() {
         /*
@@ -73,19 +73,19 @@ public class WilcoxonSignedRankTestTest {
         final double[] y1 = new double[30];
         final double[] y2 = new double[31];
         for (int i = 0; i < 30; ++i) {
-            x1[i] = x2[i] = y1[i] = y2[i] = i;            
+            x1[i] = x2[i] = y1[i] = y2[i] = i;
         }
-        
+
         // Exactly 30 is okay
-        //testStatistic.wilcoxonSignedRankTest(x1, y1, true);            
-        
+        //testStatistic.wilcoxonSignedRankTest(x1, y1, true);
+
         try {
             testStatistic.wilcoxonSignedRankTest(x2, y2, true);
             Assert.fail("More than 30 samples and exact chosen, NumberIsTooLargeException expected");
         } catch (NumberIsTooLargeException ex) {
             // expected
         }
-        
+
         /* Samples must be present, i.e. length > 0
          */
         try {
@@ -131,7 +131,7 @@ public class WilcoxonSignedRankTestTest {
         } catch (DimensionMismatchException ex) {
             // expected
         }
-        
+
         /*
          * x and y is null
          */
@@ -141,14 +141,14 @@ public class WilcoxonSignedRankTestTest {
         } catch (NullArgumentException ex) {
             // expected
         }
-        
+
         try {
             testStatistic.wilcoxonSignedRankTest(null, null, false);
             Assert.fail("x and y is null (asymptotic), NullArgumentException expected");
         } catch (NullArgumentException ex) {
             // expected
         }
-        
+
         /*
          * x or y is null
          */
@@ -158,21 +158,21 @@ public class WilcoxonSignedRankTestTest {
         } catch (NullArgumentException ex) {
             // expected
         }
-        
+
         try {
             testStatistic.wilcoxonSignedRankTest(null, new double[] { 1.0 }, false);
             Assert.fail("x is null (asymptotic), NullArgumentException expected");
         } catch (NullArgumentException ex) {
             // expected
         }
-        
+
         try {
             testStatistic.wilcoxonSignedRankTest(new double[] { 1.0 }, null, true);
             Assert.fail("y is null (exact), NullArgumentException expected");
         } catch (NullArgumentException ex) {
             // expected
         }
-        
+
         try {
             testStatistic.wilcoxonSignedRankTest(new double[] { 1.0 }, null, false);
             Assert.fail("y is null (asymptotic), NullArgumentException expected");

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/interval/AgrestiCoullIntervalTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/interval/AgrestiCoullIntervalTest.java b/src/test/java/org/apache/commons/math3/stat/interval/AgrestiCoullIntervalTest.java
index 2072b0e..4b757c9 100644
--- a/src/test/java/org/apache/commons/math3/stat/interval/AgrestiCoullIntervalTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/interval/AgrestiCoullIntervalTest.java
@@ -32,7 +32,7 @@ public class AgrestiCoullIntervalTest extends BinomialConfidenceIntervalAbstract
     protected BinomialConfidenceInterval createBinomialConfidenceInterval() {
         return new AgrestiCoullInterval();
     }
-    
+
     @Test
     public void testStandardInterval() {
         ConfidenceInterval confidenceInterval = createStandardTestInterval();

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/interval/BinomialConfidenceIntervalAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/interval/BinomialConfidenceIntervalAbstractTest.java b/src/test/java/org/apache/commons/math3/stat/interval/BinomialConfidenceIntervalAbstractTest.java
index a346297..7cc75a3 100644
--- a/src/test/java/org/apache/commons/math3/stat/interval/BinomialConfidenceIntervalAbstractTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/interval/BinomialConfidenceIntervalAbstractTest.java
@@ -35,10 +35,10 @@ public abstract class BinomialConfidenceIntervalAbstractTest {
     private final double confidenceLevel = 0.9;
 
     protected abstract BinomialConfidenceInterval createBinomialConfidenceInterval();
-    
+
     /**
      * Returns the confidence interval for the given statistic with the following values:
-     * 
+     *
      * <ul>
      *  <li>trials: 500</li>
      *  <li>successes: 50</li>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/interval/ClopperPearsonIntervalTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/interval/ClopperPearsonIntervalTest.java b/src/test/java/org/apache/commons/math3/stat/interval/ClopperPearsonIntervalTest.java
index 2dfe1be..8258021 100644
--- a/src/test/java/org/apache/commons/math3/stat/interval/ClopperPearsonIntervalTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/interval/ClopperPearsonIntervalTest.java
@@ -32,7 +32,7 @@ public class ClopperPearsonIntervalTest extends BinomialConfidenceIntervalAbstra
     protected BinomialConfidenceInterval createBinomialConfidenceInterval() {
         return new ClopperPearsonInterval();
     }
-    
+
     @Test
     public void testStandardInterval() {
         ConfidenceInterval confidenceInterval = createStandardTestInterval();

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/interval/IntervalUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/interval/IntervalUtilsTest.java b/src/test/java/org/apache/commons/math3/stat/interval/IntervalUtilsTest.java
index 4f87371..8ebab58 100644
--- a/src/test/java/org/apache/commons/math3/stat/interval/IntervalUtilsTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/interval/IntervalUtilsTest.java
@@ -21,14 +21,14 @@ import org.junit.Test;
 
 /**
  * Test cases for the IntervalUtils class.
- * 
+ *
  */
 public class IntervalUtilsTest {
 
     private final int successes = 50;
     private final int trials = 500;
     private final double confidenceLevel = 0.9;
-    
+
     // values to test must be exactly the same
     private final double eps = 0.0;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/interval/NormalApproximationIntervalTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/interval/NormalApproximationIntervalTest.java b/src/test/java/org/apache/commons/math3/stat/interval/NormalApproximationIntervalTest.java
index 2b0384a..66f6166 100644
--- a/src/test/java/org/apache/commons/math3/stat/interval/NormalApproximationIntervalTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/interval/NormalApproximationIntervalTest.java
@@ -32,7 +32,7 @@ public class NormalApproximationIntervalTest extends BinomialConfidenceIntervalA
     protected BinomialConfidenceInterval createBinomialConfidenceInterval() {
         return new NormalApproximationInterval();
     }
-    
+
     @Test
     public void testStandardInterval() {
         ConfidenceInterval confidenceInterval = createStandardTestInterval();

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/interval/WilsonScoreIntervalTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/interval/WilsonScoreIntervalTest.java b/src/test/java/org/apache/commons/math3/stat/interval/WilsonScoreIntervalTest.java
index af64a54..b612ff4 100644
--- a/src/test/java/org/apache/commons/math3/stat/interval/WilsonScoreIntervalTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/interval/WilsonScoreIntervalTest.java
@@ -32,7 +32,7 @@ public class WilsonScoreIntervalTest extends BinomialConfidenceIntervalAbstractT
     protected BinomialConfidenceInterval createBinomialConfidenceInterval() {
         return new WilsonScoreInterval();
     }
-    
+
     @Test
     public void testStandardInterval() {
         ConfidenceInterval confidenceInterval = createStandardTestInterval();

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/ranking/NaturalRankingTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/ranking/NaturalRankingTest.java b/src/test/java/org/apache/commons/math3/stat/ranking/NaturalRankingTest.java
index e1ddf06..33a3db4 100644
--- a/src/test/java/org/apache/commons/math3/stat/ranking/NaturalRankingTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/ranking/NaturalRankingTest.java
@@ -44,28 +44,28 @@ public class NaturalRankingTest {
     public void testDefault() { // Ties averaged, NaNs failed
         NaturalRanking ranking = new NaturalRanking();
         double[] ranks;
-        
+
         try {
             ranks = ranking.rank(exampleData);
             Assert.fail("expected NotANumberException due to NaNStrategy.FAILED");
         } catch (NotANumberException e) {
             // expected
         }
-        
+
         ranks = ranking.rank(tiesFirst);
         double[] correctRanks = new double[] { 1.5, 1.5, 4, 3, 5 };
         TestUtils.assertEquals(correctRanks, ranks, 0d);
         ranks = ranking.rank(tiesLast);
         correctRanks = new double[] { 3.5, 3.5, 2, 1 };
         TestUtils.assertEquals(correctRanks, ranks, 0d);
-        
+
         try {
             ranks = ranking.rank(multipleNaNs);
             Assert.fail("expected NotANumberException due to NaNStrategy.FAILED");
         } catch (NotANumberException e) {
             // expected
         }
-        
+
         ranks = ranking.rank(multipleTies);
         correctRanks = new double[] { 3, 2, 4.5, 4.5, 6.5, 6.5, 1 };
         TestUtils.assertEquals(correctRanks, ranks, 0d);
@@ -207,14 +207,14 @@ public class NaturalRankingTest {
         correctRanks = new double[] { 3, 4, 1.5, 1.5 };
         TestUtils.assertEquals(correctRanks, ranks, 0d);
     }
-    
+
     @Test(expected=NotANumberException.class)
     public void testNaNsFailed() {
         double[] data = { 0, Double.POSITIVE_INFINITY, Double.NaN, Double.NEGATIVE_INFINITY };
         NaturalRanking ranking = new NaturalRanking(NaNStrategy.FAILED);
         ranking.rank(data);
     }
-    
+
     @Test
     public void testNoNaNsFailed() {
         double[] data = { 1, 2, 3, 4 };
@@ -222,5 +222,5 @@ public class NaturalRankingTest {
         double[] ranks = ranking.rank(data);
         TestUtils.assertEquals(data, ranks, 0d);
     }
-    
+
 }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/regression/GLSMultipleLinearRegressionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/regression/GLSMultipleLinearRegressionTest.java b/src/test/java/org/apache/commons/math3/stat/regression/GLSMultipleLinearRegressionTest.java
index 3896487..e00cee5 100644
--- a/src/test/java/org/apache/commons/math3/stat/regression/GLSMultipleLinearRegressionTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/regression/GLSMultipleLinearRegressionTest.java
@@ -162,18 +162,18 @@ public class GLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
         model.newSampleData(y, x, omega);
         TestUtils.assertEquals(model.calculateYVariance(), 3.5, 0);
     }
-    
+
     /**
      * Verifies that setting X, Y and covariance separately has the same effect as newSample(X,Y,cov).
      */
     @Test
     public void testNewSample2() {
-        double[] y = new double[] {1, 2, 3, 4}; 
+        double[] y = new double[] {1, 2, 3, 4};
         double[][] x = new double[][] {
           {19, 22, 33},
           {20, 30, 40},
           {25, 35, 45},
-          {27, 37, 47}   
+          {27, 37, 47}
         };
         double[][] covariance = MatrixUtils.createRealIdentityMatrix(4).scalarMultiply(2).getData();
         GLSMultipleLinearRegression regression = new GLSMultipleLinearRegression();
@@ -187,13 +187,13 @@ public class GLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
         Assert.assertEquals(combinedY, regression.getY());
         Assert.assertEquals(combinedCovInv, regression.getOmegaInverse());
     }
-    
+
     /**
      * Verifies that GLS with identity covariance matrix gives the same results
      * as OLS.
      */
     @Test
-    public void testGLSOLSConsistency() {      
+    public void testGLSOLSConsistency() {
         RealMatrix identityCov = MatrixUtils.createRealIdentityMatrix(16);
         GLSMultipleLinearRegression glsModel = new GLSMultipleLinearRegression();
         OLSMultipleLinearRegression olsModel = new OLSMultipleLinearRegression();
@@ -208,7 +208,7 @@ public class GLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
             TestUtils.assertRelativelyEquals(olsBeta[i], glsBeta[i], 10E-7);
         }
     }
-    
+
     /**
      * Generate an error covariance matrix and sample data representing models
      * with this error structure. Then verify that GLS estimated coefficients,
@@ -218,7 +218,7 @@ public class GLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
     public void testGLSEfficiency() {
         RandomGenerator rg = new JDKRandomGenerator();
         rg.setSeed(200);  // Seed has been selected to generate non-trivial covariance
-        
+
         // Assume model has 16 observations (will use Longley data).  Start by generating
         // non-constant variances for the 16 error terms.
         final int nObs = 16;
@@ -226,7 +226,7 @@ public class GLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
         for (int i = 0; i < nObs; i++) {
             sigma[i] = 10 * rg.nextDouble();
         }
-        
+
         // Now generate 1000 error vectors to use to estimate the covariance matrix
         // Columns are draws on N(0, sigma[col])
         final int numSeeds = 1000;
@@ -236,16 +236,16 @@ public class GLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
                 errorSeeds.setEntry(i, j, rg.nextGaussian() * sigma[j]);
             }
         }
-        
+
         // Get covariance matrix for columns
         RealMatrix cov = (new Covariance(errorSeeds)).getCovarianceMatrix();
-          
+
         // Create a CorrelatedRandomVectorGenerator to use to generate correlated errors
         GaussianRandomGenerator rawGenerator = new GaussianRandomGenerator(rg);
         double[] errorMeans = new double[nObs];  // Counting on init to 0 here
         CorrelatedRandomVectorGenerator gen = new CorrelatedRandomVectorGenerator(errorMeans, cov,
          1.0e-12 * cov.getNorm(), rawGenerator);
-        
+
         // Now start generating models.  Use Longley X matrix on LHS
         // and Longley OLS beta vector as "true" beta.  Generate
         // Y values by XB + u where u is a CorrelatedRandomVector generated
@@ -254,44 +254,44 @@ public class GLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
         ols.newSampleData(longley, nObs, 6);
         final RealVector b = ols.calculateBeta().copy();
         final RealMatrix x = ols.getX().copy();
-        
+
         // Create a GLS model to reuse
         GLSMultipleLinearRegression gls = new GLSMultipleLinearRegression();
         gls.newSampleData(longley, nObs, 6);
         gls.newCovarianceData(cov.getData());
-        
+
         // Create aggregators for stats measuring model performance
         DescriptiveStatistics olsBetaStats = new DescriptiveStatistics();
         DescriptiveStatistics glsBetaStats = new DescriptiveStatistics();
-        
+
         // Generate Y vectors for 10000 models, estimate GLS and OLS and
         // Verify that OLS estimates are better
         final int nModels = 10000;
         for (int i = 0; i < nModels; i++) {
-            
+
             // Generate y = xb + u with u cov
             RealVector u = MatrixUtils.createRealVector(gen.nextVector());
             double[] y = u.add(x.operate(b)).toArray();
-            
+
             // Estimate OLS parameters
             ols.newYSampleData(y);
             RealVector olsBeta = ols.calculateBeta();
-            
+
             // Estimate GLS parameters
             gls.newYSampleData(y);
             RealVector glsBeta = gls.calculateBeta();
-            
+
             // Record deviations from "true" beta
             double dist = olsBeta.getDistance(b);
             olsBetaStats.addValue(dist * dist);
             dist = glsBeta.getDistance(b);
             glsBetaStats.addValue(dist * dist);
-            
+
         }
-        
+
         // Verify that GLS is on average more efficient, lower variance
         assert(olsBetaStats.getMean() > 1.5 * glsBetaStats.getMean());
-        assert(olsBetaStats.getStandardDeviation() > glsBetaStats.getStandardDeviation());  
+        assert(olsBetaStats.getStandardDeviation() > glsBetaStats.getStandardDeviation());
     }
-    
+
 }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/regression/MillerUpdatingRegressionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/regression/MillerUpdatingRegressionTest.java b/src/test/java/org/apache/commons/math3/stat/regression/MillerUpdatingRegressionTest.java
index 2ff023c..7f0a06a 100644
--- a/src/test/java/org/apache/commons/math3/stat/regression/MillerUpdatingRegressionTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/regression/MillerUpdatingRegressionTest.java
@@ -30,9 +30,9 @@ public class MillerUpdatingRegressionTest {
 
     public MillerUpdatingRegressionTest() {
     }
-    /* This is the Greene Airline Cost data. 
+    /* This is the Greene Airline Cost data.
      * The data can be downloaded from http://www.indiana.edu/~statmath/stat/all/panel/airline.csv
-     */ 
+     */
     private final static double[][] airdata = {
         /*"I",*/new double[]{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6},
         /*"T",*/ new double[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
@@ -327,7 +327,7 @@ public class MillerUpdatingRegressionTest {
 //            tmp[6] = tmp[2] * tmp[3]; //^7
 //            tmp[7] = tmp[3] * tmp[3]; //^8
 //            tmp[8] = tmp[4] * tmp[3]; //^9
-//            tmp[9] = tmp[4] * tmp[4]; //^10           
+//            tmp[9] = tmp[4] * tmp[4]; //^10
             tmp[1] = tmp[0] * tmp[0];
             tmp[2] = tmp[0] * tmp[1];
             tmp[3] = tmp[0] * tmp[2];
@@ -678,12 +678,12 @@ public class MillerUpdatingRegressionTest {
                     0.214274163161675,
                     0.226073200069370,
                     455.478499142212}, errors, 1E-6);
-//        
+//
         // Check R-Square statistics against R
         TestUtils.assertEquals(0.995479004577296, result.getRSquared(), 1E-12);
         TestUtils.assertEquals(0.992465007628826, result.getAdjustedRSquared(), 1E-12);
-//        
-//        
+//
+//
 //        // Estimate model without intercept
         model = new MillerUpdatingRegression(6, false);
         off = 0;
@@ -699,13 +699,13 @@ public class MillerUpdatingRegressionTest {
                 new double[]{-52.99357013868291, 0.07107319907358,
                     -0.42346585566399, -0.57256866841929,
                     -0.41420358884978, 48.41786562001326}, 1E-11);
-//        
+//
         // Check standard errors from R
         errors = result.getStdErrorOfEstimates();
         TestUtils.assertEquals(new double[]{129.54486693117232, 0.03016640003786,
                     0.41773654056612, 0.27899087467676, 0.32128496193363,
                     17.68948737819961}, errors, 1E-11);
-//        
+//
 
 //        // Check R-Square statistics against R
         TestUtils.assertEquals(0.9999670130706, result.getRSquared(), 1E-12);
@@ -1045,11 +1045,11 @@ public class MillerUpdatingRegressionTest {
         }
         return;
     }
-    
-    
+
+
     @Test
     public void testSubsetRegression() {
-        
+
         MillerUpdatingRegression instance = new MillerUpdatingRegression(3, true);
         MillerUpdatingRegression redRegression = new MillerUpdatingRegression(2, true);
         double[][] x = new double[airdata[0].length][];
@@ -1060,23 +1060,23 @@ public class MillerUpdatingRegressionTest {
             x[i][0] = FastMath.log(airdata[3][i]);
             x[i][1] = FastMath.log(airdata[4][i]);
             x[i][2] = airdata[5][i];
-            
+
             xReduced[i] = new double[2];
             xReduced[i][0] = FastMath.log(airdata[3][i]);
             xReduced[i][1] = FastMath.log(airdata[4][i]);
-            
+
             y[i] = FastMath.log(airdata[2][i]);
         }
 
         instance.addObservations(x, y);
         redRegression.addObservations(xReduced, y);
-        
+
         RegressionResults resultsInstance = instance.regress( new int[]{0,1,2} );
         RegressionResults resultsReduced = redRegression.regress();
-        
+
         TestUtils.assertEquals(resultsInstance.getParameterEstimates(), resultsReduced.getParameterEstimates(), 1.0e-12);
         TestUtils.assertEquals(resultsInstance.getStdErrorOfEstimates(), resultsReduced.getStdErrorOfEstimates(), 1.0e-12);
     }
-    
-    
+
+
 }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/regression/MultipleLinearRegressionAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/regression/MultipleLinearRegressionAbstractTest.java b/src/test/java/org/apache/commons/math3/stat/regression/MultipleLinearRegressionAbstractTest.java
index ea5fecf..759422b 100644
--- a/src/test/java/org/apache/commons/math3/stat/regression/MultipleLinearRegressionAbstractTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/regression/MultipleLinearRegressionAbstractTest.java
@@ -64,7 +64,7 @@ public abstract class MultipleLinearRegressionAbstractTest {
             Assert.assertTrue(variance > 0.0);
         }
     }
-    
+
     /**
      * Verifies that newSampleData methods consistently insert unitary columns
      * in design matrix.  Confirms the fix for MATH-411.
@@ -77,12 +77,12 @@ public abstract class MultipleLinearRegressionAbstractTest {
           3, 25, 35, 45,
           4, 27, 37, 47
         };
-        double[] y = new double[] {1, 2, 3, 4}; 
+        double[] y = new double[] {1, 2, 3, 4};
         double[][] x = new double[][] {
           {19, 22, 33},
           {20, 30, 40},
           {25, 35, 45},
-          {27, 37, 47}   
+          {27, 37, 47}
         };
         AbstractMultipleLinearRegression regression = createRegression();
         regression.newSampleData(design, 4, 3);
@@ -92,7 +92,7 @@ public abstract class MultipleLinearRegressionAbstractTest {
         regression.newYSampleData(y);
         Assert.assertEquals(flatX, regression.getX());
         Assert.assertEquals(flatY, regression.getY());
-        
+
         // No intercept
         regression.setNoIntercept(true);
         regression.newSampleData(design, 4, 3);
@@ -103,30 +103,30 @@ public abstract class MultipleLinearRegressionAbstractTest {
         Assert.assertEquals(flatX, regression.getX());
         Assert.assertEquals(flatY, regression.getY());
     }
-    
+
     @Test(expected=IllegalArgumentException.class)
     public void testNewSampleNullData() {
         double[] data = null;
-        createRegression().newSampleData(data, 2, 3); 
+        createRegression().newSampleData(data, 2, 3);
     }
-    
+
     @Test(expected=IllegalArgumentException.class)
     public void testNewSampleInvalidData() {
         double[] data = new double[] {1, 2, 3, 4};
         createRegression().newSampleData(data, 2, 3);
     }
-    
+
     @Test(expected=IllegalArgumentException.class)
     public void testNewSampleInsufficientData() {
         double[] data = new double[] {1, 2, 3, 4};
         createRegression().newSampleData(data, 1, 3);
     }
-    
+
     @Test(expected=IllegalArgumentException.class)
     public void testXSampleDataNull() {
         createRegression().newXSampleData(null);
     }
-    
+
     @Test(expected=IllegalArgumentException.class)
     public void testYSampleDataNull() {
         createRegression().newYSampleData(null);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/regression/OLSMultipleLinearRegressionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/regression/OLSMultipleLinearRegressionTest.java b/src/test/java/org/apache/commons/math3/stat/regression/OLSMultipleLinearRegressionTest.java
index d719c8b..87dabb8 100644
--- a/src/test/java/org/apache/commons/math3/stat/regression/OLSMultipleLinearRegressionTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/regression/OLSMultipleLinearRegressionTest.java
@@ -63,7 +63,7 @@ public class OLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
     protected int getSampleSize() {
         return y.length;
     }
-    
+
     @Test(expected=IllegalArgumentException.class)
     public void cannotAddSampleDataWithSizeMismatch() {
         double[] y = new double[]{1.0, 2.0};
@@ -170,33 +170,33 @@ public class OLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
                        0.214274163161675,
                        0.226073200069370,
                        455.478499142212}, errors, 1E-6);
-        
+
         // Check regression standard error against R
         Assert.assertEquals(304.8540735619638, model.estimateRegressionStandardError(), 1E-10);
-        
+
         // Check R-Square statistics against R
         Assert.assertEquals(0.995479004577296, model.calculateRSquared(), 1E-12);
         Assert.assertEquals(0.992465007628826, model.calculateAdjustedRSquared(), 1E-12);
-        
+
         checkVarianceConsistency(model);
-        
+
         // Estimate model without intercept
         model.setNoIntercept(true);
         model.newSampleData(design, nobs, nvars);
-        
+
         // Check expected beta values from R
         betaHat = model.estimateRegressionParameters();
         TestUtils.assertEquals(betaHat,
           new double[]{-52.99357013868291, 0.07107319907358,
                 -0.42346585566399,-0.57256866841929,
-                -0.41420358884978, 48.41786562001326}, 1E-11); 
-        
+                -0.41420358884978, 48.41786562001326}, 1E-11);
+
         // Check standard errors from R
         errors = model.estimateRegressionParametersStandardErrors();
         TestUtils.assertEquals(new double[] {129.54486693117232, 0.03016640003786,
                 0.41773654056612, 0.27899087467676, 0.32128496193363,
                 17.68948737819961}, errors, 1E-11);
-        
+
         // Check expected residuals from R
         residuals = model.estimateResiduals();
         TestUtils.assertEquals(residuals, new double[]{
@@ -205,14 +205,14 @@ public class OLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
                 73.09368242049943, 913.21694494481869, 424.82484953610174, -8.56475876776709,
                 -361.32974610842876, 27.34560497213464, 151.28955976355002, -492.49937355336846},
                       1E-10);
-        
+
         // Check regression standard error against R
         Assert.assertEquals(475.1655079819517, model.estimateRegressionStandardError(), 1E-10);
-        
+
         // Check R-Square statistics against R
         Assert.assertEquals(0.9999670130706, model.calculateRSquared(), 1E-12);
         Assert.assertEquals(0.999947220913, model.calculateAdjustedRSquared(), 1E-12);
-         
+
     }
 
     /**
@@ -270,7 +270,7 @@ public class OLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
             44.7,46.6,16,29,50.43,
             42.8,27.7,22,29,58.33
         };
-        
+
         final int nobs = 47;
         final int nvars = 4;
 
@@ -315,16 +315,16 @@ public class OLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
                 0.27410957467466,
                 0.19454551679325,
                 0.03726654773803}, errors, 1E-10);
-        
+
         // Check regression standard error against R
         Assert.assertEquals(7.73642194433223, model.estimateRegressionStandardError(), 1E-12);
-        
+
         // Check R-Square statistics against R
         Assert.assertEquals(0.649789742860228, model.calculateRSquared(), 1E-12);
         Assert.assertEquals(0.6164363850373927, model.calculateAdjustedRSquared(), 1E-12);
-        
+
         checkVarianceConsistency(model);
-        
+
         // Estimate the model with no intercept
         model = new OLSMultipleLinearRegression();
         model.setNoIntercept(true);
@@ -335,15 +335,15 @@ public class OLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
         TestUtils.assertEquals(betaHat,
                 new double[]{0.52191832900513,
                   2.36588087917963,
-                  -0.94770353802795, 
+                  -0.94770353802795,
                   0.30851985863609}, 1E-12);
 
         // Check expected residuals from R
         residuals = model.estimateResiduals();
         TestUtils.assertEquals(residuals, new double[]{
-                44.138759883538249, 27.720705122356215, 35.873200836126799, 
+                44.138759883538249, 27.720705122356215, 35.873200836126799,
                 34.574619581211977, 26.600168342080213, 15.074636243026923, -12.704904871199814,
-                1.497443824078134, 2.691972687079431, 5.582798774291231, -4.422986561283165, 
+                1.497443824078134, 2.691972687079431, 5.582798774291231, -4.422986561283165,
                 -9.198581600334345, 4.481765170730647, 2.273520207553216, -22.649827853221336,
                 -17.747900013943308, 20.298314638496436, 6.861405135329779, -8.684712790954924,
                 -10.298639278062371, -9.896618896845819, 4.568568616351242, -15.313570491727944,
@@ -359,10 +359,10 @@ public class OLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
         errors = model.estimateRegressionParametersStandardErrors();
         TestUtils.assertEquals(new double[] {0.10470063765677, 0.41684100584290,
                 0.43370143099691, 0.07694953606522}, errors, 1E-10);
-        
+
         // Check regression standard error against R
         Assert.assertEquals(17.24710630547, model.estimateRegressionStandardError(), 1E-10);
-        
+
         // Check R-Square statistics against R
         Assert.assertEquals(0.946350722085, model.calculateRSquared(), 1E-12);
         Assert.assertEquals(0.9413600915813, model.calculateAdjustedRSquared(), 1E-12);
@@ -449,7 +449,7 @@ public class OLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
         model.newSampleData(y, x);
         TestUtils.assertEquals(model.calculateYVariance(), 3.5, 0);
     }
-    
+
     /**
      * Verifies that calculateYVariance and calculateResidualVariance return consistent
      * values with direct variance computation from Y, residuals, respectively.
@@ -457,27 +457,27 @@ public class OLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
     protected void checkVarianceConsistency(OLSMultipleLinearRegression model) {
         // Check Y variance consistency
         TestUtils.assertEquals(StatUtils.variance(model.getY().toArray()), model.calculateYVariance(), 0);
-        
+
         // Check residual variance consistency
         double[] residuals = model.calculateResiduals().toArray();
         RealMatrix X = model.getX();
         TestUtils.assertEquals(
                 StatUtils.variance(model.calculateResiduals().toArray()) * (residuals.length - 1),
                 model.calculateErrorVariance() * (X.getRowDimension() - X.getColumnDimension()), 1E-20);
-        
+
     }
-    
+
     /**
      * Verifies that setting X and Y separately has the same effect as newSample(X,Y).
      */
     @Test
     public void testNewSample2() {
-        double[] y = new double[] {1, 2, 3, 4}; 
+        double[] y = new double[] {1, 2, 3, 4};
         double[][] x = new double[][] {
           {19, 22, 33},
           {20, 30, 40},
           {25, 35, 45},
-          {27, 37, 47}   
+          {27, 37, 47}
         };
         OLSMultipleLinearRegression regression = new OLSMultipleLinearRegression();
         regression.newSampleData(y, x);
@@ -487,7 +487,7 @@ public class OLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
         regression.newYSampleData(y);
         Assert.assertEquals(combinedX, regression.getX());
         Assert.assertEquals(combinedY, regression.getY());
-        
+
         // No intercept
         regression.setNoIntercept(true);
         regression.newSampleData(y, x);
@@ -498,17 +498,17 @@ public class OLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
         Assert.assertEquals(combinedX, regression.getX());
         Assert.assertEquals(combinedY, regression.getY());
     }
-    
+
     @Test(expected=IllegalArgumentException.class)
     public void testNewSampleDataYNull() {
         createRegression().newSampleData(null, new double[][] {});
     }
-    
+
     @Test(expected=IllegalArgumentException.class)
     public void testNewSampleDataXNull() {
         createRegression().newSampleData(new double[] {}, null);
     }
-    
+
      /*
      * This is a test based on the Wampler1 data set
      * http://www.itl.nist.gov/div898/strd/lls/data/Wampler1.shtml
@@ -568,7 +568,7 @@ public class OLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
                 new double[]{0.0,
                     0.0, 0.0,
                     0.0, 0.0,
-                    0.0}, 1E-8); 
+                    0.0}, 1E-8);
 
         TestUtils.assertEquals(1.0, model.calculateRSquared(), 1.0e-10);
         TestUtils.assertEquals(0, model.estimateErrorVariance(), 1.0e-7);
@@ -576,7 +576,7 @@ public class OLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
 
         return;
     }
-    
+
     /*
      * This is a test based on the Wampler2 data set
      * http://www.itl.nist.gov/div898/strd/lls/data/Wampler2.shtml
@@ -638,13 +638,13 @@ public class OLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
                 new double[]{0.0,
                     0.0, 0.0,
                     0.0, 0.0,
-                    0.0}, 1E-8); 
+                    0.0}, 1E-8);
         TestUtils.assertEquals(1.0, model.calculateRSquared(), 1.0e-10);
         TestUtils.assertEquals(0, model.estimateErrorVariance(), 1.0e-7);
         TestUtils.assertEquals(0.00, model.calculateResidualSumOfSquares(), 1.0e-6);
         return;
     }
-    
+
     /*
      * This is a test based on the Wampler3 data set
      * http://www.itl.nist.gov/div898/strd/lls/data/Wampler3.shtml
@@ -699,7 +699,7 @@ public class OLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
                     1.0,
                     1.0,
                     1.0,
-                    1.0}, 1E-8); 
+                    1.0}, 1E-8);
 
         double[] se = model.estimateRegressionParametersStandardErrors();
         TestUtils.assertEquals(se,
@@ -768,21 +768,21 @@ public class OLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
                     1.0,
                     1.0,
                     1.0,
-                    1.0}, 1E-6); 
+                    1.0}, 1E-6);
 
         double[] se = model.estimateRegressionParametersStandardErrors();
         TestUtils.assertEquals(se,
                 new double[]{215232.624678170,
                     236355.173469681, 77934.3524331583,
                     10147.5507550350, 564.566512170752,
-                    11.2324854679312}, 1E-8); 
+                    11.2324854679312}, 1E-8);
 
         TestUtils.assertEquals(.957478440825662, model.calculateRSquared(), 1.0e-10);
         TestUtils.assertEquals(55702845333.3333, model.estimateErrorVariance(), 1.0e-4);
         TestUtils.assertEquals(835542680000.000, model.calculateResidualSumOfSquares(), 1.0e-3);
         return;
     }
-    
+
     /**
      * Anything requiring beta calculation should advertise SME.
      */
@@ -792,26 +792,26 @@ public class OLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
         model.newSampleData(new double[] {1,  2,  3, 1, 2, 3, 1, 2, 3}, 3, 2);
         model.calculateBeta();
     }
-    
+
     @Test
     public void testNoSSTOCalculateRsquare() {
         OLSMultipleLinearRegression model = new OLSMultipleLinearRegression();
         model.newSampleData(new double[] {1,  2,  3, 1, 7, 8, 1, 10, 12}, 3, 2);
         Assert.assertTrue(Double.isNaN(model.calculateRSquared()));
     }
-    
+
     @Test(expected=NullPointerException.class)
     public void testNoDataNPECalculateBeta() {
         OLSMultipleLinearRegression model = new OLSMultipleLinearRegression();
         model.calculateBeta();
     }
-    
+
     @Test(expected=NullPointerException.class)
     public void testNoDataNPECalculateHat() {
         OLSMultipleLinearRegression model = new OLSMultipleLinearRegression();
         model.calculateHat();
     }
-    
+
     @Test(expected=NullPointerException.class)
     public void testNoDataNPESSTO() {
         OLSMultipleLinearRegression model = new OLSMultipleLinearRegression();

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/regression/SimpleRegressionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/regression/SimpleRegressionTest.java b/src/test/java/org/apache/commons/math3/stat/regression/SimpleRegressionTest.java
index 063e06b..e79ab6a 100644
--- a/src/test/java/org/apache/commons/math3/stat/regression/SimpleRegressionTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/regression/SimpleRegressionTest.java
@@ -547,7 +547,7 @@ public final class SimpleRegressionTest {
         Assert.assertTrue(regression.getSlope() > 0.0);
         Assert.assertTrue(regression.getSumSquaredErrors() >= 0.0);
     }
-    
+
     @Test
     public void testPerfect2() {
         SimpleRegression regression = new SimpleRegression();

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/util/CombinationsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/util/CombinationsTest.java b/src/test/java/org/apache/commons/math3/util/CombinationsTest.java
index 99b8e60..da52951 100644
--- a/src/test/java/org/apache/commons/math3/util/CombinationsTest.java
+++ b/src/test/java/org/apache/commons/math3/util/CombinationsTest.java
@@ -145,7 +145,7 @@ public class CombinationsTest {
      * Verifies that the iterator generates a lexicographically
      * increasing sequence of b(n,k) arrays, each having length k
      * and each array itself increasing.
-     * 
+     *
      * @param c Combinations.
      */
     private void checkLexicographicIterator(Combinations c) {
@@ -177,7 +177,7 @@ public class CombinationsTest {
         Assert.assertEquals(CombinatoricsUtils.binomialCoefficient(n, k),
                             numIterates);
     }
-    
+
     @Test
     public void testCombinationsIteratorFail() {
         try {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/util/FastMathTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/util/FastMathTest.java b/src/test/java/org/apache/commons/math3/util/FastMathTest.java
index 2df5542..2d7607d 100644
--- a/src/test/java/org/apache/commons/math3/util/FastMathTest.java
+++ b/src/test/java/org/apache/commons/math3/util/FastMathTest.java
@@ -182,14 +182,14 @@ public class FastMathTest {
         for (double x = start; x < end; x += 1e-3) {
             final double tst = FastMath.cosh(x);
             final double ref = Math.cosh(x);
-            maxErr = FastMath.max(maxErr, FastMath.abs(ref - tst) / FastMath.ulp(ref));            
+            maxErr = FastMath.max(maxErr, FastMath.abs(ref - tst) / FastMath.ulp(ref));
         }
         Assert.assertEquals(0, maxErr, 3);
 
         for (double x = start; x < end; x += 1e-3) {
             final double tst = FastMath.sinh(x);
             final double ref = Math.sinh(x);
-            maxErr = FastMath.max(maxErr, FastMath.abs(ref - tst) / FastMath.ulp(ref));            
+            maxErr = FastMath.max(maxErr, FastMath.abs(ref - tst) / FastMath.ulp(ref));
         }
         Assert.assertEquals(0, maxErr, 3);
     }
@@ -204,18 +204,18 @@ public class FastMathTest {
         for (double x = start; x > end; x -= 1e-3) {
             final double tst = FastMath.cosh(x);
             final double ref = Math.cosh(x);
-            maxErr = FastMath.max(maxErr, FastMath.abs(ref - tst) / FastMath.ulp(ref));            
+            maxErr = FastMath.max(maxErr, FastMath.abs(ref - tst) / FastMath.ulp(ref));
         }
         Assert.assertEquals(0, maxErr, 3);
 
         for (double x = start; x > end; x -= 1e-3) {
             final double tst = FastMath.sinh(x);
             final double ref = Math.sinh(x);
-            maxErr = FastMath.max(maxErr, FastMath.abs(ref - tst) / FastMath.ulp(ref));            
+            maxErr = FastMath.max(maxErr, FastMath.abs(ref - tst) / FastMath.ulp(ref));
         }
         Assert.assertEquals(0, maxErr, 3);
     }
-    
+
     @Test
     public void testMath1269() {
         final double arg = 709.8125;
@@ -1027,13 +1027,13 @@ public class FastMathTest {
      */
     @Test
     public void testAcosSpecialCases() {
-        
+
         Assert.assertTrue("acos(NaN) should be NaN", Double.isNaN(FastMath.acos(Double.NaN)));
-        
+
         Assert.assertTrue("acos(-1.1) should be NaN", Double.isNaN(FastMath.acos(-1.1)));
 
         Assert.assertTrue("acos(-1.1) should be NaN", Double.isNaN(FastMath.acos(1.1)));
-        
+
         Assert.assertEquals("acos(-1.0) should be PI", FastMath.acos(-1.0), FastMath.PI, Precision.EPSILON);
 
         Assert.assertEquals("acos(1.0) should be 0.0", FastMath.acos(1.0), 0.0, Precision.EPSILON);
@@ -1046,13 +1046,13 @@ public class FastMathTest {
      */
     @Test
     public void testAsinSpecialCases() {
-   
+
         Assert.assertTrue("asin(NaN) should be NaN", Double.isNaN(FastMath.asin(Double.NaN)));
-        
+
         Assert.assertTrue("asin(1.1) should be NaN", Double.isNaN(FastMath.asin(1.1)));
-        
+
         Assert.assertTrue("asin(-1.1) should be NaN", Double.isNaN(FastMath.asin(-1.1)));
-        
+
         Assert.assertEquals("asin(1.0) should be PI/2", FastMath.asin(1.0), FastMath.PI / 2.0, Precision.EPSILON);
 
         Assert.assertEquals("asin(-1.0) should be -PI/2", FastMath.asin(-1.0), -FastMath.PI / 2.0, Precision.EPSILON);
@@ -1458,7 +1458,7 @@ public class FastMathTest {
     public void testIntPowLongMinValue() {
         Assert.assertEquals(1.0, FastMath.pow(1.0, Long.MIN_VALUE), -1.0);
     }
-    
+
     @Test(timeout=5000L)
     public void testIntPowSpecialCases() {
         final double EXACT = -1.0;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/util/IncrementorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/util/IncrementorTest.java b/src/test/java/org/apache/commons/math3/util/IncrementorTest.java
index 0c7d4fb..382b0fc 100644
--- a/src/test/java/org/apache/commons/math3/util/IncrementorTest.java
+++ b/src/test/java/org/apache/commons/math3/util/IncrementorTest.java
@@ -134,4 +134,4 @@ public class IncrementorTest {
         i.incrementCount(1);
         Assert.assertEquals(3, i.getCount());
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/util/ResizableDoubleArrayTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/util/ResizableDoubleArrayTest.java b/src/test/java/org/apache/commons/math3/util/ResizableDoubleArrayTest.java
index 3a1a1d7..1a7b45a 100644
--- a/src/test/java/org/apache/commons/math3/util/ResizableDoubleArrayTest.java
+++ b/src/test/java/org/apache/commons/math3/util/ResizableDoubleArrayTest.java
@@ -61,11 +61,11 @@ public class ResizableDoubleArrayTest extends DoubleArrayAbstractTest {
         } catch (IllegalArgumentException ex) {
             // expected
         }
-        
+
         testDa = new ResizableDoubleArray((double[]) null);
         Assert.assertEquals(0, testDa.getNumElements());
-        
-        double[] initialArray = new double[] { 0, 1, 2 };        
+
+        double[] initialArray = new double[] { 0, 1, 2 };
         testDa = new ResizableDoubleArray(initialArray);
         Assert.assertEquals(3, testDa.getNumElements());
 
@@ -125,14 +125,14 @@ public class ResizableDoubleArrayTest extends DoubleArrayAbstractTest {
         ResizableDoubleArray copyDa = new ResizableDoubleArray(testDa);
         Assert.assertEquals(copyDa, testDa);
         Assert.assertEquals(testDa, copyDa);
-        
+
         // JIRA: MATH-1252
         final double[] values = {1};
         testDa = new ResizableDoubleArray(values);
         Assert.assertArrayEquals(values, testDa.getElements(), 0);
         Assert.assertEquals(1, testDa.getNumElements());
         Assert.assertEquals(1, testDa.getElement(0), 0);
-        
+
     }
 
 
@@ -205,24 +205,24 @@ public class ResizableDoubleArrayTest extends DoubleArrayAbstractTest {
                 "16 and an expansion factor of 2.0",
                 1024, ((ResizableDoubleArray) da).getCapacity());
     }
-    
+
     @Test
     public void testAddElements() {
         ResizableDoubleArray testDa = new ResizableDoubleArray();
-        
+
         // MULTIPLICATIVE_MODE
         testDa.addElements(new double[] {4, 5, 6});
         Assert.assertEquals(3, testDa.getNumElements(), 0);
         Assert.assertEquals(4, testDa.getElement(0), 0);
         Assert.assertEquals(5, testDa.getElement(1), 0);
         Assert.assertEquals(6, testDa.getElement(2), 0);
-        
+
         testDa.addElements(new double[] {4, 5, 6});
         Assert.assertEquals(6, testDa.getNumElements());
 
         // ADDITIVE_MODE  (x's are occupied storage locations, 0's are open)
         testDa = new ResizableDoubleArray(2, 2.0, 2.5,
-                                          ResizableDoubleArray.ExpansionMode.ADDITIVE);        
+                                          ResizableDoubleArray.ExpansionMode.ADDITIVE);
         Assert.assertEquals(2, testDa.getCapacity());
         testDa.addElements(new double[] { 1d }); // x,0
         testDa.addElements(new double[] { 2d }); // x,x


[10/21] [math] Removed trailing spaces. No code change.

Posted by lu...@apache.org.
Removed trailing spaces. No code change.


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

Branch: refs/heads/field-ode
Commit: ff35e6f27ee4976f4091ebdd4c9b715134c35e11
Parents: 654d723
Author: Phil Steitz <ph...@gmail.com>
Authored: Fri Nov 27 11:10:39 2015 -0700
Committer: Phil Steitz <ph...@gmail.com>
Committed: Fri Nov 27 11:10:39 2015 -0700

----------------------------------------------------------------------
 .../math3/analysis/FunctionUtilsTest.java       |   8 +-
 .../DerivativeStructureTest.java                |  16 +--
 .../FiniteDifferencesDifferentiatorTest.java    |  14 +--
 .../differentiation/GradientFunctionTest.java   |   4 +-
 .../differentiation/JacobianFunctionTest.java   |   4 +-
 .../differentiation/SparseGradientTest.java     |   4 +-
 .../math3/analysis/function/GaussianTest.java   |   2 +-
 .../math3/analysis/function/LogisticTest.java   |   8 +-
 .../math3/analysis/function/SigmoidTest.java    |   2 +-
 .../analysis/function/StepFunctionTest.java     |   8 +-
 .../integration/MidPointIntegratorTest.java     |   4 +-
 .../BicubicSplineInterpolatingFunctionTest.java |  18 +--
 .../BicubicSplineInterpolatorTest.java          |   6 +-
 ...PolynomialBicubicSplineInterpolatorTest.java |   8 +-
 .../TricubicInterpolatingFunctionTest.java      |   4 +-
 ...TricubicSplineInterpolatingFunctionTest.java |  16 +--
 .../TricubicSplineInterpolatorTest.java         |  12 +-
 .../PolynomialSplineFunctionTest.java           |   2 +-
 .../polynomials/PolynomialsUtilsTest.java       |   2 +-
 .../commons/math3/complex/QuaternionTest.java   |   2 +-
 .../apache/commons/math3/dfp/DfpDecTest.java    |   6 +-
 .../apache/commons/math3/dfp/DfpMathTest.java   | 122 +++++++++----------
 .../distribution/BinomialDistributionTest.java  |   4 +-
 .../ConstantRealDistributionTest.java           |   4 +-
 .../EnumeratedIntegerDistributionTest.java      |   2 +-
 .../EnumeratedRealDistributionTest.java         |   8 +-
 .../distribution/GeometricDistributionTest.java |   2 +-
 .../HypergeometricDistributionTest.java         |  14 +--
 .../KolmogorovSmirnovDistributionTest.java      |   8 +-
 .../distribution/LevyDistributionTest.java      |   2 +-
 .../MultivariateNormalDistributionTest.java     |   2 +-
 .../distribution/PoissonDistributionTest.java   |   2 +-
 .../RealDistributionAbstractTest.java           |  12 +-
 .../math3/distribution/TDistributionTest.java   |   4 +-
 .../UniformRealDistributionTest.java            |  10 +-
 ...ormalMixtureExpectationMaximizationTest.java |  10 +-
 .../DimensionMismatchExceptionTest.java         |   2 +-
 .../MaxCountExceededExceptionTest.java          |   2 +-
 .../NonMonotonicSequenceExceptionTest.java      |   2 +-
 .../exception/NotPositiveExceptionTest.java     |   2 +-
 .../NotStrictlyPositiveExceptionTest.java       |   2 +-
 .../NumberIsTooLargeExceptionTest.java          |   2 +-
 .../NumberIsTooSmallExceptionTest.java          |   2 +-
 .../exception/OutOfRangeExceptionTest.java      |   2 +-
 .../TooManyEvaluationsExceptionTest.java        |   2 +-
 .../math3/exception/util/ArgUtilsTest.java      |   2 +-
 .../exception/util/ExceptionContextTest.java    |   2 +-
 .../commons/math3/filter/KalmanFilterTest.java  |  50 ++++----
 .../math3/fitting/GaussianCurveFitterTest.java  |  16 +--
 .../math3/fitting/GaussianFitterTest.java       |  16 +--
 .../math3/fitting/HarmonicCurveFitterTest.java  |   2 +-
 .../fitting/PolynomialCurveFitterTest.java      |   2 +-
 .../math3/fitting/SimpleCurveFitterTest.java    |   2 +-
 .../fitting/leastsquares/CircleProblem.java     |   2 +-
 .../fitting/leastsquares/CircleVectorial.java   |   2 +-
 .../math3/fitting/leastsquares/MinpackTest.java |   4 +-
 .../commons/math3/fraction/BigFractionTest.java |   4 +-
 .../math3/genetics/CycleCrossoverTest.java      |   4 +-
 .../math3/genetics/DummyListChromosome.java     |   2 +-
 .../genetics/ElitisticListPopulationTest.java   |  10 +-
 .../math3/genetics/ListPopulationTest.java      |  26 ++--
 .../math3/genetics/NPointCrossoverTest.java     |  16 +--
 .../math3/genetics/OrderedCrossoverTest.java    |   6 +-
 .../commons/math3/genetics/RandomKeyTest.java   |   2 +-
 .../math3/genetics/UniformCrossoverTest.java    |  14 +--
 .../euclidean/threed/FieldVector3DTest.java     |   6 +-
 .../geometry/euclidean/threed/LineTest.java     |   2 +-
 .../euclidean/threed/PolyhedronsSetTest.java    |  26 ++--
 .../geometry/euclidean/threed/RotationTest.java |   2 +-
 .../euclidean/threed/SphereGeneratorTest.java   |   2 +-
 .../threed/SphericalCoordinatesTest.java        |   2 +-
 .../geometry/euclidean/threed/SubLineTest.java  |   2 +-
 .../geometry/euclidean/threed/Vector3DTest.java |   6 +-
 .../euclidean/twod/DiskGeneratorTest.java       |   2 +-
 .../euclidean/twod/PolygonsSetTest.java         |  12 +-
 .../geometry/euclidean/twod/Vector2DTest.java   |   6 +-
 .../hull/ConvexHullGenerator2DAbstractTest.java |  18 +--
 .../geometry/partitioning/RegionDumper.java     |   2 +-
 .../geometry/partitioning/RegionParser.java     |   2 +-
 .../geometry/spherical/twod/CircleTest.java     |   4 +-
 .../math3/linear/Array2DRowRealMatrixTest.java  |   2 +-
 .../math3/linear/DiagonalMatrixTest.java        |   6 +-
 .../math3/linear/EigenDecompositionTest.java    |  20 +--
 .../math3/linear/HessenbergTransformerTest.java |  10 +-
 .../MatrixDimensionMismatchExceptionTest.java   |   2 +-
 .../commons/math3/linear/MatrixUtilsTest.java   |  16 +--
 .../math3/linear/QRDecompositionTest.java       |   2 +-
 .../commons/math3/linear/RRQRSolverTest.java    |   4 +-
 .../RectangularCholeskyDecompositionTest.java   |   2 +-
 .../math3/linear/SchurTransformerTest.java      |   6 +-
 .../ml/clustering/DBSCANClustererTest.java      |  10 +-
 .../clustering/KMeansPlusPlusClustererTest.java |  12 +-
 .../MultiKMeansPlusPlusClustererTest.java       |   2 +-
 .../evaluation/SumOfClusterVariancesTest.java   |   4 +-
 .../commons/math3/ml/neuralnet/NetworkTest.java |   4 +-
 .../ml/neuralnet/OffsetFeatureInitializer.java  |   2 +-
 .../neuralnet/sofm/KohonenTrainingTaskTest.java |   2 +-
 .../sofm/TravellingSalesmanSolver.java          |   2 +-
 .../commons/math3/ode/JacobianMatricesTest.java |   2 +-
 .../math3/ode/events/EventStateTest.java        |  16 +--
 .../nonstiff/HighamHall54IntegratorTest.java    |   2 +-
 .../sampling/StepNormalizerOutputTestBase.java  |   8 +-
 .../math3/optim/SimplePointCheckerTest.java     |   2 +-
 .../math3/optim/SimpleValueCheckerTest.java     |   2 +-
 .../math3/optim/linear/SimplexSolverTest.java   |  40 +++---
 .../scalar/noderiv/BOBYQAOptimizerTest.java     |  40 +++---
 .../scalar/noderiv/CMAESOptimizerTest.java      |  12 +-
 ...stractLeastSquaresOptimizerAbstractTest.java |   2 +-
 .../vector/jacobian/CircleProblem.java          |   2 +-
 .../nonlinear/vector/jacobian/MinpackTest.java  |   2 +-
 .../optim/univariate/BrentOptimizerTest.java    |   2 +-
 .../MultiStartUnivariateOptimizerTest.java      |   2 +-
 .../SimpleUnivariateValueCheckerTest.java       |   2 +-
 .../optimization/SimplePointCheckerTest.java    |   2 +-
 .../optimization/SimpleValueCheckerTest.java    |   2 +-
 .../direct/BOBYQAOptimizerTest.java             |  40 +++---
 .../optimization/direct/CMAESOptimizerTest.java |  14 +--
 .../fitting/GaussianFitterTest.java             |  16 +--
 ...stractLeastSquaresOptimizerAbstractTest.java |   2 +-
 ...NonLinearConjugateGradientOptimizerTest.java |   2 +-
 .../optimization/linear/SimplexSolverTest.java  |  26 ++--
 .../univariate/BrentOptimizerTest.java          |   2 +-
 .../SimpleUnivariateValueCheckerTest.java       |   2 +-
 .../UnivariateMultiStartOptimizerTest.java      |   2 +-
 .../apache/commons/math3/primes/PrimesTest.java |   2 +-
 .../random/AbstractRandomGeneratorTest.java     |   4 +-
 .../math3/random/BitsStreamGeneratorTest.java   |  16 +--
 .../CorrelatedRandomVectorGeneratorTest.java    |   8 +-
 .../math3/random/EmpiricalDistributionTest.java |  60 ++++-----
 .../random/HaltonSequenceGeneratorTest.java     |   4 +-
 .../math3/random/MersenneTwisterTest.java       |   4 +-
 .../commons/math3/random/RandomAdaptorTest.java |   6 +-
 .../random/RandomGeneratorAbstractTest.java     |   2 +-
 .../random/SobolSequenceGeneratorTest.java      |   8 +-
 .../math3/random/StableRandomGeneratorTest.java |   6 +-
 .../UnitSphereRandomVectorGeneratorTest.java    |   2 +-
 .../commons/math3/random/ValueServerTest.java   |   8 +-
 .../commons/math3/random/Well19937aTest.java    |   2 +-
 .../commons/math3/random/Well19937cTest.java    |   2 +-
 .../commons/math3/random/Well44497aTest.java    |   4 +-
 .../commons/math3/random/Well44497bTest.java    |   4 +-
 .../commons/math3/random/Well512aTest.java      |   2 +-
 .../commons/math3/special/BesselJTest.java      |   6 +-
 .../apache/commons/math3/special/ErfTest.java   |  54 ++++----
 .../commons/math3/stat/FrequencyTest.java       |  36 +++---
 .../commons/math3/stat/StatUtilsTest.java       |  16 +--
 .../stat/clustering/DBSCANClustererTest.java    |  10 +-
 .../clustering/KMeansPlusPlusClustererTest.java |   8 +-
 .../SpearmansRankCorrelationTest.java           |   4 +-
 .../correlation/StorelessCovarianceTest.java    |  10 +-
 .../descriptive/DescriptiveStatisticsTest.java  |   2 +-
 .../StatisticalSummaryValuesTest.java           |   2 +-
 ...torelessUnivariateStatisticAbstractTest.java |   2 +-
 .../stat/descriptive/SummaryStatisticsTest.java |  20 +--
 .../UnivariateStatisticAbstractTest.java        |   4 +-
 .../descriptive/rank/PSquarePercentileTest.java |   4 +-
 .../stat/descriptive/rank/PercentileTest.java   |   4 +-
 .../stat/descriptive/summary/ProductTest.java   |   2 +-
 .../stat/descriptive/summary/SumLogTest.java    |   4 +-
 .../stat/descriptive/summary/SumSqTest.java     |   2 +-
 .../math3/stat/descriptive/summary/SumTest.java |   2 +-
 .../commons/math3/stat/inference/GTestTest.java |  14 +--
 .../stat/inference/MannWhitneyUTestTest.java    |  14 +--
 .../math3/stat/inference/TestUtilsTest.java     |   6 +-
 .../inference/WilcoxonSignedRankTestTest.java   |  36 +++---
 .../stat/interval/AgrestiCoullIntervalTest.java |   2 +-
 .../BinomialConfidenceIntervalAbstractTest.java |   4 +-
 .../interval/ClopperPearsonIntervalTest.java    |   2 +-
 .../math3/stat/interval/IntervalUtilsTest.java  |   4 +-
 .../NormalApproximationIntervalTest.java        |   2 +-
 .../stat/interval/WilsonScoreIntervalTest.java  |   2 +-
 .../math3/stat/ranking/NaturalRankingTest.java  |  14 +--
 .../GLSMultipleLinearRegressionTest.java        |  44 +++----
 .../MillerUpdatingRegressionTest.java           |  34 +++---
 .../MultipleLinearRegressionAbstractTest.java   |  20 +--
 .../OLSMultipleLinearRegressionTest.java        |  88 ++++++-------
 .../stat/regression/SimpleRegressionTest.java   |   2 +-
 .../commons/math3/util/CombinationsTest.java    |   4 +-
 .../apache/commons/math3/util/FastMathTest.java |  26 ++--
 .../commons/math3/util/IncrementorTest.java     |   2 +-
 .../math3/util/ResizableDoubleArrayTest.java    |  18 +--
 181 files changed, 840 insertions(+), 840 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/analysis/FunctionUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/analysis/FunctionUtilsTest.java b/src/test/java/org/apache/commons/math3/analysis/FunctionUtilsTest.java
index 5e2bc96..8c66189 100644
--- a/src/test/java/org/apache/commons/math3/analysis/FunctionUtilsTest.java
+++ b/src/test/java/org/apache/commons/math3/analysis/FunctionUtilsTest.java
@@ -273,11 +273,11 @@ public class FunctionUtilsTest {
     public void testToDifferentiableMultivariateFunction() {
 
         MultivariateDifferentiableFunction hypot = new MultivariateDifferentiableFunction() {
-            
+
             public double value(double[] point) {
                 return FastMath.hypot(point[0], point[1]);
             }
-            
+
             public DerivativeStructure value(DerivativeStructure[] point) {
                 return DerivativeStructure.hypot(point[0], point[1]);
             }
@@ -300,7 +300,7 @@ public class FunctionUtilsTest {
     public void testToMultivariateDifferentiableFunction() {
 
         DifferentiableMultivariateFunction hypot = new DifferentiableMultivariateFunction() {
-            
+
             public double value(double[] point) {
                 return FastMath.hypot(point[0], point[1]);
             }
@@ -321,7 +321,7 @@ public class FunctionUtilsTest {
                     }
                 };
             }
-            
+
         };
 
         MultivariateDifferentiableFunction converted = FunctionUtils.toMultivariateDifferentiableFunction(hypot);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/analysis/differentiation/DerivativeStructureTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/analysis/differentiation/DerivativeStructureTest.java b/src/test/java/org/apache/commons/math3/analysis/differentiation/DerivativeStructureTest.java
index 39b4d5f..91f2310 100644
--- a/src/test/java/org/apache/commons/math3/analysis/differentiation/DerivativeStructureTest.java
+++ b/src/test/java/org/apache/commons/math3/analysis/differentiation/DerivativeStructureTest.java
@@ -375,7 +375,7 @@ public class DerivativeStructureTest extends ExtendedFieldElementAbstractTest<De
                                         FastMath.abs(epsilon * dfdxdydz));
 
                 }
-                
+
             }
         }
     }
@@ -395,17 +395,17 @@ public class DerivativeStructureTest extends ExtendedFieldElementAbstractTest<De
                         double f1 = 1 / (2 * FastMath.sqrt(x * y));
                         Assert.assertEquals(f1, f.getPartialDerivative(1), FastMath.abs(epsilon * f1));
                         if (f.getOrder() > 1) {
-                            double f2 = -f1 / (2 * x); 
+                            double f2 = -f1 / (2 * x);
                             Assert.assertEquals(f2, f.getPartialDerivative(2), FastMath.abs(epsilon * f2));
                             if (f.getOrder() > 2) {
-                                double f3 = (f0 + x / (2 * y * f0)) / (4 * x * x * x); 
+                                double f3 = (f0 + x / (2 * y * f0)) / (4 * x * x * x);
                                 Assert.assertEquals(f3, f.getPartialDerivative(3), FastMath.abs(epsilon * f3));
                             }
                         }
                     }
                 }
             }
-        }        
+        }
     }
 
     @Test
@@ -447,7 +447,7 @@ public class DerivativeStructureTest extends ExtendedFieldElementAbstractTest<De
                         }
                     }
                 }
-            }        
+            }
         }
     }
 
@@ -1102,17 +1102,17 @@ public class DerivativeStructureTest extends ExtendedFieldElementAbstractTest<De
                         double f1 = -x / (2 * y * y * f0);
                         Assert.assertEquals(f1, f.getPartialDerivative(1), FastMath.abs(epsilon * f1));
                         if (f.getOrder() > 1) {
-                            double f2 = (f0 - x / (4 * y * f0)) / (y * y); 
+                            double f2 = (f0 - x / (4 * y * f0)) / (y * y);
                             Assert.assertEquals(f2, f.getPartialDerivative(2), FastMath.abs(epsilon * f2));
                             if (f.getOrder() > 2) {
-                                double f3 = (x / (8 * y * f0) - 2 * f0) / (y * y * y); 
+                                double f3 = (x / (8 * y * f0) - 2 * f0) / (y * y * y);
                                 Assert.assertEquals(f3, f.getPartialDerivative(3), FastMath.abs(epsilon * f3));
                             }
                         }
                     }
                 }
             }
-        }        
+        }
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/analysis/differentiation/FiniteDifferencesDifferentiatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/analysis/differentiation/FiniteDifferencesDifferentiatorTest.java b/src/test/java/org/apache/commons/math3/analysis/differentiation/FiniteDifferencesDifferentiatorTest.java
index 9702305..2e17796 100644
--- a/src/test/java/org/apache/commons/math3/analysis/differentiation/FiniteDifferencesDifferentiatorTest.java
+++ b/src/test/java/org/apache/commons/math3/analysis/differentiation/FiniteDifferencesDifferentiatorTest.java
@@ -153,7 +153,7 @@ public class FiniteDifferencesDifferentiatorTest {
         // the 1.0e-6 step size is far too small for finite differences in the quintic on this abscissa range for 7 points
         // the errors are huge!
         final double[] expectedBad = new double[] {
-            2.910e-11, 2.087e-5, 147.7, 3.820e7, 6.354e14, 6.548e19, 1.543e27            
+            2.910e-11, 2.087e-5, 147.7, 3.820e7, 6.354e14, 6.548e19, 1.543e27
         };
 
         for (int i = 0; i < maxErrorGood.length; ++i) {
@@ -255,11 +255,11 @@ public class FiniteDifferencesDifferentiatorTest {
         // here, we did set the bounds, so evaluations are done within domain
         // using f(0.0), f(0.1), f(0.2)
         Assert.assertEquals(slope, properlyBounded.value(tLow).getPartialDerivative(1), 1.0e-10);
-        
+
         // here, we did set the bounds, so evaluations are done within domain
         // using f(0.8), f(0.9), f(1.0)
         Assert.assertEquals(slope, properlyBounded.value(tHigh).getPartialDerivative(1), 1.0e-10);
-        
+
     }
 
     @Test
@@ -290,11 +290,11 @@ public class FiniteDifferencesDifferentiatorTest {
                 new FiniteDifferencesDifferentiator(7, 0.01);
         UnivariateDifferentiableVectorFunction f =
                 differentiator.differentiate(new UnivariateVectorFunction() {
-            
+
             public double[] value(double x) {
                 return new double[] { FastMath.cos(x), FastMath.sin(x) };
             }
-            
+
         });
 
         for (double x = -10; x < 10; x += 0.1) {
@@ -325,14 +325,14 @@ public class FiniteDifferencesDifferentiatorTest {
                 new FiniteDifferencesDifferentiator(7, 0.01);
         UnivariateDifferentiableMatrixFunction f =
                 differentiator.differentiate(new UnivariateMatrixFunction() {
-            
+
             public double[][] value(double x) {
                 return new double[][] {
                     { FastMath.cos(x),  FastMath.sin(x)  },
                     { FastMath.cosh(x), FastMath.sinh(x) }
                 };
             }
-            
+
         });
 
         for (double x = -1; x < 1; x += 0.02) {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/analysis/differentiation/GradientFunctionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/analysis/differentiation/GradientFunctionTest.java b/src/test/java/org/apache/commons/math3/analysis/differentiation/GradientFunctionTest.java
index 7faf9b6..18fbe1d 100644
--- a/src/test/java/org/apache/commons/math3/analysis/differentiation/GradientFunctionTest.java
+++ b/src/test/java/org/apache/commons/math3/analysis/differentiation/GradientFunctionTest.java
@@ -56,7 +56,7 @@ public class GradientFunctionTest {
     }
 
     private static class EuclideanDistance implements MultivariateDifferentiableFunction {
-        
+
         public double value(double[] point) {
             double d2 = 0;
             for (double x : point) {
@@ -64,7 +64,7 @@ public class GradientFunctionTest {
             }
             return FastMath.sqrt(d2);
         }
-        
+
         public DerivativeStructure value(DerivativeStructure[] point)
             throws DimensionMismatchException, MathIllegalArgumentException {
             DerivativeStructure d2 = point[0].getField().getZero();

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/analysis/differentiation/JacobianFunctionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/analysis/differentiation/JacobianFunctionTest.java b/src/test/java/org/apache/commons/math3/analysis/differentiation/JacobianFunctionTest.java
index b7c00fe..15625a4 100644
--- a/src/test/java/org/apache/commons/math3/analysis/differentiation/JacobianFunctionTest.java
+++ b/src/test/java/org/apache/commons/math3/analysis/differentiation/JacobianFunctionTest.java
@@ -54,7 +54,7 @@ public class JacobianFunctionTest {
         public SphereMapping(final double radius) {
             this.radius = radius;
         }
-        
+
         public double[] value(double[] point) {
             final double cLat = FastMath.cos(point[0]);
             final double sLat = FastMath.sin(point[0]);
@@ -66,7 +66,7 @@ public class JacobianFunctionTest {
                 radius * sLat
             };
         }
-        
+
         public DerivativeStructure[] value(DerivativeStructure[] point) {
             final DerivativeStructure cLat = point[0].cos();
             final DerivativeStructure sLat = point[0].sin();

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/analysis/differentiation/SparseGradientTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/analysis/differentiation/SparseGradientTest.java b/src/test/java/org/apache/commons/math3/analysis/differentiation/SparseGradientTest.java
index 559da87..a6eac4f 100644
--- a/src/test/java/org/apache/commons/math3/analysis/differentiation/SparseGradientTest.java
+++ b/src/test/java/org/apache/commons/math3/analysis/differentiation/SparseGradientTest.java
@@ -308,7 +308,7 @@ public class SparseGradientTest extends ExtendedFieldElementAbstractTest<SparseG
                     Assert.assertEquals(dfdx, sg.getDerivative(0), FastMath.abs(epsilon * dfdx));
 
                 }
-                
+
             }
         }
     }
@@ -352,7 +352,7 @@ public class SparseGradientTest extends ExtendedFieldElementAbstractTest<SparseG
                         Assert.assertEquals(dfdz, f.getDerivative(2), FastMath.abs(epsilon * dfdz));
                     }
                 }
-            }        
+            }
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/analysis/function/GaussianTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/analysis/function/GaussianTest.java b/src/test/java/org/apache/commons/math3/analysis/function/GaussianTest.java
index ef7536d..c580cf0 100644
--- a/src/test/java/org/apache/commons/math3/analysis/function/GaussianTest.java
+++ b/src/test/java/org/apache/commons/math3/analysis/function/GaussianTest.java
@@ -80,7 +80,7 @@ public class GaussianTest {
         Assert.assertEquals(0, f.value(new DerivativeStructure(1, 1, 0, 1e2)).getPartialDerivative(1), 0);
         Assert.assertEquals(0, f.value(new DerivativeStructure(1, 1, 0, 1e50)).getPartialDerivative(1), 0);
         Assert.assertEquals(0, f.value(new DerivativeStructure(1, 1, 0, Double.MAX_VALUE)).getPartialDerivative(1), 0);
-        Assert.assertEquals(0, f.value(new DerivativeStructure(1, 1, 0, Double.POSITIVE_INFINITY)).getPartialDerivative(1), 0);        
+        Assert.assertEquals(0, f.value(new DerivativeStructure(1, 1, 0, Double.POSITIVE_INFINITY)).getPartialDerivative(1), 0);
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/analysis/function/LogisticTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/analysis/function/LogisticTest.java b/src/test/java/org/apache/commons/math3/analysis/function/LogisticTest.java
index f721719..0e992d2 100644
--- a/src/test/java/org/apache/commons/math3/analysis/function/LogisticTest.java
+++ b/src/test/java/org/apache/commons/math3/analysis/function/LogisticTest.java
@@ -87,7 +87,7 @@ public class LogisticTest {
 
         final Logistic f = new Logistic(k, 0, 1, 1, a, 1);
         final Sigmoid g = new Sigmoid(a, k);
-        
+
         final double min = -10;
         final double max = 10;
         final double n = 20;
@@ -147,7 +147,7 @@ public class LogisticTest {
         final Logistic.Parametric f = new Logistic.Parametric();
         // Compare using the "Sigmoid" function.
         final Sigmoid.Parametric g = new Sigmoid.Parametric();
-        
+
         final double x = 0.12345;
         final double[] gf = f.gradient(x, new double[] {k, 0, 1, 1, a, 1});
         final double[] gg = g.gradient(x, new double[] {a, k});
@@ -166,7 +166,7 @@ public class LogisticTest {
         final double n = 3.4;
 
         final Logistic.Parametric f = new Logistic.Parametric();
-        
+
         final double x = m - 1;
         final double qExp1 = 2;
 
@@ -186,7 +186,7 @@ public class LogisticTest {
         final double n = 3.4;
 
         final Logistic.Parametric f = new Logistic.Parametric();
-        
+
         final double x = 0;
         final double qExp1 = 2;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/analysis/function/SigmoidTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/analysis/function/SigmoidTest.java b/src/test/java/org/apache/commons/math3/analysis/function/SigmoidTest.java
index 59f6312..b1e505c 100644
--- a/src/test/java/org/apache/commons/math3/analysis/function/SigmoidTest.java
+++ b/src/test/java/org/apache/commons/math3/analysis/function/SigmoidTest.java
@@ -70,7 +70,7 @@ public class SigmoidTest {
         Assert.assertEquals(0, f.value(new DerivativeStructure(1, 1, 0, 1e3)).getPartialDerivative(1), 0);
         Assert.assertEquals(0, f.value(new DerivativeStructure(1, 1, 0, 1e50)).getPartialDerivative(1), 0);
         Assert.assertEquals(0, f.value(new DerivativeStructure(1, 1, 0, Double.MAX_VALUE)).getPartialDerivative(1), 0);
-        Assert.assertEquals(0, f.value(new DerivativeStructure(1, 1, 0, Double.POSITIVE_INFINITY)).getPartialDerivative(1), 0);        
+        Assert.assertEquals(0, f.value(new DerivativeStructure(1, 1, 0, Double.POSITIVE_INFINITY)).getPartialDerivative(1), 0);
     }
 
     @Test(expected=NullArgumentException.class)

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/analysis/function/StepFunctionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/analysis/function/StepFunctionTest.java b/src/test/java/org/apache/commons/math3/analysis/function/StepFunctionTest.java
index 247a0a9..92a2097 100644
--- a/src/test/java/org/apache/commons/math3/analysis/function/StepFunctionTest.java
+++ b/src/test/java/org/apache/commons/math3/analysis/function/StepFunctionTest.java
@@ -78,7 +78,7 @@ public class StepFunctionTest {
         Assert.assertEquals(51.2, f.value(30), EPS);
         Assert.assertEquals(51.2, f.value(Double.POSITIVE_INFINITY), EPS);
     }
-    
+
     @Test
     public void testEndpointBehavior() {
         final double[] x = {0, 1, 2, 3};
@@ -93,15 +93,15 @@ public class StepFunctionTest {
         for (int i = 0; i < x.length; i++) {
            Assert.assertEquals(y[i], f.value(x[i]), EPS);
            if (i > 0) {
-               Assert.assertEquals(y[i - 1], f.value(x[i] - 0.5), EPS); 
+               Assert.assertEquals(y[i - 1], f.value(x[i] - 0.5), EPS);
            } else {
-               Assert.assertEquals(y[0], f.value(x[i] - 0.5), EPS); 
+               Assert.assertEquals(y[0], f.value(x[i] - 0.5), EPS);
            }
         }
     }
 
     @Test
-    public void testHeaviside() {   
+    public void testHeaviside() {
         final UnivariateFunction h = new StepFunction(new double[] {-1, 0},
                                                           new double[] {0, 1});
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/analysis/integration/MidPointIntegratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/analysis/integration/MidPointIntegratorTest.java b/src/test/java/org/apache/commons/math3/analysis/integration/MidPointIntegratorTest.java
index 36daa3e..c6f9ca8 100644
--- a/src/test/java/org/apache/commons/math3/analysis/integration/MidPointIntegratorTest.java
+++ b/src/test/java/org/apache/commons/math3/analysis/integration/MidPointIntegratorTest.java
@@ -41,7 +41,7 @@ public final class MidPointIntegratorTest {
     public void testLowAccuracy() {
         UnivariateFunction f = new QuinticFunction();
         UnivariateIntegrator integrator = new MidPointIntegrator(0.01, 1.0e-10, 2, 4);
-        
+
         double min = -10;
         double max =  -9;
         double expected = -3697001.0 / 48.0;
@@ -60,7 +60,7 @@ public final class MidPointIntegratorTest {
     public void testSinFunction() {
         UnivariateFunction f = new Sin();
         UnivariateIntegrator integrator = new MidPointIntegrator();
-        
+
         double min = 0;
         double max = FastMath.PI;
         double expected = 2;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/analysis/interpolation/BicubicSplineInterpolatingFunctionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/analysis/interpolation/BicubicSplineInterpolatingFunctionTest.java b/src/test/java/org/apache/commons/math3/analysis/interpolation/BicubicSplineInterpolatingFunctionTest.java
index 8c78aed..24aa0f4 100644
--- a/src/test/java/org/apache/commons/math3/analysis/interpolation/BicubicSplineInterpolatingFunctionTest.java
+++ b/src/test/java/org/apache/commons/math3/analysis/interpolation/BicubicSplineInterpolatingFunctionTest.java
@@ -29,7 +29,7 @@ import org.junit.Ignore;
 
 /**
  * Test case for the bicubic function.
- * 
+ *
  */
 public final class BicubicSplineInterpolatingFunctionTest {
     /**
@@ -44,7 +44,7 @@ public final class BicubicSplineInterpolatingFunctionTest {
         @SuppressWarnings("unused")
         BivariateFunction bcf = new BicubicSplineInterpolatingFunction(xval, yval, zval,
                                                                            zval, zval, zval);
-        
+
         double[] wxval = new double[] {3, 2, 5, 6.5};
         try {
             bcf = new BicubicSplineInterpolatingFunction(wxval, yval, zval, zval, zval, zval);
@@ -239,7 +239,7 @@ public final class BicubicSplineInterpolatingFunctionTest {
                                                                            dZdX, dZdY, dZdXdY);
         double x, y;
         double expected, result;
-        
+
         x = 4;
         y = -3;
         expected = f.value(x, y);
@@ -295,7 +295,7 @@ public final class BicubicSplineInterpolatingFunctionTest {
             };
         Assert.assertEquals("dFdX", derivative.value(x, y),
                             f.partialDerivativeX().value(x, y), tol);
-        
+
         derivative = new BivariateFunction() {
                 public double value(double x, double y) {
                     final double x2 = x * x;
@@ -385,7 +385,7 @@ public final class BicubicSplineInterpolatingFunctionTest {
         BivariateFunction dfdX = new BivariateFunction() {
                 public double value(double x, double y) {
                     final double x2 = x * x;
-                    final double y2 = y * y;                    
+                    final double y2 = y * y;
                     return - 3 - y + 4 * x + 8 * x * y - y2 - 9 * x2;
                 }
             };
@@ -399,7 +399,7 @@ public final class BicubicSplineInterpolatingFunctionTest {
         BivariateFunction dfdY = new BivariateFunction() {
                 public double value(double x, double y) {
                     final double x2 = x * x;
-                    final double y2 = y * y;                    
+                    final double y2 = y * y;
                     return 2 - x - 6 * y + 4 * x2 - 2 * x * y + 3 * y2;
                 }
             };
@@ -432,7 +432,7 @@ public final class BicubicSplineInterpolatingFunctionTest {
             x = val[i];
             for (int j = 0; j < sz; j++) {
                 y = val[j];
-                
+
                 expected = dfdX.value(x, y);
                 result = bcf.partialDerivativeX(x, y);
                 Assert.assertEquals(x + " " + y + " dFdX", expected, result, tol);
@@ -440,7 +440,7 @@ public final class BicubicSplineInterpolatingFunctionTest {
                 expected = dfdY.value(x, y);
                 result = bcf.partialDerivativeY(x, y);
                 Assert.assertEquals(x + " " + y + " dFdY", expected, result, tol);
-                
+
                 expected = d2fdXdY.value(x, y);
                 result = bcf.partialDerivativeXY(x, y);
                 Assert.assertEquals(x + " " + y + " d2FdXdY", expected, result, tol);
@@ -637,7 +637,7 @@ public final class BicubicSplineInterpolatingFunctionTest {
         Assert.assertTrue(bcf.isValidPoint(x, y));
         // Ensure that no exception is thrown.
         bcf.value(x, y);
- 
+
         final double xRange = xMax - xMin;
         final double yRange = yMax - yMin;
         x = xMin + xRange / 3.4;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/analysis/interpolation/BicubicSplineInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/analysis/interpolation/BicubicSplineInterpolatorTest.java b/src/test/java/org/apache/commons/math3/analysis/interpolation/BicubicSplineInterpolatorTest.java
index c4a56bb..3a3852f 100644
--- a/src/test/java/org/apache/commons/math3/analysis/interpolation/BicubicSplineInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math3/analysis/interpolation/BicubicSplineInterpolatorTest.java
@@ -27,7 +27,7 @@ import org.junit.Test;
 
 /**
  * Test case for the bicubic interpolator.
- * 
+ *
  */
 public final class BicubicSplineInterpolatorTest {
     /**
@@ -40,10 +40,10 @@ public final class BicubicSplineInterpolatorTest {
         double[][] zval = new double[xval.length][yval.length];
 
         BivariateGridInterpolator interpolator = new BicubicSplineInterpolator();
-        
+
         @SuppressWarnings("unused")
         BivariateFunction p = interpolator.interpolate(xval, yval, zval);
-        
+
         double[] wxval = new double[] {3, 2, 5, 6.5};
         try {
             p = interpolator.interpolate(wxval, yval, zval);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/analysis/interpolation/SmoothingPolynomialBicubicSplineInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/analysis/interpolation/SmoothingPolynomialBicubicSplineInterpolatorTest.java b/src/test/java/org/apache/commons/math3/analysis/interpolation/SmoothingPolynomialBicubicSplineInterpolatorTest.java
index 51c9760..1977b11 100644
--- a/src/test/java/org/apache/commons/math3/analysis/interpolation/SmoothingPolynomialBicubicSplineInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math3/analysis/interpolation/SmoothingPolynomialBicubicSplineInterpolatorTest.java
@@ -25,7 +25,7 @@ import org.junit.Test;
 
 /**
  * Test case for the smoothing bicubic interpolator.
- * 
+ *
  */
 public final class SmoothingPolynomialBicubicSplineInterpolatorTest {
     /**
@@ -38,10 +38,10 @@ public final class SmoothingPolynomialBicubicSplineInterpolatorTest {
         double[][] zval = new double[xval.length][yval.length];
 
         BivariateGridInterpolator interpolator = new SmoothingPolynomialBicubicSplineInterpolator(0);
-        
+
         @SuppressWarnings("unused")
         BivariateFunction p = interpolator.interpolate(xval, yval, zval);
-        
+
         double[] wxval = new double[] {3, 2, 5, 6.5};
         try {
             p = interpolator.interpolate(wxval, yval, zval);
@@ -109,7 +109,7 @@ public final class SmoothingPolynomialBicubicSplineInterpolatorTest {
         BivariateFunction p = interpolator.interpolate(xval, yval, zval);
         double x, y;
         double expected, result;
-        
+
         x = 4;
         y = -3;
         expected = f.value(x, y);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/analysis/interpolation/TricubicInterpolatingFunctionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/analysis/interpolation/TricubicInterpolatingFunctionTest.java b/src/test/java/org/apache/commons/math3/analysis/interpolation/TricubicInterpolatingFunctionTest.java
index 9760555..0b5a3e5 100644
--- a/src/test/java/org/apache/commons/math3/analysis/interpolation/TricubicInterpolatingFunctionTest.java
+++ b/src/test/java/org/apache/commons/math3/analysis/interpolation/TricubicInterpolatingFunctionTest.java
@@ -29,7 +29,7 @@ import org.junit.Test;
 
 /**
  * Test case for the bicubic function.
- * 
+ *
  */
 public final class TricubicInterpolatingFunctionTest {
     /**
@@ -46,7 +46,7 @@ public final class TricubicInterpolatingFunctionTest {
         TrivariateFunction tcf = new TricubicInterpolatingFunction(xval, yval, zval,
                                                                    fval, fval, fval, fval,
                                                                    fval, fval, fval, fval);
-        
+
         double[] wxval = new double[] {3, 2, 5, 6.5};
         try {
             tcf = new TricubicInterpolatingFunction(wxval, yval, zval,

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/analysis/interpolation/TricubicSplineInterpolatingFunctionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/analysis/interpolation/TricubicSplineInterpolatingFunctionTest.java b/src/test/java/org/apache/commons/math3/analysis/interpolation/TricubicSplineInterpolatingFunctionTest.java
index 90bce9e..c6ee8af 100644
--- a/src/test/java/org/apache/commons/math3/analysis/interpolation/TricubicSplineInterpolatingFunctionTest.java
+++ b/src/test/java/org/apache/commons/math3/analysis/interpolation/TricubicSplineInterpolatingFunctionTest.java
@@ -25,7 +25,7 @@ import org.junit.Test;
 
 /**
  * Test case for the bicubic function.
- * 
+ *
  */
 public final class TricubicSplineInterpolatingFunctionTest {
     /**
@@ -42,7 +42,7 @@ public final class TricubicSplineInterpolatingFunctionTest {
         TrivariateFunction tcf = new TricubicSplineInterpolatingFunction(xval, yval, zval,
                                                                              fval, fval, fval, fval,
                                                                              fval, fval, fval, fval);
-        
+
         double[] wxval = new double[] {3, 2, 5, 6.5};
         try {
             tcf = new TricubicSplineInterpolatingFunction(wxval, yval, zval,
@@ -383,19 +383,19 @@ public final class TricubicSplineInterpolatingFunctionTest {
         double[] xval = new double[] {3, 4, 5, 6.5};
         double[] yval = new double[] {-4, -3, -1, 2, 2.5};
         double[] zval = new double[] {-12, -8, -5.5, -3, 0, 4};
-        
+
         final double a = 0.2;
         final double omega = 0.5;
         final double kx = 2;
         final double ky = 1;
-        
+
         // Function values
         TrivariateFunction f = new TrivariateFunction() {
                 public double value(double x, double y, double z) {
                     return a * FastMath.cos(omega * z - kx * x - ky * y);
                 }
             };
-        
+
         double[][][] fval = new double[xval.length][yval.length][zval.length];
         for (int i = 0; i < xval.length; i++) {
             for (int j = 0; j < yval.length; j++) {
@@ -404,7 +404,7 @@ public final class TricubicSplineInterpolatingFunctionTest {
                 }
             }
         }
-        
+
         // Partial derivatives with respect to x
         double[][][] dFdX = new double[xval.length][yval.length][zval.length];
         TrivariateFunction dFdX_f = new TrivariateFunction() {
@@ -419,7 +419,7 @@ public final class TricubicSplineInterpolatingFunctionTest {
                 }
             }
         }
-            
+
         // Partial derivatives with respect to y
         double[][][] dFdY = new double[xval.length][yval.length][zval.length];
         TrivariateFunction dFdY_f = new TrivariateFunction() {
@@ -516,7 +516,7 @@ public final class TricubicSplineInterpolatingFunctionTest {
                                                                              d3FdXdYdZ);
         double x, y, z;
         double expected, result;
-        
+
         x = 4;
         y = -3;
         z = 0;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/analysis/interpolation/TricubicSplineInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/analysis/interpolation/TricubicSplineInterpolatorTest.java b/src/test/java/org/apache/commons/math3/analysis/interpolation/TricubicSplineInterpolatorTest.java
index 6de42a2..a747cca 100644
--- a/src/test/java/org/apache/commons/math3/analysis/interpolation/TricubicSplineInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math3/analysis/interpolation/TricubicSplineInterpolatorTest.java
@@ -26,7 +26,7 @@ import org.junit.Ignore;
 
 /**
  * Test case for the tricubic interpolator.
- * 
+ *
  */
 public final class TricubicSplineInterpolatorTest {
     /**
@@ -40,10 +40,10 @@ public final class TricubicSplineInterpolatorTest {
         double[][][] fval = new double[xval.length][yval.length][zval.length];
 
         TrivariateGridInterpolator interpolator = new TricubicSplineInterpolator();
-        
+
         @SuppressWarnings("unused")
         TrivariateFunction p = interpolator.interpolate(xval, yval, zval, fval);
-        
+
         double[] wxval = new double[] {3, 2, 5, 6.5};
         try {
             p = interpolator.interpolate(wxval, yval, zval, fval);
@@ -121,7 +121,7 @@ public final class TricubicSplineInterpolatorTest {
         TrivariateFunction p = interpolator.interpolate(xval, yval, zval, fval);
         double x, y, z;
         double expected, result;
-        
+
         x = 4;
         y = -3;
         z = 0;
@@ -169,7 +169,7 @@ public final class TricubicSplineInterpolatorTest {
                     return a * FastMath.cos(omega * z - kx * x - ky * y);
                 }
             };
-        
+
         double[][][] fval = new double[xval.length][yval.length][zval.length];
         for (int i = 0; i < xval.length; i++) {
             for (int j = 0; j < yval.length; j++) {
@@ -184,7 +184,7 @@ public final class TricubicSplineInterpolatorTest {
         TrivariateFunction p = interpolator.interpolate(xval, yval, zval, fval);
         double x, y, z;
         double expected, result;
-        
+
         x = 4;
         y = -3;
         z = 0;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/analysis/polynomials/PolynomialSplineFunctionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/analysis/polynomials/PolynomialSplineFunctionTest.java b/src/test/java/org/apache/commons/math3/analysis/polynomials/PolynomialSplineFunctionTest.java
index b353a73..708968a 100644
--- a/src/test/java/org/apache/commons/math3/analysis/polynomials/PolynomialSplineFunctionTest.java
+++ b/src/test/java/org/apache/commons/math3/analysis/polynomials/PolynomialSplineFunctionTest.java
@@ -151,7 +151,7 @@ public class PolynomialSplineFunctionTest {
         Assert.assertTrue(spline.isValidPoint(x));
         // Ensure that no exception is thrown.
         spline.value(x);
- 
+
         final double xRange = xMax - xMin;
         x = xMin + xRange / 3.4;
         Assert.assertTrue(spline.isValidPoint(x));

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/analysis/polynomials/PolynomialsUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/analysis/polynomials/PolynomialsUtilsTest.java b/src/test/java/org/apache/commons/math3/analysis/polynomials/PolynomialsUtilsTest.java
index e87804b..0997fd3 100644
--- a/src/test/java/org/apache/commons/math3/analysis/polynomials/PolynomialsUtilsTest.java
+++ b/src/test/java/org/apache/commons/math3/analysis/polynomials/PolynomialsUtilsTest.java
@@ -329,7 +329,7 @@ public class PolynomialsUtilsTest {
         PolynomialFunction f1xM1
             = new PolynomialFunction(PolynomialsUtils.shift(f1x.getCoefficients(), -1));
         checkPolynomial(f1xM1, "2 - 3 x + 2 x^2");
-        
+
         PolynomialFunction f1x3
             = new PolynomialFunction(PolynomialsUtils.shift(f1x.getCoefficients(), 3));
         checkPolynomial(f1x3, "22 + 13 x + 2 x^2");

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/complex/QuaternionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/complex/QuaternionTest.java b/src/test/java/org/apache/commons/math3/complex/QuaternionTest.java
index b81e260..0f9cf3a 100644
--- a/src/test/java/org/apache/commons/math3/complex/QuaternionTest.java
+++ b/src/test/java/org/apache/commons/math3/complex/QuaternionTest.java
@@ -84,7 +84,7 @@ public class QuaternionTest {
     public void testWrongDimension() {
         new Quaternion(new double[] { 1, 2 });
     }
-    
+
     @Test
     public final void testConjugate() {
         final double q0 = 2;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/dfp/DfpDecTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/dfp/DfpDecTest.java b/src/test/java/org/apache/commons/math3/dfp/DfpDecTest.java
index fc65fd7..2f4d33c 100644
--- a/src/test/java/org/apache/commons/math3/dfp/DfpDecTest.java
+++ b/src/test/java/org/apache/commons/math3/dfp/DfpDecTest.java
@@ -44,13 +44,13 @@ public class DfpDecTest {
         ninf    = null;
     }
 
-    // Generic test function.  Takes params x and y and tests them for 
+    // Generic test function.  Takes params x and y and tests them for
     // equality.  Then checks the status flags against the flags argument.
     // If the test fail, it prints the desc string
     private void test(Dfp x, Dfp y, int flags, String desc) {
         boolean b = x.equals(y);
 
-        if (!x.equals(y) && !x.unequal(y))  // NaNs involved 
+        if (!x.equals(y) && !x.unequal(y))  // NaNs involved
             b = (x.toString().equals(y.toString()));
 
         if (x.equals(new DfpDec(field, 0)))  // distinguish +/- zero
@@ -553,7 +553,7 @@ public class DfpDecTest {
              new DfpDec(field, "-0"),
              DfpField.FLAG_UNDERFLOW|DfpField.FLAG_INEXACT, "Next After #12");
 
-        test(new DfpDec(field, "1e-131092").nextAfter(ninf), 
+        test(new DfpDec(field, "1e-131092").nextAfter(ninf),
              new DfpDec(field, "0"),
              DfpField.FLAG_UNDERFLOW|DfpField.FLAG_INEXACT, "Next After #13");
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/dfp/DfpMathTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/dfp/DfpMathTest.java b/src/test/java/org/apache/commons/math3/dfp/DfpMathTest.java
index 832a808..c61cfbc 100644
--- a/src/test/java/org/apache/commons/math3/dfp/DfpMathTest.java
+++ b/src/test/java/org/apache/commons/math3/dfp/DfpMathTest.java
@@ -53,14 +53,14 @@ public class DfpMathTest {
         qnan = null;
     }
 
-    // Generic test function.  Takes params x and y and tests them for 
+    // Generic test function.  Takes params x and y and tests them for
     // equality.  Then checks the status flags against the flags argument.
     // If the test fail, it prints the desc string
     private void test(Dfp x, Dfp y, int flags, String desc)
     {
         boolean b = x.equals(y);
 
-        if (!x.equals(y) && !x.unequal(y))  // NaNs involved 
+        if (!x.equals(y) && !x.unequal(y))  // NaNs involved
             b = (x.toString().equals(y.toString()));
 
         if (x.equals(factory.newDfp("0")))  // distinguish +/- zero
@@ -75,109 +75,109 @@ public class DfpMathTest {
     }
 
     @Test
-    public void testPow()  
+    public void testPow()
     {
         // Test special cases  exponent of zero
-        test(DfpMath.pow(factory.newDfp("0"), factory.newDfp("0")),      
-             factory.newDfp("1"), 
+        test(DfpMath.pow(factory.newDfp("0"), factory.newDfp("0")),
+             factory.newDfp("1"),
              0, "pow #1");
 
-        test(DfpMath.pow(factory.newDfp("0"), factory.newDfp("-0")),      
-             factory.newDfp("1"), 
+        test(DfpMath.pow(factory.newDfp("0"), factory.newDfp("-0")),
+             factory.newDfp("1"),
              0, "pow #2");
 
-        test(DfpMath.pow(factory.newDfp("2"), factory.newDfp("0")),      
-             factory.newDfp("1"), 
+        test(DfpMath.pow(factory.newDfp("2"), factory.newDfp("0")),
+             factory.newDfp("1"),
              0, "pow #3");
 
-        test(DfpMath.pow(factory.newDfp("-2"), factory.newDfp("-0")),      
-             factory.newDfp("1"), 
+        test(DfpMath.pow(factory.newDfp("-2"), factory.newDfp("-0")),
+             factory.newDfp("1"),
              0, "pow #4");
 
-        test(DfpMath.pow(pinf, factory.newDfp("-0")),      
-             factory.newDfp("1"), 
+        test(DfpMath.pow(pinf, factory.newDfp("-0")),
+             factory.newDfp("1"),
              0, "pow #5");
 
         test(DfpMath.pow(pinf, factory.newDfp("0")),
-             factory.newDfp("1"), 
+             factory.newDfp("1"),
              0, "pow #6");
 
-        test(DfpMath.pow(ninf, factory.newDfp("-0")),      
-             factory.newDfp("1"), 
+        test(DfpMath.pow(ninf, factory.newDfp("-0")),
+             factory.newDfp("1"),
              0, "pow #7");
 
         test(DfpMath.pow(ninf, factory.newDfp("0")),
-             factory.newDfp("1"), 
+             factory.newDfp("1"),
              0, "pow #8");
 
         test(DfpMath.pow(qnan, factory.newDfp("0")),
-             factory.newDfp("1"), 
+             factory.newDfp("1"),
              0, "pow #8");
 
         // exponent of one
         test(DfpMath.pow(factory.newDfp("0"), factory.newDfp("1")),
-             factory.newDfp("0"), 
+             factory.newDfp("0"),
              0, "pow #9");
 
-        test(DfpMath.pow(factory.newDfp("-0"), factory.newDfp("1")),      
-             factory.newDfp("-0"), 
+        test(DfpMath.pow(factory.newDfp("-0"), factory.newDfp("1")),
+             factory.newDfp("-0"),
              0, "pow #10");
 
         test(DfpMath.pow(factory.newDfp("2"), factory.newDfp("1")),
-             factory.newDfp("2"), 
+             factory.newDfp("2"),
              0, "pow #11");
 
         test(DfpMath.pow(factory.newDfp("-2"), factory.newDfp("1")),
-             factory.newDfp("-2"), 
+             factory.newDfp("-2"),
              0, "pow #12");
 
-        test(DfpMath.pow(pinf, factory.newDfp("1")),      
-             pinf, 
+        test(DfpMath.pow(pinf, factory.newDfp("1")),
+             pinf,
              0, "pow #13");
 
         test(DfpMath.pow(ninf, factory.newDfp("1")),
-             ninf, 
+             ninf,
              0, "pow #14");
 
         test(DfpMath.pow(qnan, factory.newDfp("1")),
-             qnan, 
+             qnan,
              DfpField.FLAG_INVALID, "pow #14.1");
 
         // exponent of NaN
         test(DfpMath.pow(factory.newDfp("0"), qnan),
-             qnan, 
+             qnan,
              DfpField.FLAG_INVALID, "pow #15");
 
-        test(DfpMath.pow(factory.newDfp("-0"), qnan),      
-             qnan, 
+        test(DfpMath.pow(factory.newDfp("-0"), qnan),
+             qnan,
              DfpField.FLAG_INVALID, "pow #16");
 
         test(DfpMath.pow(factory.newDfp("2"), qnan),
-             qnan, 
+             qnan,
              DfpField.FLAG_INVALID, "pow #17");
 
         test(DfpMath.pow(factory.newDfp("-2"), qnan),
-             qnan, 
+             qnan,
              DfpField.FLAG_INVALID, "pow #18");
 
-        test(DfpMath.pow(pinf, qnan),      
-             qnan, 
+        test(DfpMath.pow(pinf, qnan),
+             qnan,
              DfpField.FLAG_INVALID, "pow #19");
 
         test(DfpMath.pow(ninf, qnan),
-             qnan, 
+             qnan,
              DfpField.FLAG_INVALID, "pow #20");
 
         test(DfpMath.pow(qnan, qnan),
-             qnan, 
+             qnan,
              DfpField.FLAG_INVALID, "pow #21");
 
         // radix of NaN
         test(DfpMath.pow(qnan, factory.newDfp("1")),
-             qnan, 
+             qnan,
              DfpField.FLAG_INVALID, "pow #22");
 
-        test(DfpMath.pow(qnan, factory.newDfp("-1")),      
+        test(DfpMath.pow(qnan, factory.newDfp("-1")),
              qnan,
              DfpField.FLAG_INVALID, "pow #23");
 
@@ -186,19 +186,19 @@ public class DfpMathTest {
              DfpField.FLAG_INVALID, "pow #24");
 
         test(DfpMath.pow(qnan, ninf),
-             qnan, 
+             qnan,
              DfpField.FLAG_INVALID, "pow #25");
 
         test(DfpMath.pow(qnan, qnan),
-             qnan, 
+             qnan,
              DfpField.FLAG_INVALID, "pow #26");
 
         // (x > 1) ^ pinf = pinf,    (x < -1) ^ pinf = pinf
         test(DfpMath.pow(factory.newDfp("2"), pinf),
-             pinf, 
+             pinf,
              0, "pow #27");
 
-        test(DfpMath.pow(factory.newDfp("-2"), pinf),      
+        test(DfpMath.pow(factory.newDfp("-2"), pinf),
              pinf,
              0, "pow #28");
 
@@ -207,15 +207,15 @@ public class DfpMathTest {
              0, "pow #29");
 
         test(DfpMath.pow(ninf, pinf),
-             pinf, 
+             pinf,
              0, "pow #30");
 
         // (x > 1) ^ ninf = +0,    (x < -1) ^ ninf = +0
         test(DfpMath.pow(factory.newDfp("2"), ninf),
-             factory.getZero(), 
+             factory.getZero(),
              0, "pow #31");
 
-        test(DfpMath.pow(factory.newDfp("-2"), ninf),      
+        test(DfpMath.pow(factory.newDfp("-2"), ninf),
              factory.getZero(),
              0, "pow #32");
 
@@ -224,41 +224,41 @@ public class DfpMathTest {
              0, "pow #33");
 
         test(DfpMath.pow(ninf, ninf),
-             factory.getZero(), 
+             factory.getZero(),
              0, "pow #34");
 
         // (-1 < x < 1) ^ pinf = 0
         test(DfpMath.pow(factory.newDfp("0.5"), pinf),
-             factory.getZero(), 
+             factory.getZero(),
              0, "pow #35");
 
-        test(DfpMath.pow(factory.newDfp("-0.5"), pinf),      
+        test(DfpMath.pow(factory.newDfp("-0.5"), pinf),
              factory.getZero(),
              0, "pow #36");
 
-        // (-1 < x < 1) ^ ninf = pinf 
+        // (-1 < x < 1) ^ ninf = pinf
         test(DfpMath.pow(factory.newDfp("0.5"), ninf),
-             pinf, 
+             pinf,
              0, "pow #37");
 
-        test(DfpMath.pow(factory.newDfp("-0.5"), ninf),      
+        test(DfpMath.pow(factory.newDfp("-0.5"), ninf),
              pinf,
              0, "pow #38");
 
         // +/- 1  ^ +/-inf  = NaN
         test(DfpMath.pow(factory.getOne(), pinf),
-             qnan, 
+             qnan,
              DfpField.FLAG_INVALID, "pow #39");
 
-        test(DfpMath.pow(factory.getOne(), ninf),      
+        test(DfpMath.pow(factory.getOne(), ninf),
              qnan,
              DfpField.FLAG_INVALID, "pow #40");
 
         test(DfpMath.pow(factory.newDfp("-1"), pinf),
-             qnan, 
+             qnan,
              DfpField.FLAG_INVALID, "pow #41");
 
-        test(DfpMath.pow(factory.getOne().negate(), ninf),      
+        test(DfpMath.pow(factory.getOne().negate(), ninf),
              qnan,
              DfpField.FLAG_INVALID, "pow #42");
 
@@ -352,7 +352,7 @@ public class DfpMathTest {
              factory.newDfp("-0"),
              DfpField.FLAG_INEXACT, "pow #62");
 
-        // pinf  ^ +anything   = pinf 
+        // pinf  ^ +anything   = pinf
         test(DfpMath.pow(pinf, factory.newDfp("3")),
              pinf,
              0, "pow #63");
@@ -369,7 +369,7 @@ public class DfpMathTest {
              pinf,
              0, "pow #66");
 
-        // pinf  ^ -anything   = +0 
+        // pinf  ^ -anything   = +0
 
         test(DfpMath.pow(pinf, factory.newDfp("-3")),
              factory.getZero(),
@@ -442,7 +442,7 @@ public class DfpMathTest {
              factory.newDfp("-0"),
              DfpField.FLAG_INEXACT, "pow #82");
 
-        // -anything ^ integer 
+        // -anything ^ integer
         test(DfpMath.pow(factory.newDfp("-2"), factory.newDfp("3")),
              factory.newDfp("-8"),
              DfpField.FLAG_INEXACT, "pow #83");
@@ -467,7 +467,7 @@ public class DfpMathTest {
 
         // Some fractional cases.
         test(DfpMath.pow(factory.newDfp("2"),factory.newDfp("1.5")),
-             factory.newDfp("2.8284271247461901"), 
+             factory.newDfp("2.8284271247461901"),
              DfpField.FLAG_INEXACT, "pow #88");
     }
 
@@ -543,10 +543,10 @@ public class DfpMathTest {
              DfpField.FLAG_INEXACT, "sin #17");
 
         test(DfpMath.sin(factory.newDfp("0.7")),
-             factory.newDfp("0.64421768723769105367"),  
+             factory.newDfp("0.64421768723769105367"),
              DfpField.FLAG_INEXACT, "sin #18");
 
-        test(DfpMath.sin(factory.newDfp("0.8")),        
+        test(DfpMath.sin(factory.newDfp("0.8")),
              factory.newDfp("0.71735609089952276163"),
              DfpField.FLAG_INEXACT, "sin #19");
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/distribution/BinomialDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/distribution/BinomialDistributionTest.java b/src/test/java/org/apache/commons/math3/distribution/BinomialDistributionTest.java
index d6cb294..3817f88 100644
--- a/src/test/java/org/apache/commons/math3/distribution/BinomialDistributionTest.java
+++ b/src/test/java/org/apache/commons/math3/distribution/BinomialDistributionTest.java
@@ -29,7 +29,7 @@ public class BinomialDistributionTest extends IntegerDistributionAbstractTest {
     public BinomialDistributionTest() {
         setTolerance(1e-12);
     }
-    
+
     // -------------- Implementations for abstract methods
     // -----------------------
 
@@ -45,7 +45,7 @@ public class BinomialDistributionTest extends IntegerDistributionAbstractTest {
         return new int[] { -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
     }
 
-    /** 
+    /**
      * Creates the default probability density test expected values.
      * Reference values are from R, version 2.15.3.
      */

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/distribution/ConstantRealDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/distribution/ConstantRealDistributionTest.java b/src/test/java/org/apache/commons/math3/distribution/ConstantRealDistributionTest.java
index 1f3edb7..2eea53c 100644
--- a/src/test/java/org/apache/commons/math3/distribution/ConstantRealDistributionTest.java
+++ b/src/test/java/org/apache/commons/math3/distribution/ConstantRealDistributionTest.java
@@ -58,7 +58,7 @@ public class ConstantRealDistributionTest extends RealDistributionAbstractTest {
     public double[] makeDensityTestValues() {
         return new double[] {0, 0, 1};
     }
-    
+
     /** Override default test, verifying that inverse cum is constant */
     @Override
     @Test
@@ -86,6 +86,6 @@ public class ConstantRealDistributionTest extends RealDistributionAbstractTest {
         for (int i = 0; i < 10; i++) {
             Assert.assertEquals(0, dist.sample(), 0);
         }
-        
+
     }
 }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/distribution/EnumeratedIntegerDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/distribution/EnumeratedIntegerDistributionTest.java b/src/test/java/org/apache/commons/math3/distribution/EnumeratedIntegerDistributionTest.java
index 6948875..85aa5af 100644
--- a/src/test/java/org/apache/commons/math3/distribution/EnumeratedIntegerDistributionTest.java
+++ b/src/test/java/org/apache/commons/math3/distribution/EnumeratedIntegerDistributionTest.java
@@ -168,7 +168,7 @@ public class EnumeratedIntegerDistributionTest {
         Assert.assertEquals(testDistribution.getNumericalVariance(),
                 sumOfSquares / n - FastMath.pow(sum / n, 2), 1e-2);
     }
-    
+
     @Test
     public void testCreateFromIntegers() {
         final int[] data = new int[] {0, 1, 1, 2, 2, 2};

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/distribution/EnumeratedRealDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/distribution/EnumeratedRealDistributionTest.java b/src/test/java/org/apache/commons/math3/distribution/EnumeratedRealDistributionTest.java
index 4103c0b..e9155fe 100644
--- a/src/test/java/org/apache/commons/math3/distribution/EnumeratedRealDistributionTest.java
+++ b/src/test/java/org/apache/commons/math3/distribution/EnumeratedRealDistributionTest.java
@@ -33,7 +33,7 @@ import org.junit.Test;
 
 /**
  * Test class for {@link EnumeratedRealDistribution}.
- * 
+ *
  */
 public class EnumeratedRealDistributionTest {
 
@@ -240,11 +240,11 @@ public class EnumeratedRealDistributionTest {
         //                      14  18 21     28 31 33
         //
         // sum  = 4+5+0+3+1+3 = 16
-        
+
         EnumeratedRealDistribution distribution = new EnumeratedRealDistribution(
                 new double[] { 14.0, 18.0, 21.0, 28.0, 31.0, 33.0 },
                 new double[] { 4.0 / 16.0, 5.0 / 16.0, 0.0 / 16.0, 3.0 / 16.0, 1.0 / 16.0, 3.0 / 16.0 });
-        
+
         assertEquals(14.0, distribution.inverseCumulativeProbability(0.0000), 0.0);
         assertEquals(14.0, distribution.inverseCumulativeProbability(0.2500), 0.0);
         assertEquals(33.0, distribution.inverseCumulativeProbability(1.0000), 0.0);
@@ -256,7 +256,7 @@ public class EnumeratedRealDistributionTest {
         assertEquals(18.0, distribution.inverseCumulativeProbability(0.5625), 0.0);
         assertEquals(28.0, distribution.inverseCumulativeProbability(0.7500), 0.0);
     }
-    
+
     @Test
     public void testCreateFromDoubles() {
         final double[] data = new double[] {0, 1, 1, 2, 2, 2};

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/distribution/GeometricDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/distribution/GeometricDistributionTest.java b/src/test/java/org/apache/commons/math3/distribution/GeometricDistributionTest.java
index 2795ead..4d88911 100644
--- a/src/test/java/org/apache/commons/math3/distribution/GeometricDistributionTest.java
+++ b/src/test/java/org/apache/commons/math3/distribution/GeometricDistributionTest.java
@@ -31,7 +31,7 @@ public class GeometricDistributionTest extends IntegerDistributionAbstractTest {
     public GeometricDistributionTest() {
         setTolerance(1e-12);
     }
-    
+
     // -------------- Implementations for abstract methods --------------------
 
     /** Creates the default discrete distribution instance to use in tests. */

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/distribution/HypergeometricDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/distribution/HypergeometricDistributionTest.java b/src/test/java/org/apache/commons/math3/distribution/HypergeometricDistributionTest.java
index a5adbc2..465c3bf 100644
--- a/src/test/java/org/apache/commons/math3/distribution/HypergeometricDistributionTest.java
+++ b/src/test/java/org/apache/commons/math3/distribution/HypergeometricDistributionTest.java
@@ -39,7 +39,7 @@ public class HypergeometricDistributionTest extends IntegerDistributionAbstractT
     public HypergeometricDistributionTest() {
         setTolerance(1e-12);
     }
-    
+
     //-------------- Implementations for abstract methods -----------------------
 
     /** Creates the default discrete distribution instance to use in tests. */
@@ -54,7 +54,7 @@ public class HypergeometricDistributionTest extends IntegerDistributionAbstractT
         return new int[] {-1, 0, 1, 2, 3, 4, 5, 10};
     }
 
-    /** 
+    /**
      * Creates the default probability density test expected values
      * Reference values are from R, version 2.15.3.
      */
@@ -64,7 +64,7 @@ public class HypergeometricDistributionTest extends IntegerDistributionAbstractT
             0.0992063492063, 0.00396825396825, 0d};
     }
 
-    /** 
+    /**
      * Creates the default probability log density test expected values
      * Reference values are from R, version 2.14.1.
      */
@@ -81,7 +81,7 @@ public class HypergeometricDistributionTest extends IntegerDistributionAbstractT
         return makeDensityTestPoints();
     }
 
-    /** 
+    /**
      * Creates the default cumulative probability density test expected values
      * Reference values are from R, version 2.15.3.
      */
@@ -290,7 +290,7 @@ public class HypergeometricDistributionTest extends IntegerDistributionAbstractT
         Assert.assertEquals(dist.getNumericalMean(), 55d * 200d / 3000d, tol);
         Assert.assertEquals(dist.getNumericalVariance(), ( 200d * 55d * (3000d - 200d) * (3000d - 55d) ) / ( (3000d * 3000d * 2999d) ), tol);
     }
-    
+
     @Test
     public void testMath644() {
         int N = 14761461;  // population
@@ -299,10 +299,10 @@ public class HypergeometricDistributionTest extends IntegerDistributionAbstractT
 
         int k = 0;
         final HypergeometricDistribution dist = new HypergeometricDistribution(N, m, n);
-        
+
         Assert.assertTrue(Precision.compareTo(1.0, dist.upperCumulativeProbability(k), 1) == 0);
         Assert.assertTrue(Precision.compareTo(dist.cumulativeProbability(k), 0.0, 1) > 0);
-        
+
         // another way to calculate the upper cumulative probability
         double upper = 1.0 - dist.cumulativeProbability(k) + dist.probability(k);
         Assert.assertTrue(Precision.compareTo(1.0, upper, 1) == 0);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/distribution/KolmogorovSmirnovDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/distribution/KolmogorovSmirnovDistributionTest.java b/src/test/java/org/apache/commons/math3/distribution/KolmogorovSmirnovDistributionTest.java
index 53f4ff8..2ff4bd5 100644
--- a/src/test/java/org/apache/commons/math3/distribution/KolmogorovSmirnovDistributionTest.java
+++ b/src/test/java/org/apache/commons/math3/distribution/KolmogorovSmirnovDistributionTest.java
@@ -26,18 +26,18 @@ import org.junit.Test;
  */
 @Deprecated
 public class KolmogorovSmirnovDistributionTest {
-    
+
     private static final double TOLERANCE = 10e-10;
 
     @Test
     public void testCumulativeDensityFunction() {
-        
+
         KolmogorovSmirnovDistribution dist;
-        
+
         /* The code below is generated using the R-script located in
          * /src/test/R/KolmogorovSmirnovDistributionTestCases.R
          */
-        
+
         /* R version 2.11.1 (2010-05-31) */
 
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/distribution/LevyDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/distribution/LevyDistributionTest.java b/src/test/java/org/apache/commons/math3/distribution/LevyDistributionTest.java
index 3c32b9e..55c92c0 100644
--- a/src/test/java/org/apache/commons/math3/distribution/LevyDistributionTest.java
+++ b/src/test/java/org/apache/commons/math3/distribution/LevyDistributionTest.java
@@ -68,7 +68,7 @@ public class LevyDistributionTest extends RealDistributionAbstractTest {
         };
     }
 
-    /** 
+    /**
      * Creates the default logarithmic probability density test expected values.
      * Reference values are from R, version 2.14.1.
      */

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/distribution/MultivariateNormalDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/distribution/MultivariateNormalDistributionTest.java b/src/test/java/org/apache/commons/math3/distribution/MultivariateNormalDistributionTest.java
index f044cbd..2bd149d 100644
--- a/src/test/java/org/apache/commons/math3/distribution/MultivariateNormalDistributionTest.java
+++ b/src/test/java/org/apache/commons/math3/distribution/MultivariateNormalDistributionTest.java
@@ -137,7 +137,7 @@ public class MultivariateNormalDistributionTest {
     public void testUnivariateDistribution() {
         final double[] mu = { -1.5 };
         final double[][] sigma = { { 1 } };
- 
+
         final MultivariateNormalDistribution multi = new MultivariateNormalDistribution(mu, sigma);
 
         final NormalDistribution uni = new NormalDistribution(mu[0], sigma[0][0]);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/distribution/PoissonDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/distribution/PoissonDistributionTest.java b/src/test/java/org/apache/commons/math3/distribution/PoissonDistributionTest.java
index 63518d2..736b84a 100644
--- a/src/test/java/org/apache/commons/math3/distribution/PoissonDistributionTest.java
+++ b/src/test/java/org/apache/commons/math3/distribution/PoissonDistributionTest.java
@@ -66,7 +66,7 @@ public class PoissonDistributionTest extends IntegerDistributionAbstractTest {
                 0.156293451851d, 0.00529247667642d, 8.27746364655e-09};
     }
 
-    /** 
+    /**
      * Creates the default logarithmic probability density test expected values.
      * Reference values are from R, version 2.14.1.
      */

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/distribution/RealDistributionAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/distribution/RealDistributionAbstractTest.java b/src/test/java/org/apache/commons/math3/distribution/RealDistributionAbstractTest.java
index 4fa94a9..4ca1fb8 100644
--- a/src/test/java/org/apache/commons/math3/distribution/RealDistributionAbstractTest.java
+++ b/src/test/java/org/apache/commons/math3/distribution/RealDistributionAbstractTest.java
@@ -325,7 +325,7 @@ public abstract class RealDistributionAbstractTest {
             // expected
         }
     }
-    
+
     /**
      * Test sampling
      */
@@ -342,7 +342,7 @@ public abstract class RealDistributionAbstractTest {
         }
         TestUtils.assertChiSquareAccept(expected, counts, 0.001);
     }
-    
+
     /**
      * Verify that density integrals match the distribution.
      * The (filtered, sorted) cumulativeTestPoints array is used to source
@@ -381,7 +381,7 @@ public abstract class RealDistributionAbstractTest {
                                     integrationTestPoints.get(i)), tol);
         }
     }
-    
+
     /**
      * Verify that isSupportLowerBoundInclusvie returns true iff the lower bound
      * is finite and density is non-NaN, non-infinite there.
@@ -395,9 +395,9 @@ public abstract class RealDistributionAbstractTest {
                 !Double.isInfinite(lowerBound) && !Double.isNaN(result) &&
                 !Double.isInfinite(result),
                 distribution.isSupportLowerBoundInclusive());
-         
+
     }
-    
+
     /**
      * Verify that isSupportUpperBoundInclusvie returns true iff the upper bound
      * is finite and density is non-NaN, non-infinite there.
@@ -411,7 +411,7 @@ public abstract class RealDistributionAbstractTest {
                 !Double.isInfinite(upperBound) && !Double.isNaN(result) &&
                 !Double.isInfinite(result),
                 distribution.isSupportUpperBoundInclusive());
-         
+
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/distribution/TDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/distribution/TDistributionTest.java b/src/test/java/org/apache/commons/math3/distribution/TDistributionTest.java
index 2f50b70..c186f33 100644
--- a/src/test/java/org/apache/commons/math3/distribution/TDistributionTest.java
+++ b/src/test/java/org/apache/commons/math3/distribution/TDistributionTest.java
@@ -100,7 +100,7 @@ public class TDistributionTest extends RealDistributionAbstractTest {
                 new double[] {Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY});
         verifyInverseCumulativeProbabilities();
     }
-    
+
     @Test
     public void testCumulativeProbablilityExtremes() {
         TDistribution dist;
@@ -110,7 +110,7 @@ public class TDistributionTest extends RealDistributionAbstractTest {
                 dist.cumulativeProbability(Double.POSITIVE_INFINITY), Double.MIN_VALUE);
             Assert.assertEquals(0,
                 dist.cumulativeProbability(Double.NEGATIVE_INFINITY), Double.MIN_VALUE);
-        }   
+        }
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/distribution/UniformRealDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/distribution/UniformRealDistributionTest.java b/src/test/java/org/apache/commons/math3/distribution/UniformRealDistributionTest.java
index 29f6a85..7bf3f4b 100644
--- a/src/test/java/org/apache/commons/math3/distribution/UniformRealDistributionTest.java
+++ b/src/test/java/org/apache/commons/math3/distribution/UniformRealDistributionTest.java
@@ -110,15 +110,15 @@ public class UniformRealDistributionTest extends RealDistributionAbstractTest {
         Assert.assertEquals(dist.getNumericalMean(), 0.375, 0);
         Assert.assertEquals(dist.getNumericalVariance(), 0.2552083333333333, 0);
     }
-    
-    /** 
-     * Check accuracy of analytical inverse CDF. Fails if a solver is used 
-     * with the default accuracy. 
+
+    /**
+     * Check accuracy of analytical inverse CDF. Fails if a solver is used
+     * with the default accuracy.
      */
     @Test
     public void testInverseCumulativeDistribution() {
         UniformRealDistribution dist = new UniformRealDistribution(0, 1e-9);
-        
+
         Assert.assertEquals(2.5e-10, dist.inverseCumulativeProbability(0.25), 0);
     }
 }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/distribution/fitting/MultivariateNormalMixtureExpectationMaximizationTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/distribution/fitting/MultivariateNormalMixtureExpectationMaximizationTest.java b/src/test/java/org/apache/commons/math3/distribution/fitting/MultivariateNormalMixtureExpectationMaximizationTest.java
index 75328fc..cfb2619 100644
--- a/src/test/java/org/apache/commons/math3/distribution/fitting/MultivariateNormalMixtureExpectationMaximizationTest.java
+++ b/src/test/java/org/apache/commons/math3/distribution/fitting/MultivariateNormalMixtureExpectationMaximizationTest.java
@@ -180,10 +180,10 @@ public class MultivariateNormalMixtureExpectationMaximizationTest {
                 .getComponents()) {
             Assert.assertEquals(correctWeights[i], component.getFirst(),
                     Math.ulp(1d));
-            
+
             final double[] means = component.getValue().getMeans();
             Assert.assertTrue(Arrays.equals(correctMeans[i], means));
-            
+
             final RealMatrix covMat = component.getValue().getCovariances();
             Assert.assertEquals(correctCovMats[i], covMat);
             i++;
@@ -197,12 +197,12 @@ public class MultivariateNormalMixtureExpectationMaximizationTest {
         final double[][] data = getTestSamples();
         final double correctLogLikelihood = -4.292431006791994;
         final double[] correctWeights = new double[] { 0.2962324189652912, 0.7037675810347089 };
-        
+
         final double[][] correctMeans = new double[][]{
             {-1.4213112715121132, 1.6924690505757753},
             {4.213612224374709, 7.975621325853645}
         };
-        
+
         final RealMatrix[] correctCovMats = new Array2DRowRealMatrix[2];
         correctCovMats[0] = new Array2DRowRealMatrix(new double[][] {
             { 1.739356907285747, -0.5867644251487614 },
@@ -211,7 +211,7 @@ public class MultivariateNormalMixtureExpectationMaximizationTest {
         correctCovMats[1] = new Array2DRowRealMatrix(new double[][] {
             { 4.245384898007161, 2.5797798966382155 },
             { 2.5797798966382155, 3.9200272522448367 } });
-        
+
         final MultivariateNormalDistribution[] correctMVNs = new MultivariateNormalDistribution[2];
         correctMVNs[0] = new MultivariateNormalDistribution(correctMeans[0], correctCovMats[0].getData());
         correctMVNs[1] = new MultivariateNormalDistribution(correctMeans[1], correctCovMats[1].getData());

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/exception/DimensionMismatchExceptionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/exception/DimensionMismatchExceptionTest.java b/src/test/java/org/apache/commons/math3/exception/DimensionMismatchExceptionTest.java
index 3ac51e9..4073bfe 100644
--- a/src/test/java/org/apache/commons/math3/exception/DimensionMismatchExceptionTest.java
+++ b/src/test/java/org/apache/commons/math3/exception/DimensionMismatchExceptionTest.java
@@ -21,7 +21,7 @@ import org.junit.Test;
 
 /**
  * Test for {@link DimensionMismatchException}.
- * 
+ *
  */
 public class DimensionMismatchExceptionTest {
     @Test

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/exception/MaxCountExceededExceptionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/exception/MaxCountExceededExceptionTest.java b/src/test/java/org/apache/commons/math3/exception/MaxCountExceededExceptionTest.java
index ba0de1e..1a96d35 100644
--- a/src/test/java/org/apache/commons/math3/exception/MaxCountExceededExceptionTest.java
+++ b/src/test/java/org/apache/commons/math3/exception/MaxCountExceededExceptionTest.java
@@ -21,7 +21,7 @@ import org.junit.Test;
 
 /**
  * Test for {@link MaxCountExceededException}.
- * 
+ *
  */
 public class MaxCountExceededExceptionTest {
     @Test

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/exception/NonMonotonicSequenceExceptionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/exception/NonMonotonicSequenceExceptionTest.java b/src/test/java/org/apache/commons/math3/exception/NonMonotonicSequenceExceptionTest.java
index 42c5460..08981dc 100644
--- a/src/test/java/org/apache/commons/math3/exception/NonMonotonicSequenceExceptionTest.java
+++ b/src/test/java/org/apache/commons/math3/exception/NonMonotonicSequenceExceptionTest.java
@@ -23,7 +23,7 @@ import org.junit.Test;
 
 /**
  * Test for {@link NonMonotonicSequenceException}.
- * 
+ *
  */
 public class NonMonotonicSequenceExceptionTest {
     @Test

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/exception/NotPositiveExceptionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/exception/NotPositiveExceptionTest.java b/src/test/java/org/apache/commons/math3/exception/NotPositiveExceptionTest.java
index 6e4106c..d2fe973 100644
--- a/src/test/java/org/apache/commons/math3/exception/NotPositiveExceptionTest.java
+++ b/src/test/java/org/apache/commons/math3/exception/NotPositiveExceptionTest.java
@@ -21,7 +21,7 @@ import org.junit.Test;
 
 /**
  * Test for {@link NotPositiveException}.
- * 
+ *
  */
 public class NotPositiveExceptionTest {
     @Test

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/exception/NotStrictlyPositiveExceptionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/exception/NotStrictlyPositiveExceptionTest.java b/src/test/java/org/apache/commons/math3/exception/NotStrictlyPositiveExceptionTest.java
index e313b15..d9c7bec 100644
--- a/src/test/java/org/apache/commons/math3/exception/NotStrictlyPositiveExceptionTest.java
+++ b/src/test/java/org/apache/commons/math3/exception/NotStrictlyPositiveExceptionTest.java
@@ -21,7 +21,7 @@ import org.junit.Test;
 
 /**
  * Test for {@link NotStrictlyPositiveException}.
- * 
+ *
  */
 public class NotStrictlyPositiveExceptionTest {
     @Test

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/exception/NumberIsTooLargeExceptionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/exception/NumberIsTooLargeExceptionTest.java b/src/test/java/org/apache/commons/math3/exception/NumberIsTooLargeExceptionTest.java
index 5ebe49d..15c8820 100644
--- a/src/test/java/org/apache/commons/math3/exception/NumberIsTooLargeExceptionTest.java
+++ b/src/test/java/org/apache/commons/math3/exception/NumberIsTooLargeExceptionTest.java
@@ -21,7 +21,7 @@ import org.junit.Test;
 
 /**
  * Test for {@link NumberIsTooLargeException}.
- * 
+ *
  */
 public class NumberIsTooLargeExceptionTest {
     @Test

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/exception/NumberIsTooSmallExceptionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/exception/NumberIsTooSmallExceptionTest.java b/src/test/java/org/apache/commons/math3/exception/NumberIsTooSmallExceptionTest.java
index b70032f..5e2295f 100644
--- a/src/test/java/org/apache/commons/math3/exception/NumberIsTooSmallExceptionTest.java
+++ b/src/test/java/org/apache/commons/math3/exception/NumberIsTooSmallExceptionTest.java
@@ -21,7 +21,7 @@ import org.junit.Test;
 
 /**
  * Test for {@link NumberIsTooSmallException}.
- * 
+ *
  */
 public class NumberIsTooSmallExceptionTest {
     @Test

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/exception/OutOfRangeExceptionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/exception/OutOfRangeExceptionTest.java b/src/test/java/org/apache/commons/math3/exception/OutOfRangeExceptionTest.java
index deda254..21954e2 100644
--- a/src/test/java/org/apache/commons/math3/exception/OutOfRangeExceptionTest.java
+++ b/src/test/java/org/apache/commons/math3/exception/OutOfRangeExceptionTest.java
@@ -21,7 +21,7 @@ import org.junit.Test;
 
 /**
  * Test for {@link OutOfRangeException}.
- * 
+ *
  */
 public class OutOfRangeExceptionTest {
     @Test

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/exception/TooManyEvaluationsExceptionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/exception/TooManyEvaluationsExceptionTest.java b/src/test/java/org/apache/commons/math3/exception/TooManyEvaluationsExceptionTest.java
index c21775e..596c469 100644
--- a/src/test/java/org/apache/commons/math3/exception/TooManyEvaluationsExceptionTest.java
+++ b/src/test/java/org/apache/commons/math3/exception/TooManyEvaluationsExceptionTest.java
@@ -23,7 +23,7 @@ import org.junit.Test;
 
 /**
  * Test for {@link TooManyEvaluationsException}.
- * 
+ *
  */
 public class TooManyEvaluationsExceptionTest {
     @Test

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/exception/util/ArgUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/exception/util/ArgUtilsTest.java b/src/test/java/org/apache/commons/math3/exception/util/ArgUtilsTest.java
index d07708f..95dce1d 100644
--- a/src/test/java/org/apache/commons/math3/exception/util/ArgUtilsTest.java
+++ b/src/test/java/org/apache/commons/math3/exception/util/ArgUtilsTest.java
@@ -24,7 +24,7 @@ import org.junit.Test;
 
 /**
  * Test for {@link ArgUtils}.
- * 
+ *
  */
 public class ArgUtilsTest {
     @Test

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/exception/util/ExceptionContextTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/exception/util/ExceptionContextTest.java b/src/test/java/org/apache/commons/math3/exception/util/ExceptionContextTest.java
index 91fe804..17a2163 100644
--- a/src/test/java/org/apache/commons/math3/exception/util/ExceptionContextTest.java
+++ b/src/test/java/org/apache/commons/math3/exception/util/ExceptionContextTest.java
@@ -29,7 +29,7 @@ import org.junit.Test;
 
 /**
  * Test for {@link ExceptionContext}.
- * 
+ *
  */
 public class ExceptionContextTest {
     @Test


[04/21] [math] [MATH-1294] Fix potential race condition in PolynomialUtils. Thanks to Kamil Włodarczyk

Posted by lu...@apache.org.
[MATH-1294] Fix potential race condition in PolynomialUtils. Thanks to Kamil Włodarczyk


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

Branch: refs/heads/field-ode
Commit: fe23c9b04aff89b3c6da20b4769157b8c577d071
Parents: 978f89c
Author: Thomas Neidhart <th...@gmail.com>
Authored: Mon Nov 23 23:16:58 2015 +0100
Committer: Thomas Neidhart <th...@gmail.com>
Committed: Mon Nov 23 23:16:58 2015 +0100

----------------------------------------------------------------------
 src/changes/changes.xml                                   |  5 +++++
 .../math3/analysis/polynomials/PolynomialsUtils.java      | 10 +++++++---
 2 files changed, 12 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/fe23c9b0/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 7dfacc5..3448c23 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -51,6 +51,11 @@ If the output is not quite correct, check for invisible trailing spaces!
   </properties>
   <body>
     <release version="3.6" date="XXXX-XX-XX" description="">
+      <action dev="tn" type="fix" issue="MATH-1294" due-to="Kamil Włodarczyk">
+        Fixed potential race condition in PolynomialUtils#buildPolynomial in
+        case polynomials are generated from multiple threads. Furthermore, the
+        synchronization is now performed on the coefficient list instead of the class.
+      </action>    
       <action dev="psteitz" type="update" issue="MATH-1246">
         Added bootstrap method to KolmogorovSmirnov test.
       </action>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/fe23c9b0/src/main/java/org/apache/commons/math3/analysis/polynomials/PolynomialsUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/polynomials/PolynomialsUtils.java b/src/main/java/org/apache/commons/math3/analysis/polynomials/PolynomialsUtils.java
index 5604149..2efa07d 100644
--- a/src/main/java/org/apache/commons/math3/analysis/polynomials/PolynomialsUtils.java
+++ b/src/main/java/org/apache/commons/math3/analysis/polynomials/PolynomialsUtils.java
@@ -107,6 +107,7 @@ public class PolynomialsUtils {
             /** Fixed recurrence coefficients. */
             private final BigFraction[] coeffs = { BigFraction.ZERO, BigFraction.TWO, BigFraction.ONE };
             /** {@inheritDoc} */
+            @Override
             public BigFraction[] generate(int k) {
                 return coeffs;
             }
@@ -131,6 +132,7 @@ public class PolynomialsUtils {
         return buildPolynomial(degree, HERMITE_COEFFICIENTS,
                 new RecurrenceCoefficientsGenerator() {
             /** {@inheritDoc} */
+            @Override
             public BigFraction[] generate(int k) {
                 return new BigFraction[] {
                         BigFraction.ZERO,
@@ -157,6 +159,7 @@ public class PolynomialsUtils {
         return buildPolynomial(degree, LAGUERRE_COEFFICIENTS,
                 new RecurrenceCoefficientsGenerator() {
             /** {@inheritDoc} */
+            @Override
             public BigFraction[] generate(int k) {
                 final int kP1 = k + 1;
                 return new BigFraction[] {
@@ -184,6 +187,7 @@ public class PolynomialsUtils {
         return buildPolynomial(degree, LEGENDRE_COEFFICIENTS,
                                new RecurrenceCoefficientsGenerator() {
             /** {@inheritDoc} */
+            @Override
             public BigFraction[] generate(int k) {
                 final int kP1 = k + 1;
                 return new BigFraction[] {
@@ -234,6 +238,7 @@ public class PolynomialsUtils {
         return buildPolynomial(degree, JACOBI_COEFFICIENTS.get(key),
                                new RecurrenceCoefficientsGenerator() {
             /** {@inheritDoc} */
+            @Override
             public BigFraction[] generate(int k) {
                 k++;
                 final int kvw      = k + v + w;
@@ -359,9 +364,8 @@ public class PolynomialsUtils {
     private static PolynomialFunction buildPolynomial(final int degree,
                                                       final List<BigFraction> coefficients,
                                                       final RecurrenceCoefficientsGenerator generator) {
-
-        final int maxDegree = (int) FastMath.floor(FastMath.sqrt(2 * coefficients.size())) - 1;
-        synchronized (PolynomialsUtils.class) {
+        synchronized (coefficients) {
+            final int maxDegree = (int) FastMath.floor(FastMath.sqrt(2 * coefficients.size())) - 1;
             if (degree > maxDegree) {
                 computeUpToDegree(degree, maxDegree, generator, coefficients);
             }


[08/21] [math] Removed trailing spaces. No code change.

Posted by lu...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optim/linear/SimplexSolverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optim/linear/SimplexSolverTest.java b/src/test/java/org/apache/commons/math3/optim/linear/SimplexSolverTest.java
index 0728be1..452bd7d 100644
--- a/src/test/java/org/apache/commons/math3/optim/linear/SimplexSolverTest.java
+++ b/src/test/java/org/apache/commons/math3/optim/linear/SimplexSolverTest.java
@@ -42,13 +42,13 @@ public class SimplexSolverTest {
         //      x1,x2,x3,x4 >= 0
 
         LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 10, -57, -9, -24}, 0);
-        
+
         ArrayList<LinearConstraint> constraints = new ArrayList<LinearConstraint>();
 
         constraints.add(new LinearConstraint(new double[] {0.5, -5.5, -2.5, 9}, Relationship.LEQ, 0));
         constraints.add(new LinearConstraint(new double[] {0.5, -1.5, -0.5, 1}, Relationship.LEQ, 0));
         constraints.add(new LinearConstraint(new double[] {  1,    0,    0, 0}, Relationship.LEQ, 1));
-        
+
         double epsilon = 1e-6;
         SimplexSolver solver = new SimplexSolver();
         PointValuePair solution = solver.optimize(f, new LinearConstraintSet(constraints),
@@ -63,7 +63,7 @@ public class SimplexSolverTest {
     public void testMath828() {
         LinearObjectiveFunction f = new LinearObjectiveFunction(
                 new double[] { 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 0.0);
-        
+
         ArrayList <LinearConstraint>constraints = new ArrayList<LinearConstraint>();
 
         constraints.add(new LinearConstraint(new double[] {0.0, 39.0, 23.0, 96.0, 15.0, 48.0, 9.0, 21.0, 48.0, 36.0, 76.0, 19.0, 88.0, 17.0, 16.0, 36.0,}, Relationship.GEQ, 15.0));
@@ -73,7 +73,7 @@ public class SimplexSolverTest {
         constraints.add(new LinearConstraint(new double[] {25.0, -7.0, -99.0, -78.0, -25.0, -14.0, -16.0, -89.0, -39.0, -56.0, -53.0, -9.0, -18.0, -26.0, -11.0, -61.0,}, Relationship.GEQ, 0.0));
         constraints.add(new LinearConstraint(new double[] {33.0, -95.0, -15.0, -4.0, -33.0, -3.0, -20.0, -96.0, -27.0, -13.0, -80.0, -24.0, -3.0, -13.0, -57.0, -76.0,}, Relationship.GEQ, 0.0));
         constraints.add(new LinearConstraint(new double[] {7.0, -95.0, -39.0, -93.0, -7.0, -94.0, -94.0, -62.0, -76.0, -26.0, -53.0, -57.0, -31.0, -76.0, -53.0, -52.0,}, Relationship.GEQ, 0.0));
-        
+
         double epsilon = 1e-6;
         PointValuePair solution = new SimplexSolver().optimize(DEFAULT_MAX_ITER, f, new LinearConstraintSet(constraints),
                                                                GoalType.MINIMIZE, new NonNegativeConstraint(true));
@@ -85,7 +85,7 @@ public class SimplexSolverTest {
     public void testMath828Cycle() {
         LinearObjectiveFunction f = new LinearObjectiveFunction(
                 new double[] { 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 0.0);
-        
+
         ArrayList <LinearConstraint>constraints = new ArrayList<LinearConstraint>();
 
         constraints.add(new LinearConstraint(new double[] {0.0, 16.0, 14.0, 69.0, 1.0, 85.0, 52.0, 43.0, 64.0, 97.0, 14.0, 74.0, 89.0, 28.0, 94.0, 58.0, 13.0, 22.0, 21.0, 17.0, 30.0, 25.0, 1.0, 59.0, 91.0, 78.0, 12.0, 74.0, 56.0, 3.0, 88.0,}, Relationship.GEQ, 91.0));
@@ -95,14 +95,14 @@ public class SimplexSolverTest {
         constraints.add(new LinearConstraint(new double[] {41.0, -96.0, -41.0, -48.0, -70.0, -43.0, -43.0, -43.0, -97.0, -37.0, -85.0, -70.0, -45.0, -67.0, -87.0, -69.0, -94.0, -54.0, -54.0, -92.0, -79.0, -10.0, -35.0, -20.0, -41.0, -41.0, -65.0, -25.0, -12.0, -8.0, -46.0,}, Relationship.GEQ, 0.0));
         constraints.add(new LinearConstraint(new double[] {27.0, -42.0, -65.0, -49.0, -53.0, -42.0, -17.0, -2.0, -61.0, -31.0, -76.0, -47.0, -8.0, -93.0, -86.0, -62.0, -65.0, -63.0, -22.0, -43.0, -27.0, -23.0, -32.0, -74.0, -27.0, -63.0, -47.0, -78.0, -29.0, -95.0, -73.0,}, Relationship.GEQ, 0.0));
         constraints.add(new LinearConstraint(new double[] {15.0, -46.0, -41.0, -83.0, -98.0, -99.0, -21.0, -35.0, -7.0, -14.0, -80.0, -63.0, -18.0, -42.0, -5.0, -34.0, -56.0, -70.0, -16.0, -18.0, -74.0, -61.0, -47.0, -41.0, -15.0, -79.0, -18.0, -47.0, -88.0, -68.0, -55.0,}, Relationship.GEQ, 0.0));
-        
+
         double epsilon = 1e-6;
         PointValuePair solution = new SimplexSolver().optimize(DEFAULT_MAX_ITER, f,
                                                                new LinearConstraintSet(constraints),
                                                                GoalType.MINIMIZE, new NonNegativeConstraint(true),
                                                                PivotSelectionRule.BLAND);
         Assert.assertEquals(1.0d, solution.getValue(), epsilon);
-        Assert.assertTrue(validSolution(solution, constraints, epsilon));        
+        Assert.assertTrue(validSolution(solution, constraints, epsilon));
     }
 
     @Test
@@ -185,7 +185,7 @@ public class SimplexSolverTest {
         SimplexSolver solver = new SimplexSolver();
         PointValuePair solution = solver.optimize(DEFAULT_MAX_ITER, f, new LinearConstraintSet(constraints),
                                                   GoalType.MINIMIZE, new NonNegativeConstraint(false));
-        
+
         Assert.assertTrue(Precision.compareTo(solution.getPoint()[0] * 200.d, 1.d, epsilon) >= 0);
         Assert.assertEquals(0.0050, solution.getValue(), epsilon);
     }
@@ -209,13 +209,13 @@ public class SimplexSolverTest {
         SimplexSolver simplex = new SimplexSolver();
         PointValuePair solution = simplex.optimize(DEFAULT_MAX_ITER, f, new LinearConstraintSet(constraints),
                                                    GoalType.MINIMIZE, new NonNegativeConstraint(false));
-        
+
         Assert.assertTrue(Precision.compareTo(solution.getPoint()[0], -1e-18d, epsilon) >= 0);
-        Assert.assertEquals(1.0d, solution.getPoint()[1], epsilon);        
+        Assert.assertEquals(1.0d, solution.getPoint()[1], epsilon);
         Assert.assertEquals(0.0d, solution.getPoint()[2], epsilon);
         Assert.assertEquals(1.0d, solution.getValue(), epsilon);
     }
-    
+
     @Test
     public void testMath272() {
         LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 2, 2, 1 }, 0);
@@ -351,12 +351,12 @@ public class SimplexSolverTest {
     @Test
     public void testMath930() {
         Collection<LinearConstraint> constraints = createMath930Constraints();
-        
+
         double[] objFunctionCoeff = new double[33];
         objFunctionCoeff[3] = 1;
         LinearObjectiveFunction f = new LinearObjectiveFunction(objFunctionCoeff, 0);
         SimplexSolver solver = new SimplexSolver(1e-4, 10, 1e-6);
-        
+
         PointValuePair solution = solver.optimize(new MaxIter(1000), f, new LinearConstraintSet(constraints),
                                                   GoalType.MINIMIZE, new NonNegativeConstraint(true));
         Assert.assertEquals(0.3752298, solution.getValue(), 1e-4);
@@ -751,7 +751,7 @@ public class SimplexSolverTest {
     public void testSolutionCallback() {
         // re-use the problem from testcase for MATH-288
         // it normally requires 5 iterations
-        
+
         LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 7, 3, 0, 0 }, 0 );
 
         List<LinearConstraint> constraints = new ArrayList<LinearConstraint>();
@@ -763,7 +763,7 @@ public class SimplexSolverTest {
 
         final SimplexSolver solver = new SimplexSolver();
         final SolutionCallback callback = new SolutionCallback();
-        
+
         Assert.assertNull(callback.getSolution());
         Assert.assertFalse(callback.isSolutionOptimal());
 
@@ -774,7 +774,7 @@ public class SimplexSolverTest {
         } catch (TooManyIterationsException ex) {
             // expected
         }
-        
+
         final PointValuePair solution = callback.getSolution();
         Assert.assertNotNull(solution);
         Assert.assertTrue(validSolution(solution, constraints, 1e-4));
@@ -821,20 +821,20 @@ public class SimplexSolverTest {
             for (int i = 0; i < vals.length; i++) {
                 result += vals[i] * coeffs[i];
             }
-            
+
             switch (c.getRelationship()) {
             case EQ:
                 if (!Precision.equals(result, c.getValue(), epsilon)) {
                     return false;
                 }
                 break;
-                
+
             case GEQ:
                 if (Precision.compareTo(result, c.getValue(), epsilon) < 0) {
                     return false;
                 }
                 break;
-                
+
             case LEQ:
                 if (Precision.compareTo(result, c.getValue(), epsilon) > 0) {
                     return false;
@@ -842,7 +842,7 @@ public class SimplexSolverTest {
                 break;
             }
         }
-        
+
         return true;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optim/nonlinear/scalar/noderiv/BOBYQAOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optim/nonlinear/scalar/noderiv/BOBYQAOptimizerTest.java b/src/test/java/org/apache/commons/math3/optim/nonlinear/scalar/noderiv/BOBYQAOptimizerTest.java
index c214e4b..858d37b 100644
--- a/src/test/java/org/apache/commons/math3/optim/nonlinear/scalar/noderiv/BOBYQAOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math3/optim/nonlinear/scalar/noderiv/BOBYQAOptimizerTest.java
@@ -41,22 +41,22 @@ import org.junit.Test;
 public class BOBYQAOptimizerTest {
 
     static final int DIM = 13;
-   
+
     @Test(expected=NumberIsTooLargeException.class)
     public void testInitOutOfBounds() {
         double[] startPoint = point(DIM, 3);
         double[][] boundaries = boundaries(DIM, -1, 2);
         doTest(new Rosen(), startPoint, boundaries,
-                GoalType.MINIMIZE, 
+                GoalType.MINIMIZE,
                 1e-13, 1e-6, 2000, null);
     }
-    
+
     @Test(expected=DimensionMismatchException.class)
     public void testBoundariesDimensionMismatch() {
         double[] startPoint = point(DIM, 0.5);
         double[][] boundaries = boundaries(DIM + 1, -1, 2);
         doTest(new Rosen(), startPoint, boundaries,
-               GoalType.MINIMIZE, 
+               GoalType.MINIMIZE,
                1e-13, 1e-6, 2000, null);
     }
 
@@ -74,7 +74,7 @@ public class BOBYQAOptimizerTest {
         double[] startPoint = point(DIM, 0.1);
         double[][] boundaries = null;
         doTest(new Rosen(), startPoint, boundaries,
-               GoalType.MINIMIZE, 
+               GoalType.MINIMIZE,
                1e-13, 1e-6, lowMaxEval, null);
      }
 
@@ -84,7 +84,7 @@ public class BOBYQAOptimizerTest {
         double[][] boundaries = null;
         PointValuePair expected = new PointValuePair(point(DIM,1.0),0.0);
         doTest(new Rosen(), startPoint, boundaries,
-                GoalType.MINIMIZE, 
+                GoalType.MINIMIZE,
                 1e-13, 1e-6, 2000, expected);
      }
 
@@ -94,12 +94,12 @@ public class BOBYQAOptimizerTest {
         double[][] boundaries = null;
         PointValuePair expected = new PointValuePair(point(DIM,0.0),1.0);
         doTest(new MinusElli(), startPoint, boundaries,
-                GoalType.MAXIMIZE, 
+                GoalType.MAXIMIZE,
                 2e-10, 5e-6, 1000, expected);
-        boundaries = boundaries(DIM,-0.3,0.3); 
+        boundaries = boundaries(DIM,-0.3,0.3);
         startPoint = point(DIM,0.1);
         doTest(new MinusElli(), startPoint, boundaries,
-                GoalType.MAXIMIZE, 
+                GoalType.MAXIMIZE,
                 2e-10, 5e-6, 1000, expected);
     }
 
@@ -110,7 +110,7 @@ public class BOBYQAOptimizerTest {
         PointValuePair expected =
             new PointValuePair(point(DIM,0.0),0.0);
         doTest(new Elli(), startPoint, boundaries,
-                GoalType.MINIMIZE, 
+                GoalType.MINIMIZE,
                 1e-13, 1e-6, 1000, expected);
      }
 
@@ -121,7 +121,7 @@ public class BOBYQAOptimizerTest {
         PointValuePair expected =
             new PointValuePair(point(DIM,0.0),0.0);
         doTest(new ElliRotated(), startPoint, boundaries,
-                GoalType.MINIMIZE, 
+                GoalType.MINIMIZE,
                 1e-12, 1e-6, 10000, expected);
     }
 
@@ -132,7 +132,7 @@ public class BOBYQAOptimizerTest {
         PointValuePair expected =
             new PointValuePair(point(DIM,0.0),0.0);
         doTest(new Cigar(), startPoint, boundaries,
-                GoalType.MINIMIZE, 
+                GoalType.MINIMIZE,
                 1e-13, 1e-6, 100, expected);
     }
 
@@ -154,7 +154,7 @@ public class BOBYQAOptimizerTest {
         PointValuePair expected =
             new PointValuePair(point(DIM,0.0),0.0);
         doTest(new CigTab(), startPoint, boundaries,
-                GoalType.MINIMIZE, 
+                GoalType.MINIMIZE,
                 1e-13, 5e-5, 100, expected);
      }
 
@@ -165,18 +165,18 @@ public class BOBYQAOptimizerTest {
         PointValuePair expected =
             new PointValuePair(point(DIM,0.0),0.0);
         doTest(new Sphere(), startPoint, boundaries,
-                GoalType.MINIMIZE, 
+                GoalType.MINIMIZE,
                 1e-13, 1e-6, 100, expected);
     }
 
     @Test
     public void testTablet() {
-        double[] startPoint = point(DIM,1.0); 
+        double[] startPoint = point(DIM,1.0);
         double[][] boundaries = null;
         PointValuePair expected =
             new PointValuePair(point(DIM,0.0),0.0);
         doTest(new Tablet(), startPoint, boundaries,
-                GoalType.MINIMIZE, 
+                GoalType.MINIMIZE,
                 1e-13, 1e-6, 100, expected);
     }
 
@@ -187,7 +187,7 @@ public class BOBYQAOptimizerTest {
         PointValuePair expected =
             new PointValuePair(point(DIM/2,0.0),0.0);
         doTest(new DiffPow(), startPoint, boundaries,
-                GoalType.MINIMIZE, 
+                GoalType.MINIMIZE,
                 1e-8, 1e-1, 21000, expected);
     }
 
@@ -198,7 +198,7 @@ public class BOBYQAOptimizerTest {
         PointValuePair expected =
             new PointValuePair(point(DIM/2,0.0),0.0);
         doTest(new SsDiffPow(), startPoint, boundaries,
-                GoalType.MINIMIZE, 
+                GoalType.MINIMIZE,
                 1e-2, 1.3e-1, 50000, expected);
     }
 
@@ -221,7 +221,7 @@ public class BOBYQAOptimizerTest {
         PointValuePair expected =
             new PointValuePair(point(DIM,0.0),0.0);
         doTest(new Rastrigin(), startPoint, boundaries,
-                GoalType.MINIMIZE, 
+                GoalType.MINIMIZE,
                 1e-13, 1e-6, 1000, expected);
     }
 
@@ -333,7 +333,7 @@ public class BOBYQAOptimizerTest {
                            new InitialGuess(startPoint),
                            new SimpleBounds(boundaries[0],
                                             boundaries[1]));
-//        System.out.println(func.getClass().getName() + " = " 
+//        System.out.println(func.getClass().getName() + " = "
 //              + optim.getEvaluations() + " f(");
 //        for (double x: result.getPoint())  System.out.print(x + " ");
 //        System.out.println(") = " +  result.getValue());

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optim/nonlinear/scalar/noderiv/CMAESOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optim/nonlinear/scalar/noderiv/CMAESOptimizerTest.java b/src/test/java/org/apache/commons/math3/optim/nonlinear/scalar/noderiv/CMAESOptimizerTest.java
index aade822..85f8565 100644
--- a/src/test/java/org/apache/commons/math3/optim/nonlinear/scalar/noderiv/CMAESOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math3/optim/nonlinear/scalar/noderiv/CMAESOptimizerTest.java
@@ -70,7 +70,7 @@ public class CMAESOptimizerTest {
                 GoalType.MINIMIZE, LAMBDA, true, 0, 1e-13,
                 1e-13, 1e-6, 100000, expected);
     }
-    
+
     @Test(expected = DimensionMismatchException.class)
     public void testBoundariesDimensionMismatch() {
         double[] startPoint = point(DIM,0.5);
@@ -118,7 +118,7 @@ public class CMAESOptimizerTest {
                 GoalType.MINIMIZE, LAMBDA, true, 0, 1e-13,
                 1e-13, 1e-6, 100000, expected);
     }
-    
+
     @Test
     @Retry(3)
     public void testRosen() {
@@ -149,7 +149,7 @@ public class CMAESOptimizerTest {
         doTest(new MinusElli(), startPoint, insigma, boundaries,
                 GoalType.MAXIMIZE, LAMBDA, false, 0, 1.0-1e-13,
                 2e-10, 5e-6, 100000, expected);
-        boundaries = boundaries(DIM,-0.3,0.3); 
+        boundaries = boundaries(DIM,-0.3,0.3);
         startPoint = point(DIM,0.1);
         doTest(new MinusElli(), startPoint, insigma, boundaries,
                 GoalType.MAXIMIZE, LAMBDA, true, 0, 1.0-1e-13,
@@ -408,7 +408,7 @@ public class CMAESOptimizerTest {
             };
 
         final double[] start = { 1 };
- 
+
         // No bounds.
         PointValuePair result = optimizer.optimize(new MaxEval(100000),
                                                    new ObjectiveFunction(fitnessFunction),
@@ -453,7 +453,7 @@ public class CMAESOptimizerTest {
         Assert.assertEquals(resNoBound, resNearLo, 1e-3);
         Assert.assertEquals(resNoBound, resNearHi, 1e-3);
     }
- 
+
     /**
      * @param func Function to optimize.
      * @param startPoint Starting point.
@@ -476,7 +476,7 @@ public class CMAESOptimizerTest {
                         GoalType goal,
                         int lambda,
                         boolean isActive,
-                        int diagonalOnly, 
+                        int diagonalOnly,
                         double stopValue,
                         double fTol,
                         double pointTol,

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerAbstractTest.java b/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerAbstractTest.java
index 7a9c9eb..bc523ce 100644
--- a/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerAbstractTest.java
+++ b/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerAbstractTest.java
@@ -294,7 +294,7 @@ public abstract class AbstractLeastSquaresOptimizerAbstractTest {
             optimizer.optimize(new MaxEval(100),
                                problem2.getModelFunction(),
                                problem2.getModelFunctionJacobian(),
-                               problem2.getTarget(), 
+                               problem2.getTarget(),
                                new Weight(new double[] { 1, 1, 1, 1 }),
                                new InitialGuess(new double[] { 0, 1, 2, 3 }));
         Assert.assertEquals(0, optimizer.getRMS(), 1e-10);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/CircleProblem.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/CircleProblem.java b/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/CircleProblem.java
index fe2c3bc..61834b1 100644
--- a/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/CircleProblem.java
+++ b/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/CircleProblem.java
@@ -162,7 +162,7 @@ class CircleProblem {
 
         for (int i = 0; i < points.size(); i++) {
             final int index = i * 2;
-            // Partial derivative wrt x-coordinate of center. 
+            // Partial derivative wrt x-coordinate of center.
             jacobian[index][0] = 1;
             jacobian[index + 1][0] = 0;
             // Partial derivative wrt y-coordinate of center.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/MinpackTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/MinpackTest.java b/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/MinpackTest.java
index 898dbdd..53d7880 100644
--- a/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/MinpackTest.java
+++ b/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/MinpackTest.java
@@ -1368,7 +1368,7 @@ public class MinpackTest {
             }
             return f;
         }
-        
+
         private static final double[] y = {
             0.844, 0.908, 0.932, 0.936, 0.925, 0.908, 0.881, 0.850, 0.818, 0.784, 0.751,
             0.718, 0.685, 0.658, 0.628, 0.603, 0.580, 0.558, 0.538, 0.522, 0.506, 0.490,

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optim/univariate/BrentOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optim/univariate/BrentOptimizerTest.java b/src/test/java/org/apache/commons/math3/optim/univariate/BrentOptimizerTest.java
index 575eb5c..f558fc0 100644
--- a/src/test/java/org/apache/commons/math3/optim/univariate/BrentOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math3/optim/univariate/BrentOptimizerTest.java
@@ -83,7 +83,7 @@ public final class BrentOptimizerTest {
     public void testBoundaries() {
         final double lower = -1.0;
         final double upper = +1.0;
-        UnivariateFunction f = new UnivariateFunction() {            
+        UnivariateFunction f = new UnivariateFunction() {
             public double value(double x) {
                 if (x < lower) {
                     throw new NumberIsTooSmallException(x, lower, true);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optim/univariate/MultiStartUnivariateOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optim/univariate/MultiStartUnivariateOptimizerTest.java b/src/test/java/org/apache/commons/math3/optim/univariate/MultiStartUnivariateOptimizerTest.java
index d979c72..dde425f 100644
--- a/src/test/java/org/apache/commons/math3/optim/univariate/MultiStartUnivariateOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math3/optim/univariate/MultiStartUnivariateOptimizerTest.java
@@ -111,7 +111,7 @@ public class MultiStartUnivariateOptimizerTest {
         JDKRandomGenerator g = new JDKRandomGenerator();
         g.setSeed(4312000053L);
         MultiStartUnivariateOptimizer optimizer = new MultiStartUnivariateOptimizer(underlying, 5, g);
- 
+
         try {
             optimizer.optimize(new MaxEval(300),
                                new UnivariateObjectiveFunction(f),

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optim/univariate/SimpleUnivariateValueCheckerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optim/univariate/SimpleUnivariateValueCheckerTest.java b/src/test/java/org/apache/commons/math3/optim/univariate/SimpleUnivariateValueCheckerTest.java
index e7b7904..d2bd42d 100644
--- a/src/test/java/org/apache/commons/math3/optim/univariate/SimpleUnivariateValueCheckerTest.java
+++ b/src/test/java/org/apache/commons/math3/optim/univariate/SimpleUnivariateValueCheckerTest.java
@@ -30,7 +30,7 @@ public class SimpleUnivariateValueCheckerTest {
     public void testIterationCheck() {
         final int max = 10;
         final SimpleUnivariateValueChecker checker = new SimpleUnivariateValueChecker(1e-1, 1e-2, max);
-        Assert.assertTrue(checker.converged(max, null, null)); 
+        Assert.assertTrue(checker.converged(max, null, null));
         Assert.assertTrue(checker.converged(max + 1, null, null));
     }
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optimization/SimplePointCheckerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optimization/SimplePointCheckerTest.java b/src/test/java/org/apache/commons/math3/optimization/SimplePointCheckerTest.java
index 5595b11..484c4f5 100644
--- a/src/test/java/org/apache/commons/math3/optimization/SimplePointCheckerTest.java
+++ b/src/test/java/org/apache/commons/math3/optimization/SimplePointCheckerTest.java
@@ -32,7 +32,7 @@ public class SimplePointCheckerTest {
         final int max = 10;
         final SimplePointChecker<PointValuePair> checker
             = new SimplePointChecker<PointValuePair>(1e-1, 1e-2, max);
-        Assert.assertTrue(checker.converged(max, null, null)); 
+        Assert.assertTrue(checker.converged(max, null, null));
         Assert.assertTrue(checker.converged(max + 1, null, null));
     }
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optimization/SimpleValueCheckerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optimization/SimpleValueCheckerTest.java b/src/test/java/org/apache/commons/math3/optimization/SimpleValueCheckerTest.java
index baf865f..2cb388e 100644
--- a/src/test/java/org/apache/commons/math3/optimization/SimpleValueCheckerTest.java
+++ b/src/test/java/org/apache/commons/math3/optimization/SimpleValueCheckerTest.java
@@ -31,7 +31,7 @@ public class SimpleValueCheckerTest {
     public void testIterationCheck() {
         final int max = 10;
         final SimpleValueChecker checker = new SimpleValueChecker(1e-1, 1e-2, max);
-        Assert.assertTrue(checker.converged(max, null, null)); 
+        Assert.assertTrue(checker.converged(max, null, null));
         Assert.assertTrue(checker.converged(max + 1, null, null));
     }
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optimization/direct/BOBYQAOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optimization/direct/BOBYQAOptimizerTest.java b/src/test/java/org/apache/commons/math3/optimization/direct/BOBYQAOptimizerTest.java
index f89da18..a871d85 100644
--- a/src/test/java/org/apache/commons/math3/optimization/direct/BOBYQAOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math3/optimization/direct/BOBYQAOptimizerTest.java
@@ -40,22 +40,22 @@ import org.junit.Test;
 public class BOBYQAOptimizerTest {
 
     static final int DIM = 13;
-   
+
     @Test(expected=NumberIsTooLargeException.class)
     public void testInitOutOfBounds() {
         double[] startPoint = point(DIM, 3);
         double[][] boundaries = boundaries(DIM, -1, 2);
         doTest(new Rosen(), startPoint, boundaries,
-                GoalType.MINIMIZE, 
+                GoalType.MINIMIZE,
                 1e-13, 1e-6, 2000, null);
     }
-    
+
     @Test(expected=DimensionMismatchException.class)
     public void testBoundariesDimensionMismatch() {
         double[] startPoint = point(DIM, 0.5);
         double[][] boundaries = boundaries(DIM + 1, -1, 2);
         doTest(new Rosen(), startPoint, boundaries,
-               GoalType.MINIMIZE, 
+               GoalType.MINIMIZE,
                1e-13, 1e-6, 2000, null);
     }
 
@@ -73,7 +73,7 @@ public class BOBYQAOptimizerTest {
         double[] startPoint = point(DIM, 0.1);
         double[][] boundaries = null;
         doTest(new Rosen(), startPoint, boundaries,
-               GoalType.MINIMIZE, 
+               GoalType.MINIMIZE,
                1e-13, 1e-6, lowMaxEval, null);
      }
 
@@ -83,7 +83,7 @@ public class BOBYQAOptimizerTest {
         double[][] boundaries = null;
         PointValuePair expected = new PointValuePair(point(DIM,1.0),0.0);
         doTest(new Rosen(), startPoint, boundaries,
-                GoalType.MINIMIZE, 
+                GoalType.MINIMIZE,
                 1e-13, 1e-6, 2000, expected);
      }
 
@@ -93,12 +93,12 @@ public class BOBYQAOptimizerTest {
         double[][] boundaries = null;
         PointValuePair expected = new PointValuePair(point(DIM,0.0),1.0);
         doTest(new MinusElli(), startPoint, boundaries,
-                GoalType.MAXIMIZE, 
+                GoalType.MAXIMIZE,
                 2e-10, 5e-6, 1000, expected);
-        boundaries = boundaries(DIM,-0.3,0.3); 
+        boundaries = boundaries(DIM,-0.3,0.3);
         startPoint = point(DIM,0.1);
         doTest(new MinusElli(), startPoint, boundaries,
-                GoalType.MAXIMIZE, 
+                GoalType.MAXIMIZE,
                 2e-10, 5e-6, 1000, expected);
     }
 
@@ -109,7 +109,7 @@ public class BOBYQAOptimizerTest {
         PointValuePair expected =
             new PointValuePair(point(DIM,0.0),0.0);
         doTest(new Elli(), startPoint, boundaries,
-                GoalType.MINIMIZE, 
+                GoalType.MINIMIZE,
                 1e-13, 1e-6, 1000, expected);
      }
 
@@ -120,7 +120,7 @@ public class BOBYQAOptimizerTest {
         PointValuePair expected =
             new PointValuePair(point(DIM,0.0),0.0);
         doTest(new ElliRotated(), startPoint, boundaries,
-                GoalType.MINIMIZE, 
+                GoalType.MINIMIZE,
                 1e-12, 1e-6, 10000, expected);
     }
 
@@ -131,7 +131,7 @@ public class BOBYQAOptimizerTest {
         PointValuePair expected =
             new PointValuePair(point(DIM,0.0),0.0);
         doTest(new Cigar(), startPoint, boundaries,
-                GoalType.MINIMIZE, 
+                GoalType.MINIMIZE,
                 1e-13, 1e-6, 100, expected);
     }
 
@@ -153,7 +153,7 @@ public class BOBYQAOptimizerTest {
         PointValuePair expected =
             new PointValuePair(point(DIM,0.0),0.0);
         doTest(new CigTab(), startPoint, boundaries,
-                GoalType.MINIMIZE, 
+                GoalType.MINIMIZE,
                 1e-13, 5e-5, 100, expected);
      }
 
@@ -164,18 +164,18 @@ public class BOBYQAOptimizerTest {
         PointValuePair expected =
             new PointValuePair(point(DIM,0.0),0.0);
         doTest(new Sphere(), startPoint, boundaries,
-                GoalType.MINIMIZE, 
+                GoalType.MINIMIZE,
                 1e-13, 1e-6, 100, expected);
     }
 
     @Test
     public void testTablet() {
-        double[] startPoint = point(DIM,1.0); 
+        double[] startPoint = point(DIM,1.0);
         double[][] boundaries = null;
         PointValuePair expected =
             new PointValuePair(point(DIM,0.0),0.0);
         doTest(new Tablet(), startPoint, boundaries,
-                GoalType.MINIMIZE, 
+                GoalType.MINIMIZE,
                 1e-13, 1e-6, 100, expected);
     }
 
@@ -186,7 +186,7 @@ public class BOBYQAOptimizerTest {
         PointValuePair expected =
             new PointValuePair(point(DIM/2,0.0),0.0);
         doTest(new DiffPow(), startPoint, boundaries,
-                GoalType.MINIMIZE, 
+                GoalType.MINIMIZE,
                 1e-8, 1e-1, 21000, expected);
     }
 
@@ -197,7 +197,7 @@ public class BOBYQAOptimizerTest {
         PointValuePair expected =
             new PointValuePair(point(DIM/2,0.0),0.0);
         doTest(new SsDiffPow(), startPoint, boundaries,
-                GoalType.MINIMIZE, 
+                GoalType.MINIMIZE,
                 1e-2, 1.3e-1, 50000, expected);
     }
 
@@ -220,7 +220,7 @@ public class BOBYQAOptimizerTest {
         PointValuePair expected =
             new PointValuePair(point(DIM,0.0),0.0);
         doTest(new Rastrigin(), startPoint, boundaries,
-                GoalType.MINIMIZE, 
+                GoalType.MINIMIZE,
                 1e-13, 1e-6, 1000, expected);
     }
 
@@ -331,7 +331,7 @@ public class BOBYQAOptimizerTest {
             optim.optimize(maxEvaluations, func, goal,
                            new InitialGuess(startPoint),
                            new SimpleBounds(lB, uB));
-//        System.out.println(func.getClass().getName() + " = " 
+//        System.out.println(func.getClass().getName() + " = "
 //              + optim.getEvaluations() + " f(");
 //        for (double x: result.getPoint())  System.out.print(x + " ");
 //        System.out.println(") = " +  result.getValue());

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optimization/direct/CMAESOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optimization/direct/CMAESOptimizerTest.java b/src/test/java/org/apache/commons/math3/optimization/direct/CMAESOptimizerTest.java
index 29c3eec..2826d31 100644
--- a/src/test/java/org/apache/commons/math3/optimization/direct/CMAESOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math3/optimization/direct/CMAESOptimizerTest.java
@@ -46,7 +46,7 @@ public class CMAESOptimizerTest {
 
     static final int DIM = 13;
     static final int LAMBDA = 4 + (int)(3.*FastMath.log(DIM));
-   
+
     @Test(expected = NumberIsTooLargeException.class)
     public void testInitOutofbounds1() {
         double[] startPoint = point(DIM,3);
@@ -69,7 +69,7 @@ public class CMAESOptimizerTest {
                 GoalType.MINIMIZE, LAMBDA, true, 0, 1e-13,
                 1e-13, 1e-6, 100000, expected);
     }
-    
+
     @Test(expected = DimensionMismatchException.class)
     public void testBoundariesDimensionMismatch() {
         double[] startPoint = point(DIM,0.5);
@@ -117,7 +117,7 @@ public class CMAESOptimizerTest {
                 GoalType.MINIMIZE, LAMBDA, true, 0, 1e-13,
                 1e-13, 1e-6, 100000, expected);
     }
-    
+
     @Test
     @Retry(3)
     public void testRosen() {
@@ -148,7 +148,7 @@ public class CMAESOptimizerTest {
         doTest(new MinusElli(), startPoint, insigma, boundaries,
                 GoalType.MAXIMIZE, LAMBDA, false, 0, 1.0-1e-13,
                 2e-10, 5e-6, 100000, expected);
-        boundaries = boundaries(DIM,-0.3,0.3); 
+        boundaries = boundaries(DIM,-0.3,0.3);
         startPoint = point(DIM,0.1);
         doTest(new MinusElli(), startPoint, insigma, boundaries,
                 GoalType.MAXIMIZE, LAMBDA, true, 0, 1.0-1e-13,
@@ -397,7 +397,7 @@ public class CMAESOptimizerTest {
             };
 
         final double[] start = { 1 };
- 
+
         // No bounds.
         PointValuePair result = optimizer.optimize(100000, fitnessFunction, GoalType.MINIMIZE,
                                                    start);
@@ -426,7 +426,7 @@ public class CMAESOptimizerTest {
         Assert.assertEquals(resNoBound, resNearLo, 1e-3);
         Assert.assertEquals(resNoBound, resNearHi, 1e-3);
     }
- 
+
     /**
      * @param func Function to optimize.
      * @param startPoint Starting point.
@@ -449,7 +449,7 @@ public class CMAESOptimizerTest {
             GoalType goal,
             int lambda,
             boolean isActive,
-            int diagonalOnly, 
+            int diagonalOnly,
             double stopValue,
             double fTol,
             double pointTol,

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optimization/fitting/GaussianFitterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optimization/fitting/GaussianFitterTest.java b/src/test/java/org/apache/commons/math3/optimization/fitting/GaussianFitterTest.java
index ddccdb2..af8acd4 100644
--- a/src/test/java/org/apache/commons/math3/optimization/fitting/GaussianFitterTest.java
+++ b/src/test/java/org/apache/commons/math3/optimization/fitting/GaussianFitterTest.java
@@ -200,7 +200,7 @@ public class GaussianFitterTest {
         GaussianFitter fitter = new GaussianFitter(new LevenbergMarquardtOptimizer());
         fitter.fit();
     }
-    
+
     /**
      * Two points is not enough observed points.
      */
@@ -213,7 +213,7 @@ public class GaussianFitterTest {
             fitter);
         fitter.fit();
     }
-    
+
     /**
      * Poor data: right of peak not symmetric with left of peak.
      */
@@ -226,8 +226,8 @@ public class GaussianFitterTest {
         Assert.assertEquals(233003.2967252038, parameters[0], 1e-4);
         Assert.assertEquals(-10.654887521095983, parameters[1], 1e-4);
         Assert.assertEquals(4.335937353196641, parameters[2], 1e-4);
-    }  
-    
+    }
+
     /**
      * Poor data: long tails.
      */
@@ -241,7 +241,7 @@ public class GaussianFitterTest {
         Assert.assertEquals(-13.29641995105174, parameters[1], 1e-4);
         Assert.assertEquals(1.7297330293549908, parameters[2], 1e-4);
     }
-    
+
     /**
      * Poor data: right of peak is missing.
      */
@@ -254,7 +254,7 @@ public class GaussianFitterTest {
         Assert.assertEquals(285250.66754309234, parameters[0], 1e-4);
         Assert.assertEquals(-13.528375695228455, parameters[1], 1e-4);
         Assert.assertEquals(1.5204344894331614, parameters[2], 1e-4);
-    }    
+    }
 
     /**
      * Basic with smaller dataset.
@@ -275,7 +275,7 @@ public class GaussianFitterTest {
         // The optimizer will try negative sigma values but "GaussianFitter"
         // will catch the raised exceptions and return NaN values instead.
 
-        final double[] data = { 
+        final double[] data = {
             1.1143831578403364E-29,
             4.95281403484594E-28,
             1.1171347211930288E-26,
@@ -343,7 +343,7 @@ public class GaussianFitterTest {
         Assert.assertEquals(0.603770729862231, p[1], 1e-15);
         Assert.assertEquals(1.0786447936766612, p[2], 1e-14);
     }
-    
+
     /**
      * Adds the specified points to specified <code>GaussianFitter</code>
      * instance.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optimization/general/AbstractLeastSquaresOptimizerAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optimization/general/AbstractLeastSquaresOptimizerAbstractTest.java b/src/test/java/org/apache/commons/math3/optimization/general/AbstractLeastSquaresOptimizerAbstractTest.java
index 4dbe17d..de80e44 100644
--- a/src/test/java/org/apache/commons/math3/optimization/general/AbstractLeastSquaresOptimizerAbstractTest.java
+++ b/src/test/java/org/apache/commons/math3/optimization/general/AbstractLeastSquaresOptimizerAbstractTest.java
@@ -514,7 +514,7 @@ public abstract class AbstractLeastSquaresOptimizerAbstractTest {
                 for (int j = 0; j < factors.getColumnDimension(); ++j) {
                     value[i] = value[i].add(variables[j].multiply(factors.getEntry(i, j)));
                 }
-                
+
             }
             return value;
         }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optimization/general/NonLinearConjugateGradientOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optimization/general/NonLinearConjugateGradientOptimizerTest.java b/src/test/java/org/apache/commons/math3/optimization/general/NonLinearConjugateGradientOptimizerTest.java
index 26091a4..f606b28 100644
--- a/src/test/java/org/apache/commons/math3/optimization/general/NonLinearConjugateGradientOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math3/optimization/general/NonLinearConjugateGradientOptimizerTest.java
@@ -194,7 +194,7 @@ public class NonLinearConjugateGradientOptimizerTest {
                                                     new SimpleValueChecker(1e-13, 1e-13),
                                                     new BrentSolver(),
                                                     preconditioner);
-                                                    
+
         PointValuePair optimum =
             optimizer.optimize(100, problem, GoalType.MINIMIZE, new double[] { 0, 0, 0, 0, 0, 0 });
         Assert.assertEquals( 3.0, optimum.getPoint()[0], 1.0e-10);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optimization/linear/SimplexSolverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optimization/linear/SimplexSolverTest.java b/src/test/java/org/apache/commons/math3/optimization/linear/SimplexSolverTest.java
index 110992a..3e5f188 100644
--- a/src/test/java/org/apache/commons/math3/optimization/linear/SimplexSolverTest.java
+++ b/src/test/java/org/apache/commons/math3/optimization/linear/SimplexSolverTest.java
@@ -35,7 +35,7 @@ public class SimplexSolverTest {
     public void testMath828() {
         LinearObjectiveFunction f = new LinearObjectiveFunction(
                 new double[] { 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 0.0);
-        
+
         ArrayList <LinearConstraint>constraints = new ArrayList<LinearConstraint>();
 
         constraints.add(new LinearConstraint(new double[] {0.0, 39.0, 23.0, 96.0, 15.0, 48.0, 9.0, 21.0, 48.0, 36.0, 76.0, 19.0, 88.0, 17.0, 16.0, 36.0,}, Relationship.GEQ, 15.0));
@@ -45,7 +45,7 @@ public class SimplexSolverTest {
         constraints.add(new LinearConstraint(new double[] {25.0, -7.0, -99.0, -78.0, -25.0, -14.0, -16.0, -89.0, -39.0, -56.0, -53.0, -9.0, -18.0, -26.0, -11.0, -61.0,}, Relationship.GEQ, 0.0));
         constraints.add(new LinearConstraint(new double[] {33.0, -95.0, -15.0, -4.0, -33.0, -3.0, -20.0, -96.0, -27.0, -13.0, -80.0, -24.0, -3.0, -13.0, -57.0, -76.0,}, Relationship.GEQ, 0.0));
         constraints.add(new LinearConstraint(new double[] {7.0, -95.0, -39.0, -93.0, -7.0, -94.0, -94.0, -62.0, -76.0, -26.0, -53.0, -57.0, -31.0, -76.0, -53.0, -52.0,}, Relationship.GEQ, 0.0));
-        
+
         double epsilon = 1e-6;
         PointValuePair solution = new SimplexSolver().optimize(f, constraints, GoalType.MINIMIZE, true);
         Assert.assertEquals(1.0d, solution.getValue(), epsilon);
@@ -56,7 +56,7 @@ public class SimplexSolverTest {
     public void testMath828Cycle() {
         LinearObjectiveFunction f = new LinearObjectiveFunction(
                 new double[] { 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 0.0);
-        
+
         ArrayList <LinearConstraint>constraints = new ArrayList<LinearConstraint>();
 
         constraints.add(new LinearConstraint(new double[] {0.0, 16.0, 14.0, 69.0, 1.0, 85.0, 52.0, 43.0, 64.0, 97.0, 14.0, 74.0, 89.0, 28.0, 94.0, 58.0, 13.0, 22.0, 21.0, 17.0, 30.0, 25.0, 1.0, 59.0, 91.0, 78.0, 12.0, 74.0, 56.0, 3.0, 88.0,}, Relationship.GEQ, 91.0));
@@ -66,11 +66,11 @@ public class SimplexSolverTest {
         constraints.add(new LinearConstraint(new double[] {41.0, -96.0, -41.0, -48.0, -70.0, -43.0, -43.0, -43.0, -97.0, -37.0, -85.0, -70.0, -45.0, -67.0, -87.0, -69.0, -94.0, -54.0, -54.0, -92.0, -79.0, -10.0, -35.0, -20.0, -41.0, -41.0, -65.0, -25.0, -12.0, -8.0, -46.0,}, Relationship.GEQ, 0.0));
         constraints.add(new LinearConstraint(new double[] {27.0, -42.0, -65.0, -49.0, -53.0, -42.0, -17.0, -2.0, -61.0, -31.0, -76.0, -47.0, -8.0, -93.0, -86.0, -62.0, -65.0, -63.0, -22.0, -43.0, -27.0, -23.0, -32.0, -74.0, -27.0, -63.0, -47.0, -78.0, -29.0, -95.0, -73.0,}, Relationship.GEQ, 0.0));
         constraints.add(new LinearConstraint(new double[] {15.0, -46.0, -41.0, -83.0, -98.0, -99.0, -21.0, -35.0, -7.0, -14.0, -80.0, -63.0, -18.0, -42.0, -5.0, -34.0, -56.0, -70.0, -16.0, -18.0, -74.0, -61.0, -47.0, -41.0, -15.0, -79.0, -18.0, -47.0, -88.0, -68.0, -55.0,}, Relationship.GEQ, 0.0));
-        
+
         double epsilon = 1e-6;
         PointValuePair solution = new SimplexSolver().optimize(f, constraints, GoalType.MINIMIZE, true);
         Assert.assertEquals(1.0d, solution.getValue(), epsilon);
-        Assert.assertTrue(validSolution(solution, constraints, epsilon));        
+        Assert.assertTrue(validSolution(solution, constraints, epsilon));
     }
 
     @Test
@@ -148,7 +148,7 @@ public class SimplexSolverTest {
 
         SimplexSolver solver = new SimplexSolver();
         PointValuePair solution = solver.optimize(f, constraints, GoalType.MINIMIZE, false);
-        
+
         Assert.assertTrue(Precision.compareTo(solution.getPoint()[0] * 200.d, 1.d, epsilon) >= 0);
         Assert.assertEquals(0.0050, solution.getValue(), epsilon);
     }
@@ -171,13 +171,13 @@ public class SimplexSolverTest {
         double epsilon = 1e-7;
         SimplexSolver simplex = new SimplexSolver();
         PointValuePair solution = simplex.optimize(f, constraints, GoalType.MINIMIZE, false);
-        
+
         Assert.assertTrue(Precision.compareTo(solution.getPoint()[0], -1e-18d, epsilon) >= 0);
-        Assert.assertEquals(1.0d, solution.getPoint()[1], epsilon);        
+        Assert.assertEquals(1.0d, solution.getPoint()[1], epsilon);
         Assert.assertEquals(0.0d, solution.getPoint()[2], epsilon);
         Assert.assertEquals(1.0d, solution.getValue(), epsilon);
     }
-    
+
     @Test
     public void testMath272() {
         LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 2, 2, 1 }, 0);
@@ -612,20 +612,20 @@ public class SimplexSolverTest {
             for (int i = 0; i < vals.length; i++) {
                 result += vals[i] * coeffs[i];
             }
-            
+
             switch (c.getRelationship()) {
             case EQ:
                 if (!Precision.equals(result, c.getValue(), epsilon)) {
                     return false;
                 }
                 break;
-                
+
             case GEQ:
                 if (Precision.compareTo(result, c.getValue(), epsilon) < 0) {
                     return false;
                 }
                 break;
-                
+
             case LEQ:
                 if (Precision.compareTo(result, c.getValue(), epsilon) > 0) {
                     return false;
@@ -633,7 +633,7 @@ public class SimplexSolverTest {
                 break;
             }
         }
-        
+
         return true;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optimization/univariate/BrentOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optimization/univariate/BrentOptimizerTest.java b/src/test/java/org/apache/commons/math3/optimization/univariate/BrentOptimizerTest.java
index 34ee8c7..73054db 100644
--- a/src/test/java/org/apache/commons/math3/optimization/univariate/BrentOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math3/optimization/univariate/BrentOptimizerTest.java
@@ -71,7 +71,7 @@ public final class BrentOptimizerTest {
     public void testBoundaries() {
         final double lower = -1.0;
         final double upper = +1.0;
-        UnivariateFunction f = new UnivariateFunction() {            
+        UnivariateFunction f = new UnivariateFunction() {
             public double value(double x) {
                 if (x < lower) {
                     throw new NumberIsTooSmallException(x, lower, true);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optimization/univariate/SimpleUnivariateValueCheckerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optimization/univariate/SimpleUnivariateValueCheckerTest.java b/src/test/java/org/apache/commons/math3/optimization/univariate/SimpleUnivariateValueCheckerTest.java
index 8ad9f66..5964ecc 100644
--- a/src/test/java/org/apache/commons/math3/optimization/univariate/SimpleUnivariateValueCheckerTest.java
+++ b/src/test/java/org/apache/commons/math3/optimization/univariate/SimpleUnivariateValueCheckerTest.java
@@ -31,7 +31,7 @@ public class SimpleUnivariateValueCheckerTest {
     public void testIterationCheck() {
         final int max = 10;
         final SimpleUnivariateValueChecker checker = new SimpleUnivariateValueChecker(1e-1, 1e-2, max);
-        Assert.assertTrue(checker.converged(max, null, null)); 
+        Assert.assertTrue(checker.converged(max, null, null));
         Assert.assertTrue(checker.converged(max + 1, null, null));
     }
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optimization/univariate/UnivariateMultiStartOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optimization/univariate/UnivariateMultiStartOptimizerTest.java b/src/test/java/org/apache/commons/math3/optimization/univariate/UnivariateMultiStartOptimizerTest.java
index 18fbdab..55929a0 100644
--- a/src/test/java/org/apache/commons/math3/optimization/univariate/UnivariateMultiStartOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math3/optimization/univariate/UnivariateMultiStartOptimizerTest.java
@@ -88,7 +88,7 @@ public class UnivariateMultiStartOptimizerTest {
         g.setSeed(4312000053L);
         UnivariateMultiStartOptimizer<UnivariateFunction> optimizer =
             new UnivariateMultiStartOptimizer<UnivariateFunction>(underlying, 5, g);
- 
+
         try {
             optimizer.optimize(300, f, GoalType.MINIMIZE, -0.3, -0.2);
             Assert.fail();

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/primes/PrimesTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/primes/PrimesTest.java b/src/test/java/org/apache/commons/math3/primes/PrimesTest.java
index 19eef5d..ccc4bf9 100644
--- a/src/test/java/org/apache/commons/math3/primes/PrimesTest.java
+++ b/src/test/java/org/apache/commons/math3/primes/PrimesTest.java
@@ -169,4 +169,4 @@ public class PrimesTest {
             Assert.assertEquals(1, factors.size());
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/AbstractRandomGeneratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/AbstractRandomGeneratorTest.java b/src/test/java/org/apache/commons/math3/random/AbstractRandomGeneratorTest.java
index 1f3d2b0..7fd2ac9 100644
--- a/src/test/java/org/apache/commons/math3/random/AbstractRandomGeneratorTest.java
+++ b/src/test/java/org/apache/commons/math3/random/AbstractRandomGeneratorTest.java
@@ -26,12 +26,12 @@ public class AbstractRandomGeneratorTest extends RandomGeneratorAbstractTest {
     public AbstractRandomGeneratorTest() {
         super();
     }
-    
+
     @Override
     protected RandomGenerator makeGenerator() {
         RandomGenerator generator = new TestRandomGenerator();
         generator.setSeed(1001);
         return generator;
     }
-    
+
 }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/BitsStreamGeneratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/BitsStreamGeneratorTest.java b/src/test/java/org/apache/commons/math3/random/BitsStreamGeneratorTest.java
index da4bc94..6bb0f59 100644
--- a/src/test/java/org/apache/commons/math3/random/BitsStreamGeneratorTest.java
+++ b/src/test/java/org/apache/commons/math3/random/BitsStreamGeneratorTest.java
@@ -28,14 +28,14 @@ public class BitsStreamGeneratorTest extends RandomGeneratorAbstractTest {
     public BitsStreamGeneratorTest() {
         super();
     }
-    
+
     @Override
     protected RandomGenerator makeGenerator() {
         RandomGenerator generator = new TestBitStreamGenerator();
         generator.setSeed(1000);
         return generator;
     }
-    
+
     /**
      * Test BitStreamGenerator using a Random as bit source.
      */
@@ -43,7 +43,7 @@ public class BitsStreamGeneratorTest extends RandomGeneratorAbstractTest {
 
         private static final long serialVersionUID = 1L;
         private BitRandom ran = new BitRandom();
-        
+
         @Override
         public void setSeed(int seed) {
            ran.setSeed(seed);
@@ -58,15 +58,15 @@ public class BitsStreamGeneratorTest extends RandomGeneratorAbstractTest {
         @Override
         public void setSeed(long seed) {
             ran.setSeed((int) seed);
-            
+
         }
-        
+
         @Override
         protected int next(int bits) {
             return ran.nextBits(bits);
-        }  
+        }
     }
-    
+
     /**
      * Extend Random to expose next(bits)
      */
@@ -79,5 +79,5 @@ public class BitsStreamGeneratorTest extends RandomGeneratorAbstractTest {
             return next(bits);
         }
     }
-    
+
 }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/CorrelatedRandomVectorGeneratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/CorrelatedRandomVectorGeneratorTest.java b/src/test/java/org/apache/commons/math3/random/CorrelatedRandomVectorGeneratorTest.java
index f4d5882..3a3fa60 100644
--- a/src/test/java/org/apache/commons/math3/random/CorrelatedRandomVectorGeneratorTest.java
+++ b/src/test/java/org/apache/commons/math3/random/CorrelatedRandomVectorGeneratorTest.java
@@ -147,7 +147,7 @@ public class CorrelatedRandomVectorGeneratorTest {
                 {0.009881156, 0.008196856, 0.019023866, 0.009210099},
                 {0.010499559, 0.010732709, 0.009210099, 0.019107243}
         };
-        
+
         final double[][] covMatrix2 = new double[][]{
                 {0.0, 0.0, 0.0, 0.0, 0.0},
                 {0.0, 0.013445532, 0.010394690, 0.009881156, 0.010499559},
@@ -155,7 +155,7 @@ public class CorrelatedRandomVectorGeneratorTest {
                 {0.0, 0.009881156, 0.008196856, 0.019023866, 0.009210099},
                 {0.0, 0.010499559, 0.010732709, 0.009210099, 0.019107243}
         };
-        
+
         final double[][] covMatrix3 = new double[][]{
                 {0.013445532, 0.010394690, 0.0, 0.009881156, 0.010499559},
                 {0.010394690, 0.023006616, 0.0, 0.008196856, 0.010732709},
@@ -163,7 +163,7 @@ public class CorrelatedRandomVectorGeneratorTest {
                 {0.009881156, 0.008196856, 0.0, 0.019023866, 0.009210099},
                 {0.010499559, 0.010732709, 0.0, 0.009210099, 0.019107243}
         };
-        
+
         testSampler(covMatrix1, 10000, 0.001);
         testSampler(covMatrix2, 10000, 0.001);
         testSampler(covMatrix3, 10000, 0.001);
@@ -182,7 +182,7 @@ public class CorrelatedRandomVectorGeneratorTest {
 
     private void testSampler(final double[][] covMatrix, int samples, double epsilon) {
         CorrelatedRandomVectorGenerator sampler = createSampler(covMatrix);
-        
+
         StorelessCovariance cov = new StorelessCovariance(covMatrix.length);
         for (int i = 0; i < samples; ++i) {
             cov.increment(sampler.nextVector());

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/EmpiricalDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/EmpiricalDistributionTest.java b/src/test/java/org/apache/commons/math3/random/EmpiricalDistributionTest.java
index 71763e1..c0dd2a4 100644
--- a/src/test/java/org/apache/commons/math3/random/EmpiricalDistributionTest.java
+++ b/src/test/java/org/apache/commons/math3/random/EmpiricalDistributionTest.java
@@ -103,13 +103,13 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
         // Load from a URL
         empiricalDistribution.load(url);
         checkDistribution();
-        
+
         // Load again from a file (also verifies idempotency of load)
         File file = new File(url.toURI());
         empiricalDistribution.load(file);
         checkDistribution();
     }
-    
+
     private void checkDistribution() {
         // testData File has 10000 values, with mean ~ 5.0, std dev ~ 1
         // Make sure that loaded distribution matches this
@@ -245,24 +245,24 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
         TestUtils.assertEquals(expectedBinUpperBounds, dist.getUpperBounds(), tol);
         TestUtils.assertEquals(expectedGeneratorUpperBounds, dist.getGeneratorUpperBounds(), tol);
     }
-    
+
     @Test
     public void testGeneratorConfig() {
         double[] testData = {0, 1, 2, 3, 4};
         RandomGenerator generator = new RandomAdaptorTest.ConstantGenerator(0.5);
-        
+
         EmpiricalDistribution dist = new EmpiricalDistribution(5, generator);
         dist.load(testData);
         for (int i = 0; i < 5; i++) {
             Assert.assertEquals(2.0, dist.getNextValue(), 0d);
         }
-        
+
         // Verify no NPE with null generator argument
         dist = new EmpiricalDistribution(5, (RandomGenerator) null);
         dist.load(testData);
         dist.getNextValue();
     }
-    
+
     @Test
     public void testReSeed() throws Exception {
         empiricalDistribution.load(url);
@@ -310,9 +310,9 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
         Assert.assertEquals("mean", 5.069831575018909, stats.getMean(), tolerance);
         Assert.assertEquals("std dev", 1.0173699343977738, stats.getStandardDeviation(), tolerance);
     }
-   
+
     //  Setup for distribution tests
-    
+
     @Override
     public RealDistribution makeDistribution() {
         // Create a uniform distribution on [0, 10,000]
@@ -324,10 +324,10 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
         dist.load(sourceData);
         return dist;
     }
-    
+
     /** Uniform bin mass = 10/10001 == mass of all but the first bin */
     private final double binMass = 10d / (n + 1);
-    
+
     /** Mass of first bin = 11/10001 */
     private final double firstBinMass = 11d / (n + 1);
 
@@ -336,11 +336,11 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
        final double[] testPoints = new double[] {9, 10, 15, 1000, 5004, 9999};
        return testPoints;
     }
-    
+
 
     @Override
     public double[] makeCumulativeTestValues() {
-        /* 
+        /*
          * Bins should be [0, 10], (10, 20], ..., (9990, 10000]
          * Kernels should be N(4.5, 3.02765), N(14.5, 3.02765)...
          * Each bin should have mass 10/10000 = .001
@@ -379,12 +379,12 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
             final RealDistribution kernel = findKernel(lower, upper);
             final double withinBinKernelMass = kernel.cumulativeProbability(lower, upper);
             final double density = kernel.density(testPoints[i]);
-            densityValues[i] = density * (bin == 0 ? firstBinMass : binMass) / withinBinKernelMass;   
+            densityValues[i] = density * (bin == 0 ? firstBinMass : binMass) / withinBinKernelMass;
         }
         return densityValues;
     }
-    
-    /** 
+
+    /**
      * Modify test integration bounds from the default. Because the distribution
      * has discontinuities at bin boundaries, integrals spanning multiple bins
      * will face convergence problems.  Only test within-bin integrals and spans
@@ -406,15 +406,15 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
         final double[] upper = {5, 12, 1030, 5010, 10000};
         for (int i = 1; i < 5; i++) {
             Assert.assertEquals(
-                    distribution.cumulativeProbability( 
+                    distribution.cumulativeProbability(
                             lower[i], upper[i]),
                             integrator.integrate(
                                     1000000, // Triangle integrals are very slow to converge
                                     d, lower[i], upper[i]), tol);
         }
     }
-    
-    /** 
+
+    /**
      * MATH-984
      * Verify that sampled values do not go outside of the range of the data.
      */
@@ -438,7 +438,7 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
             Assert.assertTrue(dev > 0);
         }
     }
-    
+
     /**
      * MATH-1203, MATH-1208
      */
@@ -456,8 +456,8 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
         Assert.assertEquals(1.0, dist.cumulativeProbability(1), Double.MIN_VALUE);
         Assert.assertEquals(0.5, dist.cumulativeProbability(0.5), Double.MIN_VALUE);
         Assert.assertEquals(0.5, dist.cumulativeProbability(0.7), Double.MIN_VALUE);
-    }   
-    
+    }
+
     /**
      * Find the bin that x belongs (relative to {@link #makeDistribution()}).
      */
@@ -468,7 +468,7 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
         // If x falls on a bin boundary, it is in the lower bin
         return FastMath.floor(x / 10) == x / 10 ? bin - 1 : bin;
     }
-    
+
     /**
      * Find the within-bin kernel for the bin with lower bound lower
      * and upper bound upper. All bins other than the first contain 10 points
@@ -480,10 +480,10 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
         if (lower < 1) {
             return new NormalDistribution(5d, 3.3166247903554);
         } else {
-            return new NormalDistribution((upper + lower + 1) / 2d, 3.0276503540974917); 
+            return new NormalDistribution((upper + lower + 1) / 2d, 3.0276503540974917);
         }
     }
-    
+
     @Test
     public void testKernelOverrideConstant() {
         final EmpiricalDistribution dist = new ConstantKernelEmpiricalDistribution(5);
@@ -509,7 +509,7 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
         Assert.assertEquals(8.0, dist.inverseCumulativeProbability(0.5), tol);
         Assert.assertEquals(8.0, dist.inverseCumulativeProbability(0.6), tol);
     }
-    
+
     @Test
     public void testKernelOverrideUniform() {
         final EmpiricalDistribution dist = new UniformKernelEmpiricalDistribution(5);
@@ -517,14 +517,14 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
         dist.load(data);
         // Kernels are uniform distributions on [1,3], [4,6], [7,9], [10,12], [13,15]
         final double bounds[] = {3d, 6d, 9d, 12d};
-        final double tol = 10E-12; 
+        final double tol = 10E-12;
         for (int i = 0; i < 20; i++) {
             final double v = dist.sample();
             // Make sure v is not in the excluded range between bins - that is (bounds[i], bounds[i] + 1)
             for (int j = 0; j < bounds.length; j++) {
                 Assert.assertFalse(v > bounds[j] + tol && v < bounds[j] + 1 - tol);
             }
-        }   
+        }
         Assert.assertEquals(0.0, dist.cumulativeProbability(1), tol);
         Assert.assertEquals(0.1, dist.cumulativeProbability(2), tol);
         Assert.assertEquals(0.6, dist.cumulativeProbability(10), tol);
@@ -539,8 +539,8 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
         Assert.assertEquals(8.0, dist.inverseCumulativeProbability(0.5), tol);
         Assert.assertEquals(9.0, dist.inverseCumulativeProbability(0.6), tol);
     }
-    
-    
+
+
     /**
      * Empirical distribution using a constant smoothing kernel.
      */
@@ -555,7 +555,7 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
             return new ConstantRealDistribution(bStats.getMean());
         }
     }
-    
+
     /**
      * Empirical distribution using a uniform smoothing kernel.
      */

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/HaltonSequenceGeneratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/HaltonSequenceGeneratorTest.java b/src/test/java/org/apache/commons/math3/random/HaltonSequenceGeneratorTest.java
index bbe8187..e64eed5 100644
--- a/src/test/java/org/apache/commons/math3/random/HaltonSequenceGeneratorTest.java
+++ b/src/test/java/org/apache/commons/math3/random/HaltonSequenceGeneratorTest.java
@@ -86,7 +86,7 @@ public class HaltonSequenceGeneratorTest {
         } catch (OutOfRangeException e) {
             // expected
         }
-        
+
         try {
             new HaltonSequenceGenerator(41);
             Assert.fail("an exception should have been thrown");
@@ -124,7 +124,7 @@ public class HaltonSequenceGeneratorTest {
         double[] result = generator.skipTo(5);
         Assert.assertArrayEquals(referenceValues[5], result, 1e-3);
         Assert.assertEquals(6, generator.getNextIndex());
-        
+
         for (int i = 6; i < referenceValues.length; i++) {
             result = generator.nextVector();
             Assert.assertArrayEquals(referenceValues[i], result, 1e-3);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/MersenneTwisterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/MersenneTwisterTest.java b/src/test/java/org/apache/commons/math3/random/MersenneTwisterTest.java
index 3a72e11..4e3e2c9 100644
--- a/src/test/java/org/apache/commons/math3/random/MersenneTwisterTest.java
+++ b/src/test/java/org/apache/commons/math3/random/MersenneTwisterTest.java
@@ -25,10 +25,10 @@ public class MersenneTwisterTest extends RandomGeneratorAbstractTest {
     protected RandomGenerator makeGenerator() {
         return new MersenneTwister(111);
     }
-    
+
     // TODO: Some of the tests moved up to RandomGeneratorAbstractTest tested alternative seeding / constructors
     // Tests exercising these features directly should be added to this class.
-    
+
     @Test
     public void testMakotoNishimura() {
         MersenneTwister mt = new MersenneTwister(new int[] {0x123, 0x234, 0x345, 0x456});

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/RandomAdaptorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/RandomAdaptorTest.java b/src/test/java/org/apache/commons/math3/random/RandomAdaptorTest.java
index 02109ef..289ccf1 100644
--- a/src/test/java/org/apache/commons/math3/random/RandomAdaptorTest.java
+++ b/src/test/java/org/apache/commons/math3/random/RandomAdaptorTest.java
@@ -58,13 +58,13 @@ public class RandomAdaptorTest {
      *
      */
     public static class ConstantGenerator implements RandomGenerator {
-        
+
         private final double value;
-        
+
         public ConstantGenerator() {
             value = 0;
         }
-        
+
         public ConstantGenerator(double value) {
             this.value = value;
         }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/RandomGeneratorAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/RandomGeneratorAbstractTest.java b/src/test/java/org/apache/commons/math3/random/RandomGeneratorAbstractTest.java
index 0094553..0c492b1 100644
--- a/src/test/java/org/apache/commons/math3/random/RandomGeneratorAbstractTest.java
+++ b/src/test/java/org/apache/commons/math3/random/RandomGeneratorAbstractTest.java
@@ -66,7 +66,7 @@ public abstract class RandomGeneratorAbstractTest extends RandomDataGeneratorTes
     public void setUp() {
         generator = makeGenerator();
     }
-    
+
     // Omit secureXxx tests, since they do not use the provided generator
     @Override
     public void testNextSecureLongIAE() {}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/SobolSequenceGeneratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/SobolSequenceGeneratorTest.java b/src/test/java/org/apache/commons/math3/random/SobolSequenceGeneratorTest.java
index c09d09b..73f13f0 100644
--- a/src/test/java/org/apache/commons/math3/random/SobolSequenceGeneratorTest.java
+++ b/src/test/java/org/apache/commons/math3/random/SobolSequenceGeneratorTest.java
@@ -54,7 +54,7 @@ public class SobolSequenceGeneratorTest {
             Assert.assertEquals(i + 1, generator.getNextIndex());
         }
     }
-    
+
     @Test
     public void testConstructor() {
         try {
@@ -63,7 +63,7 @@ public class SobolSequenceGeneratorTest {
         } catch (OutOfRangeException e) {
             // expected
         }
-        
+
         try {
             new SobolSequenceGenerator(1001);
             Assert.fail("an exception should have been thrown");
@@ -82,7 +82,7 @@ public class SobolSequenceGeneratorTest {
         } catch (OutOfRangeException e) {
             // expected
         }
-        
+
         try {
             new SobolSequenceGenerator(1001);
             Assert.fail("an exception should have been thrown");
@@ -96,7 +96,7 @@ public class SobolSequenceGeneratorTest {
         double[] result = generator.skipTo(5);
         Assert.assertArrayEquals(referenceValues[5], result, 1e-6);
         Assert.assertEquals(6, generator.getNextIndex());
-        
+
         for (int i = 6; i < referenceValues.length; i++) {
             result = generator.nextVector();
             Assert.assertArrayEquals(referenceValues[i], result, 1e-6);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/StableRandomGeneratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/StableRandomGeneratorTest.java b/src/test/java/org/apache/commons/math3/random/StableRandomGeneratorTest.java
index 5531ceb..8d75105 100644
--- a/src/test/java/org/apache/commons/math3/random/StableRandomGeneratorTest.java
+++ b/src/test/java/org/apache/commons/math3/random/StableRandomGeneratorTest.java
@@ -25,7 +25,7 @@ import org.junit.Test;
 /**
  * The class <code>StableRandomGeneratorTest</code> contains tests for the class
  * {@link StableRandomGenerator}
- * 
+ *
  */
 public class StableRandomGeneratorTest {
 
@@ -35,7 +35,7 @@ public class StableRandomGeneratorTest {
     /**
      * Run the double nextDouble() method test Due to leptokurtic property the
      * acceptance range is widened.
-     * 
+     *
      * TODO: verify that tolerance this wide is really OK
      */
     @Test
@@ -128,4 +128,4 @@ public class StableRandomGeneratorTest {
             Assert.assertEquals(2.0, e.getArgument());
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/UnitSphereRandomVectorGeneratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/UnitSphereRandomVectorGeneratorTest.java b/src/test/java/org/apache/commons/math3/random/UnitSphereRandomVectorGeneratorTest.java
index 4676a82..b1727b2 100644
--- a/src/test/java/org/apache/commons/math3/random/UnitSphereRandomVectorGeneratorTest.java
+++ b/src/test/java/org/apache/commons/math3/random/UnitSphereRandomVectorGeneratorTest.java
@@ -27,7 +27,7 @@ public class UnitSphereRandomVectorGeneratorTest {
      */
     @Test
     public void test2DDistribution() {
-      
+
         RandomGenerator rg = new JDKRandomGenerator();
         rg.setSeed(17399225432l);
         UnitSphereRandomVectorGenerator generator = new UnitSphereRandomVectorGenerator(2, rg);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/ValueServerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/ValueServerTest.java b/src/test/java/org/apache/commons/math3/random/ValueServerTest.java
index 145b9b8..5fa29a2 100644
--- a/src/test/java/org/apache/commons/math3/random/ValueServerTest.java
+++ b/src/test/java/org/apache/commons/math3/random/ValueServerTest.java
@@ -76,12 +76,12 @@ public final class ValueServerTest {
         Assert.assertEquals("std dev", 1.0173699343977738, stats.getStandardDeviation(),
             tolerance);
     }
-    
+
     /**
      * Verify that when provided with fixed seeds, stochastic modes
      * generate fixed sequences.  Verifies the fix for MATH-654.
      */
-    @Test 
+    @Test
     public void testFixedSeed() throws Exception {
         ValueServer valueServer = new ValueServer();
         URL url = getClass().getResource("testData.txt");
@@ -92,7 +92,7 @@ public final class ValueServerTest {
         checkFixedSeed(valueServer, ValueServer.GAUSSIAN_MODE);
         checkFixedSeed(valueServer, ValueServer.UNIFORM_MODE);
     }
-    
+
     /**
      * Do the check for {@link #testFixedSeed()}
      * @param mode ValueServer mode
@@ -108,7 +108,7 @@ public final class ValueServerTest {
         for (int i = 0; i < 100; i++) {
             values[1][i] = valueServer.getNext();
         }
-        Assert.assertTrue(Arrays.equals(values[0], values[1])); 
+        Assert.assertTrue(Arrays.equals(values[0], values[1]));
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/Well19937aTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/Well19937aTest.java b/src/test/java/org/apache/commons/math3/random/Well19937aTest.java
index ff9fe95..7db3428 100644
--- a/src/test/java/org/apache/commons/math3/random/Well19937aTest.java
+++ b/src/test/java/org/apache/commons/math3/random/Well19937aTest.java
@@ -20,7 +20,7 @@ import org.junit.Assert;
 import org.junit.Test;
 
 public class Well19937aTest extends RandomGeneratorAbstractTest {
-    
+
     @Override
     public RandomGenerator makeGenerator() {
         return new Well19937a(100);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/Well19937cTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/Well19937cTest.java b/src/test/java/org/apache/commons/math3/random/Well19937cTest.java
index a9f7a8e..1b0bf3f 100644
--- a/src/test/java/org/apache/commons/math3/random/Well19937cTest.java
+++ b/src/test/java/org/apache/commons/math3/random/Well19937cTest.java
@@ -20,7 +20,7 @@ import org.junit.Assert;
 import org.junit.Test;
 
 public class Well19937cTest extends RandomGeneratorAbstractTest {
-    
+
     @Override
     public RandomGenerator makeGenerator() {
         return new Well19937c(100);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/Well44497aTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/Well44497aTest.java b/src/test/java/org/apache/commons/math3/random/Well44497aTest.java
index ac46eb7..78500a6 100644
--- a/src/test/java/org/apache/commons/math3/random/Well44497aTest.java
+++ b/src/test/java/org/apache/commons/math3/random/Well44497aTest.java
@@ -20,12 +20,12 @@ import org.junit.Assert;
 import org.junit.Test;
 
 public class Well44497aTest extends RandomGeneratorAbstractTest {
-    
+
     @Override
     public RandomGenerator makeGenerator() {
         return new Well44497a(100);
     }
-    
+
     @Test
     public void testReferenceCode() {
         int[] base = {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/Well44497bTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/Well44497bTest.java b/src/test/java/org/apache/commons/math3/random/Well44497bTest.java
index 23be971..a3748bd 100644
--- a/src/test/java/org/apache/commons/math3/random/Well44497bTest.java
+++ b/src/test/java/org/apache/commons/math3/random/Well44497bTest.java
@@ -20,12 +20,12 @@ import org.junit.Assert;
 import org.junit.Test;
 
 public class Well44497bTest extends RandomGeneratorAbstractTest {
-    
+
     @Override
     public RandomGenerator makeGenerator() {
         return new Well44497b(100);
     }
-        
+
     @Test
     public void testReferenceCode() {
         int[] base = {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/Well512aTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/Well512aTest.java b/src/test/java/org/apache/commons/math3/random/Well512aTest.java
index 01cfe75..f88938a 100644
--- a/src/test/java/org/apache/commons/math3/random/Well512aTest.java
+++ b/src/test/java/org/apache/commons/math3/random/Well512aTest.java
@@ -20,7 +20,7 @@ import org.junit.Assert;
 import org.junit.Test;
 
 public class Well512aTest extends RandomGeneratorAbstractTest {
-    
+
     @Override
     public RandomGenerator makeGenerator() {
         return new Well512a(101);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/special/BesselJTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/special/BesselJTest.java b/src/test/java/org/apache/commons/math3/special/BesselJTest.java
index 7477bf4..83ec982 100644
--- a/src/test/java/org/apache/commons/math3/special/BesselJTest.java
+++ b/src/test/java/org/apache/commons/math3/special/BesselJTest.java
@@ -35,7 +35,7 @@ public class BesselJTest {
      * near.eight = 8 + seq(-.5,.5,.1)
      * largexs = c(10,30,100,300,1000)
      * xs = unique(sort(c(smallxs, medxs, near.eight,largexs)))
-     *          
+     *
      * for (n in c(0:15, 30, 100)) {
      * for (x in xs) {
      * val = format( besselJ(x,n), digits=20 )
@@ -763,12 +763,12 @@ public class BesselJTest {
             Assert.assertEquals(msg, expected, actual, tol);
         }
     }
-    
+
     @Test(expected=MathIllegalArgumentException.class)
     public void testIAEBadOrder() {
         BesselJ.value(-1, 1);
     }
-    
+
     @Test(expected=MathIllegalArgumentException.class)
     public void testIAEBadArgument() {
         BesselJ.value(1, 100000);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/special/ErfTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/special/ErfTest.java b/src/test/java/org/apache/commons/math3/special/ErfTest.java
index 3e26662..6a1b86d 100644
--- a/src/test/java/org/apache/commons/math3/special/ErfTest.java
+++ b/src/test/java/org/apache/commons/math3/special/ErfTest.java
@@ -89,7 +89,7 @@ public class ErfTest {
         Assert.assertEquals(expected, actual, 1.0e-5);
         Assert.assertEquals(1 - expected, Erf.erfc(-x), 1.0e-5);
     }
-    
+
     /**
      * MATH-301, MATH-456
      */
@@ -107,14 +107,14 @@ public class ErfTest {
             Assert.assertTrue(result >= 0 && result < 1);
             result = Erf.erfc(-i);
             Assert.assertFalse(Double.isNaN(result));
-            Assert.assertTrue(result >= 1 && result <= 2);    
+            Assert.assertTrue(result >= 1 && result <= 2);
         }
         Assert.assertEquals(-1, Erf.erf(Double.NEGATIVE_INFINITY), 0);
         Assert.assertEquals(1, Erf.erf(Double.POSITIVE_INFINITY), 0);
         Assert.assertEquals(2, Erf.erfc(Double.NEGATIVE_INFINITY), 0);
         Assert.assertEquals(0, Erf.erfc(Double.POSITIVE_INFINITY), 0);
     }
-    
+
     /**
      * Compare Erf.erf against reference values computed using GCC 4.2.1 (Apple OSX packaged version)
      * erfl (extended precision erf).
@@ -122,15 +122,15 @@ public class ErfTest {
     @Test
     public void testErfGnu() {
         final double tol = 1E-15;
-        final double[] gnuValues = new double[] {-1, -1, -1, -1, -1, 
-        -1, -1, -1, -0.99999999999999997848, 
-        -0.99999999999999264217, -0.99999999999846254017, -0.99999999980338395581, -0.99999998458274209971, 
-        -0.9999992569016276586, -0.99997790950300141459, -0.99959304798255504108, -0.99532226501895273415, 
-        -0.96610514647531072711, -0.84270079294971486948, -0.52049987781304653809,  0, 
-         0.52049987781304653809, 0.84270079294971486948, 0.96610514647531072711, 0.99532226501895273415, 
-         0.99959304798255504108, 0.99997790950300141459, 0.9999992569016276586, 0.99999998458274209971, 
-         0.99999999980338395581, 0.99999999999846254017, 0.99999999999999264217, 0.99999999999999997848, 
-         1,  1,  1,  1, 
+        final double[] gnuValues = new double[] {-1, -1, -1, -1, -1,
+        -1, -1, -1, -0.99999999999999997848,
+        -0.99999999999999264217, -0.99999999999846254017, -0.99999999980338395581, -0.99999998458274209971,
+        -0.9999992569016276586, -0.99997790950300141459, -0.99959304798255504108, -0.99532226501895273415,
+        -0.96610514647531072711, -0.84270079294971486948, -0.52049987781304653809,  0,
+         0.52049987781304653809, 0.84270079294971486948, 0.96610514647531072711, 0.99532226501895273415,
+         0.99959304798255504108, 0.99997790950300141459, 0.9999992569016276586, 0.99999998458274209971,
+         0.99999999980338395581, 0.99999999999846254017, 0.99999999999999264217, 0.99999999999999997848,
+         1,  1,  1,  1,
          1,  1,  1,  1};
         double x = -10d;
         for (int i = 0; i < 41; i++) {
@@ -138,7 +138,7 @@ public class ErfTest {
             x += 0.5d;
         }
     }
-    
+
     /**
      * Compare Erf.erfc against reference values computed using GCC 4.2.1 (Apple OSX packaged version)
      * erfcl (extended precision erfc).
@@ -146,15 +146,15 @@ public class ErfTest {
     @Test
     public void testErfcGnu() {
         final double tol = 1E-15;
-        final double[] gnuValues = new double[] { 2,  2,  2,  2,  2, 
-        2,  2,  2, 1.9999999999999999785, 
-        1.9999999999999926422, 1.9999999999984625402, 1.9999999998033839558, 1.9999999845827420998, 
-        1.9999992569016276586, 1.9999779095030014146, 1.9995930479825550411, 1.9953222650189527342, 
-        1.9661051464753107271, 1.8427007929497148695, 1.5204998778130465381,  1, 
-        0.47950012218695346194, 0.15729920705028513051, 0.033894853524689272893, 0.0046777349810472658333, 
-        0.00040695201744495893941, 2.2090496998585441366E-05, 7.4309837234141274516E-07, 1.5417257900280018858E-08, 
-        1.966160441542887477E-10, 1.5374597944280348501E-12, 7.3578479179743980661E-15, 2.1519736712498913103E-17, 
-        3.8421483271206474691E-20, 4.1838256077794144006E-23, 2.7766493860305691016E-26, 1.1224297172982927079E-29, 
+        final double[] gnuValues = new double[] { 2,  2,  2,  2,  2,
+        2,  2,  2, 1.9999999999999999785,
+        1.9999999999999926422, 1.9999999999984625402, 1.9999999998033839558, 1.9999999845827420998,
+        1.9999992569016276586, 1.9999779095030014146, 1.9995930479825550411, 1.9953222650189527342,
+        1.9661051464753107271, 1.8427007929497148695, 1.5204998778130465381,  1,
+        0.47950012218695346194, 0.15729920705028513051, 0.033894853524689272893, 0.0046777349810472658333,
+        0.00040695201744495893941, 2.2090496998585441366E-05, 7.4309837234141274516E-07, 1.5417257900280018858E-08,
+        1.966160441542887477E-10, 1.5374597944280348501E-12, 7.3578479179743980661E-15, 2.1519736712498913103E-17,
+        3.8421483271206474691E-20, 4.1838256077794144006E-23, 2.7766493860305691016E-26, 1.1224297172982927079E-29,
         2.7623240713337714448E-33, 4.1370317465138102353E-37, 3.7692144856548799402E-41, 2.0884875837625447567E-45};
         double x = -10d;
         for (int i = 0; i < 41; i++) {
@@ -162,9 +162,9 @@ public class ErfTest {
             x += 0.5d;
         }
     }
-    
+
     /**
-     * Tests erfc against reference data computed using Maple reported in Marsaglia, G,, 
+     * Tests erfc against reference data computed using Maple reported in Marsaglia, G,,
      * "Evaluating the Normal Distribution," Journal of Statistical Software, July, 2004.
      * http//www.jstatsoft.org/v11/a05/paper
      */
@@ -176,13 +176,13 @@ public class ErfTest {
                          {2.3, 1.07241100216758e-02},
                          {3.4, 3.36929265676881e-04},
                          {4.5, 3.39767312473006e-06},
-                         {5.6, 1.07175902583109e-08}, 
+                         {5.6, 1.07175902583109e-08},
                          {6.7, 1.04209769879652e-11},
                          {7.8, 3.09535877195870e-15},
                          {8.9, 2.79233437493966e-19},
                          {10.0, 7.61985302416053e-24},
                          {11.1, 6.27219439321703e-29},
-                         {12.2, 1.55411978638959e-34}, 
+                         {12.2, 1.55411978638959e-34},
                          {13.3, 1.15734162836904e-40},
                          {14.4, 2.58717592540226e-47},
                          {15.5, 1.73446079179387e-54},
@@ -194,7 +194,7 @@ public class ErfTest {
             TestUtils.assertRelativelyEquals(ref[i][1], result, 1E-13);
         }
     }
-    
+
     /**
      * Test the implementation of Erf.erf(double, double) for consistency with results
      * obtained from Erf.erf(double) and Erf.erfc(double).


[03/21] [math] Fixed syntax / coding errors to make tests agree exactly with Java tests; added missing tests to testAll.

Posted by lu...@apache.org.
Fixed syntax / coding errors to make tests agree exactly with Java tests; added missing tests to testAll.


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

Branch: refs/heads/field-ode
Commit: 978f89c75359ac771588c95401161875b076d9dc
Parents: 35f3217
Author: Phil Steitz <ph...@gmail.com>
Authored: Mon Nov 23 14:06:20 2015 -0700
Committer: Phil Steitz <ph...@gmail.com>
Committed: Mon Nov 23 14:06:20 2015 -0700

----------------------------------------------------------------------
 src/test/R/LevyDistributionTestCases.R |  1 -
 src/test/R/nakagamiTestCases.R         |  6 +++---
 src/test/R/paretoTestCases             | 11 +++++++----
 src/test/R/testAll                     | 12 +++++++++++-
 4 files changed, 21 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/978f89c7/src/test/R/LevyDistributionTestCases.R
----------------------------------------------------------------------
diff --git a/src/test/R/LevyDistributionTestCases.R b/src/test/R/LevyDistributionTestCases.R
index 95a2200..7770d0b 100644
--- a/src/test/R/LevyDistributionTestCases.R
+++ b/src/test/R/LevyDistributionTestCases.R
@@ -31,7 +31,6 @@ tol <- 1E-9
 # Function definitions
 
 source("testFunctions")           # utility test functions
-library(rmutil)
 
 # function to verify distribution computations
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/978f89c7/src/test/R/nakagamiTestCases.R
----------------------------------------------------------------------
diff --git a/src/test/R/nakagamiTestCases.R b/src/test/R/nakagamiTestCases.R
index 033de7e..31133d7 100644
--- a/src/test/R/nakagamiTestCases.R
+++ b/src/test/R/nakagamiTestCases.R
@@ -15,7 +15,7 @@
 #
 #------------------------------------------------------------------------------
 # R source file to validate Nakagami distribution tests in
-# org.apache.commons.math3.distribution.NakagamiDistributionTest
+# org.apache.commons.math4.distribution.NakagamiDistributionTest
 #
 # To run the test, install R, put this file and testFunctions
 # into the same directory, launch R from this directory and then enter
@@ -39,7 +39,7 @@ verifyDistribution <- function(points, expected, m, s, tol) {
   i <- 0
   for (point in points) {
     i <- i + 1
-    rDistValues[i] <- pnaka(point, m, s)
+    rDistValues[i] <- pnaka(point, s, m)
   }
   output <- c("Distribution test m = ",m,", s = ", s)
   if (assertEquals(expected, rDistValues, tol, "Distribution Values")) {
@@ -55,7 +55,7 @@ verifyDensity <- function(points, expected, m, s, tol) {
   i <- 0
   for (point in points) {
     i <- i + 1
-    rDensityValues[i] <- dnaka(point, m, s)
+    rDensityValues[i] <- dnaka(point, s, m)
   }
   output <- c("Density test m = ",m,", s = ", s)
   if (assertEquals(expected, rDensityValues, tol, "Density Values")) {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/978f89c7/src/test/R/paretoTestCases
----------------------------------------------------------------------
diff --git a/src/test/R/paretoTestCases b/src/test/R/paretoTestCases
index 7360b9a..0eabf5e 100644
--- a/src/test/R/paretoTestCases
+++ b/src/test/R/paretoTestCases
@@ -23,6 +23,9 @@
 #
 # R functions used
 # ppareto(q, mean=0, sd=1, lower.tail = TRUE, log.p = FALSE) <-- distribution
+# The VGAM library which includes the function above must be installed to run
+# this test.
+# See https://cran.r-project.org/web/packages/VGAM/index.html
 #-----------------------------------------------------------------------------
 tol <- 1E-9
 
@@ -78,7 +81,7 @@ verifyDistribution(distributionPoints, distributionValues, mu, sigma, tol)
 verifyDensity(distributionPoints, densityValues, mu, sigma, tol)
 
 distributionValues <- c(0, 0, 0, 0.510884134236, 0.694625688662, 0.785201995008, 0.837811522357, 0.871634279326)
-densityValues <- c(0, 0, 0, 0.195646346305, 0.0872498032394, 0.0477328899983, 0.0294888141169, 0.0197485724114)
+densityValues <- c(0, 0, 0.666666666, 0.195646346305, 0.0872498032394, 0.0477328899983, 0.0294888141169, 0.0197485724114)
 distributionPoints <- c(mu - 2 *sigma, mu - sigma, mu, mu + sigma,
 		mu + 2 * sigma,  mu + 3 * sigma, mu + 4 * sigma,
                     mu + 5 * sigma)
@@ -91,17 +94,17 @@ distributionPoints <- c(mu - 2 *sigma, mu - sigma, mu, mu + sigma,
 		mu + 2 * sigma,  mu + 3 * sigma, mu + 4 * sigma,
                     mu + 5 * sigma)
 distributionValues <- c(0, 0, 0, 0.5, 0.666666666667, 0.75, 0.8, 0.833333333333)
-densityValues <- c(0, 0, 0, 0.25, 0.111111111111, 0.0625, 0.04, 0.0277777777778)
+densityValues <- c(0, 0, 1, 0.25, 0.111111111111, 0.0625, 0.04, 0.0277777777778)
 verifyDistribution(distributionPoints, distributionValues, mu, sigma, tol)
 verifyDensity(distributionPoints, densityValues, mu, sigma, tol)
 
 mu <- 0.1
 sigma <- 0.1
-distributionPoints <- c(mu - 2 *sigma, mu - sigma, mu, mu + sigma,
+distributionPoints <- c(mu - 2 *sigma, 0, mu, mu + sigma,
 		mu + 2 * sigma,  mu + 3 * sigma, mu + 4 * sigma,
                     mu + 5 * sigma)
 distributionValues <- c(0, 0, 0, 0.0669670084632, 0.104041540159, 0.129449436704, 0.148660077479, 0.164041197922)
-densityValues <- c(0, 0, 0, 0.466516495768, 0.298652819947, 0.217637640824, 0.170267984504, 0.139326467013)
+densityValues <- c(0, 0, 1, 0.466516495768, 0.298652819947, 0.217637640824, 0.170267984504, 0.139326467013)
 verifyDistribution(distributionPoints, distributionValues, mu, sigma, tol)
 verifyDensity(distributionPoints, densityValues, mu, sigma, tol)
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/978f89c7/src/test/R/testAll
----------------------------------------------------------------------
diff --git a/src/test/R/testAll b/src/test/R/testAll
index 9af417b..49c460b 100644
--- a/src/test/R/testAll
+++ b/src/test/R/testAll
@@ -21,6 +21,12 @@
 # directory, launch R from this directory and then enter
 # source("<name-of-this-file>")
 #
+# The KolmogorovSmirnov and Pareto distribution tests require the following
+# packages to be installed:
+#
+# https://cran.r-project.org/web/packages/Matching/index.html
+# https://cran.r-project.org/web/packages/VGAM/index.html
+#
 # To redirect output to a file, uncomment the following line, substituting
 # another file path if you like (default behavior is to write the file to the
 # current directory).
@@ -31,6 +37,8 @@
 source("binomialTestCases")
 source("normalTestCases")
 source("poissonTestCases")
+source("paretoTestCases")
+source("logNormalTestCases")
 source("hypergeometricTestCases")
 source("exponentialTestCases")
 source("cauchyTestCases.R")
@@ -45,6 +53,7 @@ source("gumbelTestCases.R")
 source("laplaceTestCases.R")
 source("logisticsTestCases.R")
 source("nakagamiTestCases.R")
+source("zipfTestCases")
 
 # regression
 source("regressionTestCases")
@@ -52,7 +61,8 @@ source("regressionTestCases")
 # inference
 source("chiSquareTestCases")
 source("anovaTestCases")
-source("KolmogorovSmirnovTestCases")
+source("KolmogorovSmirnovTestCases.R")
+source("TTestCases")
 
 # descriptive
 source("descriptiveTestCases")


[15/21] [math] Fixed field-based Dormand-Prince 8(5, 3) integrator constants.

Posted by lu...@apache.org.
Fixed field-based Dormand-Prince 8(5,3) integrator constants.

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

Branch: refs/heads/field-ode
Commit: d9bb79e268b3eab012590c5c67c38e87837bce63
Parents: 84b95dc
Author: Luc Maisonobe <lu...@apache.org>
Authored: Wed Dec 9 13:29:24 2015 +0100
Committer: Luc Maisonobe <lu...@apache.org>
Committed: Wed Dec 9 13:29:24 2015 +0100

----------------------------------------------------------------------
 .../DormandPrince853FieldIntegrator.java        | 54 ++++++++++----------
 1 file changed, 27 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/d9bb79e2/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldIntegrator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldIntegrator.java
index 2c872e8..a3cdaf3 100644
--- a/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldIntegrator.java
+++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldIntegrator.java
@@ -230,7 +230,7 @@ public class DormandPrince853FieldIntegrator<T extends RealFieldElement<T>>
         a[ 0][ 0] = sqrt6.add(-6).divide(-67.5);
 
         a[ 1][ 0] = sqrt6.add(-6).divide(-180);
-        a[ 1][ 1] = sqrt6.add(-6).divide( -40);
+        a[ 1][ 1] = sqrt6.add(-6).divide( -60);
 
         a[ 2][ 0] = sqrt6.add(-6).divide(-120);
         a[ 2][ 1] = getField().getZero();
@@ -259,7 +259,7 @@ public class DormandPrince853FieldIntegrator<T extends RealFieldElement<T>>
         a[ 6][ 2] = getField().getZero();
         a[ 6][ 3] = sqrt6.multiply( 4784).add(51544).divide(371293);
         a[ 6][ 4] = sqrt6.multiply(-4784).add(51544).divide(371293);
-        a[ 6][ 5] = fraction(-5688, 371283);
+        a[ 6][ 5] = fraction(-5688, 371293);
         a[ 6][ 6] = fraction( 3072, 371293);
 
         a[ 7][ 0] = fraction(58656157643.0, 93983540625.0);
@@ -320,47 +320,47 @@ public class DormandPrince853FieldIntegrator<T extends RealFieldElement<T>>
         a[11][11] = fraction(137909.0, 3084480.0);
 
         // the following stages are for interpolation only
-        a[12][ 0] = fraction(      13481885573.0, 240030000000.0)     .subtract(a[11][0]);
+        a[12][ 0] = fraction(      13481885573.0, 240030000000.0);
         a[12][ 1] = getField().getZero();
         a[12][ 2] = getField().getZero();
         a[12][ 3] = getField().getZero();
         a[12][ 4] = getField().getZero();
-        a[12][ 5] = getField().getZero()                              .subtract(a[11][5]);
-        a[12][ 6] = fraction(     139418837528.0, 549975234375.0)     .subtract(a[11][6]);
-        a[12][ 7] = fraction(  -11108320068443.0, 45111937500000.0)   .subtract(a[11][7]);
-        a[12][ 8] = fraction(-1769651421925959.0, 14249385146080000.0).subtract(a[11][8]);
-        a[12][ 9] = fraction(         57799439.0, 377055000.0)        .subtract(a[11][9]);
-        a[12][10] = fraction(     793322643029.0, 96734250000000.0)   .subtract(a[11][10]);
-        a[12][11] = fraction(       1458939311.0, 192780000000.0)     .subtract(a[11][11]);
+        a[12][ 5] = getField().getZero();
+        a[12][ 6] = fraction(     139418837528.0, 549975234375.0);
+        a[12][ 7] = fraction(  -11108320068443.0, 45111937500000.0);
+        a[12][ 8] = fraction(-1769651421925959.0, 14249385146080000.0);
+        a[12][ 9] = fraction(         57799439.0, 377055000.0);
+        a[12][10] = fraction(     793322643029.0, 96734250000000.0);
+        a[12][11] = fraction(       1458939311.0, 192780000000.0);
         a[12][12]  = fraction(            -4149.0, 500000.0);
 
-        a[13][ 0] = fraction(    1595561272731.0, 50120273500000.0)   .subtract(a[11][0]);
+        a[13][ 0] = fraction(    1595561272731.0, 50120273500000.0);
         a[13][ 1] = getField().getZero();
         a[13][ 2] = getField().getZero();
         a[13][ 3] = getField().getZero();
         a[13][ 4] = getField().getZero();
-        a[13][ 5] = fraction(     975183916491.0, 34457688031250.0)   .subtract(a[11][5]);
-        a[13][ 6] = fraction(   38492013932672.0, 718912673015625.0)  .subtract(a[11][6]);
-        a[13][ 7] = fraction(-1114881286517557.0, 20298710767500000.0).subtract(a[11][7]);
-        a[13][ 8] = getField().getZero()                              .subtract(a[11][8]);
-        a[13][ 9] = getField().getZero()                              .subtract(a[11][9]);
-        a[13][10] = fraction(   -2538710946863.0, 23431227861250000.0).subtract(a[11][10]);
-        a[13][11] = fraction(       8824659001.0, 23066716781250.0)   .subtract(a[11][11]);
+        a[13][ 5] = fraction(     975183916491.0, 34457688031250.0);
+        a[13][ 6] = fraction(   38492013932672.0, 718912673015625.0);
+        a[13][ 7] = fraction(-1114881286517557.0, 20298710767500000.0);
+        a[13][ 8] = getField().getZero();
+        a[13][ 9] = getField().getZero();
+        a[13][10] = fraction(   -2538710946863.0, 23431227861250000.0);
+        a[13][11] = fraction(       8824659001.0, 23066716781250.0);
         a[13][12] = fraction(     -11518334563.0, 33831184612500.0);
         a[13][13] = fraction(       1912306948.0, 13532473845.0);
 
-        a[14][ 0] = fraction(     -13613986967.0, 31741908048.0)      .subtract(a[11][0]);
+        a[14][ 0] = fraction(     -13613986967.0, 31741908048.0);
         a[14][ 1] = getField().getZero();
         a[14][ 2] = getField().getZero();
         a[14][ 3] = getField().getZero();
         a[14][ 4] = getField().getZero();
-        a[14][ 5] = fraction(      -4755612631.0, 1012344804.0)       .subtract(a[11][5]);
-        a[14][ 6] = fraction(   42939257944576.0, 5588559685701.0)    .subtract(a[11][6]);
-        a[14][ 7] = fraction(   77881972900277.0, 19140370552944.0)   .subtract(a[11][7]);
-        a[14][ 8] = fraction(   22719829234375.0, 63689648654052.0)   .subtract(a[11][8]);
-        a[14][ 9] = getField().getZero()                              .subtract(a[11][9]);
-        a[14][10] = getField().getZero()                              .subtract(a[11][10]);
-        a[14][11] = getField().getZero()                              .subtract(a[11][11]);
+        a[14][ 5] = fraction(      -4755612631.0, 1012344804.0);
+        a[14][ 6] = fraction(   42939257944576.0, 5588559685701.0);
+        a[14][ 7] = fraction(   77881972900277.0, 19140370552944.0);
+        a[14][ 8] = fraction(   22719829234375.0, 63689648654052.0);
+        a[14][ 9] = getField().getZero();
+        a[14][10] = getField().getZero();
+        a[14][11] = getField().getZero();
         a[14][12] = fraction(      -1199007803.0, 857031517296.0);
         a[14][13] = fraction(     157882067000.0, 53564469831.0);
         a[14][14] = fraction(    -290468882375.0, 31741908048.0);
@@ -373,7 +373,7 @@ public class DormandPrince853FieldIntegrator<T extends RealFieldElement<T>>
     @Override
     public T[] getB() {
         final T[] b = MathArrays.buildArray(getField(), 16);
-        b[ 0] = fraction(104257, 1929240);
+        b[ 0] = fraction(104257, 1920240);
         b[ 1] = getField().getZero();
         b[ 2] = getField().getZero();
         b[ 3] = getField().getZero();


[05/21] [math] Pass rng to EnumeratedRealDistribution used by bootstrap.

Posted by lu...@apache.org.
Pass rng to EnumeratedRealDistribution used by bootstrap.


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

Branch: refs/heads/field-ode
Commit: 3cfafe0510554e5d3cc05d9cecb3759d682afdce
Parents: fe23c9b
Author: Phil Steitz <ph...@gmail.com>
Authored: Tue Nov 24 06:20:48 2015 -0700
Committer: Phil Steitz <ph...@gmail.com>
Committed: Tue Nov 24 06:20:48 2015 -0700

----------------------------------------------------------------------
 .../apache/commons/math3/stat/inference/KolmogorovSmirnovTest.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/3cfafe05/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 7c19b1a..f4edf5f 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
@@ -400,7 +400,7 @@ public class KolmogorovSmirnovTest {
         final double[] combined = new double[xLength + yLength];
         System.arraycopy(x, 0, combined, 0, xLength);
         System.arraycopy(y, 0, combined, xLength, yLength);
-        final EnumeratedRealDistribution dist = new EnumeratedRealDistribution(combined);
+        final EnumeratedRealDistribution dist = new EnumeratedRealDistribution(rng, combined);
         final long d = integralKolmogorovSmirnovStatistic(x, y);
         int greaterCount = 0;
         int equalCount = 0;


[16/21] [math] Fixed test thresholds.

Posted by lu...@apache.org.
Fixed test thresholds.

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

Branch: refs/heads/field-ode
Commit: cb513428f9b07f6d7a53c20b8b498b092a581126
Parents: d9bb79e
Author: Luc Maisonobe <lu...@apache.org>
Authored: Wed Dec 9 15:55:40 2015 +0100
Committer: Luc Maisonobe <lu...@apache.org>
Committed: Wed Dec 9 15:55:40 2015 +0100

----------------------------------------------------------------------
 .../math3/ode/nonstiff/DormandPrince54FieldIntegratorTest.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/cb513428/src/test/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldIntegratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldIntegratorTest.java b/src/test/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldIntegratorTest.java
index 1a80dd8..87de743 100644
--- a/src/test/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldIntegratorTest.java
+++ b/src/test/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldIntegratorTest.java
@@ -69,15 +69,15 @@ public class DormandPrince54FieldIntegratorTest extends AbstractEmbeddedRungeKut
 
     @Override
     public void testIncreasingTolerance() {
-        // the 0.5 factor is only valid for this test
+        // the 0.7 factor is only valid for this test
         // and has been obtained from trial and error
         // there is no general relation between local and global errors
-        doTestIncreasingTolerance(Decimal64Field.getInstance(), 0.5, 1.0e-12);
+        doTestIncreasingTolerance(Decimal64Field.getInstance(), 0.7, 1.0e-12);
     }
 
     @Override
     public void testEvents() {
-        doTestEvents(Decimal64Field.getInstance(), 3.10e-8, "Dormand-Prince 5(4)");
+        doTestEvents(Decimal64Field.getInstance(), 1.7e-7, "Dormand-Prince 5(4)");
     }
 
     @Override


[19/21] [math] Fixed syntax incompatible with Java 5.

Posted by lu...@apache.org.
Fixed syntax incompatible with Java 5.

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

Branch: refs/heads/field-ode
Commit: 35e2da2bf145a69522afa7c8d477a3b49cb9b2d5
Parents: 2291c26
Author: Luc Maisonobe <lu...@apache.org>
Authored: Wed Dec 9 16:26:26 2015 +0100
Committer: Luc Maisonobe <lu...@apache.org>
Committed: Wed Dec 9 16:31:23 2015 +0100

----------------------------------------------------------------------
 .../commons/math3/ode/FieldExpandableODE.java       |  2 +-
 ...stractEmbeddedRungeKuttaFieldIntegratorTest.java | 16 ++++++++--------
 .../AbstractRungeKuttaFieldIntegratorTest.java      | 14 +++++++-------
 ...AbstractRungeKuttaFieldStepInterpolatorTest.java |  6 +++---
 .../ode/sampling/StepInterpolatorTestUtils.java     |  2 +-
 5 files changed, 20 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/35e2da2b/src/main/java/org/apache/commons/math3/ode/FieldExpandableODE.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/ode/FieldExpandableODE.java b/src/main/java/org/apache/commons/math3/ode/FieldExpandableODE.java
index 91dc81e..b4f4c5b 100644
--- a/src/main/java/org/apache/commons/math3/ode/FieldExpandableODE.java
+++ b/src/main/java/org/apache/commons/math3/ode/FieldExpandableODE.java
@@ -92,7 +92,7 @@ public class FieldExpandableODE<T extends RealFieldElement<T>> {
     public int addSecondaryEquations(final FieldSecondaryEquations<T> secondary) {
 
         components.add(secondary);
-        mapper = new FieldEquationsMapper<>(mapper, secondary.getDimension());
+        mapper = new FieldEquationsMapper<T>(mapper, secondary.getDimension());
 
         return components.size() - 1;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/35e2da2b/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractEmbeddedRungeKuttaFieldIntegratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractEmbeddedRungeKuttaFieldIntegratorTest.java b/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractEmbeddedRungeKuttaFieldIntegratorTest.java
index e166f49..9e29a7c 100644
--- a/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractEmbeddedRungeKuttaFieldIntegratorTest.java
+++ b/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractEmbeddedRungeKuttaFieldIntegratorTest.java
@@ -151,7 +151,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest {
         EmbeddedRungeKuttaFieldIntegrator<T> integrator = createIntegrator(field, 0.0, 1.0, 1.0e-10, 1.0e-10);
 
         try  {
-            integrator.integrate(new FieldExpandableODE<>(equations),
+            integrator.integrate(new FieldExpandableODE<T>(equations),
                                  new FieldODEState<T>(field.getOne().negate(),
                                                       MathArrays.buildArray(field, 1)),
                                  field.getZero());
@@ -161,7 +161,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest {
           }
 
           try  {
-              integrator.integrate(new FieldExpandableODE<>(equations),
+              integrator.integrate(new FieldExpandableODE<T>(equations),
                                    new FieldODEState<T>(field.getZero(),
                                                         MathArrays.buildArray(field, 1)),
                                    field.getOne());
@@ -191,7 +191,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest {
                                                               vecAbsoluteTolerance, vecRelativeTolerance);
         TestFieldProblemHandler<T> handler = new TestFieldProblemHandler<T>(pb, integ);
         integ.addStepHandler(handler);
-        integ.integrate(new FieldExpandableODE<>(pb), pb.getInitialState(), pb.getFinalTime());
+        integ.integrate(new FieldExpandableODE<T>(pb), pb.getInitialState(), pb.getFinalTime());
         Assert.fail("an exception should have been thrown");
 
     }
@@ -352,7 +352,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest {
             EmbeddedRungeKuttaFieldIntegrator<T> integrator = createIntegrator(field, 0,
                                                                                pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal(),
                                                                                new double[4], new double[4]);
-            integrator.integrate(new FieldExpandableODE<>(pb),
+            integrator.integrate(new FieldExpandableODE<T>(pb),
                                  new FieldODEState<T>(pb.getInitialState().getTime(),
                                                       MathArrays.buildArray(field, 6)),
                                  pb.getFinalTime());
@@ -364,7 +364,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest {
                             createIntegrator(field, 0,
                                              pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal(),
                                              new double[2], new double[4]);
-            integrator.integrate(new FieldExpandableODE<>(pb), pb.getInitialState(), pb.getFinalTime());
+            integrator.integrate(new FieldExpandableODE<T>(pb), pb.getInitialState(), pb.getFinalTime());
             Assert.fail("an exception should have been thrown");
         } catch(DimensionMismatchException ie) {
         }
@@ -373,7 +373,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest {
                             createIntegrator(field, 0,
                                              pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal(),
                                              new double[4], new double[4]);
-            integrator.integrate(new FieldExpandableODE<>(pb), pb.getInitialState(), pb.getInitialState().getTime());
+            integrator.integrate(new FieldExpandableODE<T>(pb), pb.getInitialState(), pb.getInitialState().getTime());
             Assert.fail("an exception should have been thrown");
         } catch(NumberIsTooSmallException ie) {
         }
@@ -401,7 +401,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest {
                                                                       scalRelativeTolerance);
         TestFieldProblemHandler<T> handler = new TestFieldProblemHandler<T>(pb, integ);
         integ.addStepHandler(handler);
-        integ.integrate(new FieldExpandableODE<>(pb), pb.getInitialState(), pb.getFinalTime());
+        integ.integrate(new FieldExpandableODE<T>(pb), pb.getInitialState(), pb.getFinalTime());
 
         Assert.assertEquals(0, handler.getLastError().getReal(),         espilonLast);
         Assert.assertEquals(0, handler.getMaximalValueError().getReal(), epsilonMaxValue);
@@ -424,7 +424,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest {
         FieldFirstOrderIntegrator<T> integ = createIntegrator(field, minStep, maxStep,
                                                               vecAbsoluteTolerance, vecRelativeTolerance);
         integ.addStepHandler(new KeplerHandler<T>(pb, epsilon));
-        integ.integrate(new FieldExpandableODE<>(pb), pb.getInitialState(), pb.getFinalTime());
+        integ.integrate(new FieldExpandableODE<T>(pb), pb.getInitialState(), pb.getFinalTime());
     }
 
     private static class KeplerHandler<T extends RealFieldElement<T>> implements FieldStepHandler<T> {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/35e2da2b/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractRungeKuttaFieldIntegratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractRungeKuttaFieldIntegratorTest.java b/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractRungeKuttaFieldIntegratorTest.java
index 3c35603..c31f6ca 100644
--- a/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractRungeKuttaFieldIntegratorTest.java
+++ b/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractRungeKuttaFieldIntegratorTest.java
@@ -201,7 +201,7 @@ public abstract class AbstractRungeKuttaFieldIntegratorTest {
         RungeKuttaFieldIntegrator<T> integrator = createIntegrator(field, field.getZero().add(0.01));
         try  {
             TestFieldProblem1<T> pb = new TestFieldProblem1<T>(field);
-            integrator.integrate(new FieldExpandableODE<>(pb),
+            integrator.integrate(new FieldExpandableODE<T>(pb),
                                  new FieldODEState<T>(field.getZero(), MathArrays.buildArray(field, pb.getDimension() + 10)),
                                  field.getOne());
             Assert.fail("an exception should have been thrown");
@@ -209,7 +209,7 @@ public abstract class AbstractRungeKuttaFieldIntegratorTest {
         }
         try  {
             TestFieldProblem1<T> pb = new TestFieldProblem1<T>(field);
-            integrator.integrate(new FieldExpandableODE<>(pb),
+            integrator.integrate(new FieldExpandableODE<T>(pb),
                                  new FieldODEState<T>(field.getZero(), MathArrays.buildArray(field, pb.getDimension())),
                                  field.getZero());
             Assert.fail("an exception should have been thrown");
@@ -349,7 +349,7 @@ public abstract class AbstractRungeKuttaFieldIntegratorTest {
         RungeKuttaFieldIntegrator<T> integ = createIntegrator(field, step);
         TestFieldProblemHandler<T> handler = new TestFieldProblemHandler<T>(pb, integ);
         integ.addStepHandler(handler);
-        integ.integrate(new FieldExpandableODE<>(pb), pb.getInitialState(), pb.getFinalTime());
+        integ.integrate(new FieldExpandableODE<T>(pb), pb.getInitialState(), pb.getFinalTime());
 
         Assert.assertEquals(0, handler.getLastError().getReal(),         espilonLast);
         Assert.assertEquals(0, handler.getMaximalValueError().getReal(), epsilonMaxValue);
@@ -370,7 +370,7 @@ public abstract class AbstractRungeKuttaFieldIntegratorTest {
 
         RungeKuttaFieldIntegrator<T> integ = createIntegrator(field, step);
         integ.addStepHandler(new KeplerHandler<T>(pb, expectedMaxError, epsilon));
-        integ.integrate(new FieldExpandableODE<>(pb), pb.getInitialState(), pb.getFinalTime());
+        integ.integrate(new FieldExpandableODE<T>(pb), pb.getInitialState(), pb.getFinalTime());
     }
 
     private static class KeplerHandler<T extends RealFieldElement<T>> implements FieldStepHandler<T> {
@@ -488,7 +488,7 @@ public abstract class AbstractRungeKuttaFieldIntegratorTest {
 
         };
 
-        integ.integrate(new FieldExpandableODE<>(equations), new FieldODEState<T>(t0, y0), t);
+        integ.integrate(new FieldExpandableODE<T>(equations), new FieldODEState<T>(t0, y0), t);
 
     }
 
@@ -502,8 +502,8 @@ public abstract class AbstractRungeKuttaFieldIntegratorTest {
                                                                       field.getZero().add(2.0));
       RungeKuttaFieldIntegrator<T> integ = createIntegrator(field, field.getZero().add(0.3));
       integ.addEventHandler(stepProblem, 1.0, 1.0e-12, 1000);
-      FieldODEStateAndDerivative<T> result = integ.integrate(new FieldExpandableODE<>(stepProblem),
-                                                             new FieldODEState<>(field.getZero(), MathArrays.buildArray(field, 1)),
+      FieldODEStateAndDerivative<T> result = integ.integrate(new FieldExpandableODE<T>(stepProblem),
+                                                             new FieldODEState<T>(field.getZero(), MathArrays.buildArray(field, 1)),
                                                              field.getZero().add(10.0));
       Assert.assertEquals(8.0, result.getState()[0].getReal(), epsilon);
     }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/35e2da2b/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractRungeKuttaFieldStepInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractRungeKuttaFieldStepInterpolatorTest.java b/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractRungeKuttaFieldStepInterpolatorTest.java
index 64365b4..36b2707 100644
--- a/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractRungeKuttaFieldStepInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractRungeKuttaFieldStepInterpolatorTest.java
@@ -46,7 +46,7 @@ public abstract class AbstractRungeKuttaFieldStepInterpolatorTest {
     protected <T extends RealFieldElement<T>> void doInterpolationAtBounds(final Field<T> field, double epsilon) {
 
         RungeKuttaFieldStepInterpolator<T> interpolator = setUpInterpolator(field,
-                                                                            new SinCos<>(field),
+                                                                            new SinCos<T>(field),
                                                                             0.0, new double[] { 0.0, 1.0 }, 0.125);
 
         Assert.assertEquals(0.0, interpolator.getPreviousState().getTime().getReal(), 1.0e-15);
@@ -71,7 +71,7 @@ public abstract class AbstractRungeKuttaFieldStepInterpolatorTest {
                                                                          double epsilonSin, double epsilonCos) {
 
         RungeKuttaFieldStepInterpolator<T> interpolator = setUpInterpolator(field,
-                                                                            new SinCos<>(field),
+                                                                            new SinCos<T>(field),
                                                                             0.0, new double[] { 0.0, 1.0 }, 0.0125);
 
         int n = 100;
@@ -97,7 +97,7 @@ public abstract class AbstractRungeKuttaFieldStepInterpolatorTest {
                                                                                      double epsilonSin, double epsilonCos,
                                                                                      double epsilonSinDot, double epsilonCosDot) {
 
-        FieldFirstOrderDifferentialEquations<T> eqn = new SinCos<>(field);
+        FieldFirstOrderDifferentialEquations<T> eqn = new SinCos<T>(field);
         RungeKuttaFieldStepInterpolator<T> fieldInterpolator =
                         setUpInterpolator(field, eqn, 0.0, new double[] { 0.0, 1.0 }, 0.125);
         RungeKuttaStepInterpolator regularInterpolator = convertInterpolator(fieldInterpolator, eqn);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/35e2da2b/src/test/java/org/apache/commons/math3/ode/sampling/StepInterpolatorTestUtils.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ode/sampling/StepInterpolatorTestUtils.java b/src/test/java/org/apache/commons/math3/ode/sampling/StepInterpolatorTestUtils.java
index ba47738..9450df2 100644
--- a/src/test/java/org/apache/commons/math3/ode/sampling/StepInterpolatorTestUtils.java
+++ b/src/test/java/org/apache/commons/math3/ode/sampling/StepInterpolatorTestUtils.java
@@ -133,7 +133,7 @@ public class StepInterpolatorTestUtils {
 
         });
 
-        integrator.integrate(new FieldExpandableODE<>(problem), problem.getInitialState(), problem.getFinalTime());
+        integrator.integrate(new FieldExpandableODE<T>(problem), problem.getInitialState(), problem.getFinalTime());
 
     }
 }


[21/21] [math] Notify availability of field-based ode.

Posted by lu...@apache.org.
Notify availability of field-based ode.

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

Branch: refs/heads/field-ode
Commit: 10c271f2cb800ceb4d649cf988f870720841c579
Parents: 4edbcc7
Author: Luc Maisonobe <lu...@apache.org>
Authored: Wed Dec 9 17:00:03 2015 +0100
Committer: Luc Maisonobe <lu...@apache.org>
Committed: Wed Dec 9 17:00:03 2015 +0100

----------------------------------------------------------------------
 src/changes/changes.xml         |  7 +++++++
 src/site/xdoc/userguide/ode.xml | 20 ++++++++++++++++++--
 2 files changed, 25 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/10c271f2/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 1276963..e5f9246 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -51,6 +51,13 @@ If the output is not quite correct, check for invisible trailing spaces!
   </properties>
   <body>
     <release version="3.6" date="XXXX-XX-XX" description="">
+      <action dev="luc" type="add" issue="MATH-1288">
+        Added a field-based version of Ordinary Differential Equations framework.
+        This allows integrating ode that refer to RealField elements instead of
+        primitive double, hence opening the way to use DerivativeStructure to
+        compute partial differential without using variational equations, or to solve
+        ode with extended precision using Dfp.
+      </action>
       <action dev="erans" type="fix" issue="MATH-1295" due-to="Luke Lindsay">
         Increased default value for number of allowed evaluations in
         "o.a.c.m.optim.univariate.BracketFinder".

http://git-wip-us.apache.org/repos/asf/commons-math/blob/10c271f2/src/site/xdoc/userguide/ode.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/userguide/ode.xml b/src/site/xdoc/userguide/ode.xml
index 0cd246b..bd2bf8e 100644
--- a/src/site/xdoc/userguide/ode.xml
+++ b/src/site/xdoc/userguide/ode.xml
@@ -69,11 +69,27 @@
           derivatives being handled be secondary ODE (see below for an example).
         </p>
         <p>
+         Two parallel APIs are available. The first is devoted to solve ode for which the integration free
+         variable t and the state y(t) are primitive double and primitive double array respectively. Starting
+         with version 3.6, a second API is devoted to solve ode for which the integration free
+         variable t and the state y(t) are <code>RealFieldElement</code> and <code>RealFieldElement</code>
+         array respectively. This allow for example users to integrate ode where the computation values
+         are for example <code>DerivativeStructure</code> elements, hence automatically computing
+         partial derivatives with respect to some equations parameters without a need to set up the
+         variational equations. Another example is to use <code>Dfp</code> elements in order to solve
+         ode with extended precision. As of 3.6, the API are slightly different, mainly in the way they
+         handle arrays. Both API will become more similar in 4.0 and future versions as the older
+         primitive double API will be modified to match the newer field API. This cannot be done in
+         3.6 for compatibility reasons.
+        </p>
+        <p>
           The user should describe his problem in his own classes which should implement the
           <a href="../apidocs/org/apache/commons/math3/ode/FirstOrderDifferentialEquations.html">FirstOrderDifferentialEquations</a>
-          interface. Then he should pass it to the integrator he prefers among all the classes that implement
+          interface (or  <a href="../apidocs/org/apache/commons/math3/ode/FieldFirstOrderDifferentialEquations.html">FieldFirstOrderDifferentialEquations</a>
+          interface). Then he should pass it to the integrator he prefers among all the classes that implement
           the <a href="../apidocs/org/apache/commons/math3/ode/FirstOrderIntegrator.html">FirstOrderIntegrator</a>
-          interface. The following example shows how to implement the simple two-dimensional problem:
+          interface (or the <a href="../apidocs/org/apache/commons/math3/ode/FieldFirstOrderIntegrator.html">FieldFirstOrderIntegrator</a>
+          interface). The following example shows how to implement the simple two-dimensional problem using double primitives:
           <ul>
             <li>y'<sub>0</sub>(t) = &#x3c9; &#xD7; (c<sub>1</sub> - y<sub>1</sub>(t))</li>
             <li>y'<sub>1</sub>(t) = &#x3c9; &#xD7; (y<sub>0</sub>(t) - c<sub>0</sub>)</li>


[14/21] [math] Fixed Dormand-Prince 5(4) field integrator constants.

Posted by lu...@apache.org.
Fixed Dormand-Prince 5(4) field integrator constants.

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

Branch: refs/heads/field-ode
Commit: 84b95dc649bf2f817217bdff9c120ab074fd5b50
Parents: b713e4c
Author: Luc Maisonobe <lu...@apache.org>
Authored: Wed Dec 9 11:38:24 2015 +0100
Committer: Luc Maisonobe <lu...@apache.org>
Committed: Wed Dec 9 11:38:24 2015 +0100

----------------------------------------------------------------------
 .../ode/nonstiff/DormandPrince54FieldIntegrator.java      |  4 ++--
 .../ode/nonstiff/DormandPrince54FieldIntegratorTest.java  | 10 +++++-----
 .../DormandPrince54FieldStepInterpolatorTest.java         |  4 ++--
 3 files changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/84b95dc6/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldIntegrator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldIntegrator.java
index 356c165..cc60c2c 100644
--- a/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldIntegrator.java
+++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldIntegrator.java
@@ -134,7 +134,7 @@ public class DormandPrince54FieldIntegrator<T extends RealFieldElement<T>>
         final T[] c = MathArrays.buildArray(getField(), 6);
         c[0] = fraction(1,  5);
         c[1] = fraction(3, 10);
-        c[2] = fraction(5,  5);
+        c[2] = fraction(4,  5);
         c[3] = fraction(8,  9);
         c[4] = getField().getOne();
         c[5] = getField().getOne();
@@ -149,7 +149,7 @@ public class DormandPrince54FieldIntegrator<T extends RealFieldElement<T>>
             a[i] = MathArrays.buildArray(getField(), i + 1);
         }
         a[0][0] = fraction(     1,     5);
-        a[1][0] = fraction(     3,     4);
+        a[1][0] = fraction(     3,    40);
         a[1][1] = fraction(     9,    40);
         a[2][0] = fraction(    44,    45);
         a[2][1] = fraction(   -56,    15);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/84b95dc6/src/test/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldIntegratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldIntegratorTest.java b/src/test/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldIntegratorTest.java
index a52e4a5..1a80dd8 100644
--- a/src/test/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldIntegratorTest.java
+++ b/src/test/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldIntegratorTest.java
@@ -49,12 +49,12 @@ public class DormandPrince54FieldIntegratorTest extends AbstractEmbeddedRungeKut
 
     @Test
     public void testBackward() {
-        doTestBackward(Decimal64Field.getInstance(), 2.0e-7, 2.0e-7, 1.0e-12, "Dormand-Prince 5(4)");
+        doTestBackward(Decimal64Field.getInstance(), 1.6e-7, 1.6e-7, 1.0e-22, "Dormand-Prince 5(4)");
     }
 
     @Test
     public void testKepler() {
-        doTestKepler(Decimal64Field.getInstance(), 7.0e-10);
+        doTestKepler(Decimal64Field.getInstance(), 3.1e-10);
     }
 
     @Override
@@ -69,15 +69,15 @@ public class DormandPrince54FieldIntegratorTest extends AbstractEmbeddedRungeKut
 
     @Override
     public void testIncreasingTolerance() {
-        // the 0.7 factor is only valid for this test
+        // the 0.5 factor is only valid for this test
         // and has been obtained from trial and error
         // there is no general relation between local and global errors
-        doTestIncreasingTolerance(Decimal64Field.getInstance(), 0.7, 1.0e-12);
+        doTestIncreasingTolerance(Decimal64Field.getInstance(), 0.5, 1.0e-12);
     }
 
     @Override
     public void testEvents() {
-        doTestEvents(Decimal64Field.getInstance(), 5.0e-6, "Dormand-Prince 5(4)");
+        doTestEvents(Decimal64Field.getInstance(), 3.10e-8, "Dormand-Prince 5(4)");
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/commons-math/blob/84b95dc6/src/test/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldStepInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldStepInterpolatorTest.java b/src/test/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldStepInterpolatorTest.java
index 378fbc8..a46544a 100644
--- a/src/test/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldStepInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldStepInterpolatorTest.java
@@ -38,12 +38,12 @@ public class DormandPrince54FieldStepInterpolatorTest extends AbstractRungeKutta
 
     @Test
     public void interpolationInside() {
-        doInterpolationInside(Decimal64Field.getInstance(), 4.0e-13, 2.7e-15);
+        doInterpolationInside(Decimal64Field.getInstance(), 9.5e-14, 1.8e-15);
     }
 
     @Test
     public void nonFieldInterpolatorConsistency() {
-        doNonFieldInterpolatorConsistency(Decimal64Field.getInstance(), 4.2e-17, 2.3e-16, 6.7e-16, 8.4e-17);
+        doNonFieldInterpolatorConsistency(Decimal64Field.getInstance(), 2.8e-17, 2.3e-16, 4.5e-16, 5.6e-17);
     }
 
 }


[02/21] [math] Removed trailing spaces.

Posted by lu...@apache.org.
Removed trailing spaces.


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

Branch: refs/heads/field-ode
Commit: 35f32170b90da3c3720502f16b0691015ee84298
Parents: fbc327e
Author: Phil Steitz <ph...@gmail.com>
Authored: Sun Nov 22 12:43:07 2015 -0700
Committer: Phil Steitz <ph...@gmail.com>
Committed: Sun Nov 22 12:43:07 2015 -0700

----------------------------------------------------------------------
 src/test/R/ChiSquareDistributionTestCases.R     |  8 +--
 src/test/R/FDistributionTestCases.R             |  8 +--
 src/test/R/GammaDistributionTestCases.R         |  8 +--
 .../R/KolmogorovSmirnovDistributionTestCases.R  |  6 +-
 src/test/R/LevyDistributionTestCases.R          |  4 +-
 src/test/R/README.txt                           | 72 ++++++++++----------
 src/test/R/TDistributionTestCases.R             |  8 +--
 src/test/R/TTestCases                           | 20 +++---
 src/test/R/WeibullDistributionTestCases.R       |  8 +--
 src/test/R/anovaTestCases                       |  8 +--
 src/test/R/binomialTestCases                    |  8 +--
 src/test/R/cauchyTestCases.R                    |  6 +-
 src/test/R/chiSquareTestCases                   | 20 +++---
 src/test/R/correlationTestCases                 | 16 ++---
 src/test/R/covarianceTestCases                  | 16 ++---
 src/test/R/descriptiveTestCases                 |  6 +-
 src/test/R/exponentialTestCases                 |  8 +--
 src/test/R/geometricTestCases                   | 10 +--
 src/test/R/hypergeometricTestCases              | 12 ++--
 src/test/R/multipleOLSRegressionTestCases       | 32 ++++-----
 src/test/R/normalTestCases                      |  8 +--
 src/test/R/pascalTestCases                      |  6 +-
 src/test/R/poissonTestCases                     | 12 ++--
 src/test/R/regressionTestCases                  | 24 +++----
 src/test/R/testAll                              |  2 +-
 src/test/R/testFunctions                        |  6 +-
 src/test/R/zipfTestCases                        |  6 +-
 27 files changed, 174 insertions(+), 174 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/35f32170/src/test/R/ChiSquareDistributionTestCases.R
----------------------------------------------------------------------
diff --git a/src/test/R/ChiSquareDistributionTestCases.R b/src/test/R/ChiSquareDistributionTestCases.R
index 78929ef..3df58ba 100644
--- a/src/test/R/ChiSquareDistributionTestCases.R
+++ b/src/test/R/ChiSquareDistributionTestCases.R
@@ -40,7 +40,7 @@ verifyDistribution <- function(points, expected, df, tol) {
         displayPadded(output, SUCCEEDED, WIDTH)
     } else {
         displayPadded(output, FAILED, WIDTH)
-    }       
+    }
 }
 
 # function to verify density computations
@@ -56,7 +56,7 @@ verifyDensity <- function(points, expected, df, tol) {
         displayPadded(output, SUCCEEDED, WIDTH)
     } else {
         displayPadded(output, FAILED, WIDTH)
-    }       
+    }
 }
 
 # function to verify quantiles
@@ -72,7 +72,7 @@ verifyQuantiles <- function(points, expected, df, tol) {
         displayPadded(output, SUCCEEDED, WIDTH)
     } else {
         displayPadded(output, FAILED, WIDTH)
-    }    
+    }
 }
 
 #--------------------------------------------------------------------------
@@ -83,7 +83,7 @@ distributionValues <- c(0.001, 0.01, 0.025, 0.05, 0.1, 0.999, 0.990, 0.975, 0.95
 densityValues <- c(0.0115379817652, 0.0415948507811, 0.0665060119842, 0.0919455953114, 0.121472591024,
                  0.000433630076361, 0.00412780610309, 0.00999340341045, 0.0193246438937, 0.0368460089216)
 distributionPoints <- c(0.210212602629, 0.554298076728, 0.831211613487, 1.14547622606, 1.61030798696,
-                20.5150056524, 15.0862724694, 12.8325019940, 11.0704976935, 9.23635689978)              
+                20.5150056524, 15.0862724694, 12.8325019940, 11.0704976935, 9.23635689978)
 verifyQuantiles(distributionValues, distributionPoints, df, tol)
 verifyDistribution(distributionPoints, distributionValues, df, tol)
 verifyDensity(distributionPoints, densityValues, df, tol)

http://git-wip-us.apache.org/repos/asf/commons-math/blob/35f32170/src/test/R/FDistributionTestCases.R
----------------------------------------------------------------------
diff --git a/src/test/R/FDistributionTestCases.R b/src/test/R/FDistributionTestCases.R
index e5f3656..ee7c199 100644
--- a/src/test/R/FDistributionTestCases.R
+++ b/src/test/R/FDistributionTestCases.R
@@ -40,7 +40,7 @@ verifyDistribution <- function(points, expected, numeratorDf, denominatorDf, tol
         displayPadded(output, SUCCEEDED, WIDTH)
     } else {
         displayPadded(output, FAILED, WIDTH)
-    }       
+    }
 }
 
 # function to verify density computations
@@ -56,7 +56,7 @@ verifyDensity <- function(points, expected, numeratorDf, denominatorDf, tol) {
         displayPadded(output, SUCCEEDED, WIDTH)
     } else {
         displayPadded(output, FAILED, WIDTH)
-    }       
+    }
 }
 
 # function to verify quantiles
@@ -72,7 +72,7 @@ verifyQuantiles <- function(points, expected, numeratorDf, denominatorDf, tol) {
         displayPadded(output, SUCCEEDED, WIDTH)
     } else {
         displayPadded(output, FAILED, WIDTH)
-    }    
+    }
 }
 
 #--------------------------------------------------------------------------
@@ -84,7 +84,7 @@ distributionValues <- c(0.001, 0.01, 0.025, 0.05, 0.1, 0.999, 0.990, 0.975, 0.95
 densityValues <- c(0.0689156576706, 0.236735653193, 0.364074131941, 0.481570789649, 0.595880479994,
                  0.000133443915657, 0.00286681303403, 0.00969192007502, 0.0242883861471, 0.0605491314658)
 distributionPoints <- c(0.0346808448626, 0.0937009113303, 0.143313661184, 0.202008445998, 0.293728320107,
-                20.8026639595, 8.74589525602, 5.98756512605, 4.38737418741, 3.10751166664)              
+                20.8026639595, 8.74589525602, 5.98756512605, 4.38737418741, 3.10751166664)
 verifyQuantiles(distributionValues, distributionPoints, numeratorDf, denominatorDf, tol)
 verifyDistribution(distributionPoints, distributionValues, numeratorDf, denominatorDf, tol)
 verifyDensity(distributionPoints, densityValues, numeratorDf, denominatorDf, tol)

http://git-wip-us.apache.org/repos/asf/commons-math/blob/35f32170/src/test/R/GammaDistributionTestCases.R
----------------------------------------------------------------------
diff --git a/src/test/R/GammaDistributionTestCases.R b/src/test/R/GammaDistributionTestCases.R
index 7cbefda..2ed7c95 100644
--- a/src/test/R/GammaDistributionTestCases.R
+++ b/src/test/R/GammaDistributionTestCases.R
@@ -40,7 +40,7 @@ verifyDistribution <- function(points, expected, alpha, beta, tol) {
         displayPadded(output, SUCCEEDED, WIDTH)
     } else {
         displayPadded(output, FAILED, WIDTH)
-    }       
+    }
 }
 
 # function to verify density computations
@@ -56,7 +56,7 @@ verifyDensity <- function(points, expected, alpha, beta, tol) {
         displayPadded(output, SUCCEEDED, WIDTH)
     } else {
         displayPadded(output, FAILED, WIDTH)
-    }       
+    }
 }
 
 # function to verify quantiles
@@ -72,7 +72,7 @@ verifyQuantiles <- function(points, expected, alpha, beta, tol) {
         displayPadded(output, SUCCEEDED, WIDTH)
     } else {
         displayPadded(output, FAILED, WIDTH)
-    }    
+    }
 }
 
 #--------------------------------------------------------------------------
@@ -84,7 +84,7 @@ distributionValues <- c(0.001, 0.01, 0.025, 0.05, 0.1, 0.999, 0.990, 0.975, 0.95
 densityValues <- c(0.00427280075546, 0.0204117166709, 0.0362756163658, 0.0542113174239, 0.0773195272491,
                    0.000394468852816, 0.00366559696761, 0.00874649473311, 0.0166712508128, 0.0311798227954)
 distributionPoints <- c(0.857104827257, 1.64649737269, 2.17973074725, 2.7326367935, 3.48953912565,
-                   26.1244815584, 20.0902350297, 17.5345461395, 15.5073130559, 13.3615661365)              
+                   26.1244815584, 20.0902350297, 17.5345461395, 15.5073130559, 13.3615661365)
 verifyQuantiles(distributionValues, distributionPoints, shape, scale, tol)
 verifyDistribution(distributionPoints, distributionValues, shape, scale, tol)
 verifyDensity(distributionPoints, densityValues, shape, scale, tol)

http://git-wip-us.apache.org/repos/asf/commons-math/blob/35f32170/src/test/R/KolmogorovSmirnovDistributionTestCases.R
----------------------------------------------------------------------
diff --git a/src/test/R/KolmogorovSmirnovDistributionTestCases.R b/src/test/R/KolmogorovSmirnovDistributionTestCases.R
index d458dcc..19f74b7 100644
--- a/src/test/R/KolmogorovSmirnovDistributionTestCases.R
+++ b/src/test/R/KolmogorovSmirnovDistributionTestCases.R
@@ -21,16 +21,16 @@ ps <- c(0.005, 0.02, 0.031111, 0.04)
 for (n in ns) {
   for (p in ps) {
     res <- .C("pkolmogorov2x", p = as.double(p), n = as.integer(n), PACKAGE = "stats")$p
-    
+
     cat("/* formatC(.C(\"pkolmogorov2x\", p = as.double(", p, "), n = as.integer(", n, "), PACKAGE = \"stats\")$p, 40) gives\n", sep = "")
     cat(" * ", formatC(res, digits = 40), "\n", sep = "")
     cat(" */\n")
-    
+
     cat("dist = new KolmogorovSmirnovDistributionImpl(", n, ");\n", sep = "")
     #cat("Assert.assertEquals(", formatC(res, digits = 40), ", dist.cdf(", p, ", true), TOLERANCE);\n", sep = "")
     cat("Assert.assertEquals(", formatC(res, digits = 40), ", dist.cdf(", p, ", false), TOLERANCE);\n", sep = "")
     cat("\n")
-    
+
     #cat("System.out.println(\"", formatC(res, digits = 20), " - \" + dist.cdf(", p, ", false) + \" = \" + (", res, " - dist.cdf(", p, ", false)));\n", sep = "")
   }
 }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/35f32170/src/test/R/LevyDistributionTestCases.R
----------------------------------------------------------------------
diff --git a/src/test/R/LevyDistributionTestCases.R b/src/test/R/LevyDistributionTestCases.R
index 7a6651f..95a2200 100644
--- a/src/test/R/LevyDistributionTestCases.R
+++ b/src/test/R/LevyDistributionTestCases.R
@@ -47,7 +47,7 @@ verifyDistribution <- function(points, expected, m, s, tol) {
         displayPadded(output, SUCCEEDED, WIDTH)
     } else {
         displayPadded(output, FAILED, WIDTH)
-    }       
+    }
 }
 
 # function to verify density computations
@@ -64,7 +64,7 @@ verifyDensity <- function(points, expected, m, s, tol) {
         displayPadded(output, SUCCEEDED, WIDTH)
     } else {
         displayPadded(output, FAILED, WIDTH)
-    }       
+    }
 }
 
 #--------------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/commons-math/blob/35f32170/src/test/R/README.txt
----------------------------------------------------------------------
diff --git a/src/test/R/README.txt b/src/test/R/README.txt
index c6549bc..eb83ecc 100644
--- a/src/test/R/README.txt
+++ b/src/test/R/README.txt
@@ -17,34 +17,34 @@
 
 INTRODUCTION
 
-The purpose of the R programs included in this directory is to validate 
-the target values used in Apache commons math unit tests. Success running the 
-R and commons-math tests on a platform (OS and R version) means that R and 
-commons-math give results for the test cases that are close in value.  The 
-tests include configurable tolerance levels; but care must be taken in changing 
-these, since in most cases the pre-set tolerance is close to the number of 
-decimal digits used in expressing the expected values (both here and in the 
+The purpose of the R programs included in this directory is to validate
+the target values used in Apache commons math unit tests. Success running the
+R and commons-math tests on a platform (OS and R version) means that R and
+commons-math give results for the test cases that are close in value.  The
+tests include configurable tolerance levels; but care must be taken in changing
+these, since in most cases the pre-set tolerance is close to the number of
+decimal digits used in expressing the expected values (both here and in the
 corresponding commons-math unit tests).
 
-Of course it is always possible that both R and commons-math give incorrect 
-values for test cases, so these tests should not be interpreted as definitive 
-in any absolute sense. The value of developing and running the tests is really  
-to generate questions (and answers!) when the two systems give different 
+Of course it is always possible that both R and commons-math give incorrect
+values for test cases, so these tests should not be interpreted as definitive
+in any absolute sense. The value of developing and running the tests is really
+to generate questions (and answers!) when the two systems give different
 results.
 
-Contributions of additional test cases (both R and Junit code) or just 
-R programs to validate commons-math tests that are not covered here would be 
+Contributions of additional test cases (both R and Junit code) or just
+R programs to validate commons-math tests that are not covered here would be
 greatly appreciated.
 
 SETUP
 
 0) Download and install R.  You can get R here
 http://www.r-project.org/
-Follow the install instructions and make sure that you can launch R from this  
-(i.e., either explitly add R to your OS path or let the install package do it 
-for you).  
+Follow the install instructions and make sure that you can launch R from this
+(i.e., either explitly add R to your OS path or let the install package do it
+for you).
 
-1) Launch R from this directory and type 
+1) Launch R from this directory and type
 > source("testAll")
 to an R prompt.  This should produce output to the console similar to this:
 
@@ -69,26 +69,26 @@ Distribution test mu = 0, sigma = 0.1..................................SUCCEEDED
 
 WORKING WITH THE TESTS
 
-The R distribution comes with online manuals that you can view by launching 
+The R distribution comes with online manuals that you can view by launching
 a browser instance and then entering
 
 > help.start()
 
-at an R prompt. Poking about in the test case files and the online docs should 
-bring you up to speed fairly quickly.  Here are some basic things to get 
-you started. I should note at this point that I am by no means an expert R 
-programmer, so some things may not be implemented in the the nicest way. 
+at an R prompt. Poking about in the test case files and the online docs should
+bring you up to speed fairly quickly.  Here are some basic things to get
+you started. I should note at this point that I am by no means an expert R
+programmer, so some things may not be implemented in the the nicest way.
 Comments / suggestions for improvement are welcome!
 
 All of the test cases use some basic functions and global constants (screen
-width and success / failure strings) defined in "testFunctions." The  
-R "source" function is used to "import" these functions into each of the test 
-programs.  The "testAll" program pulls together and executes all of the 
+width and success / failure strings) defined in "testFunctions." The
+R "source" function is used to "import" these functions into each of the test
+programs.  The "testAll" program pulls together and executes all of the
 individual test programs.  You can execute any one of them by just entering
 
 > source(<program-name>).
 
-The "assertEquals" function in the testFunctions file mimics the similarly 
+The "assertEquals" function in the testFunctions file mimics the similarly
 named function used by Junit:
 
 assertEquals <- function(expected, observed, tol, message) {
@@ -102,11 +102,11 @@ assertEquals <- function(expected, observed, tol, message) {
     }
 }
 
-The <expected> and <observed> arguments can be scalar values, vectors or 
+The <expected> and <observed> arguments can be scalar values, vectors or
 matrices. If the arguments are vectors or matrices, corresponding entries
 are compared.
 
-The standard pattern used throughout the tests looks like this (from 
+The standard pattern used throughout the tests looks like this (from
 binomialTestCases):
 
 Start by defining a "verification function" -- in this example a function to
@@ -129,11 +129,11 @@ verifyDensity <- function(points, expected, n, p, tol) {
         displayPadded(output, SUCCEEDED, WIDTH)
     } else {
         displayPadded(output, FAILED, WIDTH)
-    }       
+    }
 }
 
 The displayPadded function just displays its first and second arguments with
-enough dots in between to make the whole string WIDTH characters long. It is 
+enough dots in between to make the whole string WIDTH characters long. It is
 defined in testFunctions.
 
 Then call this function with different parameters corresponding to the different
@@ -143,7 +143,7 @@ size <- 10.0
 probability <- 0.70
 
 densityPoints <- c(-1,0,1,2,3,4,5,6,7,8,9,10,11)
-densityValues <- c(0, 0.0000, 0.0001, 0.0014, 0.0090, 0.0368, 0.1029, 
+densityValues <- c(0, 0.0000, 0.0001, 0.0014, 0.0090, 0.0368, 0.1029,
                 0.2001, 0.2668, 0.2335, 0.1211, 0.0282, 0)
 ...
 verifyDensity(densityPoints, densityValues, size, probability, tol)
@@ -153,16 +153,16 @@ produce one line of output to the console:
 
 Density test n = 10, p = 0.7...........................................SUCCEEDED
 
-If you modify the value of tol set at the top of binomialTestCases to make the 
-test more sensitive than the number of digits specified in the densityValues 
+If you modify the value of tol set at the top of binomialTestCases to make the
+test more sensitive than the number of digits specified in the densityValues
 vector, it will fail, producing the following output, showing the failure and
 the expected and observed values:
 
-FAILURE:  Density Values 
+FAILURE:  Density Values
 EXPECTED:  0 0 1e-04 0.0014 0.009 0.0368 0.1029 0.2001 0.2668 0.2335 0.1211 /
- 0.0282 0 
+ 0.0282 0
 OBSERVED:  0 5.9049e-06 0.000137781 0.0014467005 0.009001692 0.036756909 /
-0.1029193452 0.200120949 0.266827932 0.2334744405 0.121060821 0.0282475249 0 
+0.1029193452 0.200120949 0.266827932 0.2334744405 0.121060821 0.0282475249 0
 Density test n = 10, p = 0.7..............................................FAILED
 
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/35f32170/src/test/R/TDistributionTestCases.R
----------------------------------------------------------------------
diff --git a/src/test/R/TDistributionTestCases.R b/src/test/R/TDistributionTestCases.R
index 723e958..6f91269 100644
--- a/src/test/R/TDistributionTestCases.R
+++ b/src/test/R/TDistributionTestCases.R
@@ -40,7 +40,7 @@ verifyDistribution <- function(points, expected, df, tol) {
         displayPadded(output, SUCCEEDED, WIDTH)
     } else {
         displayPadded(output, FAILED, WIDTH)
-    }       
+    }
 }
 
 # function to verify density computations
@@ -56,7 +56,7 @@ verifyDensity <- function(points, expected, df, tol) {
         displayPadded(output, SUCCEEDED, WIDTH)
     } else {
         displayPadded(output, FAILED, WIDTH)
-    }       
+    }
 }
 
 # function to verify quantiles
@@ -72,7 +72,7 @@ verifyQuantiles <- function(points, expected, df, tol) {
         displayPadded(output, SUCCEEDED, WIDTH)
     } else {
         displayPadded(output, FAILED, WIDTH)
-    }    
+    }
 }
 
 #--------------------------------------------------------------------------
@@ -83,7 +83,7 @@ distributionValues <- c(0.001, 0.01, 0.025, 0.05, 0.1, 0.999, 0.990, 0.975, 0.95
 densityValues <- c(0.000756494565517, 0.0109109752919, 0.0303377878006, 0.0637967988952, 0.128289492005,
                 0.000756494565517, 0.0109109752919, 0.0303377878006, 0.0637967988952, 0.128289492005)
 distributionPoints <- c(-5.89342953136, -3.36492999891, -2.57058183564, -2.01504837333, -1.47588404882,
-                5.89342953136, 3.36492999891, 2.57058183564, 2.01504837333, 1.47588404882)              
+                5.89342953136, 3.36492999891, 2.57058183564, 2.01504837333, 1.47588404882)
 verifyQuantiles(distributionValues, distributionPoints, df, tol)
 verifyDistribution(distributionPoints, distributionValues, df, tol)
 verifyDensity(distributionPoints, densityValues, df, tol)

http://git-wip-us.apache.org/repos/asf/commons-math/blob/35f32170/src/test/R/TTestCases
----------------------------------------------------------------------
diff --git a/src/test/R/TTestCases b/src/test/R/TTestCases
index 6aa5e2d..38adf7b 100644
--- a/src/test/R/TTestCases
+++ b/src/test/R/TTestCases
@@ -27,14 +27,14 @@
 # Arguments
 #   x  a numeric vector of data values.
 #   y  an optional numeric vector data values.
-#   alternative 	a character string specifying the alternative hypothesis, 
+#   alternative 	a character string specifying the alternative hypothesis,
 #     must be one of "two.sided" (default), "greater" or "less". You can specify
 #     just the initial letter.
 #   mu  a number indicating the true value of the mean (or difference in means
 #      if you are performing a two sample test).
 #   paired 	a logical indicating whether you want a paired t-test.
 #   var.equal 	a logical variable indicating whether to treat the two
-#     variances as being equal. 
+#     variances as being equal.
 #     If TRUE then the pooled variance is used to estimate the variance,
 #     otherwise the Welch (or Satterthwaite) approximation to the degrees
 #     of freedom is used.
@@ -54,14 +54,14 @@ verifyTest <- function(out,expectedP, expectedT,
      displayPadded(output, SUCCEEDED, 80)
   } else {
      displayPadded(output, FAILED, 80)
-  }  
-  output <- c("t test test statistic") 
+  }
+  output <- c("t test test statistic")
   if (assertEquals(expectedT, out$statistic, tol,
       "Ttest t statistic")) {
       displayPadded(output, SUCCEEDED, 80)
   } else {
       displayPadded(output, FAILED, 80)
-  }          
+  }
   displayDashes(WIDTH)
 }
 
@@ -71,14 +71,14 @@ sample1 <- c(93.0, 103.0, 95.0, 101.0, 91.0, 105.0, 96.0, 94.0, 101.0,  88.0,
 out <- t.test(sample1, mu=100.0)
 expectedP <-  0.0136390585873
 expectedT<- -2.81976445346
-verifyTest(out,expectedP, expectedT, tol) 
+verifyTest(out,expectedP, expectedT, tol)
 
 cat("One-sample, one-sided TTest test cases \n")
 sample1 <- c(2, 0, 6, 6, 3, 3, 2, 3, -6, 6, 6, 6, 3, 0, 1, 1, 0, 2, 3, 3)
 out <- t.test(sample1, mu=0.0, alternative="g")
 expectedP <-  0.000521637019637
 expectedT<- 3.86485535541
-verifyTest(out,expectedP, expectedT, tol) 
+verifyTest(out,expectedP, expectedT, tol)
 
 cat("Homoscedastic TTest test cases \n")
 sample1 <- c(2, 4, 6, 8, 10, 97)
@@ -87,10 +87,10 @@ out <- t.test(sample1,sample2,var.equal = TRUE)
 expectedP <-  0.4833963785
 expectedT<- 0.73096310086
 verifyTest(out,expectedP, expectedT, tol)
- 
+
 cat("Heteroscedastic TTest test cases \n")
 sample1 <- c(7, -4, 18, 17, -3, -5, 1, 10, 11, -2)
-sample2 <- c(-1, 12, -1, -3, 3, -5, 5, 2, -11, -1, -3) 
+sample2 <- c(-1, 12, -1, -3, 3, -5, 5, 2, -11, -1, -3)
 out <- t.test(sample1,sample2,var.equal = FALSE)
 expectedP <-  0.128839369622
 expectedT<- 1.60371728768
@@ -103,4 +103,4 @@ out <- t.test(sample1,sample2,var.equal = FALSE)
 expectedP <-  0.198727388935
 expectedT<- -2.2360679775
 verifyTest(out,expectedP, expectedT, tol)
- 
+

http://git-wip-us.apache.org/repos/asf/commons-math/blob/35f32170/src/test/R/WeibullDistributionTestCases.R
----------------------------------------------------------------------
diff --git a/src/test/R/WeibullDistributionTestCases.R b/src/test/R/WeibullDistributionTestCases.R
index fadc625..7228641 100644
--- a/src/test/R/WeibullDistributionTestCases.R
+++ b/src/test/R/WeibullDistributionTestCases.R
@@ -40,7 +40,7 @@ verifyDistribution <- function(points, expected, alpha, beta, tol) {
         displayPadded(output, SUCCEEDED, WIDTH)
     } else {
         displayPadded(output, FAILED, WIDTH)
-    }       
+    }
 }
 
 # function to verify density computations
@@ -56,7 +56,7 @@ verifyDensity <- function(points, expected, alpha, beta, tol) {
         displayPadded(output, SUCCEEDED, WIDTH)
     } else {
         displayPadded(output, FAILED, WIDTH)
-    }       
+    }
 }
 
 # function to verify quantiles
@@ -72,7 +72,7 @@ verifyQuantiles <- function(points, expected, alpha, beta, tol) {
         displayPadded(output, SUCCEEDED, WIDTH)
     } else {
         displayPadded(output, FAILED, WIDTH)
-    }    
+    }
 }
 
 #--------------------------------------------------------------------------
@@ -84,7 +84,7 @@ distributionValues <- c(0.001, 0.01, 0.025, 0.05, 0.1, 0.999, 0.990, 0.975, 0.95
 densityValues <- c(0.180535929306, 0.262801138133, 0.301905425199, 0.330899152971, 0.353441418887, 0.000788590320203,
                  0.00737060094841, 0.0177576041516, 0.0343043442574, 0.065664589369)
 distributionPoints <- c(0.00664355180993, 0.0454328283309, 0.0981162737374, 0.176713524579, 0.321946865392,
-                 10.5115496887, 7.4976304671, 6.23205600701, 5.23968436955, 4.20790282578)              
+                 10.5115496887, 7.4976304671, 6.23205600701, 5.23968436955, 4.20790282578)
 verifyQuantiles(distributionValues, distributionPoints, shape, scale, tol)
 verifyDistribution(distributionPoints, distributionValues, shape, scale, tol)
 verifyDensity(distributionPoints, densityValues, shape, scale, tol)

http://git-wip-us.apache.org/repos/asf/commons-math/blob/35f32170/src/test/R/anovaTestCases
----------------------------------------------------------------------
diff --git a/src/test/R/anovaTestCases b/src/test/R/anovaTestCases
index 077ba09..1c1dd7c 100644
--- a/src/test/R/anovaTestCases
+++ b/src/test/R/anovaTestCases
@@ -43,13 +43,13 @@ verifyAnova <- function(frame, expectedP, expectedF, frameName) {
         displayPadded(output, SUCCEEDED, WIDTH)
     } else {
         displayPadded(output, FAILED, WIDTH)
-    }  
+    }
     output <- c("F-value test frame = ", frameName)
     if (assertEquals(expectedF,f,tol,"F value")) {
         displayPadded(output, SUCCEEDED, WIDTH)
     } else {
         displayPadded(output, FAILED, WIDTH)
-    }           
+    }
 }
 
 #--------------------------------------------------------------------------
@@ -63,10 +63,10 @@ class=c(rep("classA", length(classA)),
         rep("classB", length(classB)),
         rep("classC", length(classC))))
 
-verifyAnova(threeClasses,6.959446e-06,  24.67361709460624, "Three classes") 
+verifyAnova(threeClasses,6.959446e-06,  24.67361709460624, "Three classes")
 
 twoClasses = data.frame(val = c(classA, classB),
 class=c(rep("classA", length(classA)), rep("classB", length(classB))))
 verifyAnova(twoClasses, 0.904212960464, 0.0150579150579, "Two classes")
 
-displayDashes(WIDTH)
\ No newline at end of file
+displayDashes(WIDTH)

http://git-wip-us.apache.org/repos/asf/commons-math/blob/35f32170/src/test/R/binomialTestCases
----------------------------------------------------------------------
diff --git a/src/test/R/binomialTestCases b/src/test/R/binomialTestCases
index 6b1871c..144a221 100644
--- a/src/test/R/binomialTestCases
+++ b/src/test/R/binomialTestCases
@@ -46,7 +46,7 @@ verifyDensity <- function(points, expected, n, p, tol) {
         displayPadded(output, SUCCEEDED, WIDTH)
     } else {
         displayPadded(output, FAILED, WIDTH)
-    }       
+    }
 }
 
 # function to verify distribution computations
@@ -63,7 +63,7 @@ verifyDistribution <- function(points, expected, n, p, tol) {
         displayPadded(output, SUCCEEDED, WIDTH)
     } else {
         displayPadded(output, FAILED, WIDTH)
-    }       
+    }
 }
 
 #--------------------------------------------------------------------------
@@ -73,7 +73,7 @@ size <- 10.0
 probability <- 0.70
 
 densityPoints <- c(-1,0,1,2,3,4,5,6,7,8,9,10,11)
-densityValues <- c(0, 0.0000, 0.0001, 0.0014, 0.0090, 0.0368, 0.1029, 
+densityValues <- c(0, 0.0000, 0.0001, 0.0014, 0.0090, 0.0368, 0.1029,
                 0.2001, 0.2668, 0.2335, 0.1211, 0.0282, 0)
 distributionValues <- c(0, 0.0000, 0.0001, 0.0016, 0.0106, 0.0473,
                 0.1503, 0.3504, 0.6172, 0.8507, 0.9718, 1, 1)
@@ -98,7 +98,7 @@ if (assertEquals(inverseCumValues, rInverseCumValues-1, tol,
     displayPadded(output, SUCCEEDED, 80)
 } else {
     displayPadded(output, FAILED, 80)
-}       
+}
 
 # Degenerate cases
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/35f32170/src/test/R/cauchyTestCases.R
----------------------------------------------------------------------
diff --git a/src/test/R/cauchyTestCases.R b/src/test/R/cauchyTestCases.R
index b046ca5..d0fe442 100644
--- a/src/test/R/cauchyTestCases.R
+++ b/src/test/R/cauchyTestCases.R
@@ -42,7 +42,7 @@ verifyDistribution <- function(points, expected, median, scale, tol) {
         displayPadded(output, SUCCEEDED, WIDTH)
     } else {
         displayPadded(output, FAILED, WIDTH)
-    }       
+    }
 }
 
 # function to verify density computations
@@ -59,7 +59,7 @@ verifyDensity <- function(points, expected, median, scale, tol) {
         displayPadded(output, SUCCEEDED, WIDTH)
     } else {
         displayPadded(output, FAILED, WIDTH)
-    }       
+    }
 }
 
 # function to verify quantiles
@@ -76,7 +76,7 @@ verifyQuantiles <- function(points, expected, median, scale, tol) {
         displayPadded(output, SUCCEEDED, WIDTH)
     } else {
         displayPadded(output, FAILED, WIDTH)
-    }    
+    }
 }
 
 #--------------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/commons-math/blob/35f32170/src/test/R/chiSquareTestCases
----------------------------------------------------------------------
diff --git a/src/test/R/chiSquareTestCases b/src/test/R/chiSquareTestCases
index 747b5e8..be6eb84 100644
--- a/src/test/R/chiSquareTestCases
+++ b/src/test/R/chiSquareTestCases
@@ -38,16 +38,16 @@ verifyTable <- function(counts, expectedP, expectedStat, tol, desc) {
         displayPadded(c(desc," p-value test"), SUCCEEDED, WIDTH)
     } else {
         displayPadded(c(desc, " p-value test"), FAILED, WIDTH)
-    } 
+    }
     if (assertEquals(expectedStat, results$statistic, tol,
        "ChiSquare Statistic")) {
         displayPadded(c(desc, " chi-square statistic test"), SUCCEEDED, WIDTH)
     } else {
         displayPadded(c(desc, " chi-square statistic test"), FAILED, WIDTH)
-    } 
+    }
 }
 
-verifyHomogeneity <- function(obs, exp, expectedP, expectedStat, 
+verifyHomogeneity <- function(obs, exp, expectedP, expectedStat,
   tol, desc) {
     results <- chisq.test(obs,p=exp,rescale.p=TRUE)
     chi <- results$statistic
@@ -56,13 +56,13 @@ verifyHomogeneity <- function(obs, exp, expectedP, expectedStat,
         displayPadded(c(desc, " p-value test"), SUCCEEDED, WIDTH)
     } else {
         displayPadded(c(desc, " p-value test"), FAILED, WIDTH)
-    } 
+    }
     if (assertEquals(expectedStat, chi, tol,
        "ChiSquare Statistic")) {
         displayPadded(c(desc, " chi-square statistic test"), SUCCEEDED, WIDTH)
     } else {
         displayPadded(c(desc, " chi-square statistic test"), FAILED, WIDTH)
-    }    
+    }
 }
 
 cat("ChiSquareTest test cases\n")
@@ -85,17 +85,17 @@ verifyHomogeneity(observed, expected, 0, 114875.90421929007, tol,
    "testChiSquareLargeTestStatistic")
 
 counts <- matrix(c(40, 22, 43, 91, 21, 28, 60, 10, 22), nc = 3);
-verifyTable(counts, 0.000144751460134, 22.709027688, tol, 
+verifyTable(counts, 0.000144751460134, 22.709027688, tol,
    "testChiSquareIndependence1")
 
 counts <- matrix(c(10, 15, 30, 40, 60, 90), nc = 3);
-verifyTable(counts, 0.918987499852, 0.168965517241, tol,  
+verifyTable(counts, 0.918987499852, 0.168965517241, tol,
    "testChiSquareIndependence2")
- 
+
 counts <- matrix(c(40, 0, 4, 91, 1, 2, 60, 2, 0), nc = 3);
-verifyTable(counts, 0.0462835770603, 9.67444662263, tol,  
+verifyTable(counts, 0.0462835770603, 9.67444662263, tol,
   "testChiSquareZeroCount")
 
 displayDashes(WIDTH)
-            
+
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/35f32170/src/test/R/correlationTestCases
----------------------------------------------------------------------
diff --git a/src/test/R/correlationTestCases b/src/test/R/correlationTestCases
index caacd5f..07fdb27 100644
--- a/src/test/R/correlationTestCases
+++ b/src/test/R/correlationTestCases
@@ -37,7 +37,7 @@ verifyPearsonsCorrelation <- function(matrix, expectedCorrelation, name) {
         displayPadded(output, SUCCEEDED, WIDTH)
     } else {
         displayPadded(output, FAILED, WIDTH)
-    }  
+    }
 }
 
 # Verify Spearman's correlation
@@ -48,7 +48,7 @@ verifySpearmansCorrelation <- function(matrix, expectedCorrelation, name) {
         displayPadded(output, SUCCEEDED, WIDTH)
     } else {
         displayPadded(output, FAILED, WIDTH)
-    }  
+    }
 }
 
 # Verify Kendall's correlation
@@ -59,7 +59,7 @@ verifyKendallsCorrelation <- function(matrix, expectedCorrelation, name) {
         displayPadded(output, SUCCEEDED, WIDTH)
     } else {
         displayPadded(output, FAILED, WIDTH)
-    }  
+    }
 }
 
 # function to verify p-values
@@ -133,16 +133,16 @@ expectedCorrelation <- matrix(c(
           0.4172451498349454, 0.993952846232926, 1.0000000000000000),
           nrow = 7, ncol = 7, byrow = TRUE)
  verifyPearsonsCorrelation(longley, expectedCorrelation, "longley")
- 
+
  expectedPValues <- c(
           4.38904690369668e-10,
           8.36353208910623e-12, 7.8159700933611e-14,
-          0.0472894097790304, 0.01030636128354301, 0.01316878049026582, 
+          0.0472894097790304, 0.01030636128354301, 0.01316878049026582,
           0.0749178049642416, 0.06971758330341182, 0.0830166169296545, 0.510948586323452,
-          3.693245043123738e-09, 4.327782576751815e-11, 1.167954621905665e-13, 0.00331028281967516, 0.1652293725106684, 
+          3.693245043123738e-09, 4.327782576751815e-11, 1.167954621905665e-13, 0.00331028281967516, 0.1652293725106684,
           3.95834476307755e-10, 1.114663916723657e-13, 1.332267629550188e-15, 0.00466039138541463, 0.1078477071581498, 7.771561172376096e-15)
  verifyPValues(longley, expectedPValues, "longley")
- 
+
 # Spearman's
 expectedCorrelation <- matrix(c(
           1, 0.982352941176471, 0.985294117647059, 0.564705882352941, 0.2264705882352941, 0.976470588235294,
@@ -218,7 +218,7 @@ expectedCorrelation <- matrix(c(
   44.7,46.6,16,29,50.43,
   42.8,27.7,22,29,58.33),
   nrow = 47, ncol = 5, byrow = TRUE)
-  
+
 # Pearson's
   expectedCorrelation <- matrix(c(
           1, 0.3530791836199747, -0.6458827064572875, -0.663788857035069, 0.463684700651794,

http://git-wip-us.apache.org/repos/asf/commons-math/blob/35f32170/src/test/R/covarianceTestCases
----------------------------------------------------------------------
diff --git a/src/test/R/covarianceTestCases b/src/test/R/covarianceTestCases
index 3d8d603..eca5d0b 100644
--- a/src/test/R/covarianceTestCases
+++ b/src/test/R/covarianceTestCases
@@ -37,7 +37,7 @@ verifyCovariance <- function(matrix, expectedCovariance, name) {
         displayPadded(output, SUCCEEDED, WIDTH)
     } else {
         displayPadded(output, FAILED, WIDTH)
-    }  
+    }
 }
 
 #--------------------------------------------------------------------------
@@ -79,11 +79,11 @@ expectedCovariance <- matrix(c(
          16240.93333333333, 5.092333333333334e+01, 470977.900000000,
          2973.033333333333, 1382.433333333333, 32917.40000000, 22.66666666666667),
          nrow = 7, ncol = 7, byrow = TRUE)
-         
+
  verifyCovariance(longley, expectedCovariance, "longley")
- 
+
  # Swiss Fertility
- 
+
  fertility <- matrix(c(80.2,17.0,15,12,9.96,
   83.1,45.1,6,9,84.84,
   92.5,39.7,5,5,93.40,
@@ -132,7 +132,7 @@ expectedCovariance <- matrix(c(
   44.7,46.6,16,29,50.43,
   42.8,27.7,22,29,58.33),
   nrow = 47, ncol = 5, byrow = TRUE)
-   
+
  expectedCovariance <- matrix(c(
          156.0424976873265, 100.1691489361702, -64.36692876965772, -79.7295097132285, 241.5632030527289,
          100.169148936170251, 515.7994172062905, -124.39283071230344, -139.6574005550416, 379.9043755781684,
@@ -140,7 +140,7 @@ expectedCovariance <- matrix(c(
          -79.7295097132285, -139.6574005550416, 53.57585568917669, 92.4560592044403, -61.6988297872340,
           241.5632030527289, 379.9043755781684, -190.56061054579092, -61.6988297872340, 1739.2945371877890),
           nrow = 5, ncol = 5, byrow = TRUE)
-      
+
  verifyCovariance(fertility, expectedCovariance, "swiss fertility")
- 
- displayDashes(WIDTH)
\ No newline at end of file
+
+ displayDashes(WIDTH)

http://git-wip-us.apache.org/repos/asf/commons-math/blob/35f32170/src/test/R/descriptiveTestCases
----------------------------------------------------------------------
diff --git a/src/test/R/descriptiveTestCases b/src/test/R/descriptiveTestCases
index c724567..f6a6183 100644
--- a/src/test/R/descriptiveTestCases
+++ b/src/test/R/descriptiveTestCases
@@ -38,7 +38,7 @@ verifyMean <- function(values, expectedMean, tol, desc) {
         displayPadded(c(desc," mean test"), SUCCEEDED, WIDTH)
     } else {
         displayPadded(c(desc, " mean test"), FAILED, WIDTH)
-    } 
+    }
 }
 
 verifySigma <- function(values, expectedSigma, tol, desc) {
@@ -47,7 +47,7 @@ verifySigma <- function(values, expectedSigma, tol, desc) {
         displayPadded(c(desc," std test"), SUCCEEDED, WIDTH)
     } else {
         displayPadded(c(desc, " std test"), FAILED, WIDTH)
-    } 
+    }
 }
 
 cat("Descriptive test cases\n")
@@ -80,4 +80,4 @@ expectedSigma <- 0.000429123454003053
 verifyMean(values, expectedMean, tol, "Mavro")
 verifySigma(values, expectedSigma, tol, "Mavro")
 
-displayDashes(WIDTH)        
+displayDashes(WIDTH)

http://git-wip-us.apache.org/repos/asf/commons-math/blob/35f32170/src/test/R/exponentialTestCases
----------------------------------------------------------------------
diff --git a/src/test/R/exponentialTestCases b/src/test/R/exponentialTestCases
index 25f801a..c73e6dd 100644
--- a/src/test/R/exponentialTestCases
+++ b/src/test/R/exponentialTestCases
@@ -42,7 +42,7 @@ verifyDistribution <- function(points, expected, mean, tol) {
         displayPadded(output, SUCCEEDED, WIDTH)
     } else {
         displayPadded(output, FAILED, WIDTH)
-    }       
+    }
 }
 
 # function to verify density computations
@@ -58,7 +58,7 @@ verifyDensity <- function(points, expected, mean, tol) {
         displayPadded(output, SUCCEEDED, WIDTH)
     } else {
         displayPadded(output, FAILED, WIDTH)
-    }       
+    }
 }
 
 # function to verify quantiles
@@ -74,7 +74,7 @@ verifyQuantiles <- function(points, expected, mean, tol) {
         displayPadded(output, SUCCEEDED, WIDTH)
     } else {
         displayPadded(output, FAILED, WIDTH)
-    }    
+    }
 }
 
 
@@ -98,6 +98,6 @@ if (assertEquals(0.0905214480757, pexp(.75, 1/mean) - pexp(.25, 1/mean), tol, "P
     displayPadded(output, SUCCEEDED, WIDTH)
 } else {
     displayPadded(output, FAILED, WIDTH)
-}      
+}
 
 displayDashes(WIDTH)

http://git-wip-us.apache.org/repos/asf/commons-math/blob/35f32170/src/test/R/geometricTestCases
----------------------------------------------------------------------
diff --git a/src/test/R/geometricTestCases b/src/test/R/geometricTestCases
index 0c2293f..96ca82e 100644
--- a/src/test/R/geometricTestCases
+++ b/src/test/R/geometricTestCases
@@ -22,7 +22,7 @@
 # source("<name-of-this-file>")
 #
 # R functions used
-# dgeom(x, prob, log = FALSE) <- density 
+# dgeom(x, prob, log = FALSE) <- density
 # pgeom(q, prob, lower.tail = TRUE, log.p = FALSE) <- distribution
 # qgeom(p, prob, lower.tail = TRUE, log.p = FALSE) <- quantiles
 #------------------------------------------------------------------------------
@@ -46,7 +46,7 @@ verifyDensity <- function(points, expected, prob, tol, log = FALSE) {
         displayPadded(output, SUCCEEDED, WIDTH)
     } else {
         displayPadded(output, FAILED, WIDTH)
-    }       
+    }
 }
 
 # function to verify distribution computations
@@ -63,7 +63,7 @@ verifyDistribution <- function(points, expected, prob, tol) {
         displayPadded(output, SUCCEEDED, WIDTH)
     } else {
         displayPadded(output, FAILED, WIDTH)
-    }       
+    }
 }
 
 #--------------------------------------------------------------------------
@@ -79,7 +79,7 @@ densityValues <- c(0, 0.4, 0.24, 0.144, 0.0864, 0.05184, 0.031104, 0.0186624, 0.
                    0.000313456656384, 0.0001880739938304, 0.00011284439629824, 6.7706637778944e-05,
                    4.06239826673664e-05, 2.43743896004198e-05, 1.46246337602519e-05, 8.77478025615113e-06,
                    5.26486815369068e-06, 3.15892089221441e-06, 1.89535253532865e-06, 1.13721152119719e-06,
-                   6.82326912718312e-07, 4.09396147630988e-07, 2.45637688578593e-07) 
+                   6.82326912718312e-07, 4.09396147630988e-07, 2.45637688578593e-07)
 logDensityValues <- c(-Inf, -0.916290731874155, -1.42711635564015, -1.93794197940614, -2.44876760317213,
                       -2.95959322693812, -3.47041885070411, -3.9812444744701, -4.49207009823609,
                       -5.00289572200208, -5.51372134576807, -6.02454696953406, -6.53537259330005,
@@ -116,6 +116,6 @@ if (assertEquals(inverseCumValues, rInverseCumValues-1, tol,
     displayPadded(output, SUCCEEDED, 80)
 } else {
     displayPadded(output, FAILED, 80)
-}       
+}
 
 displayDashes(WIDTH)

http://git-wip-us.apache.org/repos/asf/commons-math/blob/35f32170/src/test/R/hypergeometricTestCases
----------------------------------------------------------------------
diff --git a/src/test/R/hypergeometricTestCases b/src/test/R/hypergeometricTestCases
index a1d4ee9..04bc8a0 100644
--- a/src/test/R/hypergeometricTestCases
+++ b/src/test/R/hypergeometricTestCases
@@ -22,7 +22,7 @@
 # source("<name-of-this-file>")
 #
 # R functions used
-# dhyper(x, m, n, k, log = FALSE) <- density 
+# dhyper(x, m, n, k, log = FALSE) <- density
 # phyper(q, m, n, k, lower.tail = TRUE, log.p = FALSE) <- distribution
 # qhyper(p, m, n, k, lower.tail = TRUE, log.p = FALSE) <- quantiles
 #------------------------------------------------------------------------------
@@ -41,13 +41,13 @@ verifyDensity <- function(points, expected, good, bad, selected, tol, log = FALS
         i <- i + 1
         rDensityValues[i] <- dhyper(point, good, bad, selected, log)
     }
-    output <- c("Density test good = ", good, ", bad = ", bad, 
+    output <- c("Density test good = ", good, ", bad = ", bad,
                 ", selected = ",selected)
     if (assertEquals(expected,rDensityValues,tol,"Density Values")) {
         displayPadded(output, SUCCEEDED, WIDTH)
     } else {
         displayPadded(output, FAILED, WIDTH)
-    }       
+    }
 }
 
 # function to verify distribution computations
@@ -65,7 +65,7 @@ verifyDistribution <- function(points, expected, good, bad, selected, tol) {
         displayPadded(output, SUCCEEDED, WIDTH)
     } else {
         displayPadded(output, FAILED, WIDTH)
-    }       
+    }
 }
 
 #--------------------------------------------------------------------------
@@ -98,7 +98,7 @@ for (point in inverseCumPoints) {
   rInverseCumValues[i] <- qhyper(point, good, bad, selected)
 }
 
-output <- c("Inverse Distribution test good = ", good, ", bad = ", bad, 
+output <- c("Inverse Distribution test good = ", good, ", bad = ", bad,
             ", selected = ", selected)
 # R defines quantiles from the right, need to subtract one
 if (assertEquals(inverseCumValues, rInverseCumValues-1, tol,
@@ -106,7 +106,7 @@ if (assertEquals(inverseCumValues, rInverseCumValues-1, tol,
     displayPadded(output, SUCCEEDED, 80)
 } else {
     displayPadded(output, FAILED, 80)
-}       
+}
 
 # Degenerate cases
 good <- 5

http://git-wip-us.apache.org/repos/asf/commons-math/blob/35f32170/src/test/R/multipleOLSRegressionTestCases
----------------------------------------------------------------------
diff --git a/src/test/R/multipleOLSRegressionTestCases b/src/test/R/multipleOLSRegressionTestCases
index 1fe983d..458426f 100644
--- a/src/test/R/multipleOLSRegressionTestCases
+++ b/src/test/R/multipleOLSRegressionTestCases
@@ -44,13 +44,13 @@ verifyRegression <- function(model, expectedBeta, expectedResiduals,
         displayPadded(output, SUCCEEDED, WIDTH)
     } else {
         displayPadded(output, FAILED, WIDTH)
-    }  
+    }
     output <- c("Residuals test dataset = ", modelName)
     if (assertEquals(expectedResiduals,residuals,tol,"Residuals")) {
         displayPadded(output, SUCCEEDED, WIDTH)
     } else {
         displayPadded(output, FAILED, WIDTH)
-    }    
+    }
     output <- c("Errors test dataset = ", modelName)
     if (assertEquals(expectedErrors,errors,tol,"Errors")) {
         displayPadded(output, SUCCEEDED, WIDTH)
@@ -95,13 +95,13 @@ expectedStdError <- NaN
 expectedRSquare <- 1
 expectedAdjRSquare <- NaN
 verifyRegression(model, expectedBeta, expectedResiduals, expectedErrors,
- expectedStdError, expectedRSquare, expectedAdjRSquare, "perfect fit") 
+ expectedStdError, expectedRSquare, expectedAdjRSquare, "perfect fit")
 
 # Longley
 #
 # Data Source: J. Longley (1967) "An Appraisal of Least Squares Programs for the
-# Electronic Computer from the Point of View of the User", 
-# Journal of the American Statistical Association, 
+# Electronic Computer from the Point of View of the User",
+# Journal of the American Statistical Association,
 # vol. 62. September, pp. 819-841.
 #
 # Certified values (and data) are from NIST:
@@ -154,16 +154,16 @@ expectedRSquare <- 0.995479004577296
 expectedAdjRSquare <- 0.992465007628826
 
 verifyRegression(model, expectedBeta, expectedResiduals, expectedErrors,
-expectedStdError, expectedRSquare, expectedAdjRSquare, "Longley") 
+expectedStdError, expectedRSquare, expectedAdjRSquare, "Longley")
 
 # Model with no intercept
 model <- lm(y ~ 0 + x1 + x2 + x3 + x4 + x5 + x6)
 
-estimates <- matrix(c(-52.99357013868291, 129.54486693117232, 
+estimates <- matrix(c(-52.99357013868291, 129.54486693117232,
          0.07107319907358, 0.03016640003786,
-        -0.42346585566399, 0.41773654056612, 
+        -0.42346585566399, 0.41773654056612,
         -0.57256866841929, 0.27899087467676,
-        -0.41420358884978, 0.32128496193363, 
+        -0.41420358884978, 0.32128496193363,
          48.41786562001326, 17.68948737819961),
          nrow = 6, ncol = 2, byrow = TRUE)
 
@@ -171,7 +171,7 @@ expectedBeta <- estimates[,1]
 expectedErrors <- estimates[,2]
 expectedResiduals <- c(279.90274927293092, -130.32465380836874, 90.73228661967445,
   -401.31252201634948, -440.46768772620027, -543.54512853774793, 201.32111639536299,
-   215.90889365977932, 73.09368242049943, 913.21694494481869, 424.82484953610174, 
+   215.90889365977932, 73.09368242049943, 913.21694494481869, 424.82484953610174,
    -8.56475876776709, -361.32974610842876, 27.34560497213464, 151.28955976355002,
    -492.49937355336846)
 expectedStdError <- 475.1655079819517
@@ -179,7 +179,7 @@ expectedRSquare <- 0.9999670130706
 expectedAdjRSquare <- 0.999947220913
 
 verifyRegression(model, expectedBeta, expectedResiduals, expectedErrors,
-expectedStdError, expectedRSquare, expectedAdjRSquare, "Longley No Intercept") 
+expectedStdError, expectedRSquare, expectedAdjRSquare, "Longley No Intercept")
 
 # Swiss Fertility (R dataset named "swiss")
 
@@ -272,23 +272,23 @@ expectedRSquare <- 0.649789742860228
 expectedAdjRSquare <- 0.6164363850373927
 
 verifyRegression(model, expectedBeta, expectedResiduals, expectedErrors,
-expectedStdError, expectedRSquare, expectedAdjRSquare, "Swiss Fertility") 
+expectedStdError, expectedRSquare, expectedAdjRSquare, "Swiss Fertility")
 
 # model with no intercept
 model <- lm(y ~ 0 + x1 + x2 + x3 + x4)
 
 estimates <- matrix(c(0.52191832900513, 0.10470063765677,
       2.36588087917963, 0.41684100584290,
-     -0.94770353802795, 0.43370143099691, 
+     -0.94770353802795, 0.43370143099691,
       0.30851985863609, 0.07694953606522),
      nrow = 4, ncol = 2, byrow = TRUE)
 
 expectedBeta <- estimates[,1]
 expectedErrors <- estimates[,2]
 
-expectedResiduals <- c(44.138759883538249, 27.720705122356215, 35.873200836126799, 
+expectedResiduals <- c(44.138759883538249, 27.720705122356215, 35.873200836126799,
   34.574619581211977, 26.600168342080213, 15.074636243026923, -12.704904871199814,
-  1.497443824078134, 2.691972687079431, 5.582798774291231, -4.422986561283165, 
+  1.497443824078134, 2.691972687079431, 5.582798774291231, -4.422986561283165,
   -9.198581600334345, 4.481765170730647, 2.273520207553216, -22.649827853221336,
   -17.747900013943308, 20.298314638496436, 6.861405135329779, -8.684712790954924,
   -10.298639278062371, -9.896618896845819, 4.568568616351242, -15.313570491727944,
@@ -304,6 +304,6 @@ expectedRSquare <- 0.946350722085
 expectedAdjRSquare <- 0.9413600915813
 
 verifyRegression(model, expectedBeta, expectedResiduals, expectedErrors,
-expectedStdError, expectedRSquare, expectedAdjRSquare, "Swiss Fertility No Intercept") 
+expectedStdError, expectedRSquare, expectedAdjRSquare, "Swiss Fertility No Intercept")
 
 displayDashes(WIDTH)

http://git-wip-us.apache.org/repos/asf/commons-math/blob/35f32170/src/test/R/normalTestCases
----------------------------------------------------------------------
diff --git a/src/test/R/normalTestCases b/src/test/R/normalTestCases
index ae54a96..7be2e75 100644
--- a/src/test/R/normalTestCases
+++ b/src/test/R/normalTestCases
@@ -44,7 +44,7 @@ verifyDistribution <- function(points, expected, mu, sigma, tol) {
         displayPadded(output, SUCCEEDED, WIDTH)
     } else {
         displayPadded(output, FAILED, WIDTH)
-    }       
+    }
 }
 
 # function to verify density computations
@@ -61,7 +61,7 @@ verifyDensity <- function(points, expected, mu, sigma, tol) {
         displayPadded(output, SUCCEEDED, WIDTH)
     } else {
         displayPadded(output, FAILED, WIDTH)
-    }       
+    }
 }
 
 #--------------------------------------------------------------------------
@@ -94,7 +94,7 @@ distributionPoints <- c(mu - 2 *sigma, mu - sigma, mu, mu + sigma,
 		mu + 2 * sigma,  mu + 3 * sigma, mu + 4 * sigma,
                     mu + 5 * sigma)
 densityValues <- c(0.0539909665132, 0.241970724519, 0.398942280401, 0.241970724519, 0.0539909665132,
-                0.00443184841194, 0.000133830225765, 1.48671951473e-06)            
+                0.00443184841194, 0.000133830225765, 1.48671951473e-06)
 verifyDistribution(distributionPoints, distributionValues, mu, sigma, tol)
 verifyDensity(distributionPoints, densityValues, mu, sigma, tol)
 
@@ -104,7 +104,7 @@ distributionPoints <- c(mu - 2 *sigma, mu - sigma, mu, mu + sigma,
 		mu + 2 * sigma,  mu + 3 * sigma, mu + 4 * sigma,
                     mu + 5 * sigma)
 densityValues <- c(0.539909665132, 2.41970724519, 3.98942280401, 2.41970724519,
-                0.539909665132, 0.0443184841194, 0.00133830225765, 1.48671951473e-05)                    
+                0.539909665132, 0.0443184841194, 0.00133830225765, 1.48671951473e-05)
 verifyDistribution(distributionPoints, distributionValues, mu, sigma, tol)
 verifyDensity(distributionPoints, densityValues, mu, sigma, tol)
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/35f32170/src/test/R/pascalTestCases
----------------------------------------------------------------------
diff --git a/src/test/R/pascalTestCases b/src/test/R/pascalTestCases
index a8c6c31..0e7e68e 100644
--- a/src/test/R/pascalTestCases
+++ b/src/test/R/pascalTestCases
@@ -46,7 +46,7 @@ verifyDensity <- function(points, expected, size, p, tol) {
         displayPadded(output, SUCCEEDED, WIDTH)
     } else {
         displayPadded(output, FAILED, WIDTH)
-    }       
+    }
 }
 
 # function to verify distribution computations
@@ -63,7 +63,7 @@ verifyDistribution <- function(points, expected, size, p, tol) {
         displayPadded(output, SUCCEEDED, WIDTH)
     } else {
         displayPadded(output, FAILED, WIDTH)
-    }       
+    }
 }
 
 #--------------------------------------------------------------------------
@@ -100,7 +100,7 @@ if (assertEquals(inverseCumValues, rInverseCumValues-1, tol,
     displayPadded(output, SUCCEEDED, 80)
 } else {
     displayPadded(output, FAILED, 80)
-}       
+}
 
 # Degenerate cases
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/35f32170/src/test/R/poissonTestCases
----------------------------------------------------------------------
diff --git a/src/test/R/poissonTestCases b/src/test/R/poissonTestCases
index 200aa75..2b5bbb7 100644
--- a/src/test/R/poissonTestCases
+++ b/src/test/R/poissonTestCases
@@ -46,7 +46,7 @@ verifyDensity <- function(points, expected, lambda, tol) {
         displayPadded(output, SUCCEEDED, WIDTH)
     } else {
         displayPadded(output, FAILED, WIDTH)
-    }       
+    }
 }
 
 # function to verify distribution computations
@@ -63,14 +63,14 @@ verifyDistribution <- function(points, expected, lambda, tol) {
         displayPadded(output, SUCCEEDED, WIDTH)
     } else {
         displayPadded(output, FAILED, WIDTH)
-    }       
+    }
 }
 
 # function to verify normal approximation
 
 verifyNormalApproximation <- function(expected, lambda, lower, upper, tol) {
     rValue <- pnorm(upper, mean=lambda, sd=sqrt(lambda), lower.tail = TRUE,
-               log.p = FALSE) - 
+               log.p = FALSE) -
                pnorm(lower, mean=lambda, sd=sqrt(lambda), lower.tail = TRUE,
                log.p = FALSE)
     output <- c("Normal approx. test lambda = ", lambda, " upper = ",
@@ -79,7 +79,7 @@ verifyNormalApproximation <- function(expected, lambda, lower, upper, tol) {
         displayPadded(output, SUCCEEDED, WIDTH)
     } else {
         displayPadded(output, FAILED, WIDTH)
-    }       
+    }
 }
 
 cat("Poisson distribution test cases\n")
@@ -112,5 +112,5 @@ displayDashes(WIDTH)
 
 
 
- 
- 
+
+

http://git-wip-us.apache.org/repos/asf/commons-math/blob/35f32170/src/test/R/regressionTestCases
----------------------------------------------------------------------
diff --git a/src/test/R/regressionTestCases b/src/test/R/regressionTestCases
index c4465ca..d8b3c73 100644
--- a/src/test/R/regressionTestCases
+++ b/src/test/R/regressionTestCases
@@ -58,19 +58,19 @@ if (assertEquals(4.596e-07, significance, tol, "Significance")) {
     displayPadded(output, SUCCEEDED, WIDTH)
 } else {
     displayPadded(output, FAILED, WIDTH)
-}     
- 
+}
+
 output <- "InfData conf interval test"
 ci<-confint(model)
 # ci[1,1] = lower 2.5% bound for intercept, ci[1,2] = upper 97.5% for intercept
 # ci[2,1] = lower 2.5% bound for slope,     ci[2,2] = upper 97.5% for slope
 halfWidth <- ci[2,2] - slope
-if (assertEquals(0.0270713794287, halfWidth, tol, 
+if (assertEquals(0.0270713794287, halfWidth, tol,
    "Slope conf. interval half-width")) {
     displayPadded(output, SUCCEEDED, WIDTH)
 } else {
     displayPadded(output, FAILED, WIDTH)
-}       
+}
 #------------------------------------------------------------------------------
 # Norris dataset from NIST examples
 
@@ -123,37 +123,37 @@ if (assertEquals(0.261829133982, significance, tol, "Significance")) {
     displayPadded(output, SUCCEEDED, WIDTH)
 } else {
     displayPadded(output, FAILED, WIDTH)
-}  
+}
 
 output <- "InfData2 conf interval test"
 ci<-confint(model)
 # ci[1,1] = lower 2.5% bound for intercept, ci[1,2] = upper 97.5% for intercept
 # ci[2,1] = lower 2.5% bound for slope,     ci[2,2] = upper 97.5% for slope
 halfWidth <- ci[2,2] - slope
-if (assertEquals(2.97802204827, halfWidth, tol, 
+if (assertEquals(2.97802204827, halfWidth, tol,
    "Slope conf. interval half-width")) {
     displayPadded(output, SUCCEEDED, WIDTH)
 } else {
     displayPadded(output, FAILED, WIDTH)
-} 
+}
 #------------------------------------------------------------------------------
 # Correlation example
 
 x <- c(101.0, 100.1, 100.0, 90.6, 86.5, 89.7, 90.6, 82.8, 70.1, 65.4,
        61.3, 62.5, 63.6, 52.6, 59.7, 59.5, 61.3)
 y <- c(99.2, 99.0, 100.0, 111.6, 122.2, 117.6, 121.1, 136.0, 154.2, 153.6,
-       158.5, 140.6, 136.2, 168.0, 154.3, 149.0, 165.5)  
+       158.5, 140.6, 136.2, 168.0, 154.3, 149.0, 165.5)
 
 output <- "Correlation test"
-if (assertEquals(-0.94663767742, cor(x,y, method="pearson"), tol, 
+if (assertEquals(-0.94663767742, cor(x,y, method="pearson"), tol,
    "Correlation coefficient")) {
     displayPadded(output, SUCCEEDED, WIDTH)
 } else {
     displayPadded(output, FAILED, WIDTH)
 }
- 
+
 displayDashes(WIDTH)
 
 
- 
- 
+
+

http://git-wip-us.apache.org/repos/asf/commons-math/blob/35f32170/src/test/R/testAll
----------------------------------------------------------------------
diff --git a/src/test/R/testAll b/src/test/R/testAll
index bf77f6d..9af417b 100644
--- a/src/test/R/testAll
+++ b/src/test/R/testAll
@@ -15,7 +15,7 @@
 #
 #------------------------------------------------------------------------------
 # R source file to run all commons-math R verification tests
-# 
+#
 # To run the test, install R, put this file and all other o.a.c.math R
 # verification tests and the testfunctions utilities file into the same
 # directory, launch R from this directory and then enter

http://git-wip-us.apache.org/repos/asf/commons-math/blob/35f32170/src/test/R/testFunctions
----------------------------------------------------------------------
diff --git a/src/test/R/testFunctions b/src/test/R/testFunctions
index 92f62ea..744b554 100644
--- a/src/test/R/testFunctions
+++ b/src/test/R/testFunctions
@@ -60,7 +60,7 @@ assertEquals <- function(expected, observed, tol, message) {
         cat("OBSERVED: ",observed,"\n")
         cat("DIFF: ",observed - expected,"\n")
         cat("TOLERANCE: ",tol,"\n")
-    }  
+    }
     return(!failed)
 }
 #------------------------------------------------------------------------------
@@ -73,12 +73,12 @@ displayDashes <- function(n) {
     return(1)
 }
 #------------------------------------------------------------------------------
-# Displays <start>......<end> with enough dots in between to make <n> cols, 
+# Displays <start>......<end> with enough dots in between to make <n> cols,
 # followed by a new line character. Blows up if <start><end> is longer than
 # <n> cols by itself.
 #
 # Expects <start> and <end> to be strings (character vectors).
-# 
+#
 displayPadded <- function(start, end, n) {
     len = sum(nchar(start)) + sum(nchar(end))
     cat(start, rep(".", n - len), end, "\n",sep='')

http://git-wip-us.apache.org/repos/asf/commons-math/blob/35f32170/src/test/R/zipfTestCases
----------------------------------------------------------------------
diff --git a/src/test/R/zipfTestCases b/src/test/R/zipfTestCases
index f198548..318fffa 100644
--- a/src/test/R/zipfTestCases
+++ b/src/test/R/zipfTestCases
@@ -22,7 +22,7 @@
 # source("<name-of-this-file>")
 #
 # R functions used
-# dzipf(x, N, s, log = FALSE) <- density 
+# dzipf(x, N, s, log = FALSE) <- density
 # pzipf(q, N, s) <- distribution
 #------------------------------------------------------------------------------
 tol <- 1E-6                       # error tolerance for tests
@@ -46,7 +46,7 @@ verifyDensity <- function(points, expected, N, s, tol, log = FALSE) {
         displayPadded(output, SUCCEEDED, WIDTH)
     } else {
         displayPadded(output, FAILED, WIDTH)
-    }       
+    }
 }
 
 # function to verify distribution computations
@@ -63,7 +63,7 @@ verifyDistribution <- function(points, expected, N, s, tol) {
         displayPadded(output, SUCCEEDED, WIDTH)
     } else {
         displayPadded(output, FAILED, WIDTH)
-    }       
+    }
 }
 
 #--------------------------------------------------------------------------


[17/21] [math] Fixed field-based Dormand-Prince 8(5, 3) step interpolator.

Posted by lu...@apache.org.
Fixed field-based Dormand-Prince 8(5,3) step interpolator.

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

Branch: refs/heads/field-ode
Commit: 01026aa09dc1b7394975fd9dca41318054cd4216
Parents: cb51342
Author: Luc Maisonobe <lu...@apache.org>
Authored: Wed Dec 9 15:56:36 2015 +0100
Committer: Luc Maisonobe <lu...@apache.org>
Committed: Wed Dec 9 15:57:11 2015 +0100

----------------------------------------------------------------------
 .../DormandPrince853FieldStepInterpolator.java  | 63 ++++++++++++++++----
 ...ctEmbeddedRungeKuttaFieldIntegratorTest.java | 14 +++++
 .../DormandPrince853FieldIntegratorTest.java    |  4 +-
 ...rmandPrince853FieldStepInterpolatorTest.java |  4 +-
 4 files changed, 70 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/01026aa0/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldStepInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldStepInterpolator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldStepInterpolator.java
index 211f18c..4890847 100644
--- a/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldStepInterpolator.java
+++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldStepInterpolator.java
@@ -55,7 +55,7 @@ class DormandPrince853FieldStepInterpolator<T extends RealFieldElement<T>>
         d = MathArrays.buildArray(getField(), 7, 16);
 
         // this row is the same as the b array
-        d[0][ 0] = fraction(104257, 1929240);
+        d[0][ 0] = fraction(104257, 1920240);
         d[0][ 1] = getField().getZero();
         d[0][ 2] = getField().getZero();
         d[0][ 3] = getField().getZero();
@@ -101,10 +101,10 @@ class DormandPrince853FieldStepInterpolator<T extends RealFieldElement<T>>
         d[2][ 9] = d[0][ 9].multiply(2);
         d[2][10] = d[0][10].multiply(2);
         d[2][11] = d[0][11].multiply(2);
-        d[2][12] = d[0][12].multiply(2); // really 0
-        d[2][13] = d[0][13].multiply(2); // really 0
-        d[2][14] = d[0][14].multiply(2); // really 0
-        d[2][15] = d[0][15].multiply(2); // really 0
+        d[2][12] = d[0][12].multiply(2).subtract(1); // really -1
+        d[2][13] = d[0][13].multiply(2);             // really  0
+        d[2][14] = d[0][14].multiply(2);             // really  0
+        d[2][15] = d[0][15].multiply(2);             // really  0
 
         d[3][ 0] = fraction(        -17751989329.0, 2106076560.0);
         d[3][ 1] = getField().getZero();
@@ -215,7 +215,7 @@ class DormandPrince853FieldStepInterpolator<T extends RealFieldElement<T>>
                                                                                    final T oneMinusThetaH)
         throws MaxCountExceededException {
 
-        final T one      = theta.getField().getOne();
+        final T one      = getField().getOne();
         final T eta      = one.subtract(theta);
         final T twoTheta = theta.multiply(2);
         final T theta2   = theta.multiply(theta);
@@ -228,6 +228,7 @@ class DormandPrince853FieldStepInterpolator<T extends RealFieldElement<T>>
         final T[] interpolatedState;
         final T[] interpolatedDerivatives;
 
+
         if (getGlobalPreviousState() != null && theta.getReal() <= 0.5) {
             final T f0 = theta.multiply(h);
             final T f1 = f0.multiply(eta);
@@ -236,18 +237,58 @@ class DormandPrince853FieldStepInterpolator<T extends RealFieldElement<T>>
             final T f4 = f3.multiply(theta);
             final T f5 = f4.multiply(eta);
             final T f6 = f5.multiply(theta);
-            interpolatedState       = previousStateLinearCombination(f0, f1, f2, f3, f4, f5, f6);
-            interpolatedDerivatives = derivativeLinearCombination(one, dot1, dot2, dot3, dot4, dot5, dot6);
+            final T[] p = MathArrays.buildArray(getField(), 16);
+            final T[] q = MathArrays.buildArray(getField(), 16);
+            for (int i = 0; i < p.length; ++i) {
+                p[i] =     f0.multiply(d[0][i]).
+                       add(f1.multiply(d[1][i])).
+                       add(f2.multiply(d[2][i])).
+                       add(f3.multiply(d[3][i])).
+                       add(f4.multiply(d[4][i])).
+                       add(f5.multiply(d[5][i])).
+                       add(f6.multiply(d[6][i]));
+                q[i] =                    d[0][i].
+                        add(dot1.multiply(d[1][i])).
+                        add(dot2.multiply(d[2][i])).
+                        add(dot3.multiply(d[3][i])).
+                        add(dot4.multiply(d[4][i])).
+                        add(dot5.multiply(d[5][i])).
+                        add(dot6.multiply(d[6][i]));
+            }
+            interpolatedState       = previousStateLinearCombination(p[0], p[1], p[ 2], p[ 3], p[ 4], p[ 5], p[ 6], p[ 7],
+                                                                     p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]);
+            interpolatedDerivatives = derivativeLinearCombination(q[0], q[1], q[ 2], q[ 3], q[ 4], q[ 5], q[ 6], q[ 7],
+                                                                  q[8], q[9], q[10], q[11], q[12], q[13], q[14], q[15]);
         } else {
-            final T f0 = oneMinusThetaH;
+            final T f0 = oneMinusThetaH.negate();
             final T f1 = f0.multiply(theta).negate();
             final T f2 = f1.multiply(theta);
             final T f3 = f2.multiply(eta);
             final T f4 = f3.multiply(theta);
             final T f5 = f4.multiply(eta);
             final T f6 = f5.multiply(theta);
-            interpolatedState       = currentStateLinearCombination(f0, f1, f2, f3, f4, f5, f6);
-            interpolatedDerivatives = derivativeLinearCombination(one, dot1, dot2, dot3, dot4, dot5, dot6);
+            final T[] p = MathArrays.buildArray(getField(), 16);
+            final T[] q = MathArrays.buildArray(getField(), 16);
+            for (int i = 0; i < p.length; ++i) {
+                p[i] =     f0.multiply(d[0][i]).
+                       add(f1.multiply(d[1][i])).
+                       add(f2.multiply(d[2][i])).
+                       add(f3.multiply(d[3][i])).
+                       add(f4.multiply(d[4][i])).
+                       add(f5.multiply(d[5][i])).
+                       add(f6.multiply(d[6][i]));
+                q[i] =                    d[0][i].
+                        add(dot1.multiply(d[1][i])).
+                        add(dot2.multiply(d[2][i])).
+                        add(dot3.multiply(d[3][i])).
+                        add(dot4.multiply(d[4][i])).
+                        add(dot5.multiply(d[5][i])).
+                        add(dot6.multiply(d[6][i]));
+            }
+            interpolatedState       = currentStateLinearCombination(p[0], p[1], p[ 2], p[ 3], p[ 4], p[ 5], p[ 6], p[ 7],
+                                                                    p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]);
+            interpolatedDerivatives = derivativeLinearCombination(q[0], q[1], q[ 2], q[ 3], q[ 4], q[ 5], q[ 6], q[ 7],
+                                                                  q[8], q[9], q[10], q[11], q[12], q[13], q[14], q[15]);
         }
 
         return new FieldODEStateAndDerivative<T>(time, interpolatedState, interpolatedDerivatives);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/01026aa0/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractEmbeddedRungeKuttaFieldIntegratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractEmbeddedRungeKuttaFieldIntegratorTest.java b/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractEmbeddedRungeKuttaFieldIntegratorTest.java
index 06a05c9..e166f49 100644
--- a/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractEmbeddedRungeKuttaFieldIntegratorTest.java
+++ b/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractEmbeddedRungeKuttaFieldIntegratorTest.java
@@ -64,6 +64,20 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest {
             T[][] fieldA = fieldIntegrator.getA();
             T[]   fieldB = fieldIntegrator.getB();
             T[]   fieldC = fieldIntegrator.getC();
+            if (fieldIntegrator instanceof DormandPrince853FieldIntegrator) {
+                // special case for Dormand-Prince 8(5,3), the array in the regular
+                // integrator is smaller because as of 3.X, the interpolation steps
+                // are not performed by the integrator itself
+                T[][] reducedFieldA = MathArrays.buildArray(field, 12, -1);
+                T[]   reducedFieldB = MathArrays.buildArray(field, 13);
+                T[]   reducedFieldC = MathArrays.buildArray(field, 12);
+                System.arraycopy(fieldA, 0, reducedFieldA, 0, reducedFieldA.length);
+                System.arraycopy(fieldB, 0, reducedFieldB, 0, reducedFieldB.length);
+                System.arraycopy(fieldC, 0, reducedFieldC, 0, reducedFieldC.length);
+                fieldA = reducedFieldA;
+                fieldB = reducedFieldB;
+                fieldC = reducedFieldC;
+            }
 
             String fieldName   = fieldIntegrator.getClass().getName();
             String regularName = fieldName.replaceAll("Field", "");

http://git-wip-us.apache.org/repos/asf/commons-math/blob/01026aa0/src/test/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldIntegratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldIntegratorTest.java b/src/test/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldIntegratorTest.java
index 61a9fd8..4932580 100644
--- a/src/test/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldIntegratorTest.java
+++ b/src/test/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldIntegratorTest.java
@@ -49,12 +49,12 @@ public class DormandPrince853FieldIntegratorTest extends AbstractEmbeddedRungeKu
 
     @Test
     public void testBackward() {
-        doTestBackward(Decimal64Field.getInstance(), 1.1e-7, 1.1e-7, 1.0e-12, "Dormand-Prince 8 (5, 3)");
+        doTestBackward(Decimal64Field.getInstance(), 8.1e-8, 1.1e-7, 1.0e-12, "Dormand-Prince 8 (5, 3)");
     }
 
     @Test
     public void testKepler() {
-        doTestKepler(Decimal64Field.getInstance(), 2.4e-10);
+        doTestKepler(Decimal64Field.getInstance(), 4.4e-11);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/commons-math/blob/01026aa0/src/test/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldStepInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldStepInterpolatorTest.java b/src/test/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldStepInterpolatorTest.java
index 8153ed3..2fd7ca5 100644
--- a/src/test/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldStepInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldStepInterpolatorTest.java
@@ -38,12 +38,12 @@ public class DormandPrince853FieldStepInterpolatorTest extends AbstractRungeKutt
 
     @Test
     public void interpolationInside() {
-        doInterpolationInside(Decimal64Field.getInstance(), 1.0e-50, 1.0e-50);
+        doInterpolationInside(Decimal64Field.getInstance(), 3.1e-17, 3.4e-16);
     }
 
     @Test
     public void nonFieldInterpolatorConsistency() {
-        doNonFieldInterpolatorConsistency(Decimal64Field.getInstance(), 1.0e-50, 1.0e-50, 1.0e-50, 1.0e-50);
+        doNonFieldInterpolatorConsistency(Decimal64Field.getInstance(), 3.4e-12, 5.7e-11, 1.9e-10, 3.1e-9);
     }
 
 }


[12/21] [math] MATH-1295

Posted by lu...@apache.org.
MATH-1295

Increased default value for number of allowed evaluations.


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

Branch: refs/heads/field-ode
Commit: 26ad6ac83721fd90e35fe4db4613685b5857fed9
Parents: aeb21bb
Author: Gilles <er...@apache.org>
Authored: Wed Dec 2 15:54:00 2015 +0100
Committer: Gilles <er...@apache.org>
Committed: Wed Dec 2 15:54:00 2015 +0100

----------------------------------------------------------------------
 src/changes/changes.xml                                          | 4 ++++
 .../org/apache/commons/math3/optim/univariate/BracketFinder.java | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/26ad6ac8/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 2a5a7cd..1276963 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -51,6 +51,10 @@ If the output is not quite correct, check for invisible trailing spaces!
   </properties>
   <body>
     <release version="3.6" date="XXXX-XX-XX" description="">
+      <action dev="erans" type="fix" issue="MATH-1295" due-to="Luke Lindsay">
+        Increased default value for number of allowed evaluations in
+        "o.a.c.m.optim.univariate.BracketFinder".
+      </action>
       <action dev="psteitz" type="update" issue="MATH-1246">
         Modified 2-sample KolmogorovSmirnovTest to handle ties in sample data. By default,
         ties are broken by adding random jitter to input data. Also added bootstrap method

http://git-wip-us.apache.org/repos/asf/commons-math/blob/26ad6ac8/src/main/java/org/apache/commons/math3/optim/univariate/BracketFinder.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/optim/univariate/BracketFinder.java b/src/main/java/org/apache/commons/math3/optim/univariate/BracketFinder.java
index 2653c12..414a1bb 100644
--- a/src/main/java/org/apache/commons/math3/optim/univariate/BracketFinder.java
+++ b/src/main/java/org/apache/commons/math3/optim/univariate/BracketFinder.java
@@ -72,11 +72,11 @@ public class BracketFinder {
     private double fMid;
 
     /**
-     * Constructor with default values {@code 100, 50} (see the
+     * Constructor with default values {@code 100, 500} (see the
      * {@link #BracketFinder(double,int) other constructor}).
      */
     public BracketFinder() {
-        this(100, 50);
+        this(100, 500);
     }
 
     /**


[13/21] [math] Fixed errors / omissions in javadoc regarding NaN return values. JIRA: MATH-1296.

Posted by lu...@apache.org.
Fixed errors / omissions in javadoc regarding NaN return values. JIRA: MATH-1296.


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

Branch: refs/heads/field-ode
Commit: c23e9fb1a1612bda5377b9e062d133a96a057cea
Parents: 26ad6ac
Author: Phil Steitz <ph...@gmail.com>
Authored: Wed Dec 2 20:40:19 2015 -0700
Committer: Phil Steitz <ph...@gmail.com>
Committed: Wed Dec 2 20:40:19 2015 -0700

----------------------------------------------------------------------
 .../stat/descriptive/DescriptiveStatistics.java    | 17 ++++++++++-------
 .../math3/stat/descriptive/moment/Skewness.java    |  5 +++++
 2 files changed, 15 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/c23e9fb1/src/main/java/org/apache/commons/math3/stat/descriptive/DescriptiveStatistics.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/stat/descriptive/DescriptiveStatistics.java b/src/main/java/org/apache/commons/math3/stat/descriptive/DescriptiveStatistics.java
index 31acd24..b215bc8 100644
--- a/src/main/java/org/apache/commons/math3/stat/descriptive/DescriptiveStatistics.java
+++ b/src/main/java/org/apache/commons/math3/stat/descriptive/DescriptiveStatistics.java
@@ -208,9 +208,12 @@ public class DescriptiveStatistics implements StatisticalSummary, Serializable {
 
     /**
      * Returns the <a href="http://www.xycoon.com/geometric_mean.htm">
-     * geometric mean </a> of the available values
+     * geometric mean </a> of the available values.
+     * <p>
+     * See {@link GeometricMean} for details on the computing algorithm.</p>
+     *
      * @return The geometricMean, Double.NaN if no values have been added,
-     * or if the product of the available values is less than or equal to 0.
+     * or if any negative values have been added.
      */
     public double getGeometricMean() {
         return apply(geometricMeanImpl);
@@ -273,8 +276,8 @@ public class DescriptiveStatistics implements StatisticalSummary, Serializable {
     /**
      * Returns the skewness of the available values. Skewness is a
      * measure of the asymmetry of a given distribution.
-     * @return The skewness, Double.NaN if no values have been added
-     * or 0.0 for a value set &lt;=2.
+     *
+     * @return The skewness, Double.NaN if less than 3 values have been added.
      */
     public double getSkewness() {
         return apply(skewnessImpl);
@@ -282,9 +285,9 @@ public class DescriptiveStatistics implements StatisticalSummary, Serializable {
 
     /**
      * Returns the Kurtosis of the available values. Kurtosis is a
-     * measure of the "peakedness" of a distribution
-     * @return The kurtosis, Double.NaN if no values have been added, or 0.0
-     * for a value set &lt;=3.
+     * measure of the "peakedness" of a distribution.
+     *
+     * @return The kurtosis, Double.NaN if less than 4 values have been added.
      */
     public double getKurtosis() {
         return apply(kurtosisImpl);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/c23e9fb1/src/main/java/org/apache/commons/math3/stat/descriptive/moment/Skewness.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/stat/descriptive/moment/Skewness.java b/src/main/java/org/apache/commons/math3/stat/descriptive/moment/Skewness.java
index 9ecb0dd..b4703eb 100644
--- a/src/main/java/org/apache/commons/math3/stat/descriptive/moment/Skewness.java
+++ b/src/main/java/org/apache/commons/math3/stat/descriptive/moment/Skewness.java
@@ -34,6 +34,11 @@ import org.apache.commons.math3.util.MathUtils;
  * where n is the number of values, mean is the {@link Mean} and std is the
  * {@link StandardDeviation} </p>
  * <p>
+ * Note that this statistic is undefined for n < 3.  <code>Double.Nan</code>
+ * is returned when there is not sufficient data to compute the statistic.
+ * Double.NaN may also be returned if the input includes NaN and / or
+ * infinite values.</p>
+ * <p>
  * <strong>Note that this implementation is not synchronized.</strong> If
  * multiple threads access an instance of this class concurrently, and at least
  * one of the threads invokes the <code>increment()</code> or


[11/21] [math] Update javadoc; use += for jitter.

Posted by lu...@apache.org.
Update javadoc; use += for jitter.


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

Branch: refs/heads/field-ode
Commit: aeb21bb4bd747f6b68724a3305d81f897a00cbac
Parents: ff35e6f
Author: Phil Steitz <ph...@gmail.com>
Authored: Fri Nov 27 12:49:45 2015 -0700
Committer: Phil Steitz <ph...@gmail.com>
Committed: Fri Nov 27 12:49:45 2015 -0700

----------------------------------------------------------------------
 .../stat/inference/KolmogorovSmirnovTest.java   | 29 ++++++++++++++++----
 1 file changed, 23 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/aeb21bb4/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 13af7d7..b9f2ec0 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
@@ -80,7 +80,12 @@ import org.apache.commons.math3.util.MathUtils;
  * <li>When the product of the sample sizes exceeds {@value #LARGE_SAMPLE_PRODUCT}, the asymptotic
  * distribution of \(D_{n,m}\) is used. See {@link #approximateP(double, int, int)} for details on
  * the approximation.</li>
- * </ul>
+ * </ul></p><p>
+ * If the product of the sample sizes is less than {@value #LARGE_SAMPLE_PRODUCT} and the sample
+ * data contains ties, random jitter is added to the sample data to break ties before applying
+ * the algorithm above. Alternatively, the {@link #bootstrap(double[], double[], int, boolean)}
+ * method, modeled after <a href="http://sekhon.berkeley.edu/matching/ks.boot.html">ks.boot</a>
+ * in the R Matching package [3], can be used if ties are known to be present in the data.
  * </p>
  * <p>
  * In the two-sample case, \(D_{n,m}\) has a discrete distribution. This makes the p-value
@@ -107,6 +112,9 @@ import org.apache.commons.math3.util.MathUtils;
  * George Marsaglia, Wai Wan Tsang, and Jingbo Wang</li>
  * <li>[2] <a href="http://www.jstatsoft.org/v39/i11/"> Computing the Two-Sided Kolmogorov-Smirnov
  * Distribution</a> by Richard Simard and Pierre L'Ecuyer</li>
+ * <li>[3] Jasjeet S. Sekhon. 2011. <a href="http://www.jstatsoft.org/article/view/v042i07">
+ * Multivariate and Propensity Score Matching Software with Automated Balance Optimization:
+ * The Matching package for R</a> Journal of Statistical Software, 42(7): 1-52.</li>
  * </ul>
  * <br/>
  * Note that [1] contains an error in computing h, refer to <a
@@ -233,7 +241,15 @@ public class KolmogorovSmirnovTest {
      * <li>When the product of the sample sizes exceeds {@value #LARGE_SAMPLE_PRODUCT}, the
      * asymptotic distribution of \(D_{n,m}\) is used. See {@link #approximateP(double, int, int)}
      * for details on the approximation.</li>
-     * </ul>
+     * </ul><p>
+     * If {@code x.length * y.length} < {@value #LARGE_SAMPLE_PRODUCT} and the combined set of values in
+     * {@code x} and {@code y} contains ties, random jitter is added to {@code x} and {@code y} to
+     * break ties before computing \(D_{n,m}\) and the p-value. The jitter is uniformly distributed
+     * on (-minDelta / 2, minDelta / 2) where minDelta is the smallest pairwise difference between
+     * values in the combined sample.</p>
+     * <p>
+     * If ties are known to be present in the data, {@link #bootstrap(double[], double[], int, boolean)}
+     * may be used as an alternative method for estimating the p-value.</p>
      *
      * @param x first sample dataset
      * @param y second sample dataset
@@ -244,6 +260,7 @@ public class KolmogorovSmirnovTest {
      * @throws InsufficientDataException if either {@code x} or {@code y} does not have length at
      *         least 2
      * @throws NullArgumentException if either {@code x} or {@code y} is null
+     * @see #bootstrap(double[], double[], int, boolean)
      */
     public double kolmogorovSmirnovTest(double[] x, double[] y, boolean strict) {
         final long lengthProduct = (long) x.length * y.length;
@@ -397,9 +414,9 @@ public class KolmogorovSmirnovTest {
      * probability distribution. This method estimates the p-value by repeatedly sampling sets of size
      * {@code x.length} and {@code y.length} from the empirical distribution of the combined sample.
      * When {@code strict} is true, this is equivalent to the algorithm implemented in the R function
-     * ks.boot, described in <pre>
-     * Jasjeet S. Sekhon. 2011. `Multivariate and Propensity Score Matching
-     * Software with Automated Balance Optimization: The Matching package for R.`
+     * {@code ks.boot}, described in <pre>
+     * Jasjeet S. Sekhon. 2011. 'Multivariate and Propensity Score Matching
+     * Software with Automated Balance Optimization: The Matching package for R.'
      * Journal of Statistical Software, 42(7): 1-52.
      * </pre>
      * @param x first sample
@@ -1250,7 +1267,7 @@ public class KolmogorovSmirnovTest {
      */
     private static void jitter(double[] data, RealDistribution dist) {
         for (int i = 0; i < data.length; i++) {
-            data[i] = data[i] + dist.sample();
+            data[i] += dist.sample();
         }
     }
 }


[09/21] [math] Removed trailing spaces. No code change.

Posted by lu...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/filter/KalmanFilterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/filter/KalmanFilterTest.java b/src/test/java/org/apache/commons/math3/filter/KalmanFilterTest.java
index f7a08c8..468eab6 100644
--- a/src/test/java/org/apache/commons/math3/filter/KalmanFilterTest.java
+++ b/src/test/java/org/apache/commons/math3/filter/KalmanFilterTest.java
@@ -34,12 +34,12 @@ import org.junit.Test;
  *
  */
 public class KalmanFilterTest {
-    
+
     @Test(expected=MatrixDimensionMismatchException.class)
     public void testTransitionMeasurementMatrixMismatch() {
-        
+
         // A and H matrix do not match in dimensions
-        
+
         // A = [ 1 ]
         RealMatrix A = new Array2DRowRealMatrix(new double[] { 1d });
         // no control input
@@ -61,9 +61,9 @@ public class KalmanFilterTest {
 
     @Test(expected=MatrixDimensionMismatchException.class)
     public void testTransitionControlMatrixMismatch() {
-        
+
         // A and B matrix do not match in dimensions
-        
+
         // A = [ 1 ]
         RealMatrix A = new Array2DRowRealMatrix(new double[] { 1d });
         // B = [ 1 1 ]
@@ -82,11 +82,11 @@ public class KalmanFilterTest {
         new KalmanFilter(pm, mm);
         Assert.fail("transition and control matrix should not be compatible");
     }
-    
+
     @Test
     public void testConstant() {
         // simulates a simple process with a constant state and no control input
-        
+
         double constantValue = 10d;
         double measurementNoise = 0.1d;
         double processNoise = 1e-5d;
@@ -247,30 +247,30 @@ public class KalmanFilterTest {
      * Represents an idealized Cannonball only taking into account gravity.
      */
     public static class Cannonball {
-        
+
         private final double[] gravity = { 0, -9.81 };
-        
+
         private final double[] velocity;
         private final double[] location;
-        
+
         private double timeslice;
-        
+
         public Cannonball(double timeslice, double angle, double initialVelocity) {
             this.timeslice = timeslice;
-            
+
             final double angleInRadians = FastMath.toRadians(angle);
             this.velocity = new double[] {
                     initialVelocity * FastMath.cos(angleInRadians),
                     initialVelocity * FastMath.sin(angleInRadians)
             };
-            
+
             this.location = new double[] { 0, 0 };
         }
-        
+
         public double getX() {
             return location[0];
         }
-        
+
         public double getY() {
             return location[1];
         }
@@ -278,18 +278,18 @@ public class KalmanFilterTest {
         public double getXVelocity() {
             return velocity[0];
         }
-        
+
         public double getYVelocity() {
             return velocity[1];
         }
-        
+
         public void step() {
             // break gravitational force into a smaller time slice.
             double[] slicedGravity = gravity.clone();
             for ( int i = 0; i < slicedGravity.length; i++ ) {
                 slicedGravity[i] *= timeslice;
             }
-            
+
             // apply the acceleration to velocity.
             double[] slicedVelocity = velocity.clone();
             for ( int i = 0; i < velocity.length; i++ ) {
@@ -321,7 +321,7 @@ public class KalmanFilterTest {
         final double angle = 45;
 
         final Cannonball cannonball = new Cannonball(dt, angle, initialVelocity);
-        
+
         final double speedX = cannonball.getXVelocity();
         final double speedY = cannonball.getYVelocity();
 
@@ -333,7 +333,7 @@ public class KalmanFilterTest {
                 { 1, dt, 0,  0 },
                 { 0,  1, 0,  0 },
                 { 0,  0, 1, dt },
-                { 0,  0, 0,  1 }       
+                { 0,  0, 0,  1 }
         });
 
         // The control vector, which adds acceleration to the kinematic equations.
@@ -359,7 +359,7 @@ public class KalmanFilterTest {
                 { 0, 0, 1, 0 },
                 { 0, 0, 0, 0 }
         });
-        
+
         // our guess of the initial state.
         final RealVector initialState = MatrixUtils.createRealVector(new double[] { 0, speedX, 0, speedY } );
 
@@ -374,7 +374,7 @@ public class KalmanFilterTest {
 
         // we assume no process noise -> zero matrix
         final RealMatrix Q = MatrixUtils.createRealMatrix(4, 4);
-        
+
         // the measurement covariance matrix
         final RealMatrix R = MatrixUtils.createRealMatrix(new double[][] {
                 { var,    0,   0,    0 },
@@ -394,13 +394,13 @@ public class KalmanFilterTest {
             // get the "real" cannonball position
             double x = cannonball.getX();
             double y = cannonball.getY();
-            
+
             // apply measurement noise to current cannonball position
             double nx = x + dist.sample();
             double ny = y + dist.sample();
 
             cannonball.step();
-            
+
             filter.predict(controlVector);
             // correct the filter with our measurements
             filter.correct(new double[] { nx, 0, ny, 0 } );
@@ -411,7 +411,7 @@ public class KalmanFilterTest {
         }
 
         // error covariance of the x/y-position should be already very low (< 3m std dev = 9 variance)
-        
+
         Assert.assertTrue(Precision.compareTo(filter.getErrorCovariance()[0][0],
                                               9, 1e-6) < 0);
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/fitting/GaussianCurveFitterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/fitting/GaussianCurveFitterTest.java b/src/test/java/org/apache/commons/math3/fitting/GaussianCurveFitterTest.java
index 153274b..e8c366b 100644
--- a/src/test/java/org/apache/commons/math3/fitting/GaussianCurveFitterTest.java
+++ b/src/test/java/org/apache/commons/math3/fitting/GaussianCurveFitterTest.java
@@ -236,7 +236,7 @@ public class GaussianCurveFitterTest {
     public void testFit02() {
         GaussianCurveFitter.create().fit(new WeightedObservedPoints().toList());
     }
-    
+
     /**
      * Two points is not enough observed points.
      */
@@ -248,7 +248,7 @@ public class GaussianCurveFitterTest {
                     {4.02804905, 664002.0}
                 }).toList());
     }
-    
+
     /**
      * Poor data: right of peak not symmetric with left of peak.
      */
@@ -260,8 +260,8 @@ public class GaussianCurveFitterTest {
         Assert.assertEquals(233003.2967252038, parameters[0], 1e-4);
         Assert.assertEquals(-10.654887521095983, parameters[1], 1e-4);
         Assert.assertEquals(4.335937353196641, parameters[2], 1e-4);
-    }  
-    
+    }
+
     /**
      * Poor data: long tails.
      */
@@ -274,7 +274,7 @@ public class GaussianCurveFitterTest {
         Assert.assertEquals(-13.29641995105174, parameters[1], 1e-4);
         Assert.assertEquals(1.7297330293549908, parameters[2], 1e-4);
     }
-    
+
     /**
      * Poor data: right of peak is missing.
      */
@@ -286,7 +286,7 @@ public class GaussianCurveFitterTest {
         Assert.assertEquals(285250.66754309234, parameters[0], 1e-4);
         Assert.assertEquals(-13.528375695228455, parameters[1], 1e-4);
         Assert.assertEquals(1.5204344894331614, parameters[2], 1e-4);
-    }    
+    }
 
     /**
      * Basic with smaller dataset.
@@ -306,7 +306,7 @@ public class GaussianCurveFitterTest {
         // The optimizer will try negative sigma values but "GaussianCurveFitter"
         // will catch the raised exceptions and return NaN values instead.
 
-        final double[] data = { 
+        final double[] data = {
             1.1143831578403364E-29,
             4.95281403484594E-28,
             1.1171347211930288E-26,
@@ -374,7 +374,7 @@ public class GaussianCurveFitterTest {
         Assert.assertEquals(0.603770729862231, p[1], 1e-15);
         Assert.assertEquals(1.0786447936766612, p[2], 1e-14);
     }
-    
+
     /**
      * Adds the specified points to specified <code>GaussianCurveFitter</code>
      * instance.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/fitting/GaussianFitterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/fitting/GaussianFitterTest.java b/src/test/java/org/apache/commons/math3/fitting/GaussianFitterTest.java
index ddec57d..783680d 100644
--- a/src/test/java/org/apache/commons/math3/fitting/GaussianFitterTest.java
+++ b/src/test/java/org/apache/commons/math3/fitting/GaussianFitterTest.java
@@ -199,7 +199,7 @@ public class GaussianFitterTest {
         GaussianFitter fitter = new GaussianFitter(new LevenbergMarquardtOptimizer());
         fitter.fit();
     }
-    
+
     /**
      * Two points is not enough observed points.
      */
@@ -212,7 +212,7 @@ public class GaussianFitterTest {
             fitter);
         fitter.fit();
     }
-    
+
     /**
      * Poor data: right of peak not symmetric with left of peak.
      */
@@ -225,8 +225,8 @@ public class GaussianFitterTest {
         Assert.assertEquals(233003.2967252038, parameters[0], 1e-4);
         Assert.assertEquals(-10.654887521095983, parameters[1], 1e-4);
         Assert.assertEquals(4.335937353196641, parameters[2], 1e-4);
-    }  
-    
+    }
+
     /**
      * Poor data: long tails.
      */
@@ -240,7 +240,7 @@ public class GaussianFitterTest {
         Assert.assertEquals(-13.29641995105174, parameters[1], 1e-4);
         Assert.assertEquals(1.7297330293549908, parameters[2], 1e-4);
     }
-    
+
     /**
      * Poor data: right of peak is missing.
      */
@@ -253,7 +253,7 @@ public class GaussianFitterTest {
         Assert.assertEquals(285250.66754309234, parameters[0], 1e-4);
         Assert.assertEquals(-13.528375695228455, parameters[1], 1e-4);
         Assert.assertEquals(1.5204344894331614, parameters[2], 1e-4);
-    }    
+    }
 
     /**
      * Basic with smaller dataset.
@@ -274,7 +274,7 @@ public class GaussianFitterTest {
         // The optimizer will try negative sigma values but "GaussianFitter"
         // will catch the raised exceptions and return NaN values instead.
 
-        final double[] data = { 
+        final double[] data = {
             1.1143831578403364E-29,
             4.95281403484594E-28,
             1.1171347211930288E-26,
@@ -342,7 +342,7 @@ public class GaussianFitterTest {
         Assert.assertEquals(0.603770729862231, p[1], 1e-15);
         Assert.assertEquals(1.0786447936766612, p[2], 1e-14);
     }
-    
+
     /**
      * Adds the specified points to specified <code>GaussianFitter</code>
      * instance.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/fitting/HarmonicCurveFitterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/fitting/HarmonicCurveFitterTest.java b/src/test/java/org/apache/commons/math3/fitting/HarmonicCurveFitterTest.java
index 9f6a15c..bed70dd 100644
--- a/src/test/java/org/apache/commons/math3/fitting/HarmonicCurveFitterTest.java
+++ b/src/test/java/org/apache/commons/math3/fitting/HarmonicCurveFitterTest.java
@@ -148,7 +148,7 @@ public class HarmonicCurveFitterTest {
         }
 
         // Pass it to the fitter.
-        final WeightedObservedPoints points = new WeightedObservedPoints();        
+        final WeightedObservedPoints points = new WeightedObservedPoints();
         for (int i = 0; i < size; ++i) {
             points.add(1, xTab[i], yTab[i]);
         }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/fitting/PolynomialCurveFitterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/fitting/PolynomialCurveFitterTest.java b/src/test/java/org/apache/commons/math3/fitting/PolynomialCurveFitterTest.java
index 6b8dfa2..ff76a0e 100644
--- a/src/test/java/org/apache/commons/math3/fitting/PolynomialCurveFitterTest.java
+++ b/src/test/java/org/apache/commons/math3/fitting/PolynomialCurveFitterTest.java
@@ -114,7 +114,7 @@ public class PolynomialCurveFitterTest {
         for (int degree = 0; degree < 10; ++degree) {
             final PolynomialFunction p = buildRandomPolynomial(degree, randomizer);
             final PolynomialCurveFitter fitter = PolynomialCurveFitter.create(degree);
- 
+
             final WeightedObservedPoints obs = new WeightedObservedPoints();
             for (int i = 0; i < 40000; ++i) {
                 final double x = -1.0 + i / 20000.0;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/fitting/SimpleCurveFitterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/fitting/SimpleCurveFitterTest.java b/src/test/java/org/apache/commons/math3/fitting/SimpleCurveFitterTest.java
index d411d4a..e16d661 100644
--- a/src/test/java/org/apache/commons/math3/fitting/SimpleCurveFitterTest.java
+++ b/src/test/java/org/apache/commons/math3/fitting/SimpleCurveFitterTest.java
@@ -48,7 +48,7 @@ public class SimpleCurveFitterTest {
             obs.add(x, f.value(x) + 0.1 * randomizer.nextGaussian());
         }
 
-        final ParametricUnivariateFunction function = new PolynomialFunction.Parametric(); 
+        final ParametricUnivariateFunction function = new PolynomialFunction.Parametric();
         // Start fit from initial guesses that are far from the optimal values.
         final SimpleCurveFitter fitter
             = SimpleCurveFitter.create(function,

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/fitting/leastsquares/CircleProblem.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/fitting/leastsquares/CircleProblem.java b/src/test/java/org/apache/commons/math3/fitting/leastsquares/CircleProblem.java
index ed637d4..6bb86a2 100644
--- a/src/test/java/org/apache/commons/math3/fitting/leastsquares/CircleProblem.java
+++ b/src/test/java/org/apache/commons/math3/fitting/leastsquares/CircleProblem.java
@@ -158,7 +158,7 @@ class CircleProblem {
 
         for (int i = 0; i < points.size(); i++) {
             final int index = i * 2;
-            // Partial derivative wrt x-coordinate of center. 
+            // Partial derivative wrt x-coordinate of center.
             jacobian[index][0] = 1;
             jacobian[index + 1][0] = 0;
             // Partial derivative wrt y-coordinate of center.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/fitting/leastsquares/CircleVectorial.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/fitting/leastsquares/CircleVectorial.java b/src/test/java/org/apache/commons/math3/fitting/leastsquares/CircleVectorial.java
index 968bea5..192b493 100644
--- a/src/test/java/org/apache/commons/math3/fitting/leastsquares/CircleVectorial.java
+++ b/src/test/java/org/apache/commons/math3/fitting/leastsquares/CircleVectorial.java
@@ -56,7 +56,7 @@ class CircleVectorial {
                 for (int i = 0; i < residuals.length; i++) {
                     residuals[i] = points.get(i).distance(center) - radius;
                 }
-                
+
                 return residuals;
             }
         };

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/fitting/leastsquares/MinpackTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/fitting/leastsquares/MinpackTest.java b/src/test/java/org/apache/commons/math3/fitting/leastsquares/MinpackTest.java
index b91140b..af6a427 100644
--- a/src/test/java/org/apache/commons/math3/fitting/leastsquares/MinpackTest.java
+++ b/src/test/java/org/apache/commons/math3/fitting/leastsquares/MinpackTest.java
@@ -610,7 +610,7 @@ public class MinpackTest {
     }
 
     private static class LinearFullRankFunction extends MinpackFunction {
-        
+
         public LinearFullRankFunction(int m, int n, double x0,
                                       double theoreticalStartCost,
                                       double theoreticalMinCost) {
@@ -1382,7 +1382,7 @@ public class MinpackTest {
             }
             return f;
         }
-        
+
         private static final double[] y = {
             0.844, 0.908, 0.932, 0.936, 0.925, 0.908, 0.881, 0.850, 0.818, 0.784, 0.751,
             0.718, 0.685, 0.658, 0.628, 0.603, 0.580, 0.558, 0.538, 0.522, 0.506, 0.490,

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/fraction/BigFractionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/fraction/BigFractionTest.java b/src/test/java/org/apache/commons/math3/fraction/BigFractionTest.java
index 229da69..81eef5e 100644
--- a/src/test/java/org/apache/commons/math3/fraction/BigFractionTest.java
+++ b/src/test/java/org/apache/commons/math3/fraction/BigFractionTest.java
@@ -154,9 +154,9 @@ public class BigFractionTest {
         assertFraction(8, 13, new BigFraction(0.6152, 99));
         assertFraction(510, 829, new BigFraction(0.6152, 999));
         assertFraction(769, 1250, new BigFraction(0.6152, 9999));
-        
+
         // MATH-996
-        assertFraction(1, 2, new BigFraction(0.5000000001, 10));        
+        assertFraction(1, 2, new BigFraction(0.5000000001, 10));
     }
 
     // MATH-1029

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/genetics/CycleCrossoverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/genetics/CycleCrossoverTest.java b/src/test/java/org/apache/commons/math3/genetics/CycleCrossoverTest.java
index 7b6e6b8..5ced37b 100644
--- a/src/test/java/org/apache/commons/math3/genetics/CycleCrossoverTest.java
+++ b/src/test/java/org/apache/commons/math3/genetics/CycleCrossoverTest.java
@@ -22,7 +22,7 @@ import org.junit.Assert;
 import org.junit.Test;
 
 public class CycleCrossoverTest {
-    
+
     @Test
     public void testCrossoverExample() {
         // taken from http://www.rubicite.com/Tutorials/GeneticAlgorithms/CrossoverOperators/CycleCrossoverOperator.aspx
@@ -81,7 +81,7 @@ public class CycleCrossoverTest {
             final Integer[] c2 = ((DummyListChromosome) pair.getSecond()).getRepresentation().toArray(new Integer[p2.length]);
 
             int index = 0;
-            // Determine if it is in the same spot as in the first parent, if 
+            // Determine if it is in the same spot as in the first parent, if
             // not it comes from the second parent.
             for (final Integer j : c1) {
                 if (!p1[index].equals(j)) {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/genetics/DummyListChromosome.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/genetics/DummyListChromosome.java b/src/test/java/org/apache/commons/math3/genetics/DummyListChromosome.java
index 4831e67..3dbc967 100644
--- a/src/test/java/org/apache/commons/math3/genetics/DummyListChromosome.java
+++ b/src/test/java/org/apache/commons/math3/genetics/DummyListChromosome.java
@@ -38,7 +38,7 @@ public class DummyListChromosome extends AbstractListChromosome<Integer> {
 
     @Override
     protected void checkValidity(final List<Integer> chromosomeRepresentation) throws InvalidRepresentationException {
-        // Not important.            
+        // Not important.
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/genetics/ElitisticListPopulationTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/genetics/ElitisticListPopulationTest.java b/src/test/java/org/apache/commons/math3/genetics/ElitisticListPopulationTest.java
index dbfc9f1..46265c5 100644
--- a/src/test/java/org/apache/commons/math3/genetics/ElitisticListPopulationTest.java
+++ b/src/test/java/org/apache/commons/math3/genetics/ElitisticListPopulationTest.java
@@ -40,7 +40,7 @@ public class ElitisticListPopulationTest {
 
         Assert.assertEquals(20, nextGeneration.getPopulationSize());
     }
-    
+
     @Test
     public void testSetElitismRate() {
         final double rate = 0.25;
@@ -48,27 +48,27 @@ public class ElitisticListPopulationTest {
         pop.setElitismRate(rate);
         Assert.assertEquals(rate, pop.getElitismRate(), 1e-6);
     }
-    
+
     @Test(expected = OutOfRangeException.class)
     public void testSetElitismRateTooLow() {
         final double rate = -0.25;
         final ElitisticListPopulation pop = new ElitisticListPopulation(100, 0.203);
         pop.setElitismRate(rate);
     }
-    
+
     @Test(expected = OutOfRangeException.class)
     public void testSetElitismRateTooHigh() {
         final double rate = 1.25;
         final ElitisticListPopulation pop = new ElitisticListPopulation(100, 0.203);
         pop.setElitismRate(rate);
     }
-    
+
     @Test(expected = OutOfRangeException.class)
     public void testConstructorTooLow() {
         final double rate = -0.25;
         new ElitisticListPopulation(100, rate);
     }
-    
+
     @Test(expected = OutOfRangeException.class)
     public void testConstructorTooHigh() {
         final double rate = 1.25;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/genetics/ListPopulationTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/genetics/ListPopulationTest.java b/src/test/java/org/apache/commons/math3/genetics/ListPopulationTest.java
index 9234492..7481fac 100644
--- a/src/test/java/org/apache/commons/math3/genetics/ListPopulationTest.java
+++ b/src/test/java/org/apache/commons/math3/genetics/ListPopulationTest.java
@@ -60,13 +60,13 @@ public class ListPopulationTest {
 
         Assert.assertEquals(c3, population.getFittestChromosome());
     }
-    
+
     @Test
     public void testChromosomes() {
         final ArrayList<Chromosome> chromosomes = new ArrayList<Chromosome> ();
         chromosomes.add(new DummyBinaryChromosome(BinaryChromosome.randomBinaryRepresentation(3)));
         chromosomes.add(new DummyBinaryChromosome(BinaryChromosome.randomBinaryRepresentation(3)));
-        chromosomes.add(new DummyBinaryChromosome(BinaryChromosome.randomBinaryRepresentation(3)));        
+        chromosomes.add(new DummyBinaryChromosome(BinaryChromosome.randomBinaryRepresentation(3)));
 
         final ListPopulation population = new ListPopulation(10) {
             public Population nextGeneration() {
@@ -74,16 +74,16 @@ public class ListPopulationTest {
                 return null;
             }
         };
-        
+
         population.addChromosomes(chromosomes);
 
         Assert.assertEquals(chromosomes, population.getChromosomes());
         Assert.assertEquals(chromosomes.toString(), population.toString());
-        
+
         population.setPopulationLimit(50);
         Assert.assertEquals(50, population.getPopulationLimit());
     }
-    
+
     @Test(expected = NotPositiveException.class)
     public void testSetPopulationLimit() {
         final ListPopulation population = new ListPopulation(10) {
@@ -92,7 +92,7 @@ public class ListPopulationTest {
                 return null;
             }
         };
-        
+
         population.setPopulationLimit(-50);
     }
 
@@ -123,7 +123,7 @@ public class ListPopulationTest {
         final ArrayList<Chromosome> chromosomes = new ArrayList<Chromosome> ();
         chromosomes.add(new DummyBinaryChromosome(BinaryChromosome.randomBinaryRepresentation(3)));
         chromosomes.add(new DummyBinaryChromosome(BinaryChromosome.randomBinaryRepresentation(3)));
-        chromosomes.add(new DummyBinaryChromosome(BinaryChromosome.randomBinaryRepresentation(3)));        
+        chromosomes.add(new DummyBinaryChromosome(BinaryChromosome.randomBinaryRepresentation(3)));
         new ListPopulation(chromosomes, 1) {
             public Population nextGeneration() {
                 // not important
@@ -131,7 +131,7 @@ public class ListPopulationTest {
             }
         };
     }
-    
+
     @Test(expected=NumberIsTooLargeException.class)
     public void testAddTooManyChromosomes() {
         final ArrayList<Chromosome> chromosomes = new ArrayList<Chromosome> ();
@@ -145,10 +145,10 @@ public class ListPopulationTest {
                 return null;
             }
         };
-        
+
         population.addChromosomes(chromosomes);
     }
-    
+
     @Test(expected=NumberIsTooLargeException.class)
     public void testAddTooManyChromosomesSingleCall() {
 
@@ -163,7 +163,7 @@ public class ListPopulationTest {
             population.addChromosome(new DummyBinaryChromosome(BinaryChromosome.randomBinaryRepresentation(3)));
         }
     }
-    
+
     @Test(expected = UnsupportedOperationException.class)
     public void testIterator() {
         final ArrayList<Chromosome> chromosomes = new ArrayList<Chromosome>();
@@ -186,7 +186,7 @@ public class ListPopulationTest {
             iter.remove();
         }
     }
-    
+
     @Test(expected=NumberIsTooSmallException.class)
     public void testSetPopulationLimitTooSmall() {
         final ArrayList<Chromosome> chromosomes = new ArrayList<Chromosome> ();
@@ -203,5 +203,5 @@ public class ListPopulationTest {
 
         population.setPopulationLimit(2);
     }
-    
+
 }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/genetics/NPointCrossoverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/genetics/NPointCrossoverTest.java b/src/test/java/org/apache/commons/math3/genetics/NPointCrossoverTest.java
index f290841..4e482ad 100644
--- a/src/test/java/org/apache/commons/math3/genetics/NPointCrossoverTest.java
+++ b/src/test/java/org/apache/commons/math3/genetics/NPointCrossoverTest.java
@@ -37,7 +37,7 @@ public class NPointCrossoverTest {
         final CrossoverPolicy cp = new NPointCrossover<Integer>(1);
         cp.crossover(p1c,p2c);
     }
-    
+
     @Test(expected = NumberIsTooLargeException.class)
     public void testNumberIsTooLargeException() {
         final Integer[] p1 = new Integer[] {1,0,1,0,0,1,0,1,1};
@@ -49,7 +49,7 @@ public class NPointCrossoverTest {
         final CrossoverPolicy cp = new NPointCrossover<Integer>(15);
         cp.crossover(p1c,p2c);
     }
-    
+
     @Test(expected = MathIllegalArgumentException.class)
     public void testCrossoverInvalidFixedLengthChromosomeFirst() {
         final Integer[] p1 = new Integer[] {1,0,1,0,0,1,0,1,1};
@@ -64,7 +64,7 @@ public class NPointCrossoverTest {
         final CrossoverPolicy cp = new NPointCrossover<Integer>(1);
         cp.crossover(p1c,p2c);
     }
-    
+
     @Test(expected = MathIllegalArgumentException.class)
     public void testCrossoverInvalidFixedLengthChromosomeSecond() {
         final Integer[] p1 = new Integer[] {1,0,1,0,0,1,0,1,1};
@@ -79,7 +79,7 @@ public class NPointCrossoverTest {
         final CrossoverPolicy cp = new NPointCrossover<Integer>(1);
         cp.crossover(p1c,p2c);
     }
-    
+
     @Test
     public void testCrossover() {
         Integer[] p1 = new Integer[] {1,0,1,0,1,0,1,0,1};
@@ -103,10 +103,10 @@ public class NPointCrossoverTest {
             c2 = ((BinaryChromosome) pair.getSecond()).getRepresentation().toArray(c2);
 
             Assert.assertEquals(order, detectCrossoverPoints(p1c, p2c, (BinaryChromosome) pair.getFirst()));
-            Assert.assertEquals(order, detectCrossoverPoints(p2c, p1c, (BinaryChromosome) pair.getSecond()));            
+            Assert.assertEquals(order, detectCrossoverPoints(p2c, p1c, (BinaryChromosome) pair.getSecond()));
         }
     }
-    
+
     private int detectCrossoverPoints(BinaryChromosome p1, BinaryChromosome p2, BinaryChromosome c) {
         int crossovers = 0;
         final int length = p1.getLength();
@@ -114,7 +114,7 @@ public class NPointCrossoverTest {
         final List<Integer> p1Rep = p1.getRepresentation();
         final List<Integer> p2Rep = p2.getRepresentation();
         final List<Integer> cRep = c.getRepresentation();
-        
+
         List<Integer> rep = p1Rep;
         for (int i = 0; i < length; i++) {
             if (rep.get(i) != cRep.get(i)) {
@@ -122,7 +122,7 @@ public class NPointCrossoverTest {
                 rep = rep == p1Rep ? p2Rep : p1Rep;
             }
         }
-        
+
         return crossovers;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/genetics/OrderedCrossoverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/genetics/OrderedCrossoverTest.java b/src/test/java/org/apache/commons/math3/genetics/OrderedCrossoverTest.java
index 73fd633..635248b 100644
--- a/src/test/java/org/apache/commons/math3/genetics/OrderedCrossoverTest.java
+++ b/src/test/java/org/apache/commons/math3/genetics/OrderedCrossoverTest.java
@@ -33,13 +33,13 @@ public class OrderedCrossoverTest {
         final Integer[] p2 = new Integer[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
         final DummyListChromosome p1c = new DummyListChromosome(p1);
         final DummyListChromosome p2c = new DummyListChromosome(p2);
-        
+
         final CrossoverPolicy cp = new OrderedCrossover<Integer>();
 
         for (int i = 0; i < 20; i++) {
             final Set<Integer> parentSet1 = new HashSet<Integer>(Arrays.asList(p1));
             final Set<Integer> parentSet2 = new HashSet<Integer>(Arrays.asList(p2));
-            
+
             final ChromosomePair pair = cp.crossover(p1c, p2c);
 
             final Integer[] c1 = ((DummyListChromosome) pair.getFirst()).getRepresentation().toArray(new Integer[p1.length]);
@@ -47,7 +47,7 @@ public class OrderedCrossoverTest {
 
             Assert.assertNotSame(p1c, pair.getFirst());
             Assert.assertNotSame(p2c, pair.getSecond());
-            
+
             // make sure that the children have exactly the same elements as their parents
             for (int j = 0; j < c1.length; j++) {
                 Assert.assertTrue(parentSet1.contains(c1[j]));

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/genetics/RandomKeyTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/genetics/RandomKeyTest.java b/src/test/java/org/apache/commons/math3/genetics/RandomKeyTest.java
index 4ae518f..8f4d028 100644
--- a/src/test/java/org/apache/commons/math3/genetics/RandomKeyTest.java
+++ b/src/test/java/org/apache/commons/math3/genetics/RandomKeyTest.java
@@ -62,7 +62,7 @@ public class RandomKeyTest {
         Assert.assertEquals("c", decoded.get(3));
         Assert.assertEquals("d", decoded.get(4));
     }
-    
+
     @Test(expected=IllegalArgumentException.class)
     public void testInvalidRepresentation() {
         new DummyRandomKey(new Double[] {0.1, 0.1, 2d, 0.8, 0.2});

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/genetics/UniformCrossoverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/genetics/UniformCrossoverTest.java b/src/test/java/org/apache/commons/math3/genetics/UniformCrossoverTest.java
index a99cb4a..bfbab7f 100644
--- a/src/test/java/org/apache/commons/math3/genetics/UniformCrossoverTest.java
+++ b/src/test/java/org/apache/commons/math3/genetics/UniformCrossoverTest.java
@@ -45,20 +45,20 @@ public class UniformCrossoverTest {
     public void testRatioTooLow() {
         new UniformCrossover<Integer>(-0.5d);
     }
-    
+
     @Test(expected = OutOfRangeException.class)
     public void testRatioTooHigh() {
         new UniformCrossover<Integer>(1.5d);
     }
-    
+
     @Test
     public void testCrossover() {
         // test crossover with different ratios
         performCrossover(0.5);
         performCrossover(0.7);
-        performCrossover(0.2);        
+        performCrossover(0.2);
     }
-    
+
     private void performCrossover(double ratio) {
         final DummyBinaryChromosome p1c = new DummyBinaryChromosome(p1);
         final DummyBinaryChromosome p2c = new DummyBinaryChromosome(p2);
@@ -103,7 +103,7 @@ public class UniformCrossoverTest {
             Assert.assertEquals(1.0 - ratio, (double) from2 / LEN, 0.1);
         }
     }
-    
+
     @Test(expected = DimensionMismatchException.class)
     public void testCrossoverDimensionMismatchException(){
         @SuppressWarnings("boxing")
@@ -117,7 +117,7 @@ public class UniformCrossoverTest {
         final CrossoverPolicy cp = new UniformCrossover<Integer>(0.5d);
         cp.crossover(p1c, p2c);
     }
-    
+
     @Test(expected = MathIllegalArgumentException.class)
     public void testCrossoverInvalidFixedLengthChromosomeFirst() {
         @SuppressWarnings("boxing")
@@ -133,7 +133,7 @@ public class UniformCrossoverTest {
         final CrossoverPolicy cp = new UniformCrossover<Integer>(0.5d);
         cp.crossover(p1c, p2c);
     }
-    
+
     @Test(expected = MathIllegalArgumentException.class)
     public void testCrossoverInvalidFixedLengthChromosomeSecond() {
         @SuppressWarnings("boxing")

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/FieldVector3DTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/FieldVector3DTest.java b/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/FieldVector3DTest.java
index 75e93e0..d494902 100644
--- a/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/FieldVector3DTest.java
+++ b/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/FieldVector3DTest.java
@@ -486,7 +486,7 @@ public class FieldVector3DTest {
         Assert.assertEquals(FastMath.PI / 2, createVector(0, 1, 0, 3).getAlpha().getReal(), 1.0e-10);
         Assert.assertEquals(0,           createVector(0, 1, 0, 3).getDelta().getReal(), 1.0e-10);
         Assert.assertEquals(FastMath.PI / 2, createVector(0, 0, 1, 3).getDelta().getReal(), 1.0e-10);
-      
+
         FieldVector3D<DerivativeStructure> u = createVector(-1, 1, -1, 3);
         Assert.assertEquals(3 * FastMath.PI /4, u.getAlpha().getReal(), 1.0e-10);
         Assert.assertEquals(-1.0 / FastMath.sqrt(3), u.getDelta().sin().getReal(), 1.0e-10);
@@ -632,8 +632,8 @@ public class FieldVector3DTest {
         final FieldVector3D<DerivativeStructure> u2 = createVector( 1796571811118507.0 /  2147483648.0,
                                           7853468008299307.0 /  2147483648.0,
                                           2599586637357461.0 / 17179869184.0, 3);
-        final FieldVector3D<DerivativeStructure> u3 = createVector(12753243807587107.0 / 18446744073709551616.0, 
-                                         -2313766922703915.0 / 18446744073709551616.0, 
+        final FieldVector3D<DerivativeStructure> u3 = createVector(12753243807587107.0 / 18446744073709551616.0,
+                                         -2313766922703915.0 / 18446744073709551616.0,
                                           -227970081415313.0 /   288230376151711744.0, 3);
         FieldVector3D<DerivativeStructure> cNaive = new FieldVector3D<DerivativeStructure>(u1.getY().multiply(u2.getZ()).subtract(u1.getZ().multiply(u2.getY())),
                                        u1.getZ().multiply(u2.getX()).subtract(u1.getX().multiply(u2.getZ())),

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/LineTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/LineTest.java b/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/LineTest.java
index 1811869..20b10e1 100644
--- a/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/LineTest.java
+++ b/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/LineTest.java
@@ -131,7 +131,7 @@ public class LineTest {
 
     @Test
     public void testRevert() {
-        
+
         // setup
         Line line = new Line(new Vector3D(1653345.6696423641, 6170370.041579291, 90000),
                              new Vector3D(1650757.5050732433, 6160710.879908984, 0.9),

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/PolyhedronsSetTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/PolyhedronsSetTest.java b/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/PolyhedronsSetTest.java
index 10ae3d5..c6fdcfb 100644
--- a/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/PolyhedronsSetTest.java
+++ b/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/PolyhedronsSetTest.java
@@ -254,20 +254,20 @@ public class PolyhedronsSetTest {
     @Test
     public void testIssue780() throws MathArithmeticException {
         float[] coords = {
-            1.000000f, -1.000000f, -1.000000f, 
-            1.000000f, -1.000000f, 1.000000f, 
-            -1.000000f, -1.000000f, 1.000000f, 
-            -1.000000f, -1.000000f, -1.000000f, 
-            1.000000f, 1.000000f, -1f, 
-            0.999999f, 1.000000f, 1.000000f,   // 1.000000f, 1.000000f, 1.000000f, 
-            -1.000000f, 1.000000f, 1.000000f, 
+            1.000000f, -1.000000f, -1.000000f,
+            1.000000f, -1.000000f, 1.000000f,
+            -1.000000f, -1.000000f, 1.000000f,
+            -1.000000f, -1.000000f, -1.000000f,
+            1.000000f, 1.000000f, -1f,
+            0.999999f, 1.000000f, 1.000000f,   // 1.000000f, 1.000000f, 1.000000f,
+            -1.000000f, 1.000000f, 1.000000f,
             -1.000000f, 1.000000f, -1.000000f};
         int[] indices = {
-            0, 1, 2, 0, 2, 3, 
-            4, 7, 6, 4, 6, 5, 
-            0, 4, 5, 0, 5, 1, 
-            1, 5, 6, 1, 6, 2, 
-            2, 6, 7, 2, 7, 3, 
+            0, 1, 2, 0, 2, 3,
+            4, 7, 6, 4, 6, 5,
+            0, 4, 5, 0, 5, 1,
+            1, 5, 6, 1, 6, 2,
+            2, 6, 7, 2, 7, 3,
             4, 0, 3, 4, 3, 7};
         ArrayList<SubHyperplane<Euclidean3D>> subHyperplaneList = new ArrayList<SubHyperplane<Euclidean3D>>();
         for (int idx = 0; idx < indices.length; idx += 3) {
@@ -325,7 +325,7 @@ public class PolyhedronsSetTest {
     @Test
     public void testDumpParse() throws IOException, ParseException {
         double tol=1e-8;
-        
+
             Vector3D[] verts=new Vector3D[8];
             double xmin=-1,xmax=1;
             double ymin=-1,ymax=1;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/RotationTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/RotationTest.java b/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/RotationTest.java
index d14f77f..ce38a40 100644
--- a/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/RotationTest.java
+++ b/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/RotationTest.java
@@ -534,7 +534,7 @@ public class RotationTest {
       Assert.assertEquals(1.0, q2, 1.0e-14);
       Assert.assertEquals(0.0, Vector3D.angle(v1, quat.applyTo(u1)), 1.0e-14);
       Assert.assertEquals(0.0, Vector3D.angle(v2, quat.applyTo(u2)), 1.0e-14);
-      
+
   }
 
   private void checkVector(Vector3D v1, Vector3D v2) {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/SphereGeneratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/SphereGeneratorTest.java b/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/SphereGeneratorTest.java
index 1950a06..14070b0 100644
--- a/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/SphereGeneratorTest.java
+++ b/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/SphereGeneratorTest.java
@@ -148,7 +148,7 @@ public class SphereGeneratorTest {
             Assert.assertEquals(0.0, refCenter.distance(sphere.getCenter()), 4e-7 * refRadius);
             Assert.assertEquals(refRadius, sphere.getRadius(), 1e-7 * refRadius);
         }
-        
+
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/SphericalCoordinatesTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/SphericalCoordinatesTest.java b/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/SphericalCoordinatesTest.java
index 9bc9207..b7cb810 100644
--- a/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/SphericalCoordinatesTest.java
+++ b/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/SphericalCoordinatesTest.java
@@ -96,7 +96,7 @@ public class SphericalCoordinatesTest {
                                                          cvalue.getPartialDerivative(0, 0, 1));
 
                     Vector3D testCGradient = new Vector3D(sc.toCartesianGradient(sGradient));
-                    
+
                     Assert.assertEquals(0, testCGradient.distance(refCGradient) / refCGradient.getNorm(), 5.0e-14);
 
                 }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/SubLineTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/SubLineTest.java b/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/SubLineTest.java
index 6996111..999f0dd 100644
--- a/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/SubLineTest.java
+++ b/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/SubLineTest.java
@@ -152,7 +152,7 @@ public class SubLineTest {
         Assert.assertNull(sub1.intersection(sub2, true));
         Assert.assertNull(sub1.intersection(sub2, false));
     }
-    
+
     @Test
     public void testIntersectionNotIntersecting() throws MathIllegalArgumentException {
         SubLine sub1 = new SubLine(new Vector3D(1, 1, 1), new Vector3D(1.5, 1, 1), 1.0e-10);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/Vector3DTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/Vector3DTest.java b/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/Vector3DTest.java
index 654d9c2..0fdd0db 100644
--- a/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/Vector3DTest.java
+++ b/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/Vector3DTest.java
@@ -258,7 +258,7 @@ public class Vector3DTest {
         Assert.assertEquals(0,           Vector3D.PLUS_J.getDelta(), 1.0e-10);
         Assert.assertEquals(0,           Vector3D.PLUS_K.getAlpha(), 1.0e-10);
         Assert.assertEquals(FastMath.PI / 2, Vector3D.PLUS_K.getDelta(), 1.0e-10);
-      
+
         Vector3D u = new Vector3D(-1, 1, -1);
         Assert.assertEquals(3 * FastMath.PI /4, u.getAlpha(), 1.0e-10);
         Assert.assertEquals(-1.0 / FastMath.sqrt(3), FastMath.sin(u.getDelta()), 1.0e-10);
@@ -375,8 +375,8 @@ public class Vector3DTest {
         final Vector3D u2 = new Vector3D( 1796571811118507.0 /  2147483648.0,
                                           7853468008299307.0 /  2147483648.0,
                                           2599586637357461.0 / 17179869184.0);
-        final Vector3D u3 = new Vector3D(12753243807587107.0 / 18446744073709551616.0, 
-                                         -2313766922703915.0 / 18446744073709551616.0, 
+        final Vector3D u3 = new Vector3D(12753243807587107.0 / 18446744073709551616.0,
+                                         -2313766922703915.0 / 18446744073709551616.0,
                                           -227970081415313.0 /   288230376151711744.0);
         Vector3D cNaive = new Vector3D(u1.getY() * u2.getZ() - u1.getZ() * u2.getY(),
                                        u1.getZ() * u2.getX() - u1.getX() * u2.getZ(),

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/geometry/euclidean/twod/DiskGeneratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/geometry/euclidean/twod/DiskGeneratorTest.java b/src/test/java/org/apache/commons/math3/geometry/euclidean/twod/DiskGeneratorTest.java
index a7fc16e..79141e7 100644
--- a/src/test/java/org/apache/commons/math3/geometry/euclidean/twod/DiskGeneratorTest.java
+++ b/src/test/java/org/apache/commons/math3/geometry/euclidean/twod/DiskGeneratorTest.java
@@ -113,6 +113,6 @@ public class DiskGeneratorTest {
             Assert.assertEquals(0.0, refCenter.distance(disk.getCenter()), 3e-9 * refRadius);
             Assert.assertEquals(refRadius, disk.getRadius(), 7e-10 * refRadius);
         }
-        
+
     }
 }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/geometry/euclidean/twod/PolygonsSetTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/geometry/euclidean/twod/PolygonsSetTest.java b/src/test/java/org/apache/commons/math3/geometry/euclidean/twod/PolygonsSetTest.java
index 526c076..90f80a8 100644
--- a/src/test/java/org/apache/commons/math3/geometry/euclidean/twod/PolygonsSetTest.java
+++ b/src/test/java/org/apache/commons/math3/geometry/euclidean/twod/PolygonsSetTest.java
@@ -221,7 +221,7 @@ public class PolygonsSetTest {
                 Assert.assertEquals(3.0,      p.getY(), 1.0e-10);
                 Assert.assertEquals(+v.distance(new Vector2D(3, 3)), projection.getOffset(), 1.0e-10);
             }
-            
+
         }
 
     }
@@ -1103,15 +1103,15 @@ public class PolygonsSetTest {
     public void testIssue1162() {
         PolygonsSet p = new PolygonsSet(1.0e-10,
                                                 new Vector2D(4.267199999996532, -11.928637756014894),
-                                                new Vector2D(4.267200000026445, -14.12360595809307), 
-                                                new Vector2D(9.144000000273694, -14.12360595809307), 
+                                                new Vector2D(4.267200000026445, -14.12360595809307),
+                                                new Vector2D(9.144000000273694, -14.12360595809307),
                                                 new Vector2D(9.144000000233383, -11.928637756020067));
 
         PolygonsSet w = new PolygonsSet(1.0e-10,
                                                 new Vector2D(2.56735636510452512E-9, -11.933116461089332),
-                                                new Vector2D(2.56735636510452512E-9, -12.393225665247766), 
-                                                new Vector2D(2.56735636510452512E-9, -27.785625665247778), 
-                                                new Vector2D(4.267200000030211,      -27.785625665247778), 
+                                                new Vector2D(2.56735636510452512E-9, -12.393225665247766),
+                                                new Vector2D(2.56735636510452512E-9, -27.785625665247778),
+                                                new Vector2D(4.267200000030211,      -27.785625665247778),
                                                 new Vector2D(4.267200000030211,      -11.933116461089332));
 
         Assert.assertFalse(p.contains(w));

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/geometry/euclidean/twod/Vector2DTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/geometry/euclidean/twod/Vector2DTest.java b/src/test/java/org/apache/commons/math3/geometry/euclidean/twod/Vector2DTest.java
index 32e5325..6a65329 100644
--- a/src/test/java/org/apache/commons/math3/geometry/euclidean/twod/Vector2DTest.java
+++ b/src/test/java/org/apache/commons/math3/geometry/euclidean/twod/Vector2DTest.java
@@ -27,13 +27,13 @@ public class Vector2DTest {
 
         Vector2D p1 = new Vector2D(1, 1);
         Vector2D p2 = new Vector2D(2, 2);
-        
+
         Vector2D p3 = new Vector2D(3, 3);
         Assert.assertEquals(0.0, p3.crossProduct(p1, p2), epsilon);
-        
+
         Vector2D p4 = new Vector2D(1, 2);
         Assert.assertEquals(1.0, p4.crossProduct(p1, p2), epsilon);
-        
+
         Vector2D p5 = new Vector2D(2, 1);
         Assert.assertEquals(-1.0, p5.crossProduct(p1, p2), epsilon);
     }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/geometry/euclidean/twod/hull/ConvexHullGenerator2DAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/geometry/euclidean/twod/hull/ConvexHullGenerator2DAbstractTest.java b/src/test/java/org/apache/commons/math3/geometry/euclidean/twod/hull/ConvexHullGenerator2DAbstractTest.java
index 0c52550..2680945 100644
--- a/src/test/java/org/apache/commons/math3/geometry/euclidean/twod/hull/ConvexHullGenerator2DAbstractTest.java
+++ b/src/test/java/org/apache/commons/math3/geometry/euclidean/twod/hull/ConvexHullGenerator2DAbstractTest.java
@@ -38,7 +38,7 @@ import org.junit.Test;
 
 /**
  * Abstract base test class for 2D convex hull generators.
- * 
+ *
  */
 public abstract class ConvexHullGenerator2DAbstractTest {
 
@@ -65,7 +65,7 @@ public abstract class ConvexHullGenerator2DAbstractTest {
     public void testNullArgument() {
         generator.generate(null);
     }
-    
+
     @Test
     public void testEmpty() {
         ConvexHull2D hull = generator.generate(Collections.<Vector2D>emptyList());
@@ -244,9 +244,9 @@ public abstract class ConvexHullGenerator2DAbstractTest {
 
         hull = createConvexHullGenerator(true).generate(points);
         checkConvexHull(points, hull, true);
-        
+
         points.clear();
-        
+
         // second case: multiple points are collinear
         points.add(new Vector2D(0, -29.959696875));
         points.add(new Vector2D(0, -31.621809375));
@@ -325,7 +325,7 @@ public abstract class ConvexHullGenerator2DAbstractTest {
             points.add(new Vector2D(line[0], line[1]));
         }
 
-        Vector2D[] referenceHull = new Vector2D[] { 
+        Vector2D[] referenceHull = new Vector2D[] {
             new Vector2D(-11.0, -1.0),
             new Vector2D(-10.0, -3.0),
             new Vector2D( -6.0, -7.0),
@@ -362,7 +362,7 @@ public abstract class ConvexHullGenerator2DAbstractTest {
     }
 
     // ------------------------------------------------------------------------------
-    
+
     protected final List<Vector2D> createRandomPoints(int size) {
         // create the cloud container
         List<Vector2D> points = new ArrayList<Vector2D>(size);
@@ -417,13 +417,13 @@ public abstract class ConvexHullGenerator2DAbstractTest {
                     return false;
                 }
             }
-            
+
             sign = cmp;
         }
-        
+
         return true;
     }
-    
+
     // verify that all points are inside the convex hull region
     protected final void checkPointsInsideHullRegion(final Collection<Vector2D> points,
                                                      final ConvexHull2D hull,

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/geometry/partitioning/RegionDumper.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/geometry/partitioning/RegionDumper.java b/src/test/java/org/apache/commons/math3/geometry/partitioning/RegionDumper.java
index fae3fd8..5142025 100644
--- a/src/test/java/org/apache/commons/math3/geometry/partitioning/RegionDumper.java
+++ b/src/test/java/org/apache/commons/math3/geometry/partitioning/RegionDumper.java
@@ -50,7 +50,7 @@ public class RegionDumper {
 
     /** Private constructor for a utility class
      */
-    private RegionDumper() {    
+    private RegionDumper() {
     }
 
     /** Get a string representation of an {@link ArcsSet}.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/geometry/partitioning/RegionParser.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/geometry/partitioning/RegionParser.java b/src/test/java/org/apache/commons/math3/geometry/partitioning/RegionParser.java
index 8fc1e6e..267e7ec 100644
--- a/src/test/java/org/apache/commons/math3/geometry/partitioning/RegionParser.java
+++ b/src/test/java/org/apache/commons/math3/geometry/partitioning/RegionParser.java
@@ -52,7 +52,7 @@ public class RegionParser {
 
     /** Private constructor for a utility class
      */
-    private RegionParser() {    
+    private RegionParser() {
     }
 
     /** Parse a string representation of an {@link ArcsSet}.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/geometry/spherical/twod/CircleTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/geometry/spherical/twod/CircleTest.java b/src/test/java/org/apache/commons/math3/geometry/spherical/twod/CircleTest.java
index 7546017..4258399 100644
--- a/src/test/java/org/apache/commons/math3/geometry/spherical/twod/CircleTest.java
+++ b/src/test/java/org/apache/commons/math3/geometry/spherical/twod/CircleTest.java
@@ -93,7 +93,7 @@ public class CircleTest {
         Assert.assertEquals(circle.getPhase(p), circle.getPhase(samePhase), 1.0e-10);
         Assert.assertEquals(0.0, circle.getPhase(circle.getXAxis()), 1.0e-10);
         Assert.assertEquals(0.5 * FastMath.PI, circle.getPhase(circle.getYAxis()), 1.0e-10);
-        
+
     }
 
     @Test
@@ -126,7 +126,7 @@ public class CircleTest {
         Assert.assertEquals(0.0,                circle.getOffset(new S2Point(Vector3D.MINUS_J)), 1.0e-10);
         Assert.assertEquals(-0.5 * FastMath.PI, circle.getOffset(new S2Point(Vector3D.PLUS_K)),  1.0e-10);
         Assert.assertEquals( 0.5 * FastMath.PI, circle.getOffset(new S2Point(Vector3D.MINUS_K)), 1.0e-10);
-        
+
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/linear/Array2DRowRealMatrixTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/linear/Array2DRowRealMatrixTest.java b/src/test/java/org/apache/commons/math3/linear/Array2DRowRealMatrixTest.java
index 06c4b42..a48afa1 100644
--- a/src/test/java/org/apache/commons/math3/linear/Array2DRowRealMatrixTest.java
+++ b/src/test/java/org/apache/commons/math3/linear/Array2DRowRealMatrixTest.java
@@ -536,7 +536,7 @@ public final class Array2DRowRealMatrixTest {
         checkCopy(m, null,  1, 0, 2, 4, true);
         checkCopy(m, null, new int[] {},    new int[] { 0 }, true);
         checkCopy(m, null, new int[] { 0 }, new int[] { 4 }, true);
-        
+
         // rectangular check
         double[][] copy = new double[][] { { 0, 0, 0 }, { 0, 0 } };
         checkCopy(m, copy, 0, 1, 0, 2, true);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/linear/DiagonalMatrixTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/linear/DiagonalMatrixTest.java b/src/test/java/org/apache/commons/math3/linear/DiagonalMatrixTest.java
index db0ef43..1b2ccdc 100644
--- a/src/test/java/org/apache/commons/math3/linear/DiagonalMatrixTest.java
+++ b/src/test/java/org/apache/commons/math3/linear/DiagonalMatrixTest.java
@@ -123,14 +123,14 @@ public class DiagonalMatrixTest {
                     Assert.assertEquals(0d, out[i][j], 0d);
                 }
             }
-        }        
+        }
     }
 
     @Test
     public void testAdd() {
         final double[] data1 = { -1.2, 3.4, 5 };
         final DiagonalMatrix m1 = new DiagonalMatrix(data1);
- 
+
         final double[] data2 = { 10.1, 2.3, 45 };
         final DiagonalMatrix m2 = new DiagonalMatrix(data2);
 
@@ -151,7 +151,7 @@ public class DiagonalMatrixTest {
     public void testSubtract() {
         final double[] data1 = { -1.2, 3.4, 5 };
         final DiagonalMatrix m1 = new DiagonalMatrix(data1);
- 
+
         final double[] data2 = { 10.1, 2.3, 45 };
         final DiagonalMatrix m2 = new DiagonalMatrix(data2);
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/linear/EigenDecompositionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/linear/EigenDecompositionTest.java b/src/test/java/org/apache/commons/math3/linear/EigenDecompositionTest.java
index ce0a6d0..73f21ea 100644
--- a/src/test/java/org/apache/commons/math3/linear/EigenDecompositionTest.java
+++ b/src/test/java/org/apache/commons/math3/linear/EigenDecompositionTest.java
@@ -329,7 +329,7 @@ public class EigenDecompositionTest {
 
         EigenDecomposition ed;
         ed = new EigenDecomposition(symmetric);
-        
+
         RealMatrix d = ed.getD();
         RealMatrix v = ed.getV();
         RealMatrix vT = ed.getVT();
@@ -395,7 +395,7 @@ public class EigenDecompositionTest {
                              { 27.0, 9.0,  3.0, 1.0 },
                              { 64.0, 16.0, 4.0, 1.0 } };
         checkUnsymmetricMatrix(MatrixUtils.createRealMatrix(vData));
-      
+
         RealMatrix randMatrix = MatrixUtils.createRealMatrix(new double[][] {
                 {0,  1,     0,     0},
                 {1,  0,     2.e-7, 0},
@@ -415,7 +415,7 @@ public class EigenDecompositionTest {
         };
         checkUnsymmetricMatrix(MatrixUtils.createRealMatrix(randData2));
     }
-    
+
     @Test
     @Ignore
     public void testRandomUnsymmetricMatrix() {
@@ -434,12 +434,12 @@ public class EigenDecompositionTest {
 
             RealMatrix m = MatrixUtils.createRealMatrix(data);
             checkUnsymmetricMatrix(m);
-        }        
+        }
     }
 
     /**
      * Tests the porting of a bugfix in Jama-1.0.3 (from changelog):
-     * 
+     *
      *  Patched hqr2 method in Jama.EigenvalueDecomposition to avoid infinite loop;
      *  Thanks Frederic Devernay <fr...@m4x.org>
      */
@@ -452,7 +452,7 @@ public class EigenDecompositionTest {
                 {1,1,0,0,1},
                 {1,0,1,0,1}
         };
-        
+
         RealMatrix m = MatrixUtils.createRealMatrix(data);
         checkUnsymmetricMatrix(m);
     }
@@ -478,7 +478,7 @@ public class EigenDecompositionTest {
             checkUnsymmetricMatrix(m);
         }
     }
-    
+
     @Test
     public void testMath848() {
         double[][] data = {
@@ -501,18 +501,18 @@ public class EigenDecompositionTest {
     private void checkUnsymmetricMatrix(final RealMatrix m) {
         try {
             EigenDecomposition ed = new EigenDecomposition(m);
-        
+
             RealMatrix d = ed.getD();
             RealMatrix v = ed.getV();
             //RealMatrix vT = ed.getVT();
 
             RealMatrix x = m.multiply(v);
             RealMatrix y = v.multiply(d);
-        
+
             double diffNorm = x.subtract(y).getNorm();
             Assert.assertTrue("The norm of (X-Y) is too large: " + diffNorm + ", matrix=" + m.toString(),
                     x.subtract(y).getNorm() < 1000 * Precision.EPSILON * FastMath.max(x.getNorm(), y.getNorm()));
-        
+
             RealMatrix invV = new LUDecomposition(v).getSolver().getInverse();
             double norm = v.multiply(d).multiply(invV).subtract(m).getNorm();
             Assert.assertEquals(0.0, norm, 1.0e-10);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/linear/HessenbergTransformerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/linear/HessenbergTransformerTest.java b/src/test/java/org/apache/commons/math3/linear/HessenbergTransformerTest.java
index ec7271b..4bf136e 100644
--- a/src/test/java/org/apache/commons/math3/linear/HessenbergTransformerTest.java
+++ b/src/test/java/org/apache/commons/math3/linear/HessenbergTransformerTest.java
@@ -163,17 +163,17 @@ public class HessenbergTransformerTest {
     ///////////////////////////////////////////////////////////////////////////
     // Test helpers
     ///////////////////////////////////////////////////////////////////////////
-    
+
     private RealMatrix checkAEqualPHPt(RealMatrix matrix) {
         HessenbergTransformer transformer = new HessenbergTransformer(matrix);
         RealMatrix p  = transformer.getP();
         RealMatrix pT = transformer.getPT();
         RealMatrix h  = transformer.getH();
-        
+
         RealMatrix result = p.multiply(h).multiply(pT);
         double norm = result.subtract(matrix).getNorm();
         Assert.assertEquals(0, norm, 1.0e-10);
-        
+
         for (int i = 0; i < matrix.getRowDimension(); ++i) {
             for (int j = 0; j < matrix.getColumnDimension(); ++j) {
                 if (i > j + 1) {
@@ -181,7 +181,7 @@ public class HessenbergTransformerTest {
                 }
             }
         }
-        
+
         return transformer.getH();
     }
 
@@ -202,7 +202,7 @@ public class HessenbergTransformerTest {
             }
         }
     }
-    
+
     private void checkMatricesValues(double[][] matrix, double[][] pRef, double[][] hRef) {
         HessenbergTransformer transformer =
             new HessenbergTransformer(MatrixUtils.createRealMatrix(matrix));

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/linear/MatrixDimensionMismatchExceptionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/linear/MatrixDimensionMismatchExceptionTest.java b/src/test/java/org/apache/commons/math3/linear/MatrixDimensionMismatchExceptionTest.java
index acfa71d..57e3374 100644
--- a/src/test/java/org/apache/commons/math3/linear/MatrixDimensionMismatchExceptionTest.java
+++ b/src/test/java/org/apache/commons/math3/linear/MatrixDimensionMismatchExceptionTest.java
@@ -21,7 +21,7 @@ import org.junit.Test;
 
 /**
  * Test for {@link MatrixDimensionMismatchException}.
- * 
+ *
  */
 public class MatrixDimensionMismatchExceptionTest {
     @Test

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/linear/MatrixUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/linear/MatrixUtilsTest.java b/src/test/java/org/apache/commons/math3/linear/MatrixUtilsTest.java
index 5c308ad..da14624 100644
--- a/src/test/java/org/apache/commons/math3/linear/MatrixUtilsTest.java
+++ b/src/test/java/org/apache/commons/math3/linear/MatrixUtilsTest.java
@@ -303,8 +303,8 @@ public final class MatrixUtilsTest {
         }
         return d;
     }
-  
-    @Test 
+
+    @Test
     public void testSolveLowerTriangularSystem(){
         RealMatrix rm = new Array2DRowRealMatrix(
                 new double[][] { {2,0,0,0 }, { 1,1,0,0 }, { 3,3,3,0 }, { 3,3,3,4 } },
@@ -313,8 +313,8 @@ public final class MatrixUtilsTest {
         MatrixUtils.solveLowerTriangularSystem(rm, b);
         TestUtils.assertEquals( new double[]{1,2,-1.66666666666667, 1.0}  , b.toArray() , 1.0e-12);
     }
-    
-     
+
+
     /*
      * Taken from R manual http://stat.ethz.ch/R-manual/R-patched/library/base/html/backsolve.html
      */
@@ -437,7 +437,7 @@ public final class MatrixUtilsTest {
         };
         MatrixUtils.checkSymmetric(MatrixUtils.createRealMatrix(dataSym), Math.ulp(1d));
     }
-    
+
     @Test(expected=NonSymmetricMatrixException.class)
     public void testCheckSymmetric2() {
         final double[][] dataNonSym = {
@@ -447,19 +447,19 @@ public final class MatrixUtilsTest {
         };
         MatrixUtils.checkSymmetric(MatrixUtils.createRealMatrix(dataNonSym), Math.ulp(1d));
     }
-    
+
     @Test(expected=SingularMatrixException.class)
     public void testInverseSingular() {
         RealMatrix m = MatrixUtils.createRealMatrix(testData3x3Singular);
         MatrixUtils.inverse(m);
     }
-    
+
     @Test(expected=NonSquareMatrixException.class)
     public void testInverseNonSquare() {
         RealMatrix m = MatrixUtils.createRealMatrix(testData3x4);
         MatrixUtils.inverse(m);
     }
-    
+
     @Test
     public void testInverseDiagonalMatrix() {
         final double[] data = { 1, 2, 3 };

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/linear/QRDecompositionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/linear/QRDecompositionTest.java b/src/test/java/org/apache/commons/math3/linear/QRDecompositionTest.java
index a2d93f7..003a1bd 100644
--- a/src/test/java/org/apache/commons/math3/linear/QRDecompositionTest.java
+++ b/src/test/java/org/apache/commons/math3/linear/QRDecompositionTest.java
@@ -273,7 +273,7 @@ public class QRDecompositionTest {
         });
         return m;
     }
-    
+
     @Test(expected=SingularMatrixException.class)
     public void testQRSingular() {
         final RealMatrix a = MatrixUtils.createRealMatrix(new double[][] {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/linear/RRQRSolverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/linear/RRQRSolverTest.java b/src/test/java/org/apache/commons/math3/linear/RRQRSolverTest.java
index 63364c7..ecff9f0 100644
--- a/src/test/java/org/apache/commons/math3/linear/RRQRSolverTest.java
+++ b/src/test/java/org/apache/commons/math3/linear/RRQRSolverTest.java
@@ -120,10 +120,10 @@ public class RRQRSolverTest {
                 { 1, 2515 }, { 2, 422 }, { -3, 898 }
         });
 
-        
+
         RRQRDecomposition decomposition = new RRQRDecomposition(MatrixUtils.createRealMatrix(testData3x3NonSingular));
         DecompositionSolver solver = decomposition.getSolver();
-        
+
         // using RealMatrix
         Assert.assertEquals(0, solver.solve(b).subtract(xRef).getNorm(), 3.0e-16 * xRef.getNorm());
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/linear/RectangularCholeskyDecompositionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/linear/RectangularCholeskyDecompositionTest.java b/src/test/java/org/apache/commons/math3/linear/RectangularCholeskyDecompositionTest.java
index fa43eac..a50893a 100644
--- a/src/test/java/org/apache/commons/math3/linear/RectangularCholeskyDecompositionTest.java
+++ b/src/test/java/org/apache/commons/math3/linear/RectangularCholeskyDecompositionTest.java
@@ -102,7 +102,7 @@ public class RectangularCholeskyDecompositionTest {
         composeAndTest(m3, 4);
 
     }
-    
+
     private void composeAndTest(RealMatrix m, int expectedRank) {
         RectangularCholeskyDecomposition r = new RectangularCholeskyDecomposition(m);
         Assert.assertEquals(expectedRank, r.getRank());

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/linear/SchurTransformerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/linear/SchurTransformerTest.java b/src/test/java/org/apache/commons/math3/linear/SchurTransformerTest.java
index d40a1ba..8f605cb 100644
--- a/src/test/java/org/apache/commons/math3/linear/SchurTransformerTest.java
+++ b/src/test/java/org/apache/commons/math3/linear/SchurTransformerTest.java
@@ -70,7 +70,7 @@ public class SchurTransformerTest {
     public void testPOrthogonal() {
         checkOrthogonal(new SchurTransformer(MatrixUtils.createRealMatrix(testSquare5)).getP());
         checkOrthogonal(new SchurTransformer(MatrixUtils.createRealMatrix(testSquare3)).getP());
-        checkOrthogonal(new SchurTransformer(MatrixUtils.createRealMatrix(testRandom)).getP());        
+        checkOrthogonal(new SchurTransformer(MatrixUtils.createRealMatrix(testRandom)).getP());
     }
 
     @Test
@@ -155,12 +155,12 @@ public class SchurTransformerTest {
         RealMatrix p  = transformer.getP();
         RealMatrix t  = transformer.getT();
         RealMatrix pT = transformer.getPT();
-        
+
         RealMatrix result = p.multiply(t).multiply(pT);
 
         double norm = result.subtract(matrix).getNorm();
         Assert.assertEquals(0, norm, 1.0e-9);
-        
+
         return t;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/ml/clustering/DBSCANClustererTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ml/clustering/DBSCANClustererTest.java b/src/test/java/org/apache/commons/math3/ml/clustering/DBSCANClustererTest.java
index 497459f..643e2ff 100644
--- a/src/test/java/org/apache/commons/math3/ml/clustering/DBSCANClustererTest.java
+++ b/src/test/java/org/apache/commons/math3/ml/clustering/DBSCANClustererTest.java
@@ -146,19 +146,19 @@ public class DBSCANClustererTest {
                 new DoublePoint(new int[] {14, 8}), // C
                 new DoublePoint(new int[] {7, 15}), // N - Noise, should not be present
                 new DoublePoint(new int[] {17, 8}), // D - single-link connected to C should not be present
-                
+
         };
-        
+
         final DBSCANClusterer<DoublePoint> clusterer = new DBSCANClusterer<DoublePoint>(3, 3);
         List<Cluster<DoublePoint>> clusters = clusterer.cluster(Arrays.asList(points));
-        
+
         Assert.assertEquals(1, clusters.size());
-        
+
         final List<DoublePoint> clusterOne =
                 Arrays.asList(points[0], points[1], points[2], points[3], points[4], points[5], points[6], points[7]);
         Assert.assertTrue(clusters.get(0).getPoints().containsAll(clusterOne));
     }
-    
+
     @Test
     public void testGetEps() {
         final DBSCANClusterer<DoublePoint> transformer = new DBSCANClusterer<DoublePoint>(2.0, 5);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/ml/clustering/KMeansPlusPlusClustererTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ml/clustering/KMeansPlusPlusClustererTest.java b/src/test/java/org/apache/commons/math3/ml/clustering/KMeansPlusPlusClustererTest.java
index 3d3416d..f974c36 100644
--- a/src/test/java/org/apache/commons/math3/ml/clustering/KMeansPlusPlusClustererTest.java
+++ b/src/test/java/org/apache/commons/math3/ml/clustering/KMeansPlusPlusClustererTest.java
@@ -37,7 +37,7 @@ public class KMeansPlusPlusClustererTest {
     @Before
     public void setUp() {
         random = new JDKRandomGenerator();
-        random.setSeed(1746432956321l);        
+        random.setSeed(1746432956321l);
     }
 
     /**
@@ -152,7 +152,7 @@ public class KMeansPlusPlusClustererTest {
         final int NUM_CLUSTERS = 2;
         final int NUM_ITERATIONS = 0;
         random.setSeed(RANDOM_SEED);
-        
+
         KMeansPlusPlusClusterer<DoublePoint> clusterer =
             new KMeansPlusPlusClusterer<DoublePoint>(NUM_CLUSTERS, NUM_ITERATIONS,
                     new CloseDistance(), random);
@@ -167,15 +167,15 @@ public class KMeansPlusPlusClustererTest {
         }
         Assert.assertTrue(uniquePointIsCenter);
     }
-    
+
     /**
      * 2 variables cannot be clustered into 3 clusters. See issue MATH-436.
      */
     @Test(expected=NumberIsTooSmallException.class)
     public void testPerformClusterAnalysisToManyClusters() {
-        KMeansPlusPlusClusterer<DoublePoint> transformer = 
+        KMeansPlusPlusClusterer<DoublePoint> transformer =
             new KMeansPlusPlusClusterer<DoublePoint>(3, 1, new EuclideanDistance(), random);
-        
+
         DoublePoint[] points = new DoublePoint[] {
             new DoublePoint(new int[] {
                 1959, 325100
@@ -183,7 +183,7 @@ public class KMeansPlusPlusClustererTest {
                 1960, 373200
             })
         };
-        
+
         transformer.cluster(Arrays.asList(points));
 
     }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/ml/clustering/MultiKMeansPlusPlusClustererTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ml/clustering/MultiKMeansPlusPlusClustererTest.java b/src/test/java/org/apache/commons/math3/ml/clustering/MultiKMeansPlusPlusClustererTest.java
index 23d178a..d0d43de 100644
--- a/src/test/java/org/apache/commons/math3/ml/clustering/MultiKMeansPlusPlusClustererTest.java
+++ b/src/test/java/org/apache/commons/math3/ml/clustering/MultiKMeansPlusPlusClustererTest.java
@@ -31,7 +31,7 @@ public class MultiKMeansPlusPlusClustererTest {
         MultiKMeansPlusPlusClusterer<DoublePoint> transformer =
             new MultiKMeansPlusPlusClusterer<DoublePoint>(
                     new KMeansPlusPlusClusterer<DoublePoint>(3, 10), 5);
-        
+
         DoublePoint[] points = new DoublePoint[] {
 
                 // first expected cluster

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/ml/clustering/evaluation/SumOfClusterVariancesTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ml/clustering/evaluation/SumOfClusterVariancesTest.java b/src/test/java/org/apache/commons/math3/ml/clustering/evaluation/SumOfClusterVariancesTest.java
index a92256d..9d267cd 100644
--- a/src/test/java/org/apache/commons/math3/ml/clustering/evaluation/SumOfClusterVariancesTest.java
+++ b/src/test/java/org/apache/commons/math3/ml/clustering/evaluation/SumOfClusterVariancesTest.java
@@ -54,7 +54,7 @@ public class SumOfClusterVariancesTest {
         };
 
         final List<Cluster<DoublePoint>> clusters = new ArrayList<Cluster<DoublePoint>>();
-        
+
         final Cluster<DoublePoint> cluster1 = new Cluster<DoublePoint>();
         for (DoublePoint p : points1) {
             cluster1.addPoint(p);
@@ -71,7 +71,7 @@ public class SumOfClusterVariancesTest {
 
         assertEquals(6.148148148, evaluator.score(clusters), 1e-6);
     }
-    
+
     @Test
     public void testOrdering() {
         assertTrue(evaluator.isBetterScore(10, 20));

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/ml/neuralnet/NetworkTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ml/neuralnet/NetworkTest.java b/src/test/java/org/apache/commons/math3/ml/neuralnet/NetworkTest.java
index aa83196..3123e36 100644
--- a/src/test/java/org/apache/commons/math3/ml/neuralnet/NetworkTest.java
+++ b/src/test/java/org/apache/commons/math3/ml/neuralnet/NetworkTest.java
@@ -144,14 +144,14 @@ public class NetworkTest {
                                                    initArray).getNetwork();
 
         final Network copy = net.copy();
-        
+
         final Neuron netNeuron0 = net.getNeuron(0);
         final Neuron copyNeuron0 = copy.getNeuron(0);
         final Neuron netNeuron1 = net.getNeuron(1);
         final Neuron copyNeuron1 = copy.getNeuron(1);
         Collection<Neuron> netNeighbours;
         Collection<Neuron> copyNeighbours;
-        
+
         // Check that both networks have the same connections.
         netNeighbours = net.getNeighbours(netNeuron0);
         copyNeighbours = copy.getNeighbours(copyNeuron0);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/ml/neuralnet/OffsetFeatureInitializer.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ml/neuralnet/OffsetFeatureInitializer.java b/src/test/java/org/apache/commons/math3/ml/neuralnet/OffsetFeatureInitializer.java
index 9c800cc..f1c1f04 100644
--- a/src/test/java/org/apache/commons/math3/ml/neuralnet/OffsetFeatureInitializer.java
+++ b/src/test/java/org/apache/commons/math3/ml/neuralnet/OffsetFeatureInitializer.java
@@ -35,7 +35,7 @@ public class OffsetFeatureInitializer
      * each call.
      *
      * @param orig Original initializer.
-     */    
+     */
     public OffsetFeatureInitializer(FeatureInitializer orig) {
         this.orig = orig;
     }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/ml/neuralnet/sofm/KohonenTrainingTaskTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ml/neuralnet/sofm/KohonenTrainingTaskTest.java b/src/test/java/org/apache/commons/math3/ml/neuralnet/sofm/KohonenTrainingTaskTest.java
index 218a709..b2b3aaf 100644
--- a/src/test/java/org/apache/commons/math3/ml/neuralnet/sofm/KohonenTrainingTaskTest.java
+++ b/src/test/java/org/apache/commons/math3/ml/neuralnet/sofm/KohonenTrainingTaskTest.java
@@ -150,7 +150,7 @@ public class KohonenTrainingTaskTest {
         for (double[] c : solver.getCoordinatesList()) {
             s.append(c[0]).append(" ").append(c[1]).append(" ");
             final City city = solver.getClosestCity(c[0], c[1]);
-            final double[] cityCoord = city.getCoordinates(); 
+            final double[] cityCoord = city.getCoordinates();
             s.append(cityCoord[0]).append(" ").append(cityCoord[1]).append(" ");
             s.append("   # ").append(city.getName()).append("\n");
         }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/ml/neuralnet/sofm/TravellingSalesmanSolver.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ml/neuralnet/sofm/TravellingSalesmanSolver.java b/src/test/java/org/apache/commons/math3/ml/neuralnet/sofm/TravellingSalesmanSolver.java
index 026d8bd..bd3a8ee 100644
--- a/src/test/java/org/apache/commons/math3/ml/neuralnet/sofm/TravellingSalesmanSolver.java
+++ b/src/test/java/org/apache/commons/math3/ml/neuralnet/sofm/TravellingSalesmanSolver.java
@@ -125,7 +125,7 @@ public class TravellingSalesmanSolver {
                                                createRandomIterator(numSamplesPerTask),
                                                action);
         }
-        
+
         return tasks;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/ode/JacobianMatricesTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ode/JacobianMatricesTest.java b/src/test/java/org/apache/commons/math3/ode/JacobianMatricesTest.java
index 6cf7dd2..baa8e09 100644
--- a/src/test/java/org/apache/commons/math3/ode/JacobianMatricesTest.java
+++ b/src/test/java/org/apache/commons/math3/ode/JacobianMatricesTest.java
@@ -457,7 +457,7 @@ public class JacobianMatricesTest {
             }  else {
                 dFdP[0] = cy - y[1];
                 dFdP[1] = y[0] - cx;
-            }           
+            }
         }
 
         public double[] exactY(double t) {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/ode/events/EventStateTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ode/events/EventStateTest.java b/src/test/java/org/apache/commons/math3/ode/events/EventStateTest.java
index 4a8091f..182c8ae 100644
--- a/src/test/java/org/apache/commons/math3/ode/events/EventStateTest.java
+++ b/src/test/java/org/apache/commons/math3/ode/events/EventStateTest.java
@@ -86,11 +86,11 @@ public class EventStateTest {
                MaxCountExceededException, NoBracketingException {
 
         FirstOrderDifferentialEquations equation = new FirstOrderDifferentialEquations() {
-            
+
             public int getDimension() {
                 return 1;
             }
-            
+
             public void computeDerivatives(double t, double[] y, double[] yDot) {
                 yDot[0] = 1.0;
             }
@@ -151,11 +151,11 @@ public class EventStateTest {
 
         ExpandableStatefulODE equation =
                 new ExpandableStatefulODE(new FirstOrderDifferentialEquations() {
-            
+
             public int getDimension() {
                 return 1;
             }
-            
+
             public void computeDerivatives(double t, double[] y, double[] yDot) {
                 yDot[0] = 2.0;
             }
@@ -163,11 +163,11 @@ public class EventStateTest {
         equation.setTime(0.0);
         equation.setPrimaryState(new double[1]);
         equation.addSecondaryEquations(new SecondaryEquations() {
-            
+
             public int getDimension() {
                 return 1;
             }
-            
+
             public void computeDerivatives(double t, double[] primary,
                                            double[] primaryDot, double[] secondary,
                                            double[] secondaryDot) {
@@ -219,11 +219,11 @@ public class EventStateTest {
                MaxCountExceededException, NoBracketingException {
 
         FirstOrderDifferentialEquations equation = new FirstOrderDifferentialEquations() {
-            
+
             public int getDimension() {
                 return 1;
             }
-            
+
             public void computeDerivatives(double t, double[] y, double[] yDot) {
                 yDot[0] = 1.0;
             }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/ode/nonstiff/HighamHall54IntegratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ode/nonstiff/HighamHall54IntegratorTest.java b/src/test/java/org/apache/commons/math3/ode/nonstiff/HighamHall54IntegratorTest.java
index 65a96f2..1042ecf 100644
--- a/src/test/java/org/apache/commons/math3/ode/nonstiff/HighamHall54IntegratorTest.java
+++ b/src/test/java/org/apache/commons/math3/ode/nonstiff/HighamHall54IntegratorTest.java
@@ -355,7 +355,7 @@ public class HighamHall54IntegratorTest {
     FirstOrderIntegrator integ = new HighamHall54Integrator(minStep, maxStep,
                                                             vecAbsoluteTolerance,
                                                             vecRelativeTolerance);
-    TestProblemHandler handler = new TestProblemHandler(pb, integ); 
+    TestProblemHandler handler = new TestProblemHandler(pb, integ);
     integ.addStepHandler(handler);
     integ.integrate(pb,
                     pb.getInitialTime(), pb.getInitialState(),

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/ode/sampling/StepNormalizerOutputTestBase.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ode/sampling/StepNormalizerOutputTestBase.java b/src/test/java/org/apache/commons/math3/ode/sampling/StepNormalizerOutputTestBase.java
index f862dad..0a3dc9c 100644
--- a/src/test/java/org/apache/commons/math3/ode/sampling/StepNormalizerOutputTestBase.java
+++ b/src/test/java/org/apache/commons/math3/ode/sampling/StepNormalizerOutputTestBase.java
@@ -235,10 +235,10 @@ public abstract class StepNormalizerOutputTestBase
      * @param bounds the step normalizer bounds setting to use
      * @param expected the expected output (normalized time points)
      * @param reverse whether to reverse the integration direction
-     * @throws NoBracketingException 
-     * @throws MaxCountExceededException 
-     * @throws NumberIsTooSmallException 
-     * @throws DimensionMismatchException 
+     * @throws NoBracketingException
+     * @throws MaxCountExceededException
+     * @throws NumberIsTooSmallException
+     * @throws DimensionMismatchException
      */
     private void doTest(StepNormalizerMode mode, StepNormalizerBounds bounds,
                         double[] expected, boolean reverse)

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optim/SimplePointCheckerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optim/SimplePointCheckerTest.java b/src/test/java/org/apache/commons/math3/optim/SimplePointCheckerTest.java
index f5b057a..f615cd8 100644
--- a/src/test/java/org/apache/commons/math3/optim/SimplePointCheckerTest.java
+++ b/src/test/java/org/apache/commons/math3/optim/SimplePointCheckerTest.java
@@ -31,7 +31,7 @@ public class SimplePointCheckerTest {
         final int max = 10;
         final SimplePointChecker<PointValuePair> checker
             = new SimplePointChecker<PointValuePair>(1e-1, 1e-2, max);
-        Assert.assertTrue(checker.converged(max, null, null)); 
+        Assert.assertTrue(checker.converged(max, null, null));
         Assert.assertTrue(checker.converged(max + 1, null, null));
     }
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optim/SimpleValueCheckerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optim/SimpleValueCheckerTest.java b/src/test/java/org/apache/commons/math3/optim/SimpleValueCheckerTest.java
index f4b7f2f..28e2b6d 100644
--- a/src/test/java/org/apache/commons/math3/optim/SimpleValueCheckerTest.java
+++ b/src/test/java/org/apache/commons/math3/optim/SimpleValueCheckerTest.java
@@ -30,7 +30,7 @@ public class SimpleValueCheckerTest {
     public void testIterationCheck() {
         final int max = 10;
         final SimpleValueChecker checker = new SimpleValueChecker(1e-1, 1e-2, max);
-        Assert.assertTrue(checker.converged(max, null, null)); 
+        Assert.assertTrue(checker.converged(max, null, null));
         Assert.assertTrue(checker.converged(max + 1, null, null));
     }
 


[20/21] [math] Removed unneeded field.

Posted by lu...@apache.org.
Removed unneeded field.

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

Branch: refs/heads/field-ode
Commit: 4edbcc7f2e1e5d21ebefbba6f0d258b07ece73c5
Parents: 35e2da2
Author: Luc Maisonobe <lu...@apache.org>
Authored: Wed Dec 9 16:42:28 2015 +0100
Committer: Luc Maisonobe <lu...@apache.org>
Committed: Wed Dec 9 16:42:28 2015 +0100

----------------------------------------------------------------------
 .../org/apache/commons/math3/ode/AbstractFieldIntegrator.java    | 4 ----
 1 file changed, 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/4edbcc7f/src/main/java/org/apache/commons/math3/ode/AbstractFieldIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/ode/AbstractFieldIntegrator.java b/src/main/java/org/apache/commons/math3/ode/AbstractFieldIntegrator.java
index b39ed3b..1368c8d 100644
--- a/src/main/java/org/apache/commons/math3/ode/AbstractFieldIntegrator.java
+++ b/src/main/java/org/apache/commons/math3/ode/AbstractFieldIntegrator.java
@@ -67,9 +67,6 @@ public abstract class AbstractFieldIntegrator<T extends RealFieldElement<T>> imp
     /** Indicator for last step. */
     protected boolean isLastStep;
 
-    /** Indicator that a state or derivative reset was triggered by some event. */
-    protected boolean resetOccurred;
-
     /** Field to which the time and state vector elements belong. */
     private final Field<T> field;
 
@@ -348,7 +345,6 @@ public abstract class AbstractFieldIntegrator<T extends RealFieldElement<T>> imp
                         // invalidate the derivatives, we need to recompute them
                         final T[] y    = equations.getMapper().mapState(newState);
                         final T[] yDot = computeDerivatives(newState.getTime(), y);
-                        resetOccurred = true;
                         return equations.getMapper().mapStateAndDerivative(newState.getTime(), y, yDot);
                     }
                 }


[06/21] [math] Modified KolmogororSmirnovTest 2-sample test to use random jitter to break ties in input data. JIRA: MATH-1246.

Posted by lu...@apache.org.
Modified KolmogororSmirnovTest 2-sample test to use random jitter to break ties in input data.  JIRA: MATH-1246.


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

Branch: refs/heads/field-ode
Commit: 654d7232e5e9a21fee3d8e95a29c2e880b4dcdda
Parents: 3cfafe0
Author: Phil Steitz <ph...@gmail.com>
Authored: Thu Nov 26 18:31:34 2015 -0700
Committer: Phil Steitz <ph...@gmail.com>
Committed: Thu Nov 26 18:31:34 2015 -0700

----------------------------------------------------------------------
 src/changes/changes.xml                         |   5 +
 .../math3/random/JDKRandomGenerator.java        |  17 +++
 .../stat/inference/KolmogorovSmirnovTest.java   | 115 ++++++++++++++++++-
 .../apache/commons/math3/util/MathArrays.java   |  58 ++++++++++
 .../inference/KolmogorovSmirnovTestTest.java    | 106 ++++++++++++++---
 .../commons/math3/util/MathArraysTest.java      |  95 ++++++++++++---
 6 files changed, 364 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/654d7232/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 3448c23..2a5a7cd 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -51,6 +51,11 @@ If the output is not quite correct, check for invisible trailing spaces!
   </properties>
   <body>
     <release version="3.6" date="XXXX-XX-XX" description="">
+      <action dev="psteitz" type="update" issue="MATH-1246">
+        Modified 2-sample KolmogorovSmirnovTest to handle ties in sample data. By default,
+        ties are broken by adding random jitter to input data. Also added bootstrap method
+        analogous to ks.boot in R Matching package.
+      </action>
       <action dev="tn" type="fix" issue="MATH-1294" due-to="Kamil Włodarczyk">
         Fixed potential race condition in PolynomialUtils#buildPolynomial in
         case polynomials are generated from multiple threads. Furthermore, the

http://git-wip-us.apache.org/repos/asf/commons-math/blob/654d7232/src/main/java/org/apache/commons/math3/random/JDKRandomGenerator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/random/JDKRandomGenerator.java b/src/main/java/org/apache/commons/math3/random/JDKRandomGenerator.java
index 73c2f75..562cbdc 100644
--- a/src/main/java/org/apache/commons/math3/random/JDKRandomGenerator.java
+++ b/src/main/java/org/apache/commons/math3/random/JDKRandomGenerator.java
@@ -29,6 +29,23 @@ public class JDKRandomGenerator extends Random implements RandomGenerator {
     /** Serializable version identifier. */
     private static final long serialVersionUID = -7745277476784028798L;
 
+    /**
+     * Create a new JDKRandomGenerator with a default seed.
+     */
+    public JDKRandomGenerator() {
+        super();
+    }
+
+    /**
+     * Create a new JDKRandomGenerator with the given seed.
+     *
+     * @param seed initial seed
+     * @since 3.6
+     */
+    public JDKRandomGenerator(int seed) {
+        setSeed(seed);
+    }
+
     /** {@inheritDoc} */
     public void setSeed(int seed) {
         setSeed((long) seed);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/654d7232/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 f4edf5f..13af7d7 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
@@ -19,12 +19,15 @@ package org.apache.commons.math3.stat.inference;
 
 import java.math.BigDecimal;
 import java.util.Arrays;
+import java.util.HashSet;
 import java.util.Iterator;
 
 import org.apache.commons.math3.distribution.EnumeratedRealDistribution;
 import org.apache.commons.math3.distribution.RealDistribution;
+import org.apache.commons.math3.distribution.UniformRealDistribution;
 import org.apache.commons.math3.exception.InsufficientDataException;
 import org.apache.commons.math3.exception.MathArithmeticException;
+import org.apache.commons.math3.exception.MathInternalError;
 import org.apache.commons.math3.exception.NullArgumentException;
 import org.apache.commons.math3.exception.NumberIsTooLargeException;
 import org.apache.commons.math3.exception.OutOfRangeException;
@@ -37,6 +40,7 @@ import org.apache.commons.math3.linear.Array2DRowFieldMatrix;
 import org.apache.commons.math3.linear.FieldMatrix;
 import org.apache.commons.math3.linear.MatrixUtils;
 import org.apache.commons.math3.linear.RealMatrix;
+import org.apache.commons.math3.random.JDKRandomGenerator;
 import org.apache.commons.math3.random.RandomGenerator;
 import org.apache.commons.math3.random.Well19937c;
 import org.apache.commons.math3.util.CombinatoricsUtils;
@@ -243,11 +247,21 @@ public class KolmogorovSmirnovTest {
      */
     public double kolmogorovSmirnovTest(double[] x, double[] y, boolean strict) {
         final long lengthProduct = (long) x.length * y.length;
+        double[] xa = null;
+        double[] ya = null;
+        if (lengthProduct < LARGE_SAMPLE_PRODUCT && hasTies(x,y)) {
+            xa = MathArrays.copyOf(x);
+            ya = MathArrays.copyOf(y);
+            fixTies(xa, ya);
+        } else {
+            xa = x;
+            ya = y;
+        }
         if (lengthProduct < SMALL_SAMPLE_PRODUCT) {
-            return integralExactP(integralKolmogorovSmirnovStatistic(x, y) + (strict?1l:0l), x.length, y.length);
+            return integralExactP(integralKolmogorovSmirnovStatistic(xa, ya) + (strict?1l:0l), x.length, y.length);
         }
         if (lengthProduct < LARGE_SAMPLE_PRODUCT) {
-            return integralMonteCarloP(integralKolmogorovSmirnovStatistic(x, y) + (strict?1l:0l), x.length, y.length, MONTE_CARLO_ITERATIONS);
+            return integralMonteCarloP(integralKolmogorovSmirnovStatistic(xa, ya) + (strict?1l:0l), x.length, y.length, MONTE_CARLO_ITERATIONS);
         }
         return approximateP(kolmogorovSmirnovStatistic(x, y), x.length, y.length);
     }
@@ -582,7 +596,6 @@ public class KolmogorovSmirnovTest {
      * @since 3.4
      */
     public double pelzGood(double d, int n) {
-
         // Change the variable since approximation is for the distribution evaluated at d / sqrt(n)
         final double sqrtN = FastMath.sqrt(n);
         final double z = d * sqrtN;
@@ -1033,6 +1046,7 @@ public class KolmogorovSmirnovTest {
         return (double) tail / (double) CombinatoricsUtils.binomialCoefficient(n + m, n);
     }
 
+
     /**
      * Uses the Kolmogorov-Smirnov distribution to approximate \(P(D_{n,m} > d)\) where \(D_{n,m}\)
      * is the 2-sample Kolmogorov-Smirnov statistic. See
@@ -1054,7 +1068,8 @@ public class KolmogorovSmirnovTest {
     public double approximateP(double d, int n, int m) {
         final double dm = m;
         final double dn = n;
-        return 1 - ksSum(d * FastMath.sqrt((dm * dn) / (dm + dn)), KS_SUM_CAUCHY_CRITERION, MAXIMUM_PARTIAL_SUM_COUNT);
+        return 1 - ksSum(d * FastMath.sqrt((dm * dn) / (dm + dn)),
+                         KS_SUM_CAUCHY_CRITERION, MAXIMUM_PARTIAL_SUM_COUNT);
     }
 
     /**
@@ -1146,4 +1161,96 @@ public class KolmogorovSmirnovTest {
         }
         return (double) tail / iterations;
     }
+
+    /**
+     * If there are no ties in the combined dataset formed from x and y, this
+     * method is a no-op.  If there are ties, a uniform random deviate in
+     * (-minDelta / 2, minDelta / 2) - {0} is added to each value in x and y, where
+     * minDelta is the minimum difference between unequal values in the combined
+     * sample.  A fixed seed is used to generate the jitter, so repeated activations
+     * with the same input arrays result in the same values.
+     *
+     * NOTE: if there are ties in the data, this method overwrites the data in
+     * x and y with the jittered values.
+     *
+     * @param x first sample
+     * @param y second sample
+     */
+    private static void fixTies(double[] x, double[] y) {
+       final double[] values = MathArrays.unique(MathArrays.concatenate(x,y));
+       if (values.length == x.length + y.length) {
+           return;  // There are no ties
+       }
+
+       // Find the smallest difference between values, or 1 if all values are the same
+       double minDelta = 1;
+       double prev = values[0];
+       double delta = 1;
+       for (int i = 1; i < values.length; i++) {
+          delta = prev - values[i];
+          if (delta < minDelta) {
+              minDelta = delta;
+          }
+          prev = values[i];
+       }
+       minDelta /= 2;
+
+       // Add jitter using a fixed seed (so same arguments always give same results),
+       // low-initialization-overhead generator
+       final RealDistribution dist =
+               new UniformRealDistribution(new JDKRandomGenerator(100), -minDelta, minDelta);
+
+       // It is theoretically possible that jitter does not break ties, so repeat
+       // until all ties are gone.  Bound the loop and throw MIE if bound is exceeded.
+       int ct = 0;
+       boolean ties = true;
+       do {
+           jitter(x, dist);
+           jitter(y, dist);
+           ties = hasTies(x, y);
+           ct++;
+       } while (ties && ct < 1000);
+       if (ties) {
+           throw new MathInternalError(); // Should never happen
+       }
+    }
+
+    /**
+     * Returns true iff there are ties in the combined sample
+     * formed from x and y.
+     *
+     * @param x first sample
+     * @param y second sample
+     * @return true if x and y together contain ties
+     */
+    private static boolean hasTies(double[] x, double[] y) {
+        final HashSet<Double> values = new HashSet<Double>();
+            for (int i = 0; i < x.length; i++) {
+                if (!values.add(x[i])) {
+                    return true;
+                }
+            }
+            for (int i = 0; i < y.length; i++) {
+                if (!values.add(y[i])) {
+                    return true;
+                }
+            }
+        return false;
+    }
+
+    /**
+     * Adds random jitter to {@code data} using deviates sampled from {@code dist}.
+     * <p>
+     * Note that jitter is applied in-place - i.e., the array
+     * values are overwritten with the result of applying jitter.</p>
+     *
+     * @param data input/output data array - entries overwritten by the method
+     * @param dist probability distribution to sample for jitter values
+     * @throws NullPointerException if either of the parameters is null
+     */
+    private static void jitter(double[] data, RealDistribution dist) {
+        for (int i = 0; i < data.length; i++) {
+            data[i] = data[i] + dist.sample();
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/654d7232/src/main/java/org/apache/commons/math3/util/MathArrays.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/util/MathArrays.java b/src/main/java/org/apache/commons/math3/util/MathArrays.java
index 2c9fcb3..a030a41 100644
--- a/src/main/java/org/apache/commons/math3/util/MathArrays.java
+++ b/src/main/java/org/apache/commons/math3/util/MathArrays.java
@@ -22,7 +22,9 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.Comparator;
+import java.util.Iterator;
 import java.util.List;
+import java.util.TreeSet;
 
 import org.apache.commons.math3.Field;
 import org.apache.commons.math3.random.RandomGenerator;
@@ -1874,4 +1876,60 @@ public class MathArrays {
 
         return verifyValues(values, begin, length, allowEmpty);
     }
+
+    /**
+     * Concatenates a sequence of arrays. The return array consists of the
+     * entries of the input arrays concatenated in the order they appear in
+     * the argument list.  Null arrays cause NullPointerExceptions; zero
+     * length arrays are allowed (contributing nothing to the output array).
+     *
+     * @param x list of double[] arrays to concatenate
+     * @return a new array consisting of the entries of the argument arrays
+     * @throws NullPointerException if any of the arrays are null
+     * @since 3.6
+     */
+    public static double[] concatenate(double[] ...x) {
+        int combinedLength = 0;
+        for (double[] a : x) {
+            combinedLength += a.length;
+        }
+        int offset = 0;
+        int curLength = 0;
+        final double[] combined = new double[combinedLength];
+        for (int i = 0; i < x.length; i++) {
+            curLength = x[i].length;
+            System.arraycopy(x[i], 0, combined, offset, curLength);
+            offset += curLength;
+        }
+        return combined;
+    }
+
+    /**
+     * Returns an array consisting of the unique values in {@code data}.
+     * The return array is sorted in descending order.  Empty arrays
+     * are allowed, but null arrays result in NullPointerException.
+     * Infinities are allowed.  NaN values are allowed with maximum
+     * sort order - i.e., if there are NaN values in {@code data},
+     * {@code Double.NaN} will be the first element of the output array,
+     * even if the array also contains {@code Double.POSITIVE_INFINITY}.
+     *
+     * @param data array to scan
+     * @return descending list of values included in the input array
+     * @throws NullPointerException if data is null
+     * @since 3.6
+     */
+    public static double[] unique(double[] data) {
+        TreeSet<Double> values = new TreeSet<Double>();
+        for (int i = 0; i < data.length; i++) {
+            values.add(data[i]);
+        }
+        final int count = values.size();
+        final double[] out = new double[count];
+        Iterator<Double> iterator = values.iterator();
+        int i = 0;
+        while (iterator.hasNext()) {
+            out[count - ++i] = iterator.next();
+        }
+        return out;
+    }
 }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/654d7232/src/test/java/org/apache/commons/math3/stat/inference/KolmogorovSmirnovTestTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/inference/KolmogorovSmirnovTestTest.java b/src/test/java/org/apache/commons/math3/stat/inference/KolmogorovSmirnovTestTest.java
index 609a0fd..0a8a419 100644
--- a/src/test/java/org/apache/commons/math3/stat/inference/KolmogorovSmirnovTestTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/inference/KolmogorovSmirnovTestTest.java
@@ -17,14 +17,18 @@
 
 package org.apache.commons.math3.stat.inference;
 
+import java.lang.reflect.Method;
 import java.util.Arrays;
 
+import org.apache.commons.math3.TestUtils;
 import org.apache.commons.math3.distribution.NormalDistribution;
 import org.apache.commons.math3.distribution.UniformRealDistribution;
 import org.apache.commons.math3.random.RandomGenerator;
 import org.apache.commons.math3.random.Well19937c;
+import org.apache.commons.math3.stat.inference.KolmogorovSmirnovTest;
 import org.apache.commons.math3.util.CombinatoricsUtils;
 import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math3.util.MathArrays;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -274,7 +278,6 @@ public class KolmogorovSmirnovTestTest {
         Assert.assertFalse(Double.isNaN(test.kolmogorovSmirnovTest(x, y)));
     }
 
-
     /**
      * Verifies that Monte Carlo simulation gives results close to exact p values. This test is a
      * little long-running (more than two minutes on a fast machine), so is disabled by default.
@@ -429,10 +432,10 @@ public class KolmogorovSmirnovTestTest {
             Assert.assertEquals(1.0, test.approximateP(0, values.length, values.length), 0.);
         }
     }
-    
+
     /**
      * JIRA: MATH-1245
-     * 
+     *
      * Verify that D-values are not viewed as distinct when they are mathematically equal
      * when computing p-statistics for small sample tests. Reference values are from R 3.2.0.
      */
@@ -443,19 +446,19 @@ public class KolmogorovSmirnovTestTest {
         final double[] y = {1, 10, 11, 13, 14, 15, 16, 17, 18};
         final KolmogorovSmirnovTest test = new KolmogorovSmirnovTest();
         Assert.assertEquals(0.0027495724090154106, test.kolmogorovSmirnovTest(x, y,false), tol);
-        
+
         final double[] x1 = {2, 4, 6, 8, 9, 10, 11, 12, 13};
         final double[] y1 = {0, 1, 3, 5, 7};
         Assert.assertEquals(0.085914085914085896, test.kolmogorovSmirnovTest(x1, y1, false), tol);
-        
+
         final double[] x2 = {4, 6, 7, 8, 9, 10, 11};
         final double[] y2 = {0, 1, 2, 3, 5};
-        Assert.assertEquals(0.015151515151515027, test.kolmogorovSmirnovTest(x2, y2, false), tol); 
+        Assert.assertEquals(0.015151515151515027, test.kolmogorovSmirnovTest(x2, y2, false), tol);
     }
-    
+
     /**
      * JIRA: MATH-1245
-     * 
+     *
      * Verify that D-values are not viewed as distinct when they are mathematically equal
      * when computing p-statistics for small sample tests. Reference values are from R 3.2.0.
      */
@@ -464,17 +467,17 @@ public class KolmogorovSmirnovTestTest {
         final double tol = 1e-2;
         final int iterations = 1000000;
         final KolmogorovSmirnovTest test = new KolmogorovSmirnovTest(new Well19937c(1000));
-        
+
         final double[] x = {0, 2, 3, 4, 5, 6, 7, 8, 9, 12};
         final double[] y = {1, 10, 11, 13, 14, 15, 16, 17, 18};
         double d = test.kolmogorovSmirnovStatistic(x, y);
         Assert.assertEquals(0.0027495724090154106, test.monteCarloP(d, x.length, y.length, false, iterations), tol);
-        
+
         final double[] x1 = {2, 4, 6, 8, 9, 10, 11, 12, 13};
         final double[] y1 = {0, 1, 3, 5, 7};
         d = test.kolmogorovSmirnovStatistic(x1, y1);
         Assert.assertEquals(0.085914085914085896, test.monteCarloP(d, x1.length, y1.length, false, iterations), tol);
-        
+
         final double[] x2 = {4, 6, 7, 8, 9, 10, 11};
         final double[] y2 = {0, 1, 2, 3, 5};
         d = test.kolmogorovSmirnovStatistic(x2, y2);
@@ -527,7 +530,7 @@ public class KolmogorovSmirnovTestTest {
             }
 
             Assert.assertEquals(numCombinations, observedIdx);
-            Assert.assertFalse(TestUtils.chiSquareTest(expected, observed, alpha));
+            TestUtils.assertChiSquareAccept(expected, observed, alpha);
         }
     }
 
@@ -566,6 +569,63 @@ public class KolmogorovSmirnovTestTest {
         Assert.assertEquals(0.06303, test.bootstrap(x, y, 10000, false), 1E-2);
     }
 
+    @Test
+    public void testFixTiesNoOp() throws Exception {
+        final double[] x = {0, 1, 2, 3, 4};
+        final double[] y = {5, 6, 7, 8};
+        final double[] origX = MathArrays.copyOf(x);
+        final double[] origY = MathArrays.copyOf(y);
+        fixTies(x,y);
+        Assert.assertArrayEquals(origX, x, 0);
+        Assert.assertArrayEquals(origY, y, 0);
+    }
+
+    /**
+     * Verify that fixTies is deterministic, i.e,
+     * x = x', y = y' => fixTies(x,y) = fixTies(x', y')
+     */
+    @Test
+    public void testFixTiesConsistency() throws Exception {
+        final double[] x = {0, 1, 2, 3, 4, 2};
+        final double[] y = {5, 6, 7, 8, 1, 2};
+        final double[] xP = MathArrays.copyOf(x);
+        final double[] yP = MathArrays.copyOf(y);
+        checkFixTies(x, y);
+        final double[] fixedX = MathArrays.copyOf(x);
+        final double[] fixedY = MathArrays.copyOf(y);
+        checkFixTies(xP, yP);
+        Assert.assertArrayEquals(fixedX, xP, 0);
+        Assert.assertArrayEquals(fixedY,  yP, 0);
+    }
+
+    @Test
+    public void testFixTies() throws Exception {
+        checkFixTies(new double[] {0, 1, 1, 4, 0}, new double[] {0, 5, 0.5, 0.55, 7});
+        checkFixTies(new double[] {1, 1, 1, 1, 1}, new double[] {1, 1});
+        checkFixTies(new double[] {1, 2, 3}, new double[] {1});
+        checkFixTies(new double[] {1, 1, 0, 1, 0}, new double[] {});
+    }
+
+    /**
+     * Checks that fixTies eliminates ties in the data but does not otherwise
+     * perturb the ordering.
+     */
+    private void checkFixTies(double[] x, double[] y) throws Exception {
+        final double[] origCombined = MathArrays.concatenate(x, y);
+        fixTies(x, y);
+        Assert.assertFalse(hasTies(x, y));
+        final double[] combined = MathArrays.concatenate(x, y);
+        for (int i = 0; i < combined.length; i++) {
+            for (int j = 0; j < i; j++) {
+                Assert.assertTrue(combined[i] != combined[j]);
+                if (combined[i] < combined[j])
+                    Assert.assertTrue(origCombined[i] < origCombined[j]
+                                          || origCombined[i] == origCombined[j]);
+            }
+
+        }
+    }
+
     /**
      * Verifies the inequality exactP(criticalValue, n, m, true) < alpha < exactP(criticalValue, n,
      * m, false).
@@ -600,4 +660,24 @@ public class KolmogorovSmirnovTestTest {
         Assert.assertEquals(alpha, test.approximateP(criticalValue, n, m), epsilon);
     }
 
-}
\ No newline at end of file
+    /**
+     * Reflection hack to expose private fixTies method for testing.
+     */
+    private static void fixTies(double[] x, double[] y) throws Exception {
+        Method method = KolmogorovSmirnovTest.class.getDeclaredMethod("fixTies",
+                                             double[].class, double[].class);
+        method.setAccessible(true);
+        method.invoke(KolmogorovSmirnovTest.class, x, y);
+    }
+
+    /**
+     * Reflection hack to expose private hasTies method.
+     */
+    private static boolean hasTies(double[] x, double[] y) throws Exception {
+        Method method = KolmogorovSmirnovTest.class.getDeclaredMethod("hasTies",
+                                               double[].class, double[].class);
+        method.setAccessible(true);
+        return (Boolean) method.invoke(KolmogorovSmirnovTest.class, x, y);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/654d7232/src/test/java/org/apache/commons/math3/util/MathArraysTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/util/MathArraysTest.java b/src/test/java/org/apache/commons/math3/util/MathArraysTest.java
index 1361c7e..94921c4 100644
--- a/src/test/java/org/apache/commons/math3/util/MathArraysTest.java
+++ b/src/test/java/org/apache/commons/math3/util/MathArraysTest.java
@@ -34,7 +34,7 @@ import org.junit.Test;
  *
  */
 public class MathArraysTest {
-    
+
     private double[] testArray = {0, 1, 2, 3, 4, 5};
     private double[] testWeightsArray = {0.3, 0.2, 1.3, 1.1, 1.0, 1.8};
     private double[] testNegativeWeightsArray = {-0.3, 0.2, -1.3, 1.1, 1.0, 1.8};
@@ -46,7 +46,7 @@ public class MathArraysTest {
         final double[] test = new double[] { -2.5, -1, 0, 1, 2.5 };
         final double[] correctTest = MathArrays.copyOf(test);
         final double[] correctScaled = new double[]{5.25, 2.1, 0, -2.1, -5.25};
-        
+
         final double[] scaled = MathArrays.scale(-2.1, test);
 
         // Make sure test has not changed
@@ -59,7 +59,7 @@ public class MathArraysTest {
             Assert.assertEquals(correctScaled[i], scaled[i], 0);
         }
     }
-    
+
     @Test
     public void testScaleInPlace() {
         final double[] test = new double[] { -2.5, -1, 0, 1, 2.5 };
@@ -71,7 +71,7 @@ public class MathArraysTest {
             Assert.assertEquals(correctScaled[i], test[i], 0);
         }
     }
-    
+
     @Test(expected=DimensionMismatchException.class)
     public void testEbeAddPrecondition() {
         MathArrays.ebeAdd(new double[3], new double[4]);
@@ -350,7 +350,7 @@ public class MathArraysTest {
                                                                 new Double(-27.5) },
                 MathArrays.OrderDirection.DECREASING, false));
     }
-    
+
     @Test
     public void testCheckRectangular() {
         final long[][] rect = new long[][] {{0, 1}, {2, 3}};
@@ -370,9 +370,9 @@ public class MathArraysTest {
             Assert.fail("Expecting NullArgumentException");
         } catch (NullArgumentException ex) {
             // Expected
-        } 
+        }
     }
-    
+
     @Test
     public void testCheckPositive() {
         final double[] positive = new double[] {1, 2, 3};
@@ -394,7 +394,7 @@ public class MathArraysTest {
             // Expected
         }
     }
-    
+
     @Test
     public void testCheckNonNegative() {
         final long[] nonNegative = new long[] {0, 1};
@@ -416,7 +416,7 @@ public class MathArraysTest {
             // Expected
         }
     }
-    
+
     @Test
     public void testCheckNonNegative2D() {
         final long[][] nonNegative = new long[][] {{0, 1}, {1, 0}};
@@ -551,7 +551,7 @@ public class MathArraysTest {
         Assert.assertEquals(25,  x2[0], FastMath.ulp(1d));
         Assert.assertEquals(125, x3[0], FastMath.ulp(1d));
     }
-    
+
     @Test
     /** Example in javadoc */
     public void testSortInPlaceExample() {
@@ -566,7 +566,7 @@ public class MathArraysTest {
         Assert.assertTrue(Arrays.equals(sy, y));
         Assert.assertTrue(Arrays.equals(sz, z));
     }
-    
+
     @Test
     public void testSortInPlaceFailures() {
         final double[] nullArray = null;
@@ -1044,7 +1044,7 @@ public class MathArraysTest {
             Assert.fail("expecting MathIllegalArgumentException");
         } catch (MathIllegalArgumentException ex) {}
     }
-    
+
     @Test
     public void testConvolve() {
         /* Test Case (obtained via SciPy)
@@ -1063,10 +1063,10 @@ public class MathArraysTest {
         double[] x2 = { 1, 2, 3 };
         double[] h2 = { 0, 1, 0.5 };
         double[] y2 = { 0, 1, 2.5, 4, 1.5 };
-        
+
         yActual = MathArrays.convolve(x2, h2);
         Assert.assertArrayEquals(y2, yActual, tolerance);
-                
+
         try {
             MathArrays.convolve(new double[]{1, 2}, null);
             Assert.fail("an exception should have been thrown");
@@ -1184,7 +1184,7 @@ public class MathArraysTest {
         final int[] seq = MathArrays.sequence(0, 12345, 6789);
         Assert.assertEquals(0, seq.length);
     }
-    
+
     @Test
     public void testVerifyValuesPositive() {
         for (int j = 0; j < 6; j++) {
@@ -1249,4 +1249,69 @@ public class MathArraysTest {
             // expected
         }
     }
+
+    @Test
+    public void testConcatenate() {
+        final double[] u = new double[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        final double[] x = new double[] {0, 1, 2};
+        final double[] y = new double[] {3, 4, 5, 6, 7, 8};
+        final double[] z = new double[] {9};
+        Assert.assertArrayEquals(u, MathArrays.concatenate(x, y, z), 0);
+    }
+
+    @Test
+    public void testConcatentateSingle() {
+        final double[] x = new double[] {0, 1, 2};
+        Assert.assertArrayEquals(x, MathArrays.concatenate(x), 0);
+    }
+
+    public void testConcatenateEmptyArguments() {
+        final double[] x = new double[] {0, 1, 2};
+        final double[] y = new double[] {3};
+        final double[] z = new double[] {};
+        final double[] u = new double[] {0, 1, 2, 3};
+        Assert.assertArrayEquals(u,  MathArrays.concatenate(x, z, y), 0);
+        Assert.assertArrayEquals(u,  MathArrays.concatenate(x, y, z), 0);
+        Assert.assertArrayEquals(u,  MathArrays.concatenate(z, x, y), 0);
+        Assert.assertEquals(0,  MathArrays.concatenate(z, z, z).length);
+    }
+
+    @Test(expected=NullPointerException.class)
+    public void testConcatenateNullArguments() {
+        final double[] x = new double[] {0, 1, 2};
+        MathArrays.concatenate(x, null);
+    }
+
+    @Test
+    public void testUnique() {
+        final double[] x = {0, 9, 3, 0, 11, 7, 3, 5, -1, -2};
+        final double[] values = {11, 9, 7, 5, 3, 0, -1, -2};
+        Assert.assertArrayEquals(values, MathArrays.unique(x), 0);
+    }
+
+    @Test
+    public void testUniqueInfiniteValues() {
+        final double [] x = {0, Double.NEGATIVE_INFINITY, 3, Double.NEGATIVE_INFINITY,
+            3, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY};
+        final double[] u = {Double.POSITIVE_INFINITY, 3, 0, Double.NEGATIVE_INFINITY};
+        Assert.assertArrayEquals(u , MathArrays.unique(x), 0);
+    }
+
+    @Test
+    public void testUniqueNaNValues() {
+        final double[] x = new double[] {10, 2, Double.NaN, Double.NaN, Double.NaN,
+            Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY};
+        final double[] u = MathArrays.unique(x);
+        Assert.assertEquals(5, u.length);
+        Assert.assertTrue(Double.isNaN(u[0]));
+        Assert.assertEquals(Double.POSITIVE_INFINITY, u[1], 0);
+        Assert.assertEquals(10, u[2], 0);
+        Assert.assertEquals(2, u[3], 0);
+        Assert.assertEquals(Double.NEGATIVE_INFINITY, u[4], 0);
+    }
+
+    @Test(expected=NullPointerException.class)
+    public void testUniqueNullArgument() {
+        MathArrays.unique(null);
+    }
 }