You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by lu...@apache.org on 2016/01/02 10:28:47 UTC
[2/4] [math] Renamed abstract test classes to match build environment
filters.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/29649959/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractRungeKuttaFieldStepInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractRungeKuttaFieldStepInterpolatorTest.java b/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractRungeKuttaFieldStepInterpolatorTest.java
deleted file mode 100644
index b5c7ff0..0000000
--- a/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractRungeKuttaFieldStepInterpolatorTest.java
+++ /dev/null
@@ -1,305 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.commons.math3.ode.nonstiff;
-
-
-import org.apache.commons.math3.Field;
-import org.apache.commons.math3.RealFieldElement;
-import org.apache.commons.math3.ode.AbstractIntegrator;
-import org.apache.commons.math3.ode.EquationsMapper;
-import org.apache.commons.math3.ode.ExpandableStatefulODE;
-import org.apache.commons.math3.ode.FieldEquationsMapper;
-import org.apache.commons.math3.ode.FieldExpandableODE;
-import org.apache.commons.math3.ode.FirstOrderFieldDifferentialEquations;
-import org.apache.commons.math3.ode.FieldODEStateAndDerivative;
-import org.apache.commons.math3.ode.sampling.AbstractFieldStepInterpolator;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathArrays;
-import org.junit.Assert;
-import org.junit.Test;
-
-public abstract class AbstractRungeKuttaFieldStepInterpolatorTest {
-
- protected abstract <T extends RealFieldElement<T>> RungeKuttaFieldStepInterpolator<T>
- createInterpolator(Field<T> field, boolean forward, T[][] yDotK,
- FieldODEStateAndDerivative<T> globalPreviousState,
- FieldODEStateAndDerivative<T> globalCurrentState,
- FieldODEStateAndDerivative<T> softPreviousState,
- FieldODEStateAndDerivative<T> softCurrentState,
- FieldEquationsMapper<T> mapper);
-
- protected abstract <T extends RealFieldElement<T>> FieldButcherArrayProvider<T>
- createButcherArrayProvider(final Field<T> field);
-
- @Test
- public abstract void interpolationAtBounds();
-
- protected <T extends RealFieldElement<T>> void doInterpolationAtBounds(final Field<T> field, double epsilon) {
-
- RungeKuttaFieldStepInterpolator<T> interpolator = setUpInterpolator(field,
- new SinCos<T>(field),
- 0.0, new double[] { 0.0, 1.0 }, 0.125);
-
- Assert.assertEquals(0.0, interpolator.getPreviousState().getTime().getReal(), 1.0e-15);
- for (int i = 0; i < 2; ++i) {
- Assert.assertEquals(interpolator.getPreviousState().getState()[i].getReal(),
- interpolator.getInterpolatedState(interpolator.getPreviousState().getTime()).getState()[i].getReal(),
- epsilon);
- }
- Assert.assertEquals(0.125, interpolator.getCurrentState().getTime().getReal(), 1.0e-15);
- for (int i = 0; i < 2; ++i) {
- Assert.assertEquals(interpolator.getCurrentState().getState()[i].getReal(),
- interpolator.getInterpolatedState(interpolator.getCurrentState().getTime()).getState()[i].getReal(),
- epsilon);
- }
-
- }
-
- @Test
- public abstract void interpolationInside();
-
- protected <T extends RealFieldElement<T>> void doInterpolationInside(final Field<T> field,
- double epsilonSin, double epsilonCos) {
-
- RungeKuttaFieldStepInterpolator<T> interpolator = setUpInterpolator(field,
- new SinCos<T>(field),
- 0.0, new double[] { 0.0, 1.0 }, 0.0125);
-
- int n = 100;
- double maxErrorSin = 0;
- double maxErrorCos = 0;
- for (int i = 0; i <= n; ++i) {
- T t = interpolator.getPreviousState().getTime().multiply(n - i).
- add(interpolator.getCurrentState().getTime().multiply(i)).
- divide(n);
- FieldODEStateAndDerivative<T> state = interpolator.getInterpolatedState(t);
- maxErrorSin = FastMath.max(maxErrorSin, state.getState()[0].subtract(t.sin()).abs().getReal());
- maxErrorCos = FastMath.max(maxErrorCos, state.getState()[1].subtract(t.cos()).abs().getReal());
- }
- Assert.assertEquals(0.0, maxErrorSin, epsilonSin);
- Assert.assertEquals(0.0, maxErrorCos, epsilonCos);
-
- }
-
- @Test
- public abstract void nonFieldInterpolatorConsistency();
-
- protected <T extends RealFieldElement<T>> void doNonFieldInterpolatorConsistency(final Field<T> field,
- double epsilonSin, double epsilonCos,
- double epsilonSinDot, double epsilonCosDot) {
-
- FirstOrderFieldDifferentialEquations<T> eqn = new SinCos<T>(field);
- RungeKuttaFieldStepInterpolator<T> fieldInterpolator =
- setUpInterpolator(field, eqn, 0.0, new double[] { 0.0, 1.0 }, 0.125);
- RungeKuttaStepInterpolator regularInterpolator = convertInterpolator(fieldInterpolator, eqn);
-
- int n = 100;
- double maxErrorSin = 0;
- double maxErrorCos = 0;
- double maxErrorSinDot = 0;
- double maxErrorCosDot = 0;
- for (int i = 0; i <= n; ++i) {
-
- T t = fieldInterpolator.getPreviousState().getTime().multiply(n - i).
- add(fieldInterpolator.getCurrentState().getTime().multiply(i)).
- divide(n);
-
- FieldODEStateAndDerivative<T> state = fieldInterpolator.getInterpolatedState(t);
- T[] fieldY = state.getState();
- T[] fieldYDot = state.getDerivative();
-
- regularInterpolator.setInterpolatedTime(t.getReal());
- double[] regularY = regularInterpolator.getInterpolatedState();
- double[] regularYDot = regularInterpolator.getInterpolatedDerivatives();
-
- maxErrorSin = FastMath.max(maxErrorSin, fieldY[0].subtract(regularY[0]).abs().getReal());
- maxErrorCos = FastMath.max(maxErrorCos, fieldY[1].subtract(regularY[1]).abs().getReal());
- maxErrorSinDot = FastMath.max(maxErrorSinDot, fieldYDot[0].subtract(regularYDot[0]).abs().getReal());
- maxErrorCosDot = FastMath.max(maxErrorCosDot, fieldYDot[1].subtract(regularYDot[1]).abs().getReal());
-
- }
- Assert.assertEquals(0.0, maxErrorSin, epsilonSin);
- Assert.assertEquals(0.0, maxErrorCos, epsilonCos);
- Assert.assertEquals(0.0, maxErrorSinDot, epsilonSinDot);
- Assert.assertEquals(0.0, maxErrorCosDot, epsilonCosDot);
-
- }
-
- private <T extends RealFieldElement<T>>
- RungeKuttaFieldStepInterpolator<T> setUpInterpolator(final Field<T> field,
- final FirstOrderFieldDifferentialEquations<T> eqn,
- final double t0, final double[] y0,
- final double t1) {
-
- // get the Butcher arrays from the field integrator
- FieldButcherArrayProvider<T> provider = createButcherArrayProvider(field);
- T[][] a = provider.getA();
- T[] b = provider.getB();
- T[] c = provider.getC();
-
- // store initial state
- T t = field.getZero().add(t0);
- T[] fieldY = MathArrays.buildArray(field, eqn.getDimension());
- T[][] fieldYDotK = MathArrays.buildArray(field, b.length, -1);
- for (int i = 0; i < y0.length; ++i) {
- fieldY[i] = field.getZero().add(y0[i]);
- }
- fieldYDotK[0] = eqn.computeDerivatives(t, fieldY);
- FieldODEStateAndDerivative<T> s0 = new FieldODEStateAndDerivative<T>(t, fieldY, fieldYDotK[0]);
-
- // perform one integration step, in order to get consistent derivatives
- T h = field.getZero().add(t1 - t0);
- for (int k = 0; k < a.length; ++k) {
- for (int i = 0; i < y0.length; ++i) {
- fieldY[i] = field.getZero().add(y0[i]);
- for (int s = 0; s <= k; ++s) {
- fieldY[i] = fieldY[i].add(h.multiply(a[k][s].multiply(fieldYDotK[s][i])));
- }
- }
- fieldYDotK[k + 1] = eqn.computeDerivatives(h.multiply(c[k]).add(t0), fieldY);
- }
-
- // store state at step end
- t = field.getZero().add(t1);
- for (int i = 0; i < y0.length; ++i) {
- fieldY[i] = field.getZero().add(y0[i]);
- for (int s = 0; s < b.length; ++s) {
- fieldY[i] = fieldY[i].add(h.multiply(b[s].multiply(fieldYDotK[s][i])));
- }
- }
- FieldODEStateAndDerivative<T> s1 = new FieldODEStateAndDerivative<T>(t, fieldY,
- eqn.computeDerivatives(t, fieldY));
-
- return createInterpolator(field, t1 > t0, fieldYDotK, s0, s1, s0, s1,
- new FieldExpandableODE<T>(eqn).getMapper());
-
- }
-
- private <T extends RealFieldElement<T>>
- RungeKuttaStepInterpolator convertInterpolator(final RungeKuttaFieldStepInterpolator<T> fieldInterpolator,
- final FirstOrderFieldDifferentialEquations<T> eqn) {
-
- RungeKuttaStepInterpolator regularInterpolator = null;
- try {
-
- String interpolatorName = fieldInterpolator.getClass().getName();
- String integratorName = interpolatorName.replaceAll("Field", "");
- @SuppressWarnings("unchecked")
- Class<RungeKuttaStepInterpolator> clz = (Class<RungeKuttaStepInterpolator>) Class.forName(integratorName);
- regularInterpolator = clz.newInstance();
-
- double[][] yDotArray = null;
- java.lang.reflect.Field fYD = RungeKuttaFieldStepInterpolator.class.getDeclaredField("yDotK");
- fYD.setAccessible(true);
- @SuppressWarnings("unchecked")
- T[][] fieldYDotk = (T[][]) fYD.get(fieldInterpolator);
- yDotArray = new double[fieldYDotk.length][];
- for (int i = 0; i < yDotArray.length; ++i) {
- yDotArray[i] = new double[fieldYDotk[i].length];
- for (int j = 0; j < yDotArray[i].length; ++j) {
- yDotArray[i][j] = fieldYDotk[i][j].getReal();
- }
- }
- double[] y = new double[yDotArray[0].length];
-
- EquationsMapper primaryMapper = null;
- EquationsMapper[] secondaryMappers = null;
- java.lang.reflect.Field fMapper = AbstractFieldStepInterpolator.class.getDeclaredField("mapper");
- fMapper.setAccessible(true);
- @SuppressWarnings("unchecked")
- FieldEquationsMapper<T> mapper = (FieldEquationsMapper<T>) fMapper.get(fieldInterpolator);
- java.lang.reflect.Field fStart = FieldEquationsMapper.class.getDeclaredField("start");
- fStart.setAccessible(true);
- int[] start = (int[]) fStart.get(mapper);
- primaryMapper = new EquationsMapper(start[0], start[1]);
- secondaryMappers = new EquationsMapper[mapper.getNumberOfEquations() - 1];
- for (int i = 0; i < secondaryMappers.length; ++i) {
- secondaryMappers[i] = new EquationsMapper(start[i + 1], start[i + 2]);
- }
-
- AbstractIntegrator dummyIntegrator = new AbstractIntegrator("dummy") {
- @Override
- public void integrate(ExpandableStatefulODE equations, double t) {
- Assert.fail("this method should not be called");
- }
- @Override
- public void computeDerivatives(final double t, final double[] y, final double[] yDot) {
- T fieldT = fieldInterpolator.getCurrentState().getTime().getField().getZero().add(t);
- T[] fieldY = MathArrays.buildArray(fieldInterpolator.getCurrentState().getTime().getField(), y.length);
- for (int i = 0; i < y.length; ++i) {
- fieldY[i] = fieldInterpolator.getCurrentState().getTime().getField().getZero().add(y[i]);
- }
- T[] fieldYDot = eqn.computeDerivatives(fieldT, fieldY);
- for (int i = 0; i < yDot.length; ++i) {
- yDot[i] = fieldYDot[i].getReal();
- }
- }
- };
- regularInterpolator.reinitialize(dummyIntegrator, y, yDotArray,
- fieldInterpolator.isForward(),
- primaryMapper, secondaryMappers);
-
- T[] fieldPreviousY = fieldInterpolator.getPreviousState().getState();
- for (int i = 0; i < y.length; ++i) {
- y[i] = fieldPreviousY[i].getReal();
- }
- regularInterpolator.storeTime(fieldInterpolator.getPreviousState().getTime().getReal());
-
- regularInterpolator.shift();
-
- T[] fieldCurrentY = fieldInterpolator.getCurrentState().getState();
- for (int i = 0; i < y.length; ++i) {
- y[i] = fieldCurrentY[i].getReal();
- }
- regularInterpolator.storeTime(fieldInterpolator.getCurrentState().getTime().getReal());
-
- } catch (ClassNotFoundException cnfe) {
- Assert.fail(cnfe.getLocalizedMessage());
- } catch (InstantiationException ie) {
- Assert.fail(ie.getLocalizedMessage());
- } catch (IllegalAccessException iae) {
- Assert.fail(iae.getLocalizedMessage());
- } catch (NoSuchFieldException nsfe) {
- Assert.fail(nsfe.getLocalizedMessage());
- } catch (IllegalArgumentException iae) {
- Assert.fail(iae.getLocalizedMessage());
- }
-
- return regularInterpolator;
-
- }
-
- private static class SinCos<T extends RealFieldElement<T>> implements FirstOrderFieldDifferentialEquations<T> {
- private final Field<T> field;
- protected SinCos(final Field<T> field) {
- this.field = field;
- }
- public int getDimension() {
- return 2;
- }
- public void init(final T t0, final T[] y0, final T finalTime) {
- }
- public T[] computeDerivatives(final T t, final T[] y) {
- T[] yDot = MathArrays.buildArray(field, 2);
- yDot[0] = y[1];
- yDot[1] = y[0].negate();
- return yDot;
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/29649959/src/test/java/org/apache/commons/math3/ode/nonstiff/AdamsBashforthFieldIntegratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ode/nonstiff/AdamsBashforthFieldIntegratorTest.java b/src/test/java/org/apache/commons/math3/ode/nonstiff/AdamsBashforthFieldIntegratorTest.java
index 9b7c45e..e78a6de 100644
--- a/src/test/java/org/apache/commons/math3/ode/nonstiff/AdamsBashforthFieldIntegratorTest.java
+++ b/src/test/java/org/apache/commons/math3/ode/nonstiff/AdamsBashforthFieldIntegratorTest.java
@@ -26,7 +26,7 @@ import org.apache.commons.math3.exception.NumberIsTooSmallException;
import org.apache.commons.math3.util.Decimal64Field;
import org.junit.Test;
-public class AdamsBashforthFieldIntegratorTest extends AbstractAdamsFieldIntegratorTest {
+public class AdamsBashforthFieldIntegratorTest extends AdamsFieldIntegratorAbstractTest {
protected <T extends RealFieldElement<T>> AdamsFieldIntegrator<T>
createIntegrator(Field<T> field, final int nSteps, final double minStep, final double maxStep,
http://git-wip-us.apache.org/repos/asf/commons-math/blob/29649959/src/test/java/org/apache/commons/math3/ode/nonstiff/AdamsFieldIntegratorAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ode/nonstiff/AdamsFieldIntegratorAbstractTest.java b/src/test/java/org/apache/commons/math3/ode/nonstiff/AdamsFieldIntegratorAbstractTest.java
new file mode 100644
index 0000000..efc1b2c
--- /dev/null
+++ b/src/test/java/org/apache/commons/math3/ode/nonstiff/AdamsFieldIntegratorAbstractTest.java
@@ -0,0 +1,260 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.math3.ode.nonstiff;
+
+
+import org.apache.commons.math3.Field;
+import org.apache.commons.math3.RealFieldElement;
+import org.apache.commons.math3.exception.MathIllegalStateException;
+import org.apache.commons.math3.exception.MaxCountExceededException;
+import org.apache.commons.math3.exception.NumberIsTooSmallException;
+import org.apache.commons.math3.ode.AbstractFieldIntegrator;
+import org.apache.commons.math3.ode.FieldExpandableODE;
+import org.apache.commons.math3.ode.FieldODEState;
+import org.apache.commons.math3.ode.FieldODEStateAndDerivative;
+import org.apache.commons.math3.ode.FirstOrderFieldIntegrator;
+import org.apache.commons.math3.ode.MultistepFieldIntegrator;
+import org.apache.commons.math3.ode.TestFieldProblem1;
+import org.apache.commons.math3.ode.TestFieldProblem5;
+import org.apache.commons.math3.ode.TestFieldProblem6;
+import org.apache.commons.math3.ode.TestFieldProblemAbstract;
+import org.apache.commons.math3.ode.TestFieldProblemHandler;
+import org.apache.commons.math3.ode.sampling.FieldStepHandler;
+import org.apache.commons.math3.ode.sampling.FieldStepInterpolator;
+import org.apache.commons.math3.util.FastMath;
+import org.junit.Assert;
+import org.junit.Test;
+
+public abstract class AdamsFieldIntegratorAbstractTest {
+
+ protected abstract <T extends RealFieldElement<T>> AdamsFieldIntegrator<T>
+ createIntegrator(Field<T> field, final int nSteps, final double minStep, final double maxStep,
+ final double scalAbsoluteTolerance, final double scalRelativeTolerance);
+
+ protected abstract <T extends RealFieldElement<T>> AdamsFieldIntegrator<T>
+ createIntegrator(Field<T> field, final int nSteps, final double minStep, final double maxStep,
+ final double[] vecAbsoluteTolerance, final double[] vecRelativeTolerance);
+
+ @Test(expected=NumberIsTooSmallException.class)
+ public abstract void testMinStep();
+
+ protected <T extends RealFieldElement<T>> void doDimensionCheck(final Field<T> field) {
+ TestFieldProblem1<T> pb = new TestFieldProblem1<T>(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 };
+ double[] vecRelativeTolerance = { 1.0e-15, 1.0e-16 };
+
+ FirstOrderFieldIntegrator<T> integ = createIntegrator(field, 4, minStep, maxStep,
+ vecAbsoluteTolerance,
+ vecRelativeTolerance);
+ TestFieldProblemHandler<T> handler = new TestFieldProblemHandler<T>(pb, integ);
+ integ.addStepHandler(handler);
+ integ.integrate(new FieldExpandableODE<T>(pb), pb.getInitialState(), pb.getFinalTime());
+
+ }
+
+ @Test
+ public abstract void testIncreasingTolerance();
+
+ protected <T extends RealFieldElement<T>> void doTestIncreasingTolerance(final Field<T> field,
+ double ratioMin, double ratioMax) {
+
+ int previousCalls = Integer.MAX_VALUE;
+ for (int i = -12; i < -2; ++i) {
+ TestFieldProblem1<T> pb = new TestFieldProblem1<T>(field);
+ double minStep = 0;
+ double maxStep = pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal();
+ double scalAbsoluteTolerance = FastMath.pow(10.0, i);
+ double scalRelativeTolerance = 0.01 * scalAbsoluteTolerance;
+
+ FirstOrderFieldIntegrator<T> integ = createIntegrator(field, 4, minStep, maxStep,
+ scalAbsoluteTolerance,
+ scalRelativeTolerance);
+ TestFieldProblemHandler<T> handler = new TestFieldProblemHandler<T>(pb, integ);
+ integ.addStepHandler(handler);
+ integ.integrate(new FieldExpandableODE<T>(pb), pb.getInitialState(), pb.getFinalTime());
+
+ Assert.assertTrue(handler.getMaximalValueError().getReal() > ratioMin * scalAbsoluteTolerance);
+ Assert.assertTrue(handler.getMaximalValueError().getReal() < ratioMax * scalAbsoluteTolerance);
+
+ int calls = pb.getCalls();
+ Assert.assertEquals(integ.getEvaluations(), calls);
+ Assert.assertTrue(calls <= previousCalls);
+ previousCalls = calls;
+
+ }
+
+ }
+
+ @Test(expected = MaxCountExceededException.class)
+ public abstract void exceedMaxEvaluations();
+
+ protected <T extends RealFieldElement<T>> void doExceedMaxEvaluations(final Field<T> field, final int max) {
+
+ TestFieldProblem1<T> pb = new TestFieldProblem1<T>(field);
+ double range = pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal();
+
+ FirstOrderFieldIntegrator<T> integ = createIntegrator(field, 2, 0, range, 1.0e-12, 1.0e-12);
+ TestFieldProblemHandler<T> handler = new TestFieldProblemHandler<T>(pb, integ);
+ integ.addStepHandler(handler);
+ integ.setMaxEvaluations(max);
+ integ.integrate(new FieldExpandableODE<T>(pb), pb.getInitialState(), pb.getFinalTime());
+
+ }
+
+ @Test
+ public abstract void backward();
+
+ protected <T extends RealFieldElement<T>> void doBackward(final Field<T> field,
+ final double epsilonLast,
+ final double epsilonMaxValue,
+ final double epsilonMaxTime,
+ final String name) {
+
+ TestFieldProblem5<T> pb = new TestFieldProblem5<T>(field);
+ double range = pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal();
+
+ AdamsFieldIntegrator<T> integ = createIntegrator(field, 4, 0, range, 1.0e-12, 1.0e-12);
+ TestFieldProblemHandler<T> handler = new TestFieldProblemHandler<T>(pb, integ);
+ integ.addStepHandler(handler);
+ integ.integrate(new FieldExpandableODE<T>(pb), pb.getInitialState(), pb.getFinalTime());
+
+ Assert.assertEquals(0.0, handler.getLastError().getReal(), epsilonLast);
+ Assert.assertEquals(0.0, handler.getMaximalValueError().getReal(), epsilonMaxValue);
+ Assert.assertEquals(0, handler.getMaximalTimeError().getReal(), epsilonMaxTime);
+ Assert.assertEquals(name, integ.getName());
+ }
+
+ @Test
+ public abstract void polynomial();
+
+ protected <T extends RealFieldElement<T>> void doPolynomial(final Field<T> field,
+ final int nLimit,
+ final double epsilonBad,
+ final double epsilonGood) {
+ TestFieldProblem6<T> pb = new TestFieldProblem6<T>(field);
+ double range = pb.getFinalTime().subtract(pb.getInitialState().getTime()).abs().getReal();
+
+ for (int nSteps = 2; nSteps < 8; ++nSteps) {
+ AdamsFieldIntegrator<T> integ = createIntegrator(field, nSteps, 1.0e-6 * range, 0.1 * range, 1.0e-4, 1.0e-4);
+ integ.setStarterIntegrator(new PerfectStarter<T>(pb, nSteps));
+ TestFieldProblemHandler<T> handler = new TestFieldProblemHandler<T>(pb, integ);
+ integ.addStepHandler(handler);
+ integ.integrate(new FieldExpandableODE<T>(pb), pb.getInitialState(), pb.getFinalTime());
+ if (nSteps < nLimit) {
+ Assert.assertTrue(handler.getMaximalValueError().getReal() > epsilonBad);
+ } else {
+ Assert.assertTrue(handler.getMaximalValueError().getReal() < epsilonGood);
+ }
+ }
+
+ }
+
+ @Test(expected=MathIllegalStateException.class)
+ public abstract void testStartFailure();
+
+ protected <T extends RealFieldElement<T>> void doTestStartFailure(final Field<T> field) {
+ TestFieldProblem1<T> pb = new TestFieldProblem1<T>(field);
+ double minStep = pb.getFinalTime().subtract(pb.getInitialState().getTime()).multiply(0.0001).getReal();
+ double maxStep = pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal();
+ double scalAbsoluteTolerance = 1.0e-6;
+ double scalRelativeTolerance = 1.0e-7;
+
+ MultistepFieldIntegrator<T> integ = createIntegrator(field, 6, minStep, maxStep,
+ scalAbsoluteTolerance,
+ scalRelativeTolerance);
+ integ.setStarterIntegrator(new DormandPrince853FieldIntegrator<T>(field, maxStep * 0.5, maxStep, 0.1, 0.1));
+ TestFieldProblemHandler<T> handler = new TestFieldProblemHandler<T>(pb, integ);
+ integ.addStepHandler(handler);
+ integ.integrate(new FieldExpandableODE<T>(pb), pb.getInitialState(), pb.getFinalTime());
+
+ }
+
+ private static class PerfectStarter<T extends RealFieldElement<T>> extends AbstractFieldIntegrator<T> {
+
+ private final PerfectInterpolator<T> interpolator;
+ private final int nbSteps;
+
+ public PerfectStarter(final TestFieldProblemAbstract<T> problem, final int nbSteps) {
+ super(problem.getField(), "perfect-starter");
+ this.interpolator = new PerfectInterpolator<T>(problem);
+ this.nbSteps = nbSteps;
+ }
+
+ public FieldODEStateAndDerivative<T> integrate(FieldExpandableODE<T> equations,
+ FieldODEState<T> initialState, T finalTime) {
+ T tStart = initialState.getTime().add(finalTime.subtract(initialState.getTime()).multiply(0.01));
+ getEvaluationsCounter().increment(nbSteps);
+ interpolator.setCurrentTime(initialState.getTime());
+ for (int i = 0; i < nbSteps; ++i) {
+ T tK = initialState.getTime().multiply(nbSteps - 1 - (i + 1)).add(tStart.multiply(i + 1)).divide(nbSteps - 1);
+ interpolator.setPreviousTime(interpolator.getCurrentTime());
+ interpolator.setCurrentTime(tK);
+ for (FieldStepHandler<T> handler : getStepHandlers()) {
+ handler.handleStep(interpolator, i == nbSteps - 1);
+ }
+ }
+ return interpolator.getInterpolatedState(tStart);
+ }
+
+ }
+
+ private static class PerfectInterpolator<T extends RealFieldElement<T>> implements FieldStepInterpolator<T> {
+ private final TestFieldProblemAbstract<T> problem;
+ private T previousTime;
+ private T currentTime;
+
+ public PerfectInterpolator(final TestFieldProblemAbstract<T> problem) {
+ this.problem = problem;
+ }
+
+ public void setPreviousTime(T previousTime) {
+ this.previousTime = previousTime;
+ }
+
+ public void setCurrentTime(T currentTime) {
+ this.currentTime = currentTime;
+ }
+
+ public T getCurrentTime() {
+ return currentTime;
+ }
+
+ public boolean isForward() {
+ return problem.getFinalTime().subtract(problem.getInitialState().getTime()).getReal() >= 0;
+ }
+
+ public FieldODEStateAndDerivative<T> getPreviousState() {
+ return getInterpolatedState(previousTime);
+ }
+
+ public FieldODEStateAndDerivative<T> getCurrentState() {
+ return getInterpolatedState(currentTime);
+ }
+
+ public FieldODEStateAndDerivative<T> getInterpolatedState(T time) {
+ T[] y = problem.computeTheoreticalState(time);
+ T[] yDot = problem.computeDerivatives(time, y);
+ return new FieldODEStateAndDerivative<T>(time, y, yDot);
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/29649959/src/test/java/org/apache/commons/math3/ode/nonstiff/AdamsMoultonFieldIntegratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ode/nonstiff/AdamsMoultonFieldIntegratorTest.java b/src/test/java/org/apache/commons/math3/ode/nonstiff/AdamsMoultonFieldIntegratorTest.java
index 2a389b4..eda33d3 100644
--- a/src/test/java/org/apache/commons/math3/ode/nonstiff/AdamsMoultonFieldIntegratorTest.java
+++ b/src/test/java/org/apache/commons/math3/ode/nonstiff/AdamsMoultonFieldIntegratorTest.java
@@ -26,7 +26,7 @@ import org.apache.commons.math3.exception.NumberIsTooSmallException;
import org.apache.commons.math3.util.Decimal64Field;
import org.junit.Test;
-public class AdamsMoultonFieldIntegratorTest extends AbstractAdamsFieldIntegratorTest {
+public class AdamsMoultonFieldIntegratorTest extends AdamsFieldIntegratorAbstractTest {
protected <T extends RealFieldElement<T>> AdamsFieldIntegrator<T>
createIntegrator(Field<T> field, final int nSteps, final double minStep, final double maxStep,
http://git-wip-us.apache.org/repos/asf/commons-math/blob/29649959/src/test/java/org/apache/commons/math3/ode/nonstiff/ClassicalRungKuttaFieldStepInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ode/nonstiff/ClassicalRungKuttaFieldStepInterpolatorTest.java b/src/test/java/org/apache/commons/math3/ode/nonstiff/ClassicalRungKuttaFieldStepInterpolatorTest.java
index e94a041..b69b52b 100644
--- a/src/test/java/org/apache/commons/math3/ode/nonstiff/ClassicalRungKuttaFieldStepInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math3/ode/nonstiff/ClassicalRungKuttaFieldStepInterpolatorTest.java
@@ -25,7 +25,7 @@ import org.apache.commons.math3.ode.FieldODEStateAndDerivative;
import org.apache.commons.math3.util.Decimal64Field;
import org.junit.Test;
-public class ClassicalRungKuttaFieldStepInterpolatorTest extends AbstractRungeKuttaFieldStepInterpolatorTest {
+public class ClassicalRungKuttaFieldStepInterpolatorTest extends RungeKuttaFieldStepInterpolatorAbstractTest {
protected <T extends RealFieldElement<T>> RungeKuttaFieldStepInterpolator<T>
createInterpolator(Field<T> field, boolean forward, T[][] yDotK,
http://git-wip-us.apache.org/repos/asf/commons-math/blob/29649959/src/test/java/org/apache/commons/math3/ode/nonstiff/ClassicalRungeKuttaFieldIntegratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ode/nonstiff/ClassicalRungeKuttaFieldIntegratorTest.java b/src/test/java/org/apache/commons/math3/ode/nonstiff/ClassicalRungeKuttaFieldIntegratorTest.java
index e1cef43..2fa96d5 100644
--- a/src/test/java/org/apache/commons/math3/ode/nonstiff/ClassicalRungeKuttaFieldIntegratorTest.java
+++ b/src/test/java/org/apache/commons/math3/ode/nonstiff/ClassicalRungeKuttaFieldIntegratorTest.java
@@ -22,7 +22,7 @@ import org.apache.commons.math3.Field;
import org.apache.commons.math3.RealFieldElement;
import org.apache.commons.math3.util.Decimal64Field;
-public class ClassicalRungeKuttaFieldIntegratorTest extends AbstractRungeKuttaFieldIntegratorTest {
+public class ClassicalRungeKuttaFieldIntegratorTest extends RungeKuttaFieldIntegratorAbstractTest {
protected <T extends RealFieldElement<T>> RungeKuttaFieldIntegrator<T>
createIntegrator(Field<T> field, T step) {
http://git-wip-us.apache.org/repos/asf/commons-math/blob/29649959/src/test/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldIntegratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldIntegratorTest.java b/src/test/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldIntegratorTest.java
index cd3c5ad..5285b75 100644
--- a/src/test/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldIntegratorTest.java
+++ b/src/test/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldIntegratorTest.java
@@ -22,7 +22,7 @@ import org.apache.commons.math3.Field;
import org.apache.commons.math3.RealFieldElement;
import org.apache.commons.math3.util.Decimal64Field;
-public class DormandPrince54FieldIntegratorTest extends AbstractEmbeddedRungeKuttaFieldIntegratorTest {
+public class DormandPrince54FieldIntegratorTest extends EmbeddedRungeKuttaFieldIntegratorAbstractTest {
protected <T extends RealFieldElement<T>> EmbeddedRungeKuttaFieldIntegrator<T>
createIntegrator(Field<T> field, final double minStep, final double maxStep,
http://git-wip-us.apache.org/repos/asf/commons-math/blob/29649959/src/test/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldStepInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldStepInterpolatorTest.java b/src/test/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldStepInterpolatorTest.java
index a01976e..792b21c 100644
--- a/src/test/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldStepInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldStepInterpolatorTest.java
@@ -25,7 +25,7 @@ import org.apache.commons.math3.ode.FieldODEStateAndDerivative;
import org.apache.commons.math3.util.Decimal64Field;
import org.junit.Test;
-public class DormandPrince54FieldStepInterpolatorTest extends AbstractRungeKuttaFieldStepInterpolatorTest {
+public class DormandPrince54FieldStepInterpolatorTest extends RungeKuttaFieldStepInterpolatorAbstractTest {
protected <T extends RealFieldElement<T>> RungeKuttaFieldStepInterpolator<T>
createInterpolator(Field<T> field, boolean forward, T[][] yDotK,
http://git-wip-us.apache.org/repos/asf/commons-math/blob/29649959/src/test/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldIntegratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldIntegratorTest.java b/src/test/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldIntegratorTest.java
index 1edc8a4..80f2d96 100644
--- a/src/test/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldIntegratorTest.java
+++ b/src/test/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldIntegratorTest.java
@@ -22,7 +22,7 @@ import org.apache.commons.math3.Field;
import org.apache.commons.math3.RealFieldElement;
import org.apache.commons.math3.util.Decimal64Field;
-public class DormandPrince853FieldIntegratorTest extends AbstractEmbeddedRungeKuttaFieldIntegratorTest {
+public class DormandPrince853FieldIntegratorTest extends EmbeddedRungeKuttaFieldIntegratorAbstractTest {
protected <T extends RealFieldElement<T>> EmbeddedRungeKuttaFieldIntegrator<T>
createIntegrator(Field<T> field, final double minStep, final double maxStep,
http://git-wip-us.apache.org/repos/asf/commons-math/blob/29649959/src/test/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldStepInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldStepInterpolatorTest.java b/src/test/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldStepInterpolatorTest.java
index 2fca2bd..d9e4ea1 100644
--- a/src/test/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldStepInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldStepInterpolatorTest.java
@@ -25,7 +25,7 @@ import org.apache.commons.math3.ode.FieldODEStateAndDerivative;
import org.apache.commons.math3.util.Decimal64Field;
import org.junit.Test;
-public class DormandPrince853FieldStepInterpolatorTest extends AbstractRungeKuttaFieldStepInterpolatorTest {
+public class DormandPrince853FieldStepInterpolatorTest extends RungeKuttaFieldStepInterpolatorAbstractTest {
protected <T extends RealFieldElement<T>> RungeKuttaFieldStepInterpolator<T>
createInterpolator(Field<T> field, boolean forward, T[][] yDotK,
http://git-wip-us.apache.org/repos/asf/commons-math/blob/29649959/src/test/java/org/apache/commons/math3/ode/nonstiff/EmbeddedRungeKuttaFieldIntegratorAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ode/nonstiff/EmbeddedRungeKuttaFieldIntegratorAbstractTest.java b/src/test/java/org/apache/commons/math3/ode/nonstiff/EmbeddedRungeKuttaFieldIntegratorAbstractTest.java
new file mode 100644
index 0000000..cb5797a
--- /dev/null
+++ b/src/test/java/org/apache/commons/math3/ode/nonstiff/EmbeddedRungeKuttaFieldIntegratorAbstractTest.java
@@ -0,0 +1,600 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.math3.ode.nonstiff;
+
+
+import org.apache.commons.math3.Field;
+import org.apache.commons.math3.RealFieldElement;
+import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math3.exception.DimensionMismatchException;
+import org.apache.commons.math3.exception.MaxCountExceededException;
+import org.apache.commons.math3.exception.NoBracketingException;
+import org.apache.commons.math3.exception.NumberIsTooSmallException;
+import org.apache.commons.math3.ode.FieldExpandableODE;
+import org.apache.commons.math3.ode.FirstOrderFieldDifferentialEquations;
+import org.apache.commons.math3.ode.FirstOrderFieldIntegrator;
+import org.apache.commons.math3.ode.FieldODEState;
+import org.apache.commons.math3.ode.FieldODEStateAndDerivative;
+import org.apache.commons.math3.ode.TestFieldProblem1;
+import org.apache.commons.math3.ode.TestFieldProblem3;
+import org.apache.commons.math3.ode.TestFieldProblem4;
+import org.apache.commons.math3.ode.TestFieldProblem5;
+import org.apache.commons.math3.ode.TestFieldProblemHandler;
+import org.apache.commons.math3.ode.events.Action;
+import org.apache.commons.math3.ode.events.FieldEventHandler;
+import org.apache.commons.math3.ode.sampling.FieldStepHandler;
+import org.apache.commons.math3.ode.sampling.FieldStepInterpolator;
+import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math3.util.MathArrays;
+import org.junit.Assert;
+import org.junit.Test;
+
+public abstract class EmbeddedRungeKuttaFieldIntegratorAbstractTest {
+
+ protected abstract <T extends RealFieldElement<T>> EmbeddedRungeKuttaFieldIntegrator<T>
+ createIntegrator(Field<T> field, final double minStep, final double maxStep,
+ final double scalAbsoluteTolerance, final double scalRelativeTolerance);
+
+ protected abstract <T extends RealFieldElement<T>> EmbeddedRungeKuttaFieldIntegrator<T>
+ createIntegrator(Field<T> field, final double minStep, final double maxStep,
+ final double[] vecAbsoluteTolerance, final double[] vecRelativeTolerance);
+
+ @Test
+ public abstract void testNonFieldIntegratorConsistency();
+
+ protected <T extends RealFieldElement<T>> void doTestNonFieldIntegratorConsistency(final Field<T> field) {
+ try {
+
+ // get the Butcher arrays from the field integrator
+ EmbeddedRungeKuttaFieldIntegrator<T> fieldIntegrator = createIntegrator(field, 0.001, 1.0, 1.0, 1.0);
+ T[][] fieldA = fieldIntegrator.getA();
+ T[] fieldB = fieldIntegrator.getB();
+ T[] fieldC = fieldIntegrator.getC();
+ if (fieldIntegrator instanceof DormandPrince853FieldIntegrator) {
+ // special case for Dormand-Prince 8(5,3), the array in the regular
+ // integrator is smaller because as of 3.X, the interpolation steps
+ // are not performed by the integrator itself
+ T[][] reducedFieldA = MathArrays.buildArray(field, 12, -1);
+ T[] reducedFieldB = MathArrays.buildArray(field, 13);
+ T[] reducedFieldC = MathArrays.buildArray(field, 12);
+ System.arraycopy(fieldA, 0, reducedFieldA, 0, reducedFieldA.length);
+ System.arraycopy(fieldB, 0, reducedFieldB, 0, reducedFieldB.length);
+ System.arraycopy(fieldC, 0, reducedFieldC, 0, reducedFieldC.length);
+ fieldA = reducedFieldA;
+ fieldB = reducedFieldB;
+ fieldC = reducedFieldC;
+ }
+
+ String fieldName = fieldIntegrator.getClass().getName();
+ String regularName = fieldName.replaceAll("Field", "");
+
+ // get the Butcher arrays from the regular integrator
+ @SuppressWarnings("unchecked")
+ Class<RungeKuttaIntegrator> c = (Class<RungeKuttaIntegrator>) Class.forName(regularName);
+ java.lang.reflect.Field jlrFieldA = c.getDeclaredField("STATIC_A");
+ jlrFieldA.setAccessible(true);
+ double[][] regularA = (double[][]) jlrFieldA.get(null);
+ java.lang.reflect.Field jlrFieldB = c.getDeclaredField("STATIC_B");
+ jlrFieldB.setAccessible(true);
+ double[] regularB = (double[]) jlrFieldB.get(null);
+ java.lang.reflect.Field jlrFieldC = c.getDeclaredField("STATIC_C");
+ jlrFieldC.setAccessible(true);
+ double[] regularC = (double[]) jlrFieldC.get(null);
+
+ Assert.assertEquals(regularA.length, fieldA.length);
+ for (int i = 0; i < regularA.length; ++i) {
+ checkArray(regularA[i], fieldA[i]);
+ }
+ checkArray(regularB, fieldB);
+ checkArray(regularC, fieldC);
+
+ } catch (ClassNotFoundException cnfe) {
+ Assert.fail(cnfe.getLocalizedMessage());
+ } catch (IllegalAccessException iae) {
+ Assert.fail(iae.getLocalizedMessage());
+ } catch (IllegalArgumentException iae) {
+ Assert.fail(iae.getLocalizedMessage());
+ } catch (SecurityException se) {
+ Assert.fail(se.getLocalizedMessage());
+ } catch (NoSuchFieldException nsfe) {
+ Assert.fail(nsfe.getLocalizedMessage());
+ }
+ }
+
+ private <T extends RealFieldElement<T>> void checkArray(double[] regularArray, T[] fieldArray) {
+ Assert.assertEquals(regularArray.length, fieldArray.length);
+ for (int i = 0; i < regularArray.length; ++i) {
+ if (regularArray[i] == 0) {
+ Assert.assertTrue(0.0 == fieldArray[i].getReal());
+ } else {
+ Assert.assertEquals(regularArray[i], fieldArray[i].getReal(), FastMath.ulp(regularArray[i]));
+ }
+ }
+ }
+
+ @Test
+ public abstract void testForwardBackwardExceptions();
+
+ protected <T extends RealFieldElement<T>> void doTestForwardBackwardExceptions(final Field<T> field) {
+ FirstOrderFieldDifferentialEquations<T> equations = new FirstOrderFieldDifferentialEquations<T>() {
+
+ public int getDimension() {
+ return 1;
+ }
+
+ public void init(T t0, T[] y0, T t) {
+ }
+
+ public T[] computeDerivatives(T t, T[] y) {
+ if (t.getReal() < -0.5) {
+ throw new LocalException();
+ } else {
+ throw new RuntimeException("oops");
+ }
+ }
+ };
+
+ 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(),
+ MathArrays.buildArray(field, 1)),
+ field.getZero());
+ Assert.fail("an exception should have been thrown");
+ } catch(LocalException de) {
+ // expected behavior
+ }
+
+ try {
+ integrator.integrate(new FieldExpandableODE<T>(equations),
+ new FieldODEState<T>(field.getZero(),
+ MathArrays.buildArray(field, 1)),
+ field.getOne());
+ Assert.fail("an exception should have been thrown");
+ } catch(RuntimeException de) {
+ // expected behavior
+ }
+ }
+
+ protected static class LocalException extends RuntimeException {
+ private static final long serialVersionUID = 20151208L;
+ }
+
+ @Test(expected=NumberIsTooSmallException.class)
+ public abstract void testMinStep();
+
+ protected <T extends RealFieldElement<T>> void doTestMinStep(final Field<T> field)
+ throws NumberIsTooSmallException {
+
+ TestFieldProblem1<T> pb = new TestFieldProblem1<T>(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 };
+ double[] vecRelativeTolerance = { 1.0e-15, 1.0e-16 };
+
+ FirstOrderFieldIntegrator<T> integ = createIntegrator(field, minStep, maxStep,
+ vecAbsoluteTolerance, vecRelativeTolerance);
+ TestFieldProblemHandler<T> handler = new TestFieldProblemHandler<T>(pb, integ);
+ integ.addStepHandler(handler);
+ integ.integrate(new FieldExpandableODE<T>(pb), pb.getInitialState(), pb.getFinalTime());
+ Assert.fail("an exception should have been thrown");
+
+ }
+
+ @Test
+ public abstract void testIncreasingTolerance();
+
+ protected <T extends RealFieldElement<T>> void doTestIncreasingTolerance(final Field<T> field,
+ double factor,
+ double epsilon) {
+
+ int previousCalls = Integer.MAX_VALUE;
+ for (int i = -12; i < -2; ++i) {
+ TestFieldProblem1<T> pb = new TestFieldProblem1<T>(field);
+ double minStep = 0;
+ double maxStep = pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal();
+ double scalAbsoluteTolerance = FastMath.pow(10.0, i);
+ double scalRelativeTolerance = 0.01 * scalAbsoluteTolerance;
+
+ FirstOrderFieldIntegrator<T> integ = createIntegrator(field, minStep, maxStep,
+ scalAbsoluteTolerance, scalRelativeTolerance);
+ TestFieldProblemHandler<T> handler = new TestFieldProblemHandler<T>(pb, integ);
+ integ.addStepHandler(handler);
+ integ.integrate(new FieldExpandableODE<T>(pb), pb.getInitialState(), pb.getFinalTime());
+
+ Assert.assertTrue(handler.getMaximalValueError().getReal() < (factor * scalAbsoluteTolerance));
+ Assert.assertEquals(0, handler.getMaximalTimeError().getReal(), epsilon);
+
+ int calls = pb.getCalls();
+ Assert.assertEquals(integ.getEvaluations(), calls);
+ Assert.assertTrue(calls <= previousCalls);
+ previousCalls = calls;
+
+ }
+
+ }
+
+ @Test
+ public abstract void testEvents();
+
+ protected <T extends RealFieldElement<T>> void doTestEvents(final Field<T> field,
+ final double epsilonMaxValue,
+ final String name) {
+
+ TestFieldProblem4<T> pb = new TestFieldProblem4<T>(field);
+ double minStep = 0;
+ double maxStep = pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal();
+ double scalAbsoluteTolerance = 1.0e-8;
+ double scalRelativeTolerance = 0.01 * scalAbsoluteTolerance;
+
+ FirstOrderFieldIntegrator<T> integ = createIntegrator(field, minStep, maxStep,
+ scalAbsoluteTolerance, scalRelativeTolerance);
+ TestFieldProblemHandler<T> handler = new TestFieldProblemHandler<T>(pb, integ);
+ integ.addStepHandler(handler);
+ FieldEventHandler<T>[] functions = pb.getEventsHandlers();
+ double convergence = 1.0e-8 * maxStep;
+ for (int l = 0; l < functions.length; ++l) {
+ 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());
+
+ Assert.assertEquals(0, handler.getMaximalValueError().getReal(), epsilonMaxValue);
+ Assert.assertEquals(0, handler.getMaximalTimeError().getReal(), convergence);
+ Assert.assertEquals(12.0, handler.getLastTime().getReal(), convergence);
+ Assert.assertEquals(name, integ.getName());
+ integ.clearEventHandlers();
+ Assert.assertEquals(0, integ.getEventHandlers().size());
+
+ }
+
+ @Test(expected=LocalException.class)
+ public abstract void testEventsErrors();
+
+ protected <T extends RealFieldElement<T>> void doTestEventsErrors(final Field<T> field)
+ throws LocalException {
+ final TestFieldProblem1<T> pb = new TestFieldProblem1<T>(field);
+ double minStep = 0;
+ double maxStep = pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal();
+ double scalAbsoluteTolerance = 1.0e-8;
+ double scalRelativeTolerance = 0.01 * scalAbsoluteTolerance;
+
+ FirstOrderFieldIntegrator<T> integ = createIntegrator(field, minStep, maxStep,
+ scalAbsoluteTolerance, scalRelativeTolerance);
+ TestFieldProblemHandler<T> handler = new TestFieldProblemHandler<T>(pb, integ);
+ integ.addStepHandler(handler);
+
+ integ.addEventHandler(new FieldEventHandler<T>() {
+ public void init(FieldODEStateAndDerivative<T> state0, T t) {
+ }
+ public Action eventOccurred(FieldODEStateAndDerivative<T> state, boolean increasing) {
+ return Action.CONTINUE;
+ }
+ public T g(FieldODEStateAndDerivative<T> state) {
+ T middle = pb.getInitialState().getTime().add(pb.getFinalTime()).multiply(0.5);
+ T offset = state.getTime().subtract(middle);
+ if (offset.getReal() > 0) {
+ throw new LocalException();
+ }
+ return offset;
+ }
+ public FieldODEState<T> resetState(FieldODEStateAndDerivative<T> state) {
+ return state;
+ }
+ }, Double.POSITIVE_INFINITY, 1.0e-8 * maxStep, 1000);
+
+ integ.integrate(new FieldExpandableODE<T>(pb), pb.getInitialState(), pb.getFinalTime());
+
+ }
+
+ @Test
+ public abstract void testEventsNoConvergence();
+
+ protected <T extends RealFieldElement<T>> void doTestEventsNoConvergence(final Field<T> field){
+
+ final TestFieldProblem1<T> pb = new TestFieldProblem1<T>(field);
+ double minStep = 0;
+ double maxStep = pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal();
+ double scalAbsoluteTolerance = 1.0e-8;
+ double scalRelativeTolerance = 0.01 * scalAbsoluteTolerance;
+
+ FirstOrderFieldIntegrator<T> integ = createIntegrator(field, minStep, maxStep,
+ scalAbsoluteTolerance, scalRelativeTolerance);
+ TestFieldProblemHandler<T> handler = new TestFieldProblemHandler<T>(pb, integ);
+ integ.addStepHandler(handler);
+
+ integ.addEventHandler(new FieldEventHandler<T>() {
+ public void init(FieldODEStateAndDerivative<T> state0, T t) {
+ }
+ public Action eventOccurred(FieldODEStateAndDerivative<T> state, boolean increasing) {
+ return Action.CONTINUE;
+ }
+ public T g(FieldODEStateAndDerivative<T> state) {
+ T middle = pb.getInitialState().getTime().add(pb.getFinalTime()).multiply(0.5);
+ T offset = state.getTime().subtract(middle);
+ return (offset.getReal() > 0) ? offset.add(0.5) : offset.subtract(0.5);
+ }
+ public FieldODEState<T> resetState(FieldODEStateAndDerivative<T> state) {
+ return state;
+ }
+ }, Double.POSITIVE_INFINITY, 1.0e-8 * maxStep, 3);
+
+ try {
+ integ.integrate(new FieldExpandableODE<T>(pb), pb.getInitialState(), pb.getFinalTime());
+ Assert.fail("an exception should have been thrown");
+ } catch (MaxCountExceededException mcee) {
+ // Expected.
+ }
+
+ }
+
+ @Test
+ public abstract void testSanityChecks();
+
+ protected <T extends RealFieldElement<T>> void doTestSanityChecks(Field<T> field) {
+ TestFieldProblem3<T> pb = new TestFieldProblem3<T>(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(),
+ MathArrays.buildArray(field, 6)),
+ pb.getFinalTime());
+ Assert.fail("an exception should have been thrown");
+ } catch(DimensionMismatchException ie) {
+ }
+ try {
+ EmbeddedRungeKuttaFieldIntegrator<T> integrator =
+ 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());
+ Assert.fail("an exception should have been thrown");
+ } catch(DimensionMismatchException ie) {
+ }
+ 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), pb.getInitialState(), pb.getInitialState().getTime());
+ Assert.fail("an exception should have been thrown");
+ } catch(NumberIsTooSmallException ie) {
+ }
+ }
+
+ @Test
+ public abstract void testBackward();
+
+ protected <T extends RealFieldElement<T>> void doTestBackward(Field<T> field,
+ final double epsilonLast,
+ final double epsilonMaxValue,
+ final double epsilonMaxTime,
+ final String name)
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
+
+ TestFieldProblem5<T> pb = new TestFieldProblem5<T>(field);
+ double minStep = 0;
+ double maxStep = pb.getFinalTime().subtract(pb.getInitialState().getTime()).abs().getReal();
+ double scalAbsoluteTolerance = 1.0e-8;
+ double scalRelativeTolerance = 0.01 * scalAbsoluteTolerance;
+
+ EmbeddedRungeKuttaFieldIntegrator<T> integ = createIntegrator(field, minStep, maxStep,
+ scalAbsoluteTolerance,
+ scalRelativeTolerance);
+ TestFieldProblemHandler<T> handler = new TestFieldProblemHandler<T>(pb, integ);
+ integ.addStepHandler(handler);
+ integ.integrate(new FieldExpandableODE<T>(pb), pb.getInitialState(), pb.getFinalTime());
+
+ Assert.assertEquals(0, handler.getLastError().getReal(), epsilonLast);
+ Assert.assertEquals(0, handler.getMaximalValueError().getReal(), epsilonMaxValue);
+ Assert.assertEquals(0, handler.getMaximalTimeError().getReal(), epsilonMaxTime);
+ Assert.assertEquals(name, integ.getName());
+
+ }
+
+ @Test
+ public abstract void testKepler();
+
+ 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));
+ 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 };
+ double[] vecRelativeTolerance = { 1.0e-10, 1.0e-10, 1.0e-8, 1.0e-8 };
+
+ 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());
+ }
+
+ private static class KeplerHandler<T extends RealFieldElement<T>> implements FieldStepHandler<T> {
+ private T maxError;
+ private final TestFieldProblem3<T> pb;
+ private final double epsilon;
+ public KeplerHandler(TestFieldProblem3<T> pb, double epsilon) {
+ this.pb = pb;
+ this.epsilon = epsilon;
+ maxError = pb.getField().getZero();
+ }
+ public void init(FieldODEStateAndDerivative<T> state0, T t) {
+ maxError = pb.getField().getZero();
+ }
+ public void handleStep(FieldStepInterpolator<T> interpolator, boolean isLast)
+ throws MaxCountExceededException {
+
+ FieldODEStateAndDerivative<T> current = interpolator.getCurrentState();
+ T[] theoreticalY = pb.computeTheoreticalState(current.getTime());
+ T dx = current.getState()[0].subtract(theoreticalY[0]);
+ T dy = current.getState()[1].subtract(theoreticalY[1]);
+ T error = dx.multiply(dx).add(dy.multiply(dy));
+ if (error.subtract(maxError).getReal() > 0) {
+ maxError = error;
+ }
+ if (isLast) {
+ Assert.assertEquals(0.0, maxError.getReal(), epsilon);
+ }
+ }
+ }
+
+ @Test
+ public abstract void testPartialDerivatives();
+
+ protected void doTestPartialDerivatives(final double epsilonY,
+ final double[] epsilonPartials) {
+
+ // parameters indices
+ final int parameters = 5;
+ final int order = 1;
+ final int parOmega = 0;
+ final int parTO = 1;
+ final int parY00 = 2;
+ final int parY01 = 3;
+ final int parT = 4;
+
+ DerivativeStructure omega = new DerivativeStructure(parameters, order, parOmega, 1.3);
+ DerivativeStructure t0 = new DerivativeStructure(parameters, order, parTO, 1.3);
+ DerivativeStructure[] y0 = new DerivativeStructure[] {
+ new DerivativeStructure(parameters, order, parY00, 3.0),
+ new DerivativeStructure(parameters, order, parY01, 4.0)
+ };
+ DerivativeStructure t = new DerivativeStructure(parameters, order, parT, 6.0);
+ SinCos sinCos = new SinCos(omega);
+
+ EmbeddedRungeKuttaFieldIntegrator<DerivativeStructure> integrator =
+ createIntegrator(omega.getField(),
+ 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),
+ t);
+
+ // check values
+ for (int i = 0; i < sinCos.getDimension(); ++i) {
+ Assert.assertEquals(sinCos.theoreticalY(t.getReal())[i], result.getState()[i].getValue(), epsilonY);
+ }
+
+ // check derivatives
+ final double[][] derivatives = sinCos.getDerivatives(t.getReal());
+ for (int i = 0; i < sinCos.getDimension(); ++i) {
+ for (int parameter = 0; parameter < parameters; ++parameter) {
+ Assert.assertEquals(derivatives[i][parameter], dYdP(result.getState()[i], parameter), epsilonPartials[parameter]);
+ }
+ }
+
+ }
+
+ private double dYdP(final DerivativeStructure y, final int parameter) {
+ int[] orders = new int[y.getFreeParameters()];
+ orders[parameter] = 1;
+ return y.getPartialDerivative(orders);
+ }
+
+ private static class SinCos implements FirstOrderFieldDifferentialEquations<DerivativeStructure> {
+
+ private final DerivativeStructure omega;
+ private DerivativeStructure r;
+ private DerivativeStructure alpha;
+
+ private double dRdY00;
+ private double dRdY01;
+ private double dAlphadOmega;
+ private double dAlphadT0;
+ private double dAlphadY00;
+ private double dAlphadY01;
+
+ protected SinCos(final DerivativeStructure omega) {
+ this.omega = omega;
+ }
+
+ public int getDimension() {
+ return 2;
+ }
+
+ public void init(final DerivativeStructure t0, final DerivativeStructure[] y0,
+ final DerivativeStructure finalTime) {
+
+ // theoretical solution is y(t) = { r * sin(omega * t + alpha), r * cos(omega * t + alpha) }
+ // so we retrieve alpha by identification from the initial state
+ final DerivativeStructure r2 = y0[0].multiply(y0[0]).add(y0[1].multiply(y0[1]));
+
+ this.r = r2.sqrt();
+ this.dRdY00 = y0[0].divide(r).getReal();
+ this.dRdY01 = y0[1].divide(r).getReal();
+
+ this.alpha = y0[0].atan2(y0[1]).subtract(t0.multiply(omega));
+ this.dAlphadOmega = -t0.getReal();
+ this.dAlphadT0 = -omega.getReal();
+ this.dAlphadY00 = y0[1].divide(r2).getReal();
+ this.dAlphadY01 = y0[0].negate().divide(r2).getReal();
+
+ }
+
+ public DerivativeStructure[] computeDerivatives(final DerivativeStructure t, final DerivativeStructure[] y) {
+ return new DerivativeStructure[] {
+ omega.multiply(y[1]),
+ omega.multiply(y[0]).negate()
+ };
+ }
+
+ public double[] theoreticalY(final double t) {
+ final double theta = omega.getReal() * t + alpha.getReal();
+ return new double[] {
+ r.getReal() * FastMath.sin(theta), r.getReal() * FastMath.cos(theta)
+ };
+ }
+
+ public double[][] getDerivatives(final double t) {
+
+ // intermediate angle and state
+ final double theta = omega.getReal() * t + alpha.getReal();
+ final double sin = FastMath.sin(theta);
+ final double cos = FastMath.cos(theta);
+ final double y0 = r.getReal() * sin;
+ final double y1 = r.getReal() * cos;
+
+ // partial derivatives of the state first component
+ final double dY0dOmega = y1 * (t + dAlphadOmega);
+ final double dY0dT0 = y1 * dAlphadT0;
+ final double dY0dY00 = dRdY00 * sin + y1 * dAlphadY00;
+ final double dY0dY01 = dRdY01 * sin + y1 * dAlphadY01;
+ final double dY0dT = y1 * omega.getReal();
+
+ // partial derivatives of the state second component
+ final double dY1dOmega = - y0 * (t + dAlphadOmega);
+ final double dY1dT0 = - y0 * dAlphadT0;
+ final double dY1dY00 = dRdY00 * cos - y0 * dAlphadY00;
+ final double dY1dY01 = dRdY01 * cos - y0 * dAlphadY01;
+ final double dY1dT = - y0 * omega.getReal();
+
+ return new double[][] {
+ { dY0dOmega, dY0dT0, dY0dY00, dY0dY01, dY0dT },
+ { dY1dOmega, dY1dT0, dY1dY00, dY1dY01, dY1dT }
+ };
+
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/29649959/src/test/java/org/apache/commons/math3/ode/nonstiff/EulerFieldIntegratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ode/nonstiff/EulerFieldIntegratorTest.java b/src/test/java/org/apache/commons/math3/ode/nonstiff/EulerFieldIntegratorTest.java
index b3a8488..68b66f8 100644
--- a/src/test/java/org/apache/commons/math3/ode/nonstiff/EulerFieldIntegratorTest.java
+++ b/src/test/java/org/apache/commons/math3/ode/nonstiff/EulerFieldIntegratorTest.java
@@ -22,7 +22,7 @@ import org.apache.commons.math3.Field;
import org.apache.commons.math3.RealFieldElement;
import org.apache.commons.math3.util.Decimal64Field;
-public class EulerFieldIntegratorTest extends AbstractRungeKuttaFieldIntegratorTest {
+public class EulerFieldIntegratorTest extends RungeKuttaFieldIntegratorAbstractTest {
@Override
protected <T extends RealFieldElement<T>> RungeKuttaFieldIntegrator<T>
http://git-wip-us.apache.org/repos/asf/commons-math/blob/29649959/src/test/java/org/apache/commons/math3/ode/nonstiff/EulerFieldStepInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ode/nonstiff/EulerFieldStepInterpolatorTest.java b/src/test/java/org/apache/commons/math3/ode/nonstiff/EulerFieldStepInterpolatorTest.java
index 2725d91..bc93b4b 100644
--- a/src/test/java/org/apache/commons/math3/ode/nonstiff/EulerFieldStepInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math3/ode/nonstiff/EulerFieldStepInterpolatorTest.java
@@ -25,7 +25,7 @@ import org.apache.commons.math3.ode.FieldODEStateAndDerivative;
import org.apache.commons.math3.util.Decimal64Field;
import org.junit.Test;
-public class EulerFieldStepInterpolatorTest extends AbstractRungeKuttaFieldStepInterpolatorTest {
+public class EulerFieldStepInterpolatorTest extends RungeKuttaFieldStepInterpolatorAbstractTest {
protected <T extends RealFieldElement<T>> RungeKuttaFieldStepInterpolator<T>
createInterpolator(Field<T> field, boolean forward, T[][] yDotK,
http://git-wip-us.apache.org/repos/asf/commons-math/blob/29649959/src/test/java/org/apache/commons/math3/ode/nonstiff/GillFieldIntegratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ode/nonstiff/GillFieldIntegratorTest.java b/src/test/java/org/apache/commons/math3/ode/nonstiff/GillFieldIntegratorTest.java
index 943703a..9f9935b 100644
--- a/src/test/java/org/apache/commons/math3/ode/nonstiff/GillFieldIntegratorTest.java
+++ b/src/test/java/org/apache/commons/math3/ode/nonstiff/GillFieldIntegratorTest.java
@@ -22,7 +22,7 @@ import org.apache.commons.math3.Field;
import org.apache.commons.math3.RealFieldElement;
import org.apache.commons.math3.util.Decimal64Field;
-public class GillFieldIntegratorTest extends AbstractRungeKuttaFieldIntegratorTest {
+public class GillFieldIntegratorTest extends RungeKuttaFieldIntegratorAbstractTest {
protected <T extends RealFieldElement<T>> RungeKuttaFieldIntegrator<T>
createIntegrator(Field<T> field, T step) {
http://git-wip-us.apache.org/repos/asf/commons-math/blob/29649959/src/test/java/org/apache/commons/math3/ode/nonstiff/GillFieldStepInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ode/nonstiff/GillFieldStepInterpolatorTest.java b/src/test/java/org/apache/commons/math3/ode/nonstiff/GillFieldStepInterpolatorTest.java
index 446a3e4..78e9e6d 100644
--- a/src/test/java/org/apache/commons/math3/ode/nonstiff/GillFieldStepInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math3/ode/nonstiff/GillFieldStepInterpolatorTest.java
@@ -25,7 +25,7 @@ import org.apache.commons.math3.ode.FieldODEStateAndDerivative;
import org.apache.commons.math3.util.Decimal64Field;
import org.junit.Test;
-public class GillFieldStepInterpolatorTest extends AbstractRungeKuttaFieldStepInterpolatorTest {
+public class GillFieldStepInterpolatorTest extends RungeKuttaFieldStepInterpolatorAbstractTest {
protected <T extends RealFieldElement<T>> RungeKuttaFieldStepInterpolator<T>
createInterpolator(Field<T> field, boolean forward, T[][] yDotK,
http://git-wip-us.apache.org/repos/asf/commons-math/blob/29649959/src/test/java/org/apache/commons/math3/ode/nonstiff/HighamHall54FieldIntegratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ode/nonstiff/HighamHall54FieldIntegratorTest.java b/src/test/java/org/apache/commons/math3/ode/nonstiff/HighamHall54FieldIntegratorTest.java
index 3069bd0..19dc348 100644
--- a/src/test/java/org/apache/commons/math3/ode/nonstiff/HighamHall54FieldIntegratorTest.java
+++ b/src/test/java/org/apache/commons/math3/ode/nonstiff/HighamHall54FieldIntegratorTest.java
@@ -22,7 +22,7 @@ import org.apache.commons.math3.Field;
import org.apache.commons.math3.RealFieldElement;
import org.apache.commons.math3.util.Decimal64Field;
-public class HighamHall54FieldIntegratorTest extends AbstractEmbeddedRungeKuttaFieldIntegratorTest {
+public class HighamHall54FieldIntegratorTest extends EmbeddedRungeKuttaFieldIntegratorAbstractTest {
protected <T extends RealFieldElement<T>> EmbeddedRungeKuttaFieldIntegrator<T>
createIntegrator(Field<T> field, final double minStep, final double maxStep,
http://git-wip-us.apache.org/repos/asf/commons-math/blob/29649959/src/test/java/org/apache/commons/math3/ode/nonstiff/HighamHall54FieldStepInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ode/nonstiff/HighamHall54FieldStepInterpolatorTest.java b/src/test/java/org/apache/commons/math3/ode/nonstiff/HighamHall54FieldStepInterpolatorTest.java
index 2487c26..df3ab48 100644
--- a/src/test/java/org/apache/commons/math3/ode/nonstiff/HighamHall54FieldStepInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math3/ode/nonstiff/HighamHall54FieldStepInterpolatorTest.java
@@ -25,7 +25,7 @@ import org.apache.commons.math3.ode.FieldODEStateAndDerivative;
import org.apache.commons.math3.util.Decimal64Field;
import org.junit.Test;
-public class HighamHall54FieldStepInterpolatorTest extends AbstractRungeKuttaFieldStepInterpolatorTest {
+public class HighamHall54FieldStepInterpolatorTest extends RungeKuttaFieldStepInterpolatorAbstractTest {
protected <T extends RealFieldElement<T>> RungeKuttaFieldStepInterpolator<T>
createInterpolator(Field<T> field, boolean forward, T[][] yDotK,
http://git-wip-us.apache.org/repos/asf/commons-math/blob/29649959/src/test/java/org/apache/commons/math3/ode/nonstiff/LutherFieldIntegratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ode/nonstiff/LutherFieldIntegratorTest.java b/src/test/java/org/apache/commons/math3/ode/nonstiff/LutherFieldIntegratorTest.java
index 2307280..f6599bb 100644
--- a/src/test/java/org/apache/commons/math3/ode/nonstiff/LutherFieldIntegratorTest.java
+++ b/src/test/java/org/apache/commons/math3/ode/nonstiff/LutherFieldIntegratorTest.java
@@ -26,7 +26,7 @@ import org.apache.commons.math3.exception.NoBracketingException;
import org.apache.commons.math3.exception.NumberIsTooSmallException;
import org.apache.commons.math3.util.Decimal64Field;
-public class LutherFieldIntegratorTest extends AbstractRungeKuttaFieldIntegratorTest {
+public class LutherFieldIntegratorTest extends RungeKuttaFieldIntegratorAbstractTest {
protected <T extends RealFieldElement<T>> RungeKuttaFieldIntegrator<T>
createIntegrator(Field<T> field, T step) {
http://git-wip-us.apache.org/repos/asf/commons-math/blob/29649959/src/test/java/org/apache/commons/math3/ode/nonstiff/LutherFieldStepInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ode/nonstiff/LutherFieldStepInterpolatorTest.java b/src/test/java/org/apache/commons/math3/ode/nonstiff/LutherFieldStepInterpolatorTest.java
index f7ad829..4d4c418 100644
--- a/src/test/java/org/apache/commons/math3/ode/nonstiff/LutherFieldStepInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math3/ode/nonstiff/LutherFieldStepInterpolatorTest.java
@@ -25,7 +25,7 @@ import org.apache.commons.math3.ode.FieldODEStateAndDerivative;
import org.apache.commons.math3.util.Decimal64Field;
import org.junit.Test;
-public class LutherFieldStepInterpolatorTest extends AbstractRungeKuttaFieldStepInterpolatorTest {
+public class LutherFieldStepInterpolatorTest extends RungeKuttaFieldStepInterpolatorAbstractTest {
protected <T extends RealFieldElement<T>> RungeKuttaFieldStepInterpolator<T>
createInterpolator(Field<T> field, boolean forward, T[][] yDotK,
http://git-wip-us.apache.org/repos/asf/commons-math/blob/29649959/src/test/java/org/apache/commons/math3/ode/nonstiff/MidpointFieldIntegratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ode/nonstiff/MidpointFieldIntegratorTest.java b/src/test/java/org/apache/commons/math3/ode/nonstiff/MidpointFieldIntegratorTest.java
index 3a6b02c..e8c6805 100644
--- a/src/test/java/org/apache/commons/math3/ode/nonstiff/MidpointFieldIntegratorTest.java
+++ b/src/test/java/org/apache/commons/math3/ode/nonstiff/MidpointFieldIntegratorTest.java
@@ -22,7 +22,7 @@ import org.apache.commons.math3.Field;
import org.apache.commons.math3.RealFieldElement;
import org.apache.commons.math3.util.Decimal64Field;
-public class MidpointFieldIntegratorTest extends AbstractRungeKuttaFieldIntegratorTest {
+public class MidpointFieldIntegratorTest extends RungeKuttaFieldIntegratorAbstractTest {
protected <T extends RealFieldElement<T>> RungeKuttaFieldIntegrator<T>
createIntegrator(Field<T> field, T step) {
http://git-wip-us.apache.org/repos/asf/commons-math/blob/29649959/src/test/java/org/apache/commons/math3/ode/nonstiff/MidpointFieldStepInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ode/nonstiff/MidpointFieldStepInterpolatorTest.java b/src/test/java/org/apache/commons/math3/ode/nonstiff/MidpointFieldStepInterpolatorTest.java
index 6640045..b3de00e 100644
--- a/src/test/java/org/apache/commons/math3/ode/nonstiff/MidpointFieldStepInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math3/ode/nonstiff/MidpointFieldStepInterpolatorTest.java
@@ -25,7 +25,7 @@ import org.apache.commons.math3.ode.FieldODEStateAndDerivative;
import org.apache.commons.math3.util.Decimal64Field;
import org.junit.Test;
-public class MidpointFieldStepInterpolatorTest extends AbstractRungeKuttaFieldStepInterpolatorTest {
+public class MidpointFieldStepInterpolatorTest extends RungeKuttaFieldStepInterpolatorAbstractTest {
protected <T extends RealFieldElement<T>> RungeKuttaFieldStepInterpolator<T>
createInterpolator(Field<T> field, boolean forward, T[][] yDotK,