http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/test/java/org/apache/commons/math4/linear/MatrixUtilsTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/linear/MatrixUtilsTest.java b/src/test/java/org/apache/commons/math4/linear/MatrixUtilsTest.java index b547cdc..c8bd3f9 100644 --- a/src/test/java/org/apache/commons/math4/linear/MatrixUtilsTest.java +++ b/src/test/java/org/apache/commons/math4/linear/MatrixUtilsTest.java @@ -104,9 +104,9 @@ public final class MatrixUtilsTest { @Test public void testcreateFieldMatrix() { - Assert.assertEquals(new Array2DRowFieldMatrix<Fraction>(asFraction(testData)), + Assert.assertEquals(new Array2DRowFieldMatrix<>(asFraction(testData)), MatrixUtils.createFieldMatrix(asFraction(testData))); - Assert.assertEquals(new Array2DRowFieldMatrix<Fraction>(FractionField.getInstance(), fractionColMatrix), + Assert.assertEquals(new Array2DRowFieldMatrix<>(FractionField.getInstance(), fractionColMatrix), MatrixUtils.createFieldMatrix(fractionColMatrix)); try { MatrixUtils.createFieldMatrix(asFraction(new double[][] {{1}, {1,2}})); // ragged @@ -149,9 +149,9 @@ public final class MatrixUtilsTest { @Test public void testCreateRowFieldMatrix() { Assert.assertEquals(MatrixUtils.createRowFieldMatrix(asFraction(row)), - new Array2DRowFieldMatrix<Fraction>(asFraction(rowMatrix))); + new Array2DRowFieldMatrix<>(asFraction(rowMatrix))); Assert.assertEquals(MatrixUtils.createRowFieldMatrix(fractionRow), - new Array2DRowFieldMatrix<Fraction>(fractionRowMatrix)); + new Array2DRowFieldMatrix<>(fractionRowMatrix)); try { MatrixUtils.createRowFieldMatrix(new Fraction[] {}); // empty Assert.fail("Expecting MathIllegalArgumentException"); @@ -187,9 +187,9 @@ public final class MatrixUtilsTest { @Test public void testCreateColumnFieldMatrix() { Assert.assertEquals(MatrixUtils.createColumnFieldMatrix(asFraction(col)), - new Array2DRowFieldMatrix<Fraction>(asFraction(colMatrix))); + new Array2DRowFieldMatrix<>(asFraction(colMatrix))); Assert.assertEquals(MatrixUtils.createColumnFieldMatrix(fractionCol), - new Array2DRowFieldMatrix<Fraction>(fractionColMatrix)); + new Array2DRowFieldMatrix<>(fractionColMatrix)); try { MatrixUtils.createColumnFieldMatrix(new Fraction[] {}); // empty @@ -268,7 +268,7 @@ public final class MatrixUtilsTest { { new BigFraction(2), new BigFraction(5), new BigFraction(3) }, { new BigFraction(1), new BigFraction(0), new BigFraction(8) } }; - FieldMatrix<BigFraction> m = new Array2DRowFieldMatrix<BigFraction>(bfData, false); + FieldMatrix<BigFraction> m = new Array2DRowFieldMatrix<>(bfData, false); RealMatrix converted = MatrixUtils.bigFractionMatrixToRealMatrix(m); RealMatrix reference = new Array2DRowRealMatrix(testData, false); Assert.assertEquals(0.0, converted.subtract(reference).getNorm(), 0.0); @@ -281,7 +281,7 @@ public final class MatrixUtilsTest { { new Fraction(2), new Fraction(5), new Fraction(3) }, { new Fraction(1), new Fraction(0), new Fraction(8) } }; - FieldMatrix<Fraction> m = new Array2DRowFieldMatrix<Fraction>(fData, false); + FieldMatrix<Fraction> m = new Array2DRowFieldMatrix<>(fData, false); RealMatrix converted = MatrixUtils.fractionMatrixToRealMatrix(m); RealMatrix reference = new Array2DRowRealMatrix(testData, false); Assert.assertEquals(0.0, converted.subtract(reference).getNorm(), 0.0);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/test/java/org/apache/commons/math4/linear/SparseFieldMatrixTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/linear/SparseFieldMatrixTest.java b/src/test/java/org/apache/commons/math4/linear/SparseFieldMatrixTest.java index 176b227..0266b30 100644 --- a/src/test/java/org/apache/commons/math4/linear/SparseFieldMatrixTest.java +++ b/src/test/java/org/apache/commons/math4/linear/SparseFieldMatrixTest.java @@ -209,7 +209,7 @@ public class SparseFieldMatrixTest { SparseFieldMatrix<Fraction> m2 = createSparseMatrix(testData2); assertClose("inverse multiply", m.multiply(mInv), identity, entryTolerance); - assertClose("inverse multiply", m.multiply(new Array2DRowFieldMatrix<Fraction>(FractionField.getInstance(), testDataInv)), identity, + assertClose("inverse multiply", m.multiply(new Array2DRowFieldMatrix<>(FractionField.getInstance(), testDataInv)), identity, entryTolerance); assertClose("inverse multiply", mInv.multiply(m), identity, entryTolerance); @@ -270,7 +270,7 @@ public class SparseFieldMatrixTest { assertClose("identity operate", testVector, m.operate(testVector), entryTolerance); assertClose("identity operate", testVector, m.operate( - new ArrayFieldVector<Fraction>(testVector)).toArray(), entryTolerance); + new ArrayFieldVector<>(testVector)).toArray(), entryTolerance); m = createSparseMatrix(bigSingular); try { m.operate(testVector); @@ -296,8 +296,8 @@ public class SparseFieldMatrixTest { @Test public void testTranspose() { FieldMatrix<Fraction> m = createSparseMatrix(testData); - FieldMatrix<Fraction> mIT = new FieldLUDecomposition<Fraction>(m).getSolver().getInverse().transpose(); - FieldMatrix<Fraction> mTI = new FieldLUDecomposition<Fraction>(m.transpose()).getSolver().getInverse(); + FieldMatrix<Fraction> mIT = new FieldLUDecomposition<>(m).getSolver().getInverse().transpose(); + FieldMatrix<Fraction> mTI = new FieldLUDecomposition<>(m.transpose()).getSolver().getInverse(); assertClose("inverse-transpose", mIT, mTI, normTolerance); m = createSparseMatrix(testData2); FieldMatrix<Fraction> mt = createSparseMatrix(testData2T); @@ -311,7 +311,7 @@ public class SparseFieldMatrixTest { assertClose("premultiply", m.preMultiply(testVector), preMultTest, normTolerance); assertClose("premultiply", m.preMultiply( - new ArrayFieldVector<Fraction>(testVector).toArray()), preMultTest, normTolerance); + new ArrayFieldVector<>(testVector).toArray()), preMultTest, normTolerance); m = createSparseMatrix(bigSingular); try { m.preMultiply(testVector); @@ -392,7 +392,7 @@ public class SparseFieldMatrixTest { Assert.assertEquals(2, p.getRowDimension()); Assert.assertEquals(2, p.getColumnDimension()); // Invert p - FieldMatrix<Fraction> pInverse = new FieldLUDecomposition<Fraction>(p).getSolver().getInverse(); + FieldMatrix<Fraction> pInverse = new FieldLUDecomposition<>(p).getSolver().getInverse(); Assert.assertEquals(2, pInverse.getRowDimension()); Assert.assertEquals(2, pInverse.getColumnDimension()); @@ -402,9 +402,9 @@ public class SparseFieldMatrixTest { FieldMatrix<Fraction> coefficients = createSparseMatrix(coefficientsData); Fraction[] constants = { new Fraction(1), new Fraction(-2), new Fraction(1) }; Fraction[] solution; - solution = new FieldLUDecomposition<Fraction>(coefficients) + solution = new FieldLUDecomposition<>(coefficients) .getSolver() - .solve(new ArrayFieldVector<Fraction>(constants, false)).toArray(); + .solve(new ArrayFieldVector<>(constants, false)).toArray(); Assert.assertEquals((new Fraction(2).multiply((solution[0])).add(new Fraction(3).multiply(solution[1])).subtract(new Fraction(2).multiply(solution[2]))).doubleValue(), constants[0].doubleValue(), 1E-12); Assert.assertEquals(((new Fraction(-1).multiply(solution[0])).add(new Fraction(7).multiply(solution[1])).add(new Fraction(6).multiply(solution[2]))).doubleValue(), @@ -525,8 +525,8 @@ public class SparseFieldMatrixTest { @Test public void testGetRowVector() { FieldMatrix<Fraction> m = createSparseMatrix(subTestData); - FieldVector<Fraction> mRow0 = new ArrayFieldVector<Fraction>(subRow0[0]); - FieldVector<Fraction> mRow3 = new ArrayFieldVector<Fraction>(subRow3[0]); + FieldVector<Fraction> mRow0 = new ArrayFieldVector<>(subRow0[0]); + FieldVector<Fraction> mRow3 = new ArrayFieldVector<>(subRow3[0]); Assert.assertEquals("Row0", mRow0, m.getRowVector(0)); Assert.assertEquals("Row3", mRow3, m.getRowVector(3)); try { @@ -569,7 +569,7 @@ public class SparseFieldMatrixTest { for (int i = 0; i < data.length; ++i) { data[i] = column[i][0]; } - return new ArrayFieldVector<Fraction>(data, false); + return new ArrayFieldVector<>(data, false); } @Test @@ -653,7 +653,7 @@ public class SparseFieldMatrixTest { // expected } try { - new SparseFieldMatrix<Fraction>(field, 0, 0); + new SparseFieldMatrix<>(field, 0, 0); Assert.fail("expecting MathIllegalArgumentException"); } catch (MathIllegalArgumentException e) { // expected @@ -702,7 +702,7 @@ public class SparseFieldMatrixTest { } private SparseFieldMatrix<Fraction> createSparseMatrix(Fraction[][] data) { - SparseFieldMatrix<Fraction> matrix = new SparseFieldMatrix<Fraction>(field, data.length, data[0].length); + SparseFieldMatrix<Fraction> matrix = new SparseFieldMatrix<>(field, data.length, data[0].length); for (int row = 0; row < data.length; row++) { for (int col = 0; col < data[row].length; col++) { matrix.setEntry(row, col, data[row][col]); http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/test/java/org/apache/commons/math4/linear/SparseFieldVectorTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/linear/SparseFieldVectorTest.java b/src/test/java/org/apache/commons/math4/linear/SparseFieldVectorTest.java index 3a607f4..5df1142 100644 --- a/src/test/java/org/apache/commons/math4/linear/SparseFieldVectorTest.java +++ b/src/test/java/org/apache/commons/math4/linear/SparseFieldVectorTest.java @@ -58,7 +58,7 @@ public class SparseFieldVectorTest { @Test public void testMapFunctions() throws FractionConversionException { - SparseFieldVector<Fraction> v1 = new SparseFieldVector<Fraction>(field,vec1); + SparseFieldVector<Fraction> v1 = new SparseFieldVector<>(field,vec1); //octave = v1 .+ 2.0 FieldVector<Fraction> v_mapAdd = v1.mapAdd(new Fraction(2)); @@ -120,17 +120,17 @@ public class SparseFieldVectorTest { @Test public void testBasicFunctions() throws FractionConversionException { - SparseFieldVector<Fraction> v1 = new SparseFieldVector<Fraction>(field,vec1); - SparseFieldVector<Fraction> v2 = new SparseFieldVector<Fraction>(field,vec2); + SparseFieldVector<Fraction> v1 = new SparseFieldVector<>(field,vec1); + SparseFieldVector<Fraction> v2 = new SparseFieldVector<>(field,vec2); - FieldVector<Fraction> v2_t = new ArrayFieldVectorTest.FieldVectorTestImpl<Fraction>(vec2); + FieldVector<Fraction> v2_t = new ArrayFieldVectorTest.FieldVectorTestImpl<>(vec2); //octave = v1 + v2 FieldVector<Fraction> v_add = v1.add(v2); Fraction[] result_add = {new Fraction(5), new Fraction(7), new Fraction(9)}; Assert.assertArrayEquals("compare vect" ,v_add.toArray(),result_add); - FieldVector<Fraction> vt2 = new ArrayFieldVectorTest.FieldVectorTestImpl<Fraction>(vec2); + FieldVector<Fraction> vt2 = new ArrayFieldVectorTest.FieldVectorTestImpl<>(vec2); FieldVector<Fraction> v_add_i = v1.add(vt2); Fraction[] result_add_i = {new Fraction(5), new Fraction(7), new Fraction(9)}; Assert.assertArrayEquals("compare vect" ,v_add_i.toArray(),result_add_i); @@ -181,12 +181,12 @@ public class SparseFieldVectorTest { @Test public void testOuterProduct() { final SparseFieldVector<Fraction> u - = new SparseFieldVector<Fraction>(FractionField.getInstance(), + = new SparseFieldVector<>(FractionField.getInstance(), new Fraction[] {new Fraction(1), new Fraction(2), new Fraction(-3)}); final SparseFieldVector<Fraction> v - = new SparseFieldVector<Fraction>(FractionField.getInstance(), + = new SparseFieldVector<>(FractionField.getInstance(), new Fraction[] {new Fraction(4), new Fraction(-2)}); @@ -203,7 +203,7 @@ public class SparseFieldVectorTest { @Test public void testMisc() { - SparseFieldVector<Fraction> v1 = new SparseFieldVector<Fraction>(field,vec1); + SparseFieldVector<Fraction> v1 = new SparseFieldVector<>(field,vec1); String out1 = v1.toString(); Assert.assertTrue("some output ", out1.length()!=0); @@ -220,11 +220,11 @@ public class SparseFieldVectorTest { @Test public void testPredicates() { - SparseFieldVector<Fraction> v = new SparseFieldVector<Fraction>(field, new Fraction[] { new Fraction(0), new Fraction(1), new Fraction(2) }); + SparseFieldVector<Fraction> v = new SparseFieldVector<>(field, new Fraction[] { new Fraction(0), new Fraction(1), new Fraction(2) }); v.setEntry(0, field.getZero()); - Assert.assertEquals(v, new SparseFieldVector<Fraction>(field, new Fraction[] { new Fraction(0), new Fraction(1), new Fraction(2) })); - Assert.assertNotSame(v, new SparseFieldVector<Fraction>(field, new Fraction[] { new Fraction(0), new Fraction(1), new Fraction(2), new Fraction(3) })); + Assert.assertEquals(v, new SparseFieldVector<>(field, new Fraction[] { new Fraction(0), new Fraction(1), new Fraction(2) })); + Assert.assertNotSame(v, new SparseFieldVector<>(field, new Fraction[] { new Fraction(0), new Fraction(1), new Fraction(2), new Fraction(3) })); } @@ -260,7 +260,7 @@ public class SparseFieldVectorTest { Fraction.ZERO, Fraction.TWO, Fraction.ZERO, Fraction.ZERO, Fraction.ZERO, new Fraction(3) }; - final SparseFieldVector<Fraction> v = new SparseFieldVector<Fraction>(field, data); + final SparseFieldVector<Fraction> v = new SparseFieldVector<>(field, data); final FieldVectorPreservingVisitor<Fraction> visitor; visitor = new FieldVectorPreservingVisitor<Fraction>() { @@ -347,7 +347,7 @@ public class SparseFieldVectorTest { Fraction.ZERO, Fraction.TWO, Fraction.ZERO, Fraction.ZERO, Fraction.ZERO, new Fraction(3) }; - final SparseFieldVector<Fraction> v = new SparseFieldVector<Fraction>(field, data); + final SparseFieldVector<Fraction> v = new SparseFieldVector<>(field, data); final int expectedStart = 2; final int expectedEnd = 7; final FieldVectorPreservingVisitor<Fraction> visitor; @@ -385,7 +385,7 @@ public class SparseFieldVectorTest { Fraction.ZERO, Fraction.TWO, Fraction.ZERO, Fraction.ZERO, Fraction.ZERO, new Fraction(3) }; - final SparseFieldVector<Fraction> v = new SparseFieldVector<Fraction>(field, data); + final SparseFieldVector<Fraction> v = new SparseFieldVector<>(field, data); final FieldVectorPreservingVisitor<Fraction> visitor; visitor = new FieldVectorPreservingVisitor<Fraction>() { private final boolean[] visited = new boolean[data.length]; @@ -474,7 +474,7 @@ public class SparseFieldVectorTest { Fraction.ZERO, Fraction.TWO, Fraction.ZERO, Fraction.ZERO, Fraction.ZERO, new Fraction(3) }; - final SparseFieldVector<Fraction> v = new SparseFieldVector<Fraction>(field, data); + final SparseFieldVector<Fraction> v = new SparseFieldVector<>(field, data); final int expectedStart = 2; final int expectedEnd = 7; final FieldVectorPreservingVisitor<Fraction> visitor; @@ -514,7 +514,7 @@ public class SparseFieldVectorTest { Fraction.ZERO, Fraction.TWO, Fraction.ZERO, Fraction.ZERO, Fraction.ZERO, new Fraction(3) }; - final SparseFieldVector<Fraction> v = new SparseFieldVector<Fraction>(field, data); + final SparseFieldVector<Fraction> v = new SparseFieldVector<>(field, data); final FieldVectorChangingVisitor<Fraction> visitor; visitor = new FieldVectorChangingVisitor<Fraction>() { @@ -605,7 +605,7 @@ public class SparseFieldVectorTest { Fraction.ZERO, Fraction.TWO, Fraction.ZERO, Fraction.ZERO, Fraction.ZERO, new Fraction(3) }; - final SparseFieldVector<Fraction> v = new SparseFieldVector<Fraction>(field, data); + final SparseFieldVector<Fraction> v = new SparseFieldVector<>(field, data); final int expectedStart = 2; final int expectedEnd = 7; final FieldVectorChangingVisitor<Fraction> visitor; @@ -647,7 +647,7 @@ public class SparseFieldVectorTest { Fraction.ZERO, Fraction.TWO, Fraction.ZERO, Fraction.ZERO, Fraction.ZERO, new Fraction(3) }; - final SparseFieldVector<Fraction> v = new SparseFieldVector<Fraction>(field, data); + final SparseFieldVector<Fraction> v = new SparseFieldVector<>(field, data); final FieldVectorChangingVisitor<Fraction> visitor; visitor = new FieldVectorChangingVisitor<Fraction>() { private final boolean[] visited = new boolean[data.length]; @@ -740,7 +740,7 @@ public class SparseFieldVectorTest { Fraction.ZERO, Fraction.TWO, Fraction.ZERO, Fraction.ZERO, Fraction.ZERO, new Fraction(3) }; - final SparseFieldVector<Fraction> v = new SparseFieldVector<Fraction>(field, data); + final SparseFieldVector<Fraction> v = new SparseFieldVector<>(field, data); final int expectedStart = 2; final int expectedEnd = 7; final FieldVectorChangingVisitor<Fraction> visitor; @@ -781,6 +781,6 @@ public class SparseFieldVectorTest { for (int i = 0; i < n; ++i) { t[i] = Fraction.ZERO; } - return new SparseFieldVector<Fraction>(field, t); + return new SparseFieldVector<>(field, t); } } http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/test/java/org/apache/commons/math4/linear/UnmodifiableRealVectorAbstractTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/linear/UnmodifiableRealVectorAbstractTest.java b/src/test/java/org/apache/commons/math4/linear/UnmodifiableRealVectorAbstractTest.java index 9930801..121789e 100644 --- a/src/test/java/org/apache/commons/math4/linear/UnmodifiableRealVectorAbstractTest.java +++ b/src/test/java/org/apache/commons/math4/linear/UnmodifiableRealVectorAbstractTest.java @@ -53,7 +53,7 @@ public abstract class UnmodifiableRealVectorAbstractTest { * The list of methods which are excluded from the general test * {@link #testAllButExcluded()}. */ - protected static final Set<String> EXCLUDE = new HashSet<String>(); + protected static final Set<String> EXCLUDE = new HashSet<>(); /** The random number generator (always initialized with the same seed. */ protected static final Random RANDOM; http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/test/java/org/apache/commons/math4/ml/clustering/DBSCANClustererTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/ml/clustering/DBSCANClustererTest.java b/src/test/java/org/apache/commons/math4/ml/clustering/DBSCANClustererTest.java index 0820fbc..e3413a7 100644 --- a/src/test/java/org/apache/commons/math4/ml/clustering/DBSCANClustererTest.java +++ b/src/test/java/org/apache/commons/math4/ml/clustering/DBSCANClustererTest.java @@ -99,7 +99,7 @@ public class DBSCANClustererTest { }; final DBSCANClusterer<DoublePoint> transformer = - new DBSCANClusterer<DoublePoint>(2.0, 5); + new DBSCANClusterer<>(2.0, 5); final List<Cluster<DoublePoint>> clusters = transformer.cluster(Arrays.asList(points)); final List<DoublePoint> clusterOne = @@ -152,7 +152,7 @@ public class DBSCANClustererTest { }; - final DBSCANClusterer<DoublePoint> clusterer = new DBSCANClusterer<DoublePoint>(3, 3); + final DBSCANClusterer<DoublePoint> clusterer = new DBSCANClusterer<>(3, 3); List<Cluster<DoublePoint>> clusters = clusterer.cluster(Arrays.asList(points)); Assert.assertEquals(1, clusters.size()); @@ -164,13 +164,13 @@ public class DBSCANClustererTest { @Test public void testGetEps() { - final DBSCANClusterer<DoublePoint> transformer = new DBSCANClusterer<DoublePoint>(2.0, 5); + final DBSCANClusterer<DoublePoint> transformer = new DBSCANClusterer<>(2.0, 5); Assert.assertEquals(2.0, transformer.getEps(), 0.0); } @Test public void testGetMinPts() { - final DBSCANClusterer<DoublePoint> transformer = new DBSCANClusterer<DoublePoint>(2.0, 5); + final DBSCANClusterer<DoublePoint> transformer = new DBSCANClusterer<>(2.0, 5); Assert.assertEquals(5, transformer.getMinPts()); } @@ -186,7 +186,7 @@ public class DBSCANClustererTest { @Test(expected = NullArgumentException.class) public void testNullDataset() { - DBSCANClusterer<DoublePoint> clusterer = new DBSCANClusterer<DoublePoint>(2.0, 5); + DBSCANClusterer<DoublePoint> clusterer = new DBSCANClusterer<>(2.0, 5); clusterer.cluster(null); } http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/test/java/org/apache/commons/math4/ml/clustering/FuzzyKMeansClustererTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/ml/clustering/FuzzyKMeansClustererTest.java b/src/test/java/org/apache/commons/math4/ml/clustering/FuzzyKMeansClustererTest.java index a46c01e..dd5ca36 100644 --- a/src/test/java/org/apache/commons/math4/ml/clustering/FuzzyKMeansClustererTest.java +++ b/src/test/java/org/apache/commons/math4/ml/clustering/FuzzyKMeansClustererTest.java @@ -43,7 +43,7 @@ public class FuzzyKMeansClustererTest { @Test public void testCluster() { - final List<DoublePoint> points = new ArrayList<DoublePoint>(); + final List<DoublePoint> points = new ArrayList<>(); // create 10 data points: [1], ... [10] for (int i = 1; i <= 10; i++) { @@ -52,7 +52,7 @@ public class FuzzyKMeansClustererTest { } final FuzzyKMeansClusterer<DoublePoint> transformer = - new FuzzyKMeansClusterer<DoublePoint>(3, 2.0); + new FuzzyKMeansClusterer<>(3, 2.0); final List<CentroidCluster<DoublePoint>> clusters = transformer.cluster(points); // we expect 3 clusters: @@ -90,7 +90,7 @@ public class FuzzyKMeansClustererTest { @Test(expected = NullArgumentException.class) public void testNullDataset() { - final FuzzyKMeansClusterer<DoublePoint> clusterer = new FuzzyKMeansClusterer<DoublePoint>(3, 2.0); + final FuzzyKMeansClusterer<DoublePoint> clusterer = new FuzzyKMeansClusterer<>(3, 2.0); clusterer.cluster(null); } @@ -99,7 +99,7 @@ public class FuzzyKMeansClustererTest { final DistanceMeasure measure = new CanberraDistance(); final RandomGenerator random = new JDKRandomGenerator(); final FuzzyKMeansClusterer<DoublePoint> clusterer = - new FuzzyKMeansClusterer<DoublePoint>(3, 2.0, 100, measure, 1e-6, random); + new FuzzyKMeansClusterer<>(3, 2.0, 100, measure, 1e-6, random); Assert.assertEquals(3, clusterer.getK()); Assert.assertEquals(2.0, clusterer.getFuzziness(), 1e-6); @@ -111,11 +111,11 @@ public class FuzzyKMeansClustererTest { @Test public void testSingleCluster() { - final List<DoublePoint> points = new ArrayList<DoublePoint>(); + final List<DoublePoint> points = new ArrayList<>(); points.add(new DoublePoint(new double[] { 1, 1 })); final FuzzyKMeansClusterer<DoublePoint> transformer = - new FuzzyKMeansClusterer<DoublePoint>(1, 2.0); + new FuzzyKMeansClusterer<>(1, 2.0); final List<CentroidCluster<DoublePoint>> clusters = transformer.cluster(points); Assert.assertEquals(1, clusters.size()); @@ -123,14 +123,14 @@ public class FuzzyKMeansClustererTest { @Test public void testClusterCenterEqualsPoints() { - final List<DoublePoint> points = new ArrayList<DoublePoint>(); + final List<DoublePoint> points = new ArrayList<>(); points.add(new DoublePoint(new double[] { 1, 1 })); points.add(new DoublePoint(new double[] { 1.00001, 1.00001 })); points.add(new DoublePoint(new double[] { 2, 2 })); points.add(new DoublePoint(new double[] { 3, 3 })); final FuzzyKMeansClusterer<DoublePoint> transformer = - new FuzzyKMeansClusterer<DoublePoint>(3, 2.0); + new FuzzyKMeansClusterer<>(3, 2.0); final List<CentroidCluster<DoublePoint>> clusters = transformer.cluster(points); Assert.assertEquals(3, clusters.size()); http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/test/java/org/apache/commons/math4/ml/clustering/KMeansPlusPlusClustererTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/ml/clustering/KMeansPlusPlusClustererTest.java b/src/test/java/org/apache/commons/math4/ml/clustering/KMeansPlusPlusClustererTest.java index 39ef2c5..56f262d 100644 --- a/src/test/java/org/apache/commons/math4/ml/clustering/KMeansPlusPlusClustererTest.java +++ b/src/test/java/org/apache/commons/math4/ml/clustering/KMeansPlusPlusClustererTest.java @@ -52,7 +52,7 @@ public class KMeansPlusPlusClustererTest { @Test public void testPerformClusterAnalysisDegenerate() { KMeansPlusPlusClusterer<DoublePoint> transformer = - new KMeansPlusPlusClusterer<DoublePoint>(1, 1); + new KMeansPlusPlusClusterer<>(1, 1); DoublePoint[] points = new DoublePoint[] { new DoublePoint(new int[] { 1959, 325100 }), @@ -102,7 +102,7 @@ public class KMeansPlusPlusClustererTest { for (int n = 2; n < 27; ++n) { KMeansPlusPlusClusterer<DoublePoint> transformer = - new KMeansPlusPlusClusterer<DoublePoint>(n, 100, new EuclideanDistance(), random, strategy); + new KMeansPlusPlusClusterer<>(n, 100, new EuclideanDistance(), random, strategy); List<? extends Cluster<DoublePoint>> clusters = transformer.cluster(Arrays.asList(breakingPoints)); @@ -143,7 +143,7 @@ public class KMeansPlusPlusClustererTest { DoublePoint repeatedPoint = new DoublePoint(repeatedArray); DoublePoint uniquePoint = new DoublePoint(uniqueArray); - Collection<DoublePoint> points = new ArrayList<DoublePoint>(); + Collection<DoublePoint> points = new ArrayList<>(); final int NUM_REPEATED_POINTS = 10 * 1000; for (int i = 0; i < NUM_REPEATED_POINTS; ++i) { points.add(repeatedPoint); @@ -158,7 +158,7 @@ public class KMeansPlusPlusClustererTest { random.setSeed(RANDOM_SEED); KMeansPlusPlusClusterer<DoublePoint> clusterer = - new KMeansPlusPlusClusterer<DoublePoint>(NUM_CLUSTERS, NUM_ITERATIONS, + new KMeansPlusPlusClusterer<>(NUM_CLUSTERS, NUM_ITERATIONS, new CloseDistance(), random); List<CentroidCluster<DoublePoint>> clusters = clusterer.cluster(points); @@ -178,7 +178,7 @@ public class KMeansPlusPlusClustererTest { @Test(expected=NumberIsTooSmallException.class) public void testPerformClusterAnalysisToManyClusters() { KMeansPlusPlusClusterer<DoublePoint> transformer = - new KMeansPlusPlusClusterer<DoublePoint>(3, 1, new EuclideanDistance(), random); + new KMeansPlusPlusClusterer<>(3, 1, new EuclideanDistance(), random); DoublePoint[] points = new DoublePoint[] { new DoublePoint(new int[] { http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/test/java/org/apache/commons/math4/ml/clustering/MultiKMeansPlusPlusClustererTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/ml/clustering/MultiKMeansPlusPlusClustererTest.java b/src/test/java/org/apache/commons/math4/ml/clustering/MultiKMeansPlusPlusClustererTest.java index d707112..12816d7 100644 --- a/src/test/java/org/apache/commons/math4/ml/clustering/MultiKMeansPlusPlusClustererTest.java +++ b/src/test/java/org/apache/commons/math4/ml/clustering/MultiKMeansPlusPlusClustererTest.java @@ -34,7 +34,7 @@ public class MultiKMeansPlusPlusClustererTest { @Test public void dimension2() { MultiKMeansPlusPlusClusterer<DoublePoint> transformer = - new MultiKMeansPlusPlusClusterer<DoublePoint>( + new MultiKMeansPlusPlusClusterer<>( new KMeansPlusPlusClusterer<DoublePoint>(3, 10), 5); DoublePoint[] points = new DoublePoint[] { http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/test/java/org/apache/commons/math4/ml/clustering/evaluation/SumOfClusterVariancesTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/ml/clustering/evaluation/SumOfClusterVariancesTest.java b/src/test/java/org/apache/commons/math4/ml/clustering/evaluation/SumOfClusterVariancesTest.java index 0b20f8b..37c59a6 100644 --- a/src/test/java/org/apache/commons/math4/ml/clustering/evaluation/SumOfClusterVariancesTest.java +++ b/src/test/java/org/apache/commons/math4/ml/clustering/evaluation/SumOfClusterVariancesTest.java @@ -38,7 +38,7 @@ public class SumOfClusterVariancesTest { @Before public void setUp() { - evaluator = new SumOfClusterVariances<DoublePoint>(new EuclideanDistance()); + evaluator = new SumOfClusterVariances<>(new EuclideanDistance()); } @Test @@ -55,9 +55,9 @@ public class SumOfClusterVariancesTest { new DoublePoint(new double[] { 10 }) }; - final List<Cluster<DoublePoint>> clusters = new ArrayList<Cluster<DoublePoint>>(); + final List<Cluster<DoublePoint>> clusters = new ArrayList<>(); - final Cluster<DoublePoint> cluster1 = new Cluster<DoublePoint>(); + final Cluster<DoublePoint> cluster1 = new Cluster<>(); for (DoublePoint p : points1) { cluster1.addPoint(p); } @@ -65,7 +65,7 @@ public class SumOfClusterVariancesTest { assertEquals(1.0/3.0, evaluator.score(clusters), 1e-6); - final Cluster<DoublePoint> cluster2 = new Cluster<DoublePoint>(); + final Cluster<DoublePoint> cluster2 = new Cluster<>(); for (DoublePoint p : points2) { cluster2.addPoint(p); } http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/test/java/org/apache/commons/math4/ml/neuralnet/MapUtilsTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/ml/neuralnet/MapUtilsTest.java b/src/test/java/org/apache/commons/math4/ml/neuralnet/MapUtilsTest.java index f716fc8..4404aac 100644 --- a/src/test/java/org/apache/commons/math4/ml/neuralnet/MapUtilsTest.java +++ b/src/test/java/org/apache/commons/math4/ml/neuralnet/MapUtilsTest.java @@ -49,8 +49,8 @@ public class MapUtilsTest { final Network net = new NeuronString(3, false, initArray).getNetwork(); final DistanceMeasure dist = new EuclideanDistance(); - final Set<Neuron> allBest = new HashSet<Neuron>(); - final Set<Neuron> best = new HashSet<Neuron>(); + final Set<Neuron> allBest = new HashSet<>(); + final Set<Neuron> best = new HashSet<>(); double[][] features; // The following tests ensures that @@ -97,7 +97,7 @@ public class MapUtilsTest { @Test public void testSort() { - final Set<Neuron> list = new HashSet<Neuron>(); + final Set<Neuron> list = new HashSet<>(); for (int i = 0; i < 4; i++) { list.add(new Neuron(i, new double[] { i - 0.5 })); http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/test/java/org/apache/commons/math4/ml/neuralnet/oned/NeuronStringTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/ml/neuralnet/oned/NeuronStringTest.java b/src/test/java/org/apache/commons/math4/ml/neuralnet/oned/NeuronStringTest.java index e7654fd..5871956 100644 --- a/src/test/java/org/apache/commons/math4/ml/neuralnet/oned/NeuronStringTest.java +++ b/src/test/java/org/apache/commons/math4/ml/neuralnet/oned/NeuronStringTest.java @@ -139,7 +139,7 @@ public class NeuronStringTest { public void testGetNeighboursWithExclude() { final FeatureInitializer[] initArray = { init }; final Network net = new NeuronString(5, true, initArray).getNetwork(); - final Collection<Neuron> exclude = new ArrayList<Neuron>(); + final Collection<Neuron> exclude = new ArrayList<>(); exclude.add(net.getNeuron(1)); final Collection<Neuron> neighbours = net.getNeighbours(net.getNeuron(0), exclude); http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenTrainingTaskTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenTrainingTaskTest.java b/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenTrainingTaskTest.java index dd669d5..373a5bd 100644 --- a/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenTrainingTaskTest.java +++ b/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenTrainingTaskTest.java @@ -112,7 +112,7 @@ public class KohonenTrainingTaskTest { final ExecutorService service = Executors.newCachedThreadPool(); final int numProcs = Runtime.getRuntime().availableProcessors(); final Runnable[] tasks = solver.createParallelTasks(numProcs, 5000); - final List<Future<?>> execOutput = new ArrayList<Future<?>>(); + final List<Future<?>> execOutput = new ArrayList<>(); // Run tasks. for (Runnable r : tasks) { execOutput.add(service.submit(r)); @@ -165,7 +165,7 @@ public class KohonenTrainingTaskTest { * @return the total distance. */ private Collection<City> uniqueCities(City[] cityList) { - final Set<City> unique = new HashSet<City>(); + final Set<City> unique = new HashSet<>(); for (City c : cityList) { unique.add(c); } http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/TravellingSalesmanSolver.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/TravellingSalesmanSolver.java b/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/TravellingSalesmanSolver.java index fea0f16..37a9b2d 100644 --- a/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/TravellingSalesmanSolver.java +++ b/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/TravellingSalesmanSolver.java @@ -58,7 +58,7 @@ public class TravellingSalesmanSolver { /** RNG. */ private final RandomGenerator random; /** Set of cities. */ - private final Set<City> cities = new HashSet<City>(); + private final Set<City> cities = new HashSet<>(); /** SOFM. */ private final Network net; /** Distance function. */ @@ -176,7 +176,7 @@ public class TravellingSalesmanSolver { * @return the iterator. */ private Iterator<double[]> createRandomIterator(final long numSamples) { - final List<City> cityList = new ArrayList<City>(); + final List<City> cityList = new ArrayList<>(); cityList.addAll(cities); return new Iterator<double[]>() { @@ -204,7 +204,7 @@ public class TravellingSalesmanSolver { */ private List<Neuron> getNeuronList() { // Sequence of coordinates. - final List<Neuron> list = new ArrayList<Neuron>(); + final List<Neuron> list = new ArrayList<>(); // First neuron. Neuron current = net.getNeuron(FIRST_NEURON_ID); @@ -230,7 +230,7 @@ public class TravellingSalesmanSolver { */ public List<double[]> getCoordinatesList() { // Sequence of coordinates. - final List<double[]> coordinatesList = new ArrayList<double[]>(); + final List<double[]> coordinatesList = new ArrayList<>(); for (Neuron n : getNeuronList()) { coordinatesList.add(n.getFeatures()); http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/test/java/org/apache/commons/math4/ml/neuralnet/twod/NeuronSquareMesh2DTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/ml/neuralnet/twod/NeuronSquareMesh2DTest.java b/src/test/java/org/apache/commons/math4/ml/neuralnet/twod/NeuronSquareMesh2DTest.java index d233b24..8337175 100644 --- a/src/test/java/org/apache/commons/math4/ml/neuralnet/twod/NeuronSquareMesh2DTest.java +++ b/src/test/java/org/apache/commons/math4/ml/neuralnet/twod/NeuronSquareMesh2DTest.java @@ -574,7 +574,7 @@ public class NeuronSquareMesh2DTest { initArray).getNetwork(); Collection<Neuron> neighbours; - Collection<Neuron> exclude = new HashSet<Neuron>(); + Collection<Neuron> exclude = new HashSet<>(); // Level-1 neighbourhood. neighbours = net.getNeighbours(net.getNeuron(12)); @@ -623,7 +623,7 @@ public class NeuronSquareMesh2DTest { initArray).getNetwork(); Collection<Neuron> neighbours; - Collection<Neuron> exclude = new HashSet<Neuron>(); + Collection<Neuron> exclude = new HashSet<>(); // Level-1 neighbourhood. neighbours = net.getNeighbours(net.getNeuron(8)); @@ -854,13 +854,13 @@ public class NeuronSquareMesh2DTest { 3, true, SquareNeighbourhood.VON_NEUMANN, initArray); - final Set<Neuron> fromMap = new HashSet<Neuron>(); + final Set<Neuron> fromMap = new HashSet<>(); for (Neuron n : map) { fromMap.add(n); } final Network net = map.getNetwork(); - final Set<Neuron> fromNet = new HashSet<Neuron>(); + final Set<Neuron> fromNet = new HashSet<>(); for (Neuron n : net) { fromNet.add(n); } http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/test/java/org/apache/commons/math4/ode/ContinuousOutputFieldModelTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/ode/ContinuousOutputFieldModelTest.java b/src/test/java/org/apache/commons/math4/ode/ContinuousOutputFieldModelTest.java index 870ee1e..b50d0b9 100644 --- a/src/test/java/org/apache/commons/math4/ode/ContinuousOutputFieldModelTest.java +++ b/src/test/java/org/apache/commons/math4/ode/ContinuousOutputFieldModelTest.java @@ -42,12 +42,12 @@ public class ContinuousOutputFieldModelTest { } private <T extends RealFieldElement<T>> void doTestBoundaries(final Field<T> field) { - TestFieldProblem3<T> pb = new TestFieldProblem3<T>(field, field.getZero().add(0.9)); + TestFieldProblem3<T> pb = new TestFieldProblem3<>(field, field.getZero().add(0.9)); double minStep = 0; double maxStep = pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal(); - FirstOrderFieldIntegrator<T> integ = new DormandPrince54FieldIntegrator<T>(field, minStep, maxStep, 1.0e-8, 1.0e-8); + FirstOrderFieldIntegrator<T> integ = new DormandPrince54FieldIntegrator<>(field, minStep, maxStep, 1.0e-8, 1.0e-8); integ.addStepHandler(new ContinuousOutputFieldModel<T>()); - integ.integrate(new FieldExpandableODE<T>(pb), pb.getInitialState(), pb.getFinalTime()); + integ.integrate(new FieldExpandableODE<>(pb), pb.getInitialState(), pb.getFinalTime()); ContinuousOutputFieldModel<T> cm = (ContinuousOutputFieldModel<T>) integ.getStepHandlers().iterator().next(); cm.getInterpolatedState(pb.getInitialState().getTime().multiply(2).subtract(pb.getFinalTime())); cm.getInterpolatedState(pb.getFinalTime().multiply(2).subtract(pb.getInitialState().getTime())); @@ -61,13 +61,13 @@ public class ContinuousOutputFieldModelTest { private <T extends RealFieldElement<T>> void doTestRandomAccess(final Field<T> field) { - TestFieldProblem3<T> pb = new TestFieldProblem3<T>(field, field.getZero().add(0.9)); + TestFieldProblem3<T> pb = new TestFieldProblem3<>(field, field.getZero().add(0.9)); double minStep = 0; double maxStep = pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal(); - FirstOrderFieldIntegrator<T> integ = new DormandPrince54FieldIntegrator<T>(field, minStep, maxStep, 1.0e-8, 1.0e-8); - ContinuousOutputFieldModel<T> cm = new ContinuousOutputFieldModel<T>(); + FirstOrderFieldIntegrator<T> integ = new DormandPrince54FieldIntegrator<>(field, minStep, maxStep, 1.0e-8, 1.0e-8); + ContinuousOutputFieldModel<T> cm = new ContinuousOutputFieldModel<>(); integ.addStepHandler(cm); - integ.integrate(new FieldExpandableODE<T>(pb), pb.getInitialState(), pb.getFinalTime()); + integ.integrate(new FieldExpandableODE<>(pb), pb.getInitialState(), pb.getFinalTime()); Random random = new Random(347588535632l); T maxError = field.getZero(); @@ -117,32 +117,32 @@ public class ContinuousOutputFieldModelTest { }; // integrate backward from π to 0; - ContinuousOutputFieldModel<T> cm1 = new ContinuousOutputFieldModel<T>(); + ContinuousOutputFieldModel<T> cm1 = new ContinuousOutputFieldModel<>(); FirstOrderFieldIntegrator<T> integ1 = - new DormandPrince853FieldIntegrator<T>(field, 0, 1.0, 1.0e-8, 1.0e-8); + new DormandPrince853FieldIntegrator<>(field, 0, 1.0, 1.0e-8, 1.0e-8); integ1.addStepHandler(cm1); T t0 = field.getZero().add(FastMath.PI); T[] y0 = MathArrays.buildArray(field, 2); y0[0] = field.getOne().negate(); y0[1] = field.getZero(); - integ1.integrate(new FieldExpandableODE<T>(problem), - new FieldODEState<T>(t0, y0), + integ1.integrate(new FieldExpandableODE<>(problem), + new FieldODEState<>(t0, y0), field.getZero()); // integrate backward from 2π to π - ContinuousOutputFieldModel<T> cm2 = new ContinuousOutputFieldModel<T>(); + ContinuousOutputFieldModel<T> cm2 = new ContinuousOutputFieldModel<>(); FirstOrderFieldIntegrator<T> integ2 = - new DormandPrince853FieldIntegrator<T>(field, 0, 0.1, 1.0e-12, 1.0e-12); + new DormandPrince853FieldIntegrator<>(field, 0, 0.1, 1.0e-12, 1.0e-12); integ2.addStepHandler(cm2); t0 = field.getZero().add(2.0 * FastMath.PI); y0[0] = field.getOne(); y0[1] = field.getZero(); - integ2.integrate(new FieldExpandableODE<T>(problem), - new FieldODEState<T>(t0, y0), + integ2.integrate(new FieldExpandableODE<>(problem), + new FieldODEState<>(t0, y0), field.getZero().add(FastMath.PI)); // merge the two half circles - ContinuousOutputFieldModel<T> cm = new ContinuousOutputFieldModel<T>(); + ContinuousOutputFieldModel<T> cm = new ContinuousOutputFieldModel<>(); cm.append(cm2); cm.append(new ContinuousOutputFieldModel<T>()); cm.append(cm1); @@ -164,7 +164,7 @@ public class ContinuousOutputFieldModelTest { } private <T extends RealFieldElement<T>> void doTestErrorConditions(final Field<T> field) { - ContinuousOutputFieldModel<T> cm = new ContinuousOutputFieldModel<T>(); + ContinuousOutputFieldModel<T> cm = new ContinuousOutputFieldModel<>(); cm.handleStep(buildInterpolator(field, 0, 1, new double[] { 0.0, 1.0, -2.0 }), true); // dimension mismatch @@ -184,7 +184,7 @@ public class ContinuousOutputFieldModelTest { private <T extends RealFieldElement<T>> boolean checkAppendError(Field<T> field, ContinuousOutputFieldModel<T> cm, double t0, double t1, double[] y) { try { - ContinuousOutputFieldModel<T> otherCm = new ContinuousOutputFieldModel<T>(); + ContinuousOutputFieldModel<T> otherCm = new ContinuousOutputFieldModel<>(); otherCm.handleStep(buildInterpolator(field, t0, t1, y), true); cm.append(otherCm); } catch(DimensionMismatchException dme) { @@ -201,9 +201,9 @@ public class ContinuousOutputFieldModelTest { for (int i = 0; i < y.length; ++i) { fieldY[i] = field.getZero().add(y[i]); } - final FieldODEStateAndDerivative<T> s0 = new FieldODEStateAndDerivative<T>(field.getZero().add(t0), fieldY, fieldY); - final FieldODEStateAndDerivative<T> s1 = new FieldODEStateAndDerivative<T>(field.getZero().add(t1), fieldY, fieldY); - final FieldEquationsMapper<T> mapper = new FieldExpandableODE<T>(new FirstOrderFieldDifferentialEquations<T>() { + final FieldODEStateAndDerivative<T> s0 = new FieldODEStateAndDerivative<>(field.getZero().add(t0), fieldY, fieldY); + final FieldODEStateAndDerivative<T> s1 = new FieldODEStateAndDerivative<>(field.getZero().add(t1), fieldY, fieldY); + final FieldEquationsMapper<T> mapper = new FieldExpandableODE<>(new FirstOrderFieldDifferentialEquations<T>() { public int getDimension() { return s0.getStateDimension(); } @@ -213,7 +213,7 @@ public class ContinuousOutputFieldModelTest { return y; } }).getMapper(); - return new DummyFieldStepInterpolator<T>(t1 >= t0, s0, s1, s0, s1, mapper); + return new DummyFieldStepInterpolator<>(t1 >= t0, s0, s1, s0, s1, mapper); } public void checkValue(double value, double reference) { http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/test/java/org/apache/commons/math4/ode/FieldExpandableODETest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/ode/FieldExpandableODETest.java b/src/test/java/org/apache/commons/math4/ode/FieldExpandableODETest.java index 79070d0..20fc11f 100644 --- a/src/test/java/org/apache/commons/math4/ode/FieldExpandableODETest.java +++ b/src/test/java/org/apache/commons/math4/ode/FieldExpandableODETest.java @@ -39,8 +39,8 @@ public class FieldExpandableODETest { } private <T extends RealFieldElement<T>> void doTestOnlyMainEquation(final Field<T> field) { - FirstOrderFieldDifferentialEquations<T> main = new Linear<T>(field, 3, 0); - FieldExpandableODE<T> equation = new FieldExpandableODE<T>(main); + FirstOrderFieldDifferentialEquations<T> main = new Linear<>(field, 3, 0); + FieldExpandableODE<T> equation = new FieldExpandableODE<>(main); Assert.assertEquals(main.getDimension(), equation.getMapper().getTotalDimension()); Assert.assertEquals(1, equation.getMapper().getNumberOfEquations()); T t0 = field.getZero().add(10); @@ -70,11 +70,11 @@ public class FieldExpandableODETest { private <T extends RealFieldElement<T>> void doTestMainAndSecondary(final Field<T> field) { - FirstOrderFieldDifferentialEquations<T> main = new Linear<T>(field, 3, 0); - FieldExpandableODE<T> equation = new FieldExpandableODE<T>(main); - FieldSecondaryEquations<T> secondary1 = new Linear<T>(field, 3, main.getDimension()); + FirstOrderFieldDifferentialEquations<T> main = new Linear<>(field, 3, 0); + FieldExpandableODE<T> equation = new FieldExpandableODE<>(main); + FieldSecondaryEquations<T> secondary1 = new Linear<>(field, 3, main.getDimension()); int i1 = equation.addSecondaryEquations(secondary1); - FieldSecondaryEquations<T> secondary2 = new Linear<T>(field, 5, main.getDimension() + secondary1.getDimension()); + FieldSecondaryEquations<T> secondary2 = new Linear<>(field, 5, main.getDimension() + secondary1.getDimension()); int i2 = equation.addSecondaryEquations(secondary2); Assert.assertEquals(main.getDimension() + secondary1.getDimension() + secondary2.getDimension(), equation.getMapper().getTotalDimension()); @@ -127,11 +127,11 @@ public class FieldExpandableODETest { private <T extends RealFieldElement<T>> void doTestMap(final Field<T> field) { - FirstOrderFieldDifferentialEquations<T> main = new Linear<T>(field, 3, 0); - FieldExpandableODE<T> equation = new FieldExpandableODE<T>(main); - FieldSecondaryEquations<T> secondary1 = new Linear<T>(field, 3, main.getDimension()); + FirstOrderFieldDifferentialEquations<T> main = new Linear<>(field, 3, 0); + FieldExpandableODE<T> equation = new FieldExpandableODE<>(main); + FieldSecondaryEquations<T> secondary1 = new Linear<>(field, 3, main.getDimension()); int i1 = equation.addSecondaryEquations(secondary1); - FieldSecondaryEquations<T> secondary2 = new Linear<T>(field, 5, main.getDimension() + secondary1.getDimension()); + FieldSecondaryEquations<T> secondary2 = new Linear<>(field, 5, main.getDimension() + secondary1.getDimension()); int i2 = equation.addSecondaryEquations(secondary2); Assert.assertEquals(main.getDimension() + secondary1.getDimension() + secondary2.getDimension(), equation.getMapper().getTotalDimension()); @@ -215,9 +215,9 @@ public class FieldExpandableODETest { private <T extends RealFieldElement<T>> void doTestExtractDimensionMismatch(final Field<T> field) throws DimensionMismatchException { - FirstOrderFieldDifferentialEquations<T> main = new Linear<T>(field, 3, 0); - FieldExpandableODE<T> equation = new FieldExpandableODE<T>(main); - FieldSecondaryEquations<T> secondary1 = new Linear<T>(field, 3, main.getDimension()); + FirstOrderFieldDifferentialEquations<T> main = new Linear<>(field, 3, 0); + FieldExpandableODE<T> equation = new FieldExpandableODE<>(main); + FieldSecondaryEquations<T> secondary1 = new Linear<>(field, 3, main.getDimension()); int i1 = equation.addSecondaryEquations(secondary1); T[] tooShort = MathArrays.buildArray(field, main.getDimension()); equation.getMapper().extractEquationData(i1, tooShort); @@ -231,9 +231,9 @@ public class FieldExpandableODETest { private <T extends RealFieldElement<T>> void doTestInsertTooShortComplete(final Field<T> field) throws DimensionMismatchException { - FirstOrderFieldDifferentialEquations<T> main = new Linear<T>(field, 3, 0); - FieldExpandableODE<T> equation = new FieldExpandableODE<T>(main); - FieldSecondaryEquations<T> secondary1 = new Linear<T>(field, 3, main.getDimension()); + FirstOrderFieldDifferentialEquations<T> main = new Linear<>(field, 3, 0); + FieldExpandableODE<T> equation = new FieldExpandableODE<>(main); + FieldSecondaryEquations<T> secondary1 = new Linear<>(field, 3, main.getDimension()); int i1 = equation.addSecondaryEquations(secondary1); T[] equationData = MathArrays.buildArray(field, secondary1.getDimension()); T[] tooShort = MathArrays.buildArray(field, main.getDimension()); @@ -248,9 +248,9 @@ public class FieldExpandableODETest { private <T extends RealFieldElement<T>> void doTestInsertWrongEquationData(final Field<T> field) throws DimensionMismatchException { - FirstOrderFieldDifferentialEquations<T> main = new Linear<T>(field, 3, 0); - FieldExpandableODE<T> equation = new FieldExpandableODE<T>(main); - FieldSecondaryEquations<T> secondary1 = new Linear<T>(field, 3, main.getDimension()); + FirstOrderFieldDifferentialEquations<T> main = new Linear<>(field, 3, 0); + FieldExpandableODE<T> equation = new FieldExpandableODE<>(main); + FieldSecondaryEquations<T> secondary1 = new Linear<>(field, 3, main.getDimension()); int i1 = equation.addSecondaryEquations(secondary1); T[] wrongEquationData = MathArrays.buildArray(field, secondary1.getDimension() + 1); T[] complete = MathArrays.buildArray(field, equation.getMapper().getTotalDimension()); @@ -265,8 +265,8 @@ public class FieldExpandableODETest { private <T extends RealFieldElement<T>> void doTestNegativeIndex(final Field<T> field) throws MathIllegalArgumentException { - FirstOrderFieldDifferentialEquations<T> main = new Linear<T>(field, 3, 0); - FieldExpandableODE<T> equation = new FieldExpandableODE<T>(main); + FirstOrderFieldDifferentialEquations<T> main = new Linear<>(field, 3, 0); + FieldExpandableODE<T> equation = new FieldExpandableODE<>(main); T[] complete = MathArrays.buildArray(field, equation.getMapper().getTotalDimension()); equation.getMapper().extractEquationData(-1, complete); } @@ -279,8 +279,8 @@ public class FieldExpandableODETest { private <T extends RealFieldElement<T>> void doTestTooLargeIndex(final Field<T> field) throws MathIllegalArgumentException { - FirstOrderFieldDifferentialEquations<T> main = new Linear<T>(field, 3, 0); - FieldExpandableODE<T> equation = new FieldExpandableODE<T>(main); + FirstOrderFieldDifferentialEquations<T> main = new Linear<>(field, 3, 0); + FieldExpandableODE<T> equation = new FieldExpandableODE<>(main); T[] complete = MathArrays.buildArray(field, equation.getMapper().getTotalDimension()); equation.getMapper().extractEquationData(+1, complete); } http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/test/java/org/apache/commons/math4/ode/TestFieldProblem4.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/ode/TestFieldProblem4.java b/src/test/java/org/apache/commons/math4/ode/TestFieldProblem4.java index cc79777..01db18f 100644 --- a/src/test/java/org/apache/commons/math4/ode/TestFieldProblem4.java +++ b/src/test/java/org/apache/commons/math4/ode/TestFieldProblem4.java @@ -67,8 +67,8 @@ public class TestFieldProblem4<T extends RealFieldElement<T>> @SuppressWarnings("unchecked") FieldEventHandler<T>[] handlers = (FieldEventHandler<T>[]) Array.newInstance(FieldEventHandler.class, 2); - handlers[0] = new Bounce<T>(); - handlers[1] = new Stop<T>(); + handlers[0] = new Bounce<>(); + handlers[1] = new Stop<>(); return handlers; } @@ -130,7 +130,7 @@ public class TestFieldProblem4<T extends RealFieldElement<T>> T[] y = state.getState(); y[0] = y[0].negate(); y[1] = y[1].negate(); - return new FieldODEState<T>(state.getTime(), y); + return new FieldODEState<>(state.getTime(), y); } } http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/test/java/org/apache/commons/math4/ode/TestFieldProblemAbstract.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/ode/TestFieldProblemAbstract.java b/src/test/java/org/apache/commons/math4/ode/TestFieldProblemAbstract.java index 9d1b78b..cf404d6 100644 --- a/src/test/java/org/apache/commons/math4/ode/TestFieldProblemAbstract.java +++ b/src/test/java/org/apache/commons/math4/ode/TestFieldProblemAbstract.java @@ -114,7 +114,7 @@ public abstract class TestFieldProblemAbstract<T extends RealFieldElement<T>> * @return initial state */ public FieldODEState<T> getInitialState() { - return new FieldODEState<T>(t0, y0); + return new FieldODEState<>(t0, y0); } /** http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/test/java/org/apache/commons/math4/ode/events/OverlappingEventsTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/ode/events/OverlappingEventsTest.java b/src/test/java/org/apache/commons/math4/ode/events/OverlappingEventsTest.java index e489e4e..38f1cf3 100644 --- a/src/test/java/org/apache/commons/math4/ode/events/OverlappingEventsTest.java +++ b/src/test/java/org/apache/commons/math4/ode/events/OverlappingEventsTest.java @@ -90,8 +90,8 @@ public class OverlappingEventsTest implements FirstOrderDifferentialEquations { double t = 0.0; double tEnd = 10.0; double[] y = {0.0, 0.0}; - List<Double> events1 = new ArrayList<Double>(); - List<Double> events2 = new ArrayList<Double>(); + List<Double> events1 = new ArrayList<>(); + List<Double> events2 = new ArrayList<>(); while (t < tEnd) { t = integrator.integrate(this, t, y, tEnd, y); //System.out.println("t=" + t + ",\t\ty=[" + y[0] + "," + y[1] + "]"); http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractEmbeddedRungeKuttaFieldIntegratorTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractEmbeddedRungeKuttaFieldIntegratorTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractEmbeddedRungeKuttaFieldIntegratorTest.java index 61372f5..aceede0 100644 --- a/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractEmbeddedRungeKuttaFieldIntegratorTest.java +++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractEmbeddedRungeKuttaFieldIntegratorTest.java @@ -152,8 +152,8 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { EmbeddedRungeKuttaFieldIntegrator<T> integrator = createIntegrator(field, 0.0, 1.0, 1.0e-10, 1.0e-10); try { - integrator.integrate(new FieldExpandableODE<T>(equations), - new FieldODEState<T>(field.getOne().negate(), + integrator.integrate(new FieldExpandableODE<>(equations), + new FieldODEState<>(field.getOne().negate(), MathArrays.buildArray(field, 1)), field.getZero()); Assert.fail("an exception should have been thrown"); @@ -162,8 +162,8 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { } try { - integrator.integrate(new FieldExpandableODE<T>(equations), - new FieldODEState<T>(field.getZero(), + integrator.integrate(new FieldExpandableODE<>(equations), + new FieldODEState<>(field.getZero(), MathArrays.buildArray(field, 1)), field.getOne()); Assert.fail("an exception should have been thrown"); @@ -182,7 +182,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { protected <T extends RealFieldElement<T>> void doTestMinStep(final Field<T> field) throws NumberIsTooSmallException { - TestFieldProblem1<T> pb = new TestFieldProblem1<T>(field); + TestFieldProblem1<T> pb = new TestFieldProblem1<>(field); double minStep = pb.getFinalTime().subtract(pb.getInitialState().getTime()).multiply(0.1).getReal(); double maxStep = pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal(); double[] vecAbsoluteTolerance = { 1.0e-15, 1.0e-16 }; @@ -190,9 +190,9 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { FirstOrderFieldIntegrator<T> integ = createIntegrator(field, minStep, maxStep, vecAbsoluteTolerance, vecRelativeTolerance); - TestFieldProblemHandler<T> handler = new TestFieldProblemHandler<T>(pb, integ); + TestFieldProblemHandler<T> handler = new TestFieldProblemHandler<>(pb, integ); integ.addStepHandler(handler); - integ.integrate(new FieldExpandableODE<T>(pb), pb.getInitialState(), pb.getFinalTime()); + integ.integrate(new FieldExpandableODE<>(pb), pb.getInitialState(), pb.getFinalTime()); Assert.fail("an exception should have been thrown"); } @@ -206,7 +206,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { int previousCalls = Integer.MAX_VALUE; for (int i = -12; i < -2; ++i) { - TestFieldProblem1<T> pb = new TestFieldProblem1<T>(field); + TestFieldProblem1<T> pb = new TestFieldProblem1<>(field); double minStep = 0; double maxStep = pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal(); double scalAbsoluteTolerance = FastMath.pow(10.0, i); @@ -214,9 +214,9 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { FirstOrderFieldIntegrator<T> integ = createIntegrator(field, minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance); - TestFieldProblemHandler<T> handler = new TestFieldProblemHandler<T>(pb, integ); + TestFieldProblemHandler<T> handler = new TestFieldProblemHandler<>(pb, integ); integ.addStepHandler(handler); - integ.integrate(new FieldExpandableODE<T>(pb), pb.getInitialState(), pb.getFinalTime()); + integ.integrate(new FieldExpandableODE<>(pb), pb.getInitialState(), pb.getFinalTime()); Assert.assertTrue(handler.getMaximalValueError().getReal() < (factor * scalAbsoluteTolerance)); Assert.assertEquals(0, handler.getMaximalTimeError().getReal(), epsilon); @@ -237,7 +237,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { final double epsilonMaxValue, final String name) { - TestFieldProblem4<T> pb = new TestFieldProblem4<T>(field); + TestFieldProblem4<T> pb = new TestFieldProblem4<>(field); double minStep = 0; double maxStep = pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal(); double scalAbsoluteTolerance = 1.0e-8; @@ -245,7 +245,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { FirstOrderFieldIntegrator<T> integ = createIntegrator(field, minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance); - TestFieldProblemHandler<T> handler = new TestFieldProblemHandler<T>(pb, integ); + TestFieldProblemHandler<T> handler = new TestFieldProblemHandler<>(pb, integ); integ.addStepHandler(handler); FieldEventHandler<T>[] functions = pb.getEventsHandlers(); double convergence = 1.0e-8 * maxStep; @@ -253,7 +253,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { integ.addEventHandler(functions[l], Double.POSITIVE_INFINITY, convergence, 1000); } Assert.assertEquals(functions.length, integ.getEventHandlers().size()); - integ.integrate(new FieldExpandableODE<T>(pb), pb.getInitialState(), pb.getFinalTime()); + integ.integrate(new FieldExpandableODE<>(pb), pb.getInitialState(), pb.getFinalTime()); Assert.assertEquals(0, handler.getMaximalValueError().getReal(), epsilonMaxValue); Assert.assertEquals(0, handler.getMaximalTimeError().getReal(), convergence); @@ -269,7 +269,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { protected <T extends RealFieldElement<T>> void doTestEventsErrors(final Field<T> field) throws LocalException { - final TestFieldProblem1<T> pb = new TestFieldProblem1<T>(field); + final TestFieldProblem1<T> pb = new TestFieldProblem1<>(field); double minStep = 0; double maxStep = pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal(); double scalAbsoluteTolerance = 1.0e-8; @@ -277,7 +277,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { FirstOrderFieldIntegrator<T> integ = createIntegrator(field, minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance); - TestFieldProblemHandler<T> handler = new TestFieldProblemHandler<T>(pb, integ); + TestFieldProblemHandler<T> handler = new TestFieldProblemHandler<>(pb, integ); integ.addStepHandler(handler); integ.addEventHandler(new FieldEventHandler<T>() { @@ -299,7 +299,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { } }, Double.POSITIVE_INFINITY, 1.0e-8 * maxStep, 1000); - integ.integrate(new FieldExpandableODE<T>(pb), pb.getInitialState(), pb.getFinalTime()); + integ.integrate(new FieldExpandableODE<>(pb), pb.getInitialState(), pb.getFinalTime()); } @@ -308,7 +308,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { protected <T extends RealFieldElement<T>> void doTestEventsNoConvergence(final Field<T> field){ - final TestFieldProblem1<T> pb = new TestFieldProblem1<T>(field); + final TestFieldProblem1<T> pb = new TestFieldProblem1<>(field); double minStep = 0; double maxStep = pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal(); double scalAbsoluteTolerance = 1.0e-8; @@ -316,7 +316,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { FirstOrderFieldIntegrator<T> integ = createIntegrator(field, minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance); - TestFieldProblemHandler<T> handler = new TestFieldProblemHandler<T>(pb, integ); + TestFieldProblemHandler<T> handler = new TestFieldProblemHandler<>(pb, integ); integ.addStepHandler(handler); integ.addEventHandler(new FieldEventHandler<T>() { @@ -336,7 +336,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { }, Double.POSITIVE_INFINITY, 1.0e-8 * maxStep, 3); try { - integ.integrate(new FieldExpandableODE<T>(pb), pb.getInitialState(), pb.getFinalTime()); + integ.integrate(new FieldExpandableODE<>(pb), pb.getInitialState(), pb.getFinalTime()); Assert.fail("an exception should have been thrown"); } catch (MaxCountExceededException mcee) { // Expected. @@ -348,13 +348,13 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { public abstract void testSanityChecks(); protected <T extends RealFieldElement<T>> void doTestSanityChecks(Field<T> field) { - TestFieldProblem3<T> pb = new TestFieldProblem3<T>(field); + TestFieldProblem3<T> pb = new TestFieldProblem3<>(field); try { EmbeddedRungeKuttaFieldIntegrator<T> integrator = createIntegrator(field, 0, pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal(), new double[4], new double[4]); - integrator.integrate(new FieldExpandableODE<T>(pb), - new FieldODEState<T>(pb.getInitialState().getTime(), + integrator.integrate(new FieldExpandableODE<>(pb), + new FieldODEState<>(pb.getInitialState().getTime(), MathArrays.buildArray(field, 6)), pb.getFinalTime()); Assert.fail("an exception should have been thrown"); @@ -365,7 +365,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { createIntegrator(field, 0, pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal(), new double[2], new double[4]); - integrator.integrate(new FieldExpandableODE<T>(pb), pb.getInitialState(), pb.getFinalTime()); + integrator.integrate(new FieldExpandableODE<>(pb), pb.getInitialState(), pb.getFinalTime()); Assert.fail("an exception should have been thrown"); } catch(DimensionMismatchException ie) { } @@ -374,7 +374,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { createIntegrator(field, 0, pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal(), new double[4], new double[4]); - integrator.integrate(new FieldExpandableODE<T>(pb), pb.getInitialState(), pb.getInitialState().getTime()); + integrator.integrate(new FieldExpandableODE<>(pb), pb.getInitialState(), pb.getInitialState().getTime()); Assert.fail("an exception should have been thrown"); } catch(NumberIsTooSmallException ie) { } @@ -391,7 +391,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { throws DimensionMismatchException, NumberIsTooSmallException, MaxCountExceededException, NoBracketingException { - TestFieldProblem5<T> pb = new TestFieldProblem5<T>(field); + TestFieldProblem5<T> pb = new TestFieldProblem5<>(field); double minStep = 0; double maxStep = pb.getFinalTime().subtract(pb.getInitialState().getTime()).abs().getReal(); double scalAbsoluteTolerance = 1.0e-8; @@ -400,9 +400,9 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { EmbeddedRungeKuttaFieldIntegrator<T> integ = createIntegrator(field, minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance); - TestFieldProblemHandler<T> handler = new TestFieldProblemHandler<T>(pb, integ); + TestFieldProblemHandler<T> handler = new TestFieldProblemHandler<>(pb, integ); integ.addStepHandler(handler); - integ.integrate(new FieldExpandableODE<T>(pb), pb.getInitialState(), pb.getFinalTime()); + integ.integrate(new FieldExpandableODE<>(pb), pb.getInitialState(), pb.getFinalTime()); Assert.assertEquals(0, handler.getLastError().getReal(), epsilonLast); Assert.assertEquals(0, handler.getMaximalValueError().getReal(), epsilonMaxValue); @@ -416,7 +416,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { protected <T extends RealFieldElement<T>> void doTestKepler(Field<T> field, double epsilon) { - final TestFieldProblem3<T> pb = new TestFieldProblem3<T>(field, field.getZero().add(0.9)); + final TestFieldProblem3<T> pb = new TestFieldProblem3<>(field, field.getZero().add(0.9)); double minStep = 0; double maxStep = pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal(); double[] vecAbsoluteTolerance = { 1.0e-8, 1.0e-8, 1.0e-10, 1.0e-10 }; @@ -424,8 +424,8 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { FirstOrderFieldIntegrator<T> integ = createIntegrator(field, minStep, maxStep, vecAbsoluteTolerance, vecRelativeTolerance); - integ.addStepHandler(new KeplerHandler<T>(pb, epsilon)); - integ.integrate(new FieldExpandableODE<T>(pb), pb.getInitialState(), pb.getFinalTime()); + integ.addStepHandler(new KeplerHandler<>(pb, epsilon)); + integ.integrate(new FieldExpandableODE<>(pb), pb.getInitialState(), pb.getFinalTime()); } private static class KeplerHandler<T extends RealFieldElement<T>> implements FieldStepHandler<T> { @@ -486,8 +486,8 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { t.subtract(t0).multiply(0.001).getReal(), t.subtract(t0).getReal(), 1.0e-12, 1.0e-12); FieldODEStateAndDerivative<DerivativeStructure> result = - integrator.integrate(new FieldExpandableODE<DerivativeStructure>(sinCos), - new FieldODEState<DerivativeStructure>(t0, y0), + integrator.integrate(new FieldExpandableODE<>(sinCos), + new FieldODEState<>(t0, y0), t); // check values