commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r701852 - /commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/linear/TriDiagonalTransformer.java
Date Sun, 05 Oct 2008 19:12:05 GMT
Author: luc
Date: Sun Oct  5 12:12:05 2008
New Revision: 701852

URL: http://svn.apache.org/viewvc?rev=701852&view=rev
Log:
removed unneeded multiplications by zero by separating
the first iteration from the following ones in a loop

Modified:
    commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/linear/TriDiagonalTransformer.java

Modified: commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/linear/TriDiagonalTransformer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/linear/TriDiagonalTransformer.java?rev=701852&r1=701851&r2=701852&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/linear/TriDiagonalTransformer.java
(original)
+++ commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/linear/TriDiagonalTransformer.java
Sun Oct  5 12:12:05 2008
@@ -114,9 +114,15 @@
                 final double inv = 1.0 / (secondary[k - 1] * hK[k]);
                 qtData[k][k] = 1;
                 if (hK[k] != 0.0) {
-                    for (int j = k; j < m; ++j) {
+                    final double[] qtK = qtData[k];
+                    double beta = 1.0 / secondary[k - 1];
+                    qtK[k] = 1 + beta * hK[k];
+                    for (int i = k + 1; i < m; ++i) {
+                        qtK[i] = beta * hK[i];
+                    }
+                    for (int j = k + 1; j < m; ++j) {
                         final double[] qtJ = qtData[j];
-                        double beta = 0;
+                        beta = 0;
                         for (int i = k; i < m; ++i) {
                             beta += qtJ[i] * hK[i];
                         }



Mime
View raw message