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()"). git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1407478 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ca08d0e8b1
commit
3456d2a12a
|
@ -73,7 +73,7 @@ public abstract class AbstractLeastSquaresOptimizer
|
|||
* 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 AbstractLeastSquaresOptimizer
|
|||
*
|
||||
* @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 AbstractLeastSquaresOptimizer
|
|||
* 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 AbstractLeastSquaresOptimizer
|
|||
* @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 AbstractLeastSquaresOptimizer
|
|||
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);
|
||||
|
|
|
@ -132,7 +132,7 @@ public class GaussNewtonOptimizer extends AbstractLeastSquaresOptimizer {
|
|||
// 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
|
||||
|
|
|
@ -318,7 +318,7 @@ public class LevenbergMarquardtOptimizer extends AbstractLeastSquaresOptimizer {
|
|||
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++) {
|
||||
|
|
Loading…
Reference in New Issue