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:51 UTC
[1/4] [math] Removed trailing spaces. No code change.
Repository: commons-math
Updated Branches:
refs/heads/MATH_3_X 654d7232e -> ff35e6f27
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/FrequencyTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/FrequencyTest.java b/src/test/java/org/apache/commons/math3/stat/FrequencyTest.java
index 6e4b56d..e2e73a8 100644
--- a/src/test/java/org/apache/commons/math3/stat/FrequencyTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/FrequencyTest.java
@@ -254,7 +254,7 @@ public final class FrequencyTest {
Assert.assertEquals("Integer 1 cumPct", 0.5, f.getCumPct(1), TOLERANCE);
Assert.assertEquals("Integer 1 cumPct", 0.5, f.getCumPct(Long.valueOf(1)), TOLERANCE);
Assert.assertEquals("Integer 1 cumPct", 0.5, f.getCumPct(Integer.valueOf(1)), TOLERANCE);
-
+
f.incrementValue(ONE, -2);
f.incrementValue(THREE, 5);
@@ -264,7 +264,7 @@ public final class FrequencyTest {
Iterator<?> it = f.valuesIterator();
while (it.hasNext()) {
Assert.assertTrue(it.next() instanceof Long);
- }
+ }
}
@Test
@@ -275,7 +275,7 @@ public final class FrequencyTest {
f.addValue(TWO);
Assert.assertEquals(f, TestUtils.serializeAndRecover(f));
}
-
+
@Test
public void testGetUniqueCount() {
Assert.assertEquals(0, f.getUniqueCount());
@@ -286,7 +286,7 @@ public final class FrequencyTest {
f.addValue(TWO);
Assert.assertEquals(2, f.getUniqueCount());
}
-
+
@Test
public void testIncrement() {
Assert.assertEquals(0, f.getUniqueCount());
@@ -295,10 +295,10 @@ public final class FrequencyTest {
f.incrementValue(ONE_LONG, 4);
Assert.assertEquals(5, f.getCount(ONE_LONG));
-
+
f.incrementValue(ONE_LONG, -5);
Assert.assertEquals(0, f.getCount(ONE_LONG));
-
+
try {
f.incrementValue(CHAR_A, 1);
Assert.fail("Expecting IllegalArgumentException");
@@ -308,7 +308,7 @@ public final class FrequencyTest {
f = new Frequency();
f.incrementValue(CHAR_A, 2);
-
+
Assert.assertEquals(2, f.getCount(CHAR_A));
try {
@@ -317,12 +317,12 @@ public final class FrequencyTest {
} catch (IllegalArgumentException ex) {
// expected
}
-
+
f.incrementValue(CHAR_A, 3);
Assert.assertEquals(5, f.getCount(CHAR_A));
}
-
+
@Test
public void testMerge() {
Assert.assertEquals(0, f.getUniqueCount());
@@ -330,7 +330,7 @@ public final class FrequencyTest {
f.addValue(TWO_LONG);
f.addValue(ONE);
f.addValue(TWO);
-
+
Assert.assertEquals(2, f.getUniqueCount());
Assert.assertEquals(2, f.getCount(ONE));
Assert.assertEquals(2, f.getCount(TWO));
@@ -345,18 +345,18 @@ public final class FrequencyTest {
Assert.assertEquals(2, g.getCount(THREE));
f.merge(g);
-
+
Assert.assertEquals(3, f.getUniqueCount());
Assert.assertEquals(3, f.getCount(ONE));
Assert.assertEquals(2, f.getCount(TWO));
- Assert.assertEquals(2, f.getCount(THREE));
+ Assert.assertEquals(2, f.getCount(THREE));
}
-
+
@Test
public void testMergeCollection() {
Assert.assertEquals(0, f.getUniqueCount());
f.addValue(ONE_LONG);
-
+
Assert.assertEquals(1, f.getUniqueCount());
Assert.assertEquals(1, f.getCount(ONE));
Assert.assertEquals(0, f.getCount(TWO));
@@ -366,18 +366,18 @@ public final class FrequencyTest {
Frequency h = new Frequency();
h.addValue(THREE_LONG);
-
+
List<Frequency> coll = new ArrayList<Frequency>();
coll.add(g);
coll.add(h);
f.merge(coll);
-
+
Assert.assertEquals(3, f.getUniqueCount());
Assert.assertEquals(1, f.getCount(ONE));
Assert.assertEquals(1, f.getCount(TWO));
- Assert.assertEquals(1, f.getCount(THREE));
+ Assert.assertEquals(1, f.getCount(THREE));
}
-
+
@Test
public void testMode() {
List<Comparable<?>> mode;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/StatUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/StatUtilsTest.java b/src/test/java/org/apache/commons/math3/stat/StatUtilsTest.java
index dccb7b6..1a76482 100644
--- a/src/test/java/org/apache/commons/math3/stat/StatUtilsTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/StatUtilsTest.java
@@ -269,7 +269,7 @@ public final class StatUtilsTest {
x = new double[] {ONE, TWO, TWO, THREE};
TestUtils.assertEquals(0.5, StatUtils.variance(x,2.5, 2, 2), TOLERANCE);
}
-
+
@Test
public void testPopulationVariance() {
double[] x = null;
@@ -461,10 +461,10 @@ public final class StatUtilsTest {
Assert.assertEquals(FastMath.exp(0.5 * StatUtils.sumLog(test, 0, 2)),
StatUtils.geometricMean(test, 0, 2), Double.MIN_VALUE);
}
-
-
+
+
/**
- * Run the test with the values 50 and 100 and assume standardized values
+ * Run the test with the values 50 and 100 and assume standardized values
*/
@Test
@@ -485,7 +485,7 @@ public final class StatUtilsTest {
@Test
public void testNormalize2() {
- // create an sample with 77 values
+ // create an sample with 77 values
int length = 77;
double sample[] = new double[length];
for (int i = 0; i < length; i++) {
@@ -499,14 +499,14 @@ public final class StatUtilsTest {
for (int i = 0; i < length; i++) {
stats.addValue(standardizedSample[i]);
}
- // the calculations do have a limited precision
+ // the calculations do have a limited precision
double distance = 1E-10;
// check the mean an standard deviation
Assert.assertEquals(0.0, stats.getMean(), distance);
Assert.assertEquals(1.0, stats.getStandardDeviation(), distance);
}
-
+
@Test
public void testMode() {
final double[] singleMode = {0, 1, 0, 2, 7, 11, 12};
@@ -542,7 +542,7 @@ public final class StatUtilsTest {
final double[] nansOnly = {Double.NaN, Double.NaN};
final double[] modeNansOnly = StatUtils.mode(nansOnly);
Assert.assertEquals(0, modeNansOnly.length);
-
+
final double[] nullArray = null;
try {
StatUtils.mode(nullArray);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/clustering/DBSCANClustererTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/clustering/DBSCANClustererTest.java b/src/test/java/org/apache/commons/math3/stat/clustering/DBSCANClustererTest.java
index 657e2de..1c10490 100644
--- a/src/test/java/org/apache/commons/math3/stat/clustering/DBSCANClustererTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/clustering/DBSCANClustererTest.java
@@ -147,19 +147,19 @@ public class DBSCANClustererTest {
new EuclideanIntegerPoint(new int[] {14, 8}), // C
new EuclideanIntegerPoint(new int[] {7, 15}), // N - Noise, should not be present
new EuclideanIntegerPoint(new int[] {17, 8}), // D - single-link connected to C should not be present
-
+
};
-
+
final DBSCANClusterer<EuclideanIntegerPoint> clusterer = new DBSCANClusterer<EuclideanIntegerPoint>(3, 3);
List<Cluster<EuclideanIntegerPoint>> clusters = clusterer.cluster(Arrays.asList(points));
-
+
Assert.assertEquals(1, clusters.size());
-
+
final List<EuclideanIntegerPoint> clusterOne =
Arrays.asList(points[0], points[1], points[2], points[3], points[4], points[5], points[6], points[7]);
Assert.assertTrue(clusters.get(0).getPoints().containsAll(clusterOne));
}
-
+
@Test
public void testGetEps() {
final DBSCANClusterer<EuclideanDoublePoint> transformer = new DBSCANClusterer<EuclideanDoublePoint>(2.0, 5);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/clustering/KMeansPlusPlusClustererTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/clustering/KMeansPlusPlusClustererTest.java b/src/test/java/org/apache/commons/math3/stat/clustering/KMeansPlusPlusClustererTest.java
index d14f77b..4247992 100644
--- a/src/test/java/org/apache/commons/math3/stat/clustering/KMeansPlusPlusClustererTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/clustering/KMeansPlusPlusClustererTest.java
@@ -248,16 +248,16 @@ public class KMeansPlusPlusClustererTest {
}
Assert.assertTrue(uniquePointIsCenter);
}
-
+
/**
* 2 variables cannot be clustered into 3 clusters. See issue MATH-436.
*/
@Test(expected=NumberIsTooSmallException.class)
public void testPerformClusterAnalysisToManyClusters() {
- KMeansPlusPlusClusterer<EuclideanIntegerPoint> transformer =
+ KMeansPlusPlusClusterer<EuclideanIntegerPoint> transformer =
new KMeansPlusPlusClusterer<EuclideanIntegerPoint>(
new Random(1746432956321l));
-
+
EuclideanIntegerPoint[] points = new EuclideanIntegerPoint[] {
new EuclideanIntegerPoint(new int[] {
1959, 325100
@@ -265,7 +265,7 @@ public class KMeansPlusPlusClustererTest {
1960, 373200
})
};
-
+
transformer.cluster(Arrays.asList(points), 3, 1);
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/correlation/SpearmansRankCorrelationTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/correlation/SpearmansRankCorrelationTest.java b/src/test/java/org/apache/commons/math3/stat/correlation/SpearmansRankCorrelationTest.java
index 36b0c56..e75b0b9 100644
--- a/src/test/java/org/apache/commons/math3/stat/correlation/SpearmansRankCorrelationTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/correlation/SpearmansRankCorrelationTest.java
@@ -127,7 +127,7 @@ public class SpearmansRankCorrelationTest extends PearsonsCorrelationTest {
NaturalRanking ranking = new NaturalRanking(NaNStrategy.REMOVED);
SpearmansCorrelation spearman = new SpearmansCorrelation(ranking);
-
+
Assert.assertEquals(0.5, spearman.correlation(xArray, yArray), Double.MIN_VALUE);
}
@@ -145,7 +145,7 @@ public class SpearmansRankCorrelationTest extends PearsonsCorrelationTest {
// compute correlation
NaturalRanking ranking = new NaturalRanking(NaNStrategy.REMOVED);
SpearmansCorrelation spearman = new SpearmansCorrelation(matrix, ranking);
-
+
Assert.assertEquals(0.5, spearman.getCorrelationMatrix().getEntry(0, 1), Double.MIN_VALUE);
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/correlation/StorelessCovarianceTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/correlation/StorelessCovarianceTest.java b/src/test/java/org/apache/commons/math3/stat/correlation/StorelessCovarianceTest.java
index 06052e9..b8b85a8 100644
--- a/src/test/java/org/apache/commons/math3/stat/correlation/StorelessCovarianceTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/correlation/StorelessCovarianceTest.java
@@ -221,7 +221,7 @@ public class StorelessCovarianceTest {
}
}
}
-
+
/**
* Test equality of covariance. chk: covariance of two
* samples separately and adds them together. cov: computes
@@ -232,22 +232,22 @@ public class StorelessCovarianceTest {
int num_sets = 2;
StorelessBivariateCovariance cov = new StorelessBivariateCovariance();// covariance of the superset
StorelessBivariateCovariance chk = new StorelessBivariateCovariance();// check covariance made by appending covariance of subsets
-
+
ISAACRandom rand = new ISAACRandom(10L);// Seed can be changed
for (int s = 0; s < num_sets; s++) {// loop through sets of samlpes
StorelessBivariateCovariance covs = new StorelessBivariateCovariance();
for (int i = 0; i < 5; i++) { // loop through individual samlpes.
double x = rand.nextDouble();
double y = rand.nextDouble();
- covs.increment(x, y);// add sample to the subset
+ covs.increment(x, y);// add sample to the subset
cov.increment(x, y);// add sample to the superset
}
chk.append(covs);
}
-
+
TestUtils.assertEquals("covariance subset test", chk.getResult(), cov.getResult(), 10E-7);
}
-
+
protected RealMatrix createRealMatrix(double[] data, int nRows, int nCols) {
double[][] matrixData = new double[nRows][nCols];
int ptr = 0;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/descriptive/DescriptiveStatisticsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/descriptive/DescriptiveStatisticsTest.java b/src/test/java/org/apache/commons/math3/stat/descriptive/DescriptiveStatisticsTest.java
index d9e6aa9..f573b19 100644
--- a/src/test/java/org/apache/commons/math3/stat/descriptive/DescriptiveStatisticsTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/descriptive/DescriptiveStatisticsTest.java
@@ -224,7 +224,7 @@ public class DescriptiveStatisticsTest {
checkremoval(dstat, DescriptiveStatistics.INFINITE_WINDOW, 3.5, 2.5, 3.0);
}
-
+
@Test
public void testSummaryConsistency() {
final DescriptiveStatistics dstats = new DescriptiveStatistics();
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/descriptive/StatisticalSummaryValuesTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/descriptive/StatisticalSummaryValuesTest.java b/src/test/java/org/apache/commons/math3/stat/descriptive/StatisticalSummaryValuesTest.java
index e3b766e..581c97b 100644
--- a/src/test/java/org/apache/commons/math3/stat/descriptive/StatisticalSummaryValuesTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/descriptive/StatisticalSummaryValuesTest.java
@@ -64,7 +64,7 @@ public final class StatisticalSummaryValuesTest {
TestUtils.assertEquals("min",s.getMin(),u.getMin(), 0);
TestUtils.assertEquals("max",s.getMax(),u.getMax(), 0);
}
-
+
@Test
public void testToString() {
StatisticalSummaryValues u = new StatisticalSummaryValues(4.5, 16, 10, 5, 4, 45);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/descriptive/StorelessUnivariateStatisticAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/descriptive/StorelessUnivariateStatisticAbstractTest.java b/src/test/java/org/apache/commons/math3/stat/descriptive/StorelessUnivariateStatisticAbstractTest.java
index c42b80e..4deca7e 100644
--- a/src/test/java/org/apache/commons/math3/stat/descriptive/StorelessUnivariateStatisticAbstractTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/descriptive/StorelessUnivariateStatisticAbstractTest.java
@@ -74,7 +74,7 @@ public abstract class StorelessUnivariateStatisticAbstractTest
protected void checkClearValue(StorelessUnivariateStatistic statistic){
Assert.assertTrue(Double.isNaN(statistic.getResult()));
}
-
+
@Test
public void testSerialization() {
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/descriptive/SummaryStatisticsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/descriptive/SummaryStatisticsTest.java b/src/test/java/org/apache/commons/math3/stat/descriptive/SummaryStatisticsTest.java
index e1a1f98..90786ec 100644
--- a/src/test/java/org/apache/commons/math3/stat/descriptive/SummaryStatisticsTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/descriptive/SummaryStatisticsTest.java
@@ -296,7 +296,7 @@ public class SummaryStatisticsTest {
// expected
}
}
-
+
@Test
public void testQuadraticMean() {
final double[] values = { 1.2, 3.4, 5.6, 7.89 };
@@ -314,7 +314,7 @@ public class SummaryStatisticsTest {
Assert.assertEquals(expected, stats.getQuadraticMean(), Math.ulp(expected));
}
-
+
/**
* JIRA: MATH-691
*/
@@ -326,31 +326,31 @@ public class SummaryStatisticsTest {
for(double i : scores) {
stats.addValue(i);
}
- Assert.assertEquals((new Variance(false)).evaluate(scores),stats.getVariance(), 0);
+ Assert.assertEquals((new Variance(false)).evaluate(scores),stats.getVariance(), 0);
}
-
+
@Test
public void testOverrideMeanWithMathClass() {
double[] scores = {1, 2, 3, 4};
SummaryStatistics stats = new SummaryStatistics();
- stats.setMeanImpl(new Mean());
+ stats.setMeanImpl(new Mean());
for(double i : scores) {
stats.addValue(i);
}
- Assert.assertEquals((new Mean()).evaluate(scores),stats.getMean(), 0);
+ Assert.assertEquals((new Mean()).evaluate(scores),stats.getMean(), 0);
}
-
+
@Test
public void testOverrideGeoMeanWithMathClass() {
double[] scores = {1, 2, 3, 4};
SummaryStatistics stats = new SummaryStatistics();
- stats.setGeoMeanImpl(new GeometricMean());
+ stats.setGeoMeanImpl(new GeometricMean());
for(double i : scores) {
stats.addValue(i);
}
- Assert.assertEquals((new GeometricMean()).evaluate(scores),stats.getGeometricMean(), 0);
+ Assert.assertEquals((new GeometricMean()).evaluate(scores),stats.getGeometricMean(), 0);
}
-
+
@Test
public void testToString() {
SummaryStatistics u = createSummaryStatistics();
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/descriptive/UnivariateStatisticAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/descriptive/UnivariateStatisticAbstractTest.java b/src/test/java/org/apache/commons/math3/stat/descriptive/UnivariateStatisticAbstractTest.java
index ac15c85..2d8d2d8 100644
--- a/src/test/java/org/apache/commons/math3/stat/descriptive/UnivariateStatisticAbstractTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/descriptive/UnivariateStatisticAbstractTest.java
@@ -100,7 +100,7 @@ public abstract class UnivariateStatisticAbstractTest {
getUnivariateStatistic().evaluate(testArray),
getTolerance());
}
-
+
@Test
public void testEvaluateArraySegment() {
final UnivariateStatistic stat = getUnivariateStatistic();
@@ -114,7 +114,7 @@ public abstract class UnivariateStatisticAbstractTest {
System.arraycopy(testArray, testArray.length - 5, arrayEnd, 0, 5);
Assert.assertEquals(stat.evaluate(arrayEnd), stat.evaluate(testArray, testArray.length - 5, 5), 0);
}
-
+
@Test
public void testEvaluateArraySegmentWeighted() {
// See if this statistic computes weighted statistics
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/descriptive/rank/PSquarePercentileTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/descriptive/rank/PSquarePercentileTest.java b/src/test/java/org/apache/commons/math3/stat/descriptive/rank/PSquarePercentileTest.java
index 8f7295a..68d9e08 100644
--- a/src/test/java/org/apache/commons/math3/stat/descriptive/rank/PSquarePercentileTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/descriptive/rank/PSquarePercentileTest.java
@@ -41,7 +41,7 @@ import org.junit.Test;
/**
* Test cases for the {@link PSquarePercentile} class which naturally extends
- * {@link StorelessUnivariateStatisticAbstractTest}.
+ * {@link StorelessUnivariateStatisticAbstractTest}.
*/
public class PSquarePercentileTest extends
StorelessUnivariateStatisticAbstractTest {
@@ -49,7 +49,7 @@ public class PSquarePercentileTest extends
protected double percentile5 = 8.2299d;
protected double percentile95 = 16.72195;// 20.82d; this is approximation
protected double tolerance = 10E-12;
-
+
private final RandomGenerator randomGenerator = new Well19937c(1000);
@Override
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/descriptive/rank/PercentileTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/descriptive/rank/PercentileTest.java b/src/test/java/org/apache/commons/math3/stat/descriptive/rank/PercentileTest.java
index 5381213..b380417 100644
--- a/src/test/java/org/apache/commons/math3/stat/descriptive/rank/PercentileTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/descriptive/rank/PercentileTest.java
@@ -785,12 +785,12 @@ public class PercentileTest extends UnivariateStatisticAbstractTest{
Assert.assertEquals(2d,new Percentile(50d).withEstimationType(Percentile.EstimationType.R_1).withNaNStrategy(NaNStrategy.REMOVED).evaluate(specialValues),0d);
Assert.assertEquals(Double.NaN,new Percentile(50d).withEstimationType(Percentile.EstimationType.R_5).withNaNStrategy(NaNStrategy.REMOVED).evaluate(new double[] {Double.NaN,Double.NaN,Double.NaN}),0d);
Assert.assertEquals(50d,new Percentile(50d).withEstimationType(Percentile.EstimationType.R_7).withNaNStrategy(NaNStrategy.MINIMAL).evaluate(new double[] {50d,50d,50d},1,2),0d);
-
+
specialValues = new double[] { 0d, 1d, 2d, 3d, 4d, Double.NaN, Double.NaN };
Assert.assertEquals(3.5,new Percentile().evaluate(specialValues, 3, 4),0d);
Assert.assertEquals(4d,new Percentile().evaluate(specialValues, 4, 3),0d);
Assert.assertTrue(Double.isNaN(new Percentile().evaluate(specialValues, 5, 2)));
-
+
specialValues = new double[] { 0d, 1d, 2d, 3d, 4d, Double.NaN, Double.NaN, 5d, 6d };
Assert.assertEquals(4.5,new Percentile().evaluate(specialValues, 3, 6),0d);
Assert.assertEquals(5d,new Percentile().evaluate(specialValues, 4, 5),0d);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/descriptive/summary/ProductTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/descriptive/summary/ProductTest.java b/src/test/java/org/apache/commons/math3/stat/descriptive/summary/ProductTest.java
index 7dcaa7c..106286b 100644
--- a/src/test/java/org/apache/commons/math3/stat/descriptive/summary/ProductTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/descriptive/summary/ProductTest.java
@@ -80,7 +80,7 @@ public class ProductTest extends StorelessUnivariateStatisticAbstractTest{
Assert.assertEquals(expectedWeightedValue(), product.evaluate(testArray, testWeightsArray, 0, testArray.length),getTolerance());
Assert.assertEquals(expectedValue(), product.evaluate(testArray, unitWeightsArray, 0, testArray.length), getTolerance());
}
-
+
@Override
protected void checkClearValue(StorelessUnivariateStatistic statistic){
Assert.assertEquals(1, statistic.getResult(), 0);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/descriptive/summary/SumLogTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/descriptive/summary/SumLogTest.java b/src/test/java/org/apache/commons/math3/stat/descriptive/summary/SumLogTest.java
index ad3576a..bab0577 100644
--- a/src/test/java/org/apache/commons/math3/stat/descriptive/summary/SumLogTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/descriptive/summary/SumLogTest.java
@@ -75,11 +75,11 @@ public class SumLogTest extends StorelessUnivariateStatisticAbstractTest{
sum.increment(-2d);
Assert.assertTrue(Double.isNaN(sum.getResult()));
}
-
+
@Override
protected void checkClearValue(StorelessUnivariateStatistic statistic){
Assert.assertEquals(0, statistic.getResult(), 0);
}
-
+
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/descriptive/summary/SumSqTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/descriptive/summary/SumSqTest.java b/src/test/java/org/apache/commons/math3/stat/descriptive/summary/SumSqTest.java
index b19ca4e..d0760a6 100644
--- a/src/test/java/org/apache/commons/math3/stat/descriptive/summary/SumSqTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/descriptive/summary/SumSqTest.java
@@ -61,7 +61,7 @@ public class SumSqTest extends StorelessUnivariateStatisticAbstractTest{
sumSq.increment(1);
Assert.assertTrue(Double.isNaN(sumSq.getResult()));
}
-
+
@Override
protected void checkClearValue(StorelessUnivariateStatistic statistic){
Assert.assertEquals(0, statistic.getResult(), 0);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/descriptive/summary/SumTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/descriptive/summary/SumTest.java b/src/test/java/org/apache/commons/math3/stat/descriptive/summary/SumTest.java
index 87a3f5e..08a13f3 100644
--- a/src/test/java/org/apache/commons/math3/stat/descriptive/summary/SumTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/descriptive/summary/SumTest.java
@@ -70,7 +70,7 @@ public class SumTest extends StorelessUnivariateStatisticAbstractTest{
Assert.assertEquals(expectedWeightedValue(), sum.evaluate(testArray, testWeightsArray, 0, testArray.length), getTolerance());
Assert.assertEquals(expectedValue(), sum.evaluate(testArray, unitWeightsArray, 0, testArray.length), getTolerance());
}
-
+
@Override
protected void checkClearValue(StorelessUnivariateStatistic statistic){
Assert.assertEquals(0, statistic.getResult(), 0);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/inference/GTestTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/inference/GTestTest.java b/src/test/java/org/apache/commons/math3/stat/inference/GTestTest.java
index 228f0ce..ef606f4 100644
--- a/src/test/java/org/apache/commons/math3/stat/inference/GTestTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/inference/GTestTest.java
@@ -180,7 +180,7 @@ public class GTestTest {
// expected
}
}
-
+
@Test
public void testUnmatchedArrays() {
final long[] observed = { 0, 1, 2, 3 };
@@ -199,7 +199,7 @@ public class GTestTest {
// expected
}
}
-
+
@Test
public void testNegativeObservedCounts() {
final long[] observed = { 0, 1, 2, -3 };
@@ -216,9 +216,9 @@ public class GTestTest {
Assert.fail("negative observed count, NotPositiveException expected");
} catch (NotPositiveException ex) {
// expected
- }
+ }
}
-
+
@Test
public void testZeroExpectedCounts() {
final long[] observed = { 0, 1, 2, -3 };
@@ -230,7 +230,7 @@ public class GTestTest {
// expected
}
}
-
+
@Test
public void testBadAlpha() {
final long[] observed = { 0, 1, 2, 3 };
@@ -247,9 +247,9 @@ public class GTestTest {
Assert.fail("zero expected count, NotStrictlyPositiveException expected");
} catch (OutOfRangeException ex) {
// expected
- }
+ }
}
-
+
@Test
public void testScaling() {
final long[] observed = {9, 11, 10, 8, 12};
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/inference/MannWhitneyUTestTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/inference/MannWhitneyUTestTest.java b/src/test/java/org/apache/commons/math3/stat/inference/MannWhitneyUTestTest.java
index e46f8c5..e72d1a6 100644
--- a/src/test/java/org/apache/commons/math3/stat/inference/MannWhitneyUTestTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/inference/MannWhitneyUTestTest.java
@@ -37,11 +37,11 @@ public class MannWhitneyUTestTest {
* x <- c(19, 22, 16, 29, 24)
* y <- c(20, 11, 17, 12)
* wilcox.test(x, y, alternative = "two.sided", mu = 0, paired = FALSE, exact = FALSE, correct = FALSE)
- * W = 17, p-value = 0.08641
+ * W = 17, p-value = 0.08641
*/
final double x[] = {19, 22, 16, 29, 24};
final double y[] = {20, 11, 17, 12};
-
+
Assert.assertEquals(17, testStatistic.mannWhitneyU(x, y), 1e-10);
Assert.assertEquals(0.08641, testStatistic.mannWhitneyUTest(x, y), 1e-5);
}
@@ -74,14 +74,14 @@ public class MannWhitneyUTestTest {
} catch (NullArgumentException ex) {
// expected
}
-
+
try {
testStatistic.mannWhitneyUTest(null, null);
Assert.fail("x and y is null (asymptotic), NullArgumentException expected");
} catch (NullArgumentException ex) {
// expected
}
-
+
/*
* x or y is null
*/
@@ -91,7 +91,7 @@ public class MannWhitneyUTestTest {
} catch (NullArgumentException ex) {
// expected
}
-
+
try {
testStatistic.mannWhitneyUTest(new double[] { 1.0 }, null);
Assert.fail("y is null (exact), NullArgumentException expected");
@@ -99,7 +99,7 @@ public class MannWhitneyUTestTest {
// expected
}
}
-
+
@Test
public void testBigDataSet() {
double[] d1 = new double[1500];
@@ -111,7 +111,7 @@ public class MannWhitneyUTestTest {
double result = testStatistic.mannWhitneyUTest(d1, d2);
Assert.assertTrue(result > 0.1);
}
-
+
@Test
public void testBigDataSetOverflow() {
// MATH-1145
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/inference/TestUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/inference/TestUtilsTest.java b/src/test/java/org/apache/commons/math3/stat/inference/TestUtilsTest.java
index 69bd58a..d3785f5 100644
--- a/src/test/java/org/apache/commons/math3/stat/inference/TestUtilsTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/inference/TestUtilsTest.java
@@ -528,7 +528,7 @@ public class TestUtilsTest {
Assert.assertEquals(FastMath.sqrt(5734.343), TestUtils.rootLogLikelihoodRatio(1000, 1000, 1000, 100000), 0.001);
Assert.assertEquals(FastMath.sqrt(5714.932), TestUtils.rootLogLikelihoodRatio(1000, 1000, 1000, 99000), 0.001);
}
-
+
@Test
public void testKSOneSample() throws Exception {
final NormalDistribution unitNormal = new NormalDistribution(0d, 1d);
@@ -537,7 +537,7 @@ public class TestUtilsTest {
Assert.assertEquals(0.3172069207622391, TestUtils.kolmogorovSmirnovTest(unitNormal, sample), tol);
Assert.assertEquals(0.0932947561266756, TestUtils.kolmogorovSmirnovStatistic(unitNormal, sample), tol);
}
-
+
@Test
public void testKSTwoSample() throws Exception {
final double tol = KolmogorovSmirnovTestTest.TOLERANCE;
@@ -552,6 +552,6 @@ public class TestUtilsTest {
final double d = TestUtils.kolmogorovSmirnovStatistic(smallSample1, smallSample2);
Assert.assertEquals(0.5, d, tol);
Assert
- .assertEquals(0.105577085453247, TestUtils.exactP(d, smallSample1.length,smallSample2.length, false), tol);
+ .assertEquals(0.105577085453247, TestUtils.exactP(d, smallSample1.length,smallSample2.length, false), tol);
}
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/inference/WilcoxonSignedRankTestTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/inference/WilcoxonSignedRankTestTest.java b/src/test/java/org/apache/commons/math3/stat/inference/WilcoxonSignedRankTestTest.java
index 23ad58b..b273ecb 100644
--- a/src/test/java/org/apache/commons/math3/stat/inference/WilcoxonSignedRankTestTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/inference/WilcoxonSignedRankTestTest.java
@@ -41,28 +41,28 @@ public class WilcoxonSignedRankTestTest {
*/
final double x[] = {1.83, 0.50, 1.62, 2.48, 1.68, 1.88, 1.55, 3.06, 1.30};
final double y[] = {0.878, 0.647, 0.598, 2.05, 1.06, 1.29, 1.06, 3.14, 1.29};
-
+
/* EXACT:
* wilcox.test(x, y, alternative = "two.sided", mu = 0, paired = TRUE, exact = TRUE, correct = FALSE)
* V = 40, p-value = 0.03906
- *
+ *
* Corresponds to the value obtained in R.
*/
Assert.assertEquals(40, testStatistic.wilcoxonSignedRank(x, y), 1e-10);
- Assert.assertEquals(0.03906, testStatistic.wilcoxonSignedRankTest(x, y, true), 1e-5);
-
+ Assert.assertEquals(0.03906, testStatistic.wilcoxonSignedRankTest(x, y, true), 1e-5);
+
/* ASYMPTOTIC:
* wilcox.test(x, y, alternative = "two.sided", mu = 0, paired = TRUE, exact = FALSE, correct = FALSE)
* V = 40, p-value = 0.03815
- *
- * This is not entirely the same due to different corrects,
+ *
+ * This is not entirely the same due to different corrects,
* e.g. http://mlsc.lboro.ac.uk/resources/statistics/wsrt.pdf
* and src/library/stats/R/wilcox.test.R in the R source
*/
Assert.assertEquals(40, testStatistic.wilcoxonSignedRank(x, y), 1e-10);
Assert.assertEquals(0.0329693812, testStatistic.wilcoxonSignedRankTest(x, y, false), 1e-10);
}
-
+
@Test
public void testWilcoxonSignedRankInputValidation() {
/*
@@ -73,19 +73,19 @@ public class WilcoxonSignedRankTestTest {
final double[] y1 = new double[30];
final double[] y2 = new double[31];
for (int i = 0; i < 30; ++i) {
- x1[i] = x2[i] = y1[i] = y2[i] = i;
+ x1[i] = x2[i] = y1[i] = y2[i] = i;
}
-
+
// Exactly 30 is okay
- //testStatistic.wilcoxonSignedRankTest(x1, y1, true);
-
+ //testStatistic.wilcoxonSignedRankTest(x1, y1, true);
+
try {
testStatistic.wilcoxonSignedRankTest(x2, y2, true);
Assert.fail("More than 30 samples and exact chosen, NumberIsTooLargeException expected");
} catch (NumberIsTooLargeException ex) {
// expected
}
-
+
/* Samples must be present, i.e. length > 0
*/
try {
@@ -131,7 +131,7 @@ public class WilcoxonSignedRankTestTest {
} catch (DimensionMismatchException ex) {
// expected
}
-
+
/*
* x and y is null
*/
@@ -141,14 +141,14 @@ public class WilcoxonSignedRankTestTest {
} catch (NullArgumentException ex) {
// expected
}
-
+
try {
testStatistic.wilcoxonSignedRankTest(null, null, false);
Assert.fail("x and y is null (asymptotic), NullArgumentException expected");
} catch (NullArgumentException ex) {
// expected
}
-
+
/*
* x or y is null
*/
@@ -158,21 +158,21 @@ public class WilcoxonSignedRankTestTest {
} catch (NullArgumentException ex) {
// expected
}
-
+
try {
testStatistic.wilcoxonSignedRankTest(null, new double[] { 1.0 }, false);
Assert.fail("x is null (asymptotic), NullArgumentException expected");
} catch (NullArgumentException ex) {
// expected
}
-
+
try {
testStatistic.wilcoxonSignedRankTest(new double[] { 1.0 }, null, true);
Assert.fail("y is null (exact), NullArgumentException expected");
} catch (NullArgumentException ex) {
// expected
}
-
+
try {
testStatistic.wilcoxonSignedRankTest(new double[] { 1.0 }, null, false);
Assert.fail("y is null (asymptotic), NullArgumentException expected");
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/interval/AgrestiCoullIntervalTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/interval/AgrestiCoullIntervalTest.java b/src/test/java/org/apache/commons/math3/stat/interval/AgrestiCoullIntervalTest.java
index 2072b0e..4b757c9 100644
--- a/src/test/java/org/apache/commons/math3/stat/interval/AgrestiCoullIntervalTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/interval/AgrestiCoullIntervalTest.java
@@ -32,7 +32,7 @@ public class AgrestiCoullIntervalTest extends BinomialConfidenceIntervalAbstract
protected BinomialConfidenceInterval createBinomialConfidenceInterval() {
return new AgrestiCoullInterval();
}
-
+
@Test
public void testStandardInterval() {
ConfidenceInterval confidenceInterval = createStandardTestInterval();
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/interval/BinomialConfidenceIntervalAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/interval/BinomialConfidenceIntervalAbstractTest.java b/src/test/java/org/apache/commons/math3/stat/interval/BinomialConfidenceIntervalAbstractTest.java
index a346297..7cc75a3 100644
--- a/src/test/java/org/apache/commons/math3/stat/interval/BinomialConfidenceIntervalAbstractTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/interval/BinomialConfidenceIntervalAbstractTest.java
@@ -35,10 +35,10 @@ public abstract class BinomialConfidenceIntervalAbstractTest {
private final double confidenceLevel = 0.9;
protected abstract BinomialConfidenceInterval createBinomialConfidenceInterval();
-
+
/**
* Returns the confidence interval for the given statistic with the following values:
- *
+ *
* <ul>
* <li>trials: 500</li>
* <li>successes: 50</li>
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/interval/ClopperPearsonIntervalTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/interval/ClopperPearsonIntervalTest.java b/src/test/java/org/apache/commons/math3/stat/interval/ClopperPearsonIntervalTest.java
index 2dfe1be..8258021 100644
--- a/src/test/java/org/apache/commons/math3/stat/interval/ClopperPearsonIntervalTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/interval/ClopperPearsonIntervalTest.java
@@ -32,7 +32,7 @@ public class ClopperPearsonIntervalTest extends BinomialConfidenceIntervalAbstra
protected BinomialConfidenceInterval createBinomialConfidenceInterval() {
return new ClopperPearsonInterval();
}
-
+
@Test
public void testStandardInterval() {
ConfidenceInterval confidenceInterval = createStandardTestInterval();
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/interval/IntervalUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/interval/IntervalUtilsTest.java b/src/test/java/org/apache/commons/math3/stat/interval/IntervalUtilsTest.java
index 4f87371..8ebab58 100644
--- a/src/test/java/org/apache/commons/math3/stat/interval/IntervalUtilsTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/interval/IntervalUtilsTest.java
@@ -21,14 +21,14 @@ import org.junit.Test;
/**
* Test cases for the IntervalUtils class.
- *
+ *
*/
public class IntervalUtilsTest {
private final int successes = 50;
private final int trials = 500;
private final double confidenceLevel = 0.9;
-
+
// values to test must be exactly the same
private final double eps = 0.0;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/interval/NormalApproximationIntervalTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/interval/NormalApproximationIntervalTest.java b/src/test/java/org/apache/commons/math3/stat/interval/NormalApproximationIntervalTest.java
index 2b0384a..66f6166 100644
--- a/src/test/java/org/apache/commons/math3/stat/interval/NormalApproximationIntervalTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/interval/NormalApproximationIntervalTest.java
@@ -32,7 +32,7 @@ public class NormalApproximationIntervalTest extends BinomialConfidenceIntervalA
protected BinomialConfidenceInterval createBinomialConfidenceInterval() {
return new NormalApproximationInterval();
}
-
+
@Test
public void testStandardInterval() {
ConfidenceInterval confidenceInterval = createStandardTestInterval();
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/interval/WilsonScoreIntervalTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/interval/WilsonScoreIntervalTest.java b/src/test/java/org/apache/commons/math3/stat/interval/WilsonScoreIntervalTest.java
index af64a54..b612ff4 100644
--- a/src/test/java/org/apache/commons/math3/stat/interval/WilsonScoreIntervalTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/interval/WilsonScoreIntervalTest.java
@@ -32,7 +32,7 @@ public class WilsonScoreIntervalTest extends BinomialConfidenceIntervalAbstractT
protected BinomialConfidenceInterval createBinomialConfidenceInterval() {
return new WilsonScoreInterval();
}
-
+
@Test
public void testStandardInterval() {
ConfidenceInterval confidenceInterval = createStandardTestInterval();
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/ranking/NaturalRankingTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/ranking/NaturalRankingTest.java b/src/test/java/org/apache/commons/math3/stat/ranking/NaturalRankingTest.java
index e1ddf06..33a3db4 100644
--- a/src/test/java/org/apache/commons/math3/stat/ranking/NaturalRankingTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/ranking/NaturalRankingTest.java
@@ -44,28 +44,28 @@ public class NaturalRankingTest {
public void testDefault() { // Ties averaged, NaNs failed
NaturalRanking ranking = new NaturalRanking();
double[] ranks;
-
+
try {
ranks = ranking.rank(exampleData);
Assert.fail("expected NotANumberException due to NaNStrategy.FAILED");
} catch (NotANumberException e) {
// expected
}
-
+
ranks = ranking.rank(tiesFirst);
double[] correctRanks = new double[] { 1.5, 1.5, 4, 3, 5 };
TestUtils.assertEquals(correctRanks, ranks, 0d);
ranks = ranking.rank(tiesLast);
correctRanks = new double[] { 3.5, 3.5, 2, 1 };
TestUtils.assertEquals(correctRanks, ranks, 0d);
-
+
try {
ranks = ranking.rank(multipleNaNs);
Assert.fail("expected NotANumberException due to NaNStrategy.FAILED");
} catch (NotANumberException e) {
// expected
}
-
+
ranks = ranking.rank(multipleTies);
correctRanks = new double[] { 3, 2, 4.5, 4.5, 6.5, 6.5, 1 };
TestUtils.assertEquals(correctRanks, ranks, 0d);
@@ -207,14 +207,14 @@ public class NaturalRankingTest {
correctRanks = new double[] { 3, 4, 1.5, 1.5 };
TestUtils.assertEquals(correctRanks, ranks, 0d);
}
-
+
@Test(expected=NotANumberException.class)
public void testNaNsFailed() {
double[] data = { 0, Double.POSITIVE_INFINITY, Double.NaN, Double.NEGATIVE_INFINITY };
NaturalRanking ranking = new NaturalRanking(NaNStrategy.FAILED);
ranking.rank(data);
}
-
+
@Test
public void testNoNaNsFailed() {
double[] data = { 1, 2, 3, 4 };
@@ -222,5 +222,5 @@ public class NaturalRankingTest {
double[] ranks = ranking.rank(data);
TestUtils.assertEquals(data, ranks, 0d);
}
-
+
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/regression/GLSMultipleLinearRegressionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/regression/GLSMultipleLinearRegressionTest.java b/src/test/java/org/apache/commons/math3/stat/regression/GLSMultipleLinearRegressionTest.java
index 3896487..e00cee5 100644
--- a/src/test/java/org/apache/commons/math3/stat/regression/GLSMultipleLinearRegressionTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/regression/GLSMultipleLinearRegressionTest.java
@@ -162,18 +162,18 @@ public class GLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
model.newSampleData(y, x, omega);
TestUtils.assertEquals(model.calculateYVariance(), 3.5, 0);
}
-
+
/**
* Verifies that setting X, Y and covariance separately has the same effect as newSample(X,Y,cov).
*/
@Test
public void testNewSample2() {
- double[] y = new double[] {1, 2, 3, 4};
+ double[] y = new double[] {1, 2, 3, 4};
double[][] x = new double[][] {
{19, 22, 33},
{20, 30, 40},
{25, 35, 45},
- {27, 37, 47}
+ {27, 37, 47}
};
double[][] covariance = MatrixUtils.createRealIdentityMatrix(4).scalarMultiply(2).getData();
GLSMultipleLinearRegression regression = new GLSMultipleLinearRegression();
@@ -187,13 +187,13 @@ public class GLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
Assert.assertEquals(combinedY, regression.getY());
Assert.assertEquals(combinedCovInv, regression.getOmegaInverse());
}
-
+
/**
* Verifies that GLS with identity covariance matrix gives the same results
* as OLS.
*/
@Test
- public void testGLSOLSConsistency() {
+ public void testGLSOLSConsistency() {
RealMatrix identityCov = MatrixUtils.createRealIdentityMatrix(16);
GLSMultipleLinearRegression glsModel = new GLSMultipleLinearRegression();
OLSMultipleLinearRegression olsModel = new OLSMultipleLinearRegression();
@@ -208,7 +208,7 @@ public class GLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
TestUtils.assertRelativelyEquals(olsBeta[i], glsBeta[i], 10E-7);
}
}
-
+
/**
* Generate an error covariance matrix and sample data representing models
* with this error structure. Then verify that GLS estimated coefficients,
@@ -218,7 +218,7 @@ public class GLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
public void testGLSEfficiency() {
RandomGenerator rg = new JDKRandomGenerator();
rg.setSeed(200); // Seed has been selected to generate non-trivial covariance
-
+
// Assume model has 16 observations (will use Longley data). Start by generating
// non-constant variances for the 16 error terms.
final int nObs = 16;
@@ -226,7 +226,7 @@ public class GLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
for (int i = 0; i < nObs; i++) {
sigma[i] = 10 * rg.nextDouble();
}
-
+
// Now generate 1000 error vectors to use to estimate the covariance matrix
// Columns are draws on N(0, sigma[col])
final int numSeeds = 1000;
@@ -236,16 +236,16 @@ public class GLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
errorSeeds.setEntry(i, j, rg.nextGaussian() * sigma[j]);
}
}
-
+
// Get covariance matrix for columns
RealMatrix cov = (new Covariance(errorSeeds)).getCovarianceMatrix();
-
+
// Create a CorrelatedRandomVectorGenerator to use to generate correlated errors
GaussianRandomGenerator rawGenerator = new GaussianRandomGenerator(rg);
double[] errorMeans = new double[nObs]; // Counting on init to 0 here
CorrelatedRandomVectorGenerator gen = new CorrelatedRandomVectorGenerator(errorMeans, cov,
1.0e-12 * cov.getNorm(), rawGenerator);
-
+
// Now start generating models. Use Longley X matrix on LHS
// and Longley OLS beta vector as "true" beta. Generate
// Y values by XB + u where u is a CorrelatedRandomVector generated
@@ -254,44 +254,44 @@ public class GLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
ols.newSampleData(longley, nObs, 6);
final RealVector b = ols.calculateBeta().copy();
final RealMatrix x = ols.getX().copy();
-
+
// Create a GLS model to reuse
GLSMultipleLinearRegression gls = new GLSMultipleLinearRegression();
gls.newSampleData(longley, nObs, 6);
gls.newCovarianceData(cov.getData());
-
+
// Create aggregators for stats measuring model performance
DescriptiveStatistics olsBetaStats = new DescriptiveStatistics();
DescriptiveStatistics glsBetaStats = new DescriptiveStatistics();
-
+
// Generate Y vectors for 10000 models, estimate GLS and OLS and
// Verify that OLS estimates are better
final int nModels = 10000;
for (int i = 0; i < nModels; i++) {
-
+
// Generate y = xb + u with u cov
RealVector u = MatrixUtils.createRealVector(gen.nextVector());
double[] y = u.add(x.operate(b)).toArray();
-
+
// Estimate OLS parameters
ols.newYSampleData(y);
RealVector olsBeta = ols.calculateBeta();
-
+
// Estimate GLS parameters
gls.newYSampleData(y);
RealVector glsBeta = gls.calculateBeta();
-
+
// Record deviations from "true" beta
double dist = olsBeta.getDistance(b);
olsBetaStats.addValue(dist * dist);
dist = glsBeta.getDistance(b);
glsBetaStats.addValue(dist * dist);
-
+
}
-
+
// Verify that GLS is on average more efficient, lower variance
assert(olsBetaStats.getMean() > 1.5 * glsBetaStats.getMean());
- assert(olsBetaStats.getStandardDeviation() > glsBetaStats.getStandardDeviation());
+ assert(olsBetaStats.getStandardDeviation() > glsBetaStats.getStandardDeviation());
}
-
+
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/regression/MillerUpdatingRegressionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/regression/MillerUpdatingRegressionTest.java b/src/test/java/org/apache/commons/math3/stat/regression/MillerUpdatingRegressionTest.java
index 2ff023c..7f0a06a 100644
--- a/src/test/java/org/apache/commons/math3/stat/regression/MillerUpdatingRegressionTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/regression/MillerUpdatingRegressionTest.java
@@ -30,9 +30,9 @@ public class MillerUpdatingRegressionTest {
public MillerUpdatingRegressionTest() {
}
- /* This is the Greene Airline Cost data.
+ /* This is the Greene Airline Cost data.
* The data can be downloaded from http://www.indiana.edu/~statmath/stat/all/panel/airline.csv
- */
+ */
private final static double[][] airdata = {
/*"I",*/new double[]{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6},
/*"T",*/ new double[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
@@ -327,7 +327,7 @@ public class MillerUpdatingRegressionTest {
// tmp[6] = tmp[2] * tmp[3]; //^7
// tmp[7] = tmp[3] * tmp[3]; //^8
// tmp[8] = tmp[4] * tmp[3]; //^9
-// tmp[9] = tmp[4] * tmp[4]; //^10
+// tmp[9] = tmp[4] * tmp[4]; //^10
tmp[1] = tmp[0] * tmp[0];
tmp[2] = tmp[0] * tmp[1];
tmp[3] = tmp[0] * tmp[2];
@@ -678,12 +678,12 @@ public class MillerUpdatingRegressionTest {
0.214274163161675,
0.226073200069370,
455.478499142212}, errors, 1E-6);
-//
+//
// Check R-Square statistics against R
TestUtils.assertEquals(0.995479004577296, result.getRSquared(), 1E-12);
TestUtils.assertEquals(0.992465007628826, result.getAdjustedRSquared(), 1E-12);
-//
-//
+//
+//
// // Estimate model without intercept
model = new MillerUpdatingRegression(6, false);
off = 0;
@@ -699,13 +699,13 @@ public class MillerUpdatingRegressionTest {
new double[]{-52.99357013868291, 0.07107319907358,
-0.42346585566399, -0.57256866841929,
-0.41420358884978, 48.41786562001326}, 1E-11);
-//
+//
// Check standard errors from R
errors = result.getStdErrorOfEstimates();
TestUtils.assertEquals(new double[]{129.54486693117232, 0.03016640003786,
0.41773654056612, 0.27899087467676, 0.32128496193363,
17.68948737819961}, errors, 1E-11);
-//
+//
// // Check R-Square statistics against R
TestUtils.assertEquals(0.9999670130706, result.getRSquared(), 1E-12);
@@ -1045,11 +1045,11 @@ public class MillerUpdatingRegressionTest {
}
return;
}
-
-
+
+
@Test
public void testSubsetRegression() {
-
+
MillerUpdatingRegression instance = new MillerUpdatingRegression(3, true);
MillerUpdatingRegression redRegression = new MillerUpdatingRegression(2, true);
double[][] x = new double[airdata[0].length][];
@@ -1060,23 +1060,23 @@ public class MillerUpdatingRegressionTest {
x[i][0] = FastMath.log(airdata[3][i]);
x[i][1] = FastMath.log(airdata[4][i]);
x[i][2] = airdata[5][i];
-
+
xReduced[i] = new double[2];
xReduced[i][0] = FastMath.log(airdata[3][i]);
xReduced[i][1] = FastMath.log(airdata[4][i]);
-
+
y[i] = FastMath.log(airdata[2][i]);
}
instance.addObservations(x, y);
redRegression.addObservations(xReduced, y);
-
+
RegressionResults resultsInstance = instance.regress( new int[]{0,1,2} );
RegressionResults resultsReduced = redRegression.regress();
-
+
TestUtils.assertEquals(resultsInstance.getParameterEstimates(), resultsReduced.getParameterEstimates(), 1.0e-12);
TestUtils.assertEquals(resultsInstance.getStdErrorOfEstimates(), resultsReduced.getStdErrorOfEstimates(), 1.0e-12);
}
-
-
+
+
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/regression/MultipleLinearRegressionAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/regression/MultipleLinearRegressionAbstractTest.java b/src/test/java/org/apache/commons/math3/stat/regression/MultipleLinearRegressionAbstractTest.java
index ea5fecf..759422b 100644
--- a/src/test/java/org/apache/commons/math3/stat/regression/MultipleLinearRegressionAbstractTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/regression/MultipleLinearRegressionAbstractTest.java
@@ -64,7 +64,7 @@ public abstract class MultipleLinearRegressionAbstractTest {
Assert.assertTrue(variance > 0.0);
}
}
-
+
/**
* Verifies that newSampleData methods consistently insert unitary columns
* in design matrix. Confirms the fix for MATH-411.
@@ -77,12 +77,12 @@ public abstract class MultipleLinearRegressionAbstractTest {
3, 25, 35, 45,
4, 27, 37, 47
};
- double[] y = new double[] {1, 2, 3, 4};
+ double[] y = new double[] {1, 2, 3, 4};
double[][] x = new double[][] {
{19, 22, 33},
{20, 30, 40},
{25, 35, 45},
- {27, 37, 47}
+ {27, 37, 47}
};
AbstractMultipleLinearRegression regression = createRegression();
regression.newSampleData(design, 4, 3);
@@ -92,7 +92,7 @@ public abstract class MultipleLinearRegressionAbstractTest {
regression.newYSampleData(y);
Assert.assertEquals(flatX, regression.getX());
Assert.assertEquals(flatY, regression.getY());
-
+
// No intercept
regression.setNoIntercept(true);
regression.newSampleData(design, 4, 3);
@@ -103,30 +103,30 @@ public abstract class MultipleLinearRegressionAbstractTest {
Assert.assertEquals(flatX, regression.getX());
Assert.assertEquals(flatY, regression.getY());
}
-
+
@Test(expected=IllegalArgumentException.class)
public void testNewSampleNullData() {
double[] data = null;
- createRegression().newSampleData(data, 2, 3);
+ createRegression().newSampleData(data, 2, 3);
}
-
+
@Test(expected=IllegalArgumentException.class)
public void testNewSampleInvalidData() {
double[] data = new double[] {1, 2, 3, 4};
createRegression().newSampleData(data, 2, 3);
}
-
+
@Test(expected=IllegalArgumentException.class)
public void testNewSampleInsufficientData() {
double[] data = new double[] {1, 2, 3, 4};
createRegression().newSampleData(data, 1, 3);
}
-
+
@Test(expected=IllegalArgumentException.class)
public void testXSampleDataNull() {
createRegression().newXSampleData(null);
}
-
+
@Test(expected=IllegalArgumentException.class)
public void testYSampleDataNull() {
createRegression().newYSampleData(null);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/regression/OLSMultipleLinearRegressionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/regression/OLSMultipleLinearRegressionTest.java b/src/test/java/org/apache/commons/math3/stat/regression/OLSMultipleLinearRegressionTest.java
index d719c8b..87dabb8 100644
--- a/src/test/java/org/apache/commons/math3/stat/regression/OLSMultipleLinearRegressionTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/regression/OLSMultipleLinearRegressionTest.java
@@ -63,7 +63,7 @@ public class OLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
protected int getSampleSize() {
return y.length;
}
-
+
@Test(expected=IllegalArgumentException.class)
public void cannotAddSampleDataWithSizeMismatch() {
double[] y = new double[]{1.0, 2.0};
@@ -170,33 +170,33 @@ public class OLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
0.214274163161675,
0.226073200069370,
455.478499142212}, errors, 1E-6);
-
+
// Check regression standard error against R
Assert.assertEquals(304.8540735619638, model.estimateRegressionStandardError(), 1E-10);
-
+
// Check R-Square statistics against R
Assert.assertEquals(0.995479004577296, model.calculateRSquared(), 1E-12);
Assert.assertEquals(0.992465007628826, model.calculateAdjustedRSquared(), 1E-12);
-
+
checkVarianceConsistency(model);
-
+
// Estimate model without intercept
model.setNoIntercept(true);
model.newSampleData(design, nobs, nvars);
-
+
// Check expected beta values from R
betaHat = model.estimateRegressionParameters();
TestUtils.assertEquals(betaHat,
new double[]{-52.99357013868291, 0.07107319907358,
-0.42346585566399,-0.57256866841929,
- -0.41420358884978, 48.41786562001326}, 1E-11);
-
+ -0.41420358884978, 48.41786562001326}, 1E-11);
+
// Check standard errors from R
errors = model.estimateRegressionParametersStandardErrors();
TestUtils.assertEquals(new double[] {129.54486693117232, 0.03016640003786,
0.41773654056612, 0.27899087467676, 0.32128496193363,
17.68948737819961}, errors, 1E-11);
-
+
// Check expected residuals from R
residuals = model.estimateResiduals();
TestUtils.assertEquals(residuals, new double[]{
@@ -205,14 +205,14 @@ public class OLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
73.09368242049943, 913.21694494481869, 424.82484953610174, -8.56475876776709,
-361.32974610842876, 27.34560497213464, 151.28955976355002, -492.49937355336846},
1E-10);
-
+
// Check regression standard error against R
Assert.assertEquals(475.1655079819517, model.estimateRegressionStandardError(), 1E-10);
-
+
// Check R-Square statistics against R
Assert.assertEquals(0.9999670130706, model.calculateRSquared(), 1E-12);
Assert.assertEquals(0.999947220913, model.calculateAdjustedRSquared(), 1E-12);
-
+
}
/**
@@ -270,7 +270,7 @@ public class OLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
44.7,46.6,16,29,50.43,
42.8,27.7,22,29,58.33
};
-
+
final int nobs = 47;
final int nvars = 4;
@@ -315,16 +315,16 @@ public class OLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
0.27410957467466,
0.19454551679325,
0.03726654773803}, errors, 1E-10);
-
+
// Check regression standard error against R
Assert.assertEquals(7.73642194433223, model.estimateRegressionStandardError(), 1E-12);
-
+
// Check R-Square statistics against R
Assert.assertEquals(0.649789742860228, model.calculateRSquared(), 1E-12);
Assert.assertEquals(0.6164363850373927, model.calculateAdjustedRSquared(), 1E-12);
-
+
checkVarianceConsistency(model);
-
+
// Estimate the model with no intercept
model = new OLSMultipleLinearRegression();
model.setNoIntercept(true);
@@ -335,15 +335,15 @@ public class OLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
TestUtils.assertEquals(betaHat,
new double[]{0.52191832900513,
2.36588087917963,
- -0.94770353802795,
+ -0.94770353802795,
0.30851985863609}, 1E-12);
// Check expected residuals from R
residuals = model.estimateResiduals();
TestUtils.assertEquals(residuals, new double[]{
- 44.138759883538249, 27.720705122356215, 35.873200836126799,
+ 44.138759883538249, 27.720705122356215, 35.873200836126799,
34.574619581211977, 26.600168342080213, 15.074636243026923, -12.704904871199814,
- 1.497443824078134, 2.691972687079431, 5.582798774291231, -4.422986561283165,
+ 1.497443824078134, 2.691972687079431, 5.582798774291231, -4.422986561283165,
-9.198581600334345, 4.481765170730647, 2.273520207553216, -22.649827853221336,
-17.747900013943308, 20.298314638496436, 6.861405135329779, -8.684712790954924,
-10.298639278062371, -9.896618896845819, 4.568568616351242, -15.313570491727944,
@@ -359,10 +359,10 @@ public class OLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
errors = model.estimateRegressionParametersStandardErrors();
TestUtils.assertEquals(new double[] {0.10470063765677, 0.41684100584290,
0.43370143099691, 0.07694953606522}, errors, 1E-10);
-
+
// Check regression standard error against R
Assert.assertEquals(17.24710630547, model.estimateRegressionStandardError(), 1E-10);
-
+
// Check R-Square statistics against R
Assert.assertEquals(0.946350722085, model.calculateRSquared(), 1E-12);
Assert.assertEquals(0.9413600915813, model.calculateAdjustedRSquared(), 1E-12);
@@ -449,7 +449,7 @@ public class OLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
model.newSampleData(y, x);
TestUtils.assertEquals(model.calculateYVariance(), 3.5, 0);
}
-
+
/**
* Verifies that calculateYVariance and calculateResidualVariance return consistent
* values with direct variance computation from Y, residuals, respectively.
@@ -457,27 +457,27 @@ public class OLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
protected void checkVarianceConsistency(OLSMultipleLinearRegression model) {
// Check Y variance consistency
TestUtils.assertEquals(StatUtils.variance(model.getY().toArray()), model.calculateYVariance(), 0);
-
+
// Check residual variance consistency
double[] residuals = model.calculateResiduals().toArray();
RealMatrix X = model.getX();
TestUtils.assertEquals(
StatUtils.variance(model.calculateResiduals().toArray()) * (residuals.length - 1),
model.calculateErrorVariance() * (X.getRowDimension() - X.getColumnDimension()), 1E-20);
-
+
}
-
+
/**
* Verifies that setting X and Y separately has the same effect as newSample(X,Y).
*/
@Test
public void testNewSample2() {
- double[] y = new double[] {1, 2, 3, 4};
+ double[] y = new double[] {1, 2, 3, 4};
double[][] x = new double[][] {
{19, 22, 33},
{20, 30, 40},
{25, 35, 45},
- {27, 37, 47}
+ {27, 37, 47}
};
OLSMultipleLinearRegression regression = new OLSMultipleLinearRegression();
regression.newSampleData(y, x);
@@ -487,7 +487,7 @@ public class OLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
regression.newYSampleData(y);
Assert.assertEquals(combinedX, regression.getX());
Assert.assertEquals(combinedY, regression.getY());
-
+
// No intercept
regression.setNoIntercept(true);
regression.newSampleData(y, x);
@@ -498,17 +498,17 @@ public class OLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
Assert.assertEquals(combinedX, regression.getX());
Assert.assertEquals(combinedY, regression.getY());
}
-
+
@Test(expected=IllegalArgumentException.class)
public void testNewSampleDataYNull() {
createRegression().newSampleData(null, new double[][] {});
}
-
+
@Test(expected=IllegalArgumentException.class)
public void testNewSampleDataXNull() {
createRegression().newSampleData(new double[] {}, null);
}
-
+
/*
* This is a test based on the Wampler1 data set
* http://www.itl.nist.gov/div898/strd/lls/data/Wampler1.shtml
@@ -568,7 +568,7 @@ public class OLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
new double[]{0.0,
0.0, 0.0,
0.0, 0.0,
- 0.0}, 1E-8);
+ 0.0}, 1E-8);
TestUtils.assertEquals(1.0, model.calculateRSquared(), 1.0e-10);
TestUtils.assertEquals(0, model.estimateErrorVariance(), 1.0e-7);
@@ -576,7 +576,7 @@ public class OLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
return;
}
-
+
/*
* This is a test based on the Wampler2 data set
* http://www.itl.nist.gov/div898/strd/lls/data/Wampler2.shtml
@@ -638,13 +638,13 @@ public class OLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
new double[]{0.0,
0.0, 0.0,
0.0, 0.0,
- 0.0}, 1E-8);
+ 0.0}, 1E-8);
TestUtils.assertEquals(1.0, model.calculateRSquared(), 1.0e-10);
TestUtils.assertEquals(0, model.estimateErrorVariance(), 1.0e-7);
TestUtils.assertEquals(0.00, model.calculateResidualSumOfSquares(), 1.0e-6);
return;
}
-
+
/*
* This is a test based on the Wampler3 data set
* http://www.itl.nist.gov/div898/strd/lls/data/Wampler3.shtml
@@ -699,7 +699,7 @@ public class OLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
1.0,
1.0,
1.0,
- 1.0}, 1E-8);
+ 1.0}, 1E-8);
double[] se = model.estimateRegressionParametersStandardErrors();
TestUtils.assertEquals(se,
@@ -768,21 +768,21 @@ public class OLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
1.0,
1.0,
1.0,
- 1.0}, 1E-6);
+ 1.0}, 1E-6);
double[] se = model.estimateRegressionParametersStandardErrors();
TestUtils.assertEquals(se,
new double[]{215232.624678170,
236355.173469681, 77934.3524331583,
10147.5507550350, 564.566512170752,
- 11.2324854679312}, 1E-8);
+ 11.2324854679312}, 1E-8);
TestUtils.assertEquals(.957478440825662, model.calculateRSquared(), 1.0e-10);
TestUtils.assertEquals(55702845333.3333, model.estimateErrorVariance(), 1.0e-4);
TestUtils.assertEquals(835542680000.000, model.calculateResidualSumOfSquares(), 1.0e-3);
return;
}
-
+
/**
* Anything requiring beta calculation should advertise SME.
*/
@@ -792,26 +792,26 @@ public class OLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
model.newSampleData(new double[] {1, 2, 3, 1, 2, 3, 1, 2, 3}, 3, 2);
model.calculateBeta();
}
-
+
@Test
public void testNoSSTOCalculateRsquare() {
OLSMultipleLinearRegression model = new OLSMultipleLinearRegression();
model.newSampleData(new double[] {1, 2, 3, 1, 7, 8, 1, 10, 12}, 3, 2);
Assert.assertTrue(Double.isNaN(model.calculateRSquared()));
}
-
+
@Test(expected=NullPointerException.class)
public void testNoDataNPECalculateBeta() {
OLSMultipleLinearRegression model = new OLSMultipleLinearRegression();
model.calculateBeta();
}
-
+
@Test(expected=NullPointerException.class)
public void testNoDataNPECalculateHat() {
OLSMultipleLinearRegression model = new OLSMultipleLinearRegression();
model.calculateHat();
}
-
+
@Test(expected=NullPointerException.class)
public void testNoDataNPESSTO() {
OLSMultipleLinearRegression model = new OLSMultipleLinearRegression();
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/stat/regression/SimpleRegressionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/stat/regression/SimpleRegressionTest.java b/src/test/java/org/apache/commons/math3/stat/regression/SimpleRegressionTest.java
index 063e06b..e79ab6a 100644
--- a/src/test/java/org/apache/commons/math3/stat/regression/SimpleRegressionTest.java
+++ b/src/test/java/org/apache/commons/math3/stat/regression/SimpleRegressionTest.java
@@ -547,7 +547,7 @@ public final class SimpleRegressionTest {
Assert.assertTrue(regression.getSlope() > 0.0);
Assert.assertTrue(regression.getSumSquaredErrors() >= 0.0);
}
-
+
@Test
public void testPerfect2() {
SimpleRegression regression = new SimpleRegression();
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/util/CombinationsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/util/CombinationsTest.java b/src/test/java/org/apache/commons/math3/util/CombinationsTest.java
index 99b8e60..da52951 100644
--- a/src/test/java/org/apache/commons/math3/util/CombinationsTest.java
+++ b/src/test/java/org/apache/commons/math3/util/CombinationsTest.java
@@ -145,7 +145,7 @@ public class CombinationsTest {
* Verifies that the iterator generates a lexicographically
* increasing sequence of b(n,k) arrays, each having length k
* and each array itself increasing.
- *
+ *
* @param c Combinations.
*/
private void checkLexicographicIterator(Combinations c) {
@@ -177,7 +177,7 @@ public class CombinationsTest {
Assert.assertEquals(CombinatoricsUtils.binomialCoefficient(n, k),
numIterates);
}
-
+
@Test
public void testCombinationsIteratorFail() {
try {
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/util/FastMathTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/util/FastMathTest.java b/src/test/java/org/apache/commons/math3/util/FastMathTest.java
index 2df5542..2d7607d 100644
--- a/src/test/java/org/apache/commons/math3/util/FastMathTest.java
+++ b/src/test/java/org/apache/commons/math3/util/FastMathTest.java
@@ -182,14 +182,14 @@ public class FastMathTest {
for (double x = start; x < end; x += 1e-3) {
final double tst = FastMath.cosh(x);
final double ref = Math.cosh(x);
- maxErr = FastMath.max(maxErr, FastMath.abs(ref - tst) / FastMath.ulp(ref));
+ maxErr = FastMath.max(maxErr, FastMath.abs(ref - tst) / FastMath.ulp(ref));
}
Assert.assertEquals(0, maxErr, 3);
for (double x = start; x < end; x += 1e-3) {
final double tst = FastMath.sinh(x);
final double ref = Math.sinh(x);
- maxErr = FastMath.max(maxErr, FastMath.abs(ref - tst) / FastMath.ulp(ref));
+ maxErr = FastMath.max(maxErr, FastMath.abs(ref - tst) / FastMath.ulp(ref));
}
Assert.assertEquals(0, maxErr, 3);
}
@@ -204,18 +204,18 @@ public class FastMathTest {
for (double x = start; x > end; x -= 1e-3) {
final double tst = FastMath.cosh(x);
final double ref = Math.cosh(x);
- maxErr = FastMath.max(maxErr, FastMath.abs(ref - tst) / FastMath.ulp(ref));
+ maxErr = FastMath.max(maxErr, FastMath.abs(ref - tst) / FastMath.ulp(ref));
}
Assert.assertEquals(0, maxErr, 3);
for (double x = start; x > end; x -= 1e-3) {
final double tst = FastMath.sinh(x);
final double ref = Math.sinh(x);
- maxErr = FastMath.max(maxErr, FastMath.abs(ref - tst) / FastMath.ulp(ref));
+ maxErr = FastMath.max(maxErr, FastMath.abs(ref - tst) / FastMath.ulp(ref));
}
Assert.assertEquals(0, maxErr, 3);
}
-
+
@Test
public void testMath1269() {
final double arg = 709.8125;
@@ -1027,13 +1027,13 @@ public class FastMathTest {
*/
@Test
public void testAcosSpecialCases() {
-
+
Assert.assertTrue("acos(NaN) should be NaN", Double.isNaN(FastMath.acos(Double.NaN)));
-
+
Assert.assertTrue("acos(-1.1) should be NaN", Double.isNaN(FastMath.acos(-1.1)));
Assert.assertTrue("acos(-1.1) should be NaN", Double.isNaN(FastMath.acos(1.1)));
-
+
Assert.assertEquals("acos(-1.0) should be PI", FastMath.acos(-1.0), FastMath.PI, Precision.EPSILON);
Assert.assertEquals("acos(1.0) should be 0.0", FastMath.acos(1.0), 0.0, Precision.EPSILON);
@@ -1046,13 +1046,13 @@ public class FastMathTest {
*/
@Test
public void testAsinSpecialCases() {
-
+
Assert.assertTrue("asin(NaN) should be NaN", Double.isNaN(FastMath.asin(Double.NaN)));
-
+
Assert.assertTrue("asin(1.1) should be NaN", Double.isNaN(FastMath.asin(1.1)));
-
+
Assert.assertTrue("asin(-1.1) should be NaN", Double.isNaN(FastMath.asin(-1.1)));
-
+
Assert.assertEquals("asin(1.0) should be PI/2", FastMath.asin(1.0), FastMath.PI / 2.0, Precision.EPSILON);
Assert.assertEquals("asin(-1.0) should be -PI/2", FastMath.asin(-1.0), -FastMath.PI / 2.0, Precision.EPSILON);
@@ -1458,7 +1458,7 @@ public class FastMathTest {
public void testIntPowLongMinValue() {
Assert.assertEquals(1.0, FastMath.pow(1.0, Long.MIN_VALUE), -1.0);
}
-
+
@Test(timeout=5000L)
public void testIntPowSpecialCases() {
final double EXACT = -1.0;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/util/IncrementorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/util/IncrementorTest.java b/src/test/java/org/apache/commons/math3/util/IncrementorTest.java
index 0c7d4fb..382b0fc 100644
--- a/src/test/java/org/apache/commons/math3/util/IncrementorTest.java
+++ b/src/test/java/org/apache/commons/math3/util/IncrementorTest.java
@@ -134,4 +134,4 @@ public class IncrementorTest {
i.incrementCount(1);
Assert.assertEquals(3, i.getCount());
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/util/ResizableDoubleArrayTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/util/ResizableDoubleArrayTest.java b/src/test/java/org/apache/commons/math3/util/ResizableDoubleArrayTest.java
index 3a1a1d7..1a7b45a 100644
--- a/src/test/java/org/apache/commons/math3/util/ResizableDoubleArrayTest.java
+++ b/src/test/java/org/apache/commons/math3/util/ResizableDoubleArrayTest.java
@@ -61,11 +61,11 @@ public class ResizableDoubleArrayTest extends DoubleArrayAbstractTest {
} catch (IllegalArgumentException ex) {
// expected
}
-
+
testDa = new ResizableDoubleArray((double[]) null);
Assert.assertEquals(0, testDa.getNumElements());
-
- double[] initialArray = new double[] { 0, 1, 2 };
+
+ double[] initialArray = new double[] { 0, 1, 2 };
testDa = new ResizableDoubleArray(initialArray);
Assert.assertEquals(3, testDa.getNumElements());
@@ -125,14 +125,14 @@ public class ResizableDoubleArrayTest extends DoubleArrayAbstractTest {
ResizableDoubleArray copyDa = new ResizableDoubleArray(testDa);
Assert.assertEquals(copyDa, testDa);
Assert.assertEquals(testDa, copyDa);
-
+
// JIRA: MATH-1252
final double[] values = {1};
testDa = new ResizableDoubleArray(values);
Assert.assertArrayEquals(values, testDa.getElements(), 0);
Assert.assertEquals(1, testDa.getNumElements());
Assert.assertEquals(1, testDa.getElement(0), 0);
-
+
}
@@ -205,24 +205,24 @@ public class ResizableDoubleArrayTest extends DoubleArrayAbstractTest {
"16 and an expansion factor of 2.0",
1024, ((ResizableDoubleArray) da).getCapacity());
}
-
+
@Test
public void testAddElements() {
ResizableDoubleArray testDa = new ResizableDoubleArray();
-
+
// MULTIPLICATIVE_MODE
testDa.addElements(new double[] {4, 5, 6});
Assert.assertEquals(3, testDa.getNumElements(), 0);
Assert.assertEquals(4, testDa.getElement(0), 0);
Assert.assertEquals(5, testDa.getElement(1), 0);
Assert.assertEquals(6, testDa.getElement(2), 0);
-
+
testDa.addElements(new double[] {4, 5, 6});
Assert.assertEquals(6, testDa.getNumElements());
// ADDITIVE_MODE (x's are occupied storage locations, 0's are open)
testDa = new ResizableDoubleArray(2, 2.0, 2.5,
- ResizableDoubleArray.ExpansionMode.ADDITIVE);
+ ResizableDoubleArray.ExpansionMode.ADDITIVE);
Assert.assertEquals(2, testDa.getCapacity());
testDa.addElements(new double[] { 1d }); // x,0
testDa.addElements(new double[] { 2d }); // x,x
[4/4] [math] Removed trailing spaces. No code change.
Posted by ps...@apache.org.
Removed trailing spaces. No code change.
Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/ff35e6f2
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/ff35e6f2
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/ff35e6f2
Branch: refs/heads/MATH_3_X
Commit: ff35e6f27ee4976f4091ebdd4c9b715134c35e11
Parents: 654d723
Author: Phil Steitz <ph...@gmail.com>
Authored: Fri Nov 27 11:10:39 2015 -0700
Committer: Phil Steitz <ph...@gmail.com>
Committed: Fri Nov 27 11:10:39 2015 -0700
----------------------------------------------------------------------
.../math3/analysis/FunctionUtilsTest.java | 8 +-
.../DerivativeStructureTest.java | 16 +--
.../FiniteDifferencesDifferentiatorTest.java | 14 +--
.../differentiation/GradientFunctionTest.java | 4 +-
.../differentiation/JacobianFunctionTest.java | 4 +-
.../differentiation/SparseGradientTest.java | 4 +-
.../math3/analysis/function/GaussianTest.java | 2 +-
.../math3/analysis/function/LogisticTest.java | 8 +-
.../math3/analysis/function/SigmoidTest.java | 2 +-
.../analysis/function/StepFunctionTest.java | 8 +-
.../integration/MidPointIntegratorTest.java | 4 +-
.../BicubicSplineInterpolatingFunctionTest.java | 18 +--
.../BicubicSplineInterpolatorTest.java | 6 +-
...PolynomialBicubicSplineInterpolatorTest.java | 8 +-
.../TricubicInterpolatingFunctionTest.java | 4 +-
...TricubicSplineInterpolatingFunctionTest.java | 16 +--
.../TricubicSplineInterpolatorTest.java | 12 +-
.../PolynomialSplineFunctionTest.java | 2 +-
.../polynomials/PolynomialsUtilsTest.java | 2 +-
.../commons/math3/complex/QuaternionTest.java | 2 +-
.../apache/commons/math3/dfp/DfpDecTest.java | 6 +-
.../apache/commons/math3/dfp/DfpMathTest.java | 122 +++++++++----------
.../distribution/BinomialDistributionTest.java | 4 +-
.../ConstantRealDistributionTest.java | 4 +-
.../EnumeratedIntegerDistributionTest.java | 2 +-
.../EnumeratedRealDistributionTest.java | 8 +-
.../distribution/GeometricDistributionTest.java | 2 +-
.../HypergeometricDistributionTest.java | 14 +--
.../KolmogorovSmirnovDistributionTest.java | 8 +-
.../distribution/LevyDistributionTest.java | 2 +-
.../MultivariateNormalDistributionTest.java | 2 +-
.../distribution/PoissonDistributionTest.java | 2 +-
.../RealDistributionAbstractTest.java | 12 +-
.../math3/distribution/TDistributionTest.java | 4 +-
.../UniformRealDistributionTest.java | 10 +-
...ormalMixtureExpectationMaximizationTest.java | 10 +-
.../DimensionMismatchExceptionTest.java | 2 +-
.../MaxCountExceededExceptionTest.java | 2 +-
.../NonMonotonicSequenceExceptionTest.java | 2 +-
.../exception/NotPositiveExceptionTest.java | 2 +-
.../NotStrictlyPositiveExceptionTest.java | 2 +-
.../NumberIsTooLargeExceptionTest.java | 2 +-
.../NumberIsTooSmallExceptionTest.java | 2 +-
.../exception/OutOfRangeExceptionTest.java | 2 +-
.../TooManyEvaluationsExceptionTest.java | 2 +-
.../math3/exception/util/ArgUtilsTest.java | 2 +-
.../exception/util/ExceptionContextTest.java | 2 +-
.../commons/math3/filter/KalmanFilterTest.java | 50 ++++----
.../math3/fitting/GaussianCurveFitterTest.java | 16 +--
.../math3/fitting/GaussianFitterTest.java | 16 +--
.../math3/fitting/HarmonicCurveFitterTest.java | 2 +-
.../fitting/PolynomialCurveFitterTest.java | 2 +-
.../math3/fitting/SimpleCurveFitterTest.java | 2 +-
.../fitting/leastsquares/CircleProblem.java | 2 +-
.../fitting/leastsquares/CircleVectorial.java | 2 +-
.../math3/fitting/leastsquares/MinpackTest.java | 4 +-
.../commons/math3/fraction/BigFractionTest.java | 4 +-
.../math3/genetics/CycleCrossoverTest.java | 4 +-
.../math3/genetics/DummyListChromosome.java | 2 +-
.../genetics/ElitisticListPopulationTest.java | 10 +-
.../math3/genetics/ListPopulationTest.java | 26 ++--
.../math3/genetics/NPointCrossoverTest.java | 16 +--
.../math3/genetics/OrderedCrossoverTest.java | 6 +-
.../commons/math3/genetics/RandomKeyTest.java | 2 +-
.../math3/genetics/UniformCrossoverTest.java | 14 +--
.../euclidean/threed/FieldVector3DTest.java | 6 +-
.../geometry/euclidean/threed/LineTest.java | 2 +-
.../euclidean/threed/PolyhedronsSetTest.java | 26 ++--
.../geometry/euclidean/threed/RotationTest.java | 2 +-
.../euclidean/threed/SphereGeneratorTest.java | 2 +-
.../threed/SphericalCoordinatesTest.java | 2 +-
.../geometry/euclidean/threed/SubLineTest.java | 2 +-
.../geometry/euclidean/threed/Vector3DTest.java | 6 +-
.../euclidean/twod/DiskGeneratorTest.java | 2 +-
.../euclidean/twod/PolygonsSetTest.java | 12 +-
.../geometry/euclidean/twod/Vector2DTest.java | 6 +-
.../hull/ConvexHullGenerator2DAbstractTest.java | 18 +--
.../geometry/partitioning/RegionDumper.java | 2 +-
.../geometry/partitioning/RegionParser.java | 2 +-
.../geometry/spherical/twod/CircleTest.java | 4 +-
.../math3/linear/Array2DRowRealMatrixTest.java | 2 +-
.../math3/linear/DiagonalMatrixTest.java | 6 +-
.../math3/linear/EigenDecompositionTest.java | 20 +--
.../math3/linear/HessenbergTransformerTest.java | 10 +-
.../MatrixDimensionMismatchExceptionTest.java | 2 +-
.../commons/math3/linear/MatrixUtilsTest.java | 16 +--
.../math3/linear/QRDecompositionTest.java | 2 +-
.../commons/math3/linear/RRQRSolverTest.java | 4 +-
.../RectangularCholeskyDecompositionTest.java | 2 +-
.../math3/linear/SchurTransformerTest.java | 6 +-
.../ml/clustering/DBSCANClustererTest.java | 10 +-
.../clustering/KMeansPlusPlusClustererTest.java | 12 +-
.../MultiKMeansPlusPlusClustererTest.java | 2 +-
.../evaluation/SumOfClusterVariancesTest.java | 4 +-
.../commons/math3/ml/neuralnet/NetworkTest.java | 4 +-
.../ml/neuralnet/OffsetFeatureInitializer.java | 2 +-
.../neuralnet/sofm/KohonenTrainingTaskTest.java | 2 +-
.../sofm/TravellingSalesmanSolver.java | 2 +-
.../commons/math3/ode/JacobianMatricesTest.java | 2 +-
.../math3/ode/events/EventStateTest.java | 16 +--
.../nonstiff/HighamHall54IntegratorTest.java | 2 +-
.../sampling/StepNormalizerOutputTestBase.java | 8 +-
.../math3/optim/SimplePointCheckerTest.java | 2 +-
.../math3/optim/SimpleValueCheckerTest.java | 2 +-
.../math3/optim/linear/SimplexSolverTest.java | 40 +++---
.../scalar/noderiv/BOBYQAOptimizerTest.java | 40 +++---
.../scalar/noderiv/CMAESOptimizerTest.java | 12 +-
...stractLeastSquaresOptimizerAbstractTest.java | 2 +-
.../vector/jacobian/CircleProblem.java | 2 +-
.../nonlinear/vector/jacobian/MinpackTest.java | 2 +-
.../optim/univariate/BrentOptimizerTest.java | 2 +-
.../MultiStartUnivariateOptimizerTest.java | 2 +-
.../SimpleUnivariateValueCheckerTest.java | 2 +-
.../optimization/SimplePointCheckerTest.java | 2 +-
.../optimization/SimpleValueCheckerTest.java | 2 +-
.../direct/BOBYQAOptimizerTest.java | 40 +++---
.../optimization/direct/CMAESOptimizerTest.java | 14 +--
.../fitting/GaussianFitterTest.java | 16 +--
...stractLeastSquaresOptimizerAbstractTest.java | 2 +-
...NonLinearConjugateGradientOptimizerTest.java | 2 +-
.../optimization/linear/SimplexSolverTest.java | 26 ++--
.../univariate/BrentOptimizerTest.java | 2 +-
.../SimpleUnivariateValueCheckerTest.java | 2 +-
.../UnivariateMultiStartOptimizerTest.java | 2 +-
.../apache/commons/math3/primes/PrimesTest.java | 2 +-
.../random/AbstractRandomGeneratorTest.java | 4 +-
.../math3/random/BitsStreamGeneratorTest.java | 16 +--
.../CorrelatedRandomVectorGeneratorTest.java | 8 +-
.../math3/random/EmpiricalDistributionTest.java | 60 ++++-----
.../random/HaltonSequenceGeneratorTest.java | 4 +-
.../math3/random/MersenneTwisterTest.java | 4 +-
.../commons/math3/random/RandomAdaptorTest.java | 6 +-
.../random/RandomGeneratorAbstractTest.java | 2 +-
.../random/SobolSequenceGeneratorTest.java | 8 +-
.../math3/random/StableRandomGeneratorTest.java | 6 +-
.../UnitSphereRandomVectorGeneratorTest.java | 2 +-
.../commons/math3/random/ValueServerTest.java | 8 +-
.../commons/math3/random/Well19937aTest.java | 2 +-
.../commons/math3/random/Well19937cTest.java | 2 +-
.../commons/math3/random/Well44497aTest.java | 4 +-
.../commons/math3/random/Well44497bTest.java | 4 +-
.../commons/math3/random/Well512aTest.java | 2 +-
.../commons/math3/special/BesselJTest.java | 6 +-
.../apache/commons/math3/special/ErfTest.java | 54 ++++----
.../commons/math3/stat/FrequencyTest.java | 36 +++---
.../commons/math3/stat/StatUtilsTest.java | 16 +--
.../stat/clustering/DBSCANClustererTest.java | 10 +-
.../clustering/KMeansPlusPlusClustererTest.java | 8 +-
.../SpearmansRankCorrelationTest.java | 4 +-
.../correlation/StorelessCovarianceTest.java | 10 +-
.../descriptive/DescriptiveStatisticsTest.java | 2 +-
.../StatisticalSummaryValuesTest.java | 2 +-
...torelessUnivariateStatisticAbstractTest.java | 2 +-
.../stat/descriptive/SummaryStatisticsTest.java | 20 +--
.../UnivariateStatisticAbstractTest.java | 4 +-
.../descriptive/rank/PSquarePercentileTest.java | 4 +-
.../stat/descriptive/rank/PercentileTest.java | 4 +-
.../stat/descriptive/summary/ProductTest.java | 2 +-
.../stat/descriptive/summary/SumLogTest.java | 4 +-
.../stat/descriptive/summary/SumSqTest.java | 2 +-
.../math3/stat/descriptive/summary/SumTest.java | 2 +-
.../commons/math3/stat/inference/GTestTest.java | 14 +--
.../stat/inference/MannWhitneyUTestTest.java | 14 +--
.../math3/stat/inference/TestUtilsTest.java | 6 +-
.../inference/WilcoxonSignedRankTestTest.java | 36 +++---
.../stat/interval/AgrestiCoullIntervalTest.java | 2 +-
.../BinomialConfidenceIntervalAbstractTest.java | 4 +-
.../interval/ClopperPearsonIntervalTest.java | 2 +-
.../math3/stat/interval/IntervalUtilsTest.java | 4 +-
.../NormalApproximationIntervalTest.java | 2 +-
.../stat/interval/WilsonScoreIntervalTest.java | 2 +-
.../math3/stat/ranking/NaturalRankingTest.java | 14 +--
.../GLSMultipleLinearRegressionTest.java | 44 +++----
.../MillerUpdatingRegressionTest.java | 34 +++---
.../MultipleLinearRegressionAbstractTest.java | 20 +--
.../OLSMultipleLinearRegressionTest.java | 88 ++++++-------
.../stat/regression/SimpleRegressionTest.java | 2 +-
.../commons/math3/util/CombinationsTest.java | 4 +-
.../apache/commons/math3/util/FastMathTest.java | 26 ++--
.../commons/math3/util/IncrementorTest.java | 2 +-
.../math3/util/ResizableDoubleArrayTest.java | 18 +--
181 files changed, 840 insertions(+), 840 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/analysis/FunctionUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/analysis/FunctionUtilsTest.java b/src/test/java/org/apache/commons/math3/analysis/FunctionUtilsTest.java
index 5e2bc96..8c66189 100644
--- a/src/test/java/org/apache/commons/math3/analysis/FunctionUtilsTest.java
+++ b/src/test/java/org/apache/commons/math3/analysis/FunctionUtilsTest.java
@@ -273,11 +273,11 @@ public class FunctionUtilsTest {
public void testToDifferentiableMultivariateFunction() {
MultivariateDifferentiableFunction hypot = new MultivariateDifferentiableFunction() {
-
+
public double value(double[] point) {
return FastMath.hypot(point[0], point[1]);
}
-
+
public DerivativeStructure value(DerivativeStructure[] point) {
return DerivativeStructure.hypot(point[0], point[1]);
}
@@ -300,7 +300,7 @@ public class FunctionUtilsTest {
public void testToMultivariateDifferentiableFunction() {
DifferentiableMultivariateFunction hypot = new DifferentiableMultivariateFunction() {
-
+
public double value(double[] point) {
return FastMath.hypot(point[0], point[1]);
}
@@ -321,7 +321,7 @@ public class FunctionUtilsTest {
}
};
}
-
+
};
MultivariateDifferentiableFunction converted = FunctionUtils.toMultivariateDifferentiableFunction(hypot);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/analysis/differentiation/DerivativeStructureTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/analysis/differentiation/DerivativeStructureTest.java b/src/test/java/org/apache/commons/math3/analysis/differentiation/DerivativeStructureTest.java
index 39b4d5f..91f2310 100644
--- a/src/test/java/org/apache/commons/math3/analysis/differentiation/DerivativeStructureTest.java
+++ b/src/test/java/org/apache/commons/math3/analysis/differentiation/DerivativeStructureTest.java
@@ -375,7 +375,7 @@ public class DerivativeStructureTest extends ExtendedFieldElementAbstractTest<De
FastMath.abs(epsilon * dfdxdydz));
}
-
+
}
}
}
@@ -395,17 +395,17 @@ public class DerivativeStructureTest extends ExtendedFieldElementAbstractTest<De
double f1 = 1 / (2 * FastMath.sqrt(x * y));
Assert.assertEquals(f1, f.getPartialDerivative(1), FastMath.abs(epsilon * f1));
if (f.getOrder() > 1) {
- double f2 = -f1 / (2 * x);
+ double f2 = -f1 / (2 * x);
Assert.assertEquals(f2, f.getPartialDerivative(2), FastMath.abs(epsilon * f2));
if (f.getOrder() > 2) {
- double f3 = (f0 + x / (2 * y * f0)) / (4 * x * x * x);
+ double f3 = (f0 + x / (2 * y * f0)) / (4 * x * x * x);
Assert.assertEquals(f3, f.getPartialDerivative(3), FastMath.abs(epsilon * f3));
}
}
}
}
}
- }
+ }
}
@Test
@@ -447,7 +447,7 @@ public class DerivativeStructureTest extends ExtendedFieldElementAbstractTest<De
}
}
}
- }
+ }
}
}
@@ -1102,17 +1102,17 @@ public class DerivativeStructureTest extends ExtendedFieldElementAbstractTest<De
double f1 = -x / (2 * y * y * f0);
Assert.assertEquals(f1, f.getPartialDerivative(1), FastMath.abs(epsilon * f1));
if (f.getOrder() > 1) {
- double f2 = (f0 - x / (4 * y * f0)) / (y * y);
+ double f2 = (f0 - x / (4 * y * f0)) / (y * y);
Assert.assertEquals(f2, f.getPartialDerivative(2), FastMath.abs(epsilon * f2));
if (f.getOrder() > 2) {
- double f3 = (x / (8 * y * f0) - 2 * f0) / (y * y * y);
+ double f3 = (x / (8 * y * f0) - 2 * f0) / (y * y * y);
Assert.assertEquals(f3, f.getPartialDerivative(3), FastMath.abs(epsilon * f3));
}
}
}
}
}
- }
+ }
}
@Test
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/analysis/differentiation/FiniteDifferencesDifferentiatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/analysis/differentiation/FiniteDifferencesDifferentiatorTest.java b/src/test/java/org/apache/commons/math3/analysis/differentiation/FiniteDifferencesDifferentiatorTest.java
index 9702305..2e17796 100644
--- a/src/test/java/org/apache/commons/math3/analysis/differentiation/FiniteDifferencesDifferentiatorTest.java
+++ b/src/test/java/org/apache/commons/math3/analysis/differentiation/FiniteDifferencesDifferentiatorTest.java
@@ -153,7 +153,7 @@ public class FiniteDifferencesDifferentiatorTest {
// the 1.0e-6 step size is far too small for finite differences in the quintic on this abscissa range for 7 points
// the errors are huge!
final double[] expectedBad = new double[] {
- 2.910e-11, 2.087e-5, 147.7, 3.820e7, 6.354e14, 6.548e19, 1.543e27
+ 2.910e-11, 2.087e-5, 147.7, 3.820e7, 6.354e14, 6.548e19, 1.543e27
};
for (int i = 0; i < maxErrorGood.length; ++i) {
@@ -255,11 +255,11 @@ public class FiniteDifferencesDifferentiatorTest {
// here, we did set the bounds, so evaluations are done within domain
// using f(0.0), f(0.1), f(0.2)
Assert.assertEquals(slope, properlyBounded.value(tLow).getPartialDerivative(1), 1.0e-10);
-
+
// here, we did set the bounds, so evaluations are done within domain
// using f(0.8), f(0.9), f(1.0)
Assert.assertEquals(slope, properlyBounded.value(tHigh).getPartialDerivative(1), 1.0e-10);
-
+
}
@Test
@@ -290,11 +290,11 @@ public class FiniteDifferencesDifferentiatorTest {
new FiniteDifferencesDifferentiator(7, 0.01);
UnivariateDifferentiableVectorFunction f =
differentiator.differentiate(new UnivariateVectorFunction() {
-
+
public double[] value(double x) {
return new double[] { FastMath.cos(x), FastMath.sin(x) };
}
-
+
});
for (double x = -10; x < 10; x += 0.1) {
@@ -325,14 +325,14 @@ public class FiniteDifferencesDifferentiatorTest {
new FiniteDifferencesDifferentiator(7, 0.01);
UnivariateDifferentiableMatrixFunction f =
differentiator.differentiate(new UnivariateMatrixFunction() {
-
+
public double[][] value(double x) {
return new double[][] {
{ FastMath.cos(x), FastMath.sin(x) },
{ FastMath.cosh(x), FastMath.sinh(x) }
};
}
-
+
});
for (double x = -1; x < 1; x += 0.02) {
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/analysis/differentiation/GradientFunctionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/analysis/differentiation/GradientFunctionTest.java b/src/test/java/org/apache/commons/math3/analysis/differentiation/GradientFunctionTest.java
index 7faf9b6..18fbe1d 100644
--- a/src/test/java/org/apache/commons/math3/analysis/differentiation/GradientFunctionTest.java
+++ b/src/test/java/org/apache/commons/math3/analysis/differentiation/GradientFunctionTest.java
@@ -56,7 +56,7 @@ public class GradientFunctionTest {
}
private static class EuclideanDistance implements MultivariateDifferentiableFunction {
-
+
public double value(double[] point) {
double d2 = 0;
for (double x : point) {
@@ -64,7 +64,7 @@ public class GradientFunctionTest {
}
return FastMath.sqrt(d2);
}
-
+
public DerivativeStructure value(DerivativeStructure[] point)
throws DimensionMismatchException, MathIllegalArgumentException {
DerivativeStructure d2 = point[0].getField().getZero();
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/analysis/differentiation/JacobianFunctionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/analysis/differentiation/JacobianFunctionTest.java b/src/test/java/org/apache/commons/math3/analysis/differentiation/JacobianFunctionTest.java
index b7c00fe..15625a4 100644
--- a/src/test/java/org/apache/commons/math3/analysis/differentiation/JacobianFunctionTest.java
+++ b/src/test/java/org/apache/commons/math3/analysis/differentiation/JacobianFunctionTest.java
@@ -54,7 +54,7 @@ public class JacobianFunctionTest {
public SphereMapping(final double radius) {
this.radius = radius;
}
-
+
public double[] value(double[] point) {
final double cLat = FastMath.cos(point[0]);
final double sLat = FastMath.sin(point[0]);
@@ -66,7 +66,7 @@ public class JacobianFunctionTest {
radius * sLat
};
}
-
+
public DerivativeStructure[] value(DerivativeStructure[] point) {
final DerivativeStructure cLat = point[0].cos();
final DerivativeStructure sLat = point[0].sin();
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/analysis/differentiation/SparseGradientTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/analysis/differentiation/SparseGradientTest.java b/src/test/java/org/apache/commons/math3/analysis/differentiation/SparseGradientTest.java
index 559da87..a6eac4f 100644
--- a/src/test/java/org/apache/commons/math3/analysis/differentiation/SparseGradientTest.java
+++ b/src/test/java/org/apache/commons/math3/analysis/differentiation/SparseGradientTest.java
@@ -308,7 +308,7 @@ public class SparseGradientTest extends ExtendedFieldElementAbstractTest<SparseG
Assert.assertEquals(dfdx, sg.getDerivative(0), FastMath.abs(epsilon * dfdx));
}
-
+
}
}
}
@@ -352,7 +352,7 @@ public class SparseGradientTest extends ExtendedFieldElementAbstractTest<SparseG
Assert.assertEquals(dfdz, f.getDerivative(2), FastMath.abs(epsilon * dfdz));
}
}
- }
+ }
}
@Test
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/analysis/function/GaussianTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/analysis/function/GaussianTest.java b/src/test/java/org/apache/commons/math3/analysis/function/GaussianTest.java
index ef7536d..c580cf0 100644
--- a/src/test/java/org/apache/commons/math3/analysis/function/GaussianTest.java
+++ b/src/test/java/org/apache/commons/math3/analysis/function/GaussianTest.java
@@ -80,7 +80,7 @@ public class GaussianTest {
Assert.assertEquals(0, f.value(new DerivativeStructure(1, 1, 0, 1e2)).getPartialDerivative(1), 0);
Assert.assertEquals(0, f.value(new DerivativeStructure(1, 1, 0, 1e50)).getPartialDerivative(1), 0);
Assert.assertEquals(0, f.value(new DerivativeStructure(1, 1, 0, Double.MAX_VALUE)).getPartialDerivative(1), 0);
- Assert.assertEquals(0, f.value(new DerivativeStructure(1, 1, 0, Double.POSITIVE_INFINITY)).getPartialDerivative(1), 0);
+ Assert.assertEquals(0, f.value(new DerivativeStructure(1, 1, 0, Double.POSITIVE_INFINITY)).getPartialDerivative(1), 0);
}
@Test
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/analysis/function/LogisticTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/analysis/function/LogisticTest.java b/src/test/java/org/apache/commons/math3/analysis/function/LogisticTest.java
index f721719..0e992d2 100644
--- a/src/test/java/org/apache/commons/math3/analysis/function/LogisticTest.java
+++ b/src/test/java/org/apache/commons/math3/analysis/function/LogisticTest.java
@@ -87,7 +87,7 @@ public class LogisticTest {
final Logistic f = new Logistic(k, 0, 1, 1, a, 1);
final Sigmoid g = new Sigmoid(a, k);
-
+
final double min = -10;
final double max = 10;
final double n = 20;
@@ -147,7 +147,7 @@ public class LogisticTest {
final Logistic.Parametric f = new Logistic.Parametric();
// Compare using the "Sigmoid" function.
final Sigmoid.Parametric g = new Sigmoid.Parametric();
-
+
final double x = 0.12345;
final double[] gf = f.gradient(x, new double[] {k, 0, 1, 1, a, 1});
final double[] gg = g.gradient(x, new double[] {a, k});
@@ -166,7 +166,7 @@ public class LogisticTest {
final double n = 3.4;
final Logistic.Parametric f = new Logistic.Parametric();
-
+
final double x = m - 1;
final double qExp1 = 2;
@@ -186,7 +186,7 @@ public class LogisticTest {
final double n = 3.4;
final Logistic.Parametric f = new Logistic.Parametric();
-
+
final double x = 0;
final double qExp1 = 2;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/analysis/function/SigmoidTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/analysis/function/SigmoidTest.java b/src/test/java/org/apache/commons/math3/analysis/function/SigmoidTest.java
index 59f6312..b1e505c 100644
--- a/src/test/java/org/apache/commons/math3/analysis/function/SigmoidTest.java
+++ b/src/test/java/org/apache/commons/math3/analysis/function/SigmoidTest.java
@@ -70,7 +70,7 @@ public class SigmoidTest {
Assert.assertEquals(0, f.value(new DerivativeStructure(1, 1, 0, 1e3)).getPartialDerivative(1), 0);
Assert.assertEquals(0, f.value(new DerivativeStructure(1, 1, 0, 1e50)).getPartialDerivative(1), 0);
Assert.assertEquals(0, f.value(new DerivativeStructure(1, 1, 0, Double.MAX_VALUE)).getPartialDerivative(1), 0);
- Assert.assertEquals(0, f.value(new DerivativeStructure(1, 1, 0, Double.POSITIVE_INFINITY)).getPartialDerivative(1), 0);
+ Assert.assertEquals(0, f.value(new DerivativeStructure(1, 1, 0, Double.POSITIVE_INFINITY)).getPartialDerivative(1), 0);
}
@Test(expected=NullArgumentException.class)
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/analysis/function/StepFunctionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/analysis/function/StepFunctionTest.java b/src/test/java/org/apache/commons/math3/analysis/function/StepFunctionTest.java
index 247a0a9..92a2097 100644
--- a/src/test/java/org/apache/commons/math3/analysis/function/StepFunctionTest.java
+++ b/src/test/java/org/apache/commons/math3/analysis/function/StepFunctionTest.java
@@ -78,7 +78,7 @@ public class StepFunctionTest {
Assert.assertEquals(51.2, f.value(30), EPS);
Assert.assertEquals(51.2, f.value(Double.POSITIVE_INFINITY), EPS);
}
-
+
@Test
public void testEndpointBehavior() {
final double[] x = {0, 1, 2, 3};
@@ -93,15 +93,15 @@ public class StepFunctionTest {
for (int i = 0; i < x.length; i++) {
Assert.assertEquals(y[i], f.value(x[i]), EPS);
if (i > 0) {
- Assert.assertEquals(y[i - 1], f.value(x[i] - 0.5), EPS);
+ Assert.assertEquals(y[i - 1], f.value(x[i] - 0.5), EPS);
} else {
- Assert.assertEquals(y[0], f.value(x[i] - 0.5), EPS);
+ Assert.assertEquals(y[0], f.value(x[i] - 0.5), EPS);
}
}
}
@Test
- public void testHeaviside() {
+ public void testHeaviside() {
final UnivariateFunction h = new StepFunction(new double[] {-1, 0},
new double[] {0, 1});
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/analysis/integration/MidPointIntegratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/analysis/integration/MidPointIntegratorTest.java b/src/test/java/org/apache/commons/math3/analysis/integration/MidPointIntegratorTest.java
index 36daa3e..c6f9ca8 100644
--- a/src/test/java/org/apache/commons/math3/analysis/integration/MidPointIntegratorTest.java
+++ b/src/test/java/org/apache/commons/math3/analysis/integration/MidPointIntegratorTest.java
@@ -41,7 +41,7 @@ public final class MidPointIntegratorTest {
public void testLowAccuracy() {
UnivariateFunction f = new QuinticFunction();
UnivariateIntegrator integrator = new MidPointIntegrator(0.01, 1.0e-10, 2, 4);
-
+
double min = -10;
double max = -9;
double expected = -3697001.0 / 48.0;
@@ -60,7 +60,7 @@ public final class MidPointIntegratorTest {
public void testSinFunction() {
UnivariateFunction f = new Sin();
UnivariateIntegrator integrator = new MidPointIntegrator();
-
+
double min = 0;
double max = FastMath.PI;
double expected = 2;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/analysis/interpolation/BicubicSplineInterpolatingFunctionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/analysis/interpolation/BicubicSplineInterpolatingFunctionTest.java b/src/test/java/org/apache/commons/math3/analysis/interpolation/BicubicSplineInterpolatingFunctionTest.java
index 8c78aed..24aa0f4 100644
--- a/src/test/java/org/apache/commons/math3/analysis/interpolation/BicubicSplineInterpolatingFunctionTest.java
+++ b/src/test/java/org/apache/commons/math3/analysis/interpolation/BicubicSplineInterpolatingFunctionTest.java
@@ -29,7 +29,7 @@ import org.junit.Ignore;
/**
* Test case for the bicubic function.
- *
+ *
*/
public final class BicubicSplineInterpolatingFunctionTest {
/**
@@ -44,7 +44,7 @@ public final class BicubicSplineInterpolatingFunctionTest {
@SuppressWarnings("unused")
BivariateFunction bcf = new BicubicSplineInterpolatingFunction(xval, yval, zval,
zval, zval, zval);
-
+
double[] wxval = new double[] {3, 2, 5, 6.5};
try {
bcf = new BicubicSplineInterpolatingFunction(wxval, yval, zval, zval, zval, zval);
@@ -239,7 +239,7 @@ public final class BicubicSplineInterpolatingFunctionTest {
dZdX, dZdY, dZdXdY);
double x, y;
double expected, result;
-
+
x = 4;
y = -3;
expected = f.value(x, y);
@@ -295,7 +295,7 @@ public final class BicubicSplineInterpolatingFunctionTest {
};
Assert.assertEquals("dFdX", derivative.value(x, y),
f.partialDerivativeX().value(x, y), tol);
-
+
derivative = new BivariateFunction() {
public double value(double x, double y) {
final double x2 = x * x;
@@ -385,7 +385,7 @@ public final class BicubicSplineInterpolatingFunctionTest {
BivariateFunction dfdX = new BivariateFunction() {
public double value(double x, double y) {
final double x2 = x * x;
- final double y2 = y * y;
+ final double y2 = y * y;
return - 3 - y + 4 * x + 8 * x * y - y2 - 9 * x2;
}
};
@@ -399,7 +399,7 @@ public final class BicubicSplineInterpolatingFunctionTest {
BivariateFunction dfdY = new BivariateFunction() {
public double value(double x, double y) {
final double x2 = x * x;
- final double y2 = y * y;
+ final double y2 = y * y;
return 2 - x - 6 * y + 4 * x2 - 2 * x * y + 3 * y2;
}
};
@@ -432,7 +432,7 @@ public final class BicubicSplineInterpolatingFunctionTest {
x = val[i];
for (int j = 0; j < sz; j++) {
y = val[j];
-
+
expected = dfdX.value(x, y);
result = bcf.partialDerivativeX(x, y);
Assert.assertEquals(x + " " + y + " dFdX", expected, result, tol);
@@ -440,7 +440,7 @@ public final class BicubicSplineInterpolatingFunctionTest {
expected = dfdY.value(x, y);
result = bcf.partialDerivativeY(x, y);
Assert.assertEquals(x + " " + y + " dFdY", expected, result, tol);
-
+
expected = d2fdXdY.value(x, y);
result = bcf.partialDerivativeXY(x, y);
Assert.assertEquals(x + " " + y + " d2FdXdY", expected, result, tol);
@@ -637,7 +637,7 @@ public final class BicubicSplineInterpolatingFunctionTest {
Assert.assertTrue(bcf.isValidPoint(x, y));
// Ensure that no exception is thrown.
bcf.value(x, y);
-
+
final double xRange = xMax - xMin;
final double yRange = yMax - yMin;
x = xMin + xRange / 3.4;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/analysis/interpolation/BicubicSplineInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/analysis/interpolation/BicubicSplineInterpolatorTest.java b/src/test/java/org/apache/commons/math3/analysis/interpolation/BicubicSplineInterpolatorTest.java
index c4a56bb..3a3852f 100644
--- a/src/test/java/org/apache/commons/math3/analysis/interpolation/BicubicSplineInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math3/analysis/interpolation/BicubicSplineInterpolatorTest.java
@@ -27,7 +27,7 @@ import org.junit.Test;
/**
* Test case for the bicubic interpolator.
- *
+ *
*/
public final class BicubicSplineInterpolatorTest {
/**
@@ -40,10 +40,10 @@ public final class BicubicSplineInterpolatorTest {
double[][] zval = new double[xval.length][yval.length];
BivariateGridInterpolator interpolator = new BicubicSplineInterpolator();
-
+
@SuppressWarnings("unused")
BivariateFunction p = interpolator.interpolate(xval, yval, zval);
-
+
double[] wxval = new double[] {3, 2, 5, 6.5};
try {
p = interpolator.interpolate(wxval, yval, zval);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/analysis/interpolation/SmoothingPolynomialBicubicSplineInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/analysis/interpolation/SmoothingPolynomialBicubicSplineInterpolatorTest.java b/src/test/java/org/apache/commons/math3/analysis/interpolation/SmoothingPolynomialBicubicSplineInterpolatorTest.java
index 51c9760..1977b11 100644
--- a/src/test/java/org/apache/commons/math3/analysis/interpolation/SmoothingPolynomialBicubicSplineInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math3/analysis/interpolation/SmoothingPolynomialBicubicSplineInterpolatorTest.java
@@ -25,7 +25,7 @@ import org.junit.Test;
/**
* Test case for the smoothing bicubic interpolator.
- *
+ *
*/
public final class SmoothingPolynomialBicubicSplineInterpolatorTest {
/**
@@ -38,10 +38,10 @@ public final class SmoothingPolynomialBicubicSplineInterpolatorTest {
double[][] zval = new double[xval.length][yval.length];
BivariateGridInterpolator interpolator = new SmoothingPolynomialBicubicSplineInterpolator(0);
-
+
@SuppressWarnings("unused")
BivariateFunction p = interpolator.interpolate(xval, yval, zval);
-
+
double[] wxval = new double[] {3, 2, 5, 6.5};
try {
p = interpolator.interpolate(wxval, yval, zval);
@@ -109,7 +109,7 @@ public final class SmoothingPolynomialBicubicSplineInterpolatorTest {
BivariateFunction p = interpolator.interpolate(xval, yval, zval);
double x, y;
double expected, result;
-
+
x = 4;
y = -3;
expected = f.value(x, y);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/analysis/interpolation/TricubicInterpolatingFunctionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/analysis/interpolation/TricubicInterpolatingFunctionTest.java b/src/test/java/org/apache/commons/math3/analysis/interpolation/TricubicInterpolatingFunctionTest.java
index 9760555..0b5a3e5 100644
--- a/src/test/java/org/apache/commons/math3/analysis/interpolation/TricubicInterpolatingFunctionTest.java
+++ b/src/test/java/org/apache/commons/math3/analysis/interpolation/TricubicInterpolatingFunctionTest.java
@@ -29,7 +29,7 @@ import org.junit.Test;
/**
* Test case for the bicubic function.
- *
+ *
*/
public final class TricubicInterpolatingFunctionTest {
/**
@@ -46,7 +46,7 @@ public final class TricubicInterpolatingFunctionTest {
TrivariateFunction tcf = new TricubicInterpolatingFunction(xval, yval, zval,
fval, fval, fval, fval,
fval, fval, fval, fval);
-
+
double[] wxval = new double[] {3, 2, 5, 6.5};
try {
tcf = new TricubicInterpolatingFunction(wxval, yval, zval,
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/analysis/interpolation/TricubicSplineInterpolatingFunctionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/analysis/interpolation/TricubicSplineInterpolatingFunctionTest.java b/src/test/java/org/apache/commons/math3/analysis/interpolation/TricubicSplineInterpolatingFunctionTest.java
index 90bce9e..c6ee8af 100644
--- a/src/test/java/org/apache/commons/math3/analysis/interpolation/TricubicSplineInterpolatingFunctionTest.java
+++ b/src/test/java/org/apache/commons/math3/analysis/interpolation/TricubicSplineInterpolatingFunctionTest.java
@@ -25,7 +25,7 @@ import org.junit.Test;
/**
* Test case for the bicubic function.
- *
+ *
*/
public final class TricubicSplineInterpolatingFunctionTest {
/**
@@ -42,7 +42,7 @@ public final class TricubicSplineInterpolatingFunctionTest {
TrivariateFunction tcf = new TricubicSplineInterpolatingFunction(xval, yval, zval,
fval, fval, fval, fval,
fval, fval, fval, fval);
-
+
double[] wxval = new double[] {3, 2, 5, 6.5};
try {
tcf = new TricubicSplineInterpolatingFunction(wxval, yval, zval,
@@ -383,19 +383,19 @@ public final class TricubicSplineInterpolatingFunctionTest {
double[] xval = new double[] {3, 4, 5, 6.5};
double[] yval = new double[] {-4, -3, -1, 2, 2.5};
double[] zval = new double[] {-12, -8, -5.5, -3, 0, 4};
-
+
final double a = 0.2;
final double omega = 0.5;
final double kx = 2;
final double ky = 1;
-
+
// Function values
TrivariateFunction f = new TrivariateFunction() {
public double value(double x, double y, double z) {
return a * FastMath.cos(omega * z - kx * x - ky * y);
}
};
-
+
double[][][] fval = new double[xval.length][yval.length][zval.length];
for (int i = 0; i < xval.length; i++) {
for (int j = 0; j < yval.length; j++) {
@@ -404,7 +404,7 @@ public final class TricubicSplineInterpolatingFunctionTest {
}
}
}
-
+
// Partial derivatives with respect to x
double[][][] dFdX = new double[xval.length][yval.length][zval.length];
TrivariateFunction dFdX_f = new TrivariateFunction() {
@@ -419,7 +419,7 @@ public final class TricubicSplineInterpolatingFunctionTest {
}
}
}
-
+
// Partial derivatives with respect to y
double[][][] dFdY = new double[xval.length][yval.length][zval.length];
TrivariateFunction dFdY_f = new TrivariateFunction() {
@@ -516,7 +516,7 @@ public final class TricubicSplineInterpolatingFunctionTest {
d3FdXdYdZ);
double x, y, z;
double expected, result;
-
+
x = 4;
y = -3;
z = 0;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/analysis/interpolation/TricubicSplineInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/analysis/interpolation/TricubicSplineInterpolatorTest.java b/src/test/java/org/apache/commons/math3/analysis/interpolation/TricubicSplineInterpolatorTest.java
index 6de42a2..a747cca 100644
--- a/src/test/java/org/apache/commons/math3/analysis/interpolation/TricubicSplineInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math3/analysis/interpolation/TricubicSplineInterpolatorTest.java
@@ -26,7 +26,7 @@ import org.junit.Ignore;
/**
* Test case for the tricubic interpolator.
- *
+ *
*/
public final class TricubicSplineInterpolatorTest {
/**
@@ -40,10 +40,10 @@ public final class TricubicSplineInterpolatorTest {
double[][][] fval = new double[xval.length][yval.length][zval.length];
TrivariateGridInterpolator interpolator = new TricubicSplineInterpolator();
-
+
@SuppressWarnings("unused")
TrivariateFunction p = interpolator.interpolate(xval, yval, zval, fval);
-
+
double[] wxval = new double[] {3, 2, 5, 6.5};
try {
p = interpolator.interpolate(wxval, yval, zval, fval);
@@ -121,7 +121,7 @@ public final class TricubicSplineInterpolatorTest {
TrivariateFunction p = interpolator.interpolate(xval, yval, zval, fval);
double x, y, z;
double expected, result;
-
+
x = 4;
y = -3;
z = 0;
@@ -169,7 +169,7 @@ public final class TricubicSplineInterpolatorTest {
return a * FastMath.cos(omega * z - kx * x - ky * y);
}
};
-
+
double[][][] fval = new double[xval.length][yval.length][zval.length];
for (int i = 0; i < xval.length; i++) {
for (int j = 0; j < yval.length; j++) {
@@ -184,7 +184,7 @@ public final class TricubicSplineInterpolatorTest {
TrivariateFunction p = interpolator.interpolate(xval, yval, zval, fval);
double x, y, z;
double expected, result;
-
+
x = 4;
y = -3;
z = 0;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/analysis/polynomials/PolynomialSplineFunctionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/analysis/polynomials/PolynomialSplineFunctionTest.java b/src/test/java/org/apache/commons/math3/analysis/polynomials/PolynomialSplineFunctionTest.java
index b353a73..708968a 100644
--- a/src/test/java/org/apache/commons/math3/analysis/polynomials/PolynomialSplineFunctionTest.java
+++ b/src/test/java/org/apache/commons/math3/analysis/polynomials/PolynomialSplineFunctionTest.java
@@ -151,7 +151,7 @@ public class PolynomialSplineFunctionTest {
Assert.assertTrue(spline.isValidPoint(x));
// Ensure that no exception is thrown.
spline.value(x);
-
+
final double xRange = xMax - xMin;
x = xMin + xRange / 3.4;
Assert.assertTrue(spline.isValidPoint(x));
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/analysis/polynomials/PolynomialsUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/analysis/polynomials/PolynomialsUtilsTest.java b/src/test/java/org/apache/commons/math3/analysis/polynomials/PolynomialsUtilsTest.java
index e87804b..0997fd3 100644
--- a/src/test/java/org/apache/commons/math3/analysis/polynomials/PolynomialsUtilsTest.java
+++ b/src/test/java/org/apache/commons/math3/analysis/polynomials/PolynomialsUtilsTest.java
@@ -329,7 +329,7 @@ public class PolynomialsUtilsTest {
PolynomialFunction f1xM1
= new PolynomialFunction(PolynomialsUtils.shift(f1x.getCoefficients(), -1));
checkPolynomial(f1xM1, "2 - 3 x + 2 x^2");
-
+
PolynomialFunction f1x3
= new PolynomialFunction(PolynomialsUtils.shift(f1x.getCoefficients(), 3));
checkPolynomial(f1x3, "22 + 13 x + 2 x^2");
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/complex/QuaternionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/complex/QuaternionTest.java b/src/test/java/org/apache/commons/math3/complex/QuaternionTest.java
index b81e260..0f9cf3a 100644
--- a/src/test/java/org/apache/commons/math3/complex/QuaternionTest.java
+++ b/src/test/java/org/apache/commons/math3/complex/QuaternionTest.java
@@ -84,7 +84,7 @@ public class QuaternionTest {
public void testWrongDimension() {
new Quaternion(new double[] { 1, 2 });
}
-
+
@Test
public final void testConjugate() {
final double q0 = 2;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/dfp/DfpDecTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/dfp/DfpDecTest.java b/src/test/java/org/apache/commons/math3/dfp/DfpDecTest.java
index fc65fd7..2f4d33c 100644
--- a/src/test/java/org/apache/commons/math3/dfp/DfpDecTest.java
+++ b/src/test/java/org/apache/commons/math3/dfp/DfpDecTest.java
@@ -44,13 +44,13 @@ public class DfpDecTest {
ninf = null;
}
- // Generic test function. Takes params x and y and tests them for
+ // Generic test function. Takes params x and y and tests them for
// equality. Then checks the status flags against the flags argument.
// If the test fail, it prints the desc string
private void test(Dfp x, Dfp y, int flags, String desc) {
boolean b = x.equals(y);
- if (!x.equals(y) && !x.unequal(y)) // NaNs involved
+ if (!x.equals(y) && !x.unequal(y)) // NaNs involved
b = (x.toString().equals(y.toString()));
if (x.equals(new DfpDec(field, 0))) // distinguish +/- zero
@@ -553,7 +553,7 @@ public class DfpDecTest {
new DfpDec(field, "-0"),
DfpField.FLAG_UNDERFLOW|DfpField.FLAG_INEXACT, "Next After #12");
- test(new DfpDec(field, "1e-131092").nextAfter(ninf),
+ test(new DfpDec(field, "1e-131092").nextAfter(ninf),
new DfpDec(field, "0"),
DfpField.FLAG_UNDERFLOW|DfpField.FLAG_INEXACT, "Next After #13");
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/dfp/DfpMathTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/dfp/DfpMathTest.java b/src/test/java/org/apache/commons/math3/dfp/DfpMathTest.java
index 832a808..c61cfbc 100644
--- a/src/test/java/org/apache/commons/math3/dfp/DfpMathTest.java
+++ b/src/test/java/org/apache/commons/math3/dfp/DfpMathTest.java
@@ -53,14 +53,14 @@ public class DfpMathTest {
qnan = null;
}
- // Generic test function. Takes params x and y and tests them for
+ // Generic test function. Takes params x and y and tests them for
// equality. Then checks the status flags against the flags argument.
// If the test fail, it prints the desc string
private void test(Dfp x, Dfp y, int flags, String desc)
{
boolean b = x.equals(y);
- if (!x.equals(y) && !x.unequal(y)) // NaNs involved
+ if (!x.equals(y) && !x.unequal(y)) // NaNs involved
b = (x.toString().equals(y.toString()));
if (x.equals(factory.newDfp("0"))) // distinguish +/- zero
@@ -75,109 +75,109 @@ public class DfpMathTest {
}
@Test
- public void testPow()
+ public void testPow()
{
// Test special cases exponent of zero
- test(DfpMath.pow(factory.newDfp("0"), factory.newDfp("0")),
- factory.newDfp("1"),
+ test(DfpMath.pow(factory.newDfp("0"), factory.newDfp("0")),
+ factory.newDfp("1"),
0, "pow #1");
- test(DfpMath.pow(factory.newDfp("0"), factory.newDfp("-0")),
- factory.newDfp("1"),
+ test(DfpMath.pow(factory.newDfp("0"), factory.newDfp("-0")),
+ factory.newDfp("1"),
0, "pow #2");
- test(DfpMath.pow(factory.newDfp("2"), factory.newDfp("0")),
- factory.newDfp("1"),
+ test(DfpMath.pow(factory.newDfp("2"), factory.newDfp("0")),
+ factory.newDfp("1"),
0, "pow #3");
- test(DfpMath.pow(factory.newDfp("-2"), factory.newDfp("-0")),
- factory.newDfp("1"),
+ test(DfpMath.pow(factory.newDfp("-2"), factory.newDfp("-0")),
+ factory.newDfp("1"),
0, "pow #4");
- test(DfpMath.pow(pinf, factory.newDfp("-0")),
- factory.newDfp("1"),
+ test(DfpMath.pow(pinf, factory.newDfp("-0")),
+ factory.newDfp("1"),
0, "pow #5");
test(DfpMath.pow(pinf, factory.newDfp("0")),
- factory.newDfp("1"),
+ factory.newDfp("1"),
0, "pow #6");
- test(DfpMath.pow(ninf, factory.newDfp("-0")),
- factory.newDfp("1"),
+ test(DfpMath.pow(ninf, factory.newDfp("-0")),
+ factory.newDfp("1"),
0, "pow #7");
test(DfpMath.pow(ninf, factory.newDfp("0")),
- factory.newDfp("1"),
+ factory.newDfp("1"),
0, "pow #8");
test(DfpMath.pow(qnan, factory.newDfp("0")),
- factory.newDfp("1"),
+ factory.newDfp("1"),
0, "pow #8");
// exponent of one
test(DfpMath.pow(factory.newDfp("0"), factory.newDfp("1")),
- factory.newDfp("0"),
+ factory.newDfp("0"),
0, "pow #9");
- test(DfpMath.pow(factory.newDfp("-0"), factory.newDfp("1")),
- factory.newDfp("-0"),
+ test(DfpMath.pow(factory.newDfp("-0"), factory.newDfp("1")),
+ factory.newDfp("-0"),
0, "pow #10");
test(DfpMath.pow(factory.newDfp("2"), factory.newDfp("1")),
- factory.newDfp("2"),
+ factory.newDfp("2"),
0, "pow #11");
test(DfpMath.pow(factory.newDfp("-2"), factory.newDfp("1")),
- factory.newDfp("-2"),
+ factory.newDfp("-2"),
0, "pow #12");
- test(DfpMath.pow(pinf, factory.newDfp("1")),
- pinf,
+ test(DfpMath.pow(pinf, factory.newDfp("1")),
+ pinf,
0, "pow #13");
test(DfpMath.pow(ninf, factory.newDfp("1")),
- ninf,
+ ninf,
0, "pow #14");
test(DfpMath.pow(qnan, factory.newDfp("1")),
- qnan,
+ qnan,
DfpField.FLAG_INVALID, "pow #14.1");
// exponent of NaN
test(DfpMath.pow(factory.newDfp("0"), qnan),
- qnan,
+ qnan,
DfpField.FLAG_INVALID, "pow #15");
- test(DfpMath.pow(factory.newDfp("-0"), qnan),
- qnan,
+ test(DfpMath.pow(factory.newDfp("-0"), qnan),
+ qnan,
DfpField.FLAG_INVALID, "pow #16");
test(DfpMath.pow(factory.newDfp("2"), qnan),
- qnan,
+ qnan,
DfpField.FLAG_INVALID, "pow #17");
test(DfpMath.pow(factory.newDfp("-2"), qnan),
- qnan,
+ qnan,
DfpField.FLAG_INVALID, "pow #18");
- test(DfpMath.pow(pinf, qnan),
- qnan,
+ test(DfpMath.pow(pinf, qnan),
+ qnan,
DfpField.FLAG_INVALID, "pow #19");
test(DfpMath.pow(ninf, qnan),
- qnan,
+ qnan,
DfpField.FLAG_INVALID, "pow #20");
test(DfpMath.pow(qnan, qnan),
- qnan,
+ qnan,
DfpField.FLAG_INVALID, "pow #21");
// radix of NaN
test(DfpMath.pow(qnan, factory.newDfp("1")),
- qnan,
+ qnan,
DfpField.FLAG_INVALID, "pow #22");
- test(DfpMath.pow(qnan, factory.newDfp("-1")),
+ test(DfpMath.pow(qnan, factory.newDfp("-1")),
qnan,
DfpField.FLAG_INVALID, "pow #23");
@@ -186,19 +186,19 @@ public class DfpMathTest {
DfpField.FLAG_INVALID, "pow #24");
test(DfpMath.pow(qnan, ninf),
- qnan,
+ qnan,
DfpField.FLAG_INVALID, "pow #25");
test(DfpMath.pow(qnan, qnan),
- qnan,
+ qnan,
DfpField.FLAG_INVALID, "pow #26");
// (x > 1) ^ pinf = pinf, (x < -1) ^ pinf = pinf
test(DfpMath.pow(factory.newDfp("2"), pinf),
- pinf,
+ pinf,
0, "pow #27");
- test(DfpMath.pow(factory.newDfp("-2"), pinf),
+ test(DfpMath.pow(factory.newDfp("-2"), pinf),
pinf,
0, "pow #28");
@@ -207,15 +207,15 @@ public class DfpMathTest {
0, "pow #29");
test(DfpMath.pow(ninf, pinf),
- pinf,
+ pinf,
0, "pow #30");
// (x > 1) ^ ninf = +0, (x < -1) ^ ninf = +0
test(DfpMath.pow(factory.newDfp("2"), ninf),
- factory.getZero(),
+ factory.getZero(),
0, "pow #31");
- test(DfpMath.pow(factory.newDfp("-2"), ninf),
+ test(DfpMath.pow(factory.newDfp("-2"), ninf),
factory.getZero(),
0, "pow #32");
@@ -224,41 +224,41 @@ public class DfpMathTest {
0, "pow #33");
test(DfpMath.pow(ninf, ninf),
- factory.getZero(),
+ factory.getZero(),
0, "pow #34");
// (-1 < x < 1) ^ pinf = 0
test(DfpMath.pow(factory.newDfp("0.5"), pinf),
- factory.getZero(),
+ factory.getZero(),
0, "pow #35");
- test(DfpMath.pow(factory.newDfp("-0.5"), pinf),
+ test(DfpMath.pow(factory.newDfp("-0.5"), pinf),
factory.getZero(),
0, "pow #36");
- // (-1 < x < 1) ^ ninf = pinf
+ // (-1 < x < 1) ^ ninf = pinf
test(DfpMath.pow(factory.newDfp("0.5"), ninf),
- pinf,
+ pinf,
0, "pow #37");
- test(DfpMath.pow(factory.newDfp("-0.5"), ninf),
+ test(DfpMath.pow(factory.newDfp("-0.5"), ninf),
pinf,
0, "pow #38");
// +/- 1 ^ +/-inf = NaN
test(DfpMath.pow(factory.getOne(), pinf),
- qnan,
+ qnan,
DfpField.FLAG_INVALID, "pow #39");
- test(DfpMath.pow(factory.getOne(), ninf),
+ test(DfpMath.pow(factory.getOne(), ninf),
qnan,
DfpField.FLAG_INVALID, "pow #40");
test(DfpMath.pow(factory.newDfp("-1"), pinf),
- qnan,
+ qnan,
DfpField.FLAG_INVALID, "pow #41");
- test(DfpMath.pow(factory.getOne().negate(), ninf),
+ test(DfpMath.pow(factory.getOne().negate(), ninf),
qnan,
DfpField.FLAG_INVALID, "pow #42");
@@ -352,7 +352,7 @@ public class DfpMathTest {
factory.newDfp("-0"),
DfpField.FLAG_INEXACT, "pow #62");
- // pinf ^ +anything = pinf
+ // pinf ^ +anything = pinf
test(DfpMath.pow(pinf, factory.newDfp("3")),
pinf,
0, "pow #63");
@@ -369,7 +369,7 @@ public class DfpMathTest {
pinf,
0, "pow #66");
- // pinf ^ -anything = +0
+ // pinf ^ -anything = +0
test(DfpMath.pow(pinf, factory.newDfp("-3")),
factory.getZero(),
@@ -442,7 +442,7 @@ public class DfpMathTest {
factory.newDfp("-0"),
DfpField.FLAG_INEXACT, "pow #82");
- // -anything ^ integer
+ // -anything ^ integer
test(DfpMath.pow(factory.newDfp("-2"), factory.newDfp("3")),
factory.newDfp("-8"),
DfpField.FLAG_INEXACT, "pow #83");
@@ -467,7 +467,7 @@ public class DfpMathTest {
// Some fractional cases.
test(DfpMath.pow(factory.newDfp("2"),factory.newDfp("1.5")),
- factory.newDfp("2.8284271247461901"),
+ factory.newDfp("2.8284271247461901"),
DfpField.FLAG_INEXACT, "pow #88");
}
@@ -543,10 +543,10 @@ public class DfpMathTest {
DfpField.FLAG_INEXACT, "sin #17");
test(DfpMath.sin(factory.newDfp("0.7")),
- factory.newDfp("0.64421768723769105367"),
+ factory.newDfp("0.64421768723769105367"),
DfpField.FLAG_INEXACT, "sin #18");
- test(DfpMath.sin(factory.newDfp("0.8")),
+ test(DfpMath.sin(factory.newDfp("0.8")),
factory.newDfp("0.71735609089952276163"),
DfpField.FLAG_INEXACT, "sin #19");
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/distribution/BinomialDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/distribution/BinomialDistributionTest.java b/src/test/java/org/apache/commons/math3/distribution/BinomialDistributionTest.java
index d6cb294..3817f88 100644
--- a/src/test/java/org/apache/commons/math3/distribution/BinomialDistributionTest.java
+++ b/src/test/java/org/apache/commons/math3/distribution/BinomialDistributionTest.java
@@ -29,7 +29,7 @@ public class BinomialDistributionTest extends IntegerDistributionAbstractTest {
public BinomialDistributionTest() {
setTolerance(1e-12);
}
-
+
// -------------- Implementations for abstract methods
// -----------------------
@@ -45,7 +45,7 @@ public class BinomialDistributionTest extends IntegerDistributionAbstractTest {
return new int[] { -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
}
- /**
+ /**
* Creates the default probability density test expected values.
* Reference values are from R, version 2.15.3.
*/
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/distribution/ConstantRealDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/distribution/ConstantRealDistributionTest.java b/src/test/java/org/apache/commons/math3/distribution/ConstantRealDistributionTest.java
index 1f3edb7..2eea53c 100644
--- a/src/test/java/org/apache/commons/math3/distribution/ConstantRealDistributionTest.java
+++ b/src/test/java/org/apache/commons/math3/distribution/ConstantRealDistributionTest.java
@@ -58,7 +58,7 @@ public class ConstantRealDistributionTest extends RealDistributionAbstractTest {
public double[] makeDensityTestValues() {
return new double[] {0, 0, 1};
}
-
+
/** Override default test, verifying that inverse cum is constant */
@Override
@Test
@@ -86,6 +86,6 @@ public class ConstantRealDistributionTest extends RealDistributionAbstractTest {
for (int i = 0; i < 10; i++) {
Assert.assertEquals(0, dist.sample(), 0);
}
-
+
}
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/distribution/EnumeratedIntegerDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/distribution/EnumeratedIntegerDistributionTest.java b/src/test/java/org/apache/commons/math3/distribution/EnumeratedIntegerDistributionTest.java
index 6948875..85aa5af 100644
--- a/src/test/java/org/apache/commons/math3/distribution/EnumeratedIntegerDistributionTest.java
+++ b/src/test/java/org/apache/commons/math3/distribution/EnumeratedIntegerDistributionTest.java
@@ -168,7 +168,7 @@ public class EnumeratedIntegerDistributionTest {
Assert.assertEquals(testDistribution.getNumericalVariance(),
sumOfSquares / n - FastMath.pow(sum / n, 2), 1e-2);
}
-
+
@Test
public void testCreateFromIntegers() {
final int[] data = new int[] {0, 1, 1, 2, 2, 2};
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/distribution/EnumeratedRealDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/distribution/EnumeratedRealDistributionTest.java b/src/test/java/org/apache/commons/math3/distribution/EnumeratedRealDistributionTest.java
index 4103c0b..e9155fe 100644
--- a/src/test/java/org/apache/commons/math3/distribution/EnumeratedRealDistributionTest.java
+++ b/src/test/java/org/apache/commons/math3/distribution/EnumeratedRealDistributionTest.java
@@ -33,7 +33,7 @@ import org.junit.Test;
/**
* Test class for {@link EnumeratedRealDistribution}.
- *
+ *
*/
public class EnumeratedRealDistributionTest {
@@ -240,11 +240,11 @@ public class EnumeratedRealDistributionTest {
// 14 18 21 28 31 33
//
// sum = 4+5+0+3+1+3 = 16
-
+
EnumeratedRealDistribution distribution = new EnumeratedRealDistribution(
new double[] { 14.0, 18.0, 21.0, 28.0, 31.0, 33.0 },
new double[] { 4.0 / 16.0, 5.0 / 16.0, 0.0 / 16.0, 3.0 / 16.0, 1.0 / 16.0, 3.0 / 16.0 });
-
+
assertEquals(14.0, distribution.inverseCumulativeProbability(0.0000), 0.0);
assertEquals(14.0, distribution.inverseCumulativeProbability(0.2500), 0.0);
assertEquals(33.0, distribution.inverseCumulativeProbability(1.0000), 0.0);
@@ -256,7 +256,7 @@ public class EnumeratedRealDistributionTest {
assertEquals(18.0, distribution.inverseCumulativeProbability(0.5625), 0.0);
assertEquals(28.0, distribution.inverseCumulativeProbability(0.7500), 0.0);
}
-
+
@Test
public void testCreateFromDoubles() {
final double[] data = new double[] {0, 1, 1, 2, 2, 2};
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/distribution/GeometricDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/distribution/GeometricDistributionTest.java b/src/test/java/org/apache/commons/math3/distribution/GeometricDistributionTest.java
index 2795ead..4d88911 100644
--- a/src/test/java/org/apache/commons/math3/distribution/GeometricDistributionTest.java
+++ b/src/test/java/org/apache/commons/math3/distribution/GeometricDistributionTest.java
@@ -31,7 +31,7 @@ public class GeometricDistributionTest extends IntegerDistributionAbstractTest {
public GeometricDistributionTest() {
setTolerance(1e-12);
}
-
+
// -------------- Implementations for abstract methods --------------------
/** Creates the default discrete distribution instance to use in tests. */
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/distribution/HypergeometricDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/distribution/HypergeometricDistributionTest.java b/src/test/java/org/apache/commons/math3/distribution/HypergeometricDistributionTest.java
index a5adbc2..465c3bf 100644
--- a/src/test/java/org/apache/commons/math3/distribution/HypergeometricDistributionTest.java
+++ b/src/test/java/org/apache/commons/math3/distribution/HypergeometricDistributionTest.java
@@ -39,7 +39,7 @@ public class HypergeometricDistributionTest extends IntegerDistributionAbstractT
public HypergeometricDistributionTest() {
setTolerance(1e-12);
}
-
+
//-------------- Implementations for abstract methods -----------------------
/** Creates the default discrete distribution instance to use in tests. */
@@ -54,7 +54,7 @@ public class HypergeometricDistributionTest extends IntegerDistributionAbstractT
return new int[] {-1, 0, 1, 2, 3, 4, 5, 10};
}
- /**
+ /**
* Creates the default probability density test expected values
* Reference values are from R, version 2.15.3.
*/
@@ -64,7 +64,7 @@ public class HypergeometricDistributionTest extends IntegerDistributionAbstractT
0.0992063492063, 0.00396825396825, 0d};
}
- /**
+ /**
* Creates the default probability log density test expected values
* Reference values are from R, version 2.14.1.
*/
@@ -81,7 +81,7 @@ public class HypergeometricDistributionTest extends IntegerDistributionAbstractT
return makeDensityTestPoints();
}
- /**
+ /**
* Creates the default cumulative probability density test expected values
* Reference values are from R, version 2.15.3.
*/
@@ -290,7 +290,7 @@ public class HypergeometricDistributionTest extends IntegerDistributionAbstractT
Assert.assertEquals(dist.getNumericalMean(), 55d * 200d / 3000d, tol);
Assert.assertEquals(dist.getNumericalVariance(), ( 200d * 55d * (3000d - 200d) * (3000d - 55d) ) / ( (3000d * 3000d * 2999d) ), tol);
}
-
+
@Test
public void testMath644() {
int N = 14761461; // population
@@ -299,10 +299,10 @@ public class HypergeometricDistributionTest extends IntegerDistributionAbstractT
int k = 0;
final HypergeometricDistribution dist = new HypergeometricDistribution(N, m, n);
-
+
Assert.assertTrue(Precision.compareTo(1.0, dist.upperCumulativeProbability(k), 1) == 0);
Assert.assertTrue(Precision.compareTo(dist.cumulativeProbability(k), 0.0, 1) > 0);
-
+
// another way to calculate the upper cumulative probability
double upper = 1.0 - dist.cumulativeProbability(k) + dist.probability(k);
Assert.assertTrue(Precision.compareTo(1.0, upper, 1) == 0);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/distribution/KolmogorovSmirnovDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/distribution/KolmogorovSmirnovDistributionTest.java b/src/test/java/org/apache/commons/math3/distribution/KolmogorovSmirnovDistributionTest.java
index 53f4ff8..2ff4bd5 100644
--- a/src/test/java/org/apache/commons/math3/distribution/KolmogorovSmirnovDistributionTest.java
+++ b/src/test/java/org/apache/commons/math3/distribution/KolmogorovSmirnovDistributionTest.java
@@ -26,18 +26,18 @@ import org.junit.Test;
*/
@Deprecated
public class KolmogorovSmirnovDistributionTest {
-
+
private static final double TOLERANCE = 10e-10;
@Test
public void testCumulativeDensityFunction() {
-
+
KolmogorovSmirnovDistribution dist;
-
+
/* The code below is generated using the R-script located in
* /src/test/R/KolmogorovSmirnovDistributionTestCases.R
*/
-
+
/* R version 2.11.1 (2010-05-31) */
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/distribution/LevyDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/distribution/LevyDistributionTest.java b/src/test/java/org/apache/commons/math3/distribution/LevyDistributionTest.java
index 3c32b9e..55c92c0 100644
--- a/src/test/java/org/apache/commons/math3/distribution/LevyDistributionTest.java
+++ b/src/test/java/org/apache/commons/math3/distribution/LevyDistributionTest.java
@@ -68,7 +68,7 @@ public class LevyDistributionTest extends RealDistributionAbstractTest {
};
}
- /**
+ /**
* Creates the default logarithmic probability density test expected values.
* Reference values are from R, version 2.14.1.
*/
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/distribution/MultivariateNormalDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/distribution/MultivariateNormalDistributionTest.java b/src/test/java/org/apache/commons/math3/distribution/MultivariateNormalDistributionTest.java
index f044cbd..2bd149d 100644
--- a/src/test/java/org/apache/commons/math3/distribution/MultivariateNormalDistributionTest.java
+++ b/src/test/java/org/apache/commons/math3/distribution/MultivariateNormalDistributionTest.java
@@ -137,7 +137,7 @@ public class MultivariateNormalDistributionTest {
public void testUnivariateDistribution() {
final double[] mu = { -1.5 };
final double[][] sigma = { { 1 } };
-
+
final MultivariateNormalDistribution multi = new MultivariateNormalDistribution(mu, sigma);
final NormalDistribution uni = new NormalDistribution(mu[0], sigma[0][0]);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/distribution/PoissonDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/distribution/PoissonDistributionTest.java b/src/test/java/org/apache/commons/math3/distribution/PoissonDistributionTest.java
index 63518d2..736b84a 100644
--- a/src/test/java/org/apache/commons/math3/distribution/PoissonDistributionTest.java
+++ b/src/test/java/org/apache/commons/math3/distribution/PoissonDistributionTest.java
@@ -66,7 +66,7 @@ public class PoissonDistributionTest extends IntegerDistributionAbstractTest {
0.156293451851d, 0.00529247667642d, 8.27746364655e-09};
}
- /**
+ /**
* Creates the default logarithmic probability density test expected values.
* Reference values are from R, version 2.14.1.
*/
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/distribution/RealDistributionAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/distribution/RealDistributionAbstractTest.java b/src/test/java/org/apache/commons/math3/distribution/RealDistributionAbstractTest.java
index 4fa94a9..4ca1fb8 100644
--- a/src/test/java/org/apache/commons/math3/distribution/RealDistributionAbstractTest.java
+++ b/src/test/java/org/apache/commons/math3/distribution/RealDistributionAbstractTest.java
@@ -325,7 +325,7 @@ public abstract class RealDistributionAbstractTest {
// expected
}
}
-
+
/**
* Test sampling
*/
@@ -342,7 +342,7 @@ public abstract class RealDistributionAbstractTest {
}
TestUtils.assertChiSquareAccept(expected, counts, 0.001);
}
-
+
/**
* Verify that density integrals match the distribution.
* The (filtered, sorted) cumulativeTestPoints array is used to source
@@ -381,7 +381,7 @@ public abstract class RealDistributionAbstractTest {
integrationTestPoints.get(i)), tol);
}
}
-
+
/**
* Verify that isSupportLowerBoundInclusvie returns true iff the lower bound
* is finite and density is non-NaN, non-infinite there.
@@ -395,9 +395,9 @@ public abstract class RealDistributionAbstractTest {
!Double.isInfinite(lowerBound) && !Double.isNaN(result) &&
!Double.isInfinite(result),
distribution.isSupportLowerBoundInclusive());
-
+
}
-
+
/**
* Verify that isSupportUpperBoundInclusvie returns true iff the upper bound
* is finite and density is non-NaN, non-infinite there.
@@ -411,7 +411,7 @@ public abstract class RealDistributionAbstractTest {
!Double.isInfinite(upperBound) && !Double.isNaN(result) &&
!Double.isInfinite(result),
distribution.isSupportUpperBoundInclusive());
-
+
}
@Test
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/distribution/TDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/distribution/TDistributionTest.java b/src/test/java/org/apache/commons/math3/distribution/TDistributionTest.java
index 2f50b70..c186f33 100644
--- a/src/test/java/org/apache/commons/math3/distribution/TDistributionTest.java
+++ b/src/test/java/org/apache/commons/math3/distribution/TDistributionTest.java
@@ -100,7 +100,7 @@ public class TDistributionTest extends RealDistributionAbstractTest {
new double[] {Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY});
verifyInverseCumulativeProbabilities();
}
-
+
@Test
public void testCumulativeProbablilityExtremes() {
TDistribution dist;
@@ -110,7 +110,7 @@ public class TDistributionTest extends RealDistributionAbstractTest {
dist.cumulativeProbability(Double.POSITIVE_INFINITY), Double.MIN_VALUE);
Assert.assertEquals(0,
dist.cumulativeProbability(Double.NEGATIVE_INFINITY), Double.MIN_VALUE);
- }
+ }
}
@Test
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/distribution/UniformRealDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/distribution/UniformRealDistributionTest.java b/src/test/java/org/apache/commons/math3/distribution/UniformRealDistributionTest.java
index 29f6a85..7bf3f4b 100644
--- a/src/test/java/org/apache/commons/math3/distribution/UniformRealDistributionTest.java
+++ b/src/test/java/org/apache/commons/math3/distribution/UniformRealDistributionTest.java
@@ -110,15 +110,15 @@ public class UniformRealDistributionTest extends RealDistributionAbstractTest {
Assert.assertEquals(dist.getNumericalMean(), 0.375, 0);
Assert.assertEquals(dist.getNumericalVariance(), 0.2552083333333333, 0);
}
-
- /**
- * Check accuracy of analytical inverse CDF. Fails if a solver is used
- * with the default accuracy.
+
+ /**
+ * Check accuracy of analytical inverse CDF. Fails if a solver is used
+ * with the default accuracy.
*/
@Test
public void testInverseCumulativeDistribution() {
UniformRealDistribution dist = new UniformRealDistribution(0, 1e-9);
-
+
Assert.assertEquals(2.5e-10, dist.inverseCumulativeProbability(0.25), 0);
}
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/distribution/fitting/MultivariateNormalMixtureExpectationMaximizationTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/distribution/fitting/MultivariateNormalMixtureExpectationMaximizationTest.java b/src/test/java/org/apache/commons/math3/distribution/fitting/MultivariateNormalMixtureExpectationMaximizationTest.java
index 75328fc..cfb2619 100644
--- a/src/test/java/org/apache/commons/math3/distribution/fitting/MultivariateNormalMixtureExpectationMaximizationTest.java
+++ b/src/test/java/org/apache/commons/math3/distribution/fitting/MultivariateNormalMixtureExpectationMaximizationTest.java
@@ -180,10 +180,10 @@ public class MultivariateNormalMixtureExpectationMaximizationTest {
.getComponents()) {
Assert.assertEquals(correctWeights[i], component.getFirst(),
Math.ulp(1d));
-
+
final double[] means = component.getValue().getMeans();
Assert.assertTrue(Arrays.equals(correctMeans[i], means));
-
+
final RealMatrix covMat = component.getValue().getCovariances();
Assert.assertEquals(correctCovMats[i], covMat);
i++;
@@ -197,12 +197,12 @@ public class MultivariateNormalMixtureExpectationMaximizationTest {
final double[][] data = getTestSamples();
final double correctLogLikelihood = -4.292431006791994;
final double[] correctWeights = new double[] { 0.2962324189652912, 0.7037675810347089 };
-
+
final double[][] correctMeans = new double[][]{
{-1.4213112715121132, 1.6924690505757753},
{4.213612224374709, 7.975621325853645}
};
-
+
final RealMatrix[] correctCovMats = new Array2DRowRealMatrix[2];
correctCovMats[0] = new Array2DRowRealMatrix(new double[][] {
{ 1.739356907285747, -0.5867644251487614 },
@@ -211,7 +211,7 @@ public class MultivariateNormalMixtureExpectationMaximizationTest {
correctCovMats[1] = new Array2DRowRealMatrix(new double[][] {
{ 4.245384898007161, 2.5797798966382155 },
{ 2.5797798966382155, 3.9200272522448367 } });
-
+
final MultivariateNormalDistribution[] correctMVNs = new MultivariateNormalDistribution[2];
correctMVNs[0] = new MultivariateNormalDistribution(correctMeans[0], correctCovMats[0].getData());
correctMVNs[1] = new MultivariateNormalDistribution(correctMeans[1], correctCovMats[1].getData());
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/exception/DimensionMismatchExceptionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/exception/DimensionMismatchExceptionTest.java b/src/test/java/org/apache/commons/math3/exception/DimensionMismatchExceptionTest.java
index 3ac51e9..4073bfe 100644
--- a/src/test/java/org/apache/commons/math3/exception/DimensionMismatchExceptionTest.java
+++ b/src/test/java/org/apache/commons/math3/exception/DimensionMismatchExceptionTest.java
@@ -21,7 +21,7 @@ import org.junit.Test;
/**
* Test for {@link DimensionMismatchException}.
- *
+ *
*/
public class DimensionMismatchExceptionTest {
@Test
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/exception/MaxCountExceededExceptionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/exception/MaxCountExceededExceptionTest.java b/src/test/java/org/apache/commons/math3/exception/MaxCountExceededExceptionTest.java
index ba0de1e..1a96d35 100644
--- a/src/test/java/org/apache/commons/math3/exception/MaxCountExceededExceptionTest.java
+++ b/src/test/java/org/apache/commons/math3/exception/MaxCountExceededExceptionTest.java
@@ -21,7 +21,7 @@ import org.junit.Test;
/**
* Test for {@link MaxCountExceededException}.
- *
+ *
*/
public class MaxCountExceededExceptionTest {
@Test
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/exception/NonMonotonicSequenceExceptionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/exception/NonMonotonicSequenceExceptionTest.java b/src/test/java/org/apache/commons/math3/exception/NonMonotonicSequenceExceptionTest.java
index 42c5460..08981dc 100644
--- a/src/test/java/org/apache/commons/math3/exception/NonMonotonicSequenceExceptionTest.java
+++ b/src/test/java/org/apache/commons/math3/exception/NonMonotonicSequenceExceptionTest.java
@@ -23,7 +23,7 @@ import org.junit.Test;
/**
* Test for {@link NonMonotonicSequenceException}.
- *
+ *
*/
public class NonMonotonicSequenceExceptionTest {
@Test
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/exception/NotPositiveExceptionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/exception/NotPositiveExceptionTest.java b/src/test/java/org/apache/commons/math3/exception/NotPositiveExceptionTest.java
index 6e4106c..d2fe973 100644
--- a/src/test/java/org/apache/commons/math3/exception/NotPositiveExceptionTest.java
+++ b/src/test/java/org/apache/commons/math3/exception/NotPositiveExceptionTest.java
@@ -21,7 +21,7 @@ import org.junit.Test;
/**
* Test for {@link NotPositiveException}.
- *
+ *
*/
public class NotPositiveExceptionTest {
@Test
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/exception/NotStrictlyPositiveExceptionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/exception/NotStrictlyPositiveExceptionTest.java b/src/test/java/org/apache/commons/math3/exception/NotStrictlyPositiveExceptionTest.java
index e313b15..d9c7bec 100644
--- a/src/test/java/org/apache/commons/math3/exception/NotStrictlyPositiveExceptionTest.java
+++ b/src/test/java/org/apache/commons/math3/exception/NotStrictlyPositiveExceptionTest.java
@@ -21,7 +21,7 @@ import org.junit.Test;
/**
* Test for {@link NotStrictlyPositiveException}.
- *
+ *
*/
public class NotStrictlyPositiveExceptionTest {
@Test
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/exception/NumberIsTooLargeExceptionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/exception/NumberIsTooLargeExceptionTest.java b/src/test/java/org/apache/commons/math3/exception/NumberIsTooLargeExceptionTest.java
index 5ebe49d..15c8820 100644
--- a/src/test/java/org/apache/commons/math3/exception/NumberIsTooLargeExceptionTest.java
+++ b/src/test/java/org/apache/commons/math3/exception/NumberIsTooLargeExceptionTest.java
@@ -21,7 +21,7 @@ import org.junit.Test;
/**
* Test for {@link NumberIsTooLargeException}.
- *
+ *
*/
public class NumberIsTooLargeExceptionTest {
@Test
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/exception/NumberIsTooSmallExceptionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/exception/NumberIsTooSmallExceptionTest.java b/src/test/java/org/apache/commons/math3/exception/NumberIsTooSmallExceptionTest.java
index b70032f..5e2295f 100644
--- a/src/test/java/org/apache/commons/math3/exception/NumberIsTooSmallExceptionTest.java
+++ b/src/test/java/org/apache/commons/math3/exception/NumberIsTooSmallExceptionTest.java
@@ -21,7 +21,7 @@ import org.junit.Test;
/**
* Test for {@link NumberIsTooSmallException}.
- *
+ *
*/
public class NumberIsTooSmallExceptionTest {
@Test
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/exception/OutOfRangeExceptionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/exception/OutOfRangeExceptionTest.java b/src/test/java/org/apache/commons/math3/exception/OutOfRangeExceptionTest.java
index deda254..21954e2 100644
--- a/src/test/java/org/apache/commons/math3/exception/OutOfRangeExceptionTest.java
+++ b/src/test/java/org/apache/commons/math3/exception/OutOfRangeExceptionTest.java
@@ -21,7 +21,7 @@ import org.junit.Test;
/**
* Test for {@link OutOfRangeException}.
- *
+ *
*/
public class OutOfRangeExceptionTest {
@Test
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/exception/TooManyEvaluationsExceptionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/exception/TooManyEvaluationsExceptionTest.java b/src/test/java/org/apache/commons/math3/exception/TooManyEvaluationsExceptionTest.java
index c21775e..596c469 100644
--- a/src/test/java/org/apache/commons/math3/exception/TooManyEvaluationsExceptionTest.java
+++ b/src/test/java/org/apache/commons/math3/exception/TooManyEvaluationsExceptionTest.java
@@ -23,7 +23,7 @@ import org.junit.Test;
/**
* Test for {@link TooManyEvaluationsException}.
- *
+ *
*/
public class TooManyEvaluationsExceptionTest {
@Test
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/exception/util/ArgUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/exception/util/ArgUtilsTest.java b/src/test/java/org/apache/commons/math3/exception/util/ArgUtilsTest.java
index d07708f..95dce1d 100644
--- a/src/test/java/org/apache/commons/math3/exception/util/ArgUtilsTest.java
+++ b/src/test/java/org/apache/commons/math3/exception/util/ArgUtilsTest.java
@@ -24,7 +24,7 @@ import org.junit.Test;
/**
* Test for {@link ArgUtils}.
- *
+ *
*/
public class ArgUtilsTest {
@Test
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/exception/util/ExceptionContextTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/exception/util/ExceptionContextTest.java b/src/test/java/org/apache/commons/math3/exception/util/ExceptionContextTest.java
index 91fe804..17a2163 100644
--- a/src/test/java/org/apache/commons/math3/exception/util/ExceptionContextTest.java
+++ b/src/test/java/org/apache/commons/math3/exception/util/ExceptionContextTest.java
@@ -29,7 +29,7 @@ import org.junit.Test;
/**
* Test for {@link ExceptionContext}.
- *
+ *
*/
public class ExceptionContextTest {
@Test
[3/4] [math] Removed trailing spaces. No code change.
Posted by ps...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/filter/KalmanFilterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/filter/KalmanFilterTest.java b/src/test/java/org/apache/commons/math3/filter/KalmanFilterTest.java
index f7a08c8..468eab6 100644
--- a/src/test/java/org/apache/commons/math3/filter/KalmanFilterTest.java
+++ b/src/test/java/org/apache/commons/math3/filter/KalmanFilterTest.java
@@ -34,12 +34,12 @@ import org.junit.Test;
*
*/
public class KalmanFilterTest {
-
+
@Test(expected=MatrixDimensionMismatchException.class)
public void testTransitionMeasurementMatrixMismatch() {
-
+
// A and H matrix do not match in dimensions
-
+
// A = [ 1 ]
RealMatrix A = new Array2DRowRealMatrix(new double[] { 1d });
// no control input
@@ -61,9 +61,9 @@ public class KalmanFilterTest {
@Test(expected=MatrixDimensionMismatchException.class)
public void testTransitionControlMatrixMismatch() {
-
+
// A and B matrix do not match in dimensions
-
+
// A = [ 1 ]
RealMatrix A = new Array2DRowRealMatrix(new double[] { 1d });
// B = [ 1 1 ]
@@ -82,11 +82,11 @@ public class KalmanFilterTest {
new KalmanFilter(pm, mm);
Assert.fail("transition and control matrix should not be compatible");
}
-
+
@Test
public void testConstant() {
// simulates a simple process with a constant state and no control input
-
+
double constantValue = 10d;
double measurementNoise = 0.1d;
double processNoise = 1e-5d;
@@ -247,30 +247,30 @@ public class KalmanFilterTest {
* Represents an idealized Cannonball only taking into account gravity.
*/
public static class Cannonball {
-
+
private final double[] gravity = { 0, -9.81 };
-
+
private final double[] velocity;
private final double[] location;
-
+
private double timeslice;
-
+
public Cannonball(double timeslice, double angle, double initialVelocity) {
this.timeslice = timeslice;
-
+
final double angleInRadians = FastMath.toRadians(angle);
this.velocity = new double[] {
initialVelocity * FastMath.cos(angleInRadians),
initialVelocity * FastMath.sin(angleInRadians)
};
-
+
this.location = new double[] { 0, 0 };
}
-
+
public double getX() {
return location[0];
}
-
+
public double getY() {
return location[1];
}
@@ -278,18 +278,18 @@ public class KalmanFilterTest {
public double getXVelocity() {
return velocity[0];
}
-
+
public double getYVelocity() {
return velocity[1];
}
-
+
public void step() {
// break gravitational force into a smaller time slice.
double[] slicedGravity = gravity.clone();
for ( int i = 0; i < slicedGravity.length; i++ ) {
slicedGravity[i] *= timeslice;
}
-
+
// apply the acceleration to velocity.
double[] slicedVelocity = velocity.clone();
for ( int i = 0; i < velocity.length; i++ ) {
@@ -321,7 +321,7 @@ public class KalmanFilterTest {
final double angle = 45;
final Cannonball cannonball = new Cannonball(dt, angle, initialVelocity);
-
+
final double speedX = cannonball.getXVelocity();
final double speedY = cannonball.getYVelocity();
@@ -333,7 +333,7 @@ public class KalmanFilterTest {
{ 1, dt, 0, 0 },
{ 0, 1, 0, 0 },
{ 0, 0, 1, dt },
- { 0, 0, 0, 1 }
+ { 0, 0, 0, 1 }
});
// The control vector, which adds acceleration to the kinematic equations.
@@ -359,7 +359,7 @@ public class KalmanFilterTest {
{ 0, 0, 1, 0 },
{ 0, 0, 0, 0 }
});
-
+
// our guess of the initial state.
final RealVector initialState = MatrixUtils.createRealVector(new double[] { 0, speedX, 0, speedY } );
@@ -374,7 +374,7 @@ public class KalmanFilterTest {
// we assume no process noise -> zero matrix
final RealMatrix Q = MatrixUtils.createRealMatrix(4, 4);
-
+
// the measurement covariance matrix
final RealMatrix R = MatrixUtils.createRealMatrix(new double[][] {
{ var, 0, 0, 0 },
@@ -394,13 +394,13 @@ public class KalmanFilterTest {
// get the "real" cannonball position
double x = cannonball.getX();
double y = cannonball.getY();
-
+
// apply measurement noise to current cannonball position
double nx = x + dist.sample();
double ny = y + dist.sample();
cannonball.step();
-
+
filter.predict(controlVector);
// correct the filter with our measurements
filter.correct(new double[] { nx, 0, ny, 0 } );
@@ -411,7 +411,7 @@ public class KalmanFilterTest {
}
// error covariance of the x/y-position should be already very low (< 3m std dev = 9 variance)
-
+
Assert.assertTrue(Precision.compareTo(filter.getErrorCovariance()[0][0],
9, 1e-6) < 0);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/fitting/GaussianCurveFitterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/fitting/GaussianCurveFitterTest.java b/src/test/java/org/apache/commons/math3/fitting/GaussianCurveFitterTest.java
index 153274b..e8c366b 100644
--- a/src/test/java/org/apache/commons/math3/fitting/GaussianCurveFitterTest.java
+++ b/src/test/java/org/apache/commons/math3/fitting/GaussianCurveFitterTest.java
@@ -236,7 +236,7 @@ public class GaussianCurveFitterTest {
public void testFit02() {
GaussianCurveFitter.create().fit(new WeightedObservedPoints().toList());
}
-
+
/**
* Two points is not enough observed points.
*/
@@ -248,7 +248,7 @@ public class GaussianCurveFitterTest {
{4.02804905, 664002.0}
}).toList());
}
-
+
/**
* Poor data: right of peak not symmetric with left of peak.
*/
@@ -260,8 +260,8 @@ public class GaussianCurveFitterTest {
Assert.assertEquals(233003.2967252038, parameters[0], 1e-4);
Assert.assertEquals(-10.654887521095983, parameters[1], 1e-4);
Assert.assertEquals(4.335937353196641, parameters[2], 1e-4);
- }
-
+ }
+
/**
* Poor data: long tails.
*/
@@ -274,7 +274,7 @@ public class GaussianCurveFitterTest {
Assert.assertEquals(-13.29641995105174, parameters[1], 1e-4);
Assert.assertEquals(1.7297330293549908, parameters[2], 1e-4);
}
-
+
/**
* Poor data: right of peak is missing.
*/
@@ -286,7 +286,7 @@ public class GaussianCurveFitterTest {
Assert.assertEquals(285250.66754309234, parameters[0], 1e-4);
Assert.assertEquals(-13.528375695228455, parameters[1], 1e-4);
Assert.assertEquals(1.5204344894331614, parameters[2], 1e-4);
- }
+ }
/**
* Basic with smaller dataset.
@@ -306,7 +306,7 @@ public class GaussianCurveFitterTest {
// The optimizer will try negative sigma values but "GaussianCurveFitter"
// will catch the raised exceptions and return NaN values instead.
- final double[] data = {
+ final double[] data = {
1.1143831578403364E-29,
4.95281403484594E-28,
1.1171347211930288E-26,
@@ -374,7 +374,7 @@ public class GaussianCurveFitterTest {
Assert.assertEquals(0.603770729862231, p[1], 1e-15);
Assert.assertEquals(1.0786447936766612, p[2], 1e-14);
}
-
+
/**
* Adds the specified points to specified <code>GaussianCurveFitter</code>
* instance.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/fitting/GaussianFitterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/fitting/GaussianFitterTest.java b/src/test/java/org/apache/commons/math3/fitting/GaussianFitterTest.java
index ddec57d..783680d 100644
--- a/src/test/java/org/apache/commons/math3/fitting/GaussianFitterTest.java
+++ b/src/test/java/org/apache/commons/math3/fitting/GaussianFitterTest.java
@@ -199,7 +199,7 @@ public class GaussianFitterTest {
GaussianFitter fitter = new GaussianFitter(new LevenbergMarquardtOptimizer());
fitter.fit();
}
-
+
/**
* Two points is not enough observed points.
*/
@@ -212,7 +212,7 @@ public class GaussianFitterTest {
fitter);
fitter.fit();
}
-
+
/**
* Poor data: right of peak not symmetric with left of peak.
*/
@@ -225,8 +225,8 @@ public class GaussianFitterTest {
Assert.assertEquals(233003.2967252038, parameters[0], 1e-4);
Assert.assertEquals(-10.654887521095983, parameters[1], 1e-4);
Assert.assertEquals(4.335937353196641, parameters[2], 1e-4);
- }
-
+ }
+
/**
* Poor data: long tails.
*/
@@ -240,7 +240,7 @@ public class GaussianFitterTest {
Assert.assertEquals(-13.29641995105174, parameters[1], 1e-4);
Assert.assertEquals(1.7297330293549908, parameters[2], 1e-4);
}
-
+
/**
* Poor data: right of peak is missing.
*/
@@ -253,7 +253,7 @@ public class GaussianFitterTest {
Assert.assertEquals(285250.66754309234, parameters[0], 1e-4);
Assert.assertEquals(-13.528375695228455, parameters[1], 1e-4);
Assert.assertEquals(1.5204344894331614, parameters[2], 1e-4);
- }
+ }
/**
* Basic with smaller dataset.
@@ -274,7 +274,7 @@ public class GaussianFitterTest {
// The optimizer will try negative sigma values but "GaussianFitter"
// will catch the raised exceptions and return NaN values instead.
- final double[] data = {
+ final double[] data = {
1.1143831578403364E-29,
4.95281403484594E-28,
1.1171347211930288E-26,
@@ -342,7 +342,7 @@ public class GaussianFitterTest {
Assert.assertEquals(0.603770729862231, p[1], 1e-15);
Assert.assertEquals(1.0786447936766612, p[2], 1e-14);
}
-
+
/**
* Adds the specified points to specified <code>GaussianFitter</code>
* instance.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/fitting/HarmonicCurveFitterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/fitting/HarmonicCurveFitterTest.java b/src/test/java/org/apache/commons/math3/fitting/HarmonicCurveFitterTest.java
index 9f6a15c..bed70dd 100644
--- a/src/test/java/org/apache/commons/math3/fitting/HarmonicCurveFitterTest.java
+++ b/src/test/java/org/apache/commons/math3/fitting/HarmonicCurveFitterTest.java
@@ -148,7 +148,7 @@ public class HarmonicCurveFitterTest {
}
// Pass it to the fitter.
- final WeightedObservedPoints points = new WeightedObservedPoints();
+ final WeightedObservedPoints points = new WeightedObservedPoints();
for (int i = 0; i < size; ++i) {
points.add(1, xTab[i], yTab[i]);
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/fitting/PolynomialCurveFitterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/fitting/PolynomialCurveFitterTest.java b/src/test/java/org/apache/commons/math3/fitting/PolynomialCurveFitterTest.java
index 6b8dfa2..ff76a0e 100644
--- a/src/test/java/org/apache/commons/math3/fitting/PolynomialCurveFitterTest.java
+++ b/src/test/java/org/apache/commons/math3/fitting/PolynomialCurveFitterTest.java
@@ -114,7 +114,7 @@ public class PolynomialCurveFitterTest {
for (int degree = 0; degree < 10; ++degree) {
final PolynomialFunction p = buildRandomPolynomial(degree, randomizer);
final PolynomialCurveFitter fitter = PolynomialCurveFitter.create(degree);
-
+
final WeightedObservedPoints obs = new WeightedObservedPoints();
for (int i = 0; i < 40000; ++i) {
final double x = -1.0 + i / 20000.0;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/fitting/SimpleCurveFitterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/fitting/SimpleCurveFitterTest.java b/src/test/java/org/apache/commons/math3/fitting/SimpleCurveFitterTest.java
index d411d4a..e16d661 100644
--- a/src/test/java/org/apache/commons/math3/fitting/SimpleCurveFitterTest.java
+++ b/src/test/java/org/apache/commons/math3/fitting/SimpleCurveFitterTest.java
@@ -48,7 +48,7 @@ public class SimpleCurveFitterTest {
obs.add(x, f.value(x) + 0.1 * randomizer.nextGaussian());
}
- final ParametricUnivariateFunction function = new PolynomialFunction.Parametric();
+ final ParametricUnivariateFunction function = new PolynomialFunction.Parametric();
// Start fit from initial guesses that are far from the optimal values.
final SimpleCurveFitter fitter
= SimpleCurveFitter.create(function,
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/fitting/leastsquares/CircleProblem.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/fitting/leastsquares/CircleProblem.java b/src/test/java/org/apache/commons/math3/fitting/leastsquares/CircleProblem.java
index ed637d4..6bb86a2 100644
--- a/src/test/java/org/apache/commons/math3/fitting/leastsquares/CircleProblem.java
+++ b/src/test/java/org/apache/commons/math3/fitting/leastsquares/CircleProblem.java
@@ -158,7 +158,7 @@ class CircleProblem {
for (int i = 0; i < points.size(); i++) {
final int index = i * 2;
- // Partial derivative wrt x-coordinate of center.
+ // Partial derivative wrt x-coordinate of center.
jacobian[index][0] = 1;
jacobian[index + 1][0] = 0;
// Partial derivative wrt y-coordinate of center.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/fitting/leastsquares/CircleVectorial.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/fitting/leastsquares/CircleVectorial.java b/src/test/java/org/apache/commons/math3/fitting/leastsquares/CircleVectorial.java
index 968bea5..192b493 100644
--- a/src/test/java/org/apache/commons/math3/fitting/leastsquares/CircleVectorial.java
+++ b/src/test/java/org/apache/commons/math3/fitting/leastsquares/CircleVectorial.java
@@ -56,7 +56,7 @@ class CircleVectorial {
for (int i = 0; i < residuals.length; i++) {
residuals[i] = points.get(i).distance(center) - radius;
}
-
+
return residuals;
}
};
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/fitting/leastsquares/MinpackTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/fitting/leastsquares/MinpackTest.java b/src/test/java/org/apache/commons/math3/fitting/leastsquares/MinpackTest.java
index b91140b..af6a427 100644
--- a/src/test/java/org/apache/commons/math3/fitting/leastsquares/MinpackTest.java
+++ b/src/test/java/org/apache/commons/math3/fitting/leastsquares/MinpackTest.java
@@ -610,7 +610,7 @@ public class MinpackTest {
}
private static class LinearFullRankFunction extends MinpackFunction {
-
+
public LinearFullRankFunction(int m, int n, double x0,
double theoreticalStartCost,
double theoreticalMinCost) {
@@ -1382,7 +1382,7 @@ public class MinpackTest {
}
return f;
}
-
+
private static final double[] y = {
0.844, 0.908, 0.932, 0.936, 0.925, 0.908, 0.881, 0.850, 0.818, 0.784, 0.751,
0.718, 0.685, 0.658, 0.628, 0.603, 0.580, 0.558, 0.538, 0.522, 0.506, 0.490,
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/fraction/BigFractionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/fraction/BigFractionTest.java b/src/test/java/org/apache/commons/math3/fraction/BigFractionTest.java
index 229da69..81eef5e 100644
--- a/src/test/java/org/apache/commons/math3/fraction/BigFractionTest.java
+++ b/src/test/java/org/apache/commons/math3/fraction/BigFractionTest.java
@@ -154,9 +154,9 @@ public class BigFractionTest {
assertFraction(8, 13, new BigFraction(0.6152, 99));
assertFraction(510, 829, new BigFraction(0.6152, 999));
assertFraction(769, 1250, new BigFraction(0.6152, 9999));
-
+
// MATH-996
- assertFraction(1, 2, new BigFraction(0.5000000001, 10));
+ assertFraction(1, 2, new BigFraction(0.5000000001, 10));
}
// MATH-1029
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/genetics/CycleCrossoverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/genetics/CycleCrossoverTest.java b/src/test/java/org/apache/commons/math3/genetics/CycleCrossoverTest.java
index 7b6e6b8..5ced37b 100644
--- a/src/test/java/org/apache/commons/math3/genetics/CycleCrossoverTest.java
+++ b/src/test/java/org/apache/commons/math3/genetics/CycleCrossoverTest.java
@@ -22,7 +22,7 @@ import org.junit.Assert;
import org.junit.Test;
public class CycleCrossoverTest {
-
+
@Test
public void testCrossoverExample() {
// taken from http://www.rubicite.com/Tutorials/GeneticAlgorithms/CrossoverOperators/CycleCrossoverOperator.aspx
@@ -81,7 +81,7 @@ public class CycleCrossoverTest {
final Integer[] c2 = ((DummyListChromosome) pair.getSecond()).getRepresentation().toArray(new Integer[p2.length]);
int index = 0;
- // Determine if it is in the same spot as in the first parent, if
+ // Determine if it is in the same spot as in the first parent, if
// not it comes from the second parent.
for (final Integer j : c1) {
if (!p1[index].equals(j)) {
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/genetics/DummyListChromosome.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/genetics/DummyListChromosome.java b/src/test/java/org/apache/commons/math3/genetics/DummyListChromosome.java
index 4831e67..3dbc967 100644
--- a/src/test/java/org/apache/commons/math3/genetics/DummyListChromosome.java
+++ b/src/test/java/org/apache/commons/math3/genetics/DummyListChromosome.java
@@ -38,7 +38,7 @@ public class DummyListChromosome extends AbstractListChromosome<Integer> {
@Override
protected void checkValidity(final List<Integer> chromosomeRepresentation) throws InvalidRepresentationException {
- // Not important.
+ // Not important.
}
@Override
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/genetics/ElitisticListPopulationTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/genetics/ElitisticListPopulationTest.java b/src/test/java/org/apache/commons/math3/genetics/ElitisticListPopulationTest.java
index dbfc9f1..46265c5 100644
--- a/src/test/java/org/apache/commons/math3/genetics/ElitisticListPopulationTest.java
+++ b/src/test/java/org/apache/commons/math3/genetics/ElitisticListPopulationTest.java
@@ -40,7 +40,7 @@ public class ElitisticListPopulationTest {
Assert.assertEquals(20, nextGeneration.getPopulationSize());
}
-
+
@Test
public void testSetElitismRate() {
final double rate = 0.25;
@@ -48,27 +48,27 @@ public class ElitisticListPopulationTest {
pop.setElitismRate(rate);
Assert.assertEquals(rate, pop.getElitismRate(), 1e-6);
}
-
+
@Test(expected = OutOfRangeException.class)
public void testSetElitismRateTooLow() {
final double rate = -0.25;
final ElitisticListPopulation pop = new ElitisticListPopulation(100, 0.203);
pop.setElitismRate(rate);
}
-
+
@Test(expected = OutOfRangeException.class)
public void testSetElitismRateTooHigh() {
final double rate = 1.25;
final ElitisticListPopulation pop = new ElitisticListPopulation(100, 0.203);
pop.setElitismRate(rate);
}
-
+
@Test(expected = OutOfRangeException.class)
public void testConstructorTooLow() {
final double rate = -0.25;
new ElitisticListPopulation(100, rate);
}
-
+
@Test(expected = OutOfRangeException.class)
public void testConstructorTooHigh() {
final double rate = 1.25;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/genetics/ListPopulationTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/genetics/ListPopulationTest.java b/src/test/java/org/apache/commons/math3/genetics/ListPopulationTest.java
index 9234492..7481fac 100644
--- a/src/test/java/org/apache/commons/math3/genetics/ListPopulationTest.java
+++ b/src/test/java/org/apache/commons/math3/genetics/ListPopulationTest.java
@@ -60,13 +60,13 @@ public class ListPopulationTest {
Assert.assertEquals(c3, population.getFittestChromosome());
}
-
+
@Test
public void testChromosomes() {
final ArrayList<Chromosome> chromosomes = new ArrayList<Chromosome> ();
chromosomes.add(new DummyBinaryChromosome(BinaryChromosome.randomBinaryRepresentation(3)));
chromosomes.add(new DummyBinaryChromosome(BinaryChromosome.randomBinaryRepresentation(3)));
- chromosomes.add(new DummyBinaryChromosome(BinaryChromosome.randomBinaryRepresentation(3)));
+ chromosomes.add(new DummyBinaryChromosome(BinaryChromosome.randomBinaryRepresentation(3)));
final ListPopulation population = new ListPopulation(10) {
public Population nextGeneration() {
@@ -74,16 +74,16 @@ public class ListPopulationTest {
return null;
}
};
-
+
population.addChromosomes(chromosomes);
Assert.assertEquals(chromosomes, population.getChromosomes());
Assert.assertEquals(chromosomes.toString(), population.toString());
-
+
population.setPopulationLimit(50);
Assert.assertEquals(50, population.getPopulationLimit());
}
-
+
@Test(expected = NotPositiveException.class)
public void testSetPopulationLimit() {
final ListPopulation population = new ListPopulation(10) {
@@ -92,7 +92,7 @@ public class ListPopulationTest {
return null;
}
};
-
+
population.setPopulationLimit(-50);
}
@@ -123,7 +123,7 @@ public class ListPopulationTest {
final ArrayList<Chromosome> chromosomes = new ArrayList<Chromosome> ();
chromosomes.add(new DummyBinaryChromosome(BinaryChromosome.randomBinaryRepresentation(3)));
chromosomes.add(new DummyBinaryChromosome(BinaryChromosome.randomBinaryRepresentation(3)));
- chromosomes.add(new DummyBinaryChromosome(BinaryChromosome.randomBinaryRepresentation(3)));
+ chromosomes.add(new DummyBinaryChromosome(BinaryChromosome.randomBinaryRepresentation(3)));
new ListPopulation(chromosomes, 1) {
public Population nextGeneration() {
// not important
@@ -131,7 +131,7 @@ public class ListPopulationTest {
}
};
}
-
+
@Test(expected=NumberIsTooLargeException.class)
public void testAddTooManyChromosomes() {
final ArrayList<Chromosome> chromosomes = new ArrayList<Chromosome> ();
@@ -145,10 +145,10 @@ public class ListPopulationTest {
return null;
}
};
-
+
population.addChromosomes(chromosomes);
}
-
+
@Test(expected=NumberIsTooLargeException.class)
public void testAddTooManyChromosomesSingleCall() {
@@ -163,7 +163,7 @@ public class ListPopulationTest {
population.addChromosome(new DummyBinaryChromosome(BinaryChromosome.randomBinaryRepresentation(3)));
}
}
-
+
@Test(expected = UnsupportedOperationException.class)
public void testIterator() {
final ArrayList<Chromosome> chromosomes = new ArrayList<Chromosome>();
@@ -186,7 +186,7 @@ public class ListPopulationTest {
iter.remove();
}
}
-
+
@Test(expected=NumberIsTooSmallException.class)
public void testSetPopulationLimitTooSmall() {
final ArrayList<Chromosome> chromosomes = new ArrayList<Chromosome> ();
@@ -203,5 +203,5 @@ public class ListPopulationTest {
population.setPopulationLimit(2);
}
-
+
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/genetics/NPointCrossoverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/genetics/NPointCrossoverTest.java b/src/test/java/org/apache/commons/math3/genetics/NPointCrossoverTest.java
index f290841..4e482ad 100644
--- a/src/test/java/org/apache/commons/math3/genetics/NPointCrossoverTest.java
+++ b/src/test/java/org/apache/commons/math3/genetics/NPointCrossoverTest.java
@@ -37,7 +37,7 @@ public class NPointCrossoverTest {
final CrossoverPolicy cp = new NPointCrossover<Integer>(1);
cp.crossover(p1c,p2c);
}
-
+
@Test(expected = NumberIsTooLargeException.class)
public void testNumberIsTooLargeException() {
final Integer[] p1 = new Integer[] {1,0,1,0,0,1,0,1,1};
@@ -49,7 +49,7 @@ public class NPointCrossoverTest {
final CrossoverPolicy cp = new NPointCrossover<Integer>(15);
cp.crossover(p1c,p2c);
}
-
+
@Test(expected = MathIllegalArgumentException.class)
public void testCrossoverInvalidFixedLengthChromosomeFirst() {
final Integer[] p1 = new Integer[] {1,0,1,0,0,1,0,1,1};
@@ -64,7 +64,7 @@ public class NPointCrossoverTest {
final CrossoverPolicy cp = new NPointCrossover<Integer>(1);
cp.crossover(p1c,p2c);
}
-
+
@Test(expected = MathIllegalArgumentException.class)
public void testCrossoverInvalidFixedLengthChromosomeSecond() {
final Integer[] p1 = new Integer[] {1,0,1,0,0,1,0,1,1};
@@ -79,7 +79,7 @@ public class NPointCrossoverTest {
final CrossoverPolicy cp = new NPointCrossover<Integer>(1);
cp.crossover(p1c,p2c);
}
-
+
@Test
public void testCrossover() {
Integer[] p1 = new Integer[] {1,0,1,0,1,0,1,0,1};
@@ -103,10 +103,10 @@ public class NPointCrossoverTest {
c2 = ((BinaryChromosome) pair.getSecond()).getRepresentation().toArray(c2);
Assert.assertEquals(order, detectCrossoverPoints(p1c, p2c, (BinaryChromosome) pair.getFirst()));
- Assert.assertEquals(order, detectCrossoverPoints(p2c, p1c, (BinaryChromosome) pair.getSecond()));
+ Assert.assertEquals(order, detectCrossoverPoints(p2c, p1c, (BinaryChromosome) pair.getSecond()));
}
}
-
+
private int detectCrossoverPoints(BinaryChromosome p1, BinaryChromosome p2, BinaryChromosome c) {
int crossovers = 0;
final int length = p1.getLength();
@@ -114,7 +114,7 @@ public class NPointCrossoverTest {
final List<Integer> p1Rep = p1.getRepresentation();
final List<Integer> p2Rep = p2.getRepresentation();
final List<Integer> cRep = c.getRepresentation();
-
+
List<Integer> rep = p1Rep;
for (int i = 0; i < length; i++) {
if (rep.get(i) != cRep.get(i)) {
@@ -122,7 +122,7 @@ public class NPointCrossoverTest {
rep = rep == p1Rep ? p2Rep : p1Rep;
}
}
-
+
return crossovers;
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/genetics/OrderedCrossoverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/genetics/OrderedCrossoverTest.java b/src/test/java/org/apache/commons/math3/genetics/OrderedCrossoverTest.java
index 73fd633..635248b 100644
--- a/src/test/java/org/apache/commons/math3/genetics/OrderedCrossoverTest.java
+++ b/src/test/java/org/apache/commons/math3/genetics/OrderedCrossoverTest.java
@@ -33,13 +33,13 @@ public class OrderedCrossoverTest {
final Integer[] p2 = new Integer[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
final DummyListChromosome p1c = new DummyListChromosome(p1);
final DummyListChromosome p2c = new DummyListChromosome(p2);
-
+
final CrossoverPolicy cp = new OrderedCrossover<Integer>();
for (int i = 0; i < 20; i++) {
final Set<Integer> parentSet1 = new HashSet<Integer>(Arrays.asList(p1));
final Set<Integer> parentSet2 = new HashSet<Integer>(Arrays.asList(p2));
-
+
final ChromosomePair pair = cp.crossover(p1c, p2c);
final Integer[] c1 = ((DummyListChromosome) pair.getFirst()).getRepresentation().toArray(new Integer[p1.length]);
@@ -47,7 +47,7 @@ public class OrderedCrossoverTest {
Assert.assertNotSame(p1c, pair.getFirst());
Assert.assertNotSame(p2c, pair.getSecond());
-
+
// make sure that the children have exactly the same elements as their parents
for (int j = 0; j < c1.length; j++) {
Assert.assertTrue(parentSet1.contains(c1[j]));
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/genetics/RandomKeyTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/genetics/RandomKeyTest.java b/src/test/java/org/apache/commons/math3/genetics/RandomKeyTest.java
index 4ae518f..8f4d028 100644
--- a/src/test/java/org/apache/commons/math3/genetics/RandomKeyTest.java
+++ b/src/test/java/org/apache/commons/math3/genetics/RandomKeyTest.java
@@ -62,7 +62,7 @@ public class RandomKeyTest {
Assert.assertEquals("c", decoded.get(3));
Assert.assertEquals("d", decoded.get(4));
}
-
+
@Test(expected=IllegalArgumentException.class)
public void testInvalidRepresentation() {
new DummyRandomKey(new Double[] {0.1, 0.1, 2d, 0.8, 0.2});
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/genetics/UniformCrossoverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/genetics/UniformCrossoverTest.java b/src/test/java/org/apache/commons/math3/genetics/UniformCrossoverTest.java
index a99cb4a..bfbab7f 100644
--- a/src/test/java/org/apache/commons/math3/genetics/UniformCrossoverTest.java
+++ b/src/test/java/org/apache/commons/math3/genetics/UniformCrossoverTest.java
@@ -45,20 +45,20 @@ public class UniformCrossoverTest {
public void testRatioTooLow() {
new UniformCrossover<Integer>(-0.5d);
}
-
+
@Test(expected = OutOfRangeException.class)
public void testRatioTooHigh() {
new UniformCrossover<Integer>(1.5d);
}
-
+
@Test
public void testCrossover() {
// test crossover with different ratios
performCrossover(0.5);
performCrossover(0.7);
- performCrossover(0.2);
+ performCrossover(0.2);
}
-
+
private void performCrossover(double ratio) {
final DummyBinaryChromosome p1c = new DummyBinaryChromosome(p1);
final DummyBinaryChromosome p2c = new DummyBinaryChromosome(p2);
@@ -103,7 +103,7 @@ public class UniformCrossoverTest {
Assert.assertEquals(1.0 - ratio, (double) from2 / LEN, 0.1);
}
}
-
+
@Test(expected = DimensionMismatchException.class)
public void testCrossoverDimensionMismatchException(){
@SuppressWarnings("boxing")
@@ -117,7 +117,7 @@ public class UniformCrossoverTest {
final CrossoverPolicy cp = new UniformCrossover<Integer>(0.5d);
cp.crossover(p1c, p2c);
}
-
+
@Test(expected = MathIllegalArgumentException.class)
public void testCrossoverInvalidFixedLengthChromosomeFirst() {
@SuppressWarnings("boxing")
@@ -133,7 +133,7 @@ public class UniformCrossoverTest {
final CrossoverPolicy cp = new UniformCrossover<Integer>(0.5d);
cp.crossover(p1c, p2c);
}
-
+
@Test(expected = MathIllegalArgumentException.class)
public void testCrossoverInvalidFixedLengthChromosomeSecond() {
@SuppressWarnings("boxing")
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/FieldVector3DTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/FieldVector3DTest.java b/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/FieldVector3DTest.java
index 75e93e0..d494902 100644
--- a/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/FieldVector3DTest.java
+++ b/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/FieldVector3DTest.java
@@ -486,7 +486,7 @@ public class FieldVector3DTest {
Assert.assertEquals(FastMath.PI / 2, createVector(0, 1, 0, 3).getAlpha().getReal(), 1.0e-10);
Assert.assertEquals(0, createVector(0, 1, 0, 3).getDelta().getReal(), 1.0e-10);
Assert.assertEquals(FastMath.PI / 2, createVector(0, 0, 1, 3).getDelta().getReal(), 1.0e-10);
-
+
FieldVector3D<DerivativeStructure> u = createVector(-1, 1, -1, 3);
Assert.assertEquals(3 * FastMath.PI /4, u.getAlpha().getReal(), 1.0e-10);
Assert.assertEquals(-1.0 / FastMath.sqrt(3), u.getDelta().sin().getReal(), 1.0e-10);
@@ -632,8 +632,8 @@ public class FieldVector3DTest {
final FieldVector3D<DerivativeStructure> u2 = createVector( 1796571811118507.0 / 2147483648.0,
7853468008299307.0 / 2147483648.0,
2599586637357461.0 / 17179869184.0, 3);
- final FieldVector3D<DerivativeStructure> u3 = createVector(12753243807587107.0 / 18446744073709551616.0,
- -2313766922703915.0 / 18446744073709551616.0,
+ final FieldVector3D<DerivativeStructure> u3 = createVector(12753243807587107.0 / 18446744073709551616.0,
+ -2313766922703915.0 / 18446744073709551616.0,
-227970081415313.0 / 288230376151711744.0, 3);
FieldVector3D<DerivativeStructure> cNaive = new FieldVector3D<DerivativeStructure>(u1.getY().multiply(u2.getZ()).subtract(u1.getZ().multiply(u2.getY())),
u1.getZ().multiply(u2.getX()).subtract(u1.getX().multiply(u2.getZ())),
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/LineTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/LineTest.java b/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/LineTest.java
index 1811869..20b10e1 100644
--- a/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/LineTest.java
+++ b/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/LineTest.java
@@ -131,7 +131,7 @@ public class LineTest {
@Test
public void testRevert() {
-
+
// setup
Line line = new Line(new Vector3D(1653345.6696423641, 6170370.041579291, 90000),
new Vector3D(1650757.5050732433, 6160710.879908984, 0.9),
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/PolyhedronsSetTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/PolyhedronsSetTest.java b/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/PolyhedronsSetTest.java
index 10ae3d5..c6fdcfb 100644
--- a/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/PolyhedronsSetTest.java
+++ b/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/PolyhedronsSetTest.java
@@ -254,20 +254,20 @@ public class PolyhedronsSetTest {
@Test
public void testIssue780() throws MathArithmeticException {
float[] coords = {
- 1.000000f, -1.000000f, -1.000000f,
- 1.000000f, -1.000000f, 1.000000f,
- -1.000000f, -1.000000f, 1.000000f,
- -1.000000f, -1.000000f, -1.000000f,
- 1.000000f, 1.000000f, -1f,
- 0.999999f, 1.000000f, 1.000000f, // 1.000000f, 1.000000f, 1.000000f,
- -1.000000f, 1.000000f, 1.000000f,
+ 1.000000f, -1.000000f, -1.000000f,
+ 1.000000f, -1.000000f, 1.000000f,
+ -1.000000f, -1.000000f, 1.000000f,
+ -1.000000f, -1.000000f, -1.000000f,
+ 1.000000f, 1.000000f, -1f,
+ 0.999999f, 1.000000f, 1.000000f, // 1.000000f, 1.000000f, 1.000000f,
+ -1.000000f, 1.000000f, 1.000000f,
-1.000000f, 1.000000f, -1.000000f};
int[] indices = {
- 0, 1, 2, 0, 2, 3,
- 4, 7, 6, 4, 6, 5,
- 0, 4, 5, 0, 5, 1,
- 1, 5, 6, 1, 6, 2,
- 2, 6, 7, 2, 7, 3,
+ 0, 1, 2, 0, 2, 3,
+ 4, 7, 6, 4, 6, 5,
+ 0, 4, 5, 0, 5, 1,
+ 1, 5, 6, 1, 6, 2,
+ 2, 6, 7, 2, 7, 3,
4, 0, 3, 4, 3, 7};
ArrayList<SubHyperplane<Euclidean3D>> subHyperplaneList = new ArrayList<SubHyperplane<Euclidean3D>>();
for (int idx = 0; idx < indices.length; idx += 3) {
@@ -325,7 +325,7 @@ public class PolyhedronsSetTest {
@Test
public void testDumpParse() throws IOException, ParseException {
double tol=1e-8;
-
+
Vector3D[] verts=new Vector3D[8];
double xmin=-1,xmax=1;
double ymin=-1,ymax=1;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/RotationTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/RotationTest.java b/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/RotationTest.java
index d14f77f..ce38a40 100644
--- a/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/RotationTest.java
+++ b/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/RotationTest.java
@@ -534,7 +534,7 @@ public class RotationTest {
Assert.assertEquals(1.0, q2, 1.0e-14);
Assert.assertEquals(0.0, Vector3D.angle(v1, quat.applyTo(u1)), 1.0e-14);
Assert.assertEquals(0.0, Vector3D.angle(v2, quat.applyTo(u2)), 1.0e-14);
-
+
}
private void checkVector(Vector3D v1, Vector3D v2) {
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/SphereGeneratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/SphereGeneratorTest.java b/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/SphereGeneratorTest.java
index 1950a06..14070b0 100644
--- a/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/SphereGeneratorTest.java
+++ b/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/SphereGeneratorTest.java
@@ -148,7 +148,7 @@ public class SphereGeneratorTest {
Assert.assertEquals(0.0, refCenter.distance(sphere.getCenter()), 4e-7 * refRadius);
Assert.assertEquals(refRadius, sphere.getRadius(), 1e-7 * refRadius);
}
-
+
}
@Test
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/SphericalCoordinatesTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/SphericalCoordinatesTest.java b/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/SphericalCoordinatesTest.java
index 9bc9207..b7cb810 100644
--- a/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/SphericalCoordinatesTest.java
+++ b/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/SphericalCoordinatesTest.java
@@ -96,7 +96,7 @@ public class SphericalCoordinatesTest {
cvalue.getPartialDerivative(0, 0, 1));
Vector3D testCGradient = new Vector3D(sc.toCartesianGradient(sGradient));
-
+
Assert.assertEquals(0, testCGradient.distance(refCGradient) / refCGradient.getNorm(), 5.0e-14);
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/SubLineTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/SubLineTest.java b/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/SubLineTest.java
index 6996111..999f0dd 100644
--- a/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/SubLineTest.java
+++ b/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/SubLineTest.java
@@ -152,7 +152,7 @@ public class SubLineTest {
Assert.assertNull(sub1.intersection(sub2, true));
Assert.assertNull(sub1.intersection(sub2, false));
}
-
+
@Test
public void testIntersectionNotIntersecting() throws MathIllegalArgumentException {
SubLine sub1 = new SubLine(new Vector3D(1, 1, 1), new Vector3D(1.5, 1, 1), 1.0e-10);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/Vector3DTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/Vector3DTest.java b/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/Vector3DTest.java
index 654d9c2..0fdd0db 100644
--- a/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/Vector3DTest.java
+++ b/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/Vector3DTest.java
@@ -258,7 +258,7 @@ public class Vector3DTest {
Assert.assertEquals(0, Vector3D.PLUS_J.getDelta(), 1.0e-10);
Assert.assertEquals(0, Vector3D.PLUS_K.getAlpha(), 1.0e-10);
Assert.assertEquals(FastMath.PI / 2, Vector3D.PLUS_K.getDelta(), 1.0e-10);
-
+
Vector3D u = new Vector3D(-1, 1, -1);
Assert.assertEquals(3 * FastMath.PI /4, u.getAlpha(), 1.0e-10);
Assert.assertEquals(-1.0 / FastMath.sqrt(3), FastMath.sin(u.getDelta()), 1.0e-10);
@@ -375,8 +375,8 @@ public class Vector3DTest {
final Vector3D u2 = new Vector3D( 1796571811118507.0 / 2147483648.0,
7853468008299307.0 / 2147483648.0,
2599586637357461.0 / 17179869184.0);
- final Vector3D u3 = new Vector3D(12753243807587107.0 / 18446744073709551616.0,
- -2313766922703915.0 / 18446744073709551616.0,
+ final Vector3D u3 = new Vector3D(12753243807587107.0 / 18446744073709551616.0,
+ -2313766922703915.0 / 18446744073709551616.0,
-227970081415313.0 / 288230376151711744.0);
Vector3D cNaive = new Vector3D(u1.getY() * u2.getZ() - u1.getZ() * u2.getY(),
u1.getZ() * u2.getX() - u1.getX() * u2.getZ(),
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/geometry/euclidean/twod/DiskGeneratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/geometry/euclidean/twod/DiskGeneratorTest.java b/src/test/java/org/apache/commons/math3/geometry/euclidean/twod/DiskGeneratorTest.java
index a7fc16e..79141e7 100644
--- a/src/test/java/org/apache/commons/math3/geometry/euclidean/twod/DiskGeneratorTest.java
+++ b/src/test/java/org/apache/commons/math3/geometry/euclidean/twod/DiskGeneratorTest.java
@@ -113,6 +113,6 @@ public class DiskGeneratorTest {
Assert.assertEquals(0.0, refCenter.distance(disk.getCenter()), 3e-9 * refRadius);
Assert.assertEquals(refRadius, disk.getRadius(), 7e-10 * refRadius);
}
-
+
}
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/geometry/euclidean/twod/PolygonsSetTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/geometry/euclidean/twod/PolygonsSetTest.java b/src/test/java/org/apache/commons/math3/geometry/euclidean/twod/PolygonsSetTest.java
index 526c076..90f80a8 100644
--- a/src/test/java/org/apache/commons/math3/geometry/euclidean/twod/PolygonsSetTest.java
+++ b/src/test/java/org/apache/commons/math3/geometry/euclidean/twod/PolygonsSetTest.java
@@ -221,7 +221,7 @@ public class PolygonsSetTest {
Assert.assertEquals(3.0, p.getY(), 1.0e-10);
Assert.assertEquals(+v.distance(new Vector2D(3, 3)), projection.getOffset(), 1.0e-10);
}
-
+
}
}
@@ -1103,15 +1103,15 @@ public class PolygonsSetTest {
public void testIssue1162() {
PolygonsSet p = new PolygonsSet(1.0e-10,
new Vector2D(4.267199999996532, -11.928637756014894),
- new Vector2D(4.267200000026445, -14.12360595809307),
- new Vector2D(9.144000000273694, -14.12360595809307),
+ new Vector2D(4.267200000026445, -14.12360595809307),
+ new Vector2D(9.144000000273694, -14.12360595809307),
new Vector2D(9.144000000233383, -11.928637756020067));
PolygonsSet w = new PolygonsSet(1.0e-10,
new Vector2D(2.56735636510452512E-9, -11.933116461089332),
- new Vector2D(2.56735636510452512E-9, -12.393225665247766),
- new Vector2D(2.56735636510452512E-9, -27.785625665247778),
- new Vector2D(4.267200000030211, -27.785625665247778),
+ new Vector2D(2.56735636510452512E-9, -12.393225665247766),
+ new Vector2D(2.56735636510452512E-9, -27.785625665247778),
+ new Vector2D(4.267200000030211, -27.785625665247778),
new Vector2D(4.267200000030211, -11.933116461089332));
Assert.assertFalse(p.contains(w));
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/geometry/euclidean/twod/Vector2DTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/geometry/euclidean/twod/Vector2DTest.java b/src/test/java/org/apache/commons/math3/geometry/euclidean/twod/Vector2DTest.java
index 32e5325..6a65329 100644
--- a/src/test/java/org/apache/commons/math3/geometry/euclidean/twod/Vector2DTest.java
+++ b/src/test/java/org/apache/commons/math3/geometry/euclidean/twod/Vector2DTest.java
@@ -27,13 +27,13 @@ public class Vector2DTest {
Vector2D p1 = new Vector2D(1, 1);
Vector2D p2 = new Vector2D(2, 2);
-
+
Vector2D p3 = new Vector2D(3, 3);
Assert.assertEquals(0.0, p3.crossProduct(p1, p2), epsilon);
-
+
Vector2D p4 = new Vector2D(1, 2);
Assert.assertEquals(1.0, p4.crossProduct(p1, p2), epsilon);
-
+
Vector2D p5 = new Vector2D(2, 1);
Assert.assertEquals(-1.0, p5.crossProduct(p1, p2), epsilon);
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/geometry/euclidean/twod/hull/ConvexHullGenerator2DAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/geometry/euclidean/twod/hull/ConvexHullGenerator2DAbstractTest.java b/src/test/java/org/apache/commons/math3/geometry/euclidean/twod/hull/ConvexHullGenerator2DAbstractTest.java
index 0c52550..2680945 100644
--- a/src/test/java/org/apache/commons/math3/geometry/euclidean/twod/hull/ConvexHullGenerator2DAbstractTest.java
+++ b/src/test/java/org/apache/commons/math3/geometry/euclidean/twod/hull/ConvexHullGenerator2DAbstractTest.java
@@ -38,7 +38,7 @@ import org.junit.Test;
/**
* Abstract base test class for 2D convex hull generators.
- *
+ *
*/
public abstract class ConvexHullGenerator2DAbstractTest {
@@ -65,7 +65,7 @@ public abstract class ConvexHullGenerator2DAbstractTest {
public void testNullArgument() {
generator.generate(null);
}
-
+
@Test
public void testEmpty() {
ConvexHull2D hull = generator.generate(Collections.<Vector2D>emptyList());
@@ -244,9 +244,9 @@ public abstract class ConvexHullGenerator2DAbstractTest {
hull = createConvexHullGenerator(true).generate(points);
checkConvexHull(points, hull, true);
-
+
points.clear();
-
+
// second case: multiple points are collinear
points.add(new Vector2D(0, -29.959696875));
points.add(new Vector2D(0, -31.621809375));
@@ -325,7 +325,7 @@ public abstract class ConvexHullGenerator2DAbstractTest {
points.add(new Vector2D(line[0], line[1]));
}
- Vector2D[] referenceHull = new Vector2D[] {
+ Vector2D[] referenceHull = new Vector2D[] {
new Vector2D(-11.0, -1.0),
new Vector2D(-10.0, -3.0),
new Vector2D( -6.0, -7.0),
@@ -362,7 +362,7 @@ public abstract class ConvexHullGenerator2DAbstractTest {
}
// ------------------------------------------------------------------------------
-
+
protected final List<Vector2D> createRandomPoints(int size) {
// create the cloud container
List<Vector2D> points = new ArrayList<Vector2D>(size);
@@ -417,13 +417,13 @@ public abstract class ConvexHullGenerator2DAbstractTest {
return false;
}
}
-
+
sign = cmp;
}
-
+
return true;
}
-
+
// verify that all points are inside the convex hull region
protected final void checkPointsInsideHullRegion(final Collection<Vector2D> points,
final ConvexHull2D hull,
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/geometry/partitioning/RegionDumper.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/geometry/partitioning/RegionDumper.java b/src/test/java/org/apache/commons/math3/geometry/partitioning/RegionDumper.java
index fae3fd8..5142025 100644
--- a/src/test/java/org/apache/commons/math3/geometry/partitioning/RegionDumper.java
+++ b/src/test/java/org/apache/commons/math3/geometry/partitioning/RegionDumper.java
@@ -50,7 +50,7 @@ public class RegionDumper {
/** Private constructor for a utility class
*/
- private RegionDumper() {
+ private RegionDumper() {
}
/** Get a string representation of an {@link ArcsSet}.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/geometry/partitioning/RegionParser.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/geometry/partitioning/RegionParser.java b/src/test/java/org/apache/commons/math3/geometry/partitioning/RegionParser.java
index 8fc1e6e..267e7ec 100644
--- a/src/test/java/org/apache/commons/math3/geometry/partitioning/RegionParser.java
+++ b/src/test/java/org/apache/commons/math3/geometry/partitioning/RegionParser.java
@@ -52,7 +52,7 @@ public class RegionParser {
/** Private constructor for a utility class
*/
- private RegionParser() {
+ private RegionParser() {
}
/** Parse a string representation of an {@link ArcsSet}.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/geometry/spherical/twod/CircleTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/geometry/spherical/twod/CircleTest.java b/src/test/java/org/apache/commons/math3/geometry/spherical/twod/CircleTest.java
index 7546017..4258399 100644
--- a/src/test/java/org/apache/commons/math3/geometry/spherical/twod/CircleTest.java
+++ b/src/test/java/org/apache/commons/math3/geometry/spherical/twod/CircleTest.java
@@ -93,7 +93,7 @@ public class CircleTest {
Assert.assertEquals(circle.getPhase(p), circle.getPhase(samePhase), 1.0e-10);
Assert.assertEquals(0.0, circle.getPhase(circle.getXAxis()), 1.0e-10);
Assert.assertEquals(0.5 * FastMath.PI, circle.getPhase(circle.getYAxis()), 1.0e-10);
-
+
}
@Test
@@ -126,7 +126,7 @@ public class CircleTest {
Assert.assertEquals(0.0, circle.getOffset(new S2Point(Vector3D.MINUS_J)), 1.0e-10);
Assert.assertEquals(-0.5 * FastMath.PI, circle.getOffset(new S2Point(Vector3D.PLUS_K)), 1.0e-10);
Assert.assertEquals( 0.5 * FastMath.PI, circle.getOffset(new S2Point(Vector3D.MINUS_K)), 1.0e-10);
-
+
}
@Test
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/linear/Array2DRowRealMatrixTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/linear/Array2DRowRealMatrixTest.java b/src/test/java/org/apache/commons/math3/linear/Array2DRowRealMatrixTest.java
index 06c4b42..a48afa1 100644
--- a/src/test/java/org/apache/commons/math3/linear/Array2DRowRealMatrixTest.java
+++ b/src/test/java/org/apache/commons/math3/linear/Array2DRowRealMatrixTest.java
@@ -536,7 +536,7 @@ public final class Array2DRowRealMatrixTest {
checkCopy(m, null, 1, 0, 2, 4, true);
checkCopy(m, null, new int[] {}, new int[] { 0 }, true);
checkCopy(m, null, new int[] { 0 }, new int[] { 4 }, true);
-
+
// rectangular check
double[][] copy = new double[][] { { 0, 0, 0 }, { 0, 0 } };
checkCopy(m, copy, 0, 1, 0, 2, true);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/linear/DiagonalMatrixTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/linear/DiagonalMatrixTest.java b/src/test/java/org/apache/commons/math3/linear/DiagonalMatrixTest.java
index db0ef43..1b2ccdc 100644
--- a/src/test/java/org/apache/commons/math3/linear/DiagonalMatrixTest.java
+++ b/src/test/java/org/apache/commons/math3/linear/DiagonalMatrixTest.java
@@ -123,14 +123,14 @@ public class DiagonalMatrixTest {
Assert.assertEquals(0d, out[i][j], 0d);
}
}
- }
+ }
}
@Test
public void testAdd() {
final double[] data1 = { -1.2, 3.4, 5 };
final DiagonalMatrix m1 = new DiagonalMatrix(data1);
-
+
final double[] data2 = { 10.1, 2.3, 45 };
final DiagonalMatrix m2 = new DiagonalMatrix(data2);
@@ -151,7 +151,7 @@ public class DiagonalMatrixTest {
public void testSubtract() {
final double[] data1 = { -1.2, 3.4, 5 };
final DiagonalMatrix m1 = new DiagonalMatrix(data1);
-
+
final double[] data2 = { 10.1, 2.3, 45 };
final DiagonalMatrix m2 = new DiagonalMatrix(data2);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/linear/EigenDecompositionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/linear/EigenDecompositionTest.java b/src/test/java/org/apache/commons/math3/linear/EigenDecompositionTest.java
index ce0a6d0..73f21ea 100644
--- a/src/test/java/org/apache/commons/math3/linear/EigenDecompositionTest.java
+++ b/src/test/java/org/apache/commons/math3/linear/EigenDecompositionTest.java
@@ -329,7 +329,7 @@ public class EigenDecompositionTest {
EigenDecomposition ed;
ed = new EigenDecomposition(symmetric);
-
+
RealMatrix d = ed.getD();
RealMatrix v = ed.getV();
RealMatrix vT = ed.getVT();
@@ -395,7 +395,7 @@ public class EigenDecompositionTest {
{ 27.0, 9.0, 3.0, 1.0 },
{ 64.0, 16.0, 4.0, 1.0 } };
checkUnsymmetricMatrix(MatrixUtils.createRealMatrix(vData));
-
+
RealMatrix randMatrix = MatrixUtils.createRealMatrix(new double[][] {
{0, 1, 0, 0},
{1, 0, 2.e-7, 0},
@@ -415,7 +415,7 @@ public class EigenDecompositionTest {
};
checkUnsymmetricMatrix(MatrixUtils.createRealMatrix(randData2));
}
-
+
@Test
@Ignore
public void testRandomUnsymmetricMatrix() {
@@ -434,12 +434,12 @@ public class EigenDecompositionTest {
RealMatrix m = MatrixUtils.createRealMatrix(data);
checkUnsymmetricMatrix(m);
- }
+ }
}
/**
* Tests the porting of a bugfix in Jama-1.0.3 (from changelog):
- *
+ *
* Patched hqr2 method in Jama.EigenvalueDecomposition to avoid infinite loop;
* Thanks Frederic Devernay <fr...@m4x.org>
*/
@@ -452,7 +452,7 @@ public class EigenDecompositionTest {
{1,1,0,0,1},
{1,0,1,0,1}
};
-
+
RealMatrix m = MatrixUtils.createRealMatrix(data);
checkUnsymmetricMatrix(m);
}
@@ -478,7 +478,7 @@ public class EigenDecompositionTest {
checkUnsymmetricMatrix(m);
}
}
-
+
@Test
public void testMath848() {
double[][] data = {
@@ -501,18 +501,18 @@ public class EigenDecompositionTest {
private void checkUnsymmetricMatrix(final RealMatrix m) {
try {
EigenDecomposition ed = new EigenDecomposition(m);
-
+
RealMatrix d = ed.getD();
RealMatrix v = ed.getV();
//RealMatrix vT = ed.getVT();
RealMatrix x = m.multiply(v);
RealMatrix y = v.multiply(d);
-
+
double diffNorm = x.subtract(y).getNorm();
Assert.assertTrue("The norm of (X-Y) is too large: " + diffNorm + ", matrix=" + m.toString(),
x.subtract(y).getNorm() < 1000 * Precision.EPSILON * FastMath.max(x.getNorm(), y.getNorm()));
-
+
RealMatrix invV = new LUDecomposition(v).getSolver().getInverse();
double norm = v.multiply(d).multiply(invV).subtract(m).getNorm();
Assert.assertEquals(0.0, norm, 1.0e-10);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/linear/HessenbergTransformerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/linear/HessenbergTransformerTest.java b/src/test/java/org/apache/commons/math3/linear/HessenbergTransformerTest.java
index ec7271b..4bf136e 100644
--- a/src/test/java/org/apache/commons/math3/linear/HessenbergTransformerTest.java
+++ b/src/test/java/org/apache/commons/math3/linear/HessenbergTransformerTest.java
@@ -163,17 +163,17 @@ public class HessenbergTransformerTest {
///////////////////////////////////////////////////////////////////////////
// Test helpers
///////////////////////////////////////////////////////////////////////////
-
+
private RealMatrix checkAEqualPHPt(RealMatrix matrix) {
HessenbergTransformer transformer = new HessenbergTransformer(matrix);
RealMatrix p = transformer.getP();
RealMatrix pT = transformer.getPT();
RealMatrix h = transformer.getH();
-
+
RealMatrix result = p.multiply(h).multiply(pT);
double norm = result.subtract(matrix).getNorm();
Assert.assertEquals(0, norm, 1.0e-10);
-
+
for (int i = 0; i < matrix.getRowDimension(); ++i) {
for (int j = 0; j < matrix.getColumnDimension(); ++j) {
if (i > j + 1) {
@@ -181,7 +181,7 @@ public class HessenbergTransformerTest {
}
}
}
-
+
return transformer.getH();
}
@@ -202,7 +202,7 @@ public class HessenbergTransformerTest {
}
}
}
-
+
private void checkMatricesValues(double[][] matrix, double[][] pRef, double[][] hRef) {
HessenbergTransformer transformer =
new HessenbergTransformer(MatrixUtils.createRealMatrix(matrix));
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/linear/MatrixDimensionMismatchExceptionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/linear/MatrixDimensionMismatchExceptionTest.java b/src/test/java/org/apache/commons/math3/linear/MatrixDimensionMismatchExceptionTest.java
index acfa71d..57e3374 100644
--- a/src/test/java/org/apache/commons/math3/linear/MatrixDimensionMismatchExceptionTest.java
+++ b/src/test/java/org/apache/commons/math3/linear/MatrixDimensionMismatchExceptionTest.java
@@ -21,7 +21,7 @@ import org.junit.Test;
/**
* Test for {@link MatrixDimensionMismatchException}.
- *
+ *
*/
public class MatrixDimensionMismatchExceptionTest {
@Test
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/linear/MatrixUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/linear/MatrixUtilsTest.java b/src/test/java/org/apache/commons/math3/linear/MatrixUtilsTest.java
index 5c308ad..da14624 100644
--- a/src/test/java/org/apache/commons/math3/linear/MatrixUtilsTest.java
+++ b/src/test/java/org/apache/commons/math3/linear/MatrixUtilsTest.java
@@ -303,8 +303,8 @@ public final class MatrixUtilsTest {
}
return d;
}
-
- @Test
+
+ @Test
public void testSolveLowerTriangularSystem(){
RealMatrix rm = new Array2DRowRealMatrix(
new double[][] { {2,0,0,0 }, { 1,1,0,0 }, { 3,3,3,0 }, { 3,3,3,4 } },
@@ -313,8 +313,8 @@ public final class MatrixUtilsTest {
MatrixUtils.solveLowerTriangularSystem(rm, b);
TestUtils.assertEquals( new double[]{1,2,-1.66666666666667, 1.0} , b.toArray() , 1.0e-12);
}
-
-
+
+
/*
* Taken from R manual http://stat.ethz.ch/R-manual/R-patched/library/base/html/backsolve.html
*/
@@ -437,7 +437,7 @@ public final class MatrixUtilsTest {
};
MatrixUtils.checkSymmetric(MatrixUtils.createRealMatrix(dataSym), Math.ulp(1d));
}
-
+
@Test(expected=NonSymmetricMatrixException.class)
public void testCheckSymmetric2() {
final double[][] dataNonSym = {
@@ -447,19 +447,19 @@ public final class MatrixUtilsTest {
};
MatrixUtils.checkSymmetric(MatrixUtils.createRealMatrix(dataNonSym), Math.ulp(1d));
}
-
+
@Test(expected=SingularMatrixException.class)
public void testInverseSingular() {
RealMatrix m = MatrixUtils.createRealMatrix(testData3x3Singular);
MatrixUtils.inverse(m);
}
-
+
@Test(expected=NonSquareMatrixException.class)
public void testInverseNonSquare() {
RealMatrix m = MatrixUtils.createRealMatrix(testData3x4);
MatrixUtils.inverse(m);
}
-
+
@Test
public void testInverseDiagonalMatrix() {
final double[] data = { 1, 2, 3 };
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/linear/QRDecompositionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/linear/QRDecompositionTest.java b/src/test/java/org/apache/commons/math3/linear/QRDecompositionTest.java
index a2d93f7..003a1bd 100644
--- a/src/test/java/org/apache/commons/math3/linear/QRDecompositionTest.java
+++ b/src/test/java/org/apache/commons/math3/linear/QRDecompositionTest.java
@@ -273,7 +273,7 @@ public class QRDecompositionTest {
});
return m;
}
-
+
@Test(expected=SingularMatrixException.class)
public void testQRSingular() {
final RealMatrix a = MatrixUtils.createRealMatrix(new double[][] {
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/linear/RRQRSolverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/linear/RRQRSolverTest.java b/src/test/java/org/apache/commons/math3/linear/RRQRSolverTest.java
index 63364c7..ecff9f0 100644
--- a/src/test/java/org/apache/commons/math3/linear/RRQRSolverTest.java
+++ b/src/test/java/org/apache/commons/math3/linear/RRQRSolverTest.java
@@ -120,10 +120,10 @@ public class RRQRSolverTest {
{ 1, 2515 }, { 2, 422 }, { -3, 898 }
});
-
+
RRQRDecomposition decomposition = new RRQRDecomposition(MatrixUtils.createRealMatrix(testData3x3NonSingular));
DecompositionSolver solver = decomposition.getSolver();
-
+
// using RealMatrix
Assert.assertEquals(0, solver.solve(b).subtract(xRef).getNorm(), 3.0e-16 * xRef.getNorm());
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/linear/RectangularCholeskyDecompositionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/linear/RectangularCholeskyDecompositionTest.java b/src/test/java/org/apache/commons/math3/linear/RectangularCholeskyDecompositionTest.java
index fa43eac..a50893a 100644
--- a/src/test/java/org/apache/commons/math3/linear/RectangularCholeskyDecompositionTest.java
+++ b/src/test/java/org/apache/commons/math3/linear/RectangularCholeskyDecompositionTest.java
@@ -102,7 +102,7 @@ public class RectangularCholeskyDecompositionTest {
composeAndTest(m3, 4);
}
-
+
private void composeAndTest(RealMatrix m, int expectedRank) {
RectangularCholeskyDecomposition r = new RectangularCholeskyDecomposition(m);
Assert.assertEquals(expectedRank, r.getRank());
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/linear/SchurTransformerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/linear/SchurTransformerTest.java b/src/test/java/org/apache/commons/math3/linear/SchurTransformerTest.java
index d40a1ba..8f605cb 100644
--- a/src/test/java/org/apache/commons/math3/linear/SchurTransformerTest.java
+++ b/src/test/java/org/apache/commons/math3/linear/SchurTransformerTest.java
@@ -70,7 +70,7 @@ public class SchurTransformerTest {
public void testPOrthogonal() {
checkOrthogonal(new SchurTransformer(MatrixUtils.createRealMatrix(testSquare5)).getP());
checkOrthogonal(new SchurTransformer(MatrixUtils.createRealMatrix(testSquare3)).getP());
- checkOrthogonal(new SchurTransformer(MatrixUtils.createRealMatrix(testRandom)).getP());
+ checkOrthogonal(new SchurTransformer(MatrixUtils.createRealMatrix(testRandom)).getP());
}
@Test
@@ -155,12 +155,12 @@ public class SchurTransformerTest {
RealMatrix p = transformer.getP();
RealMatrix t = transformer.getT();
RealMatrix pT = transformer.getPT();
-
+
RealMatrix result = p.multiply(t).multiply(pT);
double norm = result.subtract(matrix).getNorm();
Assert.assertEquals(0, norm, 1.0e-9);
-
+
return t;
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/ml/clustering/DBSCANClustererTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ml/clustering/DBSCANClustererTest.java b/src/test/java/org/apache/commons/math3/ml/clustering/DBSCANClustererTest.java
index 497459f..643e2ff 100644
--- a/src/test/java/org/apache/commons/math3/ml/clustering/DBSCANClustererTest.java
+++ b/src/test/java/org/apache/commons/math3/ml/clustering/DBSCANClustererTest.java
@@ -146,19 +146,19 @@ public class DBSCANClustererTest {
new DoublePoint(new int[] {14, 8}), // C
new DoublePoint(new int[] {7, 15}), // N - Noise, should not be present
new DoublePoint(new int[] {17, 8}), // D - single-link connected to C should not be present
-
+
};
-
+
final DBSCANClusterer<DoublePoint> clusterer = new DBSCANClusterer<DoublePoint>(3, 3);
List<Cluster<DoublePoint>> clusters = clusterer.cluster(Arrays.asList(points));
-
+
Assert.assertEquals(1, clusters.size());
-
+
final List<DoublePoint> clusterOne =
Arrays.asList(points[0], points[1], points[2], points[3], points[4], points[5], points[6], points[7]);
Assert.assertTrue(clusters.get(0).getPoints().containsAll(clusterOne));
}
-
+
@Test
public void testGetEps() {
final DBSCANClusterer<DoublePoint> transformer = new DBSCANClusterer<DoublePoint>(2.0, 5);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/ml/clustering/KMeansPlusPlusClustererTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ml/clustering/KMeansPlusPlusClustererTest.java b/src/test/java/org/apache/commons/math3/ml/clustering/KMeansPlusPlusClustererTest.java
index 3d3416d..f974c36 100644
--- a/src/test/java/org/apache/commons/math3/ml/clustering/KMeansPlusPlusClustererTest.java
+++ b/src/test/java/org/apache/commons/math3/ml/clustering/KMeansPlusPlusClustererTest.java
@@ -37,7 +37,7 @@ public class KMeansPlusPlusClustererTest {
@Before
public void setUp() {
random = new JDKRandomGenerator();
- random.setSeed(1746432956321l);
+ random.setSeed(1746432956321l);
}
/**
@@ -152,7 +152,7 @@ public class KMeansPlusPlusClustererTest {
final int NUM_CLUSTERS = 2;
final int NUM_ITERATIONS = 0;
random.setSeed(RANDOM_SEED);
-
+
KMeansPlusPlusClusterer<DoublePoint> clusterer =
new KMeansPlusPlusClusterer<DoublePoint>(NUM_CLUSTERS, NUM_ITERATIONS,
new CloseDistance(), random);
@@ -167,15 +167,15 @@ public class KMeansPlusPlusClustererTest {
}
Assert.assertTrue(uniquePointIsCenter);
}
-
+
/**
* 2 variables cannot be clustered into 3 clusters. See issue MATH-436.
*/
@Test(expected=NumberIsTooSmallException.class)
public void testPerformClusterAnalysisToManyClusters() {
- KMeansPlusPlusClusterer<DoublePoint> transformer =
+ KMeansPlusPlusClusterer<DoublePoint> transformer =
new KMeansPlusPlusClusterer<DoublePoint>(3, 1, new EuclideanDistance(), random);
-
+
DoublePoint[] points = new DoublePoint[] {
new DoublePoint(new int[] {
1959, 325100
@@ -183,7 +183,7 @@ public class KMeansPlusPlusClustererTest {
1960, 373200
})
};
-
+
transformer.cluster(Arrays.asList(points));
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/ml/clustering/MultiKMeansPlusPlusClustererTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ml/clustering/MultiKMeansPlusPlusClustererTest.java b/src/test/java/org/apache/commons/math3/ml/clustering/MultiKMeansPlusPlusClustererTest.java
index 23d178a..d0d43de 100644
--- a/src/test/java/org/apache/commons/math3/ml/clustering/MultiKMeansPlusPlusClustererTest.java
+++ b/src/test/java/org/apache/commons/math3/ml/clustering/MultiKMeansPlusPlusClustererTest.java
@@ -31,7 +31,7 @@ public class MultiKMeansPlusPlusClustererTest {
MultiKMeansPlusPlusClusterer<DoublePoint> transformer =
new MultiKMeansPlusPlusClusterer<DoublePoint>(
new KMeansPlusPlusClusterer<DoublePoint>(3, 10), 5);
-
+
DoublePoint[] points = new DoublePoint[] {
// first expected cluster
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/ml/clustering/evaluation/SumOfClusterVariancesTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ml/clustering/evaluation/SumOfClusterVariancesTest.java b/src/test/java/org/apache/commons/math3/ml/clustering/evaluation/SumOfClusterVariancesTest.java
index a92256d..9d267cd 100644
--- a/src/test/java/org/apache/commons/math3/ml/clustering/evaluation/SumOfClusterVariancesTest.java
+++ b/src/test/java/org/apache/commons/math3/ml/clustering/evaluation/SumOfClusterVariancesTest.java
@@ -54,7 +54,7 @@ public class SumOfClusterVariancesTest {
};
final List<Cluster<DoublePoint>> clusters = new ArrayList<Cluster<DoublePoint>>();
-
+
final Cluster<DoublePoint> cluster1 = new Cluster<DoublePoint>();
for (DoublePoint p : points1) {
cluster1.addPoint(p);
@@ -71,7 +71,7 @@ public class SumOfClusterVariancesTest {
assertEquals(6.148148148, evaluator.score(clusters), 1e-6);
}
-
+
@Test
public void testOrdering() {
assertTrue(evaluator.isBetterScore(10, 20));
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/ml/neuralnet/NetworkTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ml/neuralnet/NetworkTest.java b/src/test/java/org/apache/commons/math3/ml/neuralnet/NetworkTest.java
index aa83196..3123e36 100644
--- a/src/test/java/org/apache/commons/math3/ml/neuralnet/NetworkTest.java
+++ b/src/test/java/org/apache/commons/math3/ml/neuralnet/NetworkTest.java
@@ -144,14 +144,14 @@ public class NetworkTest {
initArray).getNetwork();
final Network copy = net.copy();
-
+
final Neuron netNeuron0 = net.getNeuron(0);
final Neuron copyNeuron0 = copy.getNeuron(0);
final Neuron netNeuron1 = net.getNeuron(1);
final Neuron copyNeuron1 = copy.getNeuron(1);
Collection<Neuron> netNeighbours;
Collection<Neuron> copyNeighbours;
-
+
// Check that both networks have the same connections.
netNeighbours = net.getNeighbours(netNeuron0);
copyNeighbours = copy.getNeighbours(copyNeuron0);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/ml/neuralnet/OffsetFeatureInitializer.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ml/neuralnet/OffsetFeatureInitializer.java b/src/test/java/org/apache/commons/math3/ml/neuralnet/OffsetFeatureInitializer.java
index 9c800cc..f1c1f04 100644
--- a/src/test/java/org/apache/commons/math3/ml/neuralnet/OffsetFeatureInitializer.java
+++ b/src/test/java/org/apache/commons/math3/ml/neuralnet/OffsetFeatureInitializer.java
@@ -35,7 +35,7 @@ public class OffsetFeatureInitializer
* each call.
*
* @param orig Original initializer.
- */
+ */
public OffsetFeatureInitializer(FeatureInitializer orig) {
this.orig = orig;
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/ml/neuralnet/sofm/KohonenTrainingTaskTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ml/neuralnet/sofm/KohonenTrainingTaskTest.java b/src/test/java/org/apache/commons/math3/ml/neuralnet/sofm/KohonenTrainingTaskTest.java
index 218a709..b2b3aaf 100644
--- a/src/test/java/org/apache/commons/math3/ml/neuralnet/sofm/KohonenTrainingTaskTest.java
+++ b/src/test/java/org/apache/commons/math3/ml/neuralnet/sofm/KohonenTrainingTaskTest.java
@@ -150,7 +150,7 @@ public class KohonenTrainingTaskTest {
for (double[] c : solver.getCoordinatesList()) {
s.append(c[0]).append(" ").append(c[1]).append(" ");
final City city = solver.getClosestCity(c[0], c[1]);
- final double[] cityCoord = city.getCoordinates();
+ final double[] cityCoord = city.getCoordinates();
s.append(cityCoord[0]).append(" ").append(cityCoord[1]).append(" ");
s.append(" # ").append(city.getName()).append("\n");
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/ml/neuralnet/sofm/TravellingSalesmanSolver.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ml/neuralnet/sofm/TravellingSalesmanSolver.java b/src/test/java/org/apache/commons/math3/ml/neuralnet/sofm/TravellingSalesmanSolver.java
index 026d8bd..bd3a8ee 100644
--- a/src/test/java/org/apache/commons/math3/ml/neuralnet/sofm/TravellingSalesmanSolver.java
+++ b/src/test/java/org/apache/commons/math3/ml/neuralnet/sofm/TravellingSalesmanSolver.java
@@ -125,7 +125,7 @@ public class TravellingSalesmanSolver {
createRandomIterator(numSamplesPerTask),
action);
}
-
+
return tasks;
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/ode/JacobianMatricesTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ode/JacobianMatricesTest.java b/src/test/java/org/apache/commons/math3/ode/JacobianMatricesTest.java
index 6cf7dd2..baa8e09 100644
--- a/src/test/java/org/apache/commons/math3/ode/JacobianMatricesTest.java
+++ b/src/test/java/org/apache/commons/math3/ode/JacobianMatricesTest.java
@@ -457,7 +457,7 @@ public class JacobianMatricesTest {
} else {
dFdP[0] = cy - y[1];
dFdP[1] = y[0] - cx;
- }
+ }
}
public double[] exactY(double t) {
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/ode/events/EventStateTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ode/events/EventStateTest.java b/src/test/java/org/apache/commons/math3/ode/events/EventStateTest.java
index 4a8091f..182c8ae 100644
--- a/src/test/java/org/apache/commons/math3/ode/events/EventStateTest.java
+++ b/src/test/java/org/apache/commons/math3/ode/events/EventStateTest.java
@@ -86,11 +86,11 @@ public class EventStateTest {
MaxCountExceededException, NoBracketingException {
FirstOrderDifferentialEquations equation = new FirstOrderDifferentialEquations() {
-
+
public int getDimension() {
return 1;
}
-
+
public void computeDerivatives(double t, double[] y, double[] yDot) {
yDot[0] = 1.0;
}
@@ -151,11 +151,11 @@ public class EventStateTest {
ExpandableStatefulODE equation =
new ExpandableStatefulODE(new FirstOrderDifferentialEquations() {
-
+
public int getDimension() {
return 1;
}
-
+
public void computeDerivatives(double t, double[] y, double[] yDot) {
yDot[0] = 2.0;
}
@@ -163,11 +163,11 @@ public class EventStateTest {
equation.setTime(0.0);
equation.setPrimaryState(new double[1]);
equation.addSecondaryEquations(new SecondaryEquations() {
-
+
public int getDimension() {
return 1;
}
-
+
public void computeDerivatives(double t, double[] primary,
double[] primaryDot, double[] secondary,
double[] secondaryDot) {
@@ -219,11 +219,11 @@ public class EventStateTest {
MaxCountExceededException, NoBracketingException {
FirstOrderDifferentialEquations equation = new FirstOrderDifferentialEquations() {
-
+
public int getDimension() {
return 1;
}
-
+
public void computeDerivatives(double t, double[] y, double[] yDot) {
yDot[0] = 1.0;
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/ode/nonstiff/HighamHall54IntegratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ode/nonstiff/HighamHall54IntegratorTest.java b/src/test/java/org/apache/commons/math3/ode/nonstiff/HighamHall54IntegratorTest.java
index 65a96f2..1042ecf 100644
--- a/src/test/java/org/apache/commons/math3/ode/nonstiff/HighamHall54IntegratorTest.java
+++ b/src/test/java/org/apache/commons/math3/ode/nonstiff/HighamHall54IntegratorTest.java
@@ -355,7 +355,7 @@ public class HighamHall54IntegratorTest {
FirstOrderIntegrator integ = new HighamHall54Integrator(minStep, maxStep,
vecAbsoluteTolerance,
vecRelativeTolerance);
- TestProblemHandler handler = new TestProblemHandler(pb, integ);
+ TestProblemHandler handler = new TestProblemHandler(pb, integ);
integ.addStepHandler(handler);
integ.integrate(pb,
pb.getInitialTime(), pb.getInitialState(),
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/ode/sampling/StepNormalizerOutputTestBase.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ode/sampling/StepNormalizerOutputTestBase.java b/src/test/java/org/apache/commons/math3/ode/sampling/StepNormalizerOutputTestBase.java
index f862dad..0a3dc9c 100644
--- a/src/test/java/org/apache/commons/math3/ode/sampling/StepNormalizerOutputTestBase.java
+++ b/src/test/java/org/apache/commons/math3/ode/sampling/StepNormalizerOutputTestBase.java
@@ -235,10 +235,10 @@ public abstract class StepNormalizerOutputTestBase
* @param bounds the step normalizer bounds setting to use
* @param expected the expected output (normalized time points)
* @param reverse whether to reverse the integration direction
- * @throws NoBracketingException
- * @throws MaxCountExceededException
- * @throws NumberIsTooSmallException
- * @throws DimensionMismatchException
+ * @throws NoBracketingException
+ * @throws MaxCountExceededException
+ * @throws NumberIsTooSmallException
+ * @throws DimensionMismatchException
*/
private void doTest(StepNormalizerMode mode, StepNormalizerBounds bounds,
double[] expected, boolean reverse)
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optim/SimplePointCheckerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optim/SimplePointCheckerTest.java b/src/test/java/org/apache/commons/math3/optim/SimplePointCheckerTest.java
index f5b057a..f615cd8 100644
--- a/src/test/java/org/apache/commons/math3/optim/SimplePointCheckerTest.java
+++ b/src/test/java/org/apache/commons/math3/optim/SimplePointCheckerTest.java
@@ -31,7 +31,7 @@ public class SimplePointCheckerTest {
final int max = 10;
final SimplePointChecker<PointValuePair> checker
= new SimplePointChecker<PointValuePair>(1e-1, 1e-2, max);
- Assert.assertTrue(checker.converged(max, null, null));
+ Assert.assertTrue(checker.converged(max, null, null));
Assert.assertTrue(checker.converged(max + 1, null, null));
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optim/SimpleValueCheckerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optim/SimpleValueCheckerTest.java b/src/test/java/org/apache/commons/math3/optim/SimpleValueCheckerTest.java
index f4b7f2f..28e2b6d 100644
--- a/src/test/java/org/apache/commons/math3/optim/SimpleValueCheckerTest.java
+++ b/src/test/java/org/apache/commons/math3/optim/SimpleValueCheckerTest.java
@@ -30,7 +30,7 @@ public class SimpleValueCheckerTest {
public void testIterationCheck() {
final int max = 10;
final SimpleValueChecker checker = new SimpleValueChecker(1e-1, 1e-2, max);
- Assert.assertTrue(checker.converged(max, null, null));
+ Assert.assertTrue(checker.converged(max, null, null));
Assert.assertTrue(checker.converged(max + 1, null, null));
}
[2/4] [math] Removed trailing spaces. No code change.
Posted by ps...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optim/linear/SimplexSolverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optim/linear/SimplexSolverTest.java b/src/test/java/org/apache/commons/math3/optim/linear/SimplexSolverTest.java
index 0728be1..452bd7d 100644
--- a/src/test/java/org/apache/commons/math3/optim/linear/SimplexSolverTest.java
+++ b/src/test/java/org/apache/commons/math3/optim/linear/SimplexSolverTest.java
@@ -42,13 +42,13 @@ public class SimplexSolverTest {
// x1,x2,x3,x4 >= 0
LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 10, -57, -9, -24}, 0);
-
+
ArrayList<LinearConstraint> constraints = new ArrayList<LinearConstraint>();
constraints.add(new LinearConstraint(new double[] {0.5, -5.5, -2.5, 9}, Relationship.LEQ, 0));
constraints.add(new LinearConstraint(new double[] {0.5, -1.5, -0.5, 1}, Relationship.LEQ, 0));
constraints.add(new LinearConstraint(new double[] { 1, 0, 0, 0}, Relationship.LEQ, 1));
-
+
double epsilon = 1e-6;
SimplexSolver solver = new SimplexSolver();
PointValuePair solution = solver.optimize(f, new LinearConstraintSet(constraints),
@@ -63,7 +63,7 @@ public class SimplexSolverTest {
public void testMath828() {
LinearObjectiveFunction f = new LinearObjectiveFunction(
new double[] { 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 0.0);
-
+
ArrayList <LinearConstraint>constraints = new ArrayList<LinearConstraint>();
constraints.add(new LinearConstraint(new double[] {0.0, 39.0, 23.0, 96.0, 15.0, 48.0, 9.0, 21.0, 48.0, 36.0, 76.0, 19.0, 88.0, 17.0, 16.0, 36.0,}, Relationship.GEQ, 15.0));
@@ -73,7 +73,7 @@ public class SimplexSolverTest {
constraints.add(new LinearConstraint(new double[] {25.0, -7.0, -99.0, -78.0, -25.0, -14.0, -16.0, -89.0, -39.0, -56.0, -53.0, -9.0, -18.0, -26.0, -11.0, -61.0,}, Relationship.GEQ, 0.0));
constraints.add(new LinearConstraint(new double[] {33.0, -95.0, -15.0, -4.0, -33.0, -3.0, -20.0, -96.0, -27.0, -13.0, -80.0, -24.0, -3.0, -13.0, -57.0, -76.0,}, Relationship.GEQ, 0.0));
constraints.add(new LinearConstraint(new double[] {7.0, -95.0, -39.0, -93.0, -7.0, -94.0, -94.0, -62.0, -76.0, -26.0, -53.0, -57.0, -31.0, -76.0, -53.0, -52.0,}, Relationship.GEQ, 0.0));
-
+
double epsilon = 1e-6;
PointValuePair solution = new SimplexSolver().optimize(DEFAULT_MAX_ITER, f, new LinearConstraintSet(constraints),
GoalType.MINIMIZE, new NonNegativeConstraint(true));
@@ -85,7 +85,7 @@ public class SimplexSolverTest {
public void testMath828Cycle() {
LinearObjectiveFunction f = new LinearObjectiveFunction(
new double[] { 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 0.0);
-
+
ArrayList <LinearConstraint>constraints = new ArrayList<LinearConstraint>();
constraints.add(new LinearConstraint(new double[] {0.0, 16.0, 14.0, 69.0, 1.0, 85.0, 52.0, 43.0, 64.0, 97.0, 14.0, 74.0, 89.0, 28.0, 94.0, 58.0, 13.0, 22.0, 21.0, 17.0, 30.0, 25.0, 1.0, 59.0, 91.0, 78.0, 12.0, 74.0, 56.0, 3.0, 88.0,}, Relationship.GEQ, 91.0));
@@ -95,14 +95,14 @@ public class SimplexSolverTest {
constraints.add(new LinearConstraint(new double[] {41.0, -96.0, -41.0, -48.0, -70.0, -43.0, -43.0, -43.0, -97.0, -37.0, -85.0, -70.0, -45.0, -67.0, -87.0, -69.0, -94.0, -54.0, -54.0, -92.0, -79.0, -10.0, -35.0, -20.0, -41.0, -41.0, -65.0, -25.0, -12.0, -8.0, -46.0,}, Relationship.GEQ, 0.0));
constraints.add(new LinearConstraint(new double[] {27.0, -42.0, -65.0, -49.0, -53.0, -42.0, -17.0, -2.0, -61.0, -31.0, -76.0, -47.0, -8.0, -93.0, -86.0, -62.0, -65.0, -63.0, -22.0, -43.0, -27.0, -23.0, -32.0, -74.0, -27.0, -63.0, -47.0, -78.0, -29.0, -95.0, -73.0,}, Relationship.GEQ, 0.0));
constraints.add(new LinearConstraint(new double[] {15.0, -46.0, -41.0, -83.0, -98.0, -99.0, -21.0, -35.0, -7.0, -14.0, -80.0, -63.0, -18.0, -42.0, -5.0, -34.0, -56.0, -70.0, -16.0, -18.0, -74.0, -61.0, -47.0, -41.0, -15.0, -79.0, -18.0, -47.0, -88.0, -68.0, -55.0,}, Relationship.GEQ, 0.0));
-
+
double epsilon = 1e-6;
PointValuePair solution = new SimplexSolver().optimize(DEFAULT_MAX_ITER, f,
new LinearConstraintSet(constraints),
GoalType.MINIMIZE, new NonNegativeConstraint(true),
PivotSelectionRule.BLAND);
Assert.assertEquals(1.0d, solution.getValue(), epsilon);
- Assert.assertTrue(validSolution(solution, constraints, epsilon));
+ Assert.assertTrue(validSolution(solution, constraints, epsilon));
}
@Test
@@ -185,7 +185,7 @@ public class SimplexSolverTest {
SimplexSolver solver = new SimplexSolver();
PointValuePair solution = solver.optimize(DEFAULT_MAX_ITER, f, new LinearConstraintSet(constraints),
GoalType.MINIMIZE, new NonNegativeConstraint(false));
-
+
Assert.assertTrue(Precision.compareTo(solution.getPoint()[0] * 200.d, 1.d, epsilon) >= 0);
Assert.assertEquals(0.0050, solution.getValue(), epsilon);
}
@@ -209,13 +209,13 @@ public class SimplexSolverTest {
SimplexSolver simplex = new SimplexSolver();
PointValuePair solution = simplex.optimize(DEFAULT_MAX_ITER, f, new LinearConstraintSet(constraints),
GoalType.MINIMIZE, new NonNegativeConstraint(false));
-
+
Assert.assertTrue(Precision.compareTo(solution.getPoint()[0], -1e-18d, epsilon) >= 0);
- Assert.assertEquals(1.0d, solution.getPoint()[1], epsilon);
+ Assert.assertEquals(1.0d, solution.getPoint()[1], epsilon);
Assert.assertEquals(0.0d, solution.getPoint()[2], epsilon);
Assert.assertEquals(1.0d, solution.getValue(), epsilon);
}
-
+
@Test
public void testMath272() {
LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 2, 2, 1 }, 0);
@@ -351,12 +351,12 @@ public class SimplexSolverTest {
@Test
public void testMath930() {
Collection<LinearConstraint> constraints = createMath930Constraints();
-
+
double[] objFunctionCoeff = new double[33];
objFunctionCoeff[3] = 1;
LinearObjectiveFunction f = new LinearObjectiveFunction(objFunctionCoeff, 0);
SimplexSolver solver = new SimplexSolver(1e-4, 10, 1e-6);
-
+
PointValuePair solution = solver.optimize(new MaxIter(1000), f, new LinearConstraintSet(constraints),
GoalType.MINIMIZE, new NonNegativeConstraint(true));
Assert.assertEquals(0.3752298, solution.getValue(), 1e-4);
@@ -751,7 +751,7 @@ public class SimplexSolverTest {
public void testSolutionCallback() {
// re-use the problem from testcase for MATH-288
// it normally requires 5 iterations
-
+
LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 7, 3, 0, 0 }, 0 );
List<LinearConstraint> constraints = new ArrayList<LinearConstraint>();
@@ -763,7 +763,7 @@ public class SimplexSolverTest {
final SimplexSolver solver = new SimplexSolver();
final SolutionCallback callback = new SolutionCallback();
-
+
Assert.assertNull(callback.getSolution());
Assert.assertFalse(callback.isSolutionOptimal());
@@ -774,7 +774,7 @@ public class SimplexSolverTest {
} catch (TooManyIterationsException ex) {
// expected
}
-
+
final PointValuePair solution = callback.getSolution();
Assert.assertNotNull(solution);
Assert.assertTrue(validSolution(solution, constraints, 1e-4));
@@ -821,20 +821,20 @@ public class SimplexSolverTest {
for (int i = 0; i < vals.length; i++) {
result += vals[i] * coeffs[i];
}
-
+
switch (c.getRelationship()) {
case EQ:
if (!Precision.equals(result, c.getValue(), epsilon)) {
return false;
}
break;
-
+
case GEQ:
if (Precision.compareTo(result, c.getValue(), epsilon) < 0) {
return false;
}
break;
-
+
case LEQ:
if (Precision.compareTo(result, c.getValue(), epsilon) > 0) {
return false;
@@ -842,7 +842,7 @@ public class SimplexSolverTest {
break;
}
}
-
+
return true;
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optim/nonlinear/scalar/noderiv/BOBYQAOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optim/nonlinear/scalar/noderiv/BOBYQAOptimizerTest.java b/src/test/java/org/apache/commons/math3/optim/nonlinear/scalar/noderiv/BOBYQAOptimizerTest.java
index c214e4b..858d37b 100644
--- a/src/test/java/org/apache/commons/math3/optim/nonlinear/scalar/noderiv/BOBYQAOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math3/optim/nonlinear/scalar/noderiv/BOBYQAOptimizerTest.java
@@ -41,22 +41,22 @@ import org.junit.Test;
public class BOBYQAOptimizerTest {
static final int DIM = 13;
-
+
@Test(expected=NumberIsTooLargeException.class)
public void testInitOutOfBounds() {
double[] startPoint = point(DIM, 3);
double[][] boundaries = boundaries(DIM, -1, 2);
doTest(new Rosen(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-13, 1e-6, 2000, null);
}
-
+
@Test(expected=DimensionMismatchException.class)
public void testBoundariesDimensionMismatch() {
double[] startPoint = point(DIM, 0.5);
double[][] boundaries = boundaries(DIM + 1, -1, 2);
doTest(new Rosen(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-13, 1e-6, 2000, null);
}
@@ -74,7 +74,7 @@ public class BOBYQAOptimizerTest {
double[] startPoint = point(DIM, 0.1);
double[][] boundaries = null;
doTest(new Rosen(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-13, 1e-6, lowMaxEval, null);
}
@@ -84,7 +84,7 @@ public class BOBYQAOptimizerTest {
double[][] boundaries = null;
PointValuePair expected = new PointValuePair(point(DIM,1.0),0.0);
doTest(new Rosen(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-13, 1e-6, 2000, expected);
}
@@ -94,12 +94,12 @@ public class BOBYQAOptimizerTest {
double[][] boundaries = null;
PointValuePair expected = new PointValuePair(point(DIM,0.0),1.0);
doTest(new MinusElli(), startPoint, boundaries,
- GoalType.MAXIMIZE,
+ GoalType.MAXIMIZE,
2e-10, 5e-6, 1000, expected);
- boundaries = boundaries(DIM,-0.3,0.3);
+ boundaries = boundaries(DIM,-0.3,0.3);
startPoint = point(DIM,0.1);
doTest(new MinusElli(), startPoint, boundaries,
- GoalType.MAXIMIZE,
+ GoalType.MAXIMIZE,
2e-10, 5e-6, 1000, expected);
}
@@ -110,7 +110,7 @@ public class BOBYQAOptimizerTest {
PointValuePair expected =
new PointValuePair(point(DIM,0.0),0.0);
doTest(new Elli(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-13, 1e-6, 1000, expected);
}
@@ -121,7 +121,7 @@ public class BOBYQAOptimizerTest {
PointValuePair expected =
new PointValuePair(point(DIM,0.0),0.0);
doTest(new ElliRotated(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-12, 1e-6, 10000, expected);
}
@@ -132,7 +132,7 @@ public class BOBYQAOptimizerTest {
PointValuePair expected =
new PointValuePair(point(DIM,0.0),0.0);
doTest(new Cigar(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-13, 1e-6, 100, expected);
}
@@ -154,7 +154,7 @@ public class BOBYQAOptimizerTest {
PointValuePair expected =
new PointValuePair(point(DIM,0.0),0.0);
doTest(new CigTab(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-13, 5e-5, 100, expected);
}
@@ -165,18 +165,18 @@ public class BOBYQAOptimizerTest {
PointValuePair expected =
new PointValuePair(point(DIM,0.0),0.0);
doTest(new Sphere(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-13, 1e-6, 100, expected);
}
@Test
public void testTablet() {
- double[] startPoint = point(DIM,1.0);
+ double[] startPoint = point(DIM,1.0);
double[][] boundaries = null;
PointValuePair expected =
new PointValuePair(point(DIM,0.0),0.0);
doTest(new Tablet(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-13, 1e-6, 100, expected);
}
@@ -187,7 +187,7 @@ public class BOBYQAOptimizerTest {
PointValuePair expected =
new PointValuePair(point(DIM/2,0.0),0.0);
doTest(new DiffPow(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-8, 1e-1, 21000, expected);
}
@@ -198,7 +198,7 @@ public class BOBYQAOptimizerTest {
PointValuePair expected =
new PointValuePair(point(DIM/2,0.0),0.0);
doTest(new SsDiffPow(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-2, 1.3e-1, 50000, expected);
}
@@ -221,7 +221,7 @@ public class BOBYQAOptimizerTest {
PointValuePair expected =
new PointValuePair(point(DIM,0.0),0.0);
doTest(new Rastrigin(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-13, 1e-6, 1000, expected);
}
@@ -333,7 +333,7 @@ public class BOBYQAOptimizerTest {
new InitialGuess(startPoint),
new SimpleBounds(boundaries[0],
boundaries[1]));
-// System.out.println(func.getClass().getName() + " = "
+// System.out.println(func.getClass().getName() + " = "
// + optim.getEvaluations() + " f(");
// for (double x: result.getPoint()) System.out.print(x + " ");
// System.out.println(") = " + result.getValue());
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optim/nonlinear/scalar/noderiv/CMAESOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optim/nonlinear/scalar/noderiv/CMAESOptimizerTest.java b/src/test/java/org/apache/commons/math3/optim/nonlinear/scalar/noderiv/CMAESOptimizerTest.java
index aade822..85f8565 100644
--- a/src/test/java/org/apache/commons/math3/optim/nonlinear/scalar/noderiv/CMAESOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math3/optim/nonlinear/scalar/noderiv/CMAESOptimizerTest.java
@@ -70,7 +70,7 @@ public class CMAESOptimizerTest {
GoalType.MINIMIZE, LAMBDA, true, 0, 1e-13,
1e-13, 1e-6, 100000, expected);
}
-
+
@Test(expected = DimensionMismatchException.class)
public void testBoundariesDimensionMismatch() {
double[] startPoint = point(DIM,0.5);
@@ -118,7 +118,7 @@ public class CMAESOptimizerTest {
GoalType.MINIMIZE, LAMBDA, true, 0, 1e-13,
1e-13, 1e-6, 100000, expected);
}
-
+
@Test
@Retry(3)
public void testRosen() {
@@ -149,7 +149,7 @@ public class CMAESOptimizerTest {
doTest(new MinusElli(), startPoint, insigma, boundaries,
GoalType.MAXIMIZE, LAMBDA, false, 0, 1.0-1e-13,
2e-10, 5e-6, 100000, expected);
- boundaries = boundaries(DIM,-0.3,0.3);
+ boundaries = boundaries(DIM,-0.3,0.3);
startPoint = point(DIM,0.1);
doTest(new MinusElli(), startPoint, insigma, boundaries,
GoalType.MAXIMIZE, LAMBDA, true, 0, 1.0-1e-13,
@@ -408,7 +408,7 @@ public class CMAESOptimizerTest {
};
final double[] start = { 1 };
-
+
// No bounds.
PointValuePair result = optimizer.optimize(new MaxEval(100000),
new ObjectiveFunction(fitnessFunction),
@@ -453,7 +453,7 @@ public class CMAESOptimizerTest {
Assert.assertEquals(resNoBound, resNearLo, 1e-3);
Assert.assertEquals(resNoBound, resNearHi, 1e-3);
}
-
+
/**
* @param func Function to optimize.
* @param startPoint Starting point.
@@ -476,7 +476,7 @@ public class CMAESOptimizerTest {
GoalType goal,
int lambda,
boolean isActive,
- int diagonalOnly,
+ int diagonalOnly,
double stopValue,
double fTol,
double pointTol,
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerAbstractTest.java b/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerAbstractTest.java
index 7a9c9eb..bc523ce 100644
--- a/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerAbstractTest.java
+++ b/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerAbstractTest.java
@@ -294,7 +294,7 @@ public abstract class AbstractLeastSquaresOptimizerAbstractTest {
optimizer.optimize(new MaxEval(100),
problem2.getModelFunction(),
problem2.getModelFunctionJacobian(),
- problem2.getTarget(),
+ problem2.getTarget(),
new Weight(new double[] { 1, 1, 1, 1 }),
new InitialGuess(new double[] { 0, 1, 2, 3 }));
Assert.assertEquals(0, optimizer.getRMS(), 1e-10);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/CircleProblem.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/CircleProblem.java b/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/CircleProblem.java
index fe2c3bc..61834b1 100644
--- a/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/CircleProblem.java
+++ b/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/CircleProblem.java
@@ -162,7 +162,7 @@ class CircleProblem {
for (int i = 0; i < points.size(); i++) {
final int index = i * 2;
- // Partial derivative wrt x-coordinate of center.
+ // Partial derivative wrt x-coordinate of center.
jacobian[index][0] = 1;
jacobian[index + 1][0] = 0;
// Partial derivative wrt y-coordinate of center.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/MinpackTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/MinpackTest.java b/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/MinpackTest.java
index 898dbdd..53d7880 100644
--- a/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/MinpackTest.java
+++ b/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/MinpackTest.java
@@ -1368,7 +1368,7 @@ public class MinpackTest {
}
return f;
}
-
+
private static final double[] y = {
0.844, 0.908, 0.932, 0.936, 0.925, 0.908, 0.881, 0.850, 0.818, 0.784, 0.751,
0.718, 0.685, 0.658, 0.628, 0.603, 0.580, 0.558, 0.538, 0.522, 0.506, 0.490,
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optim/univariate/BrentOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optim/univariate/BrentOptimizerTest.java b/src/test/java/org/apache/commons/math3/optim/univariate/BrentOptimizerTest.java
index 575eb5c..f558fc0 100644
--- a/src/test/java/org/apache/commons/math3/optim/univariate/BrentOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math3/optim/univariate/BrentOptimizerTest.java
@@ -83,7 +83,7 @@ public final class BrentOptimizerTest {
public void testBoundaries() {
final double lower = -1.0;
final double upper = +1.0;
- UnivariateFunction f = new UnivariateFunction() {
+ UnivariateFunction f = new UnivariateFunction() {
public double value(double x) {
if (x < lower) {
throw new NumberIsTooSmallException(x, lower, true);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optim/univariate/MultiStartUnivariateOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optim/univariate/MultiStartUnivariateOptimizerTest.java b/src/test/java/org/apache/commons/math3/optim/univariate/MultiStartUnivariateOptimizerTest.java
index d979c72..dde425f 100644
--- a/src/test/java/org/apache/commons/math3/optim/univariate/MultiStartUnivariateOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math3/optim/univariate/MultiStartUnivariateOptimizerTest.java
@@ -111,7 +111,7 @@ public class MultiStartUnivariateOptimizerTest {
JDKRandomGenerator g = new JDKRandomGenerator();
g.setSeed(4312000053L);
MultiStartUnivariateOptimizer optimizer = new MultiStartUnivariateOptimizer(underlying, 5, g);
-
+
try {
optimizer.optimize(new MaxEval(300),
new UnivariateObjectiveFunction(f),
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optim/univariate/SimpleUnivariateValueCheckerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optim/univariate/SimpleUnivariateValueCheckerTest.java b/src/test/java/org/apache/commons/math3/optim/univariate/SimpleUnivariateValueCheckerTest.java
index e7b7904..d2bd42d 100644
--- a/src/test/java/org/apache/commons/math3/optim/univariate/SimpleUnivariateValueCheckerTest.java
+++ b/src/test/java/org/apache/commons/math3/optim/univariate/SimpleUnivariateValueCheckerTest.java
@@ -30,7 +30,7 @@ public class SimpleUnivariateValueCheckerTest {
public void testIterationCheck() {
final int max = 10;
final SimpleUnivariateValueChecker checker = new SimpleUnivariateValueChecker(1e-1, 1e-2, max);
- Assert.assertTrue(checker.converged(max, null, null));
+ Assert.assertTrue(checker.converged(max, null, null));
Assert.assertTrue(checker.converged(max + 1, null, null));
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optimization/SimplePointCheckerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optimization/SimplePointCheckerTest.java b/src/test/java/org/apache/commons/math3/optimization/SimplePointCheckerTest.java
index 5595b11..484c4f5 100644
--- a/src/test/java/org/apache/commons/math3/optimization/SimplePointCheckerTest.java
+++ b/src/test/java/org/apache/commons/math3/optimization/SimplePointCheckerTest.java
@@ -32,7 +32,7 @@ public class SimplePointCheckerTest {
final int max = 10;
final SimplePointChecker<PointValuePair> checker
= new SimplePointChecker<PointValuePair>(1e-1, 1e-2, max);
- Assert.assertTrue(checker.converged(max, null, null));
+ Assert.assertTrue(checker.converged(max, null, null));
Assert.assertTrue(checker.converged(max + 1, null, null));
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optimization/SimpleValueCheckerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optimization/SimpleValueCheckerTest.java b/src/test/java/org/apache/commons/math3/optimization/SimpleValueCheckerTest.java
index baf865f..2cb388e 100644
--- a/src/test/java/org/apache/commons/math3/optimization/SimpleValueCheckerTest.java
+++ b/src/test/java/org/apache/commons/math3/optimization/SimpleValueCheckerTest.java
@@ -31,7 +31,7 @@ public class SimpleValueCheckerTest {
public void testIterationCheck() {
final int max = 10;
final SimpleValueChecker checker = new SimpleValueChecker(1e-1, 1e-2, max);
- Assert.assertTrue(checker.converged(max, null, null));
+ Assert.assertTrue(checker.converged(max, null, null));
Assert.assertTrue(checker.converged(max + 1, null, null));
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optimization/direct/BOBYQAOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optimization/direct/BOBYQAOptimizerTest.java b/src/test/java/org/apache/commons/math3/optimization/direct/BOBYQAOptimizerTest.java
index f89da18..a871d85 100644
--- a/src/test/java/org/apache/commons/math3/optimization/direct/BOBYQAOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math3/optimization/direct/BOBYQAOptimizerTest.java
@@ -40,22 +40,22 @@ import org.junit.Test;
public class BOBYQAOptimizerTest {
static final int DIM = 13;
-
+
@Test(expected=NumberIsTooLargeException.class)
public void testInitOutOfBounds() {
double[] startPoint = point(DIM, 3);
double[][] boundaries = boundaries(DIM, -1, 2);
doTest(new Rosen(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-13, 1e-6, 2000, null);
}
-
+
@Test(expected=DimensionMismatchException.class)
public void testBoundariesDimensionMismatch() {
double[] startPoint = point(DIM, 0.5);
double[][] boundaries = boundaries(DIM + 1, -1, 2);
doTest(new Rosen(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-13, 1e-6, 2000, null);
}
@@ -73,7 +73,7 @@ public class BOBYQAOptimizerTest {
double[] startPoint = point(DIM, 0.1);
double[][] boundaries = null;
doTest(new Rosen(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-13, 1e-6, lowMaxEval, null);
}
@@ -83,7 +83,7 @@ public class BOBYQAOptimizerTest {
double[][] boundaries = null;
PointValuePair expected = new PointValuePair(point(DIM,1.0),0.0);
doTest(new Rosen(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-13, 1e-6, 2000, expected);
}
@@ -93,12 +93,12 @@ public class BOBYQAOptimizerTest {
double[][] boundaries = null;
PointValuePair expected = new PointValuePair(point(DIM,0.0),1.0);
doTest(new MinusElli(), startPoint, boundaries,
- GoalType.MAXIMIZE,
+ GoalType.MAXIMIZE,
2e-10, 5e-6, 1000, expected);
- boundaries = boundaries(DIM,-0.3,0.3);
+ boundaries = boundaries(DIM,-0.3,0.3);
startPoint = point(DIM,0.1);
doTest(new MinusElli(), startPoint, boundaries,
- GoalType.MAXIMIZE,
+ GoalType.MAXIMIZE,
2e-10, 5e-6, 1000, expected);
}
@@ -109,7 +109,7 @@ public class BOBYQAOptimizerTest {
PointValuePair expected =
new PointValuePair(point(DIM,0.0),0.0);
doTest(new Elli(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-13, 1e-6, 1000, expected);
}
@@ -120,7 +120,7 @@ public class BOBYQAOptimizerTest {
PointValuePair expected =
new PointValuePair(point(DIM,0.0),0.0);
doTest(new ElliRotated(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-12, 1e-6, 10000, expected);
}
@@ -131,7 +131,7 @@ public class BOBYQAOptimizerTest {
PointValuePair expected =
new PointValuePair(point(DIM,0.0),0.0);
doTest(new Cigar(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-13, 1e-6, 100, expected);
}
@@ -153,7 +153,7 @@ public class BOBYQAOptimizerTest {
PointValuePair expected =
new PointValuePair(point(DIM,0.0),0.0);
doTest(new CigTab(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-13, 5e-5, 100, expected);
}
@@ -164,18 +164,18 @@ public class BOBYQAOptimizerTest {
PointValuePair expected =
new PointValuePair(point(DIM,0.0),0.0);
doTest(new Sphere(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-13, 1e-6, 100, expected);
}
@Test
public void testTablet() {
- double[] startPoint = point(DIM,1.0);
+ double[] startPoint = point(DIM,1.0);
double[][] boundaries = null;
PointValuePair expected =
new PointValuePair(point(DIM,0.0),0.0);
doTest(new Tablet(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-13, 1e-6, 100, expected);
}
@@ -186,7 +186,7 @@ public class BOBYQAOptimizerTest {
PointValuePair expected =
new PointValuePair(point(DIM/2,0.0),0.0);
doTest(new DiffPow(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-8, 1e-1, 21000, expected);
}
@@ -197,7 +197,7 @@ public class BOBYQAOptimizerTest {
PointValuePair expected =
new PointValuePair(point(DIM/2,0.0),0.0);
doTest(new SsDiffPow(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-2, 1.3e-1, 50000, expected);
}
@@ -220,7 +220,7 @@ public class BOBYQAOptimizerTest {
PointValuePair expected =
new PointValuePair(point(DIM,0.0),0.0);
doTest(new Rastrigin(), startPoint, boundaries,
- GoalType.MINIMIZE,
+ GoalType.MINIMIZE,
1e-13, 1e-6, 1000, expected);
}
@@ -331,7 +331,7 @@ public class BOBYQAOptimizerTest {
optim.optimize(maxEvaluations, func, goal,
new InitialGuess(startPoint),
new SimpleBounds(lB, uB));
-// System.out.println(func.getClass().getName() + " = "
+// System.out.println(func.getClass().getName() + " = "
// + optim.getEvaluations() + " f(");
// for (double x: result.getPoint()) System.out.print(x + " ");
// System.out.println(") = " + result.getValue());
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optimization/direct/CMAESOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optimization/direct/CMAESOptimizerTest.java b/src/test/java/org/apache/commons/math3/optimization/direct/CMAESOptimizerTest.java
index 29c3eec..2826d31 100644
--- a/src/test/java/org/apache/commons/math3/optimization/direct/CMAESOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math3/optimization/direct/CMAESOptimizerTest.java
@@ -46,7 +46,7 @@ public class CMAESOptimizerTest {
static final int DIM = 13;
static final int LAMBDA = 4 + (int)(3.*FastMath.log(DIM));
-
+
@Test(expected = NumberIsTooLargeException.class)
public void testInitOutofbounds1() {
double[] startPoint = point(DIM,3);
@@ -69,7 +69,7 @@ public class CMAESOptimizerTest {
GoalType.MINIMIZE, LAMBDA, true, 0, 1e-13,
1e-13, 1e-6, 100000, expected);
}
-
+
@Test(expected = DimensionMismatchException.class)
public void testBoundariesDimensionMismatch() {
double[] startPoint = point(DIM,0.5);
@@ -117,7 +117,7 @@ public class CMAESOptimizerTest {
GoalType.MINIMIZE, LAMBDA, true, 0, 1e-13,
1e-13, 1e-6, 100000, expected);
}
-
+
@Test
@Retry(3)
public void testRosen() {
@@ -148,7 +148,7 @@ public class CMAESOptimizerTest {
doTest(new MinusElli(), startPoint, insigma, boundaries,
GoalType.MAXIMIZE, LAMBDA, false, 0, 1.0-1e-13,
2e-10, 5e-6, 100000, expected);
- boundaries = boundaries(DIM,-0.3,0.3);
+ boundaries = boundaries(DIM,-0.3,0.3);
startPoint = point(DIM,0.1);
doTest(new MinusElli(), startPoint, insigma, boundaries,
GoalType.MAXIMIZE, LAMBDA, true, 0, 1.0-1e-13,
@@ -397,7 +397,7 @@ public class CMAESOptimizerTest {
};
final double[] start = { 1 };
-
+
// No bounds.
PointValuePair result = optimizer.optimize(100000, fitnessFunction, GoalType.MINIMIZE,
start);
@@ -426,7 +426,7 @@ public class CMAESOptimizerTest {
Assert.assertEquals(resNoBound, resNearLo, 1e-3);
Assert.assertEquals(resNoBound, resNearHi, 1e-3);
}
-
+
/**
* @param func Function to optimize.
* @param startPoint Starting point.
@@ -449,7 +449,7 @@ public class CMAESOptimizerTest {
GoalType goal,
int lambda,
boolean isActive,
- int diagonalOnly,
+ int diagonalOnly,
double stopValue,
double fTol,
double pointTol,
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optimization/fitting/GaussianFitterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optimization/fitting/GaussianFitterTest.java b/src/test/java/org/apache/commons/math3/optimization/fitting/GaussianFitterTest.java
index ddccdb2..af8acd4 100644
--- a/src/test/java/org/apache/commons/math3/optimization/fitting/GaussianFitterTest.java
+++ b/src/test/java/org/apache/commons/math3/optimization/fitting/GaussianFitterTest.java
@@ -200,7 +200,7 @@ public class GaussianFitterTest {
GaussianFitter fitter = new GaussianFitter(new LevenbergMarquardtOptimizer());
fitter.fit();
}
-
+
/**
* Two points is not enough observed points.
*/
@@ -213,7 +213,7 @@ public class GaussianFitterTest {
fitter);
fitter.fit();
}
-
+
/**
* Poor data: right of peak not symmetric with left of peak.
*/
@@ -226,8 +226,8 @@ public class GaussianFitterTest {
Assert.assertEquals(233003.2967252038, parameters[0], 1e-4);
Assert.assertEquals(-10.654887521095983, parameters[1], 1e-4);
Assert.assertEquals(4.335937353196641, parameters[2], 1e-4);
- }
-
+ }
+
/**
* Poor data: long tails.
*/
@@ -241,7 +241,7 @@ public class GaussianFitterTest {
Assert.assertEquals(-13.29641995105174, parameters[1], 1e-4);
Assert.assertEquals(1.7297330293549908, parameters[2], 1e-4);
}
-
+
/**
* Poor data: right of peak is missing.
*/
@@ -254,7 +254,7 @@ public class GaussianFitterTest {
Assert.assertEquals(285250.66754309234, parameters[0], 1e-4);
Assert.assertEquals(-13.528375695228455, parameters[1], 1e-4);
Assert.assertEquals(1.5204344894331614, parameters[2], 1e-4);
- }
+ }
/**
* Basic with smaller dataset.
@@ -275,7 +275,7 @@ public class GaussianFitterTest {
// The optimizer will try negative sigma values but "GaussianFitter"
// will catch the raised exceptions and return NaN values instead.
- final double[] data = {
+ final double[] data = {
1.1143831578403364E-29,
4.95281403484594E-28,
1.1171347211930288E-26,
@@ -343,7 +343,7 @@ public class GaussianFitterTest {
Assert.assertEquals(0.603770729862231, p[1], 1e-15);
Assert.assertEquals(1.0786447936766612, p[2], 1e-14);
}
-
+
/**
* Adds the specified points to specified <code>GaussianFitter</code>
* instance.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optimization/general/AbstractLeastSquaresOptimizerAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optimization/general/AbstractLeastSquaresOptimizerAbstractTest.java b/src/test/java/org/apache/commons/math3/optimization/general/AbstractLeastSquaresOptimizerAbstractTest.java
index 4dbe17d..de80e44 100644
--- a/src/test/java/org/apache/commons/math3/optimization/general/AbstractLeastSquaresOptimizerAbstractTest.java
+++ b/src/test/java/org/apache/commons/math3/optimization/general/AbstractLeastSquaresOptimizerAbstractTest.java
@@ -514,7 +514,7 @@ public abstract class AbstractLeastSquaresOptimizerAbstractTest {
for (int j = 0; j < factors.getColumnDimension(); ++j) {
value[i] = value[i].add(variables[j].multiply(factors.getEntry(i, j)));
}
-
+
}
return value;
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optimization/general/NonLinearConjugateGradientOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optimization/general/NonLinearConjugateGradientOptimizerTest.java b/src/test/java/org/apache/commons/math3/optimization/general/NonLinearConjugateGradientOptimizerTest.java
index 26091a4..f606b28 100644
--- a/src/test/java/org/apache/commons/math3/optimization/general/NonLinearConjugateGradientOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math3/optimization/general/NonLinearConjugateGradientOptimizerTest.java
@@ -194,7 +194,7 @@ public class NonLinearConjugateGradientOptimizerTest {
new SimpleValueChecker(1e-13, 1e-13),
new BrentSolver(),
preconditioner);
-
+
PointValuePair optimum =
optimizer.optimize(100, problem, GoalType.MINIMIZE, new double[] { 0, 0, 0, 0, 0, 0 });
Assert.assertEquals( 3.0, optimum.getPoint()[0], 1.0e-10);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optimization/linear/SimplexSolverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optimization/linear/SimplexSolverTest.java b/src/test/java/org/apache/commons/math3/optimization/linear/SimplexSolverTest.java
index 110992a..3e5f188 100644
--- a/src/test/java/org/apache/commons/math3/optimization/linear/SimplexSolverTest.java
+++ b/src/test/java/org/apache/commons/math3/optimization/linear/SimplexSolverTest.java
@@ -35,7 +35,7 @@ public class SimplexSolverTest {
public void testMath828() {
LinearObjectiveFunction f = new LinearObjectiveFunction(
new double[] { 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 0.0);
-
+
ArrayList <LinearConstraint>constraints = new ArrayList<LinearConstraint>();
constraints.add(new LinearConstraint(new double[] {0.0, 39.0, 23.0, 96.0, 15.0, 48.0, 9.0, 21.0, 48.0, 36.0, 76.0, 19.0, 88.0, 17.0, 16.0, 36.0,}, Relationship.GEQ, 15.0));
@@ -45,7 +45,7 @@ public class SimplexSolverTest {
constraints.add(new LinearConstraint(new double[] {25.0, -7.0, -99.0, -78.0, -25.0, -14.0, -16.0, -89.0, -39.0, -56.0, -53.0, -9.0, -18.0, -26.0, -11.0, -61.0,}, Relationship.GEQ, 0.0));
constraints.add(new LinearConstraint(new double[] {33.0, -95.0, -15.0, -4.0, -33.0, -3.0, -20.0, -96.0, -27.0, -13.0, -80.0, -24.0, -3.0, -13.0, -57.0, -76.0,}, Relationship.GEQ, 0.0));
constraints.add(new LinearConstraint(new double[] {7.0, -95.0, -39.0, -93.0, -7.0, -94.0, -94.0, -62.0, -76.0, -26.0, -53.0, -57.0, -31.0, -76.0, -53.0, -52.0,}, Relationship.GEQ, 0.0));
-
+
double epsilon = 1e-6;
PointValuePair solution = new SimplexSolver().optimize(f, constraints, GoalType.MINIMIZE, true);
Assert.assertEquals(1.0d, solution.getValue(), epsilon);
@@ -56,7 +56,7 @@ public class SimplexSolverTest {
public void testMath828Cycle() {
LinearObjectiveFunction f = new LinearObjectiveFunction(
new double[] { 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 0.0);
-
+
ArrayList <LinearConstraint>constraints = new ArrayList<LinearConstraint>();
constraints.add(new LinearConstraint(new double[] {0.0, 16.0, 14.0, 69.0, 1.0, 85.0, 52.0, 43.0, 64.0, 97.0, 14.0, 74.0, 89.0, 28.0, 94.0, 58.0, 13.0, 22.0, 21.0, 17.0, 30.0, 25.0, 1.0, 59.0, 91.0, 78.0, 12.0, 74.0, 56.0, 3.0, 88.0,}, Relationship.GEQ, 91.0));
@@ -66,11 +66,11 @@ public class SimplexSolverTest {
constraints.add(new LinearConstraint(new double[] {41.0, -96.0, -41.0, -48.0, -70.0, -43.0, -43.0, -43.0, -97.0, -37.0, -85.0, -70.0, -45.0, -67.0, -87.0, -69.0, -94.0, -54.0, -54.0, -92.0, -79.0, -10.0, -35.0, -20.0, -41.0, -41.0, -65.0, -25.0, -12.0, -8.0, -46.0,}, Relationship.GEQ, 0.0));
constraints.add(new LinearConstraint(new double[] {27.0, -42.0, -65.0, -49.0, -53.0, -42.0, -17.0, -2.0, -61.0, -31.0, -76.0, -47.0, -8.0, -93.0, -86.0, -62.0, -65.0, -63.0, -22.0, -43.0, -27.0, -23.0, -32.0, -74.0, -27.0, -63.0, -47.0, -78.0, -29.0, -95.0, -73.0,}, Relationship.GEQ, 0.0));
constraints.add(new LinearConstraint(new double[] {15.0, -46.0, -41.0, -83.0, -98.0, -99.0, -21.0, -35.0, -7.0, -14.0, -80.0, -63.0, -18.0, -42.0, -5.0, -34.0, -56.0, -70.0, -16.0, -18.0, -74.0, -61.0, -47.0, -41.0, -15.0, -79.0, -18.0, -47.0, -88.0, -68.0, -55.0,}, Relationship.GEQ, 0.0));
-
+
double epsilon = 1e-6;
PointValuePair solution = new SimplexSolver().optimize(f, constraints, GoalType.MINIMIZE, true);
Assert.assertEquals(1.0d, solution.getValue(), epsilon);
- Assert.assertTrue(validSolution(solution, constraints, epsilon));
+ Assert.assertTrue(validSolution(solution, constraints, epsilon));
}
@Test
@@ -148,7 +148,7 @@ public class SimplexSolverTest {
SimplexSolver solver = new SimplexSolver();
PointValuePair solution = solver.optimize(f, constraints, GoalType.MINIMIZE, false);
-
+
Assert.assertTrue(Precision.compareTo(solution.getPoint()[0] * 200.d, 1.d, epsilon) >= 0);
Assert.assertEquals(0.0050, solution.getValue(), epsilon);
}
@@ -171,13 +171,13 @@ public class SimplexSolverTest {
double epsilon = 1e-7;
SimplexSolver simplex = new SimplexSolver();
PointValuePair solution = simplex.optimize(f, constraints, GoalType.MINIMIZE, false);
-
+
Assert.assertTrue(Precision.compareTo(solution.getPoint()[0], -1e-18d, epsilon) >= 0);
- Assert.assertEquals(1.0d, solution.getPoint()[1], epsilon);
+ Assert.assertEquals(1.0d, solution.getPoint()[1], epsilon);
Assert.assertEquals(0.0d, solution.getPoint()[2], epsilon);
Assert.assertEquals(1.0d, solution.getValue(), epsilon);
}
-
+
@Test
public void testMath272() {
LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 2, 2, 1 }, 0);
@@ -612,20 +612,20 @@ public class SimplexSolverTest {
for (int i = 0; i < vals.length; i++) {
result += vals[i] * coeffs[i];
}
-
+
switch (c.getRelationship()) {
case EQ:
if (!Precision.equals(result, c.getValue(), epsilon)) {
return false;
}
break;
-
+
case GEQ:
if (Precision.compareTo(result, c.getValue(), epsilon) < 0) {
return false;
}
break;
-
+
case LEQ:
if (Precision.compareTo(result, c.getValue(), epsilon) > 0) {
return false;
@@ -633,7 +633,7 @@ public class SimplexSolverTest {
break;
}
}
-
+
return true;
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optimization/univariate/BrentOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optimization/univariate/BrentOptimizerTest.java b/src/test/java/org/apache/commons/math3/optimization/univariate/BrentOptimizerTest.java
index 34ee8c7..73054db 100644
--- a/src/test/java/org/apache/commons/math3/optimization/univariate/BrentOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math3/optimization/univariate/BrentOptimizerTest.java
@@ -71,7 +71,7 @@ public final class BrentOptimizerTest {
public void testBoundaries() {
final double lower = -1.0;
final double upper = +1.0;
- UnivariateFunction f = new UnivariateFunction() {
+ UnivariateFunction f = new UnivariateFunction() {
public double value(double x) {
if (x < lower) {
throw new NumberIsTooSmallException(x, lower, true);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optimization/univariate/SimpleUnivariateValueCheckerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optimization/univariate/SimpleUnivariateValueCheckerTest.java b/src/test/java/org/apache/commons/math3/optimization/univariate/SimpleUnivariateValueCheckerTest.java
index 8ad9f66..5964ecc 100644
--- a/src/test/java/org/apache/commons/math3/optimization/univariate/SimpleUnivariateValueCheckerTest.java
+++ b/src/test/java/org/apache/commons/math3/optimization/univariate/SimpleUnivariateValueCheckerTest.java
@@ -31,7 +31,7 @@ public class SimpleUnivariateValueCheckerTest {
public void testIterationCheck() {
final int max = 10;
final SimpleUnivariateValueChecker checker = new SimpleUnivariateValueChecker(1e-1, 1e-2, max);
- Assert.assertTrue(checker.converged(max, null, null));
+ Assert.assertTrue(checker.converged(max, null, null));
Assert.assertTrue(checker.converged(max + 1, null, null));
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/optimization/univariate/UnivariateMultiStartOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/optimization/univariate/UnivariateMultiStartOptimizerTest.java b/src/test/java/org/apache/commons/math3/optimization/univariate/UnivariateMultiStartOptimizerTest.java
index 18fbdab..55929a0 100644
--- a/src/test/java/org/apache/commons/math3/optimization/univariate/UnivariateMultiStartOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math3/optimization/univariate/UnivariateMultiStartOptimizerTest.java
@@ -88,7 +88,7 @@ public class UnivariateMultiStartOptimizerTest {
g.setSeed(4312000053L);
UnivariateMultiStartOptimizer<UnivariateFunction> optimizer =
new UnivariateMultiStartOptimizer<UnivariateFunction>(underlying, 5, g);
-
+
try {
optimizer.optimize(300, f, GoalType.MINIMIZE, -0.3, -0.2);
Assert.fail();
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/primes/PrimesTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/primes/PrimesTest.java b/src/test/java/org/apache/commons/math3/primes/PrimesTest.java
index 19eef5d..ccc4bf9 100644
--- a/src/test/java/org/apache/commons/math3/primes/PrimesTest.java
+++ b/src/test/java/org/apache/commons/math3/primes/PrimesTest.java
@@ -169,4 +169,4 @@ public class PrimesTest {
Assert.assertEquals(1, factors.size());
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/AbstractRandomGeneratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/AbstractRandomGeneratorTest.java b/src/test/java/org/apache/commons/math3/random/AbstractRandomGeneratorTest.java
index 1f3d2b0..7fd2ac9 100644
--- a/src/test/java/org/apache/commons/math3/random/AbstractRandomGeneratorTest.java
+++ b/src/test/java/org/apache/commons/math3/random/AbstractRandomGeneratorTest.java
@@ -26,12 +26,12 @@ public class AbstractRandomGeneratorTest extends RandomGeneratorAbstractTest {
public AbstractRandomGeneratorTest() {
super();
}
-
+
@Override
protected RandomGenerator makeGenerator() {
RandomGenerator generator = new TestRandomGenerator();
generator.setSeed(1001);
return generator;
}
-
+
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/BitsStreamGeneratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/BitsStreamGeneratorTest.java b/src/test/java/org/apache/commons/math3/random/BitsStreamGeneratorTest.java
index da4bc94..6bb0f59 100644
--- a/src/test/java/org/apache/commons/math3/random/BitsStreamGeneratorTest.java
+++ b/src/test/java/org/apache/commons/math3/random/BitsStreamGeneratorTest.java
@@ -28,14 +28,14 @@ public class BitsStreamGeneratorTest extends RandomGeneratorAbstractTest {
public BitsStreamGeneratorTest() {
super();
}
-
+
@Override
protected RandomGenerator makeGenerator() {
RandomGenerator generator = new TestBitStreamGenerator();
generator.setSeed(1000);
return generator;
}
-
+
/**
* Test BitStreamGenerator using a Random as bit source.
*/
@@ -43,7 +43,7 @@ public class BitsStreamGeneratorTest extends RandomGeneratorAbstractTest {
private static final long serialVersionUID = 1L;
private BitRandom ran = new BitRandom();
-
+
@Override
public void setSeed(int seed) {
ran.setSeed(seed);
@@ -58,15 +58,15 @@ public class BitsStreamGeneratorTest extends RandomGeneratorAbstractTest {
@Override
public void setSeed(long seed) {
ran.setSeed((int) seed);
-
+
}
-
+
@Override
protected int next(int bits) {
return ran.nextBits(bits);
- }
+ }
}
-
+
/**
* Extend Random to expose next(bits)
*/
@@ -79,5 +79,5 @@ public class BitsStreamGeneratorTest extends RandomGeneratorAbstractTest {
return next(bits);
}
}
-
+
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/CorrelatedRandomVectorGeneratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/CorrelatedRandomVectorGeneratorTest.java b/src/test/java/org/apache/commons/math3/random/CorrelatedRandomVectorGeneratorTest.java
index f4d5882..3a3fa60 100644
--- a/src/test/java/org/apache/commons/math3/random/CorrelatedRandomVectorGeneratorTest.java
+++ b/src/test/java/org/apache/commons/math3/random/CorrelatedRandomVectorGeneratorTest.java
@@ -147,7 +147,7 @@ public class CorrelatedRandomVectorGeneratorTest {
{0.009881156, 0.008196856, 0.019023866, 0.009210099},
{0.010499559, 0.010732709, 0.009210099, 0.019107243}
};
-
+
final double[][] covMatrix2 = new double[][]{
{0.0, 0.0, 0.0, 0.0, 0.0},
{0.0, 0.013445532, 0.010394690, 0.009881156, 0.010499559},
@@ -155,7 +155,7 @@ public class CorrelatedRandomVectorGeneratorTest {
{0.0, 0.009881156, 0.008196856, 0.019023866, 0.009210099},
{0.0, 0.010499559, 0.010732709, 0.009210099, 0.019107243}
};
-
+
final double[][] covMatrix3 = new double[][]{
{0.013445532, 0.010394690, 0.0, 0.009881156, 0.010499559},
{0.010394690, 0.023006616, 0.0, 0.008196856, 0.010732709},
@@ -163,7 +163,7 @@ public class CorrelatedRandomVectorGeneratorTest {
{0.009881156, 0.008196856, 0.0, 0.019023866, 0.009210099},
{0.010499559, 0.010732709, 0.0, 0.009210099, 0.019107243}
};
-
+
testSampler(covMatrix1, 10000, 0.001);
testSampler(covMatrix2, 10000, 0.001);
testSampler(covMatrix3, 10000, 0.001);
@@ -182,7 +182,7 @@ public class CorrelatedRandomVectorGeneratorTest {
private void testSampler(final double[][] covMatrix, int samples, double epsilon) {
CorrelatedRandomVectorGenerator sampler = createSampler(covMatrix);
-
+
StorelessCovariance cov = new StorelessCovariance(covMatrix.length);
for (int i = 0; i < samples; ++i) {
cov.increment(sampler.nextVector());
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/EmpiricalDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/EmpiricalDistributionTest.java b/src/test/java/org/apache/commons/math3/random/EmpiricalDistributionTest.java
index 71763e1..c0dd2a4 100644
--- a/src/test/java/org/apache/commons/math3/random/EmpiricalDistributionTest.java
+++ b/src/test/java/org/apache/commons/math3/random/EmpiricalDistributionTest.java
@@ -103,13 +103,13 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
// Load from a URL
empiricalDistribution.load(url);
checkDistribution();
-
+
// Load again from a file (also verifies idempotency of load)
File file = new File(url.toURI());
empiricalDistribution.load(file);
checkDistribution();
}
-
+
private void checkDistribution() {
// testData File has 10000 values, with mean ~ 5.0, std dev ~ 1
// Make sure that loaded distribution matches this
@@ -245,24 +245,24 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
TestUtils.assertEquals(expectedBinUpperBounds, dist.getUpperBounds(), tol);
TestUtils.assertEquals(expectedGeneratorUpperBounds, dist.getGeneratorUpperBounds(), tol);
}
-
+
@Test
public void testGeneratorConfig() {
double[] testData = {0, 1, 2, 3, 4};
RandomGenerator generator = new RandomAdaptorTest.ConstantGenerator(0.5);
-
+
EmpiricalDistribution dist = new EmpiricalDistribution(5, generator);
dist.load(testData);
for (int i = 0; i < 5; i++) {
Assert.assertEquals(2.0, dist.getNextValue(), 0d);
}
-
+
// Verify no NPE with null generator argument
dist = new EmpiricalDistribution(5, (RandomGenerator) null);
dist.load(testData);
dist.getNextValue();
}
-
+
@Test
public void testReSeed() throws Exception {
empiricalDistribution.load(url);
@@ -310,9 +310,9 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
Assert.assertEquals("mean", 5.069831575018909, stats.getMean(), tolerance);
Assert.assertEquals("std dev", 1.0173699343977738, stats.getStandardDeviation(), tolerance);
}
-
+
// Setup for distribution tests
-
+
@Override
public RealDistribution makeDistribution() {
// Create a uniform distribution on [0, 10,000]
@@ -324,10 +324,10 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
dist.load(sourceData);
return dist;
}
-
+
/** Uniform bin mass = 10/10001 == mass of all but the first bin */
private final double binMass = 10d / (n + 1);
-
+
/** Mass of first bin = 11/10001 */
private final double firstBinMass = 11d / (n + 1);
@@ -336,11 +336,11 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
final double[] testPoints = new double[] {9, 10, 15, 1000, 5004, 9999};
return testPoints;
}
-
+
@Override
public double[] makeCumulativeTestValues() {
- /*
+ /*
* Bins should be [0, 10], (10, 20], ..., (9990, 10000]
* Kernels should be N(4.5, 3.02765), N(14.5, 3.02765)...
* Each bin should have mass 10/10000 = .001
@@ -379,12 +379,12 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
final RealDistribution kernel = findKernel(lower, upper);
final double withinBinKernelMass = kernel.cumulativeProbability(lower, upper);
final double density = kernel.density(testPoints[i]);
- densityValues[i] = density * (bin == 0 ? firstBinMass : binMass) / withinBinKernelMass;
+ densityValues[i] = density * (bin == 0 ? firstBinMass : binMass) / withinBinKernelMass;
}
return densityValues;
}
-
- /**
+
+ /**
* Modify test integration bounds from the default. Because the distribution
* has discontinuities at bin boundaries, integrals spanning multiple bins
* will face convergence problems. Only test within-bin integrals and spans
@@ -406,15 +406,15 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
final double[] upper = {5, 12, 1030, 5010, 10000};
for (int i = 1; i < 5; i++) {
Assert.assertEquals(
- distribution.cumulativeProbability(
+ distribution.cumulativeProbability(
lower[i], upper[i]),
integrator.integrate(
1000000, // Triangle integrals are very slow to converge
d, lower[i], upper[i]), tol);
}
}
-
- /**
+
+ /**
* MATH-984
* Verify that sampled values do not go outside of the range of the data.
*/
@@ -438,7 +438,7 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
Assert.assertTrue(dev > 0);
}
}
-
+
/**
* MATH-1203, MATH-1208
*/
@@ -456,8 +456,8 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
Assert.assertEquals(1.0, dist.cumulativeProbability(1), Double.MIN_VALUE);
Assert.assertEquals(0.5, dist.cumulativeProbability(0.5), Double.MIN_VALUE);
Assert.assertEquals(0.5, dist.cumulativeProbability(0.7), Double.MIN_VALUE);
- }
-
+ }
+
/**
* Find the bin that x belongs (relative to {@link #makeDistribution()}).
*/
@@ -468,7 +468,7 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
// If x falls on a bin boundary, it is in the lower bin
return FastMath.floor(x / 10) == x / 10 ? bin - 1 : bin;
}
-
+
/**
* Find the within-bin kernel for the bin with lower bound lower
* and upper bound upper. All bins other than the first contain 10 points
@@ -480,10 +480,10 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
if (lower < 1) {
return new NormalDistribution(5d, 3.3166247903554);
} else {
- return new NormalDistribution((upper + lower + 1) / 2d, 3.0276503540974917);
+ return new NormalDistribution((upper + lower + 1) / 2d, 3.0276503540974917);
}
}
-
+
@Test
public void testKernelOverrideConstant() {
final EmpiricalDistribution dist = new ConstantKernelEmpiricalDistribution(5);
@@ -509,7 +509,7 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
Assert.assertEquals(8.0, dist.inverseCumulativeProbability(0.5), tol);
Assert.assertEquals(8.0, dist.inverseCumulativeProbability(0.6), tol);
}
-
+
@Test
public void testKernelOverrideUniform() {
final EmpiricalDistribution dist = new UniformKernelEmpiricalDistribution(5);
@@ -517,14 +517,14 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
dist.load(data);
// Kernels are uniform distributions on [1,3], [4,6], [7,9], [10,12], [13,15]
final double bounds[] = {3d, 6d, 9d, 12d};
- final double tol = 10E-12;
+ final double tol = 10E-12;
for (int i = 0; i < 20; i++) {
final double v = dist.sample();
// Make sure v is not in the excluded range between bins - that is (bounds[i], bounds[i] + 1)
for (int j = 0; j < bounds.length; j++) {
Assert.assertFalse(v > bounds[j] + tol && v < bounds[j] + 1 - tol);
}
- }
+ }
Assert.assertEquals(0.0, dist.cumulativeProbability(1), tol);
Assert.assertEquals(0.1, dist.cumulativeProbability(2), tol);
Assert.assertEquals(0.6, dist.cumulativeProbability(10), tol);
@@ -539,8 +539,8 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
Assert.assertEquals(8.0, dist.inverseCumulativeProbability(0.5), tol);
Assert.assertEquals(9.0, dist.inverseCumulativeProbability(0.6), tol);
}
-
-
+
+
/**
* Empirical distribution using a constant smoothing kernel.
*/
@@ -555,7 +555,7 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
return new ConstantRealDistribution(bStats.getMean());
}
}
-
+
/**
* Empirical distribution using a uniform smoothing kernel.
*/
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/HaltonSequenceGeneratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/HaltonSequenceGeneratorTest.java b/src/test/java/org/apache/commons/math3/random/HaltonSequenceGeneratorTest.java
index bbe8187..e64eed5 100644
--- a/src/test/java/org/apache/commons/math3/random/HaltonSequenceGeneratorTest.java
+++ b/src/test/java/org/apache/commons/math3/random/HaltonSequenceGeneratorTest.java
@@ -86,7 +86,7 @@ public class HaltonSequenceGeneratorTest {
} catch (OutOfRangeException e) {
// expected
}
-
+
try {
new HaltonSequenceGenerator(41);
Assert.fail("an exception should have been thrown");
@@ -124,7 +124,7 @@ public class HaltonSequenceGeneratorTest {
double[] result = generator.skipTo(5);
Assert.assertArrayEquals(referenceValues[5], result, 1e-3);
Assert.assertEquals(6, generator.getNextIndex());
-
+
for (int i = 6; i < referenceValues.length; i++) {
result = generator.nextVector();
Assert.assertArrayEquals(referenceValues[i], result, 1e-3);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/MersenneTwisterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/MersenneTwisterTest.java b/src/test/java/org/apache/commons/math3/random/MersenneTwisterTest.java
index 3a72e11..4e3e2c9 100644
--- a/src/test/java/org/apache/commons/math3/random/MersenneTwisterTest.java
+++ b/src/test/java/org/apache/commons/math3/random/MersenneTwisterTest.java
@@ -25,10 +25,10 @@ public class MersenneTwisterTest extends RandomGeneratorAbstractTest {
protected RandomGenerator makeGenerator() {
return new MersenneTwister(111);
}
-
+
// TODO: Some of the tests moved up to RandomGeneratorAbstractTest tested alternative seeding / constructors
// Tests exercising these features directly should be added to this class.
-
+
@Test
public void testMakotoNishimura() {
MersenneTwister mt = new MersenneTwister(new int[] {0x123, 0x234, 0x345, 0x456});
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/RandomAdaptorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/RandomAdaptorTest.java b/src/test/java/org/apache/commons/math3/random/RandomAdaptorTest.java
index 02109ef..289ccf1 100644
--- a/src/test/java/org/apache/commons/math3/random/RandomAdaptorTest.java
+++ b/src/test/java/org/apache/commons/math3/random/RandomAdaptorTest.java
@@ -58,13 +58,13 @@ public class RandomAdaptorTest {
*
*/
public static class ConstantGenerator implements RandomGenerator {
-
+
private final double value;
-
+
public ConstantGenerator() {
value = 0;
}
-
+
public ConstantGenerator(double value) {
this.value = value;
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/RandomGeneratorAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/RandomGeneratorAbstractTest.java b/src/test/java/org/apache/commons/math3/random/RandomGeneratorAbstractTest.java
index 0094553..0c492b1 100644
--- a/src/test/java/org/apache/commons/math3/random/RandomGeneratorAbstractTest.java
+++ b/src/test/java/org/apache/commons/math3/random/RandomGeneratorAbstractTest.java
@@ -66,7 +66,7 @@ public abstract class RandomGeneratorAbstractTest extends RandomDataGeneratorTes
public void setUp() {
generator = makeGenerator();
}
-
+
// Omit secureXxx tests, since they do not use the provided generator
@Override
public void testNextSecureLongIAE() {}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/SobolSequenceGeneratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/SobolSequenceGeneratorTest.java b/src/test/java/org/apache/commons/math3/random/SobolSequenceGeneratorTest.java
index c09d09b..73f13f0 100644
--- a/src/test/java/org/apache/commons/math3/random/SobolSequenceGeneratorTest.java
+++ b/src/test/java/org/apache/commons/math3/random/SobolSequenceGeneratorTest.java
@@ -54,7 +54,7 @@ public class SobolSequenceGeneratorTest {
Assert.assertEquals(i + 1, generator.getNextIndex());
}
}
-
+
@Test
public void testConstructor() {
try {
@@ -63,7 +63,7 @@ public class SobolSequenceGeneratorTest {
} catch (OutOfRangeException e) {
// expected
}
-
+
try {
new SobolSequenceGenerator(1001);
Assert.fail("an exception should have been thrown");
@@ -82,7 +82,7 @@ public class SobolSequenceGeneratorTest {
} catch (OutOfRangeException e) {
// expected
}
-
+
try {
new SobolSequenceGenerator(1001);
Assert.fail("an exception should have been thrown");
@@ -96,7 +96,7 @@ public class SobolSequenceGeneratorTest {
double[] result = generator.skipTo(5);
Assert.assertArrayEquals(referenceValues[5], result, 1e-6);
Assert.assertEquals(6, generator.getNextIndex());
-
+
for (int i = 6; i < referenceValues.length; i++) {
result = generator.nextVector();
Assert.assertArrayEquals(referenceValues[i], result, 1e-6);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/StableRandomGeneratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/StableRandomGeneratorTest.java b/src/test/java/org/apache/commons/math3/random/StableRandomGeneratorTest.java
index 5531ceb..8d75105 100644
--- a/src/test/java/org/apache/commons/math3/random/StableRandomGeneratorTest.java
+++ b/src/test/java/org/apache/commons/math3/random/StableRandomGeneratorTest.java
@@ -25,7 +25,7 @@ import org.junit.Test;
/**
* The class <code>StableRandomGeneratorTest</code> contains tests for the class
* {@link StableRandomGenerator}
- *
+ *
*/
public class StableRandomGeneratorTest {
@@ -35,7 +35,7 @@ public class StableRandomGeneratorTest {
/**
* Run the double nextDouble() method test Due to leptokurtic property the
* acceptance range is widened.
- *
+ *
* TODO: verify that tolerance this wide is really OK
*/
@Test
@@ -128,4 +128,4 @@ public class StableRandomGeneratorTest {
Assert.assertEquals(2.0, e.getArgument());
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/UnitSphereRandomVectorGeneratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/UnitSphereRandomVectorGeneratorTest.java b/src/test/java/org/apache/commons/math3/random/UnitSphereRandomVectorGeneratorTest.java
index 4676a82..b1727b2 100644
--- a/src/test/java/org/apache/commons/math3/random/UnitSphereRandomVectorGeneratorTest.java
+++ b/src/test/java/org/apache/commons/math3/random/UnitSphereRandomVectorGeneratorTest.java
@@ -27,7 +27,7 @@ public class UnitSphereRandomVectorGeneratorTest {
*/
@Test
public void test2DDistribution() {
-
+
RandomGenerator rg = new JDKRandomGenerator();
rg.setSeed(17399225432l);
UnitSphereRandomVectorGenerator generator = new UnitSphereRandomVectorGenerator(2, rg);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/ValueServerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/ValueServerTest.java b/src/test/java/org/apache/commons/math3/random/ValueServerTest.java
index 145b9b8..5fa29a2 100644
--- a/src/test/java/org/apache/commons/math3/random/ValueServerTest.java
+++ b/src/test/java/org/apache/commons/math3/random/ValueServerTest.java
@@ -76,12 +76,12 @@ public final class ValueServerTest {
Assert.assertEquals("std dev", 1.0173699343977738, stats.getStandardDeviation(),
tolerance);
}
-
+
/**
* Verify that when provided with fixed seeds, stochastic modes
* generate fixed sequences. Verifies the fix for MATH-654.
*/
- @Test
+ @Test
public void testFixedSeed() throws Exception {
ValueServer valueServer = new ValueServer();
URL url = getClass().getResource("testData.txt");
@@ -92,7 +92,7 @@ public final class ValueServerTest {
checkFixedSeed(valueServer, ValueServer.GAUSSIAN_MODE);
checkFixedSeed(valueServer, ValueServer.UNIFORM_MODE);
}
-
+
/**
* Do the check for {@link #testFixedSeed()}
* @param mode ValueServer mode
@@ -108,7 +108,7 @@ public final class ValueServerTest {
for (int i = 0; i < 100; i++) {
values[1][i] = valueServer.getNext();
}
- Assert.assertTrue(Arrays.equals(values[0], values[1]));
+ Assert.assertTrue(Arrays.equals(values[0], values[1]));
}
/**
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/Well19937aTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/Well19937aTest.java b/src/test/java/org/apache/commons/math3/random/Well19937aTest.java
index ff9fe95..7db3428 100644
--- a/src/test/java/org/apache/commons/math3/random/Well19937aTest.java
+++ b/src/test/java/org/apache/commons/math3/random/Well19937aTest.java
@@ -20,7 +20,7 @@ import org.junit.Assert;
import org.junit.Test;
public class Well19937aTest extends RandomGeneratorAbstractTest {
-
+
@Override
public RandomGenerator makeGenerator() {
return new Well19937a(100);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/Well19937cTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/Well19937cTest.java b/src/test/java/org/apache/commons/math3/random/Well19937cTest.java
index a9f7a8e..1b0bf3f 100644
--- a/src/test/java/org/apache/commons/math3/random/Well19937cTest.java
+++ b/src/test/java/org/apache/commons/math3/random/Well19937cTest.java
@@ -20,7 +20,7 @@ import org.junit.Assert;
import org.junit.Test;
public class Well19937cTest extends RandomGeneratorAbstractTest {
-
+
@Override
public RandomGenerator makeGenerator() {
return new Well19937c(100);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/Well44497aTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/Well44497aTest.java b/src/test/java/org/apache/commons/math3/random/Well44497aTest.java
index ac46eb7..78500a6 100644
--- a/src/test/java/org/apache/commons/math3/random/Well44497aTest.java
+++ b/src/test/java/org/apache/commons/math3/random/Well44497aTest.java
@@ -20,12 +20,12 @@ import org.junit.Assert;
import org.junit.Test;
public class Well44497aTest extends RandomGeneratorAbstractTest {
-
+
@Override
public RandomGenerator makeGenerator() {
return new Well44497a(100);
}
-
+
@Test
public void testReferenceCode() {
int[] base = {
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/Well44497bTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/Well44497bTest.java b/src/test/java/org/apache/commons/math3/random/Well44497bTest.java
index 23be971..a3748bd 100644
--- a/src/test/java/org/apache/commons/math3/random/Well44497bTest.java
+++ b/src/test/java/org/apache/commons/math3/random/Well44497bTest.java
@@ -20,12 +20,12 @@ import org.junit.Assert;
import org.junit.Test;
public class Well44497bTest extends RandomGeneratorAbstractTest {
-
+
@Override
public RandomGenerator makeGenerator() {
return new Well44497b(100);
}
-
+
@Test
public void testReferenceCode() {
int[] base = {
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/random/Well512aTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/random/Well512aTest.java b/src/test/java/org/apache/commons/math3/random/Well512aTest.java
index 01cfe75..f88938a 100644
--- a/src/test/java/org/apache/commons/math3/random/Well512aTest.java
+++ b/src/test/java/org/apache/commons/math3/random/Well512aTest.java
@@ -20,7 +20,7 @@ import org.junit.Assert;
import org.junit.Test;
public class Well512aTest extends RandomGeneratorAbstractTest {
-
+
@Override
public RandomGenerator makeGenerator() {
return new Well512a(101);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/special/BesselJTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/special/BesselJTest.java b/src/test/java/org/apache/commons/math3/special/BesselJTest.java
index 7477bf4..83ec982 100644
--- a/src/test/java/org/apache/commons/math3/special/BesselJTest.java
+++ b/src/test/java/org/apache/commons/math3/special/BesselJTest.java
@@ -35,7 +35,7 @@ public class BesselJTest {
* near.eight = 8 + seq(-.5,.5,.1)
* largexs = c(10,30,100,300,1000)
* xs = unique(sort(c(smallxs, medxs, near.eight,largexs)))
- *
+ *
* for (n in c(0:15, 30, 100)) {
* for (x in xs) {
* val = format( besselJ(x,n), digits=20 )
@@ -763,12 +763,12 @@ public class BesselJTest {
Assert.assertEquals(msg, expected, actual, tol);
}
}
-
+
@Test(expected=MathIllegalArgumentException.class)
public void testIAEBadOrder() {
BesselJ.value(-1, 1);
}
-
+
@Test(expected=MathIllegalArgumentException.class)
public void testIAEBadArgument() {
BesselJ.value(1, 100000);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ff35e6f2/src/test/java/org/apache/commons/math3/special/ErfTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/special/ErfTest.java b/src/test/java/org/apache/commons/math3/special/ErfTest.java
index 3e26662..6a1b86d 100644
--- a/src/test/java/org/apache/commons/math3/special/ErfTest.java
+++ b/src/test/java/org/apache/commons/math3/special/ErfTest.java
@@ -89,7 +89,7 @@ public class ErfTest {
Assert.assertEquals(expected, actual, 1.0e-5);
Assert.assertEquals(1 - expected, Erf.erfc(-x), 1.0e-5);
}
-
+
/**
* MATH-301, MATH-456
*/
@@ -107,14 +107,14 @@ public class ErfTest {
Assert.assertTrue(result >= 0 && result < 1);
result = Erf.erfc(-i);
Assert.assertFalse(Double.isNaN(result));
- Assert.assertTrue(result >= 1 && result <= 2);
+ Assert.assertTrue(result >= 1 && result <= 2);
}
Assert.assertEquals(-1, Erf.erf(Double.NEGATIVE_INFINITY), 0);
Assert.assertEquals(1, Erf.erf(Double.POSITIVE_INFINITY), 0);
Assert.assertEquals(2, Erf.erfc(Double.NEGATIVE_INFINITY), 0);
Assert.assertEquals(0, Erf.erfc(Double.POSITIVE_INFINITY), 0);
}
-
+
/**
* Compare Erf.erf against reference values computed using GCC 4.2.1 (Apple OSX packaged version)
* erfl (extended precision erf).
@@ -122,15 +122,15 @@ public class ErfTest {
@Test
public void testErfGnu() {
final double tol = 1E-15;
- final double[] gnuValues = new double[] {-1, -1, -1, -1, -1,
- -1, -1, -1, -0.99999999999999997848,
- -0.99999999999999264217, -0.99999999999846254017, -0.99999999980338395581, -0.99999998458274209971,
- -0.9999992569016276586, -0.99997790950300141459, -0.99959304798255504108, -0.99532226501895273415,
- -0.96610514647531072711, -0.84270079294971486948, -0.52049987781304653809, 0,
- 0.52049987781304653809, 0.84270079294971486948, 0.96610514647531072711, 0.99532226501895273415,
- 0.99959304798255504108, 0.99997790950300141459, 0.9999992569016276586, 0.99999998458274209971,
- 0.99999999980338395581, 0.99999999999846254017, 0.99999999999999264217, 0.99999999999999997848,
- 1, 1, 1, 1,
+ final double[] gnuValues = new double[] {-1, -1, -1, -1, -1,
+ -1, -1, -1, -0.99999999999999997848,
+ -0.99999999999999264217, -0.99999999999846254017, -0.99999999980338395581, -0.99999998458274209971,
+ -0.9999992569016276586, -0.99997790950300141459, -0.99959304798255504108, -0.99532226501895273415,
+ -0.96610514647531072711, -0.84270079294971486948, -0.52049987781304653809, 0,
+ 0.52049987781304653809, 0.84270079294971486948, 0.96610514647531072711, 0.99532226501895273415,
+ 0.99959304798255504108, 0.99997790950300141459, 0.9999992569016276586, 0.99999998458274209971,
+ 0.99999999980338395581, 0.99999999999846254017, 0.99999999999999264217, 0.99999999999999997848,
+ 1, 1, 1, 1,
1, 1, 1, 1};
double x = -10d;
for (int i = 0; i < 41; i++) {
@@ -138,7 +138,7 @@ public class ErfTest {
x += 0.5d;
}
}
-
+
/**
* Compare Erf.erfc against reference values computed using GCC 4.2.1 (Apple OSX packaged version)
* erfcl (extended precision erfc).
@@ -146,15 +146,15 @@ public class ErfTest {
@Test
public void testErfcGnu() {
final double tol = 1E-15;
- final double[] gnuValues = new double[] { 2, 2, 2, 2, 2,
- 2, 2, 2, 1.9999999999999999785,
- 1.9999999999999926422, 1.9999999999984625402, 1.9999999998033839558, 1.9999999845827420998,
- 1.9999992569016276586, 1.9999779095030014146, 1.9995930479825550411, 1.9953222650189527342,
- 1.9661051464753107271, 1.8427007929497148695, 1.5204998778130465381, 1,
- 0.47950012218695346194, 0.15729920705028513051, 0.033894853524689272893, 0.0046777349810472658333,
- 0.00040695201744495893941, 2.2090496998585441366E-05, 7.4309837234141274516E-07, 1.5417257900280018858E-08,
- 1.966160441542887477E-10, 1.5374597944280348501E-12, 7.3578479179743980661E-15, 2.1519736712498913103E-17,
- 3.8421483271206474691E-20, 4.1838256077794144006E-23, 2.7766493860305691016E-26, 1.1224297172982927079E-29,
+ final double[] gnuValues = new double[] { 2, 2, 2, 2, 2,
+ 2, 2, 2, 1.9999999999999999785,
+ 1.9999999999999926422, 1.9999999999984625402, 1.9999999998033839558, 1.9999999845827420998,
+ 1.9999992569016276586, 1.9999779095030014146, 1.9995930479825550411, 1.9953222650189527342,
+ 1.9661051464753107271, 1.8427007929497148695, 1.5204998778130465381, 1,
+ 0.47950012218695346194, 0.15729920705028513051, 0.033894853524689272893, 0.0046777349810472658333,
+ 0.00040695201744495893941, 2.2090496998585441366E-05, 7.4309837234141274516E-07, 1.5417257900280018858E-08,
+ 1.966160441542887477E-10, 1.5374597944280348501E-12, 7.3578479179743980661E-15, 2.1519736712498913103E-17,
+ 3.8421483271206474691E-20, 4.1838256077794144006E-23, 2.7766493860305691016E-26, 1.1224297172982927079E-29,
2.7623240713337714448E-33, 4.1370317465138102353E-37, 3.7692144856548799402E-41, 2.0884875837625447567E-45};
double x = -10d;
for (int i = 0; i < 41; i++) {
@@ -162,9 +162,9 @@ public class ErfTest {
x += 0.5d;
}
}
-
+
/**
- * Tests erfc against reference data computed using Maple reported in Marsaglia, G,,
+ * Tests erfc against reference data computed using Maple reported in Marsaglia, G,,
* "Evaluating the Normal Distribution," Journal of Statistical Software, July, 2004.
* http//www.jstatsoft.org/v11/a05/paper
*/
@@ -176,13 +176,13 @@ public class ErfTest {
{2.3, 1.07241100216758e-02},
{3.4, 3.36929265676881e-04},
{4.5, 3.39767312473006e-06},
- {5.6, 1.07175902583109e-08},
+ {5.6, 1.07175902583109e-08},
{6.7, 1.04209769879652e-11},
{7.8, 3.09535877195870e-15},
{8.9, 2.79233437493966e-19},
{10.0, 7.61985302416053e-24},
{11.1, 6.27219439321703e-29},
- {12.2, 1.55411978638959e-34},
+ {12.2, 1.55411978638959e-34},
{13.3, 1.15734162836904e-40},
{14.4, 2.58717592540226e-47},
{15.5, 1.73446079179387e-54},
@@ -194,7 +194,7 @@ public class ErfTest {
TestUtils.assertRelativelyEquals(ref[i][1], result, 1E-13);
}
}
-
+
/**
* Test the implementation of Erf.erf(double, double) for consistency with results
* obtained from Erf.erf(double) and Erf.erfc(double).