commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject [6/8] [math] Added tests for the Higham-Hall 5(4) integrator.
Date Tue, 08 Dec 2015 19:34:11 GMT
Added tests for the Higham-Hall 5(4) integrator.

Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/8f1c2d6a
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/8f1c2d6a
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/8f1c2d6a

Branch: refs/heads/field-ode
Commit: 8f1c2d6a5c236e908c4d7ac490847c84113a6427
Parents: a3d1099
Author: Luc Maisonobe <luc@apache.org>
Authored: Tue Dec 8 20:26:54 2015 +0100
Committer: Luc Maisonobe <luc@apache.org>
Committed: Tue Dec 8 20:26:54 2015 +0100

----------------------------------------------------------------------
 .../HighamHall54FieldIntegratorTest.java        | 93 ++++++++++++++++++++
 .../HighamHall54FieldStepInterpolatorTest.java  | 49 +++++++++++
 2 files changed, 142 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/8f1c2d6a/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
new file mode 100644
index 0000000..9ac49f4
--- /dev/null
+++ b/src/test/java/org/apache/commons/math3/ode/nonstiff/HighamHall54FieldIntegratorTest.java
@@ -0,0 +1,93 @@
+/*
+ * 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.util.Decimal64Field;
+import org.junit.Test;
+
+public class HighamHall54FieldIntegratorTest extends AbstractEmbeddedRungeKuttaFieldIntegratorTest
{
+
+    protected <T extends RealFieldElement<T>> EmbeddedRungeKuttaFieldIntegrator<T>
+    createIntegrator(Field<T> field, final double minStep, final double maxStep,
+                     final double scalAbsoluteTolerance, final double scalRelativeTolerance)
{
+        return new HighamHall54FieldIntegrator<T>(field, minStep, maxStep, scalAbsoluteTolerance,
scalRelativeTolerance);
+    }
+
+    protected <T extends RealFieldElement<T>> EmbeddedRungeKuttaFieldIntegrator<T>
+    createIntegrator(Field<T> field, final double minStep, final double maxStep,
+                     final double[] vecAbsoluteTolerance, final double[] vecRelativeTolerance)
{
+        return new HighamHall54FieldIntegrator<T>(field, minStep, maxStep, vecAbsoluteTolerance,
vecRelativeTolerance);
+    }
+
+    @Test
+    public void testNonFieldIntegratorConsistency() {
+        doTestNonFieldIntegratorConsistency(Decimal64Field.getInstance());
+    }
+
+    @Test
+    public void testSanityChecks() {
+        doTestSanityChecks(Decimal64Field.getInstance());
+    }
+
+    @Test
+    public void testBackward() {
+        doTestBackward(Decimal64Field.getInstance(), 5.0e-7, 5.0e-7, 1.0e-12, "Higham-Hall
5(4)");
+    }
+
+    @Test
+    public void testKepler() {
+        doTestKepler(Decimal64Field.getInstance(), 1.5e-4);
+    }
+
+    @Override
+    public void testForwardBackwardExceptions() {
+        doTestForwardBackwardExceptions(Decimal64Field.getInstance());
+    }
+
+    @Override
+    public void testMinStep() {
+        doTestMinStep(Decimal64Field.getInstance());
+    }
+
+    @Override
+    public void testIncreasingTolerance() {
+        // the 1.3 factor is only valid for this test
+        // and has been obtained from trial and error
+        // there is no general relation between local and global errors
+        doTestIncreasingTolerance(Decimal64Field.getInstance(), 1.3, 1.0e-12);
+    }
+
+    @Override
+    public void testEvents() {
+        doTestEvents(Decimal64Field.getInstance(), 1.0e-7, "Higham-Hall 5(4)");
+    }
+
+    @Override
+    public void testEventsErrors() {
+        doTestEventsErrors(Decimal64Field.getInstance());
+    }
+
+    @Override
+    public void testEventsNoConvergence() {
+        doTestEventsNoConvergence(Decimal64Field.getInstance());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/8f1c2d6a/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
new file mode 100644
index 0000000..e66cf48
--- /dev/null
+++ b/src/test/java/org/apache/commons/math3/ode/nonstiff/HighamHall54FieldStepInterpolatorTest.java
@@ -0,0 +1,49 @@
+/*
+ * 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.FieldEquationsMapper;
+import org.apache.commons.math3.util.Decimal64Field;
+import org.junit.Test;
+
+public class HighamHall54FieldStepInterpolatorTest extends AbstractRungeKuttaFieldStepInterpolatorTest
{
+
+    protected <T extends RealFieldElement<T>> RungeKuttaFieldStepInterpolator<T>
+    createInterpolator(Field<T> field, boolean forward, FieldEquationsMapper<T>
mapper) {
+        return new HighamHall54FieldStepInterpolator<T>(field, forward, mapper);
+    }
+
+    @Test
+    public void interpolationAtBounds() {
+        doInterpolationAtBounds(Decimal64Field.getInstance(), 4.9e-16);
+    }
+
+    @Test
+    public void interpolationInside() {
+        doInterpolationInside(Decimal64Field.getInstance(), 4.0e-13, 2.7e-15);
+    }
+
+    @Test
+    public void nonFieldInterpolatorConsistency() {
+        doNonFieldInterpolatorConsistency(Decimal64Field.getInstance(), 1.4e-17, 1.0e-50,
1.0e-50, 1.0e-50);
+    }
+
+}


Mime
View raw message