commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject [4/8] [math] Set up a shared interface for Butcher arrays used by integrators.
Date Tue, 08 Dec 2015 19:34:09 GMT
Set up a shared interface for Butcher arrays used by integrators.

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

Branch: refs/heads/field-ode
Commit: b9e3ac55df3a51b1a4de65300ff3a9da38f961fe
Parents: a39a852
Author: Luc Maisonobe <luc@apache.org>
Authored: Tue Dec 8 19:14:20 2015 +0100
Committer: Luc Maisonobe <luc@apache.org>
Committed: Tue Dec 8 19:14:20 2015 +0100

----------------------------------------------------------------------
 .../ClassicalRungeKuttaFieldIntegrator.java     |  6 +--
 .../DormandPrince54FieldIntegrator.java         |  6 +--
 .../DormandPrince853FieldIntegrator.java        |  6 +--
 .../DormandPrince853FieldStepInterpolator.java  |  2 +-
 .../EmbeddedRungeKuttaFieldIntegrator.java      | 18 +-------
 .../ode/nonstiff/EulerFieldIntegrator.java      |  6 +--
 .../ode/nonstiff/FieldButcherArrayProvider.java | 46 ++++++++++++++++++++
 .../math3/ode/nonstiff/GillFieldIntegrator.java |  6 +--
 .../nonstiff/HighamHall54FieldIntegrator.java   |  6 +--
 .../ode/nonstiff/LutherFieldIntegrator.java     |  6 +--
 .../ode/nonstiff/MidpointFieldIntegrator.java   |  6 +--
 .../ode/nonstiff/RungeKuttaFieldIntegrator.java | 18 +-------
 .../nonstiff/ThreeEighthesFieldIntegrator.java  |  6 +--
 ...ractRungeKuttaFieldStepInterpolatorTest.java | 28 ++++++------
 14 files changed, 91 insertions(+), 75 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/b9e3ac55/src/main/java/org/apache/commons/math3/ode/nonstiff/ClassicalRungeKuttaFieldIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/ClassicalRungeKuttaFieldIntegrator.java
b/src/main/java/org/apache/commons/math3/ode/nonstiff/ClassicalRungeKuttaFieldIntegrator.java
index e5116e8..057a39d 100644
--- a/src/main/java/org/apache/commons/math3/ode/nonstiff/ClassicalRungeKuttaFieldIntegrator.java
+++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/ClassicalRungeKuttaFieldIntegrator.java
@@ -62,7 +62,7 @@ public class ClassicalRungeKuttaFieldIntegrator<T extends RealFieldElement<T>>
 
     /** {@inheritDoc} */
     @Override
-    protected T[] getC() {
+    public T[] getC() {
         final T[] c = MathArrays.buildArray(getField(), 3);
         c[0] = getField().getOne().multiply(0.5);
         c[1] = c[0];
@@ -72,7 +72,7 @@ public class ClassicalRungeKuttaFieldIntegrator<T extends RealFieldElement<T>>
 
     /** {@inheritDoc} */
     @Override
-    protected T[][] getA() {
+    public T[][] getA() {
         final T[][] a = MathArrays.buildArray(getField(), 3, -1);
         for (int i = 0; i < a.length; ++i) {
             a[i] = MathArrays.buildArray(getField(), i + 1);
@@ -88,7 +88,7 @@ public class ClassicalRungeKuttaFieldIntegrator<T extends RealFieldElement<T>>
 
     /** {@inheritDoc} */
     @Override
-    protected T[] getB() {
+    public T[] getB() {
         final T[] b = MathArrays.buildArray(getField(), 4);
         b[0] = fraction(1, 6);
         b[1] = fraction(1, 3);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/b9e3ac55/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldIntegrator.java
b/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldIntegrator.java
index 2b01bdb..356c165 100644
--- a/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldIntegrator.java
+++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldIntegrator.java
@@ -130,7 +130,7 @@ public class DormandPrince54FieldIntegrator<T extends RealFieldElement<T>>
 
     /** {@inheritDoc} */
     @Override
-    protected T[] getC() {
+    public T[] getC() {
         final T[] c = MathArrays.buildArray(getField(), 6);
         c[0] = fraction(1,  5);
         c[1] = fraction(3, 10);
@@ -143,7 +143,7 @@ public class DormandPrince54FieldIntegrator<T extends RealFieldElement<T>>
 
     /** {@inheritDoc} */
     @Override
-    protected T[][] getA() {
+    public T[][] getA() {
         final T[][] a = MathArrays.buildArray(getField(), 6, -1);
         for (int i = 0; i < a.length; ++i) {
             a[i] = MathArrays.buildArray(getField(), i + 1);
@@ -174,7 +174,7 @@ public class DormandPrince54FieldIntegrator<T extends RealFieldElement<T>>
 
     /** {@inheritDoc} */
     @Override
-    protected T[] getB() {
+    public T[] getB() {
         final T[] b = MathArrays.buildArray(getField(), 7);
         b[0] = fraction(   35,   384);
         b[1] = getField().getZero();

http://git-wip-us.apache.org/repos/asf/commons-math/blob/b9e3ac55/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldIntegrator.java
b/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldIntegrator.java
index 86b3844..2c872e8 100644
--- a/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldIntegrator.java
+++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldIntegrator.java
@@ -191,7 +191,7 @@ public class DormandPrince853FieldIntegrator<T extends RealFieldElement<T>>
 
     /** {@inheritDoc} */
     @Override
-    protected T[] getC() {
+    public T[] getC() {
 
         final T sqrt6 = getField().getOne().multiply(6).sqrt();
 
@@ -218,7 +218,7 @@ public class DormandPrince853FieldIntegrator<T extends RealFieldElement<T>>
 
     /** {@inheritDoc} */
     @Override
-    protected T[][] getA() {
+    public T[][] getA() {
 
         final T sqrt6 = getField().getOne().multiply(6).sqrt();
 
@@ -371,7 +371,7 @@ public class DormandPrince853FieldIntegrator<T extends RealFieldElement<T>>
 
     /** {@inheritDoc} */
     @Override
-    protected T[] getB() {
+    public T[] getB() {
         final T[] b = MathArrays.buildArray(getField(), 16);
         b[ 0] = fraction(104257, 1929240);
         b[ 1] = getField().getZero();

http://git-wip-us.apache.org/repos/asf/commons-math/blob/b9e3ac55/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldStepInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldStepInterpolator.java
b/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldStepInterpolator.java
index 182d8a6..211f18c 100644
--- a/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldStepInterpolator.java
+++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldStepInterpolator.java
@@ -52,7 +52,7 @@ class DormandPrince853FieldStepInterpolator<T extends RealFieldElement<T>>
         super(field, forward, mapper);
 
         // interpolation weights
-        d = MathArrays.buildArray(getField(), 4, 16);
+        d = MathArrays.buildArray(getField(), 7, 16);
 
         // this row is the same as the b array
         d[0][ 0] = fraction(104257, 1929240);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/b9e3ac55/src/main/java/org/apache/commons/math3/ode/nonstiff/EmbeddedRungeKuttaFieldIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/EmbeddedRungeKuttaFieldIntegrator.java
b/src/main/java/org/apache/commons/math3/ode/nonstiff/EmbeddedRungeKuttaFieldIntegrator.java
index 39a89e1..9a81493 100644
--- a/src/main/java/org/apache/commons/math3/ode/nonstiff/EmbeddedRungeKuttaFieldIntegrator.java
+++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/EmbeddedRungeKuttaFieldIntegrator.java
@@ -68,7 +68,8 @@ import org.apache.commons.math3.util.MathUtils;
  */
 
 public abstract class EmbeddedRungeKuttaFieldIntegrator<T extends RealFieldElement<T>>
-    extends AdaptiveStepsizeFieldIntegrator<T> {
+    extends AdaptiveStepsizeFieldIntegrator<T>
+    implements FieldButcherArrayProvider<T> {
 
     /** Index of the pre-computed derivative for <i>fsal</i> methods. */
     private final int fsal;
@@ -180,21 +181,6 @@ public abstract class EmbeddedRungeKuttaFieldIntegrator<T extends
RealFieldEleme
         return getField().getOne().multiply(p).divide(q);
     }
 
-    /** Get the time steps from Butcher array (without the first zero).
-     * @return time steps from Butcher array (without the first zero
-     */
-    protected abstract T[] getC();
-
-    /** Get the internal weights from Butcher array (without the first empty row).
-     * @return internal weights from Butcher array (without the first empty row)
-     */
-    protected abstract T[][] getA();
-
-    /** Get the external weights for the high order method from Butcher array.
-     * @return external weights for the high order method from Butcher array
-     */
-    protected abstract T[] getB();
-
     /** Create an interpolator.
      * @param forward integration direction indicator
      * @param mapper equations mapper for the all equations

http://git-wip-us.apache.org/repos/asf/commons-math/blob/b9e3ac55/src/main/java/org/apache/commons/math3/ode/nonstiff/EulerFieldIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/EulerFieldIntegrator.java
b/src/main/java/org/apache/commons/math3/ode/nonstiff/EulerFieldIntegrator.java
index 798c0e9..f6ee8ff 100644
--- a/src/main/java/org/apache/commons/math3/ode/nonstiff/EulerFieldIntegrator.java
+++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/EulerFieldIntegrator.java
@@ -64,19 +64,19 @@ public class EulerFieldIntegrator<T extends RealFieldElement<T>>
extends RungeKu
 
     /** {@inheritDoc} */
     @Override
-    protected T[] getC() {
+    public T[] getC() {
         return MathArrays.buildArray(getField(), 0);
     }
 
     /** {@inheritDoc} */
     @Override
-    protected T[][] getA() {
+    public T[][] getA() {
         return MathArrays.buildArray(getField(), 0, 0);
     }
 
     /** {@inheritDoc} */
     @Override
-    protected T[] getB() {
+    public T[] getB() {
         final T[] b = MathArrays.buildArray(getField(), 1);
         b[0] = getField().getOne();
         return b;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/b9e3ac55/src/main/java/org/apache/commons/math3/ode/nonstiff/FieldButcherArrayProvider.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/FieldButcherArrayProvider.java
b/src/main/java/org/apache/commons/math3/ode/nonstiff/FieldButcherArrayProvider.java
new file mode 100644
index 0000000..b37d4cb
--- /dev/null
+++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/FieldButcherArrayProvider.java
@@ -0,0 +1,46 @@
+/*
+ * 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.RealFieldElement;
+
+/** This interface represents an integrator  based on Butcher arrays.
+ * @see RungeKuttaFieldIntegrator
+ * @see EmbeddedRungeKuttaFieldIntegrator
+ * @param <T> the type of the field elements
+ * @since 3.6
+ */
+
+public interface FieldButcherArrayProvider<T extends RealFieldElement<T>> {
+
+    /** Get the time steps from Butcher array (without the first zero).
+     * @return time steps from Butcher array (without the first zero
+     */
+    T[] getC();
+
+    /** Get the internal weights from Butcher array (without the first empty row).
+     * @return internal weights from Butcher array (without the first empty row)
+     */
+    T[][] getA();
+
+    /** Get the external weights for the high order method from Butcher array.
+     * @return external weights for the high order method from Butcher array
+     */
+    T[] getB();
+
+}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/b9e3ac55/src/main/java/org/apache/commons/math3/ode/nonstiff/GillFieldIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/GillFieldIntegrator.java
b/src/main/java/org/apache/commons/math3/ode/nonstiff/GillFieldIntegrator.java
index e627782..4f4868d 100644
--- a/src/main/java/org/apache/commons/math3/ode/nonstiff/GillFieldIntegrator.java
+++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/GillFieldIntegrator.java
@@ -62,7 +62,7 @@ public class GillFieldIntegrator<T extends RealFieldElement<T>>
 
     /** {@inheritDoc} */
     @Override
-    protected T[] getC() {
+    public T[] getC() {
         final T[] c = MathArrays.buildArray(getField(), 3);
         c[0] = fraction(1, 2);
         c[1] = c[0];
@@ -72,7 +72,7 @@ public class GillFieldIntegrator<T extends RealFieldElement<T>>
 
     /** {@inheritDoc} */
     @Override
-    protected T[][] getA() {
+    public T[][] getA() {
 
         final T two     = getField().getZero().add(2);
         final T sqrtTwo = two.sqrt();
@@ -92,7 +92,7 @@ public class GillFieldIntegrator<T extends RealFieldElement<T>>
 
     /** {@inheritDoc} */
     @Override
-    protected T[] getB() {
+    public T[] getB() {
 
         final T two     = getField().getZero().add(2);
         final T sqrtTwo = two.sqrt();

http://git-wip-us.apache.org/repos/asf/commons-math/blob/b9e3ac55/src/main/java/org/apache/commons/math3/ode/nonstiff/HighamHall54FieldIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/HighamHall54FieldIntegrator.java
b/src/main/java/org/apache/commons/math3/ode/nonstiff/HighamHall54FieldIntegrator.java
index 8473892..a186b1d 100644
--- a/src/main/java/org/apache/commons/math3/ode/nonstiff/HighamHall54FieldIntegrator.java
+++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/HighamHall54FieldIntegrator.java
@@ -105,7 +105,7 @@ public class HighamHall54FieldIntegrator<T extends RealFieldElement<T>>
 
     /** {@inheritDoc} */
     @Override
-    protected T[] getC() {
+    public T[] getC() {
         final T[] c = MathArrays.buildArray(getField(), 6);
         c[0] = fraction(2, 9);
         c[1] = fraction(1, 3);
@@ -118,7 +118,7 @@ public class HighamHall54FieldIntegrator<T extends RealFieldElement<T>>
 
     /** {@inheritDoc} */
     @Override
-    protected T[][] getA() {
+    public T[][] getA() {
         final T[][] a = MathArrays.buildArray(getField(), 6, -1);
         for (int i = 0; i < a.length; ++i) {
             a[i] = MathArrays.buildArray(getField(), i + 1);
@@ -149,7 +149,7 @@ public class HighamHall54FieldIntegrator<T extends RealFieldElement<T>>
 
     /** {@inheritDoc} */
     @Override
-    protected T[] getB() {
+    public T[] getB() {
         final T[] b = MathArrays.buildArray(getField(), 7);
         b[0] = fraction(  1, 12);
         b[1] = getField().getZero();

http://git-wip-us.apache.org/repos/asf/commons-math/blob/b9e3ac55/src/main/java/org/apache/commons/math3/ode/nonstiff/LutherFieldIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/LutherFieldIntegrator.java
b/src/main/java/org/apache/commons/math3/ode/nonstiff/LutherFieldIntegrator.java
index d906703..9adb86b 100644
--- a/src/main/java/org/apache/commons/math3/ode/nonstiff/LutherFieldIntegrator.java
+++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/LutherFieldIntegrator.java
@@ -71,7 +71,7 @@ public class LutherFieldIntegrator<T extends RealFieldElement<T>>
 
     /** {@inheritDoc} */
     @Override
-    protected T[] getC() {
+    public T[] getC() {
         final T q = getField().getZero().add(21).sqrt();
         final T[] c = MathArrays.buildArray(getField(), 6);
         c[0] = getField().getOne();
@@ -85,7 +85,7 @@ public class LutherFieldIntegrator<T extends RealFieldElement<T>>
 
     /** {@inheritDoc} */
     @Override
-    protected T[][] getA() {
+    public T[][] getA() {
         final T q = getField().getZero().add(21).sqrt();
         final T[][] a = MathArrays.buildArray(getField(), 6, -1);
         for (int i = 0; i < a.length; ++i) {
@@ -117,7 +117,7 @@ public class LutherFieldIntegrator<T extends RealFieldElement<T>>
 
     /** {@inheritDoc} */
     @Override
-    protected T[] getB() {
+    public T[] getB() {
 
         final T[] b = MathArrays.buildArray(getField(), 7);
         b[0] = fraction( 1,  20);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/b9e3ac55/src/main/java/org/apache/commons/math3/ode/nonstiff/MidpointFieldIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/MidpointFieldIntegrator.java
b/src/main/java/org/apache/commons/math3/ode/nonstiff/MidpointFieldIntegrator.java
index d3a1f2f..9ea1a06 100644
--- a/src/main/java/org/apache/commons/math3/ode/nonstiff/MidpointFieldIntegrator.java
+++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/MidpointFieldIntegrator.java
@@ -59,7 +59,7 @@ public class MidpointFieldIntegrator<T extends RealFieldElement<T>>
extends Rung
 
     /** {@inheritDoc} */
     @Override
-    protected T[] getC() {
+    public T[] getC() {
         final T[] c = MathArrays.buildArray(getField(), 1);
         c[0] = getField().getOne().multiply(0.5);
         return c;
@@ -67,7 +67,7 @@ public class MidpointFieldIntegrator<T extends RealFieldElement<T>>
extends Rung
 
     /** {@inheritDoc} */
     @Override
-    protected T[][] getA() {
+    public T[][] getA() {
         final T[][] a = MathArrays.buildArray(getField(), 1, 1);
         a[0][0] = fraction(1, 2);
         return a;
@@ -75,7 +75,7 @@ public class MidpointFieldIntegrator<T extends RealFieldElement<T>>
extends Rung
 
     /** {@inheritDoc} */
     @Override
-    protected T[] getB() {
+    public T[] getB() {
         final T[] b = MathArrays.buildArray(getField(), 2);
         b[0] = getField().getZero();
         b[1] = getField().getOne();

http://git-wip-us.apache.org/repos/asf/commons-math/blob/b9e3ac55/src/main/java/org/apache/commons/math3/ode/nonstiff/RungeKuttaFieldIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/RungeKuttaFieldIntegrator.java
b/src/main/java/org/apache/commons/math3/ode/nonstiff/RungeKuttaFieldIntegrator.java
index befa525..ed0ed77 100644
--- a/src/main/java/org/apache/commons/math3/ode/nonstiff/RungeKuttaFieldIntegrator.java
+++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/RungeKuttaFieldIntegrator.java
@@ -58,7 +58,8 @@ import org.apache.commons.math3.util.MathArrays;
  */
 
 public abstract class RungeKuttaFieldIntegrator<T extends RealFieldElement<T>>
-    extends AbstractFieldIntegrator<T> {
+    extends AbstractFieldIntegrator<T>
+    implements FieldButcherArrayProvider<T> {
 
     /** Time steps from Butcher array (without the first zero). */
     private final T[] c;
@@ -96,21 +97,6 @@ public abstract class RungeKuttaFieldIntegrator<T extends RealFieldElement<T>>
         return getField().getZero().add(p).divide(q);
     }
 
-    /** Get the time steps from Butcher array (without the first zero).
-     * @return time steps from Butcher array (without the first zero
-     */
-    protected abstract T[] getC();
-
-    /** Get the internal weights from Butcher array (without the first empty row).
-     * @return internal weights from Butcher array (without the first empty row)
-     */
-    protected abstract T[][] getA();
-
-    /** Get the external weights for the high order method from Butcher array.
-     * @return external weights for the high order method from Butcher array
-     */
-    protected abstract T[] getB();
-
     /** Create an interpolator.
      * @param forward integration direction indicator
      * @param mapper equations mapper for the all equations

http://git-wip-us.apache.org/repos/asf/commons-math/blob/b9e3ac55/src/main/java/org/apache/commons/math3/ode/nonstiff/ThreeEighthesFieldIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/ThreeEighthesFieldIntegrator.java
b/src/main/java/org/apache/commons/math3/ode/nonstiff/ThreeEighthesFieldIntegrator.java
index d298ff8..482c7d5 100644
--- a/src/main/java/org/apache/commons/math3/ode/nonstiff/ThreeEighthesFieldIntegrator.java
+++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/ThreeEighthesFieldIntegrator.java
@@ -61,7 +61,7 @@ public class ThreeEighthesFieldIntegrator<T extends RealFieldElement<T>>
 
     /** {@inheritDoc} */
     @Override
-    protected T[] getC() {
+    public T[] getC() {
         final T[] c = MathArrays.buildArray(getField(), 3);
         c[0] = fraction(1, 3);
         c[1] = c[0].add(c[0]);
@@ -71,7 +71,7 @@ public class ThreeEighthesFieldIntegrator<T extends RealFieldElement<T>>
 
     /** {@inheritDoc} */
     @Override
-    protected T[][] getA() {
+    public T[][] getA() {
         final T[][] a = MathArrays.buildArray(getField(), 3, -1);
         for (int i = 0; i < a.length; ++i) {
             a[i] = MathArrays.buildArray(getField(), i + 1);
@@ -87,7 +87,7 @@ public class ThreeEighthesFieldIntegrator<T extends RealFieldElement<T>>
 
     /** {@inheritDoc} */
     @Override
-    protected T[] getB() {
+    public T[] getB() {
         final T[] b = MathArrays.buildArray(getField(), 4);
         b[0] = fraction(1, 8);
         b[1] = fraction(3, 8);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/b9e3ac55/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
index 9f419b9..82e9887 100644
--- a/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractRungeKuttaFieldStepInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractRungeKuttaFieldStepInterpolatorTest.java
@@ -140,10 +140,10 @@ public abstract class AbstractRungeKuttaFieldStepInterpolatorTest {
         RungeKuttaFieldStepInterpolator<T> interpolator = createInterpolator(field,
t1 > t0,
                                                                              new FieldExpandableODE<T>(eqn).getMapper());
         // get the Butcher arrays from the field integrator
-        RungeKuttaFieldIntegrator<T> fieldIntegrator = createFieldIntegrator(field,
interpolator);
-        T[][] a = fieldIntegrator.getA();
-        T[]   b = fieldIntegrator.getB();
-        T[]   c = fieldIntegrator.getC();
+        FieldButcherArrayProvider<T> provider = createButcherArrayProvider(field, interpolator);
+        T[][] a = provider.getA();
+        T[]   b = provider.getB();
+        T[]   c = provider.getC();
 
         // store initial state
         T     t          = field.getZero().add(t0);
@@ -259,25 +259,23 @@ public abstract class AbstractRungeKuttaFieldStepInterpolatorTest {
 
     }
 
-    private <T extends RealFieldElement<T>> RungeKuttaFieldIntegrator<T>
-    createFieldIntegrator(final Field<T> field, final RungeKuttaFieldStepInterpolator<T>
interpolator) {
-        RungeKuttaFieldIntegrator<T> integrator = null;
+    private <T extends RealFieldElement<T>> FieldButcherArrayProvider<T>
+    createButcherArrayProvider(final Field<T> field, final RungeKuttaFieldStepInterpolator<T>
provider) {
+        FieldButcherArrayProvider<T> integrator = null;
         try {
-        String interpolatorName = interpolator.getClass().getName();
+        String interpolatorName = provider.getClass().getName();
         String integratorName = interpolatorName.replaceAll("StepInterpolator", "Integrator");
             @SuppressWarnings("unchecked")
-            Class<RungeKuttaFieldIntegrator<T>> clz = (Class<RungeKuttaFieldIntegrator<T>>)
Class.forName(integratorName);
+            Class<FieldButcherArrayProvider<T>> clz = (Class<FieldButcherArrayProvider<T>>)
Class.forName(integratorName);
             try {
                 integrator = clz.getConstructor(Field.class, RealFieldElement.class).
-                             newInstance(field, field.getOne());
+                                                newInstance(field, field.getOne());
             } catch (NoSuchMethodException nsme) {
                 try {
                     integrator = clz.getConstructor(Field.class,
-                                                    RealFieldElement.class,
-                                                    RealFieldElement.class,
-                                                    RealFieldElement.class).
-                                 newInstance(field, field.getZero().add(0.001),
-                                             field.getOne(), field.getOne(), field.getOne());
+                                                    Double.TYPE, Double.TYPE,
+                                                    Double.TYPE, Double.TYPE).
+                                 newInstance(field, 0.001, 1.0, 1.0, 1.0);
                 } catch (NoSuchMethodException e) {
                     Assert.fail(e.getLocalizedMessage());
                 }


Mime
View raw message