commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject svn commit: r1158937 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizer.java
Date Wed, 17 Aug 2011 22:11:44 GMT
Author: erans
Date: Wed Aug 17 22:11:43 2011
New Revision: 1158937

URL: http://svn.apache.org/viewvc?rev=1158937&view=rev
Log:
MATH-621
Matrix/vector operators.

Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizer.java

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizer.java?rev=1158937&r1=1158936&r2=1158937&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizer.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizer.java
Wed Aug 17 22:11:43 2011
@@ -31,6 +31,7 @@ import org.apache.commons.math.optimizat
 import org.apache.commons.math.optimization.MultivariateRealOptimizer;
 import org.apache.commons.math.optimization.RealPointValuePair;
 import org.apache.commons.math.util.MathUtils;
+import org.apache.commons.math.linear.RealVector;
 import org.apache.commons.math.linear.ArrayRealVector;
 import org.apache.commons.math.linear.Array2DRowRealMatrix;
 
@@ -2334,16 +2335,12 @@ public class BOBYQAOptimizer
                     ih++;
                 }
             }
+            final RealVector tmp = xpt.operate(s).ebeMultiply(pq);
             for (int k = 0; k < npt; k++) {
                 if (pq.getEntry(k) != ZERO) {
-                    temp = ZERO;
-                    for (int j = 0; j < n; j++) {
-                        temp += xpt.getEntry(k, j) * s.getEntry(j);
-                    }
-                    temp *= pq.getEntry(k);
                     for (int i = 0; i < n; i++) {
-                        hs.setEntry(i, hs.getEntry(i) + temp * xpt.getEntry(k, i));
-                    }
+                        hs.setEntry(i, hs.getEntry(i) + tmp.getEntry(k) * xpt.getEntry(k,
i));
+                    } 
                 }
             }
             if (crvmin != ZERO) {



Mime
View raw message