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/49bb370a Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/49bb370a Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/49bb370a Branch: refs/heads/master Commit: 49bb370a6c6a0d330f17a6c8eebb113103b4c878 Parents: f7ab3a7 Author: Phil Steitz <phil.ste...@gmail.com> Authored: Fri Nov 27 10:55:38 2015 -0700 Committer: Phil Steitz <phil.ste...@gmail.com> Committed: Fri Nov 27 10:55:38 2015 -0700 ---------------------------------------------------------------------- .../math4/analysis/FunctionUtilsTest.java | 8 +- .../DerivativeStructureTest.java | 16 +-- .../math4/analysis/function/GaussianTest.java | 2 +- .../math4/analysis/function/LogisticTest.java | 8 +- .../math4/analysis/function/SigmoidTest.java | 2 +- .../analysis/function/StepFunctionTest.java | 8 +- .../integration/MidPointIntegratorTest.java | 4 +- .../commons/math4/complex/ComplexTest.java | 2 +- .../commons/math4/complex/QuaternionTest.java | 2 +- .../apache/commons/math4/dfp/DfpDecTest.java | 6 +- .../apache/commons/math4/dfp/DfpMathTest.java | 122 +++++++++---------- .../distribution/BinomialDistributionTest.java | 4 +- .../ConstantRealDistributionTest.java | 4 +- .../EnumeratedIntegerDistributionTest.java | 2 +- .../EnumeratedRealDistributionTest.java | 8 +- .../distribution/GeometricDistributionTest.java | 2 +- .../HypergeometricDistributionTest.java | 14 +-- .../distribution/LevyDistributionTest.java | 2 +- .../MultivariateNormalDistributionTest.java | 2 +- .../distribution/PoissonDistributionTest.java | 2 +- .../RealDistributionAbstractTest.java | 6 +- .../math4/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 +- .../math4/exception/util/ArgUtilsTest.java | 2 +- .../exception/util/ExceptionContextTest.java | 2 +- .../commons/math4/filter/KalmanFilterTest.java | 50 ++++---- .../math4/fitting/GaussianCurveFitterTest.java | 16 +-- .../math4/fitting/HarmonicCurveFitterTest.java | 2 +- .../fitting/PolynomialCurveFitterTest.java | 2 +- .../math4/fitting/SimpleCurveFitterTest.java | 2 +- .../fitting/leastsquares/CircleProblem.java | 2 +- .../fitting/leastsquares/CircleVectorial.java | 2 +- .../math4/fitting/leastsquares/MinpackTest.java | 4 +- .../math4/genetics/CycleCrossoverTest.java | 4 +- .../math4/genetics/DummyListChromosome.java | 2 +- .../genetics/ElitisticListPopulationTest.java | 10 +- .../math4/genetics/ListPopulationTest.java | 26 ++-- .../math4/genetics/NPointCrossoverTest.java | 16 +-- .../math4/genetics/OrderedCrossoverTest.java | 6 +- .../math4/genetics/UniformCrossoverTest.java | 14 +-- .../euclidean/threed/FieldVector3DTest.java | 6 +- .../geometry/euclidean/threed/LineTest.java | 2 +- .../euclidean/threed/PolyhedronsSetTest.java | 24 ++-- .../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/spherical/twod/CircleTest.java | 4 +- .../math4/linear/DiagonalMatrixTest.java | 6 +- .../math4/linear/EigenDecompositionTest.java | 20 +-- .../math4/linear/HessenbergTransformerTest.java | 10 +- .../MatrixDimensionMismatchExceptionTest.java | 2 +- .../commons/math4/linear/MatrixUtilsTest.java | 16 +-- .../math4/linear/QRDecompositionTest.java | 2 +- .../commons/math4/linear/RRQRSolverTest.java | 4 +- .../RectangularCholeskyDecompositionTest.java | 2 +- .../math4/linear/SchurTransformerTest.java | 6 +- .../ml/clustering/DBSCANClustererTest.java | 10 +- .../clustering/KMeansPlusPlusClustererTest.java | 12 +- .../MultiKMeansPlusPlusClustererTest.java | 2 +- .../evaluation/SumOfClusterVariancesTest.java | 4 +- .../commons/math4/ml/neuralnet/NetworkTest.java | 4 +- .../ml/neuralnet/OffsetFeatureInitializer.java | 2 +- .../neuralnet/sofm/KohonenTrainingTaskTest.java | 2 +- .../sofm/TravellingSalesmanSolver.java | 2 +- .../commons/math4/ode/JacobianMatricesTest.java | 2 +- .../math4/ode/events/EventStateTest.java | 16 +-- .../nonstiff/HighamHall54IntegratorTest.java | 2 +- .../sampling/StepNormalizerOutputTestBase.java | 8 +- .../math4/optim/SimplePointCheckerTest.java | 2 +- .../math4/optim/SimpleValueCheckerTest.java | 2 +- .../scalar/noderiv/BOBYQAOptimizerTest.java | 40 +++--- .../scalar/noderiv/CMAESOptimizerTest.java | 12 +- .../optim/univariate/BrentOptimizerTest.java | 2 +- .../MultiStartUnivariateOptimizerTest.java | 2 +- .../SimpleUnivariateValueCheckerTest.java | 2 +- .../apache/commons/math4/primes/PrimesTest.java | 2 +- .../random/AbstractRandomGeneratorTest.java | 4 +- .../math4/random/BitsStreamGeneratorTest.java | 16 +-- .../CorrelatedRandomVectorGeneratorTest.java | 8 +- .../random/HaltonSequenceGeneratorTest.java | 4 +- .../math4/random/MersenneTwisterTest.java | 4 +- .../commons/math4/random/RandomAdaptorTest.java | 6 +- .../random/RandomGeneratorAbstractTest.java | 2 +- .../random/SobolSequenceGeneratorTest.java | 8 +- .../math4/random/StableRandomGeneratorTest.java | 6 +- .../UnitSphereRandomVectorGeneratorTest.java | 2 +- .../commons/math4/random/Well19937aTest.java | 2 +- .../commons/math4/random/Well19937cTest.java | 2 +- .../commons/math4/random/Well44497aTest.java | 4 +- .../commons/math4/random/Well44497bTest.java | 4 +- .../commons/math4/random/Well512aTest.java | 2 +- .../commons/math4/special/BesselJTest.java | 6 +- .../apache/commons/math4/special/ErfTest.java | 54 ++++---- .../commons/math4/stat/StatUtilsTest.java | 16 +-- .../correlation/StorelessCovarianceTest.java | 10 +- .../StatisticalSummaryValuesTest.java | 2 +- .../stat/descriptive/rank/PercentileTest.java | 4 +- .../stat/interval/AgrestiCoullIntervalTest.java | 2 +- .../BinomialConfidenceIntervalAbstractTest.java | 4 +- .../interval/ClopperPearsonIntervalTest.java | 2 +- .../math4/stat/interval/IntervalUtilsTest.java | 4 +- .../NormalApproximationIntervalTest.java | 2 +- .../stat/interval/WilsonScoreIntervalTest.java | 2 +- .../math4/stat/ranking/NaturalRankingTest.java | 14 +-- .../stat/regression/SimpleRegressionTest.java | 2 +- .../commons/math4/util/ArithmeticUtilsTest.java | 32 ++--- .../commons/math4/util/CombinationsTest.java | 4 +- .../apache/commons/math4/util/FastMathTest.java | 26 ++-- .../commons/math4/util/IncrementorTest.java | 2 +- .../math4/util/ResizableDoubleArrayTest.java | 2 +- 126 files changed, 490 insertions(+), 490 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-math/blob/49bb370a/src/test/java/org/apache/commons/math4/analysis/FunctionUtilsTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/analysis/FunctionUtilsTest.java b/src/test/java/org/apache/commons/math4/analysis/FunctionUtilsTest.java index ee6be54..a905dd7 100644 --- a/src/test/java/org/apache/commons/math4/analysis/FunctionUtilsTest.java +++ b/src/test/java/org/apache/commons/math4/analysis/FunctionUtilsTest.java @@ -358,12 +358,12 @@ public class FunctionUtilsTest { public void testDerivativeUnivariate() { final UnivariateDifferentiableFunction f = new UnivariateDifferentiableFunction() { - + @Override public double value(double x) { return x * x; } - + @Override public DerivativeStructure value(DerivativeStructure x) { return x.multiply(x); @@ -390,12 +390,12 @@ public class FunctionUtilsTest { final double b = 0.5; final double c = 0.25; final MultivariateDifferentiableFunction mdf = new MultivariateDifferentiableFunction() { - + @Override public double value(double[] point) { return a * point[0] * point[0] + b * point[1] * point[1] + c * point[0] * point[1]; } - + @Override public DerivativeStructure value(DerivativeStructure[] point) { DerivativeStructure x = point[0]; http://git-wip-us.apache.org/repos/asf/commons-math/blob/49bb370a/src/test/java/org/apache/commons/math4/analysis/differentiation/DerivativeStructureTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/analysis/differentiation/DerivativeStructureTest.java b/src/test/java/org/apache/commons/math4/analysis/differentiation/DerivativeStructureTest.java index dc251bb..99fcdd1 100644 --- a/src/test/java/org/apache/commons/math4/analysis/differentiation/DerivativeStructureTest.java +++ b/src/test/java/org/apache/commons/math4/analysis/differentiation/DerivativeStructureTest.java @@ -376,7 +376,7 @@ public class DerivativeStructureTest extends ExtendedFieldElementAbstractTest<De FastMath.abs(epsilon * dfdxdydz)); } - + } } } @@ -396,17 +396,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 @@ -448,7 +448,7 @@ public class DerivativeStructureTest extends ExtendedFieldElementAbstractTest<De } } } - } + } } } @@ -1103,17 +1103,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/49bb370a/src/test/java/org/apache/commons/math4/analysis/function/GaussianTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/analysis/function/GaussianTest.java b/src/test/java/org/apache/commons/math4/analysis/function/GaussianTest.java index c3b8574..f3efeec 100644 --- a/src/test/java/org/apache/commons/math4/analysis/function/GaussianTest.java +++ b/src/test/java/org/apache/commons/math4/analysis/function/GaussianTest.java @@ -81,7 +81,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/49bb370a/src/test/java/org/apache/commons/math4/analysis/function/LogisticTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/analysis/function/LogisticTest.java b/src/test/java/org/apache/commons/math4/analysis/function/LogisticTest.java index 61c1384..4af1824 100644 --- a/src/test/java/org/apache/commons/math4/analysis/function/LogisticTest.java +++ b/src/test/java/org/apache/commons/math4/analysis/function/LogisticTest.java @@ -88,7 +88,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; @@ -148,7 +148,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}); @@ -167,7 +167,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; @@ -187,7 +187,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/49bb370a/src/test/java/org/apache/commons/math4/analysis/function/SigmoidTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/analysis/function/SigmoidTest.java b/src/test/java/org/apache/commons/math4/analysis/function/SigmoidTest.java index b9f458b..91b11a1 100644 --- a/src/test/java/org/apache/commons/math4/analysis/function/SigmoidTest.java +++ b/src/test/java/org/apache/commons/math4/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/49bb370a/src/test/java/org/apache/commons/math4/analysis/function/StepFunctionTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/analysis/function/StepFunctionTest.java b/src/test/java/org/apache/commons/math4/analysis/function/StepFunctionTest.java index e6e4bfc..994135c 100644 --- a/src/test/java/org/apache/commons/math4/analysis/function/StepFunctionTest.java +++ b/src/test/java/org/apache/commons/math4/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/49bb370a/src/test/java/org/apache/commons/math4/analysis/integration/MidPointIntegratorTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/analysis/integration/MidPointIntegratorTest.java b/src/test/java/org/apache/commons/math4/analysis/integration/MidPointIntegratorTest.java index afd590a..4b476ce 100644 --- a/src/test/java/org/apache/commons/math4/analysis/integration/MidPointIntegratorTest.java +++ b/src/test/java/org/apache/commons/math4/analysis/integration/MidPointIntegratorTest.java @@ -43,7 +43,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; @@ -62,7 +62,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/49bb370a/src/test/java/org/apache/commons/math4/complex/ComplexTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/complex/ComplexTest.java b/src/test/java/org/apache/commons/math4/complex/ComplexTest.java index dc2e626..6694dd6 100644 --- a/src/test/java/org/apache/commons/math4/complex/ComplexTest.java +++ b/src/test/java/org/apache/commons/math4/complex/ComplexTest.java @@ -822,7 +822,7 @@ public class ComplexTest { }; for(String t : props) { System.out.println(t + "=" + System.getProperty(t)); - } + } System.out.println("<<testJava()"); } http://git-wip-us.apache.org/repos/asf/commons-math/blob/49bb370a/src/test/java/org/apache/commons/math4/complex/QuaternionTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/complex/QuaternionTest.java b/src/test/java/org/apache/commons/math4/complex/QuaternionTest.java index 56658e3..1a7c5b4 100644 --- a/src/test/java/org/apache/commons/math4/complex/QuaternionTest.java +++ b/src/test/java/org/apache/commons/math4/complex/QuaternionTest.java @@ -85,7 +85,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/49bb370a/src/test/java/org/apache/commons/math4/dfp/DfpDecTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/dfp/DfpDecTest.java b/src/test/java/org/apache/commons/math4/dfp/DfpDecTest.java index ead9c9e..0d4a963 100644 --- a/src/test/java/org/apache/commons/math4/dfp/DfpDecTest.java +++ b/src/test/java/org/apache/commons/math4/dfp/DfpDecTest.java @@ -47,13 +47,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 @@ -556,7 +556,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/49bb370a/src/test/java/org/apache/commons/math4/dfp/DfpMathTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/dfp/DfpMathTest.java b/src/test/java/org/apache/commons/math4/dfp/DfpMathTest.java index 577cec7..a2a14ee 100644 --- a/src/test/java/org/apache/commons/math4/dfp/DfpMathTest.java +++ b/src/test/java/org/apache/commons/math4/dfp/DfpMathTest.java @@ -56,14 +56,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 @@ -78,109 +78,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"); @@ -189,19 +189,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"); @@ -210,15 +210,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"); @@ -227,41 +227,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"); @@ -355,7 +355,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"); @@ -372,7 +372,7 @@ public class DfpMathTest { pinf, 0, "pow #66"); - // pinf ^ -anything = +0 + // pinf ^ -anything = +0 test(DfpMath.pow(pinf, factory.newDfp("-3")), factory.getZero(), @@ -445,7 +445,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"); @@ -470,7 +470,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"); } @@ -546,10 +546,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/49bb370a/src/test/java/org/apache/commons/math4/distribution/BinomialDistributionTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/distribution/BinomialDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/BinomialDistributionTest.java index 660750e..27ac515 100644 --- a/src/test/java/org/apache/commons/math4/distribution/BinomialDistributionTest.java +++ b/src/test/java/org/apache/commons/math4/distribution/BinomialDistributionTest.java @@ -31,7 +31,7 @@ public class BinomialDistributionTest extends IntegerDistributionAbstractTest { public BinomialDistributionTest() { setTolerance(1e-12); } - + // -------------- Implementations for abstract methods // ----------------------- @@ -47,7 +47,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/49bb370a/src/test/java/org/apache/commons/math4/distribution/ConstantRealDistributionTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/distribution/ConstantRealDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/ConstantRealDistributionTest.java index 6a7bbe8..2d65447 100644 --- a/src/test/java/org/apache/commons/math4/distribution/ConstantRealDistributionTest.java +++ b/src/test/java/org/apache/commons/math4/distribution/ConstantRealDistributionTest.java @@ -60,7 +60,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 @@ -88,6 +88,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/49bb370a/src/test/java/org/apache/commons/math4/distribution/EnumeratedIntegerDistributionTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/distribution/EnumeratedIntegerDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/EnumeratedIntegerDistributionTest.java index cd7bb4d..2a66f95 100644 --- a/src/test/java/org/apache/commons/math4/distribution/EnumeratedIntegerDistributionTest.java +++ b/src/test/java/org/apache/commons/math4/distribution/EnumeratedIntegerDistributionTest.java @@ -171,7 +171,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/49bb370a/src/test/java/org/apache/commons/math4/distribution/EnumeratedRealDistributionTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/distribution/EnumeratedRealDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/EnumeratedRealDistributionTest.java index 6b98c2d..f1cf652 100644 --- a/src/test/java/org/apache/commons/math4/distribution/EnumeratedRealDistributionTest.java +++ b/src/test/java/org/apache/commons/math4/distribution/EnumeratedRealDistributionTest.java @@ -35,7 +35,7 @@ import org.junit.Test; /** * Test class for {@link EnumeratedRealDistribution}. - * + * */ public class EnumeratedRealDistributionTest { @@ -224,11 +224,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); @@ -240,7 +240,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/49bb370a/src/test/java/org/apache/commons/math4/distribution/GeometricDistributionTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/distribution/GeometricDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/GeometricDistributionTest.java index e76254f..80a034e 100644 --- a/src/test/java/org/apache/commons/math4/distribution/GeometricDistributionTest.java +++ b/src/test/java/org/apache/commons/math4/distribution/GeometricDistributionTest.java @@ -33,7 +33,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/49bb370a/src/test/java/org/apache/commons/math4/distribution/HypergeometricDistributionTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/distribution/HypergeometricDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/HypergeometricDistributionTest.java index b9b791c..b2d11f4 100644 --- a/src/test/java/org/apache/commons/math4/distribution/HypergeometricDistributionTest.java +++ b/src/test/java/org/apache/commons/math4/distribution/HypergeometricDistributionTest.java @@ -41,7 +41,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. */ @@ -56,7 +56,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. */ @@ -66,7 +66,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. */ @@ -83,7 +83,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. */ @@ -292,7 +292,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 @@ -301,10 +301,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/49bb370a/src/test/java/org/apache/commons/math4/distribution/LevyDistributionTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/distribution/LevyDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/LevyDistributionTest.java index 59c2d7c..d0af056 100644 --- a/src/test/java/org/apache/commons/math4/distribution/LevyDistributionTest.java +++ b/src/test/java/org/apache/commons/math4/distribution/LevyDistributionTest.java @@ -69,7 +69,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/49bb370a/src/test/java/org/apache/commons/math4/distribution/MultivariateNormalDistributionTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/distribution/MultivariateNormalDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/MultivariateNormalDistributionTest.java index cd4a497..41d526c 100644 --- a/src/test/java/org/apache/commons/math4/distribution/MultivariateNormalDistributionTest.java +++ b/src/test/java/org/apache/commons/math4/distribution/MultivariateNormalDistributionTest.java @@ -140,7 +140,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/49bb370a/src/test/java/org/apache/commons/math4/distribution/PoissonDistributionTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/distribution/PoissonDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/PoissonDistributionTest.java index 51d6252..a0c404c 100644 --- a/src/test/java/org/apache/commons/math4/distribution/PoissonDistributionTest.java +++ b/src/test/java/org/apache/commons/math4/distribution/PoissonDistributionTest.java @@ -68,7 +68,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/49bb370a/src/test/java/org/apache/commons/math4/distribution/RealDistributionAbstractTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/distribution/RealDistributionAbstractTest.java b/src/test/java/org/apache/commons/math4/distribution/RealDistributionAbstractTest.java index d4af05d..9fffeaf 100644 --- a/src/test/java/org/apache/commons/math4/distribution/RealDistributionAbstractTest.java +++ b/src/test/java/org/apache/commons/math4/distribution/RealDistributionAbstractTest.java @@ -321,7 +321,7 @@ public abstract class RealDistributionAbstractTest { // expected } } - + /** * Test sampling */ @@ -338,7 +338,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 @@ -377,7 +377,7 @@ public abstract class RealDistributionAbstractTest { integrationTestPoints.get(i)), tol); } } - + @Test public void testDistributionClone() throws IOException, http://git-wip-us.apache.org/repos/asf/commons-math/blob/49bb370a/src/test/java/org/apache/commons/math4/distribution/TDistributionTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/distribution/TDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/TDistributionTest.java index 0279394..992bb34 100644 --- a/src/test/java/org/apache/commons/math4/distribution/TDistributionTest.java +++ b/src/test/java/org/apache/commons/math4/distribution/TDistributionTest.java @@ -101,7 +101,7 @@ public class TDistributionTest extends RealDistributionAbstractTest { new double[] {Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY}); verifyInverseCumulativeProbabilities(); } - + @Test public void testCumulativeProbablilityExtremes() { TDistribution dist; @@ -111,7 +111,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/49bb370a/src/test/java/org/apache/commons/math4/distribution/UniformRealDistributionTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/distribution/UniformRealDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/UniformRealDistributionTest.java index 839ae08..f09f876 100644 --- a/src/test/java/org/apache/commons/math4/distribution/UniformRealDistributionTest.java +++ b/src/test/java/org/apache/commons/math4/distribution/UniformRealDistributionTest.java @@ -111,15 +111,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/49bb370a/src/test/java/org/apache/commons/math4/distribution/fitting/MultivariateNormalMixtureExpectationMaximizationTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/distribution/fitting/MultivariateNormalMixtureExpectationMaximizationTest.java b/src/test/java/org/apache/commons/math4/distribution/fitting/MultivariateNormalMixtureExpectationMaximizationTest.java index 18291eb..cb68603 100644 --- a/src/test/java/org/apache/commons/math4/distribution/fitting/MultivariateNormalMixtureExpectationMaximizationTest.java +++ b/src/test/java/org/apache/commons/math4/distribution/fitting/MultivariateNormalMixtureExpectationMaximizationTest.java @@ -181,10 +181,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++; @@ -198,12 +198,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 }, @@ -212,7 +212,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/49bb370a/src/test/java/org/apache/commons/math4/exception/DimensionMismatchExceptionTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/exception/DimensionMismatchExceptionTest.java b/src/test/java/org/apache/commons/math4/exception/DimensionMismatchExceptionTest.java index 263e28d..310c024 100644 --- a/src/test/java/org/apache/commons/math4/exception/DimensionMismatchExceptionTest.java +++ b/src/test/java/org/apache/commons/math4/exception/DimensionMismatchExceptionTest.java @@ -22,7 +22,7 @@ import org.junit.Test; /** * Test for {@link DimensionMismatchException}. - * + * */ public class DimensionMismatchExceptionTest { @Test http://git-wip-us.apache.org/repos/asf/commons-math/blob/49bb370a/src/test/java/org/apache/commons/math4/exception/MaxCountExceededExceptionTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/exception/MaxCountExceededExceptionTest.java b/src/test/java/org/apache/commons/math4/exception/MaxCountExceededExceptionTest.java index f0da371..9772a27 100644 --- a/src/test/java/org/apache/commons/math4/exception/MaxCountExceededExceptionTest.java +++ b/src/test/java/org/apache/commons/math4/exception/MaxCountExceededExceptionTest.java @@ -22,7 +22,7 @@ import org.junit.Test; /** * Test for {@link MaxCountExceededException}. - * + * */ public class MaxCountExceededExceptionTest { @Test http://git-wip-us.apache.org/repos/asf/commons-math/blob/49bb370a/src/test/java/org/apache/commons/math4/exception/NonMonotonicSequenceExceptionTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/exception/NonMonotonicSequenceExceptionTest.java b/src/test/java/org/apache/commons/math4/exception/NonMonotonicSequenceExceptionTest.java index 6c3b475..823034a 100644 --- a/src/test/java/org/apache/commons/math4/exception/NonMonotonicSequenceExceptionTest.java +++ b/src/test/java/org/apache/commons/math4/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/49bb370a/src/test/java/org/apache/commons/math4/exception/NotPositiveExceptionTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/exception/NotPositiveExceptionTest.java b/src/test/java/org/apache/commons/math4/exception/NotPositiveExceptionTest.java index 37276cf..359b227 100644 --- a/src/test/java/org/apache/commons/math4/exception/NotPositiveExceptionTest.java +++ b/src/test/java/org/apache/commons/math4/exception/NotPositiveExceptionTest.java @@ -22,7 +22,7 @@ import org.junit.Test; /** * Test for {@link NotPositiveException}. - * + * */ public class NotPositiveExceptionTest { @Test http://git-wip-us.apache.org/repos/asf/commons-math/blob/49bb370a/src/test/java/org/apache/commons/math4/exception/NotStrictlyPositiveExceptionTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/exception/NotStrictlyPositiveExceptionTest.java b/src/test/java/org/apache/commons/math4/exception/NotStrictlyPositiveExceptionTest.java index 95748fc..8760d91 100644 --- a/src/test/java/org/apache/commons/math4/exception/NotStrictlyPositiveExceptionTest.java +++ b/src/test/java/org/apache/commons/math4/exception/NotStrictlyPositiveExceptionTest.java @@ -22,7 +22,7 @@ import org.junit.Test; /** * Test for {@link NotStrictlyPositiveException}. - * + * */ public class NotStrictlyPositiveExceptionTest { @Test http://git-wip-us.apache.org/repos/asf/commons-math/blob/49bb370a/src/test/java/org/apache/commons/math4/exception/NumberIsTooLargeExceptionTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/exception/NumberIsTooLargeExceptionTest.java b/src/test/java/org/apache/commons/math4/exception/NumberIsTooLargeExceptionTest.java index fea0233..1f3f8ce 100644 --- a/src/test/java/org/apache/commons/math4/exception/NumberIsTooLargeExceptionTest.java +++ b/src/test/java/org/apache/commons/math4/exception/NumberIsTooLargeExceptionTest.java @@ -22,7 +22,7 @@ import org.junit.Test; /** * Test for {@link NumberIsTooLargeException}. - * + * */ public class NumberIsTooLargeExceptionTest { @Test http://git-wip-us.apache.org/repos/asf/commons-math/blob/49bb370a/src/test/java/org/apache/commons/math4/exception/NumberIsTooSmallExceptionTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/exception/NumberIsTooSmallExceptionTest.java b/src/test/java/org/apache/commons/math4/exception/NumberIsTooSmallExceptionTest.java index 95935c0..abc7305 100644 --- a/src/test/java/org/apache/commons/math4/exception/NumberIsTooSmallExceptionTest.java +++ b/src/test/java/org/apache/commons/math4/exception/NumberIsTooSmallExceptionTest.java @@ -22,7 +22,7 @@ import org.junit.Test; /** * Test for {@link NumberIsTooSmallException}. - * + * */ public class NumberIsTooSmallExceptionTest { @Test http://git-wip-us.apache.org/repos/asf/commons-math/blob/49bb370a/src/test/java/org/apache/commons/math4/exception/OutOfRangeExceptionTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/exception/OutOfRangeExceptionTest.java b/src/test/java/org/apache/commons/math4/exception/OutOfRangeExceptionTest.java index a640443..7b0105b 100644 --- a/src/test/java/org/apache/commons/math4/exception/OutOfRangeExceptionTest.java +++ b/src/test/java/org/apache/commons/math4/exception/OutOfRangeExceptionTest.java @@ -22,7 +22,7 @@ import org.junit.Test; /** * Test for {@link OutOfRangeException}. - * + * */ public class OutOfRangeExceptionTest { @Test http://git-wip-us.apache.org/repos/asf/commons-math/blob/49bb370a/src/test/java/org/apache/commons/math4/exception/TooManyEvaluationsExceptionTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/exception/TooManyEvaluationsExceptionTest.java b/src/test/java/org/apache/commons/math4/exception/TooManyEvaluationsExceptionTest.java index 0315f26..5dce64b 100644 --- a/src/test/java/org/apache/commons/math4/exception/TooManyEvaluationsExceptionTest.java +++ b/src/test/java/org/apache/commons/math4/exception/TooManyEvaluationsExceptionTest.java @@ -24,7 +24,7 @@ import org.junit.Test; /** * Test for {@link TooManyEvaluationsException}. - * + * */ public class TooManyEvaluationsExceptionTest { @Test http://git-wip-us.apache.org/repos/asf/commons-math/blob/49bb370a/src/test/java/org/apache/commons/math4/exception/util/ArgUtilsTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/exception/util/ArgUtilsTest.java b/src/test/java/org/apache/commons/math4/exception/util/ArgUtilsTest.java index bb55ac2..46ed189 100644 --- a/src/test/java/org/apache/commons/math4/exception/util/ArgUtilsTest.java +++ b/src/test/java/org/apache/commons/math4/exception/util/ArgUtilsTest.java @@ -25,7 +25,7 @@ import org.junit.Test; /** * Test for {@link ArgUtils}. - * + * */ public class ArgUtilsTest { @Test http://git-wip-us.apache.org/repos/asf/commons-math/blob/49bb370a/src/test/java/org/apache/commons/math4/exception/util/ExceptionContextTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/exception/util/ExceptionContextTest.java b/src/test/java/org/apache/commons/math4/exception/util/ExceptionContextTest.java index a9489f8..e1ce45f 100644 --- a/src/test/java/org/apache/commons/math4/exception/util/ExceptionContextTest.java +++ b/src/test/java/org/apache/commons/math4/exception/util/ExceptionContextTest.java @@ -31,7 +31,7 @@ import org.junit.Test; /** * Test for {@link ExceptionContext}. - * + * */ public class ExceptionContextTest { @Test http://git-wip-us.apache.org/repos/asf/commons-math/blob/49bb370a/src/test/java/org/apache/commons/math4/filter/KalmanFilterTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/filter/KalmanFilterTest.java b/src/test/java/org/apache/commons/math4/filter/KalmanFilterTest.java index eeb2aa0..99d73c5 100644 --- a/src/test/java/org/apache/commons/math4/filter/KalmanFilterTest.java +++ b/src/test/java/org/apache/commons/math4/filter/KalmanFilterTest.java @@ -39,12 +39,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 @@ -66,9 +66,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 ] @@ -87,11 +87,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; @@ -252,30 +252,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]; } @@ -283,18 +283,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++ ) { @@ -326,7 +326,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(); @@ -338,7 +338,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. @@ -364,7 +364,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 } ); @@ -379,7 +379,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 }, @@ -399,13 +399,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 } ); @@ -416,7 +416,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/49bb370a/src/test/java/org/apache/commons/math4/fitting/GaussianCurveFitterTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/fitting/GaussianCurveFitterTest.java b/src/test/java/org/apache/commons/math4/fitting/GaussianCurveFitterTest.java index b14aceb..261bd30 100644 --- a/src/test/java/org/apache/commons/math4/fitting/GaussianCurveFitterTest.java +++ b/src/test/java/org/apache/commons/math4/fitting/GaussianCurveFitterTest.java @@ -238,7 +238,7 @@ public class GaussianCurveFitterTest { public void testFit02() { GaussianCurveFitter.create().fit(new WeightedObservedPoints().toList()); } - + /** * Two points is not enough observed points. */ @@ -250,7 +250,7 @@ public class GaussianCurveFitterTest { {4.02804905, 664002.0} }).toList()); } - + /** * Poor data: right of peak not symmetric with left of peak. */ @@ -262,8 +262,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. */ @@ -276,7 +276,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. */ @@ -288,7 +288,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. @@ -308,7 +308,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, @@ -376,7 +376,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/49bb370a/src/test/java/org/apache/commons/math4/fitting/HarmonicCurveFitterTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/fitting/HarmonicCurveFitterTest.java b/src/test/java/org/apache/commons/math4/fitting/HarmonicCurveFitterTest.java index d85588e..17097f5 100644 --- a/src/test/java/org/apache/commons/math4/fitting/HarmonicCurveFitterTest.java +++ b/src/test/java/org/apache/commons/math4/fitting/HarmonicCurveFitterTest.java @@ -151,7 +151,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/49bb370a/src/test/java/org/apache/commons/math4/fitting/PolynomialCurveFitterTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/fitting/PolynomialCurveFitterTest.java b/src/test/java/org/apache/commons/math4/fitting/PolynomialCurveFitterTest.java index 02c5810..89ebc2b 100644 --- a/src/test/java/org/apache/commons/math4/fitting/PolynomialCurveFitterTest.java +++ b/src/test/java/org/apache/commons/math4/fitting/PolynomialCurveFitterTest.java @@ -116,7 +116,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/49bb370a/src/test/java/org/apache/commons/math4/fitting/SimpleCurveFitterTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/fitting/SimpleCurveFitterTest.java b/src/test/java/org/apache/commons/math4/fitting/SimpleCurveFitterTest.java index b581d0d..01d28b2 100644 --- a/src/test/java/org/apache/commons/math4/fitting/SimpleCurveFitterTest.java +++ b/src/test/java/org/apache/commons/math4/fitting/SimpleCurveFitterTest.java @@ -47,7 +47,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/49bb370a/src/test/java/org/apache/commons/math4/fitting/leastsquares/CircleProblem.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/fitting/leastsquares/CircleProblem.java b/src/test/java/org/apache/commons/math4/fitting/leastsquares/CircleProblem.java index 63c817e..377726d 100644 --- a/src/test/java/org/apache/commons/math4/fitting/leastsquares/CircleProblem.java +++ b/src/test/java/org/apache/commons/math4/fitting/leastsquares/CircleProblem.java @@ -159,7 +159,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/49bb370a/src/test/java/org/apache/commons/math4/fitting/leastsquares/CircleVectorial.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/fitting/leastsquares/CircleVectorial.java b/src/test/java/org/apache/commons/math4/fitting/leastsquares/CircleVectorial.java index 3ba837b..3c88431 100644 --- a/src/test/java/org/apache/commons/math4/fitting/leastsquares/CircleVectorial.java +++ b/src/test/java/org/apache/commons/math4/fitting/leastsquares/CircleVectorial.java @@ -57,7 +57,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/49bb370a/src/test/java/org/apache/commons/math4/fitting/leastsquares/MinpackTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/fitting/leastsquares/MinpackTest.java b/src/test/java/org/apache/commons/math4/fitting/leastsquares/MinpackTest.java index 9fc4504..98b221f 100644 --- a/src/test/java/org/apache/commons/math4/fitting/leastsquares/MinpackTest.java +++ b/src/test/java/org/apache/commons/math4/fitting/leastsquares/MinpackTest.java @@ -614,7 +614,7 @@ public class MinpackTest { } private static class LinearFullRankFunction extends MinpackFunction { - + public LinearFullRankFunction(int m, int n, double x0, double theoreticalStartCost, double theoreticalMinCost) { @@ -1386,7 +1386,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/49bb370a/src/test/java/org/apache/commons/math4/genetics/CycleCrossoverTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/genetics/CycleCrossoverTest.java b/src/test/java/org/apache/commons/math4/genetics/CycleCrossoverTest.java index 740091d..fd7b177 100644 --- a/src/test/java/org/apache/commons/math4/genetics/CycleCrossoverTest.java +++ b/src/test/java/org/apache/commons/math4/genetics/CycleCrossoverTest.java @@ -27,7 +27,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 @@ -86,7 +86,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/49bb370a/src/test/java/org/apache/commons/math4/genetics/DummyListChromosome.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/genetics/DummyListChromosome.java b/src/test/java/org/apache/commons/math4/genetics/DummyListChromosome.java index 0fd1186..f4c8602 100644 --- a/src/test/java/org/apache/commons/math4/genetics/DummyListChromosome.java +++ b/src/test/java/org/apache/commons/math4/genetics/DummyListChromosome.java @@ -41,7 +41,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/49bb370a/src/test/java/org/apache/commons/math4/genetics/ElitisticListPopulationTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/genetics/ElitisticListPopulationTest.java b/src/test/java/org/apache/commons/math4/genetics/ElitisticListPopulationTest.java index 08dbeb3..4737b61 100644 --- a/src/test/java/org/apache/commons/math4/genetics/ElitisticListPopulationTest.java +++ b/src/test/java/org/apache/commons/math4/genetics/ElitisticListPopulationTest.java @@ -43,7 +43,7 @@ public class ElitisticListPopulationTest { Assert.assertEquals(20, nextGeneration.getPopulationSize()); } - + @Test public void testSetElitismRate() { final double rate = 0.25; @@ -51,27 +51,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/49bb370a/src/test/java/org/apache/commons/math4/genetics/ListPopulationTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/genetics/ListPopulationTest.java b/src/test/java/org/apache/commons/math4/genetics/ListPopulationTest.java index 9261fe3..6fa323e 100644 --- a/src/test/java/org/apache/commons/math4/genetics/ListPopulationTest.java +++ b/src/test/java/org/apache/commons/math4/genetics/ListPopulationTest.java @@ -64,13 +64,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() { @@ -78,16 +78,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) { @@ -96,7 +96,7 @@ public class ListPopulationTest { return null; } }; - + population.setPopulationLimit(-50); } @@ -127,7 +127,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 @@ -135,7 +135,7 @@ public class ListPopulationTest { } }; } - + @Test(expected=NumberIsTooLargeException.class) public void testAddTooManyChromosomes() { final ArrayList<Chromosome> chromosomes = new ArrayList<Chromosome> (); @@ -149,10 +149,10 @@ public class ListPopulationTest { return null; } }; - + population.addChromosomes(chromosomes); } - + @Test(expected=NumberIsTooLargeException.class) public void testAddTooManyChromosomesSingleCall() { @@ -167,7 +167,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>(); @@ -190,7 +190,7 @@ public class ListPopulationTest { iter.remove(); } } - + @Test(expected=NumberIsTooSmallException.class) public void testSetPopulationLimitTooSmall() { final ArrayList<Chromosome> chromosomes = new ArrayList<Chromosome> (); @@ -207,5 +207,5 @@ public class ListPopulationTest { population.setPopulationLimit(2); } - + } http://git-wip-us.apache.org/repos/asf/commons-math/blob/49bb370a/src/test/java/org/apache/commons/math4/genetics/NPointCrossoverTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/genetics/NPointCrossoverTest.java b/src/test/java/org/apache/commons/math4/genetics/NPointCrossoverTest.java index 363b161..4f05d81 100644 --- a/src/test/java/org/apache/commons/math4/genetics/NPointCrossoverTest.java +++ b/src/test/java/org/apache/commons/math4/genetics/NPointCrossoverTest.java @@ -42,7 +42,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}; @@ -54,7 +54,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}; @@ -69,7 +69,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}; @@ -84,7 +84,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}; @@ -108,10 +108,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(); @@ -119,7 +119,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)) { @@ -127,7 +127,7 @@ public class NPointCrossoverTest { rep = rep == p1Rep ? p2Rep : p1Rep; } } - + return crossovers; } http://git-wip-us.apache.org/repos/asf/commons-math/blob/49bb370a/src/test/java/org/apache/commons/math4/genetics/OrderedCrossoverTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/genetics/OrderedCrossoverTest.java b/src/test/java/org/apache/commons/math4/genetics/OrderedCrossoverTest.java index 720eb23..9379da1 100644 --- a/src/test/java/org/apache/commons/math4/genetics/OrderedCrossoverTest.java +++ b/src/test/java/org/apache/commons/math4/genetics/OrderedCrossoverTest.java @@ -38,13 +38,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]); @@ -52,7 +52,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]));