commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From celes...@apache.org
Subject svn commit: r1164662 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/GaussNewtonOptimizer.java
Date Fri, 02 Sep 2011 18:20:37 GMT
Author: celestin
Date: Fri Sep  2 18:20:37 2011
New Revision: 1164662

URL: http://svn.apache.org/viewvc?rev=1164662&view=rev
Log:
Simplification of the conversion from RealVector to double[].

Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/GaussNewtonOptimizer.java

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/GaussNewtonOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/GaussNewtonOptimizer.java?rev=1164662&r1=1164661&r2=1164662&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/GaussNewtonOptimizer.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/GaussNewtonOptimizer.java
Fri Sep  2 18:20:37 2011
@@ -148,13 +148,7 @@ public class GaussNewtonOptimizer extend
                 DecompositionSolver solver = useLU ?
                         new LUDecompositionImpl(mA).getSolver() :
                         new QRDecompositionImpl(mA).getSolver();
-                final RealVector dummy = solver.solve(new ArrayRealVector(b, false));
-                final double[] dX;
-                if (dummy instanceof ArrayRealVector){
-                    dX = ((ArrayRealVector) dummy).getDataRef();
-                }else{
-                    dX = dummy.getData();
-                }
+                final double[] dX = solver.solve(new ArrayRealVector(b, false)).toArray();
                 // update the estimated parameters
                 for (int i = 0; i < cols; ++i) {
                     point[i] += dX[i];



Mime
View raw message