simplified arrays allocation and copying

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@786874 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Luc Maisonobe 2009-06-20 18:09:16 +00:00
parent 1308cc984e
commit 8702a27155
1 changed files with 4 additions and 7 deletions

View File

@ -17,6 +17,8 @@
package org.apache.commons.math.ode.nonstiff;
import java.util.Arrays;
import org.apache.commons.math.ode.DerivativeException;
import org.apache.commons.math.ode.FirstOrderDifferentialEquations;
import org.apache.commons.math.ode.IntegratorException;
@ -177,10 +179,7 @@ public abstract class EmbeddedRungeKuttaIntegrator
if (y != y0) {
System.arraycopy(y0, 0, y, 0, y0.length);
}
final double[][] yDotK = new double[stages][];
for (int i = 0; i < stages; ++i) {
yDotK [i] = new double[y0.length];
}
final double[][] yDotK = new double[stages][y0.length];
final double[] yTmp = new double[y0.length];
// set up an interpolator sharing the integrator arrays
@ -223,9 +222,7 @@ public abstract class EmbeddedRungeKuttaIntegrator
scale = vecAbsoluteTolerance;
} else {
scale = new double[y0.length];
for (int i = 0; i < scale.length; ++i) {
scale[i] = scalAbsoluteTolerance;
}
Arrays.fill(scale, scalAbsoluteTolerance);
}
hNew = initializeStep(equations, forward, getOrder(), scale,
stepStart, y, yDotK[0], yTmp, yDotK[1]);