diff --git a/src/main/java/org/apache/commons/math3/fitting/leastsquares/DenseWeightedEvaluation.java b/src/main/java/org/apache/commons/math3/fitting/leastsquares/DenseWeightedEvaluation.java index d6afa8bd7..b76e3dcac 100644 --- a/src/main/java/org/apache/commons/math3/fitting/leastsquares/DenseWeightedEvaluation.java +++ b/src/main/java/org/apache/commons/math3/fitting/leastsquares/DenseWeightedEvaluation.java @@ -59,11 +59,6 @@ class DenseWeightedEvaluation extends AbstractEvaluation { return this.weightSqrt.operate(this.unweighted.getResiduals()); } - /** {@inheritDoc} */ - public RealVector getValue() { - return this.weightSqrt.operate(unweighted.getValue()); - } - /* delegate */ /** {@inheritDoc} */ diff --git a/src/main/java/org/apache/commons/math3/fitting/leastsquares/LeastSquaresFactory.java b/src/main/java/org/apache/commons/math3/fitting/leastsquares/LeastSquaresFactory.java index 8ec03e7c3..0853d0355 100644 --- a/src/main/java/org/apache/commons/math3/fitting/leastsquares/LeastSquaresFactory.java +++ b/src/main/java/org/apache/commons/math3/fitting/leastsquares/LeastSquaresFactory.java @@ -216,11 +216,11 @@ public class LeastSquaresFactory { iteration, new PointVectorValuePair( previous.getPoint().toArray(), - previous.getValue().toArray(), + previous.getResiduals().toArray(), false), new PointVectorValuePair( current.getPoint().toArray(), - current.getValue().toArray(), + current.getResiduals().toArray(), false) ); } @@ -344,12 +344,10 @@ public class LeastSquaresFactory { /** the point of evaluation */ private final RealVector point; - /** value at point */ - private final RealVector values; /** deriviative at point */ private final RealMatrix jacobian; - /** reference to the observed values */ - private final RealVector target; + /** the computed residuals. */ + private final RealVector residuals; /** * Create an {@link Evaluation} with no weights. @@ -364,15 +362,9 @@ public class LeastSquaresFactory { final RealVector target, final RealVector point) { super(target.getDimension()); - this.values = values; this.jacobian = jacobian; - this.target = target; this.point = point; - } - - /** {@inheritDoc} */ - public RealVector getValue() { - return this.values; + this.residuals = target.subtract(values); } /** {@inheritDoc} */ @@ -387,7 +379,7 @@ public class LeastSquaresFactory { /** {@inheritDoc} */ public RealVector getResiduals() { - return target.subtract(this.getValue()); + return this.residuals; } } diff --git a/src/main/java/org/apache/commons/math3/fitting/leastsquares/LeastSquaresProblem.java b/src/main/java/org/apache/commons/math3/fitting/leastsquares/LeastSquaresProblem.java index 744c6ec12..d3da3d5b7 100644 --- a/src/main/java/org/apache/commons/math3/fitting/leastsquares/LeastSquaresProblem.java +++ b/src/main/java/org/apache/commons/math3/fitting/leastsquares/LeastSquaresProblem.java @@ -118,13 +118,6 @@ public interface LeastSquaresProblem extends OptimizationProblem