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 <frederic.dever...@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)); }