commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r790374 - /commons/proper/math/trunk/src/java/org/apache/commons/math/ode/nonstiff/AdamsNordsieckTransformer.java
Date Wed, 01 Jul 2009 20:57:20 GMT
Author: luc
Date: Wed Jul  1 20:57:20 2009
New Revision: 790374

URL: http://svn.apache.org/viewvc?rev=790374&view=rev
Log:
optimized matrix update loop

Modified:
    commons/proper/math/trunk/src/java/org/apache/commons/math/ode/nonstiff/AdamsNordsieckTransformer.java

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/ode/nonstiff/AdamsNordsieckTransformer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/ode/nonstiff/AdamsNordsieckTransformer.java?rev=790374&r1=790373&r2=790374&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/ode/nonstiff/AdamsNordsieckTransformer.java
(original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/ode/nonstiff/AdamsNordsieckTransformer.java
Wed Jul  1 20:57:20 2009
@@ -25,13 +25,10 @@
 import org.apache.commons.math.linear.Array2DRowFieldMatrix;
 import org.apache.commons.math.linear.Array2DRowRealMatrix;
 import org.apache.commons.math.linear.DefaultFieldMatrixChangingVisitor;
-import org.apache.commons.math.linear.DefaultRealMatrixChangingVisitor;
 import org.apache.commons.math.linear.FieldDecompositionSolver;
 import org.apache.commons.math.linear.FieldLUDecompositionImpl;
 import org.apache.commons.math.linear.FieldMatrix;
 import org.apache.commons.math.linear.MatrixUtils;
-import org.apache.commons.math.linear.MatrixVisitorException;
-import org.apache.commons.math.linear.RealMatrix;
 
 /** Transformer to Nordsieck vectors for Adams integrators.
  * <p>This class i used by {@link AdamsBashforthIntegrator Adams-Bashforth} and
@@ -301,15 +298,15 @@
      */
     public void updateHighOrderDerivativesPhase2(final double[] start,
                                                  final double[] end,
-                                                 final RealMatrix highOrder) {
-        highOrder.walkInOptimizedOrder(new DefaultRealMatrixChangingVisitor() {
-            /** {@inheritDoc} */
-            @Override
-            public double visit(int row, int column, double value)
-                throws MatrixVisitorException {
-                return value + c1[row] * (start[column] - end[column]);
+                                                 final Array2DRowRealMatrix highOrder) {
+        final double[][] data = highOrder.getDataRef();
+        for (int i = 0; i < data.length; ++i) {
+            final double[] dataI = data[i];
+            final double c1I = c1[i];
+            for (int j = 0; j < dataI.length; ++j) {
+                dataI[j] += c1I * (start[j] - end[j]);
             }
-        });
+        }
     }
 
 }



Mime
View raw message