commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject [2/5] [math] Remove deprecated classes in optim package.
Date Sat, 11 Apr 2015 14:06:07 GMT
Remove deprecated classes in optim package.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/0737cf82
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/0737cf82
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/0737cf82

Branch: refs/heads/master
Commit: 0737cf82db33f55cdfcb68e8f02f0b8fed40fa15
Parents: 8a76453
Author: Thomas Neidhart <thomas.neidhart@gmail.com>
Authored: Sat Apr 11 16:04:53 2015 +0200
Committer: Thomas Neidhart <thomas.neidhart@gmail.com>
Committed: Sat Apr 11 16:04:53 2015 +0200

----------------------------------------------------------------------
 .../optim/linear/LinearObjectiveFunction.java   |   1 +
 .../optim/nonlinear/scalar/LineSearch.java      |  17 +-
 .../scalar/MultiStartMultivariateOptimizer.java |   5 +-
 .../MultivariateFunctionMappingAdapter.java     |   1 +
 .../MultivariateFunctionPenaltyAdapter.java     |   1 +
 .../NonLinearConjugateGradientOptimizer.java    |  79 --
 .../scalar/noderiv/SimplexOptimizer.java        |   2 +
 .../JacobianMultivariateVectorOptimizer.java    | 116 ---
 .../optim/nonlinear/vector/ModelFunction.java   |  51 -
 .../nonlinear/vector/ModelFunctionJacobian.java |  51 -
 .../MultiStartMultivariateVectorOptimizer.java  | 122 ---
 .../vector/MultivariateVectorOptimizer.java     | 167 ----
 .../math4/optim/nonlinear/vector/Target.java    |  54 --
 .../math4/optim/nonlinear/vector/Weight.java    |  71 --
 .../jacobian/AbstractLeastSquaresOptimizer.java | 281 ------
 .../vector/jacobian/GaussNewtonOptimizer.java   | 183 ----
 .../jacobian/LevenbergMarquardtOptimizer.java   | 962 -------------------
 .../nonlinear/vector/jacobian/package-info.java |  26 -
 .../optim/nonlinear/vector/package-info.java    |  26 -
 .../MultiStartUnivariateOptimizer.java          |   5 +-
 20 files changed, 20 insertions(+), 2201 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/0737cf82/src/main/java/org/apache/commons/math4/optim/linear/LinearObjectiveFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/linear/LinearObjectiveFunction.java b/src/main/java/org/apache/commons/math4/optim/linear/LinearObjectiveFunction.java
index 7b63872..f47b8cc 100644
--- a/src/main/java/org/apache/commons/math4/optim/linear/LinearObjectiveFunction.java
+++ b/src/main/java/org/apache/commons/math4/optim/linear/LinearObjectiveFunction.java
@@ -92,6 +92,7 @@ public class LinearObjectiveFunction
      * @param point Point at which linear equation must be evaluated.
      * @return the value of the linear equation at the current point.
      */
+    @Override
     public double value(final double[] point) {
         return value(new ArrayRealVector(point, false));
     }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/0737cf82/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/LineSearch.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/LineSearch.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/LineSearch.java
index dae251f..558b98a 100644
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/LineSearch.java
+++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/LineSearch.java
@@ -112,15 +112,16 @@ public class LineSearch {
                                            final double[] direction) {
         final int n = startPoint.length;
         final UnivariateFunction f = new UnivariateFunction() {
-                public double value(double alpha) {
-                    final double[] x = new double[n];
-                    for (int i = 0; i < n; i++) {
-                        x[i] = startPoint[i] + alpha * direction[i];
-                    }
-                    final double obj = mainOptimizer.computeObjectiveValue(x);
-                    return obj;
+            @Override
+            public double value(double alpha) {
+                final double[] x = new double[n];
+                for (int i = 0; i < n; i++) {
+                    x[i] = startPoint[i] + alpha * direction[i];
                 }
-            };
+                final double obj = mainOptimizer.computeObjectiveValue(x);
+                return obj;
+            }
+        };
 
         final GoalType goal = mainOptimizer.getGoalType();
         bracket.search(f, goal, 0, initialBracketingRange);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/0737cf82/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/MultiStartMultivariateOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/MultiStartMultivariateOptimizer.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/MultiStartMultivariateOptimizer.java
index 11ec5df..0bfa63f 100644
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/MultiStartMultivariateOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/MultiStartMultivariateOptimizer.java
@@ -16,10 +16,10 @@
  */
 package org.apache.commons.math4.optim.nonlinear.scalar;
 
-import java.util.Collections;
-import java.util.List;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.Comparator;
+import java.util.List;
 
 import org.apache.commons.math4.exception.NotStrictlyPositiveException;
 import org.apache.commons.math4.exception.NullArgumentException;
@@ -94,6 +94,7 @@ public class MultiStartMultivariateOptimizer
      */
     private Comparator<PointValuePair> getPairComparator() {
         return new Comparator<PointValuePair>() {
+            @Override
             public int compare(final PointValuePair o1,
                                final PointValuePair o2) {
                 if (o1 == null) {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/0737cf82/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/MultivariateFunctionMappingAdapter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/MultivariateFunctionMappingAdapter.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/MultivariateFunctionMappingAdapter.java
index a34f02d..dc01a2f 100644
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/MultivariateFunctionMappingAdapter.java
+++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/MultivariateFunctionMappingAdapter.java
@@ -175,6 +175,7 @@ public class MultivariateFunctionMappingAdapter
      * @return underlying function value
      * @see #unboundedToBounded(double[])
      */
+    @Override
     public double value(double[] point) {
         return bounded.value(unboundedToBounded(point));
     }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/0737cf82/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/MultivariateFunctionPenaltyAdapter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/MultivariateFunctionPenaltyAdapter.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/MultivariateFunctionPenaltyAdapter.java
index 04ca7f5..33bb852 100644
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/MultivariateFunctionPenaltyAdapter.java
+++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/MultivariateFunctionPenaltyAdapter.java
@@ -158,6 +158,7 @@ public class MultivariateFunctionPenaltyAdapter
      * @param point unbounded point
      * @return either underlying function value or penalty function value
      */
+    @Override
     public double value(double[] point) {
 
         for (int i = 0; i < scale.length; ++i) {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/0737cf82/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/gradient/NonLinearConjugateGradientOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/gradient/NonLinearConjugateGradientOptimizer.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/gradient/NonLinearConjugateGradientOptimizer.java
index 078c6ec..8ef98fc 100644
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/gradient/NonLinearConjugateGradientOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/gradient/NonLinearConjugateGradientOptimizer.java
@@ -17,7 +17,6 @@
 
 package org.apache.commons.math4.optim.nonlinear.scalar.gradient;
 
-import org.apache.commons.math4.analysis.solvers.UnivariateSolver;
 import org.apache.commons.math4.exception.MathInternalError;
 import org.apache.commons.math4.exception.MathUnsupportedOperationException;
 import org.apache.commons.math4.exception.TooManyEvaluationsException;
@@ -78,40 +77,6 @@ public class NonLinearConjugateGradientOptimizer
     }
 
     /**
-     * The initial step is a factor with respect to the search direction
-     * (which itself is roughly related to the gradient of the function).
-     * <br/>
-     * It is used to find an interval that brackets the optimum in line
-     * search.
-     *
-     * @since 3.1
-     * @deprecated As of v3.3, this class is not used anymore.
-     * This setting is replaced by the {@code initialBracketingRange}
-     * argument to the new constructors.
-     */
-    @Deprecated
-    public static class BracketingStep implements OptimizationData {
-        /** Initial step. */
-        private final double initialStep;
-
-        /**
-         * @param step Initial step for the bracket search.
-         */
-        public BracketingStep(double step) {
-            initialStep = step;
-        }
-
-        /**
-         * Gets the initial step.
-         *
-         * @return the initial step.
-         */
-        public double getBracketingStep() {
-            return initialStep;
-        }
-    }
-
-    /**
      * Constructor with default tolerances for the line search (1e-8) and
      * {@link IdentityPreconditioner preconditioner}.
      *
@@ -137,27 +102,6 @@ public class NonLinearConjugateGradientOptimizer
      * must be one of {@link Formula#FLETCHER_REEVES} or
      * {@link Formula#POLAK_RIBIERE}.
      * @param checker Convergence checker.
-     * @param lineSearchSolver Solver to use during line search.
-     * @deprecated as of 3.3. Please use
-     * {@link #NonLinearConjugateGradientOptimizer(Formula,ConvergenceChecker,double,double,double)} instead.
-     */
-    @Deprecated
-    public NonLinearConjugateGradientOptimizer(final Formula updateFormula,
-                                               ConvergenceChecker<PointValuePair> checker,
-                                               final UnivariateSolver lineSearchSolver) {
-        this(updateFormula,
-             checker,
-             lineSearchSolver,
-             new IdentityPreconditioner());
-    }
-
-    /**
-     * Constructor with default {@link IdentityPreconditioner preconditioner}.
-     *
-     * @param updateFormula formula to use for updating the &beta; parameter,
-     * must be one of {@link Formula#FLETCHER_REEVES} or
-     * {@link Formula#POLAK_RIBIERE}.
-     * @param checker Convergence checker.
      * @param relativeTolerance Relative threshold for line search.
      * @param absoluteTolerance Absolute threshold for line search.
      * @param initialBracketingRange Extent of the initial interval used to
@@ -185,29 +129,6 @@ public class NonLinearConjugateGradientOptimizer
      * must be one of {@link Formula#FLETCHER_REEVES} or
      * {@link Formula#POLAK_RIBIERE}.
      * @param checker Convergence checker.
-     * @param lineSearchSolver Solver to use during line search.
-     * @param preconditioner Preconditioner.
-     * @deprecated as of 3.3. Please use
-     * {@link #NonLinearConjugateGradientOptimizer(Formula,ConvergenceChecker,double,double,double,Preconditioner)} instead.
-     */
-    @Deprecated
-    public NonLinearConjugateGradientOptimizer(final Formula updateFormula,
-                                               ConvergenceChecker<PointValuePair> checker,
-                                               final UnivariateSolver lineSearchSolver,
-                                               final Preconditioner preconditioner) {
-        this(updateFormula,
-             checker,
-             lineSearchSolver.getRelativeAccuracy(),
-             lineSearchSolver.getAbsoluteAccuracy(),
-             lineSearchSolver.getAbsoluteAccuracy(),
-             preconditioner);
-    }
-
-    /**
-     * @param updateFormula formula to use for updating the &beta; parameter,
-     * must be one of {@link Formula#FLETCHER_REEVES} or
-     * {@link Formula#POLAK_RIBIERE}.
-     * @param checker Convergence checker.
      * @param preconditioner Preconditioner.
      * @param relativeTolerance Relative threshold for line search.
      * @param absoluteTolerance Absolute threshold for line search.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/0737cf82/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/SimplexOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/SimplexOptimizer.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/SimplexOptimizer.java
index f6eee2f..ad39a05 100644
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/SimplexOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/SimplexOptimizer.java
@@ -131,6 +131,7 @@ public class SimplexOptimizer extends MultivariateOptimizer {
         // evaluations counter.
         final MultivariateFunction evalFunc
             = new MultivariateFunction() {
+                @Override
                 public double value(double[] point) {
                     return computeObjectiveValue(point);
                 }
@@ -139,6 +140,7 @@ public class SimplexOptimizer extends MultivariateOptimizer {
         final boolean isMinim = getGoalType() == GoalType.MINIMIZE;
         final Comparator<PointValuePair> comparator
             = new Comparator<PointValuePair>() {
+            @Override
             public int compare(final PointValuePair o1,
                                final PointValuePair o2) {
                 final double v1 = o1.getValue();

http://git-wip-us.apache.org/repos/asf/commons-math/blob/0737cf82/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/JacobianMultivariateVectorOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/JacobianMultivariateVectorOptimizer.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/JacobianMultivariateVectorOptimizer.java
deleted file mode 100644
index da9ad86..0000000
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/JacobianMultivariateVectorOptimizer.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.math4.optim.nonlinear.vector;
-
-import org.apache.commons.math4.analysis.MultivariateMatrixFunction;
-import org.apache.commons.math4.exception.DimensionMismatchException;
-import org.apache.commons.math4.exception.TooManyEvaluationsException;
-import org.apache.commons.math4.optim.ConvergenceChecker;
-import org.apache.commons.math4.optim.OptimizationData;
-import org.apache.commons.math4.optim.PointVectorValuePair;
-
-/**
- * Base class for implementing optimizers for multivariate vector
- * differentiable functions.
- * It contains boiler-plate code for dealing with Jacobian evaluation.
- * It assumes that the rows of the Jacobian matrix iterate on the model
- * functions while the columns iterate on the parameters; thus, the numbers
- * of rows is equal to the dimension of the {@link Target} while the
- * number of columns is equal to the dimension of the
- * {@link org.apache.commons.math4.optim.InitialGuess InitialGuess}.
- *
- * @since 3.1
- * @deprecated All classes and interfaces in this package are deprecated.
- * The optimizers that were provided here were moved to the
- * {@link org.apache.commons.math4.fitting.leastsquares} package
- * (cf. MATH-1008).
- */
-@Deprecated
-public abstract class JacobianMultivariateVectorOptimizer
-    extends MultivariateVectorOptimizer {
-    /**
-     * Jacobian of the model function.
-     */
-    private MultivariateMatrixFunction jacobian;
-
-    /**
-     * @param checker Convergence checker.
-     */
-    protected JacobianMultivariateVectorOptimizer(ConvergenceChecker<PointVectorValuePair> checker) {
-        super(checker);
-    }
-
-    /**
-     * Computes the Jacobian matrix.
-     *
-     * @param params Point at which the Jacobian must be evaluated.
-     * @return the Jacobian at the specified point.
-     */
-    protected double[][] computeJacobian(final double[] params) {
-        return jacobian.value(params);
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * @param optData Optimization data. In addition to those documented in
-     * {@link MultivariateVectorOptimizer#optimize(OptimizationData...)}
-     * MultivariateOptimizer}, this method will register the following data:
-     * <ul>
-     *  <li>{@link ModelFunctionJacobian}</li>
-     * </ul>
-     * @return {@inheritDoc}
-     * @throws TooManyEvaluationsException if the maximal number of
-     * evaluations is exceeded.
-     * @throws DimensionMismatchException if the initial guess, target, and weight
-     * arguments have inconsistent dimensions.
-     */
-    @Override
-    public PointVectorValuePair optimize(OptimizationData... optData)
-        throws TooManyEvaluationsException,
-               DimensionMismatchException {
-        // Set up base class and perform computation.
-        return super.optimize(optData);
-    }
-
-    /**
-     * Scans the list of (required and optional) optimization data that
-     * characterize the problem.
-     *
-     * @param optData Optimization data.
-     * The following data will be looked for:
-     * <ul>
-     *  <li>{@link ModelFunctionJacobian}</li>
-     * </ul>
-     */
-    @Override
-    protected void parseOptimizationData(OptimizationData... optData) {
-        // Allow base class to register its own data.
-        super.parseOptimizationData(optData);
-
-        // The existing values (as set by the previous call) are reused if
-        // not provided in the argument list.
-        for (OptimizationData data : optData) {
-            if (data instanceof ModelFunctionJacobian) {
-                jacobian = ((ModelFunctionJacobian) data).getModelFunctionJacobian();
-                // If more data must be parsed, this statement _must_ be
-                // changed to "continue".
-                break;
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/0737cf82/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/ModelFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/ModelFunction.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/ModelFunction.java
deleted file mode 100644
index b371f13..0000000
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/ModelFunction.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.math4.optim.nonlinear.vector;
-
-import org.apache.commons.math4.analysis.MultivariateVectorFunction;
-import org.apache.commons.math4.optim.OptimizationData;
-
-/**
- * Model (vector) function to be optimized.
- *
- * @since 3.1
- * @deprecated All classes and interfaces in this package are deprecated.
- * The optimizers that were provided here were moved to the
- * {@link org.apache.commons.math4.fitting.leastsquares} package
- * (cf. MATH-1008).
- */
-@Deprecated
-public class ModelFunction implements OptimizationData {
-    /** Function to be optimized. */
-    private final MultivariateVectorFunction model;
-
-    /**
-     * @param m Model function to be optimized.
-     */
-    public ModelFunction(MultivariateVectorFunction m) {
-        model = m;
-    }
-
-    /**
-     * Gets the model function to be optimized.
-     *
-     * @return the model function.
-     */
-    public MultivariateVectorFunction getModelFunction() {
-        return model;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/0737cf82/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/ModelFunctionJacobian.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/ModelFunctionJacobian.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/ModelFunctionJacobian.java
deleted file mode 100644
index 69f7860..0000000
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/ModelFunctionJacobian.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.math4.optim.nonlinear.vector;
-
-import org.apache.commons.math4.analysis.MultivariateMatrixFunction;
-import org.apache.commons.math4.optim.OptimizationData;
-
-/**
- * Jacobian of the model (vector) function to be optimized.
- *
- * @since 3.1
- * @deprecated All classes and interfaces in this package are deprecated.
- * The optimizers that were provided here were moved to the
- * {@link org.apache.commons.math4.fitting.leastsquares} package
- * (cf. MATH-1008).
- */
-@Deprecated
-public class ModelFunctionJacobian implements OptimizationData {
-    /** Function to be optimized. */
-    private final MultivariateMatrixFunction jacobian;
-
-    /**
-     * @param j Jacobian of the model function to be optimized.
-     */
-    public ModelFunctionJacobian(MultivariateMatrixFunction j) {
-        jacobian = j;
-    }
-
-    /**
-     * Gets the Jacobian of the model function to be optimized.
-     *
-     * @return the model function Jacobian.
-     */
-    public MultivariateMatrixFunction getModelFunctionJacobian() {
-        return jacobian;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/0737cf82/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/MultiStartMultivariateVectorOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/MultiStartMultivariateVectorOptimizer.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/MultiStartMultivariateVectorOptimizer.java
deleted file mode 100644
index 2b17932..0000000
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/MultiStartMultivariateVectorOptimizer.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.math4.optim.nonlinear.vector;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Comparator;
-
-import org.apache.commons.math4.exception.NotStrictlyPositiveException;
-import org.apache.commons.math4.exception.NullArgumentException;
-import org.apache.commons.math4.linear.ArrayRealVector;
-import org.apache.commons.math4.linear.RealMatrix;
-import org.apache.commons.math4.linear.RealVector;
-import org.apache.commons.math4.optim.BaseMultiStartMultivariateOptimizer;
-import org.apache.commons.math4.optim.PointVectorValuePair;
-import org.apache.commons.math4.random.RandomVectorGenerator;
-
-/**
- * Multi-start optimizer for a (vector) model function.
- *
- * This class wraps an optimizer in order to use it several times in
- * turn with different starting points (trying to avoid being trapped
- * in a local extremum when looking for a global one).
- *
- * @since 3.0
- */
-@Deprecated
-public class MultiStartMultivariateVectorOptimizer
-    extends BaseMultiStartMultivariateOptimizer<PointVectorValuePair> {
-    /** Underlying optimizer. */
-    private final MultivariateVectorOptimizer optimizer;
-    /** Found optima. */
-    private final List<PointVectorValuePair> optima = new ArrayList<PointVectorValuePair>();
-
-    /**
-     * Create a multi-start optimizer from a single-start optimizer.
-     *
-     * @param optimizer Single-start optimizer to wrap.
-     * @param starts Number of starts to perform.
-     * If {@code starts == 1}, the result will be same as if {@code optimizer}
-     * is called directly.
-     * @param generator Random vector generator to use for restarts.
-     * @throws NullArgumentException if {@code optimizer} or {@code generator}
-     * is {@code null}.
-     * @throws NotStrictlyPositiveException if {@code starts < 1}.
-     */
-    public MultiStartMultivariateVectorOptimizer(final MultivariateVectorOptimizer optimizer,
-                                                 final int starts,
-                                                 final RandomVectorGenerator generator)
-        throws NullArgumentException,
-        NotStrictlyPositiveException {
-        super(optimizer, starts, generator);
-        this.optimizer = optimizer;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public PointVectorValuePair[] getOptima() {
-        Collections.sort(optima, getPairComparator());
-        return optima.toArray(new PointVectorValuePair[0]);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    protected void store(PointVectorValuePair optimum) {
-        optima.add(optimum);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    protected void clear() {
-        optima.clear();
-    }
-
-    /**
-     * @return a comparator for sorting the optima.
-     */
-    private Comparator<PointVectorValuePair> getPairComparator() {
-        return new Comparator<PointVectorValuePair>() {
-            private final RealVector target = new ArrayRealVector(optimizer.getTarget(), false);
-            private final RealMatrix weight = optimizer.getWeight();
-
-            public int compare(final PointVectorValuePair o1,
-                               final PointVectorValuePair o2) {
-                if (o1 == null) {
-                    return (o2 == null) ? 0 : 1;
-                } else if (o2 == null) {
-                    return -1;
-                }
-                return Double.compare(weightedResidual(o1),
-                                      weightedResidual(o2));
-            }
-
-            private double weightedResidual(final PointVectorValuePair pv) {
-                final RealVector v = new ArrayRealVector(pv.getValueRef(), false);
-                final RealVector r = target.subtract(v);
-                return r.dotProduct(weight.operate(r));
-            }
-        };
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/0737cf82/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/MultivariateVectorOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/MultivariateVectorOptimizer.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/MultivariateVectorOptimizer.java
deleted file mode 100644
index 8485ef3..0000000
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/MultivariateVectorOptimizer.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.commons.math4.optim.nonlinear.vector;
-
-import org.apache.commons.math4.analysis.MultivariateVectorFunction;
-import org.apache.commons.math4.exception.DimensionMismatchException;
-import org.apache.commons.math4.exception.TooManyEvaluationsException;
-import org.apache.commons.math4.linear.RealMatrix;
-import org.apache.commons.math4.optim.BaseMultivariateOptimizer;
-import org.apache.commons.math4.optim.ConvergenceChecker;
-import org.apache.commons.math4.optim.OptimizationData;
-import org.apache.commons.math4.optim.PointVectorValuePair;
-
-/**
- * Base class for a multivariate vector function optimizer.
- *
- * @since 3.1
- */
-@Deprecated
-public abstract class MultivariateVectorOptimizer
-    extends BaseMultivariateOptimizer<PointVectorValuePair> {
-    /** Target values for the model function at optimum. */
-    private double[] target;
-    /** Weight matrix. */
-    private RealMatrix weightMatrix;
-    /** Model function. */
-    private MultivariateVectorFunction model;
-
-    /**
-     * @param checker Convergence checker.
-     */
-    protected MultivariateVectorOptimizer(ConvergenceChecker<PointVectorValuePair> checker) {
-        super(checker);
-    }
-
-    /**
-     * Computes the objective function value.
-     * This method <em>must</em> be called by subclasses to enforce the
-     * evaluation counter limit.
-     *
-     * @param params Point at which the objective function must be evaluated.
-     * @return the objective function value at the specified point.
-     * @throws TooManyEvaluationsException if the maximal number of evaluations
-     * (of the model vector function) is exceeded.
-     */
-    protected double[] computeObjectiveValue(double[] params) {
-        super.incrementEvaluationCount();
-        return model.value(params);
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * @param optData Optimization data. In addition to those documented in
-     * {@link BaseMultivariateOptimizer#parseOptimizationData(OptimizationData[])
-     * BaseMultivariateOptimizer}, this method will register the following data:
-     * <ul>
-     *  <li>{@link Target}</li>
-     *  <li>{@link Weight}</li>
-     *  <li>{@link ModelFunction}</li>
-     * </ul>
-     * @return {@inheritDoc}
-     * @throws TooManyEvaluationsException if the maximal number of
-     * evaluations is exceeded.
-     * @throws DimensionMismatchException if the initial guess, target, and weight
-     * arguments have inconsistent dimensions.
-     */
-    @Override
-    public PointVectorValuePair optimize(OptimizationData... optData)
-        throws TooManyEvaluationsException,
-               DimensionMismatchException {
-        // Set up base class and perform computation.
-        return super.optimize(optData);
-    }
-
-    /**
-     * Gets the weight matrix of the observations.
-     *
-     * @return the weight matrix.
-     */
-    public RealMatrix getWeight() {
-        return weightMatrix.copy();
-    }
-    /**
-     * Gets the observed values to be matched by the objective vector
-     * function.
-     *
-     * @return the target values.
-     */
-    public double[] getTarget() {
-        return target.clone();
-    }
-
-    /**
-     * Gets the number of observed values.
-     *
-     * @return the length of the target vector.
-     */
-    public int getTargetSize() {
-        return target.length;
-    }
-
-    /**
-     * Scans the list of (required and optional) optimization data that
-     * characterize the problem.
-     *
-     * @param optData Optimization data. The following data will be looked for:
-     * <ul>
-     *  <li>{@link Target}</li>
-     *  <li>{@link Weight}</li>
-     *  <li>{@link ModelFunction}</li>
-     * </ul>
-     */
-    @Override
-    protected void parseOptimizationData(OptimizationData... optData) {
-        // Allow base class to register its own data.
-        super.parseOptimizationData(optData);
-
-        // The existing values (as set by the previous call) are reused if
-        // not provided in the argument list.
-        for (OptimizationData data : optData) {
-            if (data instanceof ModelFunction) {
-                model = ((ModelFunction) data).getModelFunction();
-                continue;
-            }
-            if (data instanceof Target) {
-                target = ((Target) data).getTarget();
-                continue;
-            }
-            if (data instanceof Weight) {
-                weightMatrix = ((Weight) data).getWeight();
-                continue;
-            }
-        }
-
-        // Check input consistency.
-        checkParameters();
-    }
-
-    /**
-     * Check parameters consistency.
-     *
-     * @throws DimensionMismatchException if {@link #target} and
-     * {@link #weightMatrix} have inconsistent dimensions.
-     */
-    private void checkParameters() {
-        if (target.length != weightMatrix.getColumnDimension()) {
-            throw new DimensionMismatchException(target.length,
-                                                 weightMatrix.getColumnDimension());
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/0737cf82/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/Target.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/Target.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/Target.java
deleted file mode 100644
index 2937888..0000000
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/Target.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.math4.optim.nonlinear.vector;
-
-import org.apache.commons.math4.optim.OptimizationData;
-
-/**
- * Target of the optimization procedure.
- * They are the values which the objective vector function must reproduce
- * When the parameters of the model have been optimized.
- * <br/>
- * Immutable class.
- *
- * @since 3.1
- * @deprecated All classes and interfaces in this package are deprecated.
- * The optimizers that were provided here were moved to the
- * {@link org.apache.commons.math4.fitting.leastsquares} package
- * (cf. MATH-1008).
- */
-@Deprecated
-public class Target implements OptimizationData {
-    /** Target values (of the objective vector function). */
-    private final double[] target;
-
-    /**
-     * @param observations Target values.
-     */
-    public Target(double[] observations) {
-        target = observations.clone();
-    }
-
-    /**
-     * Gets the initial guess.
-     *
-     * @return the initial guess.
-     */
-    public double[] getTarget() {
-        return target.clone();
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/0737cf82/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/Weight.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/Weight.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/Weight.java
deleted file mode 100644
index a723ae2..0000000
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/Weight.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.math4.optim.nonlinear.vector;
-
-import org.apache.commons.math4.linear.DiagonalMatrix;
-import org.apache.commons.math4.linear.NonSquareMatrixException;
-import org.apache.commons.math4.linear.RealMatrix;
-import org.apache.commons.math4.optim.OptimizationData;
-
-/**
- * Weight matrix of the residuals between model and observations.
- * <br/>
- * Immutable class.
- *
- * @since 3.1
- * @deprecated All classes and interfaces in this package are deprecated.
- * The optimizers that were provided here were moved to the
- * {@link org.apache.commons.math4.fitting.leastsquares} package
- * (cf. MATH-1008).
- */
-@Deprecated
-public class Weight implements OptimizationData {
-    /** Weight matrix. */
-    private final RealMatrix weightMatrix;
-
-    /**
-     * Creates a diagonal weight matrix.
-     *
-     * @param weight List of the values of the diagonal.
-     */
-    public Weight(double[] weight) {
-        weightMatrix = new DiagonalMatrix(weight);
-    }
-
-    /**
-     * @param weight Weight matrix.
-     * @throws NonSquareMatrixException if the argument is not
-     * a square matrix.
-     */
-    public Weight(RealMatrix weight) {
-        if (weight.getColumnDimension() != weight.getRowDimension()) {
-            throw new NonSquareMatrixException(weight.getColumnDimension(),
-                                               weight.getRowDimension());
-        }
-
-        weightMatrix = weight.copy();
-    }
-
-    /**
-     * Gets the initial guess.
-     *
-     * @return the initial guess.
-     */
-    public RealMatrix getWeight() {
-        return weightMatrix.copy();
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/0737cf82/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizer.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizer.java
deleted file mode 100644
index 6c4a2d9..0000000
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizer.java
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.math4.optim.nonlinear.vector.jacobian;
-
-import org.apache.commons.math4.exception.DimensionMismatchException;
-import org.apache.commons.math4.exception.TooManyEvaluationsException;
-import org.apache.commons.math4.linear.ArrayRealVector;
-import org.apache.commons.math4.linear.DecompositionSolver;
-import org.apache.commons.math4.linear.DiagonalMatrix;
-import org.apache.commons.math4.linear.EigenDecomposition;
-import org.apache.commons.math4.linear.MatrixUtils;
-import org.apache.commons.math4.linear.QRDecomposition;
-import org.apache.commons.math4.linear.RealMatrix;
-import org.apache.commons.math4.optim.ConvergenceChecker;
-import org.apache.commons.math4.optim.OptimizationData;
-import org.apache.commons.math4.optim.PointVectorValuePair;
-import org.apache.commons.math4.optim.nonlinear.vector.JacobianMultivariateVectorOptimizer;
-import org.apache.commons.math4.optim.nonlinear.vector.Weight;
-import org.apache.commons.math4.util.FastMath;
-
-/**
- * Base class for implementing least-squares optimizers.
- * It provides methods for error estimation.
- *
- * @since 3.1
- * @deprecated All classes and interfaces in this package are deprecated.
- * The optimizers that were provided here were moved to the
- * {@link org.apache.commons.math4.fitting.leastsquares} package
- * (cf. MATH-1008).
- */
-@Deprecated
-public abstract class AbstractLeastSquaresOptimizer
-    extends JacobianMultivariateVectorOptimizer {
-    /** Square-root of the weight matrix. */
-    private RealMatrix weightMatrixSqrt;
-    /** Cost value (square root of the sum of the residuals). */
-    private double cost;
-
-    /**
-     * @param checker Convergence checker.
-     */
-    protected AbstractLeastSquaresOptimizer(ConvergenceChecker<PointVectorValuePair> checker) {
-        super(checker);
-    }
-
-    /**
-     * Computes the weighted Jacobian matrix.
-     *
-     * @param params Model parameters at which to compute the Jacobian.
-     * @return the weighted Jacobian: W<sup>1/2</sup> J.
-     * @throws DimensionMismatchException if the Jacobian dimension does not
-     * match problem dimension.
-     */
-    protected RealMatrix computeWeightedJacobian(double[] params) {
-        return weightMatrixSqrt.multiply(MatrixUtils.createRealMatrix(computeJacobian(params)));
-    }
-
-    /**
-     * Computes the cost.
-     *
-     * @param residuals Residuals.
-     * @return the cost.
-     * @see #computeResiduals(double[])
-     */
-    protected double computeCost(double[] residuals) {
-        final ArrayRealVector r = new ArrayRealVector(residuals);
-        return FastMath.sqrt(r.dotProduct(getWeight().operate(r)));
-    }
-
-    /**
-     * Gets the root-mean-square (RMS) value.
-     *
-     * The RMS the root of the arithmetic mean of the square of all weighted
-     * residuals.
-     * This is related to the criterion that is minimized by the optimizer
-     * as follows: If <em>c</em> if the criterion, and <em>n</em> is the
-     * number of measurements, then the RMS is <em>sqrt (c/n)</em>.
-     *
-     * @return the RMS value.
-     */
-    public double getRMS() {
-        return FastMath.sqrt(getChiSquare() / getTargetSize());
-    }
-
-    /**
-     * Get a Chi-Square-like value assuming the N residuals follow N
-     * distinct normal distributions centered on 0 and whose variances are
-     * the reciprocal of the weights.
-     * @return chi-square value
-     */
-    public double getChiSquare() {
-        return cost * cost;
-    }
-
-    /**
-     * Gets the square-root of the weight matrix.
-     *
-     * @return the square-root of the weight matrix.
-     */
-    public RealMatrix getWeightSquareRoot() {
-        return weightMatrixSqrt.copy();
-    }
-
-    /**
-     * Sets the cost.
-     *
-     * @param cost Cost value.
-     */
-    protected void setCost(double cost) {
-        this.cost = cost;
-    }
-
-    /**
-     * Get the covariance matrix of the optimized parameters.
-     * <br/>
-     * Note that this operation involves the inversion of the
-     * <code>J<sup>T</sup>J</code> matrix, where {@code J} is the
-     * Jacobian matrix.
-     * The {@code threshold} parameter is a way for the caller to specify
-     * that the result of this computation should be considered meaningless,
-     * and thus trigger an exception.
-     *
-     * @param params Model parameters.
-     * @param threshold Singularity threshold.
-     * @return the covariance matrix.
-     * @throws org.apache.commons.math4.linear.SingularMatrixException
-     * if the covariance matrix cannot be computed (singular problem).
-     */
-    public double[][] computeCovariances(double[] params,
-                                         double threshold) {
-        // Set up the Jacobian.
-        final RealMatrix j = computeWeightedJacobian(params);
-
-        // Compute transpose(J)J.
-        final RealMatrix jTj = j.transpose().multiply(j);
-
-        // Compute the covariances matrix.
-        final DecompositionSolver solver
-            = new QRDecomposition(jTj, threshold).getSolver();
-        return solver.getInverse().getData();
-    }
-
-    /**
-     * Computes an estimate of the standard deviation of the parameters. The
-     * returned values are the square root of the diagonal coefficients of the
-     * covariance matrix, {@code sd(a[i]) ~= sqrt(C[i][i])}, where {@code a[i]}
-     * is the optimized value of the {@code i}-th parameter, and {@code C} is
-     * the covariance matrix.
-     *
-     * @param params Model parameters.
-     * @param covarianceSingularityThreshold Singularity threshold (see
-     * {@link #computeCovariances(double[],double) computeCovariances}).
-     * @return an estimate of the standard deviation of the optimized parameters
-     * @throws org.apache.commons.math4.linear.SingularMatrixException
-     * if the covariance matrix cannot be computed.
-     */
-    public double[] computeSigma(double[] params,
-                                 double covarianceSingularityThreshold) {
-        final int nC = params.length;
-        final double[] sig = new double[nC];
-        final double[][] cov = computeCovariances(params, covarianceSingularityThreshold);
-        for (int i = 0; i < nC; ++i) {
-            sig[i] = FastMath.sqrt(cov[i][i]);
-        }
-        return sig;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * @param optData Optimization data. In addition to those documented in
-     * {@link JacobianMultivariateVectorOptimizer#parseOptimizationData(OptimizationData[])
-     * JacobianMultivariateVectorOptimizer}, this method will register the following data:
-     * <ul>
-     *  <li>{@link org.apache.commons.math4.optim.nonlinear.vector.Weight}</li>
-     * </ul>
-     * @return {@inheritDoc}
-     * @throws TooManyEvaluationsException if the maximal number of
-     * evaluations is exceeded.
-     * @throws DimensionMismatchException if the initial guess, target, and weight
-     * arguments have inconsistent dimensions.
-     */
-    @Override
-    public PointVectorValuePair optimize(OptimizationData... optData)
-        throws TooManyEvaluationsException {
-        // Set up base class and perform computation.
-        return super.optimize(optData);
-    }
-
-    /**
-     * Computes the residuals.
-     * The residual is the difference between the observed (target)
-     * values and the model (objective function) value.
-     * There is one residual for each element of the vector-valued
-     * function.
-     *
-     * @param objectiveValue Value of the the objective function. This is
-     * the value returned from a call to
-     * {@link #computeObjectiveValue(double[]) computeObjectiveValue}
-     * (whose array argument contains the model parameters).
-     * @return the residuals.
-     * @throws DimensionMismatchException if {@code params} has a wrong
-     * length.
-     */
-    protected double[] computeResiduals(double[] objectiveValue) {
-        final double[] target = getTarget();
-        if (objectiveValue.length != target.length) {
-            throw new DimensionMismatchException(target.length,
-                                                 objectiveValue.length);
-        }
-
-        final double[] residuals = new double[target.length];
-        for (int i = 0; i < target.length; i++) {
-            residuals[i] = target[i] - objectiveValue[i];
-        }
-
-        return residuals;
-    }
-
-    /**
-     * Scans the list of (required and optional) optimization data that
-     * characterize the problem.
-     * If the weight matrix is specified, the {@link #weightMatrixSqrt}
-     * field is recomputed.
-     *
-     * @param optData Optimization data. The following data will be looked for:
-     * <ul>
-     *  <li>{@link Weight}</li>
-     * </ul>
-     */
-    @Override
-    protected void parseOptimizationData(OptimizationData... optData) {
-        // Allow base class to register its own data.
-        super.parseOptimizationData(optData);
-
-        // The existing values (as set by the previous call) are reused if
-        // not provided in the argument list.
-        for (OptimizationData data : optData) {
-            if (data instanceof Weight) {
-                weightMatrixSqrt = squareRoot(((Weight) data).getWeight());
-                // If more data must be parsed, this statement _must_ be
-                // changed to "continue".
-                break;
-            }
-        }
-    }
-
-    /**
-     * Computes the square-root of the weight matrix.
-     *
-     * @param m Symmetric, positive-definite (weight) matrix.
-     * @return the square-root of the weight matrix.
-     */
-    private RealMatrix squareRoot(RealMatrix m) {
-        if (m instanceof DiagonalMatrix) {
-            final int dim = m.getRowDimension();
-            final RealMatrix sqrtM = new DiagonalMatrix(dim);
-            for (int i = 0; i < dim; i++) {
-                sqrtM.setEntry(i, i, FastMath.sqrt(m.getEntry(i, i)));
-            }
-            return sqrtM;
-        } else {
-            final EigenDecomposition dec = new EigenDecomposition(m);
-            return dec.getSquareRoot();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/0737cf82/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/GaussNewtonOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/GaussNewtonOptimizer.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/GaussNewtonOptimizer.java
deleted file mode 100644
index 34fb988..0000000
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/GaussNewtonOptimizer.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.math4.optim.nonlinear.vector.jacobian;
-
-import org.apache.commons.math4.exception.ConvergenceException;
-import org.apache.commons.math4.exception.MathInternalError;
-import org.apache.commons.math4.exception.MathUnsupportedOperationException;
-import org.apache.commons.math4.exception.NullArgumentException;
-import org.apache.commons.math4.exception.util.LocalizedFormats;
-import org.apache.commons.math4.linear.ArrayRealVector;
-import org.apache.commons.math4.linear.BlockRealMatrix;
-import org.apache.commons.math4.linear.DecompositionSolver;
-import org.apache.commons.math4.linear.LUDecomposition;
-import org.apache.commons.math4.linear.QRDecomposition;
-import org.apache.commons.math4.linear.RealMatrix;
-import org.apache.commons.math4.linear.SingularMatrixException;
-import org.apache.commons.math4.optim.ConvergenceChecker;
-import org.apache.commons.math4.optim.PointVectorValuePair;
-
-/**
- * Gauss-Newton least-squares solver.
- * <br/>
- * Constraints are not supported: the call to
- * {@link #optimize(OptimizationData[]) optimize} will throw
- * {@link MathUnsupportedOperationException} if bounds are passed to it.
- *
- * <p>
- * This class solve a least-square problem by solving the normal equations
- * of the linearized problem at each iteration. Either LU decomposition or
- * QR decomposition can be used to solve the normal equations. LU decomposition
- * is faster but QR decomposition is more robust for difficult problems.
- * </p>
- *
- * @since 2.0
- * @deprecated All classes and interfaces in this package are deprecated.
- * The optimizers that were provided here were moved to the
- * {@link org.apache.commons.math4.fitting.leastsquares} package
- * (cf. MATH-1008).
- */
-@Deprecated
-public class GaussNewtonOptimizer extends AbstractLeastSquaresOptimizer {
-    /** Indicator for using LU decomposition. */
-    private final boolean useLU;
-
-    /**
-     * Simple constructor with default settings.
-     * The normal equations will be solved using LU decomposition.
-     *
-     * @param checker Convergence checker.
-     */
-    public GaussNewtonOptimizer(ConvergenceChecker<PointVectorValuePair> checker) {
-        this(true, checker);
-    }
-
-    /**
-     * @param useLU If {@code true}, the normal equations will be solved
-     * using LU decomposition, otherwise they will be solved using QR
-     * decomposition.
-     * @param checker Convergence checker.
-     */
-    public GaussNewtonOptimizer(final boolean useLU,
-                                ConvergenceChecker<PointVectorValuePair> checker) {
-        super(checker);
-        this.useLU = useLU;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public PointVectorValuePair doOptimize() {
-        checkParameters();
-
-        final ConvergenceChecker<PointVectorValuePair> checker
-            = getConvergenceChecker();
-
-        // Computation will be useless without a checker (see "for-loop").
-        if (checker == null) {
-            throw new NullArgumentException();
-        }
-
-        final double[] targetValues = getTarget();
-        final int nR = targetValues.length; // Number of observed data.
-
-        final RealMatrix weightMatrix = getWeight();
-        // Diagonal of the weight matrix.
-        final double[] residualsWeights = new double[nR];
-        for (int i = 0; i < nR; i++) {
-            residualsWeights[i] = weightMatrix.getEntry(i, i);
-        }
-
-        final double[] currentPoint = getStartPoint();
-        final int nC = currentPoint.length;
-
-        // iterate until convergence is reached
-        PointVectorValuePair current = null;
-        for (boolean converged = false; !converged;) {
-            incrementIterationCount();
-
-            // evaluate the objective function and its jacobian
-            PointVectorValuePair previous = current;
-            // Value of the objective function at "currentPoint".
-            final double[] currentObjective = computeObjectiveValue(currentPoint);
-            final double[] currentResiduals = computeResiduals(currentObjective);
-            final RealMatrix weightedJacobian = computeWeightedJacobian(currentPoint);
-            current = new PointVectorValuePair(currentPoint, currentObjective);
-
-            // build the linear problem
-            final double[]   b = new double[nC];
-            final double[][] a = new double[nC][nC];
-            for (int i = 0; i < nR; ++i) {
-
-                final double[] grad   = weightedJacobian.getRow(i);
-                final double weight   = residualsWeights[i];
-                final double residual = currentResiduals[i];
-
-                // compute the normal equation
-                final double wr = weight * residual;
-                for (int j = 0; j < nC; ++j) {
-                    b[j] += wr * grad[j];
-                }
-
-                // build the contribution matrix for measurement i
-                for (int k = 0; k < nC; ++k) {
-                    double[] ak = a[k];
-                    double wgk = weight * grad[k];
-                    for (int l = 0; l < nC; ++l) {
-                        ak[l] += wgk * grad[l];
-                    }
-                }
-            }
-
-            // Check convergence.
-            if (previous != null) {
-                converged = checker.converged(getIterations(), previous, current);
-                if (converged) {
-                    setCost(computeCost(currentResiduals));
-                    return current;
-                }
-            }
-
-            try {
-                // solve the linearized least squares problem
-                RealMatrix mA = new BlockRealMatrix(a);
-                DecompositionSolver solver = useLU ?
-                        new LUDecomposition(mA).getSolver() :
-                        new QRDecomposition(mA).getSolver();
-                final double[] dX = solver.solve(new ArrayRealVector(b, false)).toArray();
-                // update the estimated parameters
-                for (int i = 0; i < nC; ++i) {
-                    currentPoint[i] += dX[i];
-                }
-            } catch (SingularMatrixException e) {
-                throw new ConvergenceException(LocalizedFormats.UNABLE_TO_SOLVE_SINGULAR_PROBLEM);
-            }
-        }
-        // Must never happen.
-        throw new MathInternalError();
-    }
-
-    /**
-     * @throws MathUnsupportedOperationException if bounds were passed to the
-     * {@link #optimize(OptimizationData[]) optimize} method.
-     */
-    private void checkParameters() {
-        if (getLowerBound() != null ||
-            getUpperBound() != null) {
-            throw new MathUnsupportedOperationException(LocalizedFormats.CONSTRAINT);
-        }
-    }
-}


Mime
View raw message