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 2009/06/20 20:09:17 UTC
svn commit: r786874 -
/commons/proper/math/trunk/src/java/org/apache/commons/math/ode/nonstiff/EmbeddedRungeKuttaIntegrator.java
Author: luc
Date: Sat Jun 20 18:09:16 2009
New Revision: 786874
URL: http://svn.apache.org/viewvc?rev=786874&view=rev
Log:
simplified arrays allocation and copying
Modified:
commons/proper/math/trunk/src/java/org/apache/commons/math/ode/nonstiff/EmbeddedRungeKuttaIntegrator.java
Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/ode/nonstiff/EmbeddedRungeKuttaIntegrator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/ode/nonstiff/EmbeddedRungeKuttaIntegrator.java?rev=786874&r1=786873&r2=786874&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/ode/nonstiff/EmbeddedRungeKuttaIntegrator.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/ode/nonstiff/EmbeddedRungeKuttaIntegrator.java Sat Jun 20 18:09:16 2009
@@ -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 @@
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 @@
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]);