diff --git a/src/main/java/org/apache/commons/math/optimization/general/AbstractLeastSquaresOptimizer.java b/src/main/java/org/apache/commons/math/optimization/general/AbstractLeastSquaresOptimizer.java index b4f5e0700..e9ab30209 100644 --- a/src/main/java/org/apache/commons/math/optimization/general/AbstractLeastSquaresOptimizer.java +++ b/src/main/java/org/apache/commons/math/optimization/general/AbstractLeastSquaresOptimizer.java @@ -134,12 +134,10 @@ public abstract class AbstractLeastSquaresOptimizer final double[] residualsWeights = getWeightRef(); cost = 0; - int index = 0; for (int i = 0; i < rows; i++) { final double residual = targetValues[i] - objective[i]; weightedResiduals[i]= residual*FastMath.sqrt(residualsWeights[i]); cost += residualsWeights[i] * residual * residual; - index += cols; } cost = FastMath.sqrt(cost); }