diff --git a/src/java/org/apache/commons/math/ode/NordsieckTransformer.java b/src/java/org/apache/commons/math/ode/NordsieckTransformer.java index 1280c8a68..004358449 100644 --- a/src/java/org/apache/commons/math/ode/NordsieckTransformer.java +++ b/src/java/org/apache/commons/math/ode/NordsieckTransformer.java @@ -24,6 +24,7 @@ import org.apache.commons.math.fraction.BigFraction; import org.apache.commons.math.linear.DefaultFieldMatrixPreservingVisitor; import org.apache.commons.math.linear.FieldMatrix; import org.apache.commons.math.linear.FieldMatrixImpl; +import org.apache.commons.math.linear.InvalidMatrixException; import org.apache.commons.math.linear.RealMatrix; import org.apache.commons.math.linear.RealMatrixImpl; import org.apache.commons.math.linear.decomposition.FieldDecompositionSolver; @@ -100,15 +101,18 @@ public class NordsieckTransformer implements Serializable { /** * Build a transformer for a specified order. - *
states considered are yk-p, yk-(p+1) ... + *
States considered are yk-p, yk-(p+1) ...
* yk-(q-1) and scaled derivatives considered are
- * h y'k-r, h y'k-(r+1) ... h y'k-(s-1)
+ * h y'k-r, h y'k-(r+1) ... h y'k-(s-1)<\p>
* @param p start state index offset in multistep form
* @param q end state index offset in multistep form
* @param r start state derivative index offset in multistep form
* @param s end state derivative index offset in multistep form
+ * @exception InvalidMatrixException if the selected indices ranges define a
+ * non-invertible transform (this typically happens when p == q)
*/
- public NordsieckTransformer(final int p, final int q, final int r, final int s) {
+ public NordsieckTransformer(final int p, final int q, final int r, final int s)
+ throws InvalidMatrixException {
// from Nordsieck to multistep
final FieldMatrix states considered are yk-p, yk-(p+1) ...
+ * States considered are yk-p, yk-(p+1) ...
* yk-(q-1) and scaled derivatives considered are
* h y'k-r, h y'k-(r+1) ... h y'k-(s-1)
* @param p start state index offset in multistep form
@@ -163,10 +167,10 @@ public class NordsieckTransformer implements Serializable {
for (int l = r; l < s; ++l) {
// handle previous state scaled derivative h y'(k-l)
// the following expressions are direct applications of Taylor series
- // h y'k-1: [ 0 1 -2 3 -4 5 ...]
- // h y'k-2: [ 0 1 -4 6 -8 10 ...]
- // h y'k-3: [ 0 1 -6 9 -12 15 ...]
- // h y'k-4: [ 0 1 -8 12 -16 20 ...]
+ // h y'k-1: [ 0 1 -2 3 -4 5 ...]
+ // h y'k-2: [ 0 1 -4 12 -32 80 ...]
+ // h y'k-3: [ 0 1 -6 27 -108 405 ...]
+ // h y'k-4: [ 0 1 -8 48 -256 1280 ...]
final BigFraction[] row = array[i++];
final BigInteger factor = BigInteger.valueOf(-l);
row[0] = BigFraction.ZERO;