You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ps...@apache.org on 2015/11/27 19:10:52 UTC
[2/4] [math] Removed trailing spaces. No code change.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optim/linear/SimplexSolverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optim/linear/SimplexSolverTest.java b/src/test/java/org/apache/commons/math3/optim/linear/SimplexSolverTest.java
index 0728be1..452bd7d 100644
--- a/src/test/java/org/apache/commons/math3/optim/linear/SimplexSolverTest.java
+++ b/src/test/java/org/apache/commons/math3/optim/linear/SimplexSolverTest.java
@@ -42,13 +42,13 @@ public class SimplexSolverTest {
// x1,x2,x3,x4 >= 0
LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 10, -57, -9, -24}, 0);
-
+
ArrayList<LinearConstraint> constraints = new ArrayList<LinearConstraint>();
constraints.add(new LinearConstraint(new double[] {0.5, -5.5, -2.5, 9}, Relationship.LEQ, 0));
constraints.add(new LinearConstraint(new double[] {0.5, -1.5, -0.5, 1}, Relationship.LEQ, 0));
constraints.add(new LinearConstraint(new double[] { 1, 0, 0, 0}, Relationship.LEQ, 1));
-
+
double epsilon = 1e-6;
SimplexSolver solver = new SimplexSolver();
PointValuePair solution = solver.optimize(f, new LinearConstraintSet(constraints),
@@ -63,7 +63,7 @@ public class SimplexSolverTest {
public void testMath828() {
LinearObjectiveFunction f = new LinearObjectiveFunction(
new double[] { 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 0.0);
-
+
ArrayList <LinearConstraint>constraints = new ArrayList<LinearConstraint>();
constraints.add(new LinearConstraint(new double[] {0.0, 39.0, 23.0, 96.0, 15.0, 48.0, 9.0, 21.0, 48.0, 36.0, 76.0, 19.0, 88.0, 17.0, 16.0, 36.0,}, Relationship.GEQ, 15.0));
@@ -73,7 +73,7 @@ public class SimplexSolverTest {
constraints.add(new LinearConstraint(new double[] {25.0, -7.0, -99.0, -78.0, -25.0, -14.0, -16.0, -89.0, -39.0, -56.0, -53.0, -9.0, -18.0, -26.0, -11.0, -61.0,}, Relationship.GEQ, 0.0));
constraints.add(new LinearConstraint(new double[] {33.0, -95.0, -15.0, -4.0, -33.0, -3.0, -20.0, -96.0, -27.0, -13.0, -80.0, -24.0, -3.0, -13.0, -57.0, -76.0,}, Relationship.GEQ, 0.0));
constraints.add(new LinearConstraint(new double[] {7.0, -95.0, -39.0, -93.0, -7.0, -94.0, -94.0, -62.0, -76.0, -26.0, -53.0, -57.0, -31.0, -76.0, -53.0, -52.0,}, Relationship.GEQ, 0.0));
-
+
double epsilon = 1e-6;
PointValuePair solution = new SimplexSolver().optimize(DEFAULT_MAX_ITER, f, new LinearConstraintSet(constraints),
GoalType.MINIMIZE, new NonNegativeConstraint(true));
@@ -85,7 +85,7 @@ public class SimplexSolverTest {
public void testMath828Cycle() {
LinearObjectiveFunction f = new LinearObjectiveFunction(
new double[] { 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 0.0);
-
+
ArrayList <LinearConstraint>constraints = new ArrayList<LinearConstraint>();
constraints.add(new LinearConstraint(new double[] {0.0, 16.0, 14.0, 69.0, 1.0, 85.0, 52.0, 43.0, 64.0, 97.0, 14.0, 74.0, 89.0, 28.0, 94.0, 58.0, 13.0, 22.0, 21.0, 17.0, 30.0, 25.0, 1.0, 59.0, 91.0, 78.0, 12.0, 74.0, 56.0, 3.0, 88.0,}, Relationship.GEQ, 91.0));
@@ -95,14 +95,14 @@ public class SimplexSolverTest {
constraints.add(new LinearConstraint(new double[] {41.0, -96.0, -41.0, -48.0, -70.0, -43.0, -43.0, -43.0, -97.0, -37.0, -85.0, -70.0, -45.0, -67.0, -87.0, -69.0, -94.0, -54.0, -54.0, -92.0, -79.0, -10.0, -35.0, -20.0, -41.0, -41.0, -65.0, -25.0, -12.0, -8.0, -46.0,}, Relationship.GEQ, 0.0));
constraints.add(new LinearConstraint(new double[] {27.0, -42.0, -65.0, -49.0, -53.0, -42.0, -17.0, -2.0, -61.0, -31.0, -76.0, -47.0, -8.0, -93.0, -86.0, -62.0, -65.0, -63.0, -22.0, -43.0, -27.0, -23.0, -32.0, -74.0, -27.0, -63.0, -47.0, -78.0, -29.0, -95.0, -73.0,}, Relationship.GEQ, 0.0));
constraints.add(new LinearConstraint(new double[] {15.0, -46.0, -41.0, -83.0, -98.0, -99.0, -21.0, -35.0, -7.0, -14.0, -80.0, -63.0, -18.0, -42.0, -5.0, -34.0, -56.0, -70.0, -16.0, -18.0, -74.0, -61.0, -47.0, -41.0, -15.0, -79.0, -18.0, -47.0, -88.0, -68.0, -55.0,}, Relationship.GEQ, 0.0));
-
+
double epsilon = 1e-6;
PointValuePair solution = new SimplexSolver().optimize(DEFAULT_MAX_ITER, f,
new LinearConstraintSet(constraints),
GoalType.MINIMIZE, new NonNegativeConstraint(true),
PivotSelectionRule.BLAND);
Assert.assertEquals(1.0d, solution.getValue(), epsilon);
- Assert.assertTrue(validSolution(solution, constraints, epsilon));
+ Assert.assertTrue(validSolution(solution, constraints, epsilon));
}
@Test
@@ -185,7 +185,7 @@ public class SimplexSolverTest {
SimplexSolver solver = new SimplexSolver();
PointValuePair solution = solver.optimize(DEFAULT_MAX_ITER, f, new LinearConstraintSet(constraints),
GoalType.MINIMIZE, new NonNegativeConstraint(false));
-
+
Assert.assertTrue(Precision.compareTo(solution.getPoint()[0] * 200.d, 1.d, epsilon) >= 0);
Assert.assertEquals(0.0050, solution.getValue(), epsilon);
}
@@ -209,13 +209,13 @@ public class SimplexSolverTest {
SimplexSolver simplex = new SimplexSolver();
PointValuePair solution = simplex.optimize(DEFAULT_MAX_ITER, f, new LinearConstraintSet(constraints),
GoalType.MINIMIZE, new NonNegativeConstraint(false));
-
+
Assert.assertTrue(Precision.compareTo(solution.getPoint()[0], -1e-18d, epsilon) >= 0);
- Assert.assertEquals(1.0d, solution.getPoint()[1], epsilon);
+ Assert.assertEquals(1.0d, solution.getPoint()[1], epsilon);
Assert.assertEquals(0.0d, solution.getPoint()[2], epsilon);
Assert.assertEquals(1.0d, solution.getValue(), epsilon);
}
-
+
@Test
public void testMath272() {
LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 2, 2, 1 }, 0);
@@ -351,12 +351,12 @@ public class SimplexSolverTest {
@Test
public void testMath930() {
Collection<LinearConstraint> constraints = createMath930Constraints();
-
+
double[] objFunctionCoeff = new double[33];
objFunctionCoeff[3] = 1;
LinearObjectiveFunction f = new LinearObjectiveFunction(objFunctionCoeff, 0);
SimplexSolver solver = new SimplexSolver(1e-4, 10, 1e-6);
-
+
PointValuePair solution = solver.optimize(new MaxIter(1000), f, new LinearConstraintSet(constraints),
GoalType.MINIMIZE, new NonNegativeConstraint(true));
Assert.assertEquals(0.3752298, solution.getValue(), 1e-4);
@@ -751,7 +751,7 @@ public class SimplexSolverTest {
public void testSolutionCallback() {
// re-use the problem from testcase for MATH-288
// it normally requires 5 iterations
-
+
LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 7, 3, 0, 0 }, 0 );
List<LinearConstraint> constraints = new ArrayList<LinearConstraint>();
@@ -763,7 +763,7 @@ public class SimplexSolverTest {
final SimplexSolver solver = new SimplexSolver();
final SolutionCallback callback = new SolutionCallback();
-
+
Assert.assertNull(callback.getSolution());
Assert.assertFalse(callback.isSolutionOptimal());
@@ -774,7 +774,7 @@ public class SimplexSolverTest {
} catch (TooManyIterationsException ex) {
// expected
}
-
+
final PointValuePair solution = callback.getSolution();
Assert.assertNotNull(solution);
Assert.assertTrue(validSolution(solution, constraints, 1e-4));
@@ -821,20 +821,20 @@ public class SimplexSolverTest {
for (int i = 0; i < vals.length; i++) {
result += vals[i] * coeffs[i];
}
-
+
switch (c.getRelationship()) {
case EQ:
if (!Precision.equals(result, c.getValue(), epsilon)) {
return false;
}
break;
-
+
case GEQ:
if (Precision.compareTo(result, c.getValue(), epsilon) < 0) {
return false;
}
break;
-
+
case LEQ:
if (Precision.compareTo(result, c.getValue(), epsilon) > 0) {
return false;
@@ -842,7 +842,7 @@ public class SimplexSolverTest {
break;
}
}
-
+
return true;
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optim/nonlinear/scalar/noderiv/BOBYQAOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optim/nonlinear/scalar/noderiv/BOBYQAOptimizerTest.java b/src/test/java/org/apache/commons/math3/optim/nonlinear/scalar/noderiv/BOBYQAOptimizerTest.java
index c214e4b..858d37b 100644
--- a/src/test/java/org/apache/commons/math3/optim/nonlinear/scalar/noderiv/BOBYQAOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math3/optim/nonlinear/scalar/noderiv/BOBYQAOptimizerTest.java
@@ -41,22 +41,22 @@ import org.junit.Test;
public class BOBYQAOptimizerTest {
static final int DIM = 13;
-
+
@Test(expected=NumberIsTooLargeException.class)
public void testInitOutOfBounds() {
double[] startPoint = point(DIM, 3);
double[][] boundaries = boundaries(DIM, -1, 2);
doTest(new Rosen(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-13, 1e-6, 2000, null);
}
-
+
@Test(expected=DimensionMismatchException.class)
public void testBoundariesDimensionMismatch() {
double[] startPoint = point(DIM, 0.5);
double[][] boundaries = boundaries(DIM + 1, -1, 2);
doTest(new Rosen(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-13, 1e-6, 2000, null);
}
@@ -74,7 +74,7 @@ public class BOBYQAOptimizerTest {
double[] startPoint = point(DIM, 0.1);
double[][] boundaries = null;
doTest(new Rosen(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-13, 1e-6, lowMaxEval, null);
}
@@ -84,7 +84,7 @@ public class BOBYQAOptimizerTest {
double[][] boundaries = null;
PointValuePair expected = new PointValuePair(point(DIM,1.0),0.0);
doTest(new Rosen(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-13, 1e-6, 2000, expected);
}
@@ -94,12 +94,12 @@ public class BOBYQAOptimizerTest {
double[][] boundaries = null;
PointValuePair expected = new PointValuePair(point(DIM,0.0),1.0);
doTest(new MinusElli(), startPoint, boundaries,
- GoalType.MAXIMIZE,
+ GoalType.MAXIMIZE,
2e-10, 5e-6, 1000, expected);
- boundaries = boundaries(DIM,-0.3,0.3);
+ boundaries = boundaries(DIM,-0.3,0.3);
startPoint = point(DIM,0.1);
doTest(new MinusElli(), startPoint, boundaries,
- GoalType.MAXIMIZE,
+ GoalType.MAXIMIZE,
2e-10, 5e-6, 1000, expected);
}
@@ -110,7 +110,7 @@ public class BOBYQAOptimizerTest {
PointValuePair expected =
new PointValuePair(point(DIM,0.0),0.0);
doTest(new Elli(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-13, 1e-6, 1000, expected);
}
@@ -121,7 +121,7 @@ public class BOBYQAOptimizerTest {
PointValuePair expected =
new PointValuePair(point(DIM,0.0),0.0);
doTest(new ElliRotated(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-12, 1e-6, 10000, expected);
}
@@ -132,7 +132,7 @@ public class BOBYQAOptimizerTest {
PointValuePair expected =
new PointValuePair(point(DIM,0.0),0.0);
doTest(new Cigar(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-13, 1e-6, 100, expected);
}
@@ -154,7 +154,7 @@ public class BOBYQAOptimizerTest {
PointValuePair expected =
new PointValuePair(point(DIM,0.0),0.0);
doTest(new CigTab(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-13, 5e-5, 100, expected);
}
@@ -165,18 +165,18 @@ public class BOBYQAOptimizerTest {
PointValuePair expected =
new PointValuePair(point(DIM,0.0),0.0);
doTest(new Sphere(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-13, 1e-6, 100, expected);
}
@Test
public void testTablet() {
- double[] startPoint = point(DIM,1.0);
+ double[] startPoint = point(DIM,1.0);
double[][] boundaries = null;
PointValuePair expected =
new PointValuePair(point(DIM,0.0),0.0);
doTest(new Tablet(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-13, 1e-6, 100, expected);
}
@@ -187,7 +187,7 @@ public class BOBYQAOptimizerTest {
PointValuePair expected =
new PointValuePair(point(DIM/2,0.0),0.0);
doTest(new DiffPow(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-8, 1e-1, 21000, expected);
}
@@ -198,7 +198,7 @@ public class BOBYQAOptimizerTest {
PointValuePair expected =
new PointValuePair(point(DIM/2,0.0),0.0);
doTest(new SsDiffPow(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-2, 1.3e-1, 50000, expected);
}
@@ -221,7 +221,7 @@ public class BOBYQAOptimizerTest {
PointValuePair expected =
new PointValuePair(point(DIM,0.0),0.0);
doTest(new Rastrigin(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-13, 1e-6, 1000, expected);
}
@@ -333,7 +333,7 @@ public class BOBYQAOptimizerTest {
new InitialGuess(startPoint),
new SimpleBounds(boundaries[0],
boundaries[1]));
-// System.out.println(func.getClass().getName() + " = "
+// System.out.println(func.getClass().getName() + " = "
// + optim.getEvaluations() + " f(");
// for (double x: result.getPoint()) System.out.print(x + " ");
// System.out.println(") = " + result.getValue());
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optim/nonlinear/scalar/noderiv/CMAESOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optim/nonlinear/scalar/noderiv/CMAESOptimizerTest.java b/src/test/java/org/apache/commons/math3/optim/nonlinear/scalar/noderiv/CMAESOptimizerTest.java
index aade822..85f8565 100644
--- a/src/test/java/org/apache/commons/math3/optim/nonlinear/scalar/noderiv/CMAESOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math3/optim/nonlinear/scalar/noderiv/CMAESOptimizerTest.java
@@ -70,7 +70,7 @@ public class CMAESOptimizerTest {
GoalType.MINIMIZE, LAMBDA, true, 0, 1e-13,
1e-13, 1e-6, 100000, expected);
}
-
+
@Test(expected = DimensionMismatchException.class)
public void testBoundariesDimensionMismatch() {
double[] startPoint = point(DIM,0.5);
@@ -118,7 +118,7 @@ public class CMAESOptimizerTest {
GoalType.MINIMIZE, LAMBDA, true, 0, 1e-13,
1e-13, 1e-6, 100000, expected);
}
-
+
@Test
@Retry(3)
public void testRosen() {
@@ -149,7 +149,7 @@ public class CMAESOptimizerTest {
doTest(new MinusElli(), startPoint, insigma, boundaries,
GoalType.MAXIMIZE, LAMBDA, false, 0, 1.0-1e-13,
2e-10, 5e-6, 100000, expected);
- boundaries = boundaries(DIM,-0.3,0.3);
+ boundaries = boundaries(DIM,-0.3,0.3);
startPoint = point(DIM,0.1);
doTest(new MinusElli(), startPoint, insigma, boundaries,
GoalType.MAXIMIZE, LAMBDA, true, 0, 1.0-1e-13,
@@ -408,7 +408,7 @@ public class CMAESOptimizerTest {
};
final double[] start = { 1 };
-
+
// No bounds.
PointValuePair result = optimizer.optimize(new MaxEval(100000),
new ObjectiveFunction(fitnessFunction),
@@ -453,7 +453,7 @@ public class CMAESOptimizerTest {
Assert.assertEquals(resNoBound, resNearLo, 1e-3);
Assert.assertEquals(resNoBound, resNearHi, 1e-3);
}
-
+
/**
* @param func Function to optimize.
* @param startPoint Starting point.
@@ -476,7 +476,7 @@ public class CMAESOptimizerTest {
GoalType goal,
int lambda,
boolean isActive,
- int diagonalOnly,
+ int diagonalOnly,
double stopValue,
double fTol,
double pointTol,
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerAbstractTest.java b/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerAbstractTest.java
index 7a9c9eb..bc523ce 100644
--- a/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerAbstractTest.java
+++ b/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerAbstractTest.java
@@ -294,7 +294,7 @@ public abstract class AbstractLeastSquaresOptimizerAbstractTest {
optimizer.optimize(new MaxEval(100),
problem2.getModelFunction(),
problem2.getModelFunctionJacobian(),
- problem2.getTarget(),
+ problem2.getTarget(),
new Weight(new double[] { 1, 1, 1, 1 }),
new InitialGuess(new double[] { 0, 1, 2, 3 }));
Assert.assertEquals(0, optimizer.getRMS(), 1e-10);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/CircleProblem.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/CircleProblem.java b/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/CircleProblem.java
index fe2c3bc..61834b1 100644
--- a/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/CircleProblem.java
+++ b/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/CircleProblem.java
@@ -162,7 +162,7 @@ class CircleProblem {
for (int i = 0; i < points.size(); i++) {
final int index = i * 2;
- // Partial derivative wrt x-coordinate of center.
+ // Partial derivative wrt x-coordinate of center.
jacobian[index][0] = 1;
jacobian[index + 1][0] = 0;
// Partial derivative wrt y-coordinate of center.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/MinpackTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/MinpackTest.java b/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/MinpackTest.java
index 898dbdd..53d7880 100644
--- a/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/MinpackTest.java
+++ b/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/MinpackTest.java
@@ -1368,7 +1368,7 @@ public class MinpackTest {
}
return f;
}
-
+
private static final double[] y = {
0.844, 0.908, 0.932, 0.936, 0.925, 0.908, 0.881, 0.850, 0.818, 0.784, 0.751,
0.718, 0.685, 0.658, 0.628, 0.603, 0.580, 0.558, 0.538, 0.522, 0.506, 0.490,
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optim/univariate/BrentOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optim/univariate/BrentOptimizerTest.java b/src/test/java/org/apache/commons/math3/optim/univariate/BrentOptimizerTest.java
index 575eb5c..f558fc0 100644
--- a/src/test/java/org/apache/commons/math3/optim/univariate/BrentOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math3/optim/univariate/BrentOptimizerTest.java
@@ -83,7 +83,7 @@ public final class BrentOptimizerTest {
public void testBoundaries() {
final double lower = -1.0;
final double upper = +1.0;
- UnivariateFunction f = new UnivariateFunction() {
+ UnivariateFunction f = new UnivariateFunction() {
public double value(double x) {
if (x < lower) {
throw new NumberIsTooSmallException(x, lower, true);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optim/univariate/MultiStartUnivariateOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optim/univariate/MultiStartUnivariateOptimizerTest.java b/src/test/java/org/apache/commons/math3/optim/univariate/MultiStartUnivariateOptimizerTest.java
index d979c72..dde425f 100644
--- a/src/test/java/org/apache/commons/math3/optim/univariate/MultiStartUnivariateOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math3/optim/univariate/MultiStartUnivariateOptimizerTest.java
@@ -111,7 +111,7 @@ public class MultiStartUnivariateOptimizerTest {
JDKRandomGenerator g = new JDKRandomGenerator();
g.setSeed(4312000053L);
MultiStartUnivariateOptimizer optimizer = new MultiStartUnivariateOptimizer(underlying, 5, g);
-
+
try {
optimizer.optimize(new MaxEval(300),
new UnivariateObjectiveFunction(f),
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optim/univariate/SimpleUnivariateValueCheckerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optim/univariate/SimpleUnivariateValueCheckerTest.java b/src/test/java/org/apache/commons/math3/optim/univariate/SimpleUnivariateValueCheckerTest.java
index e7b7904..d2bd42d 100644
--- a/src/test/java/org/apache/commons/math3/optim/univariate/SimpleUnivariateValueCheckerTest.java
+++ b/src/test/java/org/apache/commons/math3/optim/univariate/SimpleUnivariateValueCheckerTest.java
@@ -30,7 +30,7 @@ public class SimpleUnivariateValueCheckerTest {
public void testIterationCheck() {
final int max = 10;
final SimpleUnivariateValueChecker checker = new SimpleUnivariateValueChecker(1e-1, 1e-2, max);
- Assert.assertTrue(checker.converged(max, null, null));
+ Assert.assertTrue(checker.converged(max, null, null));
Assert.assertTrue(checker.converged(max + 1, null, null));
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optimization/SimplePointCheckerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optimization/SimplePointCheckerTest.java b/src/test/java/org/apache/commons/math3/optimization/SimplePointCheckerTest.java
index 5595b11..484c4f5 100644
--- a/src/test/java/org/apache/commons/math3/optimization/SimplePointCheckerTest.java
+++ b/src/test/java/org/apache/commons/math3/optimization/SimplePointCheckerTest.java
@@ -32,7 +32,7 @@ public class SimplePointCheckerTest {
final int max = 10;
final SimplePointChecker<PointValuePair> checker
= new SimplePointChecker<PointValuePair>(1e-1, 1e-2, max);
- Assert.assertTrue(checker.converged(max, null, null));
+ Assert.assertTrue(checker.converged(max, null, null));
Assert.assertTrue(checker.converged(max + 1, null, null));
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optimization/SimpleValueCheckerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optimization/SimpleValueCheckerTest.java b/src/test/java/org/apache/commons/math3/optimization/SimpleValueCheckerTest.java
index baf865f..2cb388e 100644
--- a/src/test/java/org/apache/commons/math3/optimization/SimpleValueCheckerTest.java
+++ b/src/test/java/org/apache/commons/math3/optimization/SimpleValueCheckerTest.java
@@ -31,7 +31,7 @@ public class SimpleValueCheckerTest {
public void testIterationCheck() {
final int max = 10;
final SimpleValueChecker checker = new SimpleValueChecker(1e-1, 1e-2, max);
- Assert.assertTrue(checker.converged(max, null, null));
+ Assert.assertTrue(checker.converged(max, null, null));
Assert.assertTrue(checker.converged(max + 1, null, null));
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optimization/direct/BOBYQAOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optimization/direct/BOBYQAOptimizerTest.java b/src/test/java/org/apache/commons/math3/optimization/direct/BOBYQAOptimizerTest.java
index f89da18..a871d85 100644
--- a/src/test/java/org/apache/commons/math3/optimization/direct/BOBYQAOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math3/optimization/direct/BOBYQAOptimizerTest.java
@@ -40,22 +40,22 @@ import org.junit.Test;
public class BOBYQAOptimizerTest {
static final int DIM = 13;
-
+
@Test(expected=NumberIsTooLargeException.class)
public void testInitOutOfBounds() {
double[] startPoint = point(DIM, 3);
double[][] boundaries = boundaries(DIM, -1, 2);
doTest(new Rosen(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-13, 1e-6, 2000, null);
}
-
+
@Test(expected=DimensionMismatchException.class)
public void testBoundariesDimensionMismatch() {
double[] startPoint = point(DIM, 0.5);
double[][] boundaries = boundaries(DIM + 1, -1, 2);
doTest(new Rosen(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-13, 1e-6, 2000, null);
}
@@ -73,7 +73,7 @@ public class BOBYQAOptimizerTest {
double[] startPoint = point(DIM, 0.1);
double[][] boundaries = null;
doTest(new Rosen(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-13, 1e-6, lowMaxEval, null);
}
@@ -83,7 +83,7 @@ public class BOBYQAOptimizerTest {
double[][] boundaries = null;
PointValuePair expected = new PointValuePair(point(DIM,1.0),0.0);
doTest(new Rosen(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-13, 1e-6, 2000, expected);
}
@@ -93,12 +93,12 @@ public class BOBYQAOptimizerTest {
double[][] boundaries = null;
PointValuePair expected = new PointValuePair(point(DIM,0.0),1.0);
doTest(new MinusElli(), startPoint, boundaries,
- GoalType.MAXIMIZE,
+ GoalType.MAXIMIZE,
2e-10, 5e-6, 1000, expected);
- boundaries = boundaries(DIM,-0.3,0.3);
+ boundaries = boundaries(DIM,-0.3,0.3);
startPoint = point(DIM,0.1);
doTest(new MinusElli(), startPoint, boundaries,
- GoalType.MAXIMIZE,
+ GoalType.MAXIMIZE,
2e-10, 5e-6, 1000, expected);
}
@@ -109,7 +109,7 @@ public class BOBYQAOptimizerTest {
PointValuePair expected =
new PointValuePair(point(DIM,0.0),0.0);
doTest(new Elli(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-13, 1e-6, 1000, expected);
}
@@ -120,7 +120,7 @@ public class BOBYQAOptimizerTest {
PointValuePair expected =
new PointValuePair(point(DIM,0.0),0.0);
doTest(new ElliRotated(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-12, 1e-6, 10000, expected);
}
@@ -131,7 +131,7 @@ public class BOBYQAOptimizerTest {
PointValuePair expected =
new PointValuePair(point(DIM,0.0),0.0);
doTest(new Cigar(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-13, 1e-6, 100, expected);
}
@@ -153,7 +153,7 @@ public class BOBYQAOptimizerTest {
PointValuePair expected =
new PointValuePair(point(DIM,0.0),0.0);
doTest(new CigTab(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-13, 5e-5, 100, expected);
}
@@ -164,18 +164,18 @@ public class BOBYQAOptimizerTest {
PointValuePair expected =
new PointValuePair(point(DIM,0.0),0.0);
doTest(new Sphere(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-13, 1e-6, 100, expected);
}
@Test
public void testTablet() {
- double[] startPoint = point(DIM,1.0);
+ double[] startPoint = point(DIM,1.0);
double[][] boundaries = null;
PointValuePair expected =
new PointValuePair(point(DIM,0.0),0.0);
doTest(new Tablet(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-13, 1e-6, 100, expected);
}
@@ -186,7 +186,7 @@ public class BOBYQAOptimizerTest {
PointValuePair expected =
new PointValuePair(point(DIM/2,0.0),0.0);
doTest(new DiffPow(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-8, 1e-1, 21000, expected);
}
@@ -197,7 +197,7 @@ public class BOBYQAOptimizerTest {
PointValuePair expected =
new PointValuePair(point(DIM/2,0.0),0.0);
doTest(new SsDiffPow(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-2, 1.3e-1, 50000, expected);
}
@@ -220,7 +220,7 @@ public class BOBYQAOptimizerTest {
PointValuePair expected =
new PointValuePair(point(DIM,0.0),0.0);
doTest(new Rastrigin(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-13, 1e-6, 1000, expected);
}
@@ -331,7 +331,7 @@ public class BOBYQAOptimizerTest {
optim.optimize(maxEvaluations, func, goal,
new InitialGuess(startPoint),
new SimpleBounds(lB, uB));
-// System.out.println(func.getClass().getName() + " = "
+// System.out.println(func.getClass().getName() + " = "
// + optim.getEvaluations() + " f(");
// for (double x: result.getPoint()) System.out.print(x + " ");
// System.out.println(") = " + result.getValue());
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optimization/direct/CMAESOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optimization/direct/CMAESOptimizerTest.java b/src/test/java/org/apache/commons/math3/optimization/direct/CMAESOptimizerTest.java
index 29c3eec..2826d31 100644
--- a/src/test/java/org/apache/commons/math3/optimization/direct/CMAESOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math3/optimization/direct/CMAESOptimizerTest.java
@@ -46,7 +46,7 @@ public class CMAESOptimizerTest {
static final int DIM = 13;
static final int LAMBDA = 4 + (int)(3.*FastMath.log(DIM));
-
+
@Test(expected = NumberIsTooLargeException.class)
public void testInitOutofbounds1() {
double[] startPoint = point(DIM,3);
@@ -69,7 +69,7 @@ public class CMAESOptimizerTest {
GoalType.MINIMIZE, LAMBDA, true, 0, 1e-13,
1e-13, 1e-6, 100000, expected);
}
-
+
@Test(expected = DimensionMismatchException.class)
public void testBoundariesDimensionMismatch() {
double[] startPoint = point(DIM,0.5);
@@ -117,7 +117,7 @@ public class CMAESOptimizerTest {
GoalType.MINIMIZE, LAMBDA, true, 0, 1e-13,
1e-13, 1e-6, 100000, expected);
}
-
+
@Test
@Retry(3)
public void testRosen() {
@@ -148,7 +148,7 @@ public class CMAESOptimizerTest {
doTest(new MinusElli(), startPoint, insigma, boundaries,
GoalType.MAXIMIZE, LAMBDA, false, 0, 1.0-1e-13,
2e-10, 5e-6, 100000, expected);
- boundaries = boundaries(DIM,-0.3,0.3);
+ boundaries = boundaries(DIM,-0.3,0.3);
startPoint = point(DIM,0.1);
doTest(new MinusElli(), startPoint, insigma, boundaries,
GoalType.MAXIMIZE, LAMBDA, true, 0, 1.0-1e-13,
@@ -397,7 +397,7 @@ public class CMAESOptimizerTest {
};
final double[] start = { 1 };
-
+
// No bounds.
PointValuePair result = optimizer.optimize(100000, fitnessFunction, GoalType.MINIMIZE,
start);
@@ -426,7 +426,7 @@ public class CMAESOptimizerTest {
Assert.assertEquals(resNoBound, resNearLo, 1e-3);
Assert.assertEquals(resNoBound, resNearHi, 1e-3);
}
-
+
/**
* @param func Function to optimize.
* @param startPoint Starting point.
@@ -449,7 +449,7 @@ public class CMAESOptimizerTest {
GoalType goal,
int lambda,
boolean isActive,
- int diagonalOnly,
+ int diagonalOnly,
double stopValue,
double fTol,
double pointTol,
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optimization/fitting/GaussianFitterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optimization/fitting/GaussianFitterTest.java b/src/test/java/org/apache/commons/math3/optimization/fitting/GaussianFitterTest.java
index ddccdb2..af8acd4 100644
--- a/src/test/java/org/apache/commons/math3/optimization/fitting/GaussianFitterTest.java
+++ b/src/test/java/org/apache/commons/math3/optimization/fitting/GaussianFitterTest.java
@@ -200,7 +200,7 @@ public class GaussianFitterTest {
GaussianFitter fitter = new GaussianFitter(new LevenbergMarquardtOptimizer());
fitter.fit();
}
-
+
/**
* Two points is not enough observed points.
*/
@@ -213,7 +213,7 @@ public class GaussianFitterTest {
fitter);
fitter.fit();
}
-
+
/**
* Poor data: right of peak not symmetric with left of peak.
*/
@@ -226,8 +226,8 @@ public class GaussianFitterTest {
Assert.assertEquals(233003.2967252038, parameters[0], 1e-4);
Assert.assertEquals(-10.654887521095983, parameters[1], 1e-4);
Assert.assertEquals(4.335937353196641, parameters[2], 1e-4);
- }
-
+ }
+
/**
* Poor data: long tails.
*/
@@ -241,7 +241,7 @@ public class GaussianFitterTest {
Assert.assertEquals(-13.29641995105174, parameters[1], 1e-4);
Assert.assertEquals(1.7297330293549908, parameters[2], 1e-4);
}
-
+
/**
* Poor data: right of peak is missing.
*/
@@ -254,7 +254,7 @@ public class GaussianFitterTest {
Assert.assertEquals(285250.66754309234, parameters[0], 1e-4);
Assert.assertEquals(-13.528375695228455, parameters[1], 1e-4);
Assert.assertEquals(1.5204344894331614, parameters[2], 1e-4);
- }
+ }
/**
* Basic with smaller dataset.
@@ -275,7 +275,7 @@ public class GaussianFitterTest {
// The optimizer will try negative sigma values but "GaussianFitter"
// will catch the raised exceptions and return NaN values instead.
- final double[] data = {
+ final double[] data = {
1.1143831578403364E-29,
4.95281403484594E-28,
1.1171347211930288E-26,
@@ -343,7 +343,7 @@ public class GaussianFitterTest {
Assert.assertEquals(0.603770729862231, p[1], 1e-15);
Assert.assertEquals(1.0786447936766612, p[2], 1e-14);
}
-
+
/**
* Adds the specified points to specified <code>GaussianFitter</code>
* instance.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optimization/general/AbstractLeastSquaresOptimizerAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optimization/general/AbstractLeastSquaresOptimizerAbstractTest.java b/src/test/java/org/apache/commons/math3/optimization/general/AbstractLeastSquaresOptimizerAbstractTest.java
index 4dbe17d..de80e44 100644
--- a/src/test/java/org/apache/commons/math3/optimization/general/AbstractLeastSquaresOptimizerAbstractTest.java
+++ b/src/test/java/org/apache/commons/math3/optimization/general/AbstractLeastSquaresOptimizerAbstractTest.java
@@ -514,7 +514,7 @@ public abstract class AbstractLeastSquaresOptimizerAbstractTest {
for (int j = 0; j < factors.getColumnDimension(); ++j) {
value[i] = value[i].add(variables[j].multiply(factors.getEntry(i, j)));
}
-
+
}
return value;
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optimization/general/NonLinearConjugateGradientOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optimization/general/NonLinearConjugateGradientOptimizerTest.java b/src/test/java/org/apache/commons/math3/optimization/general/NonLinearConjugateGradientOptimizerTest.java
index 26091a4..f606b28 100644
--- a/src/test/java/org/apache/commons/math3/optimization/general/NonLinearConjugateGradientOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math3/optimization/general/NonLinearConjugateGradientOptimizerTest.java
@@ -194,7 +194,7 @@ public class NonLinearConjugateGradientOptimizerTest {
new SimpleValueChecker(1e-13, 1e-13),
new BrentSolver(),
preconditioner);
-
+
PointValuePair optimum =
optimizer.optimize(100, problem, GoalType.MINIMIZE, new double[] { 0, 0, 0, 0, 0, 0 });
Assert.assertEquals( 3.0, optimum.getPoint()[0], 1.0e-10);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optimization/linear/SimplexSolverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optimization/linear/SimplexSolverTest.java b/src/test/java/org/apache/commons/math3/optimization/linear/SimplexSolverTest.java
index 110992a..3e5f188 100644
--- a/src/test/java/org/apache/commons/math3/optimization/linear/SimplexSolverTest.java
+++ b/src/test/java/org/apache/commons/math3/optimization/linear/SimplexSolverTest.java
@@ -35,7 +35,7 @@ public class SimplexSolverTest {
public void testMath828() {
LinearObjectiveFunction f = new LinearObjectiveFunction(
new double[] { 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 0.0);
-
+
ArrayList <LinearConstraint>constraints = new ArrayList<LinearConstraint>();
constraints.add(new LinearConstraint(new double[] {0.0, 39.0, 23.0, 96.0, 15.0, 48.0, 9.0, 21.0, 48.0, 36.0, 76.0, 19.0, 88.0, 17.0, 16.0, 36.0,}, Relationship.GEQ, 15.0));
@@ -45,7 +45,7 @@ public class SimplexSolverTest {
constraints.add(new LinearConstraint(new double[] {25.0, -7.0, -99.0, -78.0, -25.0, -14.0, -16.0, -89.0, -39.0, -56.0, -53.0, -9.0, -18.0, -26.0, -11.0, -61.0,}, Relationship.GEQ, 0.0));
constraints.add(new LinearConstraint(new double[] {33.0, -95.0, -15.0, -4.0, -33.0, -3.0, -20.0, -96.0, -27.0, -13.0, -80.0, -24.0, -3.0, -13.0, -57.0, -76.0,}, Relationship.GEQ, 0.0));
constraints.add(new LinearConstraint(new double[] {7.0, -95.0, -39.0, -93.0, -7.0, -94.0, -94.0, -62.0, -76.0, -26.0, -53.0, -57.0, -31.0, -76.0, -53.0, -52.0,}, Relationship.GEQ, 0.0));
-
+
double epsilon = 1e-6;
PointValuePair solution = new SimplexSolver().optimize(f, constraints, GoalType.MINIMIZE, true);
Assert.assertEquals(1.0d, solution.getValue(), epsilon);
@@ -56,7 +56,7 @@ public class SimplexSolverTest {
public void testMath828Cycle() {
LinearObjectiveFunction f = new LinearObjectiveFunction(
new double[] { 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 0.0);
-
+
ArrayList <LinearConstraint>constraints = new ArrayList<LinearConstraint>();
constraints.add(new LinearConstraint(new double[] {0.0, 16.0, 14.0, 69.0, 1.0, 85.0, 52.0, 43.0, 64.0, 97.0, 14.0, 74.0, 89.0, 28.0, 94.0, 58.0, 13.0, 22.0, 21.0, 17.0, 30.0, 25.0, 1.0, 59.0, 91.0, 78.0, 12.0, 74.0, 56.0, 3.0, 88.0,}, Relationship.GEQ, 91.0));
@@ -66,11 +66,11 @@ public class SimplexSolverTest {
constraints.add(new LinearConstraint(new double[] {41.0, -96.0, -41.0, -48.0, -70.0, -43.0, -43.0, -43.0, -97.0, -37.0, -85.0, -70.0, -45.0, -67.0, -87.0, -69.0, -94.0, -54.0, -54.0, -92.0, -79.0, -10.0, -35.0, -20.0, -41.0, -41.0, -65.0, -25.0, -12.0, -8.0, -46.0,}, Relationship.GEQ, 0.0));
constraints.add(new LinearConstraint(new double[] {27.0, -42.0, -65.0, -49.0, -53.0, -42.0, -17.0, -2.0, -61.0, -31.0, -76.0, -47.0, -8.0, -93.0, -86.0, -62.0, -65.0, -63.0, -22.0, -43.0, -27.0, -23.0, -32.0, -74.0, -27.0, -63.0, -47.0, -78.0, -29.0, -95.0, -73.0,}, Relationship.GEQ, 0.0));
constraints.add(new LinearConstraint(new double[] {15.0, -46.0, -41.0, -83.0, -98.0, -99.0, -21.0, -35.0, -7.0, -14.0, -80.0, -63.0, -18.0, -42.0, -5.0, -34.0, -56.0, -70.0, -16.0, -18.0, -74.0, -61.0, -47.0, -41.0, -15.0, -79.0, -18.0, -47.0, -88.0, -68.0, -55.0,}, Relationship.GEQ, 0.0));
-
+
double epsilon = 1e-6;
PointValuePair solution = new SimplexSolver().optimize(f, constraints, GoalType.MINIMIZE, true);
Assert.assertEquals(1.0d, solution.getValue(), epsilon);
- Assert.assertTrue(validSolution(solution, constraints, epsilon));
+ Assert.assertTrue(validSolution(solution, constraints, epsilon));
}
@Test
@@ -148,7 +148,7 @@ public class SimplexSolverTest {
SimplexSolver solver = new SimplexSolver();
PointValuePair solution = solver.optimize(f, constraints, GoalType.MINIMIZE, false);
-
+
Assert.assertTrue(Precision.compareTo(solution.getPoint()[0] * 200.d, 1.d, epsilon) >= 0);
Assert.assertEquals(0.0050, solution.getValue(), epsilon);
}
@@ -171,13 +171,13 @@ public class SimplexSolverTest {
double epsilon = 1e-7;
SimplexSolver simplex = new SimplexSolver();
PointValuePair solution = simplex.optimize(f, constraints, GoalType.MINIMIZE, false);
-
+
Assert.assertTrue(Precision.compareTo(solution.getPoint()[0], -1e-18d, epsilon) >= 0);
- Assert.assertEquals(1.0d, solution.getPoint()[1], epsilon);
+ Assert.assertEquals(1.0d, solution.getPoint()[1], epsilon);
Assert.assertEquals(0.0d, solution.getPoint()[2], epsilon);
Assert.assertEquals(1.0d, solution.getValue(), epsilon);
}
-
+
@Test
public void testMath272() {
LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 2, 2, 1 }, 0);
@@ -612,20 +612,20 @@ public class SimplexSolverTest {
for (int i = 0; i < vals.length; i++) {
result += vals[i] * coeffs[i];
}
-
+
switch (c.getRelationship()) {
case EQ:
if (!Precision.equals(result, c.getValue(), epsilon)) {
return false;
}
break;
-
+
case GEQ:
if (Precision.compareTo(result, c.getValue(), epsilon) < 0) {
return false;
}
break;
-
+
case LEQ:
if (Precision.compareTo(result, c.getValue(), epsilon) > 0) {
return false;
@@ -633,7 +633,7 @@ public class SimplexSolverTest {
break;
}
}
-
+
return true;
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optimization/univariate/BrentOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optimization/univariate/BrentOptimizerTest.java b/src/test/java/org/apache/commons/math3/optimization/univariate/BrentOptimizerTest.java
index 34ee8c7..73054db 100644
--- a/src/test/java/org/apache/commons/math3/optimization/univariate/BrentOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math3/optimization/univariate/BrentOptimizerTest.java
@@ -71,7 +71,7 @@ public final class BrentOptimizerTest {
public void testBoundaries() {
final double lower = -1.0;
final double upper = +1.0;
- UnivariateFunction f = new UnivariateFunction() {
+ UnivariateFunction f = new UnivariateFunction() {
public double value(double x) {
if (x < lower) {
throw new NumberIsTooSmallException(x, lower, true);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optimization/univariate/SimpleUnivariateValueCheckerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optimization/univariate/SimpleUnivariateValueCheckerTest.java b/src/test/java/org/apache/commons/math3/optimization/univariate/SimpleUnivariateValueCheckerTest.java
index 8ad9f66..5964ecc 100644
--- a/src/test/java/org/apache/commons/math3/optimization/univariate/SimpleUnivariateValueCheckerTest.java
+++ b/src/test/java/org/apache/commons/math3/optimization/univariate/SimpleUnivariateValueCheckerTest.java
@@ -31,7 +31,7 @@ public class SimpleUnivariateValueCheckerTest {
public void testIterationCheck() {
final int max = 10;
final SimpleUnivariateValueChecker checker = new SimpleUnivariateValueChecker(1e-1, 1e-2, max);
- Assert.assertTrue(checker.converged(max, null, null));
+ Assert.assertTrue(checker.converged(max, null, null));
Assert.assertTrue(checker.converged(max + 1, null, null));
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optimization/univariate/UnivariateMultiStartOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optimization/univariate/UnivariateMultiStartOptimizerTest.java b/src/test/java/org/apache/commons/math3/optimization/univariate/UnivariateMultiStartOptimizerTest.java
index 18fbdab..55929a0 100644
--- a/src/test/java/org/apache/commons/math3/optimization/univariate/UnivariateMultiStartOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math3/optimization/univariate/UnivariateMultiStartOptimizerTest.java
@@ -88,7 +88,7 @@ public class UnivariateMultiStartOptimizerTest {
g.setSeed(4312000053L);
UnivariateMultiStartOptimizer<UnivariateFunction> optimizer =
new UnivariateMultiStartOptimizer<UnivariateFunction>(underlying, 5, g);
-
+
try {
optimizer.optimize(300, f, GoalType.MINIMIZE, -0.3, -0.2);
Assert.fail();
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/primes/PrimesTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/primes/PrimesTest.java b/src/test/java/org/apache/commons/math3/primes/PrimesTest.java
index 19eef5d..ccc4bf9 100644
--- a/src/test/java/org/apache/commons/math3/primes/PrimesTest.java
+++ b/src/test/java/org/apache/commons/math3/primes/PrimesTest.java
@@ -169,4 +169,4 @@ public class PrimesTest {
Assert.assertEquals(1, factors.size());
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/AbstractRandomGeneratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/AbstractRandomGeneratorTest.java b/src/test/java/org/apache/commons/math3/random/AbstractRandomGeneratorTest.java
index 1f3d2b0..7fd2ac9 100644
--- a/src/test/java/org/apache/commons/math3/random/AbstractRandomGeneratorTest.java
+++ b/src/test/java/org/apache/commons/math3/random/AbstractRandomGeneratorTest.java
@@ -26,12 +26,12 @@ public class AbstractRandomGeneratorTest extends RandomGeneratorAbstractTest {
public AbstractRandomGeneratorTest() {
super();
}
-
+
@Override
protected RandomGenerator makeGenerator() {
RandomGenerator generator = new TestRandomGenerator();
generator.setSeed(1001);
return generator;
}
-
+
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/BitsStreamGeneratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/BitsStreamGeneratorTest.java b/src/test/java/org/apache/commons/math3/random/BitsStreamGeneratorTest.java
index da4bc94..6bb0f59 100644
--- a/src/test/java/org/apache/commons/math3/random/BitsStreamGeneratorTest.java
+++ b/src/test/java/org/apache/commons/math3/random/BitsStreamGeneratorTest.java
@@ -28,14 +28,14 @@ public class BitsStreamGeneratorTest extends RandomGeneratorAbstractTest {
public BitsStreamGeneratorTest() {
super();
}
-
+
@Override
protected RandomGenerator makeGenerator() {
RandomGenerator generator = new TestBitStreamGenerator();
generator.setSeed(1000);
return generator;
}
-
+
/**
* Test BitStreamGenerator using a Random as bit source.
*/
@@ -43,7 +43,7 @@ public class BitsStreamGeneratorTest extends RandomGeneratorAbstractTest {
private static final long serialVersionUID = 1L;
private BitRandom ran = new BitRandom();
-
+
@Override
public void setSeed(int seed) {
ran.setSeed(seed);
@@ -58,15 +58,15 @@ public class BitsStreamGeneratorTest extends RandomGeneratorAbstractTest {
@Override
public void setSeed(long seed) {
ran.setSeed((int) seed);
-
+
}
-
+
@Override
protected int next(int bits) {
return ran.nextBits(bits);
- }
+ }
}
-
+
/**
* Extend Random to expose next(bits)
*/
@@ -79,5 +79,5 @@ public class BitsStreamGeneratorTest extends RandomGeneratorAbstractTest {
return next(bits);
}
}
-
+
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/CorrelatedRandomVectorGeneratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/CorrelatedRandomVectorGeneratorTest.java b/src/test/java/org/apache/commons/math3/random/CorrelatedRandomVectorGeneratorTest.java
index f4d5882..3a3fa60 100644
--- a/src/test/java/org/apache/commons/math3/random/CorrelatedRandomVectorGeneratorTest.java
+++ b/src/test/java/org/apache/commons/math3/random/CorrelatedRandomVectorGeneratorTest.java
@@ -147,7 +147,7 @@ public class CorrelatedRandomVectorGeneratorTest {
{0.009881156, 0.008196856, 0.019023866, 0.009210099},
{0.010499559, 0.010732709, 0.009210099, 0.019107243}
};
-
+
final double[][] covMatrix2 = new double[][]{
{0.0, 0.0, 0.0, 0.0, 0.0},
{0.0, 0.013445532, 0.010394690, 0.009881156, 0.010499559},
@@ -155,7 +155,7 @@ public class CorrelatedRandomVectorGeneratorTest {
{0.0, 0.009881156, 0.008196856, 0.019023866, 0.009210099},
{0.0, 0.010499559, 0.010732709, 0.009210099, 0.019107243}
};
-
+
final double[][] covMatrix3 = new double[][]{
{0.013445532, 0.010394690, 0.0, 0.009881156, 0.010499559},
{0.010394690, 0.023006616, 0.0, 0.008196856, 0.010732709},
@@ -163,7 +163,7 @@ public class CorrelatedRandomVectorGeneratorTest {
{0.009881156, 0.008196856, 0.0, 0.019023866, 0.009210099},
{0.010499559, 0.010732709, 0.0, 0.009210099, 0.019107243}
};
-
+
testSampler(covMatrix1, 10000, 0.001);
testSampler(covMatrix2, 10000, 0.001);
testSampler(covMatrix3, 10000, 0.001);
@@ -182,7 +182,7 @@ public class CorrelatedRandomVectorGeneratorTest {
private void testSampler(final double[][] covMatrix, int samples, double epsilon) {
CorrelatedRandomVectorGenerator sampler = createSampler(covMatrix);
-
+
StorelessCovariance cov = new StorelessCovariance(covMatrix.length);
for (int i = 0; i < samples; ++i) {
cov.increment(sampler.nextVector());
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/EmpiricalDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/EmpiricalDistributionTest.java b/src/test/java/org/apache/commons/math3/random/EmpiricalDistributionTest.java
index 71763e1..c0dd2a4 100644
--- a/src/test/java/org/apache/commons/math3/random/EmpiricalDistributionTest.java
+++ b/src/test/java/org/apache/commons/math3/random/EmpiricalDistributionTest.java
@@ -103,13 +103,13 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
// Load from a URL
empiricalDistribution.load(url);
checkDistribution();
-
+
// Load again from a file (also verifies idempotency of load)
File file = new File(url.toURI());
empiricalDistribution.load(file);
checkDistribution();
}
-
+
private void checkDistribution() {
// testData File has 10000 values, with mean ~ 5.0, std dev ~ 1
// Make sure that loaded distribution matches this
@@ -245,24 +245,24 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
TestUtils.assertEquals(expectedBinUpperBounds, dist.getUpperBounds(), tol);
TestUtils.assertEquals(expectedGeneratorUpperBounds, dist.getGeneratorUpperBounds(), tol);
}
-
+
@Test
public void testGeneratorConfig() {
double[] testData = {0, 1, 2, 3, 4};
RandomGenerator generator = new RandomAdaptorTest.ConstantGenerator(0.5);
-
+
EmpiricalDistribution dist = new EmpiricalDistribution(5, generator);
dist.load(testData);
for (int i = 0; i < 5; i++) {
Assert.assertEquals(2.0, dist.getNextValue(), 0d);
}
-
+
// Verify no NPE with null generator argument
dist = new EmpiricalDistribution(5, (RandomGenerator) null);
dist.load(testData);
dist.getNextValue();
}
-
+
@Test
public void testReSeed() throws Exception {
empiricalDistribution.load(url);
@@ -310,9 +310,9 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
Assert.assertEquals("mean", 5.069831575018909, stats.getMean(), tolerance);
Assert.assertEquals("std dev", 1.0173699343977738, stats.getStandardDeviation(), tolerance);
}
-
+
// Setup for distribution tests
-
+
@Override
public RealDistribution makeDistribution() {
// Create a uniform distribution on [0, 10,000]
@@ -324,10 +324,10 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
dist.load(sourceData);
return dist;
}
-
+
/** Uniform bin mass = 10/10001 == mass of all but the first bin */
private final double binMass = 10d / (n + 1);
-
+
/** Mass of first bin = 11/10001 */
private final double firstBinMass = 11d / (n + 1);
@@ -336,11 +336,11 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
final double[] testPoints = new double[] {9, 10, 15, 1000, 5004, 9999};
return testPoints;
}
-
+
@Override
public double[] makeCumulativeTestValues() {
- /*
+ /*
* Bins should be [0, 10], (10, 20], ..., (9990, 10000]
* Kernels should be N(4.5, 3.02765), N(14.5, 3.02765)...
* Each bin should have mass 10/10000 = .001
@@ -379,12 +379,12 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
final RealDistribution kernel = findKernel(lower, upper);
final double withinBinKernelMass = kernel.cumulativeProbability(lower, upper);
final double density = kernel.density(testPoints[i]);
- densityValues[i] = density * (bin == 0 ? firstBinMass : binMass) / withinBinKernelMass;
+ densityValues[i] = density * (bin == 0 ? firstBinMass : binMass) / withinBinKernelMass;
}
return densityValues;
}
-
- /**
+
+ /**
* Modify test integration bounds from the default. Because the distribution
* has discontinuities at bin boundaries, integrals spanning multiple bins
* will face convergence problems. Only test within-bin integrals and spans
@@ -406,15 +406,15 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
final double[] upper = {5, 12, 1030, 5010, 10000};
for (int i = 1; i < 5; i++) {
Assert.assertEquals(
- distribution.cumulativeProbability(
+ distribution.cumulativeProbability(
lower[i], upper[i]),
integrator.integrate(
1000000, // Triangle integrals are very slow to converge
d, lower[i], upper[i]), tol);
}
}
-
- /**
+
+ /**
* MATH-984
* Verify that sampled values do not go outside of the range of the data.
*/
@@ -438,7 +438,7 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
Assert.assertTrue(dev > 0);
}
}
-
+
/**
* MATH-1203, MATH-1208
*/
@@ -456,8 +456,8 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
Assert.assertEquals(1.0, dist.cumulativeProbability(1), Double.MIN_VALUE);
Assert.assertEquals(0.5, dist.cumulativeProbability(0.5), Double.MIN_VALUE);
Assert.assertEquals(0.5, dist.cumulativeProbability(0.7), Double.MIN_VALUE);
- }
-
+ }
+
/**
* Find the bin that x belongs (relative to {@link #makeDistribution()}).
*/
@@ -468,7 +468,7 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
// If x falls on a bin boundary, it is in the lower bin
return FastMath.floor(x / 10) == x / 10 ? bin - 1 : bin;
}
-
+
/**
* Find the within-bin kernel for the bin with lower bound lower
* and upper bound upper. All bins other than the first contain 10 points
@@ -480,10 +480,10 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
if (lower < 1) {
return new NormalDistribution(5d, 3.3166247903554);
} else {
- return new NormalDistribution((upper + lower + 1) / 2d, 3.0276503540974917);
+ return new NormalDistribution((upper + lower + 1) / 2d, 3.0276503540974917);
}
}
-
+
@Test
public void testKernelOverrideConstant() {
final EmpiricalDistribution dist = new ConstantKernelEmpiricalDistribution(5);
@@ -509,7 +509,7 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
Assert.assertEquals(8.0, dist.inverseCumulativeProbability(0.5), tol);
Assert.assertEquals(8.0, dist.inverseCumulativeProbability(0.6), tol);
}
-
+
@Test
public void testKernelOverrideUniform() {
final EmpiricalDistribution dist = new UniformKernelEmpiricalDistribution(5);
@@ -517,14 +517,14 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
dist.load(data);
// Kernels are uniform distributions on [1,3], [4,6], [7,9], [10,12], [13,15]
final double bounds[] = {3d, 6d, 9d, 12d};
- final double tol = 10E-12;
+ final double tol = 10E-12;
for (int i = 0; i < 20; i++) {
final double v = dist.sample();
// Make sure v is not in the excluded range between bins - that is (bounds[i], bounds[i] + 1)
for (int j = 0; j < bounds.length; j++) {
Assert.assertFalse(v > bounds[j] + tol && v < bounds[j] + 1 - tol);
}
- }
+ }
Assert.assertEquals(0.0, dist.cumulativeProbability(1), tol);
Assert.assertEquals(0.1, dist.cumulativeProbability(2), tol);
Assert.assertEquals(0.6, dist.cumulativeProbability(10), tol);
@@ -539,8 +539,8 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
Assert.assertEquals(8.0, dist.inverseCumulativeProbability(0.5), tol);
Assert.assertEquals(9.0, dist.inverseCumulativeProbability(0.6), tol);
}
-
-
+
+
/**
* Empirical distribution using a constant smoothing kernel.
*/
@@ -555,7 +555,7 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
return new ConstantRealDistribution(bStats.getMean());
}
}
-
+
/**
* Empirical distribution using a uniform smoothing kernel.
*/
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/HaltonSequenceGeneratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/HaltonSequenceGeneratorTest.java b/src/test/java/org/apache/commons/math3/random/HaltonSequenceGeneratorTest.java
index bbe8187..e64eed5 100644
--- a/src/test/java/org/apache/commons/math3/random/HaltonSequenceGeneratorTest.java
+++ b/src/test/java/org/apache/commons/math3/random/HaltonSequenceGeneratorTest.java
@@ -86,7 +86,7 @@ public class HaltonSequenceGeneratorTest {
} catch (OutOfRangeException e) {
// expected
}
-
+
try {
new HaltonSequenceGenerator(41);
Assert.fail("an exception should have been thrown");
@@ -124,7 +124,7 @@ public class HaltonSequenceGeneratorTest {
double[] result = generator.skipTo(5);
Assert.assertArrayEquals(referenceValues[5], result, 1e-3);
Assert.assertEquals(6, generator.getNextIndex());
-
+
for (int i = 6; i < referenceValues.length; i++) {
result = generator.nextVector();
Assert.assertArrayEquals(referenceValues[i], result, 1e-3);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/MersenneTwisterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/MersenneTwisterTest.java b/src/test/java/org/apache/commons/math3/random/MersenneTwisterTest.java
index 3a72e11..4e3e2c9 100644
--- a/src/test/java/org/apache/commons/math3/random/MersenneTwisterTest.java
+++ b/src/test/java/org/apache/commons/math3/random/MersenneTwisterTest.java
@@ -25,10 +25,10 @@ public class MersenneTwisterTest extends RandomGeneratorAbstractTest {
protected RandomGenerator makeGenerator() {
return new MersenneTwister(111);
}
-
+
// TODO: Some of the tests moved up to RandomGeneratorAbstractTest tested alternative seeding / constructors
// Tests exercising these features directly should be added to this class.
-
+
@Test
public void testMakotoNishimura() {
MersenneTwister mt = new MersenneTwister(new int[] {0x123, 0x234, 0x345, 0x456});
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/RandomAdaptorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/RandomAdaptorTest.java b/src/test/java/org/apache/commons/math3/random/RandomAdaptorTest.java
index 02109ef..289ccf1 100644
--- a/src/test/java/org/apache/commons/math3/random/RandomAdaptorTest.java
+++ b/src/test/java/org/apache/commons/math3/random/RandomAdaptorTest.java
@@ -58,13 +58,13 @@ public class RandomAdaptorTest {
*
*/
public static class ConstantGenerator implements RandomGenerator {
-
+
private final double value;
-
+
public ConstantGenerator() {
value = 0;
}
-
+
public ConstantGenerator(double value) {
this.value = value;
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/RandomGeneratorAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/RandomGeneratorAbstractTest.java b/src/test/java/org/apache/commons/math3/random/RandomGeneratorAbstractTest.java
index 0094553..0c492b1 100644
--- a/src/test/java/org/apache/commons/math3/random/RandomGeneratorAbstractTest.java
+++ b/src/test/java/org/apache/commons/math3/random/RandomGeneratorAbstractTest.java
@@ -66,7 +66,7 @@ public abstract class RandomGeneratorAbstractTest extends RandomDataGeneratorTes
public void setUp() {
generator = makeGenerator();
}
-
+
// Omit secureXxx tests, since they do not use the provided generator
@Override
public void testNextSecureLongIAE() {}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/SobolSequenceGeneratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/SobolSequenceGeneratorTest.java b/src/test/java/org/apache/commons/math3/random/SobolSequenceGeneratorTest.java
index c09d09b..73f13f0 100644
--- a/src/test/java/org/apache/commons/math3/random/SobolSequenceGeneratorTest.java
+++ b/src/test/java/org/apache/commons/math3/random/SobolSequenceGeneratorTest.java
@@ -54,7 +54,7 @@ public class SobolSequenceGeneratorTest {
Assert.assertEquals(i + 1, generator.getNextIndex());
}
}
-
+
@Test
public void testConstructor() {
try {
@@ -63,7 +63,7 @@ public class SobolSequenceGeneratorTest {
} catch (OutOfRangeException e) {
// expected
}
-
+
try {
new SobolSequenceGenerator(1001);
Assert.fail("an exception should have been thrown");
@@ -82,7 +82,7 @@ public class SobolSequenceGeneratorTest {
} catch (OutOfRangeException e) {
// expected
}
-
+
try {
new SobolSequenceGenerator(1001);
Assert.fail("an exception should have been thrown");
@@ -96,7 +96,7 @@ public class SobolSequenceGeneratorTest {
double[] result = generator.skipTo(5);
Assert.assertArrayEquals(referenceValues[5], result, 1e-6);
Assert.assertEquals(6, generator.getNextIndex());
-
+
for (int i = 6; i < referenceValues.length; i++) {
result = generator.nextVector();
Assert.assertArrayEquals(referenceValues[i], result, 1e-6);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/StableRandomGeneratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/StableRandomGeneratorTest.java b/src/test/java/org/apache/commons/math3/random/StableRandomGeneratorTest.java
index 5531ceb..8d75105 100644
--- a/src/test/java/org/apache/commons/math3/random/StableRandomGeneratorTest.java
+++ b/src/test/java/org/apache/commons/math3/random/StableRandomGeneratorTest.java
@@ -25,7 +25,7 @@ import org.junit.Test;
/**
* The class <code>StableRandomGeneratorTest</code> contains tests for the class
* {@link StableRandomGenerator}
- *
+ *
*/
public class StableRandomGeneratorTest {
@@ -35,7 +35,7 @@ public class StableRandomGeneratorTest {
/**
* Run the double nextDouble() method test Due to leptokurtic property the
* acceptance range is widened.
- *
+ *
* TODO: verify that tolerance this wide is really OK
*/
@Test
@@ -128,4 +128,4 @@ public class StableRandomGeneratorTest {
Assert.assertEquals(2.0, e.getArgument());
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/UnitSphereRandomVectorGeneratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/UnitSphereRandomVectorGeneratorTest.java b/src/test/java/org/apache/commons/math3/random/UnitSphereRandomVectorGeneratorTest.java
index 4676a82..b1727b2 100644
--- a/src/test/java/org/apache/commons/math3/random/UnitSphereRandomVectorGeneratorTest.java
+++ b/src/test/java/org/apache/commons/math3/random/UnitSphereRandomVectorGeneratorTest.java
@@ -27,7 +27,7 @@ public class UnitSphereRandomVectorGeneratorTest {
*/
@Test
public void test2DDistribution() {
-
+
RandomGenerator rg = new JDKRandomGenerator();
rg.setSeed(17399225432l);
UnitSphereRandomVectorGenerator generator = new UnitSphereRandomVectorGenerator(2, rg);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/ValueServerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/ValueServerTest.java b/src/test/java/org/apache/commons/math3/random/ValueServerTest.java
index 145b9b8..5fa29a2 100644
--- a/src/test/java/org/apache/commons/math3/random/ValueServerTest.java
+++ b/src/test/java/org/apache/commons/math3/random/ValueServerTest.java
@@ -76,12 +76,12 @@ public final class ValueServerTest {
Assert.assertEquals("std dev", 1.0173699343977738, stats.getStandardDeviation(),
tolerance);
}
-
+
/**
* Verify that when provided with fixed seeds, stochastic modes
* generate fixed sequences. Verifies the fix for MATH-654.
*/
- @Test
+ @Test
public void testFixedSeed() throws Exception {
ValueServer valueServer = new ValueServer();
URL url = getClass().getResource("testData.txt");
@@ -92,7 +92,7 @@ public final class ValueServerTest {
checkFixedSeed(valueServer, ValueServer.GAUSSIAN_MODE);
checkFixedSeed(valueServer, ValueServer.UNIFORM_MODE);
}
-
+
/**
* Do the check for {@link #testFixedSeed()}
* @param mode ValueServer mode
@@ -108,7 +108,7 @@ public final class ValueServerTest {
for (int i = 0; i < 100; i++) {
values[1][i] = valueServer.getNext();
}
- Assert.assertTrue(Arrays.equals(values[0], values[1]));
+ Assert.assertTrue(Arrays.equals(values[0], values[1]));
}
/**
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/Well19937aTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/Well19937aTest.java b/src/test/java/org/apache/commons/math3/random/Well19937aTest.java
index ff9fe95..7db3428 100644
--- a/src/test/java/org/apache/commons/math3/random/Well19937aTest.java
+++ b/src/test/java/org/apache/commons/math3/random/Well19937aTest.java
@@ -20,7 +20,7 @@ import org.junit.Assert;
import org.junit.Test;
public class Well19937aTest extends RandomGeneratorAbstractTest {
-
+
@Override
public RandomGenerator makeGenerator() {
return new Well19937a(100);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/Well19937cTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/Well19937cTest.java b/src/test/java/org/apache/commons/math3/random/Well19937cTest.java
index a9f7a8e..1b0bf3f 100644
--- a/src/test/java/org/apache/commons/math3/random/Well19937cTest.java
+++ b/src/test/java/org/apache/commons/math3/random/Well19937cTest.java
@@ -20,7 +20,7 @@ import org.junit.Assert;
import org.junit.Test;
public class Well19937cTest extends RandomGeneratorAbstractTest {
-
+
@Override
public RandomGenerator makeGenerator() {
return new Well19937c(100);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/Well44497aTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/Well44497aTest.java b/src/test/java/org/apache/commons/math3/random/Well44497aTest.java
index ac46eb7..78500a6 100644
--- a/src/test/java/org/apache/commons/math3/random/Well44497aTest.java
+++ b/src/test/java/org/apache/commons/math3/random/Well44497aTest.java
@@ -20,12 +20,12 @@ import org.junit.Assert;
import org.junit.Test;
public class Well44497aTest extends RandomGeneratorAbstractTest {
-
+
@Override
public RandomGenerator makeGenerator() {
return new Well44497a(100);
}
-
+
@Test
public void testReferenceCode() {
int[] base = {
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/Well44497bTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/Well44497bTest.java b/src/test/java/org/apache/commons/math3/random/Well44497bTest.java
index 23be971..a3748bd 100644
--- a/src/test/java/org/apache/commons/math3/random/Well44497bTest.java
+++ b/src/test/java/org/apache/commons/math3/random/Well44497bTest.java
@@ -20,12 +20,12 @@ import org.junit.Assert;
import org.junit.Test;
public class Well44497bTest extends RandomGeneratorAbstractTest {
-
+
@Override
public RandomGenerator makeGenerator() {
return new Well44497b(100);
}
-
+
@Test
public void testReferenceCode() {
int[] base = {
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/Well512aTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/Well512aTest.java b/src/test/java/org/apache/commons/math3/random/Well512aTest.java
index 01cfe75..f88938a 100644
--- a/src/test/java/org/apache/commons/math3/random/Well512aTest.java
+++ b/src/test/java/org/apache/commons/math3/random/Well512aTest.java
@@ -20,7 +20,7 @@ import org.junit.Assert;
import org.junit.Test;
public class Well512aTest extends RandomGeneratorAbstractTest {
-
+
@Override
public RandomGenerator makeGenerator() {
return new Well512a(101);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/special/BesselJTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/special/BesselJTest.java b/src/test/java/org/apache/commons/math3/special/BesselJTest.java
index 7477bf4..83ec982 100644
--- a/src/test/java/org/apache/commons/math3/special/BesselJTest.java
+++ b/src/test/java/org/apache/commons/math3/special/BesselJTest.java
@@ -35,7 +35,7 @@ public class BesselJTest {
* near.eight = 8 + seq(-.5,.5,.1)
* largexs = c(10,30,100,300,1000)
* xs = unique(sort(c(smallxs, medxs, near.eight,largexs)))
- *
+ *
* for (n in c(0:15, 30, 100)) {
* for (x in xs) {
* val = format( besselJ(x,n), digits=20 )
@@ -763,12 +763,12 @@ public class BesselJTest {
Assert.assertEquals(msg, expected, actual, tol);
}
}
-
+
@Test(expected=MathIllegalArgumentException.class)
public void testIAEBadOrder() {
BesselJ.value(-1, 1);
}
-
+
@Test(expected=MathIllegalArgumentException.class)
public void testIAEBadArgument() {
BesselJ.value(1, 100000);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/special/ErfTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/special/ErfTest.java b/src/test/java/org/apache/commons/math3/special/ErfTest.java
index 3e26662..6a1b86d 100644
--- a/src/test/java/org/apache/commons/math3/special/ErfTest.java
+++ b/src/test/java/org/apache/commons/math3/special/ErfTest.java
@@ -89,7 +89,7 @@ public class ErfTest {
Assert.assertEquals(expected, actual, 1.0e-5);
Assert.assertEquals(1 - expected, Erf.erfc(-x), 1.0e-5);
}
-
+
/**
* MATH-301, MATH-456
*/
@@ -107,14 +107,14 @@ public class ErfTest {
Assert.assertTrue(result >= 0 && result < 1);
result = Erf.erfc(-i);
Assert.assertFalse(Double.isNaN(result));
- Assert.assertTrue(result >= 1 && result <= 2);
+ Assert.assertTrue(result >= 1 && result <= 2);
}
Assert.assertEquals(-1, Erf.erf(Double.NEGATIVE_INFINITY), 0);
Assert.assertEquals(1, Erf.erf(Double.POSITIVE_INFINITY), 0);
Assert.assertEquals(2, Erf.erfc(Double.NEGATIVE_INFINITY), 0);
Assert.assertEquals(0, Erf.erfc(Double.POSITIVE_INFINITY), 0);
}
-
+
/**
* Compare Erf.erf against reference values computed using GCC 4.2.1 (Apple OSX packaged version)
* erfl (extended precision erf).
@@ -122,15 +122,15 @@ public class ErfTest {
@Test
public void testErfGnu() {
final double tol = 1E-15;
- final double[] gnuValues = new double[] {-1, -1, -1, -1, -1,
- -1, -1, -1, -0.99999999999999997848,
- -0.99999999999999264217, -0.99999999999846254017, -0.99999999980338395581, -0.99999998458274209971,
- -0.9999992569016276586, -0.99997790950300141459, -0.99959304798255504108, -0.99532226501895273415,
- -0.96610514647531072711, -0.84270079294971486948, -0.52049987781304653809, 0,
- 0.52049987781304653809, 0.84270079294971486948, 0.96610514647531072711, 0.99532226501895273415,
- 0.99959304798255504108, 0.99997790950300141459, 0.9999992569016276586, 0.99999998458274209971,
- 0.99999999980338395581, 0.99999999999846254017, 0.99999999999999264217, 0.99999999999999997848,
- 1, 1, 1, 1,
+ final double[] gnuValues = new double[] {-1, -1, -1, -1, -1,
+ -1, -1, -1, -0.99999999999999997848,
+ -0.99999999999999264217, -0.99999999999846254017, -0.99999999980338395581, -0.99999998458274209971,
+ -0.9999992569016276586, -0.99997790950300141459, -0.99959304798255504108, -0.99532226501895273415,
+ -0.96610514647531072711, -0.84270079294971486948, -0.52049987781304653809, 0,
+ 0.52049987781304653809, 0.84270079294971486948, 0.96610514647531072711, 0.99532226501895273415,
+ 0.99959304798255504108, 0.99997790950300141459, 0.9999992569016276586, 0.99999998458274209971,
+ 0.99999999980338395581, 0.99999999999846254017, 0.99999999999999264217, 0.99999999999999997848,
+ 1, 1, 1, 1,
1, 1, 1, 1};
double x = -10d;
for (int i = 0; i < 41; i++) {
@@ -138,7 +138,7 @@ public class ErfTest {
x += 0.5d;
}
}
-
+
/**
* Compare Erf.erfc against reference values computed using GCC 4.2.1 (Apple OSX packaged version)
* erfcl (extended precision erfc).
@@ -146,15 +146,15 @@ public class ErfTest {
@Test
public void testErfcGnu() {
final double tol = 1E-15;
- final double[] gnuValues = new double[] { 2, 2, 2, 2, 2,
- 2, 2, 2, 1.9999999999999999785,
- 1.9999999999999926422, 1.9999999999984625402, 1.9999999998033839558, 1.9999999845827420998,
- 1.9999992569016276586, 1.9999779095030014146, 1.9995930479825550411, 1.9953222650189527342,
- 1.9661051464753107271, 1.8427007929497148695, 1.5204998778130465381, 1,
- 0.47950012218695346194, 0.15729920705028513051, 0.033894853524689272893, 0.0046777349810472658333,
- 0.00040695201744495893941, 2.2090496998585441366E-05, 7.4309837234141274516E-07, 1.5417257900280018858E-08,
- 1.966160441542887477E-10, 1.5374597944280348501E-12, 7.3578479179743980661E-15, 2.1519736712498913103E-17,
- 3.8421483271206474691E-20, 4.1838256077794144006E-23, 2.7766493860305691016E-26, 1.1224297172982927079E-29,
+ final double[] gnuValues = new double[] { 2, 2, 2, 2, 2,
+ 2, 2, 2, 1.9999999999999999785,
+ 1.9999999999999926422, 1.9999999999984625402, 1.9999999998033839558, 1.9999999845827420998,
+ 1.9999992569016276586, 1.9999779095030014146, 1.9995930479825550411, 1.9953222650189527342,
+ 1.9661051464753107271, 1.8427007929497148695, 1.5204998778130465381, 1,
+ 0.47950012218695346194, 0.15729920705028513051, 0.033894853524689272893, 0.0046777349810472658333,
+ 0.00040695201744495893941, 2.2090496998585441366E-05, 7.4309837234141274516E-07, 1.5417257900280018858E-08,
+ 1.966160441542887477E-10, 1.5374597944280348501E-12, 7.3578479179743980661E-15, 2.1519736712498913103E-17,
+ 3.8421483271206474691E-20, 4.1838256077794144006E-23, 2.7766493860305691016E-26, 1.1224297172982927079E-29,
2.7623240713337714448E-33, 4.1370317465138102353E-37, 3.7692144856548799402E-41, 2.0884875837625447567E-45};
double x = -10d;
for (int i = 0; i < 41; i++) {
@@ -162,9 +162,9 @@ public class ErfTest {
x += 0.5d;
}
}
-
+
/**
- * Tests erfc against reference data computed using Maple reported in Marsaglia, G,,
+ * Tests erfc against reference data computed using Maple reported in Marsaglia, G,,
* "Evaluating the Normal Distribution," Journal of Statistical Software, July, 2004.
* http//www.jstatsoft.org/v11/a05/paper
*/
@@ -176,13 +176,13 @@ public class ErfTest {
{2.3, 1.07241100216758e-02},
{3.4, 3.36929265676881e-04},
{4.5, 3.39767312473006e-06},
- {5.6, 1.07175902583109e-08},
+ {5.6, 1.07175902583109e-08},
{6.7, 1.04209769879652e-11},
{7.8, 3.09535877195870e-15},
{8.9, 2.79233437493966e-19},
{10.0, 7.61985302416053e-24},
{11.1, 6.27219439321703e-29},
- {12.2, 1.55411978638959e-34},
+ {12.2, 1.55411978638959e-34},
{13.3, 1.15734162836904e-40},
{14.4, 2.58717592540226e-47},
{15.5, 1.73446079179387e-54},
@@ -194,7 +194,7 @@ public class ErfTest {
TestUtils.assertRelativelyEquals(ref[i][1], result, 1E-13);
}
}
-
+
/**
* Test the implementation of Erf.erf(double, double) for consistency with results
* obtained from Erf.erf(double) and Erf.erfc(double).