Author: erans
Date: Fri Nov  9 14:57:10 2012
New Revision: 1407478

URL: http://svn.apache.org/viewvc?rev=1407478&view=rev
Log:
MATH-887
Renamed "computeJacobian" to "computeWeightedJacobian" to relect what is
actually done.
Made "setCost" a "protected" method (as it should only be modified according
to the optimum found by the subclass's algorithm (defined in "doOptimize()").

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

Modified: 
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/optimization/general/AbstractLeastSquaresOptimizer.java
URL: 
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/optimization/general/AbstractLeastSquaresOptimizer.java?rev=1407478&r1=1407477&r2=1407478&view=diff
==============================================================================
--- 
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/optimization/general/AbstractLeastSquaresOptimizer.java
 (original)
+++ 
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/optimization/general/AbstractLeastSquaresOptimizer.java
 Fri Nov  9 14:57:10 2012
@@ -73,7 +73,7 @@ public abstract class AbstractLeastSquar
      * in the derived class (the {@link LevenbergMarquardtOptimizer
      * Levenberg-Marquardt optimizer} does this).
      * @deprecated As of 3.1. To be removed in 4.0. Please use
-     * {@link #computeJacobian(double[])} instead.
+     * {@link #computeWeightedJacobian(double[])} instead.
      */
     @Deprecated
     protected double[][] weightedResidualJacobian;
@@ -143,12 +143,12 @@ public abstract class AbstractLeastSquar
      *
      * @throws DimensionMismatchException if the Jacobian dimension does not
      * match problem dimension.
-     * @deprecated As of 3.1. Please use {@link #computeJacobian(double[])}
+     * @deprecated As of 3.1. Please use {@link 
#computeWeightedJacobian(double[])}
      * instead.
      */
     @Deprecated
     protected void updateJacobian() {
-        computeJacobian(point);
+        computeWeightedJacobian(point);
     }
 
     /**
@@ -160,7 +160,7 @@ public abstract class AbstractLeastSquar
      * match problem dimension.
      * @since 3.1
      */
-    protected RealMatrix computeJacobian(double[] params) {
+    protected RealMatrix computeWeightedJacobian(double[] params) {
         ++jacobianEvaluations;
 
         final DerivativeStructure[] dsPoint = new 
DerivativeStructure[params.length];
@@ -269,7 +269,7 @@ public abstract class AbstractLeastSquar
      * @param cost Cost value.
      * @since 3.1
      */
-    public void setCost(double cost) {
+    protected void setCost(double cost) {
         this.cost = cost;
     }
 
@@ -329,7 +329,7 @@ public abstract class AbstractLeastSquar
     public double[][] computeCovariances(double[] params,
                                          double threshold) {
         // Set up the Jacobian.
-        final RealMatrix j = computeJacobian(params);
+        final RealMatrix j = computeWeightedJacobian(params);
 
         // Compute transpose(J)J.
         final RealMatrix jTj = j.transpose().multiply(j);

Modified: 
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/optimization/general/GaussNewtonOptimizer.java
URL: 
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/optimization/general/GaussNewtonOptimizer.java?rev=1407478&r1=1407477&r2=1407478&view=diff
==============================================================================
--- 
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/optimization/general/GaussNewtonOptimizer.java
 (original)
+++ 
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/optimization/general/GaussNewtonOptimizer.java
 Fri Nov  9 14:57:10 2012
@@ -132,7 +132,7 @@ public class GaussNewtonOptimizer extend
             // Value of the objective function at "currentPoint".
             final double[] currentObjective = 
computeObjectiveValue(currentPoint);
             final double[] currentResiduals = 
computeResiduals(currentObjective);
-            final RealMatrix weightedJacobian = computeJacobian(currentPoint);
+            final RealMatrix weightedJacobian = 
computeWeightedJacobian(currentPoint);
             current = new PointVectorValuePair(currentPoint, currentObjective);
 
             // build the linear problem

Modified: 
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/optimization/general/LevenbergMarquardtOptimizer.java
URL: 
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/optimization/general/LevenbergMarquardtOptimizer.java?rev=1407478&r1=1407477&r2=1407478&view=diff
==============================================================================
--- 
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/optimization/general/LevenbergMarquardtOptimizer.java
 (original)
+++ 
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/optimization/general/LevenbergMarquardtOptimizer.java
 Fri Nov  9 14:57:10 2012
@@ -318,7 +318,7 @@ public class LevenbergMarquardtOptimizer
             final PointVectorValuePair previous = current;
 
             // QR decomposition of the jacobian matrix
-            qrDecomposition(computeJacobian(currentPoint));
+            qrDecomposition(computeWeightedJacobian(currentPoint));
 
             weightedResidual = weightMatrixSqrt.operate(currentResiduals);
             for (int i = 0; i < nR; i++) {


Reply via email to