You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by tn...@apache.org on 2015/04/11 16:06:06 UTC

[1/5] [math] Remove deprecated classes in optim package.

Repository: commons-math
Updated Branches:
  refs/heads/master 8a7645356 -> e31fde875


http://git-wip-us.apache.org/repos/asf/commons-math/blob/0737cf82/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/LevenbergMarquardtOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/LevenbergMarquardtOptimizer.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/LevenbergMarquardtOptimizer.java
deleted file mode 100644
index b0a2ca3..0000000
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/LevenbergMarquardtOptimizer.java
+++ /dev/null
@@ -1,962 +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 java.util.Arrays;
-
-import org.apache.commons.math4.exception.ConvergenceException;
-import org.apache.commons.math4.exception.MathUnsupportedOperationException;
-import org.apache.commons.math4.exception.util.LocalizedFormats;
-import org.apache.commons.math4.linear.RealMatrix;
-import org.apache.commons.math4.optim.ConvergenceChecker;
-import org.apache.commons.math4.optim.PointVectorValuePair;
-import org.apache.commons.math4.util.FastMath;
-import org.apache.commons.math4.util.Precision;
-
-
-/**
- * This class solves a least-squares problem using the Levenberg-Marquardt
- * algorithm.
- * <br/>
- * Constraints are not supported: the call to
- * {@link #optimize(OptimizationData[]) optimize} will throw
- * {@link MathUnsupportedOperationException} if bounds are passed to it.
- *
- * <p>This implementation <em>should</em> work even for over-determined systems
- * (i.e. systems having more point than equations). Over-determined systems
- * are solved by ignoring the point which have the smallest impact according
- * to their jacobian column norm. Only the rank of the matrix and some loop bounds
- * are changed to implement this.</p>
- *
- * <p>The resolution engine is a simple translation of the MINPACK <a
- * href="http://www.netlib.org/minpack/lmder.f">lmder</a> routine with minor
- * changes. The changes include the over-determined resolution, the use of
- * inherited convergence checker and the Q.R. decomposition which has been
- * rewritten following the algorithm described in the
- * P. Lascaux and R. Theodor book <i>Analyse num&eacute;rique matricielle
- * appliqu&eacute;e &agrave; l'art de l'ing&eacute;nieur</i>, Masson 1986.</p>
- * <p>The authors of the original fortran version are:
- * <ul>
- * <li>Argonne National Laboratory. MINPACK project. March 1980</li>
- * <li>Burton S. Garbow</li>
- * <li>Kenneth E. Hillstrom</li>
- * <li>Jorge J. More</li>
- * </ul>
- * The redistribution policy for MINPACK is available <a
- * href="http://www.netlib.org/minpack/disclaimer">here</a>, for convenience, it
- * is reproduced below.</p>
- *
- * <table border="0" width="80%" cellpadding="10" align="center" bgcolor="#E0E0E0">
- * <tr><td>
- *    Minpack Copyright Notice (1999) University of Chicago.
- *    All rights reserved
- * </td></tr>
- * <tr><td>
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * <ol>
- *  <li>Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.</li>
- * <li>Redistributions in binary form must reproduce the above
- *     copyright notice, this list of conditions and the following
- *     disclaimer in the documentation and/or other materials provided
- *     with the distribution.</li>
- * <li>The end-user documentation included with the redistribution, if any,
- *     must include the following acknowledgment:
- *     <code>This product includes software developed by the University of
- *           Chicago, as Operator of Argonne National Laboratory.</code>
- *     Alternately, this acknowledgment may appear in the software itself,
- *     if and wherever such third-party acknowledgments normally appear.</li>
- * <li><strong>WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS"
- *     WITHOUT WARRANTY OF ANY KIND. THE COPYRIGHT HOLDER, THE
- *     UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND
- *     THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR
- *     IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES
- *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE
- *     OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL LIABILITY
- *     OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR
- *     USEFULNESS OF THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF
- *     THE SOFTWARE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS, (4)
- *     DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION
- *     UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL
- *     BE CORRECTED.</strong></li>
- * <li><strong>LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT
- *     HOLDER, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF
- *     ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT,
- *     INCIDENTAL, CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF
- *     ANY KIND OR NATURE, INCLUDING BUT NOT LIMITED TO LOSS OF
- *     PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, WHETHER
- *     SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT
- *     (INCLUDING NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE,
- *     EVEN IF ANY OF SAID PARTIES HAS BEEN WARNED OF THE
- *     POSSIBILITY OF SUCH LOSS OR DAMAGES.</strong></li>
- * <ol></td></tr>
- * </table>
- *
- * @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 LevenbergMarquardtOptimizer
-    extends AbstractLeastSquaresOptimizer {
-    /** Twice the "epsilon machine". */
-    private static final double TWO_EPS = 2 * Precision.EPSILON;
-    /** Number of solved point. */
-    private int solvedCols;
-    /** Diagonal elements of the R matrix in the Q.R. decomposition. */
-    private double[] diagR;
-    /** Norms of the columns of the jacobian matrix. */
-    private double[] jacNorm;
-    /** Coefficients of the Householder transforms vectors. */
-    private double[] beta;
-    /** Columns permutation array. */
-    private int[] permutation;
-    /** Rank of the jacobian matrix. */
-    private int rank;
-    /** Levenberg-Marquardt parameter. */
-    private double lmPar;
-    /** Parameters evolution direction associated with lmPar. */
-    private double[] lmDir;
-    /** Positive input variable used in determining the initial step bound. */
-    private final double initialStepBoundFactor;
-    /** Desired relative error in the sum of squares. */
-    private final double costRelativeTolerance;
-    /**  Desired relative error in the approximate solution parameters. */
-    private final double parRelativeTolerance;
-    /** Desired max cosine on the orthogonality between the function vector
-     * and the columns of the jacobian. */
-    private final double orthoTolerance;
-    /** Threshold for QR ranking. */
-    private final double qrRankingThreshold;
-    /** Weighted residuals. */
-    private double[] weightedResidual;
-    /** Weighted Jacobian. */
-    private double[][] weightedJacobian;
-
-    /**
-     * Build an optimizer for least squares problems with default values
-     * for all the tuning parameters (see the {@link
-     * #LevenbergMarquardtOptimizer(double,double,double,double,double)
-     * other contructor}.
-     * The default values for the algorithm settings are:
-     * <ul>
-     *  <li>Initial step bound factor: 100</li>
-     *  <li>Cost relative tolerance: 1e-10</li>
-     *  <li>Parameters relative tolerance: 1e-10</li>
-     *  <li>Orthogonality tolerance: 1e-10</li>
-     *  <li>QR ranking threshold: {@link Precision#SAFE_MIN}</li>
-     * </ul>
-     */
-    public LevenbergMarquardtOptimizer() {
-        this(100, 1e-10, 1e-10, 1e-10, Precision.SAFE_MIN);
-    }
-
-    /**
-     * Constructor that allows the specification of a custom convergence
-     * checker.
-     * Note that all the usual convergence checks will be <em>disabled</em>.
-     * The default values for the algorithm settings are:
-     * <ul>
-     *  <li>Initial step bound factor: 100</li>
-     *  <li>Cost relative tolerance: 1e-10</li>
-     *  <li>Parameters relative tolerance: 1e-10</li>
-     *  <li>Orthogonality tolerance: 1e-10</li>
-     *  <li>QR ranking threshold: {@link Precision#SAFE_MIN}</li>
-     * </ul>
-     *
-     * @param checker Convergence checker.
-     */
-    public LevenbergMarquardtOptimizer(ConvergenceChecker<PointVectorValuePair> checker) {
-        this(100, checker, 1e-10, 1e-10, 1e-10, Precision.SAFE_MIN);
-    }
-
-    /**
-     * Constructor that allows the specification of a custom convergence
-     * checker, in addition to the standard ones.
-     *
-     * @param initialStepBoundFactor Positive input variable used in
-     * determining the initial step bound. This bound is set to the
-     * product of initialStepBoundFactor and the euclidean norm of
-     * {@code diag * x} if non-zero, or else to {@code initialStepBoundFactor}
-     * itself. In most cases factor should lie in the interval
-     * {@code (0.1, 100.0)}. {@code 100} is a generally recommended value.
-     * @param checker Convergence checker.
-     * @param costRelativeTolerance Desired relative error in the sum of
-     * squares.
-     * @param parRelativeTolerance Desired relative error in the approximate
-     * solution parameters.
-     * @param orthoTolerance Desired max cosine on the orthogonality between
-     * the function vector and the columns of the Jacobian.
-     * @param threshold Desired threshold for QR ranking. If the squared norm
-     * of a column vector is smaller or equal to this threshold during QR
-     * decomposition, it is considered to be a zero vector and hence the rank
-     * of the matrix is reduced.
-     */
-    public LevenbergMarquardtOptimizer(double initialStepBoundFactor,
-                                       ConvergenceChecker<PointVectorValuePair> checker,
-                                       double costRelativeTolerance,
-                                       double parRelativeTolerance,
-                                       double orthoTolerance,
-                                       double threshold) {
-        super(checker);
-        this.initialStepBoundFactor = initialStepBoundFactor;
-        this.costRelativeTolerance = costRelativeTolerance;
-        this.parRelativeTolerance = parRelativeTolerance;
-        this.orthoTolerance = orthoTolerance;
-        this.qrRankingThreshold = threshold;
-    }
-
-    /**
-     * Build an optimizer for least squares problems with default values
-     * for some of the tuning parameters (see the {@link
-     * #LevenbergMarquardtOptimizer(double,double,double,double,double)
-     * other contructor}.
-     * The default values for the algorithm settings are:
-     * <ul>
-     *  <li>Initial step bound factor}: 100</li>
-     *  <li>QR ranking threshold}: {@link Precision#SAFE_MIN}</li>
-     * </ul>
-     *
-     * @param costRelativeTolerance Desired relative error in the sum of
-     * squares.
-     * @param parRelativeTolerance Desired relative error in the approximate
-     * solution parameters.
-     * @param orthoTolerance Desired max cosine on the orthogonality between
-     * the function vector and the columns of the Jacobian.
-     */
-    public LevenbergMarquardtOptimizer(double costRelativeTolerance,
-                                       double parRelativeTolerance,
-                                       double orthoTolerance) {
-        this(100,
-             costRelativeTolerance, parRelativeTolerance, orthoTolerance,
-             Precision.SAFE_MIN);
-    }
-
-    /**
-     * The arguments control the behaviour of the default convergence checking
-     * procedure.
-     * Additional criteria can defined through the setting of a {@link
-     * ConvergenceChecker}.
-     *
-     * @param initialStepBoundFactor Positive input variable used in
-     * determining the initial step bound. This bound is set to the
-     * product of initialStepBoundFactor and the euclidean norm of
-     * {@code diag * x} if non-zero, or else to {@code initialStepBoundFactor}
-     * itself. In most cases factor should lie in the interval
-     * {@code (0.1, 100.0)}. {@code 100} is a generally recommended value.
-     * @param costRelativeTolerance Desired relative error in the sum of
-     * squares.
-     * @param parRelativeTolerance Desired relative error in the approximate
-     * solution parameters.
-     * @param orthoTolerance Desired max cosine on the orthogonality between
-     * the function vector and the columns of the Jacobian.
-     * @param threshold Desired threshold for QR ranking. If the squared norm
-     * of a column vector is smaller or equal to this threshold during QR
-     * decomposition, it is considered to be a zero vector and hence the rank
-     * of the matrix is reduced.
-     */
-    public LevenbergMarquardtOptimizer(double initialStepBoundFactor,
-                                       double costRelativeTolerance,
-                                       double parRelativeTolerance,
-                                       double orthoTolerance,
-                                       double threshold) {
-        super(null); // No custom convergence criterion.
-        this.initialStepBoundFactor = initialStepBoundFactor;
-        this.costRelativeTolerance = costRelativeTolerance;
-        this.parRelativeTolerance = parRelativeTolerance;
-        this.orthoTolerance = orthoTolerance;
-        this.qrRankingThreshold = threshold;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected PointVectorValuePair doOptimize() {
-        checkParameters();
-
-        final int nR = getTarget().length; // Number of observed data.
-        final double[] currentPoint = getStartPoint();
-        final int nC = currentPoint.length; // Number of parameters.
-
-        // arrays shared with the other private methods
-        solvedCols  = FastMath.min(nR, nC);
-        diagR       = new double[nC];
-        jacNorm     = new double[nC];
-        beta        = new double[nC];
-        permutation = new int[nC];
-        lmDir       = new double[nC];
-
-        // local point
-        double   delta   = 0;
-        double   xNorm   = 0;
-        double[] diag    = new double[nC];
-        double[] oldX    = new double[nC];
-        double[] oldRes  = new double[nR];
-        double[] oldObj  = new double[nR];
-        double[] qtf     = new double[nR];
-        double[] work1   = new double[nC];
-        double[] work2   = new double[nC];
-        double[] work3   = new double[nC];
-
-        final RealMatrix weightMatrixSqrt = getWeightSquareRoot();
-
-        // Evaluate the function at the starting point and calculate its norm.
-        double[] currentObjective = computeObjectiveValue(currentPoint);
-        double[] currentResiduals = computeResiduals(currentObjective);
-        PointVectorValuePair current = new PointVectorValuePair(currentPoint, currentObjective);
-        double currentCost = computeCost(currentResiduals);
-
-        // Outer loop.
-        lmPar = 0;
-        boolean firstIteration = true;
-        final ConvergenceChecker<PointVectorValuePair> checker = getConvergenceChecker();
-        while (true) {
-            incrementIterationCount();
-
-            final PointVectorValuePair previous = current;
-
-            // QR decomposition of the jacobian matrix
-            qrDecomposition(computeWeightedJacobian(currentPoint));
-
-            weightedResidual = weightMatrixSqrt.operate(currentResiduals);
-            for (int i = 0; i < nR; i++) {
-                qtf[i] = weightedResidual[i];
-            }
-
-            // compute Qt.res
-            qTy(qtf);
-
-            // now we don't need Q anymore,
-            // so let jacobian contain the R matrix with its diagonal elements
-            for (int k = 0; k < solvedCols; ++k) {
-                int pk = permutation[k];
-                weightedJacobian[k][pk] = diagR[pk];
-            }
-
-            if (firstIteration) {
-                // scale the point according to the norms of the columns
-                // of the initial jacobian
-                xNorm = 0;
-                for (int k = 0; k < nC; ++k) {
-                    double dk = jacNorm[k];
-                    if (dk == 0) {
-                        dk = 1.0;
-                    }
-                    double xk = dk * currentPoint[k];
-                    xNorm  += xk * xk;
-                    diag[k] = dk;
-                }
-                xNorm = FastMath.sqrt(xNorm);
-
-                // initialize the step bound delta
-                delta = (xNorm == 0) ? initialStepBoundFactor : (initialStepBoundFactor * xNorm);
-            }
-
-            // check orthogonality between function vector and jacobian columns
-            double maxCosine = 0;
-            if (currentCost != 0) {
-                for (int j = 0; j < solvedCols; ++j) {
-                    int    pj = permutation[j];
-                    double s  = jacNorm[pj];
-                    if (s != 0) {
-                        double sum = 0;
-                        for (int i = 0; i <= j; ++i) {
-                            sum += weightedJacobian[i][pj] * qtf[i];
-                        }
-                        maxCosine = FastMath.max(maxCosine, FastMath.abs(sum) / (s * currentCost));
-                    }
-                }
-            }
-            if (maxCosine <= orthoTolerance) {
-                // Convergence has been reached.
-                setCost(currentCost);
-                return current;
-            }
-
-            // rescale if necessary
-            for (int j = 0; j < nC; ++j) {
-                diag[j] = FastMath.max(diag[j], jacNorm[j]);
-            }
-
-            // Inner loop.
-            for (double ratio = 0; ratio < 1.0e-4;) {
-
-                // save the state
-                for (int j = 0; j < solvedCols; ++j) {
-                    int pj = permutation[j];
-                    oldX[pj] = currentPoint[pj];
-                }
-                final double previousCost = currentCost;
-                double[] tmpVec = weightedResidual;
-                weightedResidual = oldRes;
-                oldRes    = tmpVec;
-                tmpVec    = currentObjective;
-                currentObjective = oldObj;
-                oldObj    = tmpVec;
-
-                // determine the Levenberg-Marquardt parameter
-                determineLMParameter(qtf, delta, diag, work1, work2, work3);
-
-                // compute the new point and the norm of the evolution direction
-                double lmNorm = 0;
-                for (int j = 0; j < solvedCols; ++j) {
-                    int pj = permutation[j];
-                    lmDir[pj] = -lmDir[pj];
-                    currentPoint[pj] = oldX[pj] + lmDir[pj];
-                    double s = diag[pj] * lmDir[pj];
-                    lmNorm  += s * s;
-                }
-                lmNorm = FastMath.sqrt(lmNorm);
-                // on the first iteration, adjust the initial step bound.
-                if (firstIteration) {
-                    delta = FastMath.min(delta, lmNorm);
-                }
-
-                // Evaluate the function at x + p and calculate its norm.
-                currentObjective = computeObjectiveValue(currentPoint);
-                currentResiduals = computeResiduals(currentObjective);
-                current = new PointVectorValuePair(currentPoint, currentObjective);
-                currentCost = computeCost(currentResiduals);
-
-                // compute the scaled actual reduction
-                double actRed = -1.0;
-                if (0.1 * currentCost < previousCost) {
-                    double r = currentCost / previousCost;
-                    actRed = 1.0 - r * r;
-                }
-
-                // compute the scaled predicted reduction
-                // and the scaled directional derivative
-                for (int j = 0; j < solvedCols; ++j) {
-                    int pj = permutation[j];
-                    double dirJ = lmDir[pj];
-                    work1[j] = 0;
-                    for (int i = 0; i <= j; ++i) {
-                        work1[i] += weightedJacobian[i][pj] * dirJ;
-                    }
-                }
-                double coeff1 = 0;
-                for (int j = 0; j < solvedCols; ++j) {
-                    coeff1 += work1[j] * work1[j];
-                }
-                double pc2 = previousCost * previousCost;
-                coeff1 /= pc2;
-                double coeff2 = lmPar * lmNorm * lmNorm / pc2;
-                double preRed = coeff1 + 2 * coeff2;
-                double dirDer = -(coeff1 + coeff2);
-
-                // ratio of the actual to the predicted reduction
-                ratio = (preRed == 0) ? 0 : (actRed / preRed);
-
-                // update the step bound
-                if (ratio <= 0.25) {
-                    double tmp =
-                        (actRed < 0) ? (0.5 * dirDer / (dirDer + 0.5 * actRed)) : 0.5;
-                        if ((0.1 * currentCost >= previousCost) || (tmp < 0.1)) {
-                            tmp = 0.1;
-                        }
-                        delta = tmp * FastMath.min(delta, 10.0 * lmNorm);
-                        lmPar /= tmp;
-                } else if ((lmPar == 0) || (ratio >= 0.75)) {
-                    delta = 2 * lmNorm;
-                    lmPar *= 0.5;
-                }
-
-                // test for successful iteration.
-                if (ratio >= 1.0e-4) {
-                    // successful iteration, update the norm
-                    firstIteration = false;
-                    xNorm = 0;
-                    for (int k = 0; k < nC; ++k) {
-                        double xK = diag[k] * currentPoint[k];
-                        xNorm += xK * xK;
-                    }
-                    xNorm = FastMath.sqrt(xNorm);
-
-                    // tests for convergence.
-                    if (checker != null && checker.converged(getIterations(), previous, current)) {
-                        setCost(currentCost);
-                        return current;
-                    }
-                } else {
-                    // failed iteration, reset the previous values
-                    currentCost = previousCost;
-                    for (int j = 0; j < solvedCols; ++j) {
-                        int pj = permutation[j];
-                        currentPoint[pj] = oldX[pj];
-                    }
-                    tmpVec    = weightedResidual;
-                    weightedResidual = oldRes;
-                    oldRes    = tmpVec;
-                    tmpVec    = currentObjective;
-                    currentObjective = oldObj;
-                    oldObj    = tmpVec;
-                    // Reset "current" to previous values.
-                    current = new PointVectorValuePair(currentPoint, currentObjective);
-                }
-
-                // Default convergence criteria.
-                if ((FastMath.abs(actRed) <= costRelativeTolerance &&
-                     preRed <= costRelativeTolerance &&
-                     ratio <= 2.0) ||
-                    delta <= parRelativeTolerance * xNorm) {
-                    setCost(currentCost);
-                    return current;
-                }
-
-                // tests for termination and stringent tolerances
-                if (FastMath.abs(actRed) <= TWO_EPS &&
-                    preRed <= TWO_EPS &&
-                    ratio <= 2.0) {
-                    throw new ConvergenceException(LocalizedFormats.TOO_SMALL_COST_RELATIVE_TOLERANCE,
-                                                   costRelativeTolerance);
-                } else if (delta <= TWO_EPS * xNorm) {
-                    throw new ConvergenceException(LocalizedFormats.TOO_SMALL_PARAMETERS_RELATIVE_TOLERANCE,
-                                                   parRelativeTolerance);
-                } else if (maxCosine <= TWO_EPS) {
-                    throw new ConvergenceException(LocalizedFormats.TOO_SMALL_ORTHOGONALITY_TOLERANCE,
-                                                   orthoTolerance);
-                }
-            }
-        }
-    }
-
-    /**
-     * Determine the Levenberg-Marquardt parameter.
-     * <p>This implementation is a translation in Java of the MINPACK
-     * <a href="http://www.netlib.org/minpack/lmpar.f">lmpar</a>
-     * routine.</p>
-     * <p>This method sets the lmPar and lmDir attributes.</p>
-     * <p>The authors of the original fortran function are:</p>
-     * <ul>
-     *   <li>Argonne National Laboratory. MINPACK project. March 1980</li>
-     *   <li>Burton  S. Garbow</li>
-     *   <li>Kenneth E. Hillstrom</li>
-     *   <li>Jorge   J. More</li>
-     * </ul>
-     * <p>Luc Maisonobe did the Java translation.</p>
-     *
-     * @param qy array containing qTy
-     * @param delta upper bound on the euclidean norm of diagR * lmDir
-     * @param diag diagonal matrix
-     * @param work1 work array
-     * @param work2 work array
-     * @param work3 work array
-     */
-    private void determineLMParameter(double[] qy, double delta, double[] diag,
-                                      double[] work1, double[] work2, double[] work3) {
-        final int nC = weightedJacobian[0].length;
-
-        // compute and store in x the gauss-newton direction, if the
-        // jacobian is rank-deficient, obtain a least squares solution
-        for (int j = 0; j < rank; ++j) {
-            lmDir[permutation[j]] = qy[j];
-        }
-        for (int j = rank; j < nC; ++j) {
-            lmDir[permutation[j]] = 0;
-        }
-        for (int k = rank - 1; k >= 0; --k) {
-            int pk = permutation[k];
-            double ypk = lmDir[pk] / diagR[pk];
-            for (int i = 0; i < k; ++i) {
-                lmDir[permutation[i]] -= ypk * weightedJacobian[i][pk];
-            }
-            lmDir[pk] = ypk;
-        }
-
-        // evaluate the function at the origin, and test
-        // for acceptance of the Gauss-Newton direction
-        double dxNorm = 0;
-        for (int j = 0; j < solvedCols; ++j) {
-            int pj = permutation[j];
-            double s = diag[pj] * lmDir[pj];
-            work1[pj] = s;
-            dxNorm += s * s;
-        }
-        dxNorm = FastMath.sqrt(dxNorm);
-        double fp = dxNorm - delta;
-        if (fp <= 0.1 * delta) {
-            lmPar = 0;
-            return;
-        }
-
-        // if the jacobian is not rank deficient, the Newton step provides
-        // a lower bound, parl, for the zero of the function,
-        // otherwise set this bound to zero
-        double sum2;
-        double parl = 0;
-        if (rank == solvedCols) {
-            for (int j = 0; j < solvedCols; ++j) {
-                int pj = permutation[j];
-                work1[pj] *= diag[pj] / dxNorm;
-            }
-            sum2 = 0;
-            for (int j = 0; j < solvedCols; ++j) {
-                int pj = permutation[j];
-                double sum = 0;
-                for (int i = 0; i < j; ++i) {
-                    sum += weightedJacobian[i][pj] * work1[permutation[i]];
-                }
-                double s = (work1[pj] - sum) / diagR[pj];
-                work1[pj] = s;
-                sum2 += s * s;
-            }
-            parl = fp / (delta * sum2);
-        }
-
-        // calculate an upper bound, paru, for the zero of the function
-        sum2 = 0;
-        for (int j = 0; j < solvedCols; ++j) {
-            int pj = permutation[j];
-            double sum = 0;
-            for (int i = 0; i <= j; ++i) {
-                sum += weightedJacobian[i][pj] * qy[i];
-            }
-            sum /= diag[pj];
-            sum2 += sum * sum;
-        }
-        double gNorm = FastMath.sqrt(sum2);
-        double paru = gNorm / delta;
-        if (paru == 0) {
-            paru = Precision.SAFE_MIN / FastMath.min(delta, 0.1);
-        }
-
-        // if the input par lies outside of the interval (parl,paru),
-        // set par to the closer endpoint
-        lmPar = FastMath.min(paru, FastMath.max(lmPar, parl));
-        if (lmPar == 0) {
-            lmPar = gNorm / dxNorm;
-        }
-
-        for (int countdown = 10; countdown >= 0; --countdown) {
-
-            // evaluate the function at the current value of lmPar
-            if (lmPar == 0) {
-                lmPar = FastMath.max(Precision.SAFE_MIN, 0.001 * paru);
-            }
-            double sPar = FastMath.sqrt(lmPar);
-            for (int j = 0; j < solvedCols; ++j) {
-                int pj = permutation[j];
-                work1[pj] = sPar * diag[pj];
-            }
-            determineLMDirection(qy, work1, work2, work3);
-
-            dxNorm = 0;
-            for (int j = 0; j < solvedCols; ++j) {
-                int pj = permutation[j];
-                double s = diag[pj] * lmDir[pj];
-                work3[pj] = s;
-                dxNorm += s * s;
-            }
-            dxNorm = FastMath.sqrt(dxNorm);
-            double previousFP = fp;
-            fp = dxNorm - delta;
-
-            // if the function is small enough, accept the current value
-            // of lmPar, also test for the exceptional cases where parl is zero
-            if ((FastMath.abs(fp) <= 0.1 * delta) ||
-                    ((parl == 0) && (fp <= previousFP) && (previousFP < 0))) {
-                return;
-            }
-
-            // compute the Newton correction
-            for (int j = 0; j < solvedCols; ++j) {
-                int pj = permutation[j];
-                work1[pj] = work3[pj] * diag[pj] / dxNorm;
-            }
-            for (int j = 0; j < solvedCols; ++j) {
-                int pj = permutation[j];
-                work1[pj] /= work2[j];
-                double tmp = work1[pj];
-                for (int i = j + 1; i < solvedCols; ++i) {
-                    work1[permutation[i]] -= weightedJacobian[i][pj] * tmp;
-                }
-            }
-            sum2 = 0;
-            for (int j = 0; j < solvedCols; ++j) {
-                double s = work1[permutation[j]];
-                sum2 += s * s;
-            }
-            double correction = fp / (delta * sum2);
-
-            // depending on the sign of the function, update parl or paru.
-            if (fp > 0) {
-                parl = FastMath.max(parl, lmPar);
-            } else if (fp < 0) {
-                paru = FastMath.min(paru, lmPar);
-            }
-
-            // compute an improved estimate for lmPar
-            lmPar = FastMath.max(parl, lmPar + correction);
-
-        }
-    }
-
-    /**
-     * Solve a*x = b and d*x = 0 in the least squares sense.
-     * <p>This implementation is a translation in Java of the MINPACK
-     * <a href="http://www.netlib.org/minpack/qrsolv.f">qrsolv</a>
-     * routine.</p>
-     * <p>This method sets the lmDir and lmDiag attributes.</p>
-     * <p>The authors of the original fortran function are:</p>
-     * <ul>
-     *   <li>Argonne National Laboratory. MINPACK project. March 1980</li>
-     *   <li>Burton  S. Garbow</li>
-     *   <li>Kenneth E. Hillstrom</li>
-     *   <li>Jorge   J. More</li>
-     * </ul>
-     * <p>Luc Maisonobe did the Java translation.</p>
-     *
-     * @param qy array containing qTy
-     * @param diag diagonal matrix
-     * @param lmDiag diagonal elements associated with lmDir
-     * @param work work array
-     */
-    private void determineLMDirection(double[] qy, double[] diag,
-                                      double[] lmDiag, double[] work) {
-
-        // copy R and Qty to preserve input and initialize s
-        //  in particular, save the diagonal elements of R in lmDir
-        for (int j = 0; j < solvedCols; ++j) {
-            int pj = permutation[j];
-            for (int i = j + 1; i < solvedCols; ++i) {
-                weightedJacobian[i][pj] = weightedJacobian[j][permutation[i]];
-            }
-            lmDir[j] = diagR[pj];
-            work[j]  = qy[j];
-        }
-
-        // eliminate the diagonal matrix d using a Givens rotation
-        for (int j = 0; j < solvedCols; ++j) {
-
-            // prepare the row of d to be eliminated, locating the
-            // diagonal element using p from the Q.R. factorization
-            int pj = permutation[j];
-            double dpj = diag[pj];
-            if (dpj != 0) {
-                Arrays.fill(lmDiag, j + 1, lmDiag.length, 0);
-            }
-            lmDiag[j] = dpj;
-
-            //  the transformations to eliminate the row of d
-            // modify only a single element of Qty
-            // beyond the first n, which is initially zero.
-            double qtbpj = 0;
-            for (int k = j; k < solvedCols; ++k) {
-                int pk = permutation[k];
-
-                // determine a Givens rotation which eliminates the
-                // appropriate element in the current row of d
-                if (lmDiag[k] != 0) {
-
-                    final double sin;
-                    final double cos;
-                    double rkk = weightedJacobian[k][pk];
-                    if (FastMath.abs(rkk) < FastMath.abs(lmDiag[k])) {
-                        final double cotan = rkk / lmDiag[k];
-                        sin   = 1.0 / FastMath.sqrt(1.0 + cotan * cotan);
-                        cos   = sin * cotan;
-                    } else {
-                        final double tan = lmDiag[k] / rkk;
-                        cos = 1.0 / FastMath.sqrt(1.0 + tan * tan);
-                        sin = cos * tan;
-                    }
-
-                    // compute the modified diagonal element of R and
-                    // the modified element of (Qty,0)
-                    weightedJacobian[k][pk] = cos * rkk + sin * lmDiag[k];
-                    final double temp = cos * work[k] + sin * qtbpj;
-                    qtbpj = -sin * work[k] + cos * qtbpj;
-                    work[k] = temp;
-
-                    // accumulate the tranformation in the row of s
-                    for (int i = k + 1; i < solvedCols; ++i) {
-                        double rik = weightedJacobian[i][pk];
-                        final double temp2 = cos * rik + sin * lmDiag[i];
-                        lmDiag[i] = -sin * rik + cos * lmDiag[i];
-                        weightedJacobian[i][pk] = temp2;
-                    }
-                }
-            }
-
-            // store the diagonal element of s and restore
-            // the corresponding diagonal element of R
-            lmDiag[j] = weightedJacobian[j][permutation[j]];
-            weightedJacobian[j][permutation[j]] = lmDir[j];
-        }
-
-        // solve the triangular system for z, if the system is
-        // singular, then obtain a least squares solution
-        int nSing = solvedCols;
-        for (int j = 0; j < solvedCols; ++j) {
-            if ((lmDiag[j] == 0) && (nSing == solvedCols)) {
-                nSing = j;
-            }
-            if (nSing < solvedCols) {
-                work[j] = 0;
-            }
-        }
-        if (nSing > 0) {
-            for (int j = nSing - 1; j >= 0; --j) {
-                int pj = permutation[j];
-                double sum = 0;
-                for (int i = j + 1; i < nSing; ++i) {
-                    sum += weightedJacobian[i][pj] * work[i];
-                }
-                work[j] = (work[j] - sum) / lmDiag[j];
-            }
-        }
-
-        // permute the components of z back to components of lmDir
-        for (int j = 0; j < lmDir.length; ++j) {
-            lmDir[permutation[j]] = work[j];
-        }
-    }
-
-    /**
-     * Decompose a matrix A as A.P = Q.R using Householder transforms.
-     * <p>As suggested in the P. Lascaux and R. Theodor book
-     * <i>Analyse num&eacute;rique matricielle appliqu&eacute;e &agrave;
-     * l'art de l'ing&eacute;nieur</i> (Masson, 1986), instead of representing
-     * the Householder transforms with u<sub>k</sub> unit vectors such that:
-     * <pre>
-     * H<sub>k</sub> = I - 2u<sub>k</sub>.u<sub>k</sub><sup>t</sup>
-     * </pre>
-     * we use <sub>k</sub> non-unit vectors such that:
-     * <pre>
-     * H<sub>k</sub> = I - beta<sub>k</sub>v<sub>k</sub>.v<sub>k</sub><sup>t</sup>
-     * </pre>
-     * where v<sub>k</sub> = a<sub>k</sub> - alpha<sub>k</sub> e<sub>k</sub>.
-     * The beta<sub>k</sub> coefficients are provided upon exit as recomputing
-     * them from the v<sub>k</sub> vectors would be costly.</p>
-     * <p>This decomposition handles rank deficient cases since the tranformations
-     * are performed in non-increasing columns norms order thanks to columns
-     * pivoting. The diagonal elements of the R matrix are therefore also in
-     * non-increasing absolute values order.</p>
-     *
-     * @param jacobian Weighted Jacobian matrix at the current point.
-     * @exception ConvergenceException if the decomposition cannot be performed
-     */
-    private void qrDecomposition(RealMatrix jacobian) throws ConvergenceException {
-        // Code in this class assumes that the weighted Jacobian is -(W^(1/2) J),
-        // hence the multiplication by -1.
-        weightedJacobian = jacobian.scalarMultiply(-1).getData();
-
-        final int nR = weightedJacobian.length;
-        final int nC = weightedJacobian[0].length;
-
-        // initializations
-        for (int k = 0; k < nC; ++k) {
-            permutation[k] = k;
-            double norm2 = 0;
-            for (int i = 0; i < nR; ++i) {
-                double akk = weightedJacobian[i][k];
-                norm2 += akk * akk;
-            }
-            jacNorm[k] = FastMath.sqrt(norm2);
-        }
-
-        // transform the matrix column after column
-        for (int k = 0; k < nC; ++k) {
-
-            // select the column with the greatest norm on active components
-            int nextColumn = -1;
-            double ak2 = Double.NEGATIVE_INFINITY;
-            for (int i = k; i < nC; ++i) {
-                double norm2 = 0;
-                for (int j = k; j < nR; ++j) {
-                    double aki = weightedJacobian[j][permutation[i]];
-                    norm2 += aki * aki;
-                }
-                if (Double.isInfinite(norm2) || Double.isNaN(norm2)) {
-                    throw new ConvergenceException(LocalizedFormats.UNABLE_TO_PERFORM_QR_DECOMPOSITION_ON_JACOBIAN,
-                                                   nR, nC);
-                }
-                if (norm2 > ak2) {
-                    nextColumn = i;
-                    ak2        = norm2;
-                }
-            }
-            if (ak2 <= qrRankingThreshold) {
-                rank = k;
-                return;
-            }
-            int pk                  = permutation[nextColumn];
-            permutation[nextColumn] = permutation[k];
-            permutation[k]          = pk;
-
-            // choose alpha such that Hk.u = alpha ek
-            double akk   = weightedJacobian[k][pk];
-            double alpha = (akk > 0) ? -FastMath.sqrt(ak2) : FastMath.sqrt(ak2);
-            double betak = 1.0 / (ak2 - akk * alpha);
-            beta[pk]     = betak;
-
-            // transform the current column
-            diagR[pk]        = alpha;
-            weightedJacobian[k][pk] -= alpha;
-
-            // transform the remaining columns
-            for (int dk = nC - 1 - k; dk > 0; --dk) {
-                double gamma = 0;
-                for (int j = k; j < nR; ++j) {
-                    gamma += weightedJacobian[j][pk] * weightedJacobian[j][permutation[k + dk]];
-                }
-                gamma *= betak;
-                for (int j = k; j < nR; ++j) {
-                    weightedJacobian[j][permutation[k + dk]] -= gamma * weightedJacobian[j][pk];
-                }
-            }
-        }
-        rank = solvedCols;
-    }
-
-    /**
-     * Compute the product Qt.y for some Q.R. decomposition.
-     *
-     * @param y vector to multiply (will be overwritten with the result)
-     */
-    private void qTy(double[] y) {
-        final int nR = weightedJacobian.length;
-        final int nC = weightedJacobian[0].length;
-
-        for (int k = 0; k < nC; ++k) {
-            int pk = permutation[k];
-            double gamma = 0;
-            for (int i = k; i < nR; ++i) {
-                gamma += weightedJacobian[i][pk] * y[i];
-            }
-            gamma *= beta[pk];
-            for (int i = k; i < nR; ++i) {
-                y[i] -= gamma * weightedJacobian[i][pk];
-            }
-        }
-    }
-
-    /**
-     * @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);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/0737cf82/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/package-info.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/package-info.java
deleted file mode 100644
index ab06a53..0000000
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/package-info.java
+++ /dev/null
@@ -1,26 +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.
- */
-
-/**
- * This package provides optimization algorithms that require derivatives.
- *
- * @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).
- */
-package org.apache.commons.math4.optim.nonlinear.vector.jacobian;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/0737cf82/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/package-info.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/package-info.java
deleted file mode 100644
index 91ac3ff..0000000
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/package-info.java
+++ /dev/null
@@ -1,26 +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.
- */
-
-/**
- * Algorithms for optimizing a vector function.
- *
- * @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).
- */
-package org.apache.commons.math4.optim.nonlinear.vector;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/0737cf82/src/main/java/org/apache/commons/math4/optim/univariate/MultiStartUnivariateOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/univariate/MultiStartUnivariateOptimizer.java b/src/main/java/org/apache/commons/math4/optim/univariate/MultiStartUnivariateOptimizer.java
index cbfa268..c8a59e9 100644
--- a/src/main/java/org/apache/commons/math4/optim/univariate/MultiStartUnivariateOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optim/univariate/MultiStartUnivariateOptimizer.java
@@ -45,9 +45,9 @@ public class MultiStartUnivariateOptimizer
     /** Number of evaluations already performed for all starts. */
     private int totalEvaluations;
     /** Number of starts to go. */
-    private int starts;
+    private final int starts;
     /** Random generator for multi-start. */
-    private RandomGenerator generator;
+    private final RandomGenerator generator;
     /** Found optima. */
     private UnivariatePointValuePair[] optima;
     /** Optimization data. */
@@ -211,6 +211,7 @@ public class MultiStartUnivariateOptimizer
      */
     private void sortPairs(final GoalType goal) {
         Arrays.sort(optima, new Comparator<UnivariatePointValuePair>() {
+                @Override
                 public int compare(final UnivariatePointValuePair o1,
                                    final UnivariatePointValuePair o2) {
                     if (o1 == null) {


[4/5] [math] Remove deprecated classes in optim package.

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e31fde87/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/LevenbergMarquardtOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/LevenbergMarquardtOptimizerTest.java b/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/LevenbergMarquardtOptimizerTest.java
deleted file mode 100644
index 641f4d4..0000000
--- a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/LevenbergMarquardtOptimizerTest.java
+++ /dev/null
@@ -1,375 +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 java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.math4.analysis.MultivariateMatrixFunction;
-import org.apache.commons.math4.analysis.MultivariateVectorFunction;
-import org.apache.commons.math4.exception.DimensionMismatchException;
-import org.apache.commons.math4.exception.MathUnsupportedOperationException;
-import org.apache.commons.math4.exception.TooManyEvaluationsException;
-import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math4.linear.SingularMatrixException;
-import org.apache.commons.math4.optim.InitialGuess;
-import org.apache.commons.math4.optim.MaxEval;
-import org.apache.commons.math4.optim.PointVectorValuePair;
-import org.apache.commons.math4.optim.SimpleBounds;
-import org.apache.commons.math4.optim.nonlinear.vector.ModelFunction;
-import org.apache.commons.math4.optim.nonlinear.vector.ModelFunctionJacobian;
-import org.apache.commons.math4.optim.nonlinear.vector.Target;
-import org.apache.commons.math4.optim.nonlinear.vector.Weight;
-import org.apache.commons.math4.optim.nonlinear.vector.jacobian.AbstractLeastSquaresOptimizer;
-import org.apache.commons.math4.optim.nonlinear.vector.jacobian.LevenbergMarquardtOptimizer;
-import org.apache.commons.math4.util.FastMath;
-import org.apache.commons.math4.util.Precision;
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- * <p>Some of the unit tests are re-implementations of the MINPACK <a
- * href="http://www.netlib.org/minpack/ex/file17">file17</a> and <a
- * href="http://www.netlib.org/minpack/ex/file22">file22</a> test files.
- * The redistribution policy for MINPACK is available <a
- * href="http://www.netlib.org/minpack/disclaimer">here</a>, for
- * convenience, it is reproduced below.</p>
-
- * <table border="0" width="80%" cellpadding="10" align="center" bgcolor="#E0E0E0">
- * <tr><td>
- *    Minpack Copyright Notice (1999) University of Chicago.
- *    All rights reserved
- * </td></tr>
- * <tr><td>
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * <ol>
- *  <li>Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.</li>
- * <li>Redistributions in binary form must reproduce the above
- *     copyright notice, this list of conditions and the following
- *     disclaimer in the documentation and/or other materials provided
- *     with the distribution.</li>
- * <li>The end-user documentation included with the redistribution, if any,
- *     must include the following acknowledgment:
- *     <code>This product includes software developed by the University of
- *           Chicago, as Operator of Argonne National Laboratory.</code>
- *     Alternately, this acknowledgment may appear in the software itself,
- *     if and wherever such third-party acknowledgments normally appear.</li>
- * <li><strong>WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS"
- *     WITHOUT WARRANTY OF ANY KIND. THE COPYRIGHT HOLDER, THE
- *     UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND
- *     THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR
- *     IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES
- *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE
- *     OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL LIABILITY
- *     OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR
- *     USEFULNESS OF THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF
- *     THE SOFTWARE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS, (4)
- *     DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION
- *     UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL
- *     BE CORRECTED.</strong></li>
- * <li><strong>LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT
- *     HOLDER, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF
- *     ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT,
- *     INCIDENTAL, CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF
- *     ANY KIND OR NATURE, INCLUDING BUT NOT LIMITED TO LOSS OF
- *     PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, WHETHER
- *     SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT
- *     (INCLUDING NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE,
- *     EVEN IF ANY OF SAID PARTIES HAS BEEN WARNED OF THE
- *     POSSIBILITY OF SUCH LOSS OR DAMAGES.</strong></li>
- * <ol></td></tr>
- * </table>
-
- * @author Argonne National Laboratory. MINPACK project. March 1980 (original fortran minpack tests)
- * @author Burton S. Garbow (original fortran minpack tests)
- * @author Kenneth E. Hillstrom (original fortran minpack tests)
- * @author Jorge J. More (original fortran minpack tests)
- * @author Luc Maisonobe (non-minpack tests and minpack tests Java translation)
- */
-@Deprecated
-public class LevenbergMarquardtOptimizerTest
-    extends AbstractLeastSquaresOptimizerAbstractTest {
-    @Override
-    public AbstractLeastSquaresOptimizer createOptimizer() {
-        return new LevenbergMarquardtOptimizer();
-    }
-
-    @Test(expected=MathUnsupportedOperationException.class)
-    public void testConstraintsUnsupported() {
-        createOptimizer().optimize(new MaxEval(100),
-                                   new Target(new double[] { 2 }),
-                                   new Weight(new double[] { 1 }),
-                                   new InitialGuess(new double[] { 1, 2 }),
-                                   new SimpleBounds(new double[] { -10, 0 },
-                                                    new double[] { 20, 30 }));
-    }
-
-    @Override
-    @Test(expected=SingularMatrixException.class)
-    public void testNonInvertible() {
-        /*
-         * Overrides the method from parent class, since the default singularity
-         * threshold (1e-14) does not trigger the expected exception.
-         */
-        LinearProblem problem = new LinearProblem(new double[][] {
-                {  1, 2, -3 },
-                {  2, 1,  3 },
-                { -3, 0, -9 }
-        }, new double[] { 1, 1, 1 });
-
-        AbstractLeastSquaresOptimizer optimizer = createOptimizer();
-        PointVectorValuePair optimum
-            = optimizer.optimize(new MaxEval(100),
-                                 problem.getModelFunction(),
-                                 problem.getModelFunctionJacobian(),
-                                 problem.getTarget(),
-                                 new Weight(new double[] { 1, 1, 1 }),
-                                 new InitialGuess(new double[] { 0, 0, 0 }));
-        Assert.assertTrue(FastMath.sqrt(optimizer.getTargetSize()) * optimizer.getRMS() > 0.6);
-
-        optimizer.computeCovariances(optimum.getPoint(), 1.5e-14);
-    }
-
-    @Test
-    public void testControlParameters() {
-        CircleVectorial circle = new CircleVectorial();
-        circle.addPoint( 30.0,  68.0);
-        circle.addPoint( 50.0,  -6.0);
-        circle.addPoint(110.0, -20.0);
-        circle.addPoint( 35.0,  15.0);
-        circle.addPoint( 45.0,  97.0);
-        checkEstimate(circle.getModelFunction(),
-                      circle.getModelFunctionJacobian(),
-                      0.1, 10, 1.0e-14, 1.0e-16, 1.0e-10, false);
-        checkEstimate(circle.getModelFunction(),
-                      circle.getModelFunctionJacobian(),
-                      0.1, 10, 1.0e-15, 1.0e-17, 1.0e-10, true);
-        checkEstimate(circle.getModelFunction(),
-                      circle.getModelFunctionJacobian(),
-                      0.1,  5, 1.0e-15, 1.0e-16, 1.0e-10, true);
-        circle.addPoint(300, -300);
-        checkEstimate(circle.getModelFunction(),
-                      circle.getModelFunctionJacobian(),
-                      0.1, 20, 1.0e-18, 1.0e-16, 1.0e-10, true);
-    }
-
-    private void checkEstimate(ModelFunction problem,
-                               ModelFunctionJacobian problemJacobian,
-                               double initialStepBoundFactor, int maxCostEval,
-                               double costRelativeTolerance, double parRelativeTolerance,
-                               double orthoTolerance, boolean shouldFail) {
-        try {
-            LevenbergMarquardtOptimizer optimizer
-                = new LevenbergMarquardtOptimizer(initialStepBoundFactor,
-                                                  costRelativeTolerance,
-                                                  parRelativeTolerance,
-                                                  orthoTolerance,
-                                                  Precision.SAFE_MIN);
-            optimizer.optimize(new MaxEval(maxCostEval),
-                               problem,
-                               problemJacobian,
-                               new Target(new double[] { 0, 0, 0, 0, 0 }),
-                               new Weight(new double[] { 1, 1, 1, 1, 1 }),
-                               new InitialGuess(new double[] { 98.680, 47.345 }));
-            Assert.assertTrue(!shouldFail);
-        } catch (DimensionMismatchException ee) {
-            Assert.assertTrue(shouldFail);
-        } catch (TooManyEvaluationsException ee) {
-            Assert.assertTrue(shouldFail);
-        }
-    }
-
-    /**
-     * Non-linear test case: fitting of decay curve (from Chapter 8 of
-     * Bevington's textbook, "Data reduction and analysis for the physical sciences").
-     * XXX The expected ("reference") values may not be accurate and the tolerance too
-     * relaxed for this test to be currently really useful (the issue is under
-     * investigation).
-     */
-    @Test
-    public void testBevington() {
-        final double[][] dataPoints = {
-            // column 1 = times
-            { 15, 30, 45, 60, 75, 90, 105, 120, 135, 150,
-              165, 180, 195, 210, 225, 240, 255, 270, 285, 300,
-              315, 330, 345, 360, 375, 390, 405, 420, 435, 450,
-              465, 480, 495, 510, 525, 540, 555, 570, 585, 600,
-              615, 630, 645, 660, 675, 690, 705, 720, 735, 750,
-              765, 780, 795, 810, 825, 840, 855, 870, 885, },
-            // column 2 = measured counts
-            { 775, 479, 380, 302, 185, 157, 137, 119, 110, 89,
-              74, 61, 66, 68, 48, 54, 51, 46, 55, 29,
-              28, 37, 49, 26, 35, 29, 31, 24, 25, 35,
-              24, 30, 26, 28, 21, 18, 20, 27, 17, 17,
-              14, 17, 24, 11, 22, 17, 12, 10, 13, 16,
-              9, 9, 14, 21, 17, 13, 12, 18, 10, },
-        };
-
-        final BevingtonProblem problem = new BevingtonProblem();
-
-        final int len = dataPoints[0].length;
-        final double[] weights = new double[len];
-        for (int i = 0; i < len; i++) {
-            problem.addPoint(dataPoints[0][i],
-                             dataPoints[1][i]);
-
-            weights[i] = 1 / dataPoints[1][i];
-        }
-
-        final LevenbergMarquardtOptimizer optimizer
-            = new LevenbergMarquardtOptimizer();
-
-        final PointVectorValuePair optimum
-            = optimizer.optimize(new MaxEval(100),
-                                 problem.getModelFunction(),
-                                 problem.getModelFunctionJacobian(),
-                                 new Target(dataPoints[1]),
-                                 new Weight(weights),
-                                 new InitialGuess(new double[] { 10, 900, 80, 27, 225 }));
-
-        final double[] solution = optimum.getPoint();
-        final double[] expectedSolution = { 10.4, 958.3, 131.4, 33.9, 205.0 };
-
-        final double[][] covarMatrix = optimizer.computeCovariances(solution, 1e-14);
-        final double[][] expectedCovarMatrix = {
-            { 3.38, -3.69, 27.98, -2.34, -49.24 },
-            { -3.69, 2492.26, 81.89, -69.21, -8.9 },
-            { 27.98, 81.89, 468.99, -44.22, -615.44 },
-            { -2.34, -69.21, -44.22, 6.39, 53.80 },
-            { -49.24, -8.9, -615.44, 53.8, 929.45 }
-        };
-
-        final int numParams = expectedSolution.length;
-
-        // Check that the computed solution is within the reference error range.
-        for (int i = 0; i < numParams; i++) {
-            final double error = FastMath.sqrt(expectedCovarMatrix[i][i]);
-            Assert.assertEquals("Parameter " + i, expectedSolution[i], solution[i], error);
-        }
-
-        // Check that each entry of the computed covariance matrix is within 10%
-        // of the reference matrix entry.
-        for (int i = 0; i < numParams; i++) {
-            for (int j = 0; j < numParams; j++) {
-                Assert.assertEquals("Covariance matrix [" + i + "][" + j + "]",
-                                    expectedCovarMatrix[i][j],
-                                    covarMatrix[i][j],
-                                    FastMath.abs(0.1 * expectedCovarMatrix[i][j]));
-            }
-        }
-    }
-
-    @Test
-    public void testCircleFitting2() {
-        final double xCenter = 123.456;
-        final double yCenter = 654.321;
-        final double xSigma = 10;
-        final double ySigma = 15;
-        final double radius = 111.111;
-        // The test is extremely sensitive to the seed.
-        final long seed = 59421061L;
-        final RandomCirclePointGenerator factory
-            = new RandomCirclePointGenerator(xCenter, yCenter, radius,
-                                             xSigma, ySigma,
-                                             seed);
-        final CircleProblem circle = new CircleProblem(xSigma, ySigma);
-
-        final int numPoints = 10;
-        for (Vector2D p : factory.generate(numPoints)) {
-            circle.addPoint(p.getX(), p.getY());
-        }
-
-        // First guess for the center's coordinates and radius.
-        final double[] init = { 90, 659, 115 };
-
-        final LevenbergMarquardtOptimizer optimizer
-            = new LevenbergMarquardtOptimizer();
-        final PointVectorValuePair optimum = optimizer.optimize(new MaxEval(100),
-                                                                circle.getModelFunction(),
-                                                                circle.getModelFunctionJacobian(),
-                                                                new Target(circle.target()),
-                                                                new Weight(circle.weight()),
-                                                                new InitialGuess(init));
-
-        final double[] paramFound = optimum.getPoint();
-
-        // Retrieve errors estimation.
-        final double[] asymptoticStandardErrorFound = optimizer.computeSigma(paramFound, 1e-14);
-
-        // Check that the parameters are found within the assumed error bars.
-        Assert.assertEquals(xCenter, paramFound[0], asymptoticStandardErrorFound[0]);
-        Assert.assertEquals(yCenter, paramFound[1], asymptoticStandardErrorFound[1]);
-        Assert.assertEquals(radius, paramFound[2], asymptoticStandardErrorFound[2]);
-    }
-
-    private static class BevingtonProblem {
-        private List<Double> time;
-        private List<Double> count;
-
-        public BevingtonProblem() {
-            time = new ArrayList<Double>();
-            count = new ArrayList<Double>();
-        }
-
-        public void addPoint(double t, double c) {
-            time.add(t);
-            count.add(c);
-        }
-
-        public ModelFunction getModelFunction() {
-            return new ModelFunction(new MultivariateVectorFunction() {
-                    public double[] value(double[] params) {
-                        double[] values = new double[time.size()];
-                        for (int i = 0; i < values.length; ++i) {
-                            final double t = time.get(i);
-                            values[i] = params[0] +
-                                params[1] * FastMath.exp(-t / params[3]) +
-                                params[2] * FastMath.exp(-t / params[4]);
-                        }
-                        return values;
-                    }
-                });
-        }
-
-        public ModelFunctionJacobian getModelFunctionJacobian() {
-            return new ModelFunctionJacobian(new MultivariateMatrixFunction() {
-                    public double[][] value(double[] params) {
-                        double[][] jacobian = new double[time.size()][5];
-
-                        for (int i = 0; i < jacobian.length; ++i) {
-                            final double t = time.get(i);
-                            jacobian[i][0] = 1;
-
-                            final double p3 =  params[3];
-                            final double p4 =  params[4];
-                            final double tOp3 = t / p3;
-                            final double tOp4 = t / p4;
-                            jacobian[i][1] = FastMath.exp(-tOp3);
-                            jacobian[i][2] = FastMath.exp(-tOp4);
-                            jacobian[i][3] = params[1] * FastMath.exp(-tOp3) * tOp3 / p3;
-                            jacobian[i][4] = params[2] * FastMath.exp(-tOp4) * tOp4 / p4;
-                        }
-                        return jacobian;
-                    }
-                });
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e31fde87/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/MinpackTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/MinpackTest.java b/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/MinpackTest.java
deleted file mode 100644
index c3486c0..0000000
--- a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/MinpackTest.java
+++ /dev/null
@@ -1,1467 +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 java.util.Arrays;
-
-import org.apache.commons.math4.analysis.MultivariateMatrixFunction;
-import org.apache.commons.math4.analysis.MultivariateVectorFunction;
-import org.apache.commons.math4.exception.TooManyEvaluationsException;
-import org.apache.commons.math4.optim.InitialGuess;
-import org.apache.commons.math4.optim.MaxEval;
-import org.apache.commons.math4.optim.PointVectorValuePair;
-import org.apache.commons.math4.optim.nonlinear.vector.ModelFunction;
-import org.apache.commons.math4.optim.nonlinear.vector.ModelFunctionJacobian;
-import org.apache.commons.math4.optim.nonlinear.vector.Target;
-import org.apache.commons.math4.optim.nonlinear.vector.Weight;
-import org.apache.commons.math4.optim.nonlinear.vector.jacobian.LevenbergMarquardtOptimizer;
-import org.apache.commons.math4.util.FastMath;
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- * <p>Some of the unit tests are re-implementations of the MINPACK <a
- * href="http://www.netlib.org/minpack/ex/file17">file17</a> and <a
- * href="http://www.netlib.org/minpack/ex/file22">file22</a> test files.
- * The redistribution policy for MINPACK is available <a
- * href="http://www.netlib.org/minpack/disclaimer">here</a>, for
- * convenience, it is reproduced below.</p>
-
- * <table border="0" width="80%" cellpadding="10" align="center" bgcolor="#E0E0E0">
- * <tr><td>
- *    Minpack Copyright Notice (1999) University of Chicago.
- *    All rights reserved
- * </td></tr>
- * <tr><td>
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * <ol>
- *  <li>Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.</li>
- * <li>Redistributions in binary form must reproduce the above
- *     copyright notice, this list of conditions and the following
- *     disclaimer in the documentation and/or other materials provided
- *     with the distribution.</li>
- * <li>The end-user documentation included with the redistribution, if any,
- *     must include the following acknowledgment:
- *     <code>This product includes software developed by the University of
- *           Chicago, as Operator of Argonne National Laboratory.</code>
- *     Alternately, this acknowledgment may appear in the software itself,
- *     if and wherever such third-party acknowledgments normally appear.</li>
- * <li><strong>WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS"
- *     WITHOUT WARRANTY OF ANY KIND. THE COPYRIGHT HOLDER, THE
- *     UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND
- *     THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR
- *     IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES
- *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE
- *     OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL LIABILITY
- *     OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR
- *     USEFULNESS OF THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF
- *     THE SOFTWARE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS, (4)
- *     DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION
- *     UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL
- *     BE CORRECTED.</strong></li>
- * <li><strong>LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT
- *     HOLDER, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF
- *     ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT,
- *     INCIDENTAL, CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF
- *     ANY KIND OR NATURE, INCLUDING BUT NOT LIMITED TO LOSS OF
- *     PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, WHETHER
- *     SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT
- *     (INCLUDING NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE,
- *     EVEN IF ANY OF SAID PARTIES HAS BEEN WARNED OF THE
- *     POSSIBILITY OF SUCH LOSS OR DAMAGES.</strong></li>
- * <ol></td></tr>
- * </table>
-
- * @author Argonne National Laboratory. MINPACK project. March 1980 (original fortran minpack tests)
- * @author Burton S. Garbow (original fortran minpack tests)
- * @author Kenneth E. Hillstrom (original fortran minpack tests)
- * @author Jorge J. More (original fortran minpack tests)
- * @author Luc Maisonobe (non-minpack tests and minpack tests Java translation)
- */
-@Deprecated
-public class MinpackTest {
-
-    @Test
-    public void testMinpackLinearFullRank() {
-        minpackTest(new LinearFullRankFunction(10, 5, 1.0,
-                                               5.0, 2.23606797749979), false);
-        minpackTest(new LinearFullRankFunction(50, 5, 1.0,
-                                               8.06225774829855, 6.70820393249937), false);
-    }
-
-    @Test
-    public void testMinpackLinearRank1() {
-        minpackTest(new LinearRank1Function(10, 5, 1.0,
-                                            291.521868819476, 1.4638501094228), false);
-        minpackTest(new LinearRank1Function(50, 5, 1.0,
-                                            3101.60039334535, 3.48263016573496), false);
-    }
-
-    @Test
-    public void testMinpackLinearRank1ZeroColsAndRows() {
-        minpackTest(new LinearRank1ZeroColsAndRowsFunction(10, 5, 1.0), false);
-        minpackTest(new LinearRank1ZeroColsAndRowsFunction(50, 5, 1.0), false);
-    }
-
-    @Test
-    public void testMinpackRosenbrok() {
-        minpackTest(new RosenbrockFunction(new double[] { -1.2, 1.0 },
-                                           FastMath.sqrt(24.2)), false);
-        minpackTest(new RosenbrockFunction(new double[] { -12.0, 10.0 },
-                                           FastMath.sqrt(1795769.0)), false);
-        minpackTest(new RosenbrockFunction(new double[] { -120.0, 100.0 },
-                                           11.0 * FastMath.sqrt(169000121.0)), false);
-    }
-
-    @Test
-    public void testMinpackHelicalValley() {
-        minpackTest(new HelicalValleyFunction(new double[] { -1.0, 0.0, 0.0 },
-                                              50.0), false);
-        minpackTest(new HelicalValleyFunction(new double[] { -10.0, 0.0, 0.0 },
-                                              102.95630140987), false);
-        minpackTest(new HelicalValleyFunction(new double[] { -100.0, 0.0, 0.0},
-                                              991.261822123701), false);
-    }
-
-    @Test
-    public void testMinpackPowellSingular() {
-        minpackTest(new PowellSingularFunction(new double[] { 3.0, -1.0, 0.0, 1.0 },
-                                               14.6628782986152), false);
-        minpackTest(new PowellSingularFunction(new double[] { 30.0, -10.0, 0.0, 10.0 },
-                                               1270.9838708654), false);
-        minpackTest(new PowellSingularFunction(new double[] { 300.0, -100.0, 0.0, 100.0 },
-                                               126887.903284750), false);
-    }
-
-    @Test
-    public void testMinpackFreudensteinRoth() {
-        minpackTest(new FreudensteinRothFunction(new double[] { 0.5, -2.0 },
-                                                 20.0124960961895, 6.99887517584575,
-                                                 new double[] {
-                                                     11.4124844654993,
-                                                     -0.896827913731509
-                                                 }), false);
-        minpackTest(new FreudensteinRothFunction(new double[] { 5.0, -20.0 },
-                                                 12432.833948863, 6.9988751744895,
-                                                 new double[] {
-                                                     11.41300466147456,
-                                                     -0.896796038685959
-                                                 }), false);
-        minpackTest(new FreudensteinRothFunction(new double[] { 50.0, -200.0 },
-                                                 11426454.595762, 6.99887517242903,
-                                                 new double[] {
-                                                     11.412781785788564,
-                                                     -0.8968051074920405
-                                                 }), false);
-    }
-
-    @Test
-    public void testMinpackBard() {
-        minpackTest(new BardFunction(1.0, 6.45613629515967, 0.0906359603390466,
-                                     new double[] {
-                                         0.0824105765758334,
-                                         1.1330366534715,
-                                         2.34369463894115
-                                     }), false);
-        minpackTest(new BardFunction(10.0, 36.1418531596785, 4.17476870138539,
-                                     new double[] {
-                                         0.840666673818329,
-                                         -158848033.259565,
-                                         -164378671.653535
-                                     }), false);
-        minpackTest(new BardFunction(100.0, 384.114678637399, 4.17476870135969,
-                                     new double[] {
-                                         0.840666673867645,
-                                         -158946167.205518,
-                                         -164464906.857771
-                                     }), false);
-    }
-
-    @Test
-    public void testMinpackKowalikOsborne() {
-        minpackTest(new KowalikOsborneFunction(new double[] { 0.25, 0.39, 0.415, 0.39 },
-                                               0.0728915102882945,
-                                               0.017535837721129,
-                                               new double[] {
-                                                   0.192807810476249,
-                                                   0.191262653354071,
-                                                   0.123052801046931,
-                                                   0.136053221150517
-                                               }), false);
-        minpackTest(new KowalikOsborneFunction(new double[] { 2.5, 3.9, 4.15, 3.9 },
-                                               2.97937007555202,
-                                               0.032052192917937,
-                                               new double[] {
-                                                   728675.473768287,
-                                                   -14.0758803129393,
-                                                   -32977797.7841797,
-                                                   -20571594.1977912
-                                               }), false);
-        minpackTest(new KowalikOsborneFunction(new double[] { 25.0, 39.0, 41.5, 39.0 },
-                                               29.9590617016037,
-                                               0.0175364017658228,
-                                               new double[] {
-                                                   0.192948328597594,
-                                                   0.188053165007911,
-                                                   0.122430604321144,
-                                                   0.134575665392506
-                                               }), false);
-    }
-
-    @Test
-    public void testMinpackMeyer() {
-        minpackTest(new MeyerFunction(new double[] { 0.02, 4000.0, 250.0 },
-                                      41153.4665543031, 9.37794514651874,
-                                      new double[] {
-                                          0.00560963647102661,
-                                          6181.34634628659,
-                                          345.223634624144
-                                      }), false);
-        minpackTest(new MeyerFunction(new double[] { 0.2, 40000.0, 2500.0 },
-                                      4168216.89130846, 792.917871779501,
-                                      new double[] {
-                                          1.42367074157994e-11,
-                                          33695.7133432541,
-                                          901.268527953801
-                                      }), true);
-    }
-
-    @Test
-    public void testMinpackWatson() {
-        minpackTest(new WatsonFunction(6, 0.0,
-                                       5.47722557505166, 0.0478295939097601,
-                                       new double[] {
-                                           -0.0157249615083782, 1.01243488232965,
-                                           -0.232991722387673,  1.26043101102818,
-                                           -1.51373031394421,   0.99299727291842
-                                       }), false);
-        minpackTest(new WatsonFunction(6, 10.0,
-                                       6433.12578950026, 0.0478295939096951,
-                                       new double[] {
-                                           -0.0157251901386677, 1.01243485860105,
-                                           -0.232991545843829,  1.26042932089163,
-                                           -1.51372776706575,   0.99299573426328
-                                       }), false);
-        minpackTest(new WatsonFunction(6, 100.0,
-                                       674256.040605213, 0.047829593911544,
-                                       new double[] {
-                                           -0.0157247019712586, 1.01243490925658,
-                                           -0.232991922761641,  1.26043292929555,
-                                           -1.51373320452707,   0.99299901922322
-                                       }), false);
-        minpackTest(new WatsonFunction(9, 0.0,
-                                       5.47722557505166, 0.00118311459212420,
-                                       new double[] {
-                                           -0.153070644166722e-4, 0.999789703934597,
-                                           0.0147639634910978,   0.146342330145992,
-                                           1.00082109454817,    -2.61773112070507,
-                                           4.10440313943354,    -3.14361226236241,
-                                           1.05262640378759
-                                       }), false);
-        minpackTest(new WatsonFunction(9, 10.0,
-                                       12088.127069307, 0.00118311459212513,
-                                       new double[] {
-                                           -0.153071334849279e-4, 0.999789703941234,
-                                           0.0147639629786217,   0.146342334818836,
-                                           1.00082107321386,    -2.61773107084722,
-                                           4.10440307655564,    -3.14361222178686,
-                                           1.05262639322589
-                                       }), false);
-        minpackTest(new WatsonFunction(9, 100.0,
-                                       1269109.29043834, 0.00118311459212384,
-                                       new double[] {
-                                           -0.153069523352176e-4, 0.999789703958371,
-                                           0.0147639625185392,   0.146342341096326,
-                                           1.00082104729164,    -2.61773101573645,
-                                           4.10440301427286,    -3.14361218602503,
-                                           1.05262638516774
-                                       }), false);
-        minpackTest(new WatsonFunction(12, 0.0,
-                                       5.47722557505166, 0.217310402535861e-4,
-                                       new double[] {
-                                           -0.660266001396382e-8, 1.00000164411833,
-                                           -0.000563932146980154, 0.347820540050756,
-                                           -0.156731500244233,    1.05281515825593,
-                                           -3.24727109519451,     7.2884347837505,
-                                           -10.271848098614,       9.07411353715783,
-                                           -4.54137541918194,     1.01201187975044
-                                       }), false);
-        minpackTest(new WatsonFunction(12, 10.0,
-                                       19220.7589790951, 0.217310402518509e-4,
-                                       new double[] {
-                                           -0.663710223017410e-8, 1.00000164411787,
-                                           -0.000563932208347327, 0.347820540486998,
-                                           -0.156731503955652,    1.05281517654573,
-                                           -3.2472711515214,      7.28843489430665,
-                                           -10.2718482369638,      9.07411364383733,
-                                           -4.54137546533666,     1.01201188830857
-                                       }), false);
-        minpackTest(new WatsonFunction(12, 100.0,
-                                       2018918.04462367, 0.217310402539845e-4,
-                                       new double[] {
-                                           -0.663806046485249e-8, 1.00000164411786,
-                                           -0.000563932210324959, 0.347820540503588,
-                                           -0.156731504091375,    1.05281517718031,
-                                           -3.24727115337025,     7.28843489775302,
-                                           -10.2718482410813,      9.07411364688464,
-                                           -4.54137546660822,     1.0120118885369
-                                       }), false);
-    }
-
-    @Test
-    public void testMinpackBox3Dimensional() {
-        minpackTest(new Box3DimensionalFunction(10, new double[] { 0.0, 10.0, 20.0 },
-                                                32.1115837449572), false);
-    }
-
-    @Test
-    public void testMinpackJennrichSampson() {
-        minpackTest(new JennrichSampsonFunction(10, new double[] { 0.3, 0.4 },
-                                                64.5856498144943, 11.1517793413499,
-                                                new double[] {
-//                                                     0.2578330049, 0.257829976764542
-                                                    0.2578199266368004, 0.25782997676455244
-                                                }), false);
-    }
-
-    @Test
-    public void testMinpackBrownDennis() {
-        minpackTest(new BrownDennisFunction(20,
-                                            new double[] { 25.0, 5.0, -5.0, -1.0 },
-                                            2815.43839161816, 292.954288244866,
-                                            new double[] {
-                                                -11.59125141003, 13.2024883984741,
-                                                -0.403574643314272, 0.236736269844604
-                                            }), false);
-        minpackTest(new BrownDennisFunction(20,
-                                            new double[] { 250.0, 50.0, -50.0, -10.0 },
-                                            555073.354173069, 292.954270581415,
-                                            new double[] {
-                                                -11.5959274272203, 13.2041866926242,
-                                                -0.403417362841545, 0.236771143410386
-                                            }), false);
-        minpackTest(new BrownDennisFunction(20,
-                                            new double[] { 2500.0, 500.0, -500.0, -100.0 },
-                                            61211252.2338581, 292.954306151134,
-                                            new double[] {
-                                                -11.5902596937374, 13.2020628854665,
-                                                -0.403688070279258, 0.236665033746463
-                                            }), false);
-    }
-
-    @Test
-    public void testMinpackChebyquad() {
-        minpackTest(new ChebyquadFunction(1, 8, 1.0,
-                                          1.88623796907732, 1.88623796907732,
-                                          new double[] { 0.5 }), false);
-        minpackTest(new ChebyquadFunction(1, 8, 10.0,
-                                          5383344372.34005, 1.88424820499951,
-                                          new double[] { 0.9817314924684 }), false);
-        minpackTest(new ChebyquadFunction(1, 8, 100.0,
-                                          0.118088726698392e19, 1.88424820499347,
-                                          new double[] { 0.9817314852934 }), false);
-        minpackTest(new ChebyquadFunction(8, 8, 1.0,
-                                          0.196513862833975, 0.0593032355046727,
-                                          new double[] {
-                                              0.0431536648587336, 0.193091637843267,
-                                              0.266328593812698,  0.499999334628884,
-                                              0.500000665371116,  0.733671406187302,
-                                              0.806908362156733,  0.956846335141266
-                                          }), false);
-        minpackTest(new ChebyquadFunction(9, 9, 1.0,
-                                          0.16994993465202, 0.0,
-                                          new double[] {
-                                              0.0442053461357828, 0.199490672309881,
-                                              0.23561910847106,   0.416046907892598,
-                                              0.5,                0.583953092107402,
-                                              0.764380891528940,  0.800509327690119,
-                                              0.955794653864217
-                                          }), false);
-        minpackTest(new ChebyquadFunction(10, 10, 1.0,
-                                          0.183747831178711, 0.0806471004038253,
-                                          new double[] {
-                                              0.0596202671753563, 0.166708783805937,
-                                              0.239171018813509,  0.398885290346268,
-                                              0.398883667870681,  0.601116332129320,
-                                              0.60111470965373,   0.760828981186491,
-                                              0.833291216194063,  0.940379732824644
-                                          }), false);
-    }
-
-    @Test
-    public void testMinpackBrownAlmostLinear() {
-        minpackTest(new BrownAlmostLinearFunction(10, 0.5,
-                                                  16.5302162063499, 0.0,
-                                                  new double[] {
-                                                      0.979430303349862, 0.979430303349862,
-                                                      0.979430303349862, 0.979430303349862,
-                                                      0.979430303349862, 0.979430303349862,
-                                                      0.979430303349862, 0.979430303349862,
-                                                      0.979430303349862, 1.20569696650138
-                                                  }), false);
-        minpackTest(new BrownAlmostLinearFunction(10, 5.0,
-                                                  9765624.00089211, 0.0,
-                                                  new double[] {
-                                                      0.979430303349865, 0.979430303349865,
-                                                      0.979430303349865, 0.979430303349865,
-                                                      0.979430303349865, 0.979430303349865,
-                                                      0.979430303349865, 0.979430303349865,
-                                                      0.979430303349865, 1.20569696650135
-                                                  }), false);
-        minpackTest(new BrownAlmostLinearFunction(10, 50.0,
-                                                  0.9765625e17, 0.0,
-                                                  new double[] {
-                                                      1.0, 1.0, 1.0, 1.0, 1.0,
-                                                      1.0, 1.0, 1.0, 1.0, 1.0
-                                                  }), false);
-        minpackTest(new BrownAlmostLinearFunction(30, 0.5,
-                                                  83.476044467848, 0.0,
-                                                  new double[] {
-                                                      0.997754216442807, 0.997754216442807,
-                                                      0.997754216442807, 0.997754216442807,
-                                                      0.997754216442807, 0.997754216442807,
-                                                      0.997754216442807, 0.997754216442807,
-                                                      0.997754216442807, 0.997754216442807,
-                                                      0.997754216442807, 0.997754216442807,
-                                                      0.997754216442807, 0.997754216442807,
-                                                      0.997754216442807, 0.997754216442807,
-                                                      0.997754216442807, 0.997754216442807,
-                                                      0.997754216442807, 0.997754216442807,
-                                                      0.997754216442807, 0.997754216442807,
-                                                      0.997754216442807, 0.997754216442807,
-                                                      0.997754216442807, 0.997754216442807,
-                                                      0.997754216442807, 0.997754216442807,
-                                                      0.997754216442807, 1.06737350671578
-                                                  }), false);
-        minpackTest(new BrownAlmostLinearFunction(40, 0.5,
-                                                  128.026364472323, 0.0,
-                                                  new double[] {
-                                                      1.00000000000002, 1.00000000000002,
-                                                      1.00000000000002, 1.00000000000002,
-                                                      1.00000000000002, 1.00000000000002,
-                                                      1.00000000000002, 1.00000000000002,
-                                                      1.00000000000002, 1.00000000000002,
-                                                      1.00000000000002, 1.00000000000002,
-                                                      1.00000000000002, 1.00000000000002,
-                                                      1.00000000000002, 1.00000000000002,
-                                                      1.00000000000002, 1.00000000000002,
-                                                      1.00000000000002, 1.00000000000002,
-                                                      1.00000000000002, 1.00000000000002,
-                                                      1.00000000000002, 1.00000000000002,
-                                                      1.00000000000002, 1.00000000000002,
-                                                      1.00000000000002, 1.00000000000002,
-                                                      1.00000000000002, 1.00000000000002,
-                                                      1.00000000000002, 1.00000000000002,
-                                                      1.00000000000002, 1.00000000000002,
-                                                      0.999999999999121
-                                                  }), false);
-    }
-
-    @Test
-    public void testMinpackOsborne1() {
-        minpackTest(new Osborne1Function(new double[] { 0.5, 1.5, -1.0, 0.01, 0.02, },
-                                         0.937564021037838, 0.00739249260904843,
-                                         new double[] {
-                                             0.375410049244025, 1.93584654543108,
-                                             -1.46468676748716, 0.0128675339110439,
-                                             0.0221227011813076
-                                         }), false);
-    }
-
-    @Test
-    public void testMinpackOsborne2() {
-        minpackTest(new Osborne2Function(new double[] {
-                    1.3, 0.65, 0.65, 0.7, 0.6,
-                    3.0, 5.0, 7.0, 2.0, 4.5, 5.5
-                },
-                1.44686540984712, 0.20034404483314,
-                new double[] {
-                    1.30997663810096,  0.43155248076,
-                    0.633661261602859, 0.599428560991695,
-                    0.754179768272449, 0.904300082378518,
-                    1.36579949521007, 4.82373199748107,
-                    2.39868475104871, 4.56887554791452,
-                    5.67534206273052
-                }), false);
-    }
-
-    private void minpackTest(MinpackFunction function, boolean exceptionExpected) {
-        LevenbergMarquardtOptimizer optimizer
-            = new LevenbergMarquardtOptimizer(FastMath.sqrt(2.22044604926e-16),
-                                              FastMath.sqrt(2.22044604926e-16),
-                                              2.22044604926e-16);
-        try {
-            PointVectorValuePair optimum
-                = optimizer.optimize(new MaxEval(400 * (function.getN() + 1)),
-                                     function.getModelFunction(),
-                                     function.getModelFunctionJacobian(),
-                                     new Target(function.getTarget()),
-                                     new Weight(function.getWeight()),
-                                     new InitialGuess(function.getStartPoint()));
-            Assert.assertFalse(exceptionExpected);
-            function.checkTheoreticalMinCost(optimizer.getRMS());
-            function.checkTheoreticalMinParams(optimum);
-        } catch (TooManyEvaluationsException e) {
-            Assert.assertTrue(exceptionExpected);
-        }
-    }
-
-    private static abstract class MinpackFunction {
-        protected int      n;
-        protected int      m;
-        protected double[] startParams;
-        protected double   theoreticalMinCost;
-        protected double[] theoreticalMinParams;
-        protected double   costAccuracy;
-        protected double   paramsAccuracy;
-
-        protected MinpackFunction(int m, double[] startParams,
-                                  double theoreticalMinCost,
-                                  double[] theoreticalMinParams) {
-            this.m = m;
-            this.n = startParams.length;
-            this.startParams          = startParams.clone();
-            this.theoreticalMinCost   = theoreticalMinCost;
-            this.theoreticalMinParams = theoreticalMinParams;
-            this.costAccuracy         = 1.0e-8;
-            this.paramsAccuracy       = 1.0e-5;
-        }
-
-        protected static double[] buildArray(int n, double x) {
-            double[] array = new double[n];
-            Arrays.fill(array, x);
-            return array;
-        }
-
-        public double[] getTarget() {
-            return buildArray(m, 0.0);
-        }
-
-        public double[] getWeight() {
-            return buildArray(m, 1.0);
-        }
-
-        public double[] getStartPoint() {
-            return startParams.clone();
-        }
-
-        protected void setCostAccuracy(double costAccuracy) {
-            this.costAccuracy = costAccuracy;
-        }
-
-        protected void setParamsAccuracy(double paramsAccuracy) {
-            this.paramsAccuracy = paramsAccuracy;
-        }
-
-        public int getN() {
-            return startParams.length;
-        }
-
-        public void checkTheoreticalMinCost(double rms) {
-            double threshold = costAccuracy * (1.0 + theoreticalMinCost);
-            Assert.assertEquals(theoreticalMinCost, FastMath.sqrt(m) * rms, threshold);
-        }
-
-        public void checkTheoreticalMinParams(PointVectorValuePair optimum) {
-            double[] params = optimum.getPointRef();
-            if (theoreticalMinParams != null) {
-                for (int i = 0; i < theoreticalMinParams.length; ++i) {
-                    double mi = theoreticalMinParams[i];
-                    double vi = params[i];
-                    Assert.assertEquals(mi, vi, paramsAccuracy * (1.0 + FastMath.abs(mi)));
-                }
-            }
-        }
-
-        public ModelFunction getModelFunction() {
-            return new ModelFunction(new MultivariateVectorFunction() {
-                    public double[] value(double[] point) {
-                        return computeValue(point);
-                    }
-                });
-        }
-
-        public ModelFunctionJacobian getModelFunctionJacobian() {
-            return new ModelFunctionJacobian(new MultivariateMatrixFunction() {
-                    public double[][] value(double[] point) {
-                        return computeJacobian(point);
-                    }
-                });
-        }
-
-        public abstract double[][] computeJacobian(double[] variables);
-        public abstract double[] computeValue(double[] variables);
-    }
-
-    private static class LinearFullRankFunction extends MinpackFunction {
-        public LinearFullRankFunction(int m, int n, double x0,
-                                      double theoreticalStartCost,
-                                      double theoreticalMinCost) {
-            super(m, buildArray(n, x0), theoreticalMinCost,
-                  buildArray(n, -1.0));
-        }
-
-        @Override
-        public double[][] computeJacobian(double[] variables) {
-            double t = 2.0 / m;
-            double[][] jacobian = new double[m][];
-            for (int i = 0; i < m; ++i) {
-                jacobian[i] = new double[n];
-                for (int j = 0; j < n; ++j) {
-                    jacobian[i][j] = (i == j) ? (1 - t) : -t;
-                }
-            }
-            return jacobian;
-        }
-
-        @Override
-        public double[] computeValue(double[] variables) {
-            double sum = 0;
-            for (int i = 0; i < n; ++i) {
-                sum += variables[i];
-            }
-            double t  = 1 + 2 * sum / m;
-            double[] f = new double[m];
-            for (int i = 0; i < n; ++i) {
-                f[i] = variables[i] - t;
-            }
-            Arrays.fill(f, n, m, -t);
-            return f;
-        }
-    }
-
-    private static class LinearRank1Function extends MinpackFunction {
-        public LinearRank1Function(int m, int n, double x0,
-                                   double theoreticalStartCost,
-                                   double theoreticalMinCost) {
-            super(m, buildArray(n, x0), theoreticalMinCost, null);
-        }
-
-        @Override
-        public double[][] computeJacobian(double[] variables) {
-            double[][] jacobian = new double[m][];
-            for (int i = 0; i < m; ++i) {
-                jacobian[i] = new double[n];
-                for (int j = 0; j < n; ++j) {
-                    jacobian[i][j] = (i + 1) * (j + 1);
-                }
-            }
-            return jacobian;
-        }
-
-        @Override
-        public double[] computeValue(double[] variables) {
-            double[] f = new double[m];
-            double sum = 0;
-            for (int i = 0; i < n; ++i) {
-                sum += (i + 1) * variables[i];
-            }
-            for (int i = 0; i < m; ++i) {
-                f[i] = (i + 1) * sum - 1;
-            }
-            return f;
-        }
-    }
-
-    private static class LinearRank1ZeroColsAndRowsFunction extends MinpackFunction {
-        public LinearRank1ZeroColsAndRowsFunction(int m, int n, double x0) {
-            super(m, buildArray(n, x0),
-                  FastMath.sqrt((m * (m + 3) - 6) / (2.0 * (2 * m - 3))),
-                  null);
-        }
-
-        @Override
-        public double[][] computeJacobian(double[] variables) {
-            double[][] jacobian = new double[m][];
-            for (int i = 0; i < m; ++i) {
-                jacobian[i] = new double[n];
-                jacobian[i][0] = 0;
-                for (int j = 1; j < (n - 1); ++j) {
-                    if (i == 0) {
-                        jacobian[i][j] = 0;
-                    } else if (i != (m - 1)) {
-                        jacobian[i][j] = i * (j + 1);
-                    } else {
-                        jacobian[i][j] = 0;
-                    }
-                }
-                jacobian[i][n - 1] = 0;
-            }
-            return jacobian;
-        }
-
-        @Override
-        public double[] computeValue(double[] variables) {
-            double[] f = new double[m];
-            double sum = 0;
-            for (int i = 1; i < (n - 1); ++i) {
-                sum += (i + 1) * variables[i];
-            }
-            for (int i = 0; i < (m - 1); ++i) {
-                f[i] = i * sum - 1;
-            }
-            f[m - 1] = -1;
-            return f;
-        }
-    }
-
-    private static class RosenbrockFunction extends MinpackFunction {
-        public RosenbrockFunction(double[] startParams, double theoreticalStartCost) {
-            super(2, startParams, 0.0, buildArray(2, 1.0));
-        }
-
-        @Override
-        public double[][] computeJacobian(double[] variables) {
-            double x1 = variables[0];
-            return new double[][] { { -20 * x1, 10 }, { -1, 0 } };
-        }
-
-        @Override
-        public double[] computeValue(double[] variables) {
-            double x1 = variables[0];
-            double x2 = variables[1];
-            return new double[] { 10 * (x2 - x1 * x1), 1 - x1 };
-        }
-    }
-
-    private static class HelicalValleyFunction extends MinpackFunction {
-        public HelicalValleyFunction(double[] startParams,
-                                     double theoreticalStartCost) {
-            super(3, startParams, 0.0, new double[] { 1.0, 0.0, 0.0 });
-        }
-
-        @Override
-        public double[][] computeJacobian(double[] variables) {
-            double x1 = variables[0];
-            double x2 = variables[1];
-            double tmpSquare = x1 * x1 + x2 * x2;
-            double tmp1 = twoPi * tmpSquare;
-            double tmp2 = FastMath.sqrt(tmpSquare);
-            return new double[][] {
-                {  100 * x2 / tmp1, -100 * x1 / tmp1, 10 },
-                { 10 * x1 / tmp2, 10 * x2 / tmp2, 0 },
-                { 0, 0, 1 }
-            };
-        }
-
-        @Override
-        public double[] computeValue(double[] variables) {
-            double x1 = variables[0];
-            double x2 = variables[1];
-            double x3 = variables[2];
-            double tmp1;
-            if (x1 == 0) {
-                tmp1 = (x2 >= 0) ? 0.25 : -0.25;
-            } else {
-                tmp1 = FastMath.atan(x2 / x1) / twoPi;
-                if (x1 < 0) {
-                    tmp1 += 0.5;
-                }
-            }
-            double tmp2 = FastMath.sqrt(x1 * x1 + x2 * x2);
-            return new double[] {
-                10.0 * (x3 - 10 * tmp1),
-                10.0 * (tmp2 - 1),
-                x3
-            };
-        }
-
-        private static final double twoPi = 2.0 * FastMath.PI;
-    }
-
-    private static class PowellSingularFunction extends MinpackFunction {
-        public PowellSingularFunction(double[] startParams,
-                                      double theoreticalStartCost) {
-            super(4, startParams, 0.0, buildArray(4, 0.0));
-        }
-
-        @Override
-        public double[][] computeJacobian(double[] variables) {
-            double x1 = variables[0];
-            double x2 = variables[1];
-            double x3 = variables[2];
-            double x4 = variables[3];
-            return new double[][] {
-                { 1, 10, 0, 0 },
-                { 0, 0, sqrt5, -sqrt5 },
-                { 0, 2 * (x2 - 2 * x3), -4 * (x2 - 2 * x3), 0 },
-                { 2 * sqrt10 * (x1 - x4), 0, 0, -2 * sqrt10 * (x1 - x4) }
-            };
-        }
-
-        @Override
-        public double[] computeValue(double[] variables) {
-            double x1 = variables[0];
-            double x2 = variables[1];
-            double x3 = variables[2];
-            double x4 = variables[3];
-            return new double[] {
-                x1 + 10 * x2,
-                sqrt5 * (x3 - x4),
-                (x2 - 2 * x3) * (x2 - 2 * x3),
-                sqrt10 * (x1 - x4) * (x1 - x4)
-            };
-        }
-
-        private static final double sqrt5  = FastMath.sqrt( 5.0);
-        private static final double sqrt10 = FastMath.sqrt(10.0);
-  }
-
-    private static class FreudensteinRothFunction extends MinpackFunction {
-        public FreudensteinRothFunction(double[] startParams,
-                                        double theoreticalStartCost,
-                                        double theoreticalMinCost,
-                                        double[] theoreticalMinParams) {
-            super(2, startParams, theoreticalMinCost,
-                  theoreticalMinParams);
-        }
-
-        @Override
-        public double[][] computeJacobian(double[] variables) {
-            double x2 = variables[1];
-            return new double[][] {
-                { 1, x2 * (10 - 3 * x2) -  2 },
-                { 1, x2 * ( 2 + 3 * x2) - 14, }
-            };
-        }
-
-        @Override
-        public double[] computeValue(double[] variables) {
-            double x1 = variables[0];
-            double x2 = variables[1];
-            return new double[] {
-                -13.0 + x1 + ((5.0 - x2) * x2 -  2.0) * x2,
-                -29.0 + x1 + ((1.0 + x2) * x2 - 14.0) * x2
-            };
-        }
-    }
-
-    private static class BardFunction extends MinpackFunction {
-        public BardFunction(double x0,
-                            double theoreticalStartCost,
-                            double theoreticalMinCost,
-                            double[] theoreticalMinParams) {
-            super(15, buildArray(3, x0), theoreticalMinCost,
-                  theoreticalMinParams);
-        }
-
-        @Override
-        public double[][] computeJacobian(double[] variables) {
-            double   x2 = variables[1];
-            double   x3 = variables[2];
-            double[][] jacobian = new double[m][];
-            for (int i = 0; i < m; ++i) {
-                double tmp1 = i  + 1;
-                double tmp2 = 15 - i;
-                double tmp3 = (i <= 7) ? tmp1 : tmp2;
-                double tmp4 = x2 * tmp2 + x3 * tmp3;
-                tmp4 *= tmp4;
-                jacobian[i] = new double[] { -1, tmp1 * tmp2 / tmp4, tmp1 * tmp3 / tmp4 };
-            }
-            return jacobian;
-        }
-
-        @Override
-        public double[] computeValue(double[] variables) {
-            double   x1 = variables[0];
-            double   x2 = variables[1];
-            double   x3 = variables[2];
-            double[] f = new double[m];
-            for (int i = 0; i < m; ++i) {
-                double tmp1 = i + 1;
-                double tmp2 = 15 - i;
-                double tmp3 = (i <= 7) ? tmp1 : tmp2;
-                f[i] = y[i] - (x1 + tmp1 / (x2 * tmp2 + x3 * tmp3));
-            }
-            return f;
-        }
-
-        private static final double[] y = {
-            0.14, 0.18, 0.22, 0.25, 0.29,
-            0.32, 0.35, 0.39, 0.37, 0.58,
-            0.73, 0.96, 1.34, 2.10, 4.39
-        };
-    }
-
-    private static class KowalikOsborneFunction extends MinpackFunction {
-        public KowalikOsborneFunction(double[] startParams,
-                                      double theoreticalStartCost,
-                                      double theoreticalMinCost,
-                                      double[] theoreticalMinParams) {
-            super(11, startParams, theoreticalMinCost,
-                  theoreticalMinParams);
-            if (theoreticalStartCost > 20.0) {
-                setCostAccuracy(2.0e-4);
-                setParamsAccuracy(5.0e-3);
-            }
-        }
-
-        @Override
-        public double[][] computeJacobian(double[] variables) {
-            double   x1 = variables[0];
-            double   x2 = variables[1];
-            double   x3 = variables[2];
-            double   x4 = variables[3];
-            double[][] jacobian = new double[m][];
-            for (int i = 0; i < m; ++i) {
-                double tmp = v[i] * (v[i] + x3) + x4;
-                double j1  = -v[i] * (v[i] + x2) / tmp;
-                double j2  = -v[i] * x1 / tmp;
-                double j3  = j1 * j2;
-                double j4  = j3 / v[i];
-                jacobian[i] = new double[] { j1, j2, j3, j4 };
-            }
-            return jacobian;
-        }
-
-        @Override
-        public double[] computeValue(double[] variables) {
-            double x1 = variables[0];
-            double x2 = variables[1];
-            double x3 = variables[2];
-            double x4 = variables[3];
-            double[] f = new double[m];
-            for (int i = 0; i < m; ++i) {
-                f[i] = y[i] - x1 * (v[i] * (v[i] + x2)) / (v[i] * (v[i] + x3) + x4);
-            }
-            return f;
-        }
-
-        private static final double[] v = {
-            4.0, 2.0, 1.0, 0.5, 0.25, 0.167, 0.125, 0.1, 0.0833, 0.0714, 0.0625
-        };
-
-        private static final double[] y = {
-            0.1957, 0.1947, 0.1735, 0.1600, 0.0844, 0.0627,
-            0.0456, 0.0342, 0.0323, 0.0235, 0.0246
-        };
-    }
-
-    private static class MeyerFunction extends MinpackFunction {
-        public MeyerFunction(double[] startParams,
-                             double theoreticalStartCost,
-                             double theoreticalMinCost,
-                             double[] theoreticalMinParams) {
-            super(16, startParams, theoreticalMinCost,
-                  theoreticalMinParams);
-            if (theoreticalStartCost > 1.0e6) {
-                setCostAccuracy(7.0e-3);
-                setParamsAccuracy(2.0e-2);
-            }
-        }
-
-        @Override
-        public double[][] computeJacobian(double[] variables) {
-            double   x1 = variables[0];
-            double   x2 = variables[1];
-            double   x3 = variables[2];
-            double[][] jacobian = new double[m][];
-            for (int i = 0; i < m; ++i) {
-                double temp = 5.0 * (i + 1) + 45.0 + x3;
-                double tmp1 = x2 / temp;
-                double tmp2 = FastMath.exp(tmp1);
-                double tmp3 = x1 * tmp2 / temp;
-                jacobian[i] = new double[] { tmp2, tmp3, -tmp1 * tmp3 };
-            }
-            return jacobian;
-        }
-
-        @Override
-        public double[] computeValue(double[] variables) {
-            double x1 = variables[0];
-            double x2 = variables[1];
-            double x3 = variables[2];
-            double[] f = new double[m];
-            for (int i = 0; i < m; ++i) {
-                f[i] = x1 * FastMath.exp(x2 / (5.0 * (i + 1) + 45.0 + x3)) - y[i];
-            }
-            return f;
-        }
-
-        private static final double[] y = {
-            34780.0, 28610.0, 23650.0, 19630.0,
-            16370.0, 13720.0, 11540.0,  9744.0,
-            8261.0,  7030.0,  6005.0,  5147.0,
-            4427.0,  3820.0,  3307.0,  2872.0
-        };
-    }
-
-    private static class WatsonFunction extends MinpackFunction {
-        public WatsonFunction(int n, double x0,
-                              double theoreticalStartCost,
-                              double theoreticalMinCost,
-                              double[] theoreticalMinParams) {
-            super(31, buildArray(n, x0), theoreticalMinCost,
-                  theoreticalMinParams);
-        }
-
-        @Override
-        public double[][] computeJacobian(double[] variables) {
-            double[][] jacobian = new double[m][];
-
-            for (int i = 0; i < (m - 2); ++i) {
-                double div = (i + 1) / 29.0;
-                double s2  = 0.0;
-                double dx  = 1.0;
-                for (int j = 0; j < n; ++j) {
-                    s2 += dx * variables[j];
-                    dx *= div;
-                }
-                double temp= 2 * div * s2;
-                dx = 1.0 / div;
-                jacobian[i] = new double[n];
-                for (int j = 0; j < n; ++j) {
-                    jacobian[i][j] = dx * (j - temp);
-                    dx *= div;
-                }
-            }
-
-            jacobian[m - 2]    = new double[n];
-            jacobian[m - 2][0] = 1;
-
-            jacobian[m - 1]   = new double[n];
-            jacobian[m - 1][0]= -2 * variables[0];
-            jacobian[m - 1][1]= 1;
-
-            return jacobian;
-        }
-
-        @Override
-        public double[] computeValue(double[] variables) {
-            double[] f = new double[m];
-            for (int i = 0; i < (m - 2); ++i) {
-                double div = (i + 1) / 29.0;
-                double s1 = 0;
-                double dx = 1;
-                for (int j = 1; j < n; ++j) {
-                    s1 += j * dx * variables[j];
-                    dx *= div;
-                }
-                double s2 = 0;
-                dx = 1;
-                for (int j = 0; j < n; ++j) {
-                    s2 += dx * variables[j];
-                    dx *= div;
-                }
-                f[i] = s1 - s2 * s2 - 1;
-            }
-
-            double x1 = variables[0];
-            double x2 = variables[1];
-            f[m - 2] = x1;
-            f[m - 1] = x2 - x1 * x1 - 1;
-
-            return f;
-        }
-    }
-
-    private static class Box3DimensionalFunction extends MinpackFunction {
-        public Box3DimensionalFunction(int m, double[] startParams,
-                                       double theoreticalStartCost) {
-            super(m, startParams, 0.0,
-                  new double[] { 1.0, 10.0, 1.0 });
-        }
-
-        @Override
-        public double[][] computeJacobian(double[] variables) {
-            double   x1 = variables[0];
-            double   x2 = variables[1];
-            double[][] jacobian = new double[m][];
-            for (int i = 0; i < m; ++i) {
-                double tmp = (i + 1) / 10.0;
-                jacobian[i] = new double[] {
-                    -tmp * FastMath.exp(-tmp * x1),
-                    tmp * FastMath.exp(-tmp * x2),
-                    FastMath.exp(-i - 1) - FastMath.exp(-tmp)
-                };
-            }
-            return jacobian;
-        }
-
-        @Override
-        public double[] computeValue(double[] variables) {
-            double x1 = variables[0];
-            double x2 = variables[1];
-            double x3 = variables[2];
-            double[] f = new double[m];
-            for (int i = 0; i < m; ++i) {
-                double tmp = (i + 1) / 10.0;
-                f[i] = FastMath.exp(-tmp * x1) - FastMath.exp(-tmp * x2)
-                    + (FastMath.exp(-i - 1) - FastMath.exp(-tmp)) * x3;
-            }
-            return f;
-        }
-    }
-
-    private static class JennrichSampsonFunction extends MinpackFunction {
-        public JennrichSampsonFunction(int m, double[] startParams,
-                                       double theoreticalStartCost,
-                                       double theoreticalMinCost,
-                                       double[] theoreticalMinParams) {
-            super(m, startParams, theoreticalMinCost,
-                  theoreticalMinParams);
-        }
-
-        @Override
-        public double[][] computeJacobian(double[] variables) {
-            double   x1 = variables[0];
-            double   x2 = variables[1];
-            double[][] jacobian = new double[m][];
-            for (int i = 0; i < m; ++i) {
-                double t = i + 1;
-                jacobian[i] = new double[] { -t * FastMath.exp(t * x1), -t * FastMath.exp(t * x2) };
-            }
-            return jacobian;
-        }
-
-        @Override
-        public double[] computeValue(double[] variables) {
-            double x1 = variables[0];
-            double x2 = variables[1];
-            double[] f = new double[m];
-            for (int i = 0; i < m; ++i) {
-                double temp = i + 1;
-                f[i] = 2 + 2 * temp - FastMath.exp(temp * x1) - FastMath.exp(temp * x2);
-            }
-            return f;
-        }
-    }
-
-    private static class BrownDennisFunction extends MinpackFunction {
-        public BrownDennisFunction(int m, double[] startParams,
-                                   double theoreticalStartCost,
-                                   double theoreticalMinCost,
-                                   double[] theoreticalMinParams) {
-            super(m, startParams, theoreticalMinCost,
-                theoreticalMinParams);
-            setCostAccuracy(2.5e-8);
-        }
-
-        @Override
-        public double[][] computeJacobian(double[] variables) {
-            double   x1 = variables[0];
-            double   x2 = variables[1];
-            double   x3 = variables[2];
-            double   x4 = variables[3];
-            double[][] jacobian = new double[m][];
-            for (int i = 0; i < m; ++i) {
-                double temp = (i + 1) / 5.0;
-                double ti   = FastMath.sin(temp);
-                double tmp1 = x1 + temp * x2 - FastMath.exp(temp);
-                double tmp2 = x3 + ti   * x4 - FastMath.cos(temp);
-                jacobian[i] = new double[] {
-                    2 * tmp1, 2 * temp * tmp1, 2 * tmp2, 2 * ti * tmp2
-                };
-            }
-            return jacobian;
-        }
-
-        @Override
-        public double[] computeValue(double[] variables) {
-            double x1 = variables[0];
-            double x2 = variables[1];
-            double x3 = variables[2];
-            double x4 = variables[3];
-            double[] f = new double[m];
-            for (int i = 0; i < m; ++i) {
-                double temp = (i + 1) / 5.0;
-                double tmp1 = x1 + temp * x2 - FastMath.exp(temp);
-                double tmp2 = x3 + FastMath.sin(temp) * x4 - FastMath.cos(temp);
-                f[i] = tmp1 * tmp1 + tmp2 * tmp2;
-            }
-            return f;
-        }
-    }
-
-    private static class ChebyquadFunction extends MinpackFunction {
-        private static double[] buildChebyquadArray(int n, double factor) {
-            double[] array = new double[n];
-            double inv = factor / (n + 1);
-            for (int i = 0; i < n; ++i) {
-                array[i] = (i + 1) * inv;
-            }
-            return array;
-        }
-
-        public ChebyquadFunction(int n, int m, double factor,
-                                 double theoreticalStartCost,
-                                 double theoreticalMinCost,
-                                 double[] theoreticalMinParams) {
-            super(m, buildChebyquadArray(n, factor), theoreticalMinCost,
-                  theoreticalMinParams);
-        }
-
-        @Override
-        public double[][] computeJacobian(double[] variables) {
-            double[][] jacobian = new double[m][];
-            for (int i = 0; i < m; ++i) {
-                jacobian[i] = new double[n];
-            }
-
-            double dx = 1.0 / n;
-            for (int j = 0; j < n; ++j) {
-                double tmp1 = 1;
-                double tmp2 = 2 * variables[j] - 1;
-                double temp = 2 * tmp2;
-                double tmp3 = 0;
-                double tmp4 = 2;
-                for (int i = 0; i < m; ++i) {
-                    jacobian[i][j] = dx * tmp4;
-                    double ti = 4 * tmp2 + temp * tmp4 - tmp3;
-                    tmp3 = tmp4;
-                    tmp4 = ti;
-                    ti   = temp * tmp2 - tmp1;
-                    tmp1 = tmp2;
-                    tmp2 = ti;
-                }
-            }
-
-            return jacobian;
-        }
-
-        @Override
-        public double[] computeValue(double[] variables) {
-            double[] f = new double[m];
-
-            for (int j = 0; j < n; ++j) {
-                double tmp1 = 1;
-                double tmp2 = 2 * variables[j] - 1;
-                double temp = 2 * tmp2;
-                for (int i = 0; i < m; ++i) {
-                    f[i] += tmp2;
-                    double ti = temp * tmp2 - tmp1;
-                    tmp1 = tmp2;
-                    tmp2 = ti;
-                }
-            }
-
-            double dx = 1.0 / n;
-            boolean iev = false;
-            for (int i = 0; i < m; ++i) {
-                f[i] *= dx;
-                if (iev) {
-                    f[i] += 1.0 / (i * (i + 2));
-                }
-                iev = ! iev;
-            }
-
-            return f;
-        }
-    }
-
-    private static class BrownAlmostLinearFunction extends MinpackFunction {
-        public BrownAlmostLinearFunction(int m, double factor,
-                                         double theoreticalStartCost,
-                                         double theoreticalMinCost,
-                                         double[] theoreticalMinParams) {
-            super(m, buildArray(m, factor), theoreticalMinCost,
-                  theoreticalMinParams);
-        }
-
-        @Override
-        public double[][] computeJacobian(double[] variables) {
-            double[][] jacobian = new double[m][];
-            for (int i = 0; i < m; ++i) {
-                jacobian[i] = new double[n];
-            }
-
-            double prod = 1;
-            for (int j = 0; j < n; ++j) {
-                prod *= variables[j];
-                for (int i = 0; i < n; ++i) {
-                    jacobian[i][j] = 1;
-                }
-                jacobian[j][j] = 2;
-            }
-
-            for (int j = 0; j < n; ++j) {
-                double temp = variables[j];
-                if (temp == 0) {
-                    temp = 1;
-                    prod = 1;
-                    for (int k = 0; k < n; ++k) {
-                        if (k != j) {
-                            prod *= variables[k];
-                        }
-                    }
-                }
-                jacobian[n - 1][j] = prod / temp;
-            }
-
-            return jacobian;
-        }
-
-        @Override
-        public double[] computeValue(double[] variables) {
-            double[] f = new double[m];
-            double sum  = -(n + 1);
-            double prod = 1;
-            for (int j = 0; j < n; ++j) {
-                sum  += variables[j];
-                prod *= variables[j];
-            }
-            for (int i = 0; i < n; ++i) {
-                f[i] = variables[i] + sum;
-            }
-            f[n - 1] = prod - 1;
-            return f;
-        }
-    }
-
-    private static class Osborne1Function extends MinpackFunction {
-        public Osborne1Function(double[] startParams,
-                                double theoreticalStartCost,
-                                double theoreticalMinCost,
-                                double[] theoreticalMinParams) {
-            super(33, startParams, theoreticalMinCost,
-                  theoreticalMinParams);
-        }
-
-        @Override
-        public double[][] computeJacobian(double[] variables) {
-            double   x2 = variables[1];
-            double   x3 = variables[2];
-            double   x4 = variables[3];
-            double   x5 = variables[4];
-            double[][] jacobian = new double[m][];
-            for (int i = 0; i < m; ++i) {
-                double temp = 10.0 * i;
-                double tmp1 = FastMath.exp(-temp * x4);
-                double tmp2 = FastMath.exp(-temp * x5);
-                jacobian[i] = new double[] {
-                    -1, -tmp1, -tmp2, temp * x2 * tmp1, temp * x3 * tmp2
-                };
-            }
-            return jacobian;
-        }
-
-        @Override
-        public double[] computeValue(double[] variables) {
-            double x1 = variables[0];
-            double x2 = variables[1];
-            double x3 = variables[2];
-            double x4 = variables[3];
-            double x5 = variables[4];
-            double[] f = new double[m];
-            for (int i = 0; i < m; ++i) {
-                double temp = 10.0 * i;
-                double tmp1 = FastMath.exp(-temp * x4);
-                double tmp2 = FastMath.exp(-temp * x5);
-                f[i] = y[i] - (x1 + x2 * tmp1 + x3 * tmp2);
-            }
-            return f;
-        }
-        
-        private static final double[] y = {
-            0.844, 0.908, 0.932, 0.936, 0.925, 0.908, 0.881, 0.850, 0.818, 0.784, 0.751,
-            0.718, 0.685, 0.658, 0.628, 0.603, 0.580, 0.558, 0.538, 0.522, 0.506, 0.490,
-            0.478, 0.467, 0.457, 0.448, 0.438, 0.431, 0.424, 0.420, 0.414, 0.411, 0.406
-        };
-    }
-
-    private static class Osborne2Function extends MinpackFunction {
-        public Osborne2Function(double[] startParams,
-                                double theoreticalStartCost,
-                                double theoreticalMinCost,
-                                double[] theoreticalMinParams) {
-            super(65, startParams, theoreticalMinCost,
-                  theoreticalMinParams);
-        }
-
-        @Override
-        public double[][] computeJacobian(double[] variables) {
-            double   x01 = variables[0];
-            double   x02 = variables[1];
-            double   x03 = variables[2];
-            double   x04 = variables[3];
-            double   x05 = variables[4];
-            double   x06 = variables[5];
-            double   x07 = variables[6];
-            double   x08 = variables[7];
-            double   x09 = variables[8];
-            double   x10 = variables[9];
-            double   x11 = variables[10];
-            double[][] jacobian = new double[m][];
-            for (int i = 0; i < m; ++i) {
-                double temp = i / 10.0;
-                double tmp1 = FastMath.exp(-x05 * temp);
-                double tmp2 = FastMath.exp(-x06 * (temp - x09) * (temp - x09));
-                double tmp3 = FastMath.exp(-x07 * (temp - x10) * (temp - x10));
-                double tmp4 = FastMath.exp(-x08 * (temp - x11) * (temp - x11));
-                jacobian[i] = new double[] {
-                    -tmp1,
-                    -tmp2,
-                    -tmp3,
-                    -tmp4,
-                    temp * x01 * tmp1,
-                    x02 * (temp - x09) * (temp - x09) * tmp2,
-                    x03 * (temp - x10) * (temp - x10) * tmp3,
-                    x04 * (temp - x11) * (temp - x11) * tmp4,
-                    -2 * x02 * x06 * (temp - x09) * tmp2,
-                    -2 * x03 * x07 * (temp - x10) * tmp3,
-                    -2 * x04 * x08 * (temp - x11) * tmp4
-                };
-            }
-            return jacobian;
-        }
-
-        @Override
-        public double[] computeValue(double[] variables) {
-            double x01 = variables[0];
-            double x02 = variables[1];
-            double x03 = variables[2];
-            double x04 = variables[3];
-            double x05 = variables[4];
-            double x06 = variables[5];
-            double x07 = variables[6];
-            double x08 = variables[7];
-            double x09 = variables[8];
-            double x10 = variables[9];
-            double x11 = variables[10];
-            double[] f = new double[m];
-            for (int i = 0; i < m; ++i) {
-                double temp = i / 10.0;
-                double tmp1 = FastMath.exp(-x05 * temp);
-                double tmp2 = FastMath.exp(-x06 * (temp - x09) * (temp - x09));
-                double tmp3 = FastMath.exp(-x07 * (temp - x10) * (temp - x10));
-                double tmp4 = FastMath.exp(-x08 * (temp - x11) * (temp - x11));
-                f[i] = y[i] - (x01 * tmp1 + x02 * tmp2 + x03 * tmp3 + x04 * tmp4);
-            }
-            return f;
-        }
-
-        private static final double[] y = {
-            1.366, 1.191, 1.112, 1.013, 0.991,
-            0.885, 0.831, 0.847, 0.786, 0.725,
-            0.746, 0.679, 0.608, 0.655, 0.616,
-            0.606, 0.602, 0.626, 0.651, 0.724,
-            0.649, 0.649, 0.694, 0.644, 0.624,
-            0.661, 0.612, 0.558, 0.533, 0.495,
-            0.500, 0.423, 0.395, 0.375, 0.372,
-            0.391, 0.396, 0.405, 0.428, 0.429,
-            0.523, 0.562, 0.607, 0.653, 0.672,
-            0.708, 0.633, 0.668, 0.645, 0.632,
-            0.591, 0.559, 0.597, 0.625, 0.739,
-            0.710, 0.729, 0.720, 0.636, 0.581,
-            0.428, 0.292, 0.162, 0.098, 0.054
-        };
-    }
-}


[5/5] [math] Remove deprecated classes in optim package.

Posted by tn...@apache.org.
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/e31fde87
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/e31fde87
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/e31fde87

Branch: refs/heads/master
Commit: e31fde875c6075ae3da9572c6f910cc29ceaf6c3
Parents: 0737cf8
Author: Thomas Neidhart <th...@gmail.com>
Authored: Sat Apr 11 16:05:10 2015 +0200
Committer: Thomas Neidhart <th...@gmail.com>
Committed: Sat Apr 11 16:05:10 2015 +0200

----------------------------------------------------------------------
 ...ltiStartMultivariateVectorOptimizerTest.java |  253 ---
 ...stractLeastSquaresOptimizerAbstractTest.java |  641 --------
 .../AbstractLeastSquaresOptimizerTest.java      |  129 --
 ...ractLeastSquaresOptimizerTestValidation.java |  335 ----
 .../vector/jacobian/CircleProblem.java          |  179 ---
 .../vector/jacobian/CircleVectorial.java        |   99 --
 .../jacobian/GaussNewtonOptimizerTest.java      |  173 ---
 .../LevenbergMarquardtOptimizerTest.java        |  375 -----
 .../nonlinear/vector/jacobian/MinpackTest.java  | 1467 ------------------
 .../jacobian/RandomCirclePointGenerator.java    |   91 --
 .../RandomStraightLinePointGenerator.java       |   99 --
 .../jacobian/StatisticalReferenceDataset.java   |  385 -----
 .../StatisticalReferenceDatasetFactory.java     |  203 ---
 .../vector/jacobian/StraightLineProblem.java    |  169 --
 14 files changed, 4598 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/e31fde87/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/MultiStartMultivariateVectorOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/MultiStartMultivariateVectorOptimizerTest.java b/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/MultiStartMultivariateVectorOptimizerTest.java
deleted file mode 100644
index 70b3f95..0000000
--- a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/MultiStartMultivariateVectorOptimizerTest.java
+++ /dev/null
@@ -1,253 +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.analysis.MultivariateVectorFunction;
-import org.apache.commons.math4.linear.BlockRealMatrix;
-import org.apache.commons.math4.linear.RealMatrix;
-import org.apache.commons.math4.optim.InitialGuess;
-import org.apache.commons.math4.optim.MaxEval;
-import org.apache.commons.math4.optim.OptimizationData;
-import org.apache.commons.math4.optim.PointVectorValuePair;
-import org.apache.commons.math4.optim.SimpleBounds;
-import org.apache.commons.math4.optim.SimpleVectorValueChecker;
-import org.apache.commons.math4.optim.nonlinear.vector.JacobianMultivariateVectorOptimizer;
-import org.apache.commons.math4.optim.nonlinear.vector.ModelFunction;
-import org.apache.commons.math4.optim.nonlinear.vector.ModelFunctionJacobian;
-import org.apache.commons.math4.optim.nonlinear.vector.MultiStartMultivariateVectorOptimizer;
-import org.apache.commons.math4.optim.nonlinear.vector.Target;
-import org.apache.commons.math4.optim.nonlinear.vector.Weight;
-import org.apache.commons.math4.optim.nonlinear.vector.jacobian.GaussNewtonOptimizer;
-import org.apache.commons.math4.random.GaussianRandomGenerator;
-import org.apache.commons.math4.random.JDKRandomGenerator;
-import org.apache.commons.math4.random.RandomVectorGenerator;
-import org.apache.commons.math4.random.UncorrelatedRandomVectorGenerator;
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- * <p>Some of the unit tests are re-implementations of the MINPACK <a
- * href="http://www.netlib.org/minpack/ex/file17">file17</a> and <a
- * href="http://www.netlib.org/minpack/ex/file22">file22</a> test files.
- * The redistribution policy for MINPACK is available <a
- * href="http://www.netlib.org/minpack/disclaimer">here</a>, for
- * convenience, it is reproduced below.</p>
- *
- * <table border="0" width="80%" cellpadding="10" align="center" bgcolor="#E0E0E0">
- * <tr><td>
- *    Minpack Copyright Notice (1999) University of Chicago.
- *    All rights reserved
- * </td></tr>
- * <tr><td>
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * <ol>
- *  <li>Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.</li>
- * <li>Redistributions in binary form must reproduce the above
- *     copyright notice, this list of conditions and the following
- *     disclaimer in the documentation and/or other materials provided
- *     with the distribution.</li>
- * <li>The end-user documentation included with the redistribution, if any,
- *     must include the following acknowledgment:
- *     <code>This product includes software developed by the University of
- *           Chicago, as Operator of Argonne National Laboratory.</code>
- *     Alternately, this acknowledgment may appear in the software itself,
- *     if and wherever such third-party acknowledgments normally appear.</li>
- * <li><strong>WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS"
- *     WITHOUT WARRANTY OF ANY KIND. THE COPYRIGHT HOLDER, THE
- *     UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND
- *     THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR
- *     IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES
- *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE
- *     OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL LIABILITY
- *     OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR
- *     USEFULNESS OF THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF
- *     THE SOFTWARE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS, (4)
- *     DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION
- *     UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL
- *     BE CORRECTED.</strong></li>
- * <li><strong>LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT
- *     HOLDER, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF
- *     ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT,
- *     INCIDENTAL, CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF
- *     ANY KIND OR NATURE, INCLUDING BUT NOT LIMITED TO LOSS OF
- *     PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, WHETHER
- *     SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT
- *     (INCLUDING NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE,
- *     EVEN IF ANY OF SAID PARTIES HAS BEEN WARNED OF THE
- *     POSSIBILITY OF SUCH LOSS OR DAMAGES.</strong></li>
- * <ol></td></tr>
- * </table>
- *
- * @author Argonne National Laboratory. MINPACK project. March 1980 (original fortran minpack tests)
- * @author Burton S. Garbow (original fortran minpack tests)
- * @author Kenneth E. Hillstrom (original fortran minpack tests)
- * @author Jorge J. More (original fortran minpack tests)
- * @author Luc Maisonobe (non-minpack tests and minpack tests Java translation)
- */
-@Deprecated
-public class MultiStartMultivariateVectorOptimizerTest {
-
-    @Test(expected=NullPointerException.class)
-    public void testGetOptimaBeforeOptimize() {
-
-        JacobianMultivariateVectorOptimizer underlyingOptimizer
-            = new GaussNewtonOptimizer(true, new SimpleVectorValueChecker(1e-6, 1e-6));
-        JDKRandomGenerator g = new JDKRandomGenerator();
-        g.setSeed(16069223052l);
-        RandomVectorGenerator generator
-            = new UncorrelatedRandomVectorGenerator(1, new GaussianRandomGenerator(g));
-        MultiStartMultivariateVectorOptimizer optimizer
-            = new MultiStartMultivariateVectorOptimizer(underlyingOptimizer, 10, generator);
-
-        optimizer.getOptima();
-    }
-
-    @Test
-    public void testTrivial() {
-        LinearProblem problem
-            = new LinearProblem(new double[][] { { 2 } }, new double[] { 3 });
-        JacobianMultivariateVectorOptimizer underlyingOptimizer
-            = new GaussNewtonOptimizer(true, new SimpleVectorValueChecker(1e-6, 1e-6));
-        JDKRandomGenerator g = new JDKRandomGenerator();
-        g.setSeed(16069223052l);
-        RandomVectorGenerator generator
-            = new UncorrelatedRandomVectorGenerator(1, new GaussianRandomGenerator(g));
-        MultiStartMultivariateVectorOptimizer optimizer
-            = new MultiStartMultivariateVectorOptimizer(underlyingOptimizer, 10, generator);
-
-        PointVectorValuePair optimum
-            = optimizer.optimize(new MaxEval(100),
-                                 problem.getModelFunction(),
-                                 problem.getModelFunctionJacobian(),
-                                 problem.getTarget(),
-                                 new Weight(new double[] { 1 }),
-                                 new InitialGuess(new double[] { 0 }));
-        Assert.assertEquals(1.5, optimum.getPoint()[0], 1e-10);
-        Assert.assertEquals(3.0, optimum.getValue()[0], 1e-10);
-        PointVectorValuePair[] optima = optimizer.getOptima();
-        Assert.assertEquals(10, optima.length);
-        for (int i = 0; i < optima.length; i++) {
-            Assert.assertEquals(1.5, optima[i].getPoint()[0], 1e-10);
-            Assert.assertEquals(3.0, optima[i].getValue()[0], 1e-10);
-        }
-        Assert.assertTrue(optimizer.getEvaluations() > 20);
-        Assert.assertTrue(optimizer.getEvaluations() < 50);
-        Assert.assertEquals(100, optimizer.getMaxEvaluations());
-    }
-
-    @Test
-    public void testIssue914() {
-        LinearProblem problem = new LinearProblem(new double[][] { { 2 } }, new double[] { 3 });
-        JacobianMultivariateVectorOptimizer underlyingOptimizer =
-                new GaussNewtonOptimizer(true, new SimpleVectorValueChecker(1e-6, 1e-6)) {
-            @Override
-            public PointVectorValuePair optimize(OptimizationData... optData) {
-                // filter out simple bounds, as they are not supported
-                // by the underlying optimizer, and we don't really care for this test
-                OptimizationData[] filtered = optData.clone();
-                for (int i = 0; i < filtered.length; ++i) {
-                    if (filtered[i] instanceof SimpleBounds) {
-                        filtered[i] = null;
-                    }
-                }
-                return super.optimize(filtered);
-            }
-        };
-        JDKRandomGenerator g = new JDKRandomGenerator();
-        g.setSeed(16069223052l);
-        RandomVectorGenerator generator =
-                new UncorrelatedRandomVectorGenerator(1, new GaussianRandomGenerator(g));
-        MultiStartMultivariateVectorOptimizer optimizer =
-                new MultiStartMultivariateVectorOptimizer(underlyingOptimizer, 10, generator);
-
-        optimizer.optimize(new MaxEval(100),
-                           problem.getModelFunction(),
-                           problem.getModelFunctionJacobian(),
-                           problem.getTarget(),
-                           new Weight(new double[] { 1 }),
-                           new InitialGuess(new double[] { 0 }),
-                           new SimpleBounds(new double[] { -1.0e-10 }, new double[] {  1.0e-10 }));
-        PointVectorValuePair[] optima = optimizer.getOptima();
-        // only the first start should have succeeded
-        Assert.assertEquals(1, optima.length);
-
-    }
-
-    /**
-     * Test demonstrating that the user exception is finally thrown if none
-     * of the runs succeed.
-     */
-    @Test(expected=TestException.class)
-    public void testNoOptimum() {
-        JacobianMultivariateVectorOptimizer underlyingOptimizer
-            = new GaussNewtonOptimizer(true, new SimpleVectorValueChecker(1e-6, 1e-6));
-        JDKRandomGenerator g = new JDKRandomGenerator();
-        g.setSeed(12373523445l);
-        RandomVectorGenerator generator
-            = new UncorrelatedRandomVectorGenerator(1, new GaussianRandomGenerator(g));
-        MultiStartMultivariateVectorOptimizer optimizer
-            = new MultiStartMultivariateVectorOptimizer(underlyingOptimizer, 10, generator);
-        optimizer.optimize(new MaxEval(100),
-                           new Target(new double[] { 0 }),
-                           new Weight(new double[] { 1 }),
-                           new InitialGuess(new double[] { 0 }),
-                           new ModelFunction(new MultivariateVectorFunction() {
-                                   public double[] value(double[] point) {
-                                       throw new TestException();
-                                   }
-                               }));
-    }
-
-    private static class TestException extends RuntimeException {
-
-    private static final long serialVersionUID = 1L;}
-
-    private static class LinearProblem {
-        private final RealMatrix factors;
-        private final double[] target;
-
-        public LinearProblem(double[][] factors,
-                             double[] target) {
-            this.factors = new BlockRealMatrix(factors);
-            this.target  = target;
-        }
-
-        public Target getTarget() {
-            return new Target(target);
-        }
-
-        public ModelFunction getModelFunction() {
-            return new ModelFunction(new MultivariateVectorFunction() {
-                    public double[] value(double[] variables) {
-                        return factors.operate(variables);
-                    }
-                });
-        }
-
-        public ModelFunctionJacobian getModelFunctionJacobian() {
-            return new ModelFunctionJacobian(new MultivariateMatrixFunction() {
-                    public double[][] value(double[] point) {
-                        return factors.getData();
-                    }
-                });
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e31fde87/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerAbstractTest.java b/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerAbstractTest.java
deleted file mode 100644
index e2814fc..0000000
--- a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerAbstractTest.java
+++ /dev/null
@@ -1,641 +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 java.io.IOException;
-import java.util.Arrays;
-
-import org.apache.commons.math4.analysis.MultivariateMatrixFunction;
-import org.apache.commons.math4.analysis.MultivariateVectorFunction;
-import org.apache.commons.math4.exception.ConvergenceException;
-import org.apache.commons.math4.exception.DimensionMismatchException;
-import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math4.linear.BlockRealMatrix;
-import org.apache.commons.math4.linear.RealMatrix;
-import org.apache.commons.math4.optim.InitialGuess;
-import org.apache.commons.math4.optim.MaxEval;
-import org.apache.commons.math4.optim.PointVectorValuePair;
-import org.apache.commons.math4.optim.nonlinear.vector.ModelFunction;
-import org.apache.commons.math4.optim.nonlinear.vector.ModelFunctionJacobian;
-import org.apache.commons.math4.optim.nonlinear.vector.Target;
-import org.apache.commons.math4.optim.nonlinear.vector.Weight;
-import org.apache.commons.math4.optim.nonlinear.vector.jacobian.AbstractLeastSquaresOptimizer;
-import org.apache.commons.math4.util.FastMath;
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- * <p>Some of the unit tests are re-implementations of the MINPACK <a
- * href="http://www.netlib.org/minpack/ex/file17">file17</a> and <a
- * href="http://www.netlib.org/minpack/ex/file22">file22</a> test files.
- * The redistribution policy for MINPACK is available <a
- * href="http://www.netlib.org/minpack/disclaimer">here</a>, for
- * convenience, it is reproduced below.</p>
-
- * <table border="0" width="80%" cellpadding="10" align="center" bgcolor="#E0E0E0">
- * <tr><td>
- *    Minpack Copyright Notice (1999) University of Chicago.
- *    All rights reserved
- * </td></tr>
- * <tr><td>
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * <ol>
- *  <li>Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.</li>
- * <li>Redistributions in binary form must reproduce the above
- *     copyright notice, this list of conditions and the following
- *     disclaimer in the documentation and/or other materials provided
- *     with the distribution.</li>
- * <li>The end-user documentation included with the redistribution, if any,
- *     must include the following acknowledgment:
- *     <code>This product includes software developed by the University of
- *           Chicago, as Operator of Argonne National Laboratory.</code>
- *     Alternately, this acknowledgment may appear in the software itself,
- *     if and wherever such third-party acknowledgments normally appear.</li>
- * <li><strong>WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS"
- *     WITHOUT WARRANTY OF ANY KIND. THE COPYRIGHT HOLDER, THE
- *     UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND
- *     THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR
- *     IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES
- *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE
- *     OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL LIABILITY
- *     OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR
- *     USEFULNESS OF THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF
- *     THE SOFTWARE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS, (4)
- *     DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION
- *     UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL
- *     BE CORRECTED.</strong></li>
- * <li><strong>LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT
- *     HOLDER, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF
- *     ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT,
- *     INCIDENTAL, CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF
- *     ANY KIND OR NATURE, INCLUDING BUT NOT LIMITED TO LOSS OF
- *     PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, WHETHER
- *     SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT
- *     (INCLUDING NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE,
- *     EVEN IF ANY OF SAID PARTIES HAS BEEN WARNED OF THE
- *     POSSIBILITY OF SUCH LOSS OR DAMAGES.</strong></li>
- * <ol></td></tr>
- * </table>
-
- * @author Argonne National Laboratory. MINPACK project. March 1980 (original fortran minpack tests)
- * @author Burton S. Garbow (original fortran minpack tests)
- * @author Kenneth E. Hillstrom (original fortran minpack tests)
- * @author Jorge J. More (original fortran minpack tests)
- * @author Luc Maisonobe (non-minpack tests and minpack tests Java translation)
- */
-@Deprecated
-public abstract class AbstractLeastSquaresOptimizerAbstractTest {
-
-    public abstract AbstractLeastSquaresOptimizer createOptimizer();
-
-    @Test
-    public void testGetIterations() {
-        AbstractLeastSquaresOptimizer optim = createOptimizer();
-        optim.optimize(new MaxEval(100), new Target(new double[] { 1 }),
-                       new Weight(new double[] { 1 }),
-                       new InitialGuess(new double[] { 3 }),
-                       new ModelFunction(new MultivariateVectorFunction() {
-                               public double[] value(double[] point) {
-                                   return new double[] {
-                                       FastMath.pow(point[0], 4)
-                                   };
-                               }
-                           }),
-                       new ModelFunctionJacobian(new MultivariateMatrixFunction() {
-                               public double[][] value(double[] point) {
-                                   return new double[][] {
-                                       { 0.25 * FastMath.pow(point[0], 3) }
-                                   };
-                               }
-                           }));
-
-        Assert.assertTrue(optim.getIterations() > 0);
-    }
-
-    @Test
-    public void testTrivial() {
-        LinearProblem problem
-            = new LinearProblem(new double[][] { { 2 } }, new double[] { 3 });
-        AbstractLeastSquaresOptimizer optimizer = createOptimizer();
-        PointVectorValuePair optimum =
-            optimizer.optimize(new MaxEval(100),
-                               problem.getModelFunction(),
-                               problem.getModelFunctionJacobian(),
-                               problem.getTarget(),
-                               new Weight(new double[] { 1 }),
-                               new InitialGuess(new double[] { 0 }));
-        Assert.assertEquals(0, optimizer.getRMS(), 1e-10);
-        Assert.assertEquals(1.5, optimum.getPoint()[0], 1e-10);
-        Assert.assertEquals(3.0, optimum.getValue()[0], 1e-10);
-    }
-
-    @Test
-    public void testQRColumnsPermutation() {
-
-        LinearProblem problem
-            = new LinearProblem(new double[][] { { 1, -1 }, { 0, 2 }, { 1, -2 } },
-                                new double[] { 4, 6, 1 });
-
-        AbstractLeastSquaresOptimizer optimizer = createOptimizer();
-        PointVectorValuePair optimum =
-            optimizer.optimize(new MaxEval(100),
-                               problem.getModelFunction(),
-                               problem.getModelFunctionJacobian(),
-                               problem.getTarget(),
-                               new Weight(new double[] { 1, 1, 1 }),
-                               new InitialGuess(new double[] { 0, 0 }));
-        Assert.assertEquals(0, optimizer.getRMS(), 1e-10);
-        Assert.assertEquals(7, optimum.getPoint()[0], 1e-10);
-        Assert.assertEquals(3, optimum.getPoint()[1], 1e-10);
-        Assert.assertEquals(4, optimum.getValue()[0], 1e-10);
-        Assert.assertEquals(6, optimum.getValue()[1], 1e-10);
-        Assert.assertEquals(1, optimum.getValue()[2], 1e-10);
-    }
-
-    @Test
-    public void testNoDependency() {
-        LinearProblem problem = new LinearProblem(new double[][] {
-                { 2, 0, 0, 0, 0, 0 },
-                { 0, 2, 0, 0, 0, 0 },
-                { 0, 0, 2, 0, 0, 0 },
-                { 0, 0, 0, 2, 0, 0 },
-                { 0, 0, 0, 0, 2, 0 },
-                { 0, 0, 0, 0, 0, 2 }
-        }, new double[] { 0, 1.1, 2.2, 3.3, 4.4, 5.5 });
-        AbstractLeastSquaresOptimizer optimizer = createOptimizer();
-        PointVectorValuePair optimum =
-            optimizer.optimize(new MaxEval(100),
-                               problem.getModelFunction(),
-                               problem.getModelFunctionJacobian(),
-                               problem.getTarget(),
-                               new Weight(new double[] { 1, 1, 1, 1, 1, 1 }),
-                               new InitialGuess(new double[] { 0, 0, 0, 0, 0, 0 }));
-        Assert.assertEquals(0, optimizer.getRMS(), 1e-10);
-        for (int i = 0; i < problem.target.length; ++i) {
-            Assert.assertEquals(0.55 * i, optimum.getPoint()[i], 1e-10);
-        }
-    }
-
-    @Test
-    public void testOneSet() {
-
-        LinearProblem problem = new LinearProblem(new double[][] {
-                {  1,  0, 0 },
-                { -1,  1, 0 },
-                {  0, -1, 1 }
-        }, new double[] { 1, 1, 1});
-        AbstractLeastSquaresOptimizer optimizer = createOptimizer();
-        PointVectorValuePair optimum =
-            optimizer.optimize(new MaxEval(100),
-                               problem.getModelFunction(),
-                               problem.getModelFunctionJacobian(),
-                               problem.getTarget(),
-                               new Weight(new double[] { 1, 1, 1 }),
-                               new InitialGuess(new double[] { 0, 0, 0 }));
-        Assert.assertEquals(0, optimizer.getRMS(), 1e-10);
-        Assert.assertEquals(1, optimum.getPoint()[0], 1e-10);
-        Assert.assertEquals(2, optimum.getPoint()[1], 1e-10);
-        Assert.assertEquals(3, optimum.getPoint()[2], 1e-10);
-    }
-
-    @Test
-    public void testTwoSets() {
-        double epsilon = 1e-7;
-        LinearProblem problem = new LinearProblem(new double[][] {
-                {  2,  1,   0,  4,       0, 0 },
-                { -4, -2,   3, -7,       0, 0 },
-                {  4,  1,  -2,  8,       0, 0 },
-                {  0, -3, -12, -1,       0, 0 },
-                {  0,  0,   0,  0, epsilon, 1 },
-                {  0,  0,   0,  0,       1, 1 }
-        }, new double[] { 2, -9, 2, 2, 1 + epsilon * epsilon, 2});
-
-        AbstractLeastSquaresOptimizer optimizer = createOptimizer();
-        PointVectorValuePair optimum =
-            optimizer.optimize(new MaxEval(100),
-                               problem.getModelFunction(),
-                               problem.getModelFunctionJacobian(),
-                               problem.getTarget(),
-                               new Weight(new double[] { 1, 1, 1, 1, 1, 1 }),
-                               new InitialGuess(new double[] { 0, 0, 0, 0, 0, 0 }));
-        Assert.assertEquals(0, optimizer.getRMS(), 1e-10);
-        Assert.assertEquals(3, optimum.getPoint()[0], 1e-10);
-        Assert.assertEquals(4, optimum.getPoint()[1], 1e-10);
-        Assert.assertEquals(-1, optimum.getPoint()[2], 1e-10);
-        Assert.assertEquals(-2, optimum.getPoint()[3], 1e-10);
-        Assert.assertEquals(1 + epsilon, optimum.getPoint()[4], 1e-10);
-        Assert.assertEquals(1 - epsilon, optimum.getPoint()[5], 1e-10);
-    }
-
-    @Test(expected=ConvergenceException.class)
-    public void testNonInvertible() throws Exception {
-
-        LinearProblem problem = new LinearProblem(new double[][] {
-                {  1, 2, -3 },
-                {  2, 1,  3 },
-                { -3, 0, -9 }
-        }, new double[] { 1, 1, 1 });
-
-        AbstractLeastSquaresOptimizer optimizer = createOptimizer();
-
-        optimizer.optimize(new MaxEval(100),
-                           problem.getModelFunction(),
-                           problem.getModelFunctionJacobian(),
-                           problem.getTarget(),
-                           new Weight(new double[] { 1, 1, 1 }),
-                           new InitialGuess(new double[] { 0, 0, 0 }));
-    }
-
-    @Test
-    public void testIllConditioned() {
-        LinearProblem problem1 = new LinearProblem(new double[][] {
-                { 10, 7,  8,  7 },
-                {  7, 5,  6,  5 },
-                {  8, 6, 10,  9 },
-                {  7, 5,  9, 10 }
-        }, new double[] { 32, 23, 33, 31 });
-        AbstractLeastSquaresOptimizer optimizer = createOptimizer();
-        PointVectorValuePair optimum1 =
-            optimizer.optimize(new MaxEval(100),
-                               problem1.getModelFunction(),
-                               problem1.getModelFunctionJacobian(),
-                               problem1.getTarget(),
-                               new Weight(new double[] { 1, 1, 1, 1 }),
-                               new InitialGuess(new double[] { 0, 1, 2, 3 }));
-        Assert.assertEquals(0, optimizer.getRMS(), 1e-10);
-        Assert.assertEquals(1, optimum1.getPoint()[0], 1e-10);
-        Assert.assertEquals(1, optimum1.getPoint()[1], 1e-10);
-        Assert.assertEquals(1, optimum1.getPoint()[2], 1e-10);
-        Assert.assertEquals(1, optimum1.getPoint()[3], 1e-10);
-
-        LinearProblem problem2 = new LinearProblem(new double[][] {
-                { 10.00, 7.00, 8.10, 7.20 },
-                {  7.08, 5.04, 6.00, 5.00 },
-                {  8.00, 5.98, 9.89, 9.00 },
-                {  6.99, 4.99, 9.00, 9.98 }
-        }, new double[] { 32, 23, 33, 31 });
-        PointVectorValuePair optimum2 =
-            optimizer.optimize(new MaxEval(100),
-                               problem2.getModelFunction(),
-                               problem2.getModelFunctionJacobian(),
-                               problem2.getTarget(), 
-                               new Weight(new double[] { 1, 1, 1, 1 }),
-                               new InitialGuess(new double[] { 0, 1, 2, 3 }));
-        Assert.assertEquals(0, optimizer.getRMS(), 1e-10);
-        Assert.assertEquals(-81, optimum2.getPoint()[0], 1e-8);
-        Assert.assertEquals(137, optimum2.getPoint()[1], 1e-8);
-        Assert.assertEquals(-34, optimum2.getPoint()[2], 1e-8);
-        Assert.assertEquals( 22, optimum2.getPoint()[3], 1e-8);
-    }
-
-    @Test
-    public void testMoreEstimatedParametersSimple() {
-
-        LinearProblem problem = new LinearProblem(new double[][] {
-                { 3, 2,  0, 0 },
-                { 0, 1, -1, 1 },
-                { 2, 0,  1, 0 }
-        }, new double[] { 7, 3, 5 });
-
-        AbstractLeastSquaresOptimizer optimizer = createOptimizer();
-        optimizer.optimize(new MaxEval(100),
-                           problem.getModelFunction(),
-                           problem.getModelFunctionJacobian(),
-                           problem.getTarget(),
-                           new Weight(new double[] { 1, 1, 1 }),
-                           new InitialGuess(new double[] { 7, 6, 5, 4 }));
-        Assert.assertEquals(0, optimizer.getRMS(), 1e-10);
-    }
-
-    @Test
-    public void testMoreEstimatedParametersUnsorted() {
-        LinearProblem problem = new LinearProblem(new double[][] {
-                { 1, 1,  0,  0, 0,  0 },
-                { 0, 0,  1,  1, 1,  0 },
-                { 0, 0,  0,  0, 1, -1 },
-                { 0, 0, -1,  1, 0,  1 },
-                { 0, 0,  0, -1, 1,  0 }
-       }, new double[] { 3, 12, -1, 7, 1 });
-
-        AbstractLeastSquaresOptimizer optimizer = createOptimizer();
-        PointVectorValuePair optimum =
-            optimizer.optimize(new MaxEval(100),
-                               problem.getModelFunction(),
-                               problem.getModelFunctionJacobian(),
-                               problem.getTarget(),
-                               new Weight(new double[] { 1, 1, 1, 1, 1 }),
-                               new InitialGuess(new double[] { 2, 2, 2, 2, 2, 2 }));
-        Assert.assertEquals(0, optimizer.getRMS(), 1e-10);
-        Assert.assertEquals(3, optimum.getPointRef()[2], 1e-10);
-        Assert.assertEquals(4, optimum.getPointRef()[3], 1e-10);
-        Assert.assertEquals(5, optimum.getPointRef()[4], 1e-10);
-        Assert.assertEquals(6, optimum.getPointRef()[5], 1e-10);
-    }
-
-    @Test
-    public void testRedundantEquations() {
-        LinearProblem problem = new LinearProblem(new double[][] {
-                { 1,  1 },
-                { 1, -1 },
-                { 1,  3 }
-        }, new double[] { 3, 1, 5 });
-
-        AbstractLeastSquaresOptimizer optimizer = createOptimizer();
-        PointVectorValuePair optimum =
-            optimizer.optimize(new MaxEval(100),
-                               problem.getModelFunction(),
-                               problem.getModelFunctionJacobian(),
-                               problem.getTarget(),
-                               new Weight(new double[] { 1, 1, 1 }),
-                               new InitialGuess(new double[] { 1, 1 }));
-        Assert.assertEquals(0, optimizer.getRMS(), 1e-10);
-        Assert.assertEquals(2, optimum.getPointRef()[0], 1e-10);
-        Assert.assertEquals(1, optimum.getPointRef()[1], 1e-10);
-    }
-
-    @Test
-    public void testInconsistentEquations() {
-        LinearProblem problem = new LinearProblem(new double[][] {
-                { 1,  1 },
-                { 1, -1 },
-                { 1,  3 }
-        }, new double[] { 3, 1, 4 });
-
-        AbstractLeastSquaresOptimizer optimizer = createOptimizer();
-        optimizer.optimize(new MaxEval(100),
-                           problem.getModelFunction(),
-                           problem.getModelFunctionJacobian(),
-                           problem.getTarget(),
-                           new Weight(new double[] { 1, 1, 1 }),
-                           new InitialGuess(new double[] { 1, 1 }));
-        Assert.assertTrue(optimizer.getRMS() > 0.1);
-    }
-
-    @Test(expected=DimensionMismatchException.class)
-    public void testInconsistentSizes1() {
-        LinearProblem problem
-            = new LinearProblem(new double[][] { { 1, 0 }, { 0, 1 } },
-                                new double[] { -1, 1 });
-        AbstractLeastSquaresOptimizer optimizer = createOptimizer();
-        PointVectorValuePair optimum =
-            optimizer.optimize(new MaxEval(100),
-                               problem.getModelFunction(),
-                               problem.getModelFunctionJacobian(),
-                               problem.getTarget(),
-                               new Weight(new double[] { 1, 1 }),
-                               new InitialGuess(new double[] { 0, 0 }));
-        Assert.assertEquals(0, optimizer.getRMS(), 1e-10);
-        Assert.assertEquals(-1, optimum.getPoint()[0], 1e-10);
-        Assert.assertEquals(1, optimum.getPoint()[1], 1e-10);
-
-        optimizer.optimize(new MaxEval(100),
-                           problem.getModelFunction(),
-                           problem.getModelFunctionJacobian(),
-                           problem.getTarget(),
-                           new Weight(new double[] { 1 }),
-                           new InitialGuess(new double[] { 0, 0 }));
-    }
-
-    @Test(expected=DimensionMismatchException.class)
-    public void testInconsistentSizes2() {
-        LinearProblem problem
-            = new LinearProblem(new double[][] { { 1, 0 }, { 0, 1 } },
-                                new double[] { -1, 1 });
-        AbstractLeastSquaresOptimizer optimizer = createOptimizer();
-        PointVectorValuePair optimum
-            = optimizer.optimize(new MaxEval(100),
-                                 problem.getModelFunction(),
-                                 problem.getModelFunctionJacobian(),
-                                 problem.getTarget(),
-                                 new Weight(new double[] { 1, 1 }),
-                                 new InitialGuess(new double[] { 0, 0 }));
-        Assert.assertEquals(0, optimizer.getRMS(), 1e-10);
-        Assert.assertEquals(-1, optimum.getPoint()[0], 1e-10);
-        Assert.assertEquals(1, optimum.getPoint()[1], 1e-10);
-
-        optimizer.optimize(new MaxEval(100),
-                           problem.getModelFunction(),
-                           problem.getModelFunctionJacobian(),
-                           new Target(new double[] { 1 }),
-                           new Weight(new double[] { 1 }),
-                           new InitialGuess(new double[] { 0, 0 }));
-    }
-
-    @Test
-    public void testCircleFitting() {
-        CircleVectorial circle = new CircleVectorial();
-        circle.addPoint( 30,  68);
-        circle.addPoint( 50,  -6);
-        circle.addPoint(110, -20);
-        circle.addPoint( 35,  15);
-        circle.addPoint( 45,  97);
-        AbstractLeastSquaresOptimizer optimizer = createOptimizer();
-        PointVectorValuePair optimum
-            = optimizer.optimize(new MaxEval(100),
-                                 circle.getModelFunction(),
-                                 circle.getModelFunctionJacobian(),
-                                 new Target(new double[] { 0, 0, 0, 0, 0 }),
-                                 new Weight(new double[] { 1, 1, 1, 1, 1 }),
-                                 new InitialGuess(new double[] { 98.680, 47.345 }));
-        Assert.assertTrue(optimizer.getEvaluations() < 10);
-        double rms = optimizer.getRMS();
-        Assert.assertEquals(1.768262623567235,  FastMath.sqrt(circle.getN()) * rms,  1e-10);
-        Vector2D center = new Vector2D(optimum.getPointRef()[0], optimum.getPointRef()[1]);
-        Assert.assertEquals(69.96016176931406, circle.getRadius(center), 1e-6);
-        Assert.assertEquals(96.07590211815305, center.getX(),            1e-6);
-        Assert.assertEquals(48.13516790438953, center.getY(),            1e-6);
-        double[][] cov = optimizer.computeCovariances(optimum.getPoint(), 1e-14);
-        Assert.assertEquals(1.839, cov[0][0], 0.001);
-        Assert.assertEquals(0.731, cov[0][1], 0.001);
-        Assert.assertEquals(cov[0][1], cov[1][0], 1e-14);
-        Assert.assertEquals(0.786, cov[1][1], 0.001);
-
-        // add perfect measurements and check errors are reduced
-        double  r = circle.getRadius(center);
-        for (double d= 0; d < 2 * FastMath.PI; d += 0.01) {
-            circle.addPoint(center.getX() + r * FastMath.cos(d), center.getY() + r * FastMath.sin(d));
-        }
-        double[] target = new double[circle.getN()];
-        Arrays.fill(target, 0);
-        double[] weights = new double[circle.getN()];
-        Arrays.fill(weights, 2);
-        optimum = optimizer.optimize(new MaxEval(100),
-                                     circle.getModelFunction(),
-                                     circle.getModelFunctionJacobian(),
-                                     new Target(target),
-                                     new Weight(weights),
-                                     new InitialGuess(new double[] { 98.680, 47.345 }));
-        cov = optimizer.computeCovariances(optimum.getPoint(), 1e-14);
-        Assert.assertEquals(0.0016, cov[0][0], 0.001);
-        Assert.assertEquals(3.2e-7, cov[0][1], 1e-9);
-        Assert.assertEquals(cov[0][1], cov[1][0], 1e-14);
-        Assert.assertEquals(0.0016, cov[1][1], 0.001);
-    }
-
-    @Test
-    public void testCircleFittingBadInit() {
-        CircleVectorial circle = new CircleVectorial();
-        double[][] points = circlePoints;
-        double[] target = new double[points.length];
-        Arrays.fill(target, 0);
-        double[] weights = new double[points.length];
-        Arrays.fill(weights, 2);
-        for (int i = 0; i < points.length; ++i) {
-            circle.addPoint(points[i][0], points[i][1]);
-        }
-        AbstractLeastSquaresOptimizer optimizer = createOptimizer();
-        PointVectorValuePair optimum
-            = optimizer.optimize(new MaxEval(100),
-                                 circle.getModelFunction(),
-                                 circle.getModelFunctionJacobian(),
-                                 new Target(target),
-                                 new Weight(weights),
-                                 new InitialGuess(new double[] { -12, -12 }));
-        Vector2D center = new Vector2D(optimum.getPointRef()[0], optimum.getPointRef()[1]);
-        Assert.assertTrue(optimizer.getEvaluations() < 25);
-        Assert.assertEquals( 0.043, optimizer.getRMS(), 1e-3);
-        Assert.assertEquals( 0.292235,  circle.getRadius(center), 1e-6);
-        Assert.assertEquals(-0.151738,  center.getX(),            1e-6);
-        Assert.assertEquals( 0.2075001, center.getY(),            1e-6);
-    }
-
-    @Test
-    public void testCircleFittingGoodInit() {
-        CircleVectorial circle = new CircleVectorial();
-        double[][] points = circlePoints;
-        double[] target = new double[points.length];
-        Arrays.fill(target, 0);
-        double[] weights = new double[points.length];
-        Arrays.fill(weights, 2);
-        for (int i = 0; i < points.length; ++i) {
-            circle.addPoint(points[i][0], points[i][1]);
-        }
-        AbstractLeastSquaresOptimizer optimizer = createOptimizer();
-        PointVectorValuePair optimum =
-            optimizer.optimize(new MaxEval(100),
-                               circle.getModelFunction(),
-                               circle.getModelFunctionJacobian(),
-                               new Target(target),
-                               new Weight(weights),
-                               new InitialGuess(new double[] { 0, 0 }));
-        Assert.assertEquals(-0.1517383071957963, optimum.getPointRef()[0], 1e-6);
-        Assert.assertEquals(0.2074999736353867,  optimum.getPointRef()[1], 1e-6);
-        Assert.assertEquals(0.04268731682389561, optimizer.getRMS(),       1e-8);
-    }
-
-    private final double[][] circlePoints = new double[][] {
-        {-0.312967,  0.072366}, {-0.339248,  0.132965}, {-0.379780,  0.202724},
-        {-0.390426,  0.260487}, {-0.361212,  0.328325}, {-0.346039,  0.392619},
-        {-0.280579,  0.444306}, {-0.216035,  0.470009}, {-0.149127,  0.493832},
-        {-0.075133,  0.483271}, {-0.007759,  0.452680}, { 0.060071,  0.410235},
-        { 0.103037,  0.341076}, { 0.118438,  0.273884}, { 0.131293,  0.192201},
-        { 0.115869,  0.129797}, { 0.072223,  0.058396}, { 0.022884,  0.000718},
-        {-0.053355, -0.020405}, {-0.123584, -0.032451}, {-0.216248, -0.032862},
-        {-0.278592, -0.005008}, {-0.337655,  0.056658}, {-0.385899,  0.112526},
-        {-0.405517,  0.186957}, {-0.415374,  0.262071}, {-0.387482,  0.343398},
-        {-0.347322,  0.397943}, {-0.287623,  0.458425}, {-0.223502,  0.475513},
-        {-0.135352,  0.478186}, {-0.061221,  0.483371}, { 0.003711,  0.422737},
-        { 0.065054,  0.375830}, { 0.108108,  0.297099}, { 0.123882,  0.222850},
-        { 0.117729,  0.134382}, { 0.085195,  0.056820}, { 0.029800, -0.019138},
-        {-0.027520, -0.072374}, {-0.102268, -0.091555}, {-0.200299, -0.106578},
-        {-0.292731, -0.091473}, {-0.356288, -0.051108}, {-0.420561,  0.014926},
-        {-0.471036,  0.074716}, {-0.488638,  0.182508}, {-0.485990,  0.254068},
-        {-0.463943,  0.338438}, {-0.406453,  0.404704}, {-0.334287,  0.466119},
-        {-0.254244,  0.503188}, {-0.161548,  0.495769}, {-0.075733,  0.495560},
-        { 0.001375,  0.434937}, { 0.082787,  0.385806}, { 0.115490,  0.323807},
-        { 0.141089,  0.223450}, { 0.138693,  0.131703}, { 0.126415,  0.049174},
-        { 0.066518, -0.010217}, {-0.005184, -0.070647}, {-0.080985, -0.103635},
-        {-0.177377, -0.116887}, {-0.260628, -0.100258}, {-0.335756, -0.056251},
-        {-0.405195, -0.000895}, {-0.444937,  0.085456}, {-0.484357,  0.175597},
-        {-0.472453,  0.248681}, {-0.438580,  0.347463}, {-0.402304,  0.422428},
-        {-0.326777,  0.479438}, {-0.247797,  0.505581}, {-0.152676,  0.519380},
-        {-0.071754,  0.516264}, { 0.015942,  0.472802}, { 0.076608,  0.419077},
-        { 0.127673,  0.330264}, { 0.159951,  0.262150}, { 0.153530,  0.172681},
-        { 0.140653,  0.089229}, { 0.078666,  0.024981}, { 0.023807, -0.037022},
-        {-0.048837, -0.077056}, {-0.127729, -0.075338}, {-0.221271, -0.067526}
-    };
-
-    public void doTestStRD(final StatisticalReferenceDataset dataset,
-                           final double errParams,
-                           final double errParamsSd) {
-        final AbstractLeastSquaresOptimizer optimizer = createOptimizer();
-        final double[] w = new double[dataset.getNumObservations()];
-        Arrays.fill(w, 1);
-
-        final double[][] data = dataset.getData();
-        final double[] initial = dataset.getStartingPoint(0);
-        final StatisticalReferenceDataset.LeastSquaresProblem problem = dataset.getLeastSquaresProblem();
-        final PointVectorValuePair optimum
-            = optimizer.optimize(new MaxEval(100),
-                                 problem.getModelFunction(),
-                                 problem.getModelFunctionJacobian(),
-                                 new Target(data[1]),
-                                 new Weight(w),
-                                 new InitialGuess(initial));
-
-        final double[] actual = optimum.getPoint();
-        for (int i = 0; i < actual.length; i++) {
-            double expected = dataset.getParameter(i);
-            double delta = FastMath.abs(errParams * expected);
-            Assert.assertEquals(dataset.getName() + ", param #" + i,
-                                expected, actual[i], delta);
-        }
-    }
-
-    @Test
-    public void testKirby2() throws IOException {
-        doTestStRD(StatisticalReferenceDatasetFactory.createKirby2(), 1E-7, 1E-7);
-    }
-
-    @Test
-    public void testHahn1() throws IOException {
-        doTestStRD(StatisticalReferenceDatasetFactory.createHahn1(), 1E-7, 1E-4);
-    }
-
-    static class LinearProblem {
-        private final RealMatrix factors;
-        private final double[] target;
-
-        public LinearProblem(double[][] factors, double[] target) {
-            this.factors = new BlockRealMatrix(factors);
-            this.target  = target;
-        }
-
-        public Target getTarget() {
-            return new Target(target);
-        }
-
-        public ModelFunction getModelFunction() {
-            return new ModelFunction(new MultivariateVectorFunction() {
-                    public double[] value(double[] params) {
-                        return factors.operate(params);
-                    }
-                });
-        }
-
-        public ModelFunctionJacobian getModelFunctionJacobian() {
-            return new ModelFunctionJacobian(new MultivariateMatrixFunction() {
-                    public double[][] value(double[] params) {
-                        return factors.getData();
-                    }
-                });
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e31fde87/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerTest.java b/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerTest.java
deleted file mode 100644
index aad5e43..0000000
--- a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerTest.java
+++ /dev/null
@@ -1,129 +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 java.io.IOException;
-import java.util.Arrays;
-
-import org.apache.commons.math4.optim.InitialGuess;
-import org.apache.commons.math4.optim.MaxEval;
-import org.apache.commons.math4.optim.PointVectorValuePair;
-import org.apache.commons.math4.optim.nonlinear.vector.Target;
-import org.apache.commons.math4.optim.nonlinear.vector.Weight;
-import org.apache.commons.math4.optim.nonlinear.vector.jacobian.AbstractLeastSquaresOptimizer;
-import org.apache.commons.math4.util.FastMath;
-import org.junit.Test;
-import org.junit.Assert;
-
-@Deprecated
-public class AbstractLeastSquaresOptimizerTest {
-
-    public static AbstractLeastSquaresOptimizer createOptimizer() {
-        return new AbstractLeastSquaresOptimizer(null) {
-
-            @Override
-            protected PointVectorValuePair doOptimize() {
-                final double[] params = getStartPoint();
-                final double[] res = computeResiduals(computeObjectiveValue(params));
-                setCost(computeCost(res));
-                return new PointVectorValuePair(params, null);
-            }
-        };
-    }
-
-    @Test
-    public void testGetChiSquare() throws IOException {
-        final StatisticalReferenceDataset dataset
-            = StatisticalReferenceDatasetFactory.createKirby2();
-        final AbstractLeastSquaresOptimizer optimizer = createOptimizer();
-        final double[] a = dataset.getParameters();
-        final double[] y = dataset.getData()[1];
-        final double[] w = new double[y.length];
-        Arrays.fill(w, 1.0);
-
-        StatisticalReferenceDataset.LeastSquaresProblem problem
-            = dataset.getLeastSquaresProblem();
-
-        optimizer.optimize(new MaxEval(1),
-                           problem.getModelFunction(),
-                           problem.getModelFunctionJacobian(),
-                           new Target(y),
-                           new Weight(w),
-                           new InitialGuess(a));
-        final double expected = dataset.getResidualSumOfSquares();
-        final double actual = optimizer.getChiSquare();
-        Assert.assertEquals(dataset.getName(), expected, actual,
-                            1E-11 * expected);
-    }
-
-    @Test
-    public void testGetRMS() throws IOException {
-        final StatisticalReferenceDataset dataset
-            = StatisticalReferenceDatasetFactory.createKirby2();
-        final AbstractLeastSquaresOptimizer optimizer = createOptimizer();
-        final double[] a = dataset.getParameters();
-        final double[] y = dataset.getData()[1];
-        final double[] w = new double[y.length];
-        Arrays.fill(w, 1);
-
-        StatisticalReferenceDataset.LeastSquaresProblem problem
-            = dataset.getLeastSquaresProblem();
-
-        optimizer.optimize(new MaxEval(1),
-                           problem.getModelFunction(),
-                           problem.getModelFunctionJacobian(),
-                           new Target(y),
-                           new Weight(w),
-                           new InitialGuess(a));
-
-        final double expected = FastMath
-            .sqrt(dataset.getResidualSumOfSquares() /
-                  dataset.getNumObservations());
-        final double actual = optimizer.getRMS();
-        Assert.assertEquals(dataset.getName(), expected, actual,
-                            1E-11 * expected);
-    }
-
-    @Test
-    public void testComputeSigma() throws IOException {
-        final StatisticalReferenceDataset dataset
-            = StatisticalReferenceDatasetFactory.createKirby2();
-        final AbstractLeastSquaresOptimizer optimizer = createOptimizer();
-        final double[] a = dataset.getParameters();
-        final double[] y = dataset.getData()[1];
-        final double[] w = new double[y.length];
-        Arrays.fill(w, 1);
-
-        StatisticalReferenceDataset.LeastSquaresProblem problem
-            = dataset.getLeastSquaresProblem();
-
-        final PointVectorValuePair optimum
-            = optimizer.optimize(new MaxEval(1),
-                                 problem.getModelFunction(),
-                                 problem.getModelFunctionJacobian(),
-                                 new Target(y),
-                                 new Weight(w),
-                                 new InitialGuess(a));
-
-        final double[] sig = optimizer.computeSigma(optimum.getPoint(), 1e-14);
-
-        final int dof = y.length - a.length;
-        final double[] expected = dataset.getParametersStandardDeviations();
-        for (int i = 0; i < sig.length; i++) {
-            final double actual = FastMath.sqrt(optimizer.getChiSquare() / dof) * sig[i];
-            Assert.assertEquals(dataset.getName() + ", parameter #" + i,
-                                expected[i], actual, 1e-6 * expected[i]);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e31fde87/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerTestValidation.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerTestValidation.java b/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerTestValidation.java
deleted file mode 100644
index 9235e6b..0000000
--- a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerTestValidation.java
+++ /dev/null
@@ -1,335 +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 java.util.Arrays;
-import java.util.List;
-import java.util.ArrayList;
-import java.awt.geom.Point2D;
-
-import org.apache.commons.math4.optim.InitialGuess;
-import org.apache.commons.math4.optim.MaxEval;
-import org.apache.commons.math4.optim.PointVectorValuePair;
-import org.apache.commons.math4.optim.nonlinear.vector.Target;
-import org.apache.commons.math4.optim.nonlinear.vector.Weight;
-import org.apache.commons.math4.optim.nonlinear.vector.jacobian.AbstractLeastSquaresOptimizer;
-import org.apache.commons.math4.stat.descriptive.StatisticalSummary;
-import org.apache.commons.math4.stat.descriptive.SummaryStatistics;
-import org.apache.commons.math4.util.FastMath;
-import org.junit.Test;
-import org.junit.Assert;
-
-/**
- * This class demonstrates the main functionality of the
- * {@link AbstractLeastSquaresOptimizer}, common to the
- * optimizer implementations in package
- * {@link org.apache.commons.math4.optimization.general}.
- * <br/>
- * Not enabled by default, as the class name does not end with "Test".
- * <br/>
- * Invoke by running
- * <pre><code>
- *  mvn test -Dtest=AbstractLeastSquaresOptimizerTestValidation
- * </code></pre>
- * or by running
- * <pre><code>
- *  mvn test -Dtest=AbstractLeastSquaresOptimizerTestValidation -DargLine="-DmcRuns=1234 -server"
- * </code></pre>
- */
-@Deprecated
-public class AbstractLeastSquaresOptimizerTestValidation {
-    private static final int MONTE_CARLO_RUNS = Integer.parseInt(System.getProperty("mcRuns",
-                                                                                    "100"));
-
-    /**
-     * Using a Monte-Carlo procedure, this test checks the error estimations
-     * as provided by the square-root of the diagonal elements of the
-     * covariance matrix.
-     * <br/>
-     * The test generates sets of observations, each sampled from
-     * a Gaussian distribution.
-     * <br/>
-     * The optimization problem solved is defined in class
-     * {@link StraightLineProblem}.
-     * <br/>
-     * The output (on stdout) will be a table summarizing the distribution
-     * of parameters generated by the Monte-Carlo process and by the direct
-     * estimation provided by the diagonal elements of the covariance matrix.
-     */
-    @Test
-    public void testParametersErrorMonteCarloObservations() {
-        // Error on the observations.
-        final double yError = 15;
-
-        // True values of the parameters.
-        final double slope = 123.456;
-        final double offset = -98.765;
-
-        // Samples generator.
-        final RandomStraightLinePointGenerator lineGenerator
-            = new RandomStraightLinePointGenerator(slope, offset,
-                                                   yError,
-                                                   -1e3, 1e4,
-                                                   138577L);
-
-        // Number of observations.
-        final int numObs = 100; // XXX Should be a command-line option.
-        // number of parameters.
-        final int numParams = 2;
-
-        // Parameters found for each of Monte-Carlo run.
-        final SummaryStatistics[] paramsFoundByDirectSolution = new SummaryStatistics[numParams];
-        // Sigma estimations (square-root of the diagonal elements of the
-        // covariance matrix), for each Monte-Carlo run.
-        final SummaryStatistics[] sigmaEstimate = new SummaryStatistics[numParams];
-
-        // Initialize statistics accumulators.
-        for (int i = 0; i < numParams; i++) {
-            paramsFoundByDirectSolution[i] = new SummaryStatistics();
-            sigmaEstimate[i] = new SummaryStatistics();
-        }
-
-        // Dummy optimizer (to compute the covariance matrix).
-        final AbstractLeastSquaresOptimizer optim = new DummyOptimizer();
-        final double[] init = { slope, offset };
-
-        // Monte-Carlo (generates many sets of observations).
-        final int mcRepeat = MONTE_CARLO_RUNS;
-        int mcCount = 0;
-        while (mcCount < mcRepeat) {
-            // Observations.
-            final Point2D.Double[] obs = lineGenerator.generate(numObs);
-
-            final StraightLineProblem problem = new StraightLineProblem(yError);
-            for (int i = 0; i < numObs; i++) {
-                final Point2D.Double p = obs[i];
-                problem.addPoint(p.x, p.y);
-            }
-
-            // Direct solution (using simple regression).
-            final double[] regress = problem.solve();
-
-            // Estimation of the standard deviation (diagonal elements of the
-            // covariance matrix).
-            final PointVectorValuePair optimum
-                = optim.optimize(new MaxEval(Integer.MAX_VALUE),
-                                 problem.getModelFunction(),
-                                 problem.getModelFunctionJacobian(),
-                                 new Target(problem.target()),
-                                 new Weight(problem.weight()),
-                                 new InitialGuess(init));
-            final double[] sigma = optim.computeSigma(optimum.getPoint(), 1e-14);
-
-            // Accumulate statistics.
-            for (int i = 0; i < numParams; i++) {
-                paramsFoundByDirectSolution[i].addValue(regress[i]);
-                sigmaEstimate[i].addValue(sigma[i]);
-            }
-
-            // Next Monte-Carlo.
-            ++mcCount;
-        }
-
-        // Print statistics.
-        final String line = "--------------------------------------------------------------";
-        System.out.println("                 True value       Mean        Std deviation");
-        for (int i = 0; i < numParams; i++) {
-            System.out.println(line);
-            System.out.println("Parameter #" + i);
-
-            StatisticalSummary s = paramsFoundByDirectSolution[i].getSummary();
-            System.out.printf("              %+.6e   %+.6e   %+.6e\n",
-                              init[i],
-                              s.getMean(),
-                              s.getStandardDeviation());
-
-            s = sigmaEstimate[i].getSummary();
-            System.out.printf("sigma: %+.6e (%+.6e)\n",
-                              s.getMean(),
-                              s.getStandardDeviation());
-        }
-        System.out.println(line);
-
-        // Check the error estimation.
-        for (int i = 0; i < numParams; i++) {
-            Assert.assertEquals(paramsFoundByDirectSolution[i].getSummary().getStandardDeviation(),
-                                sigmaEstimate[i].getSummary().getMean(),
-                                8e-2);
-        }
-    }
-
-    /**
-     * In this test, the set of observations is fixed.
-     * Using a Monte-Carlo procedure, it generates sets of parameters,
-     * and determine the parameter change that will result in the
-     * normalized chi-square becoming larger by one than the value from
-     * the best fit solution.
-     * <br/>
-     * The optimization problem solved is defined in class
-     * {@link StraightLineProblem}.
-     * <br/>
-     * The output (on stdout) will be a list of lines containing:
-     * <ul>
-     *  <li>slope of the straight line,</li>
-     *  <li>intercept of the straight line,</li>
-     *  <li>chi-square of the solution defined by the above two values.</li>
-     * </ul>
-     * The output is separated into two blocks (with a blank line between
-     * them); the first block will contain all parameter sets for which
-     * {@code chi2 < chi2_b + 1}
-     * and the second block, all sets for which
-     * {@code chi2 >= chi2_b + 1}
-     * where {@code chi2_b} is the lowest chi-square (corresponding to the
-     * best solution).
-     */
-    @Test
-    public void testParametersErrorMonteCarloParameters() {
-        // Error on the observations.
-        final double yError = 15;
-
-        // True values of the parameters.
-        final double slope = 123.456;
-        final double offset = -98.765;
-
-        // Samples generator.
-        final RandomStraightLinePointGenerator lineGenerator
-            = new RandomStraightLinePointGenerator(slope, offset,
-                                                   yError,
-                                                   -1e3, 1e4,
-                                                   13839013L);
-
-        // Number of observations.
-        final int numObs = 10;
-
-        // Create a single set of observations.
-        final Point2D.Double[] obs = lineGenerator.generate(numObs);
-
-        final StraightLineProblem problem = new StraightLineProblem(yError);
-        for (int i = 0; i < numObs; i++) {
-            final Point2D.Double p = obs[i];
-            problem.addPoint(p.x, p.y);
-        }
-
-        // Direct solution (using simple regression).
-        final double[] regress = problem.solve();
-
-        // Dummy optimizer (to compute the chi-square).
-        final AbstractLeastSquaresOptimizer optim = new DummyOptimizer();
-        // Get chi-square of the best parameters set for the given set of
-        // observations.
-        final double bestChi2N = getChi2N(optim, problem, regress);
-        final double[] sigma = optim.computeSigma(regress, 1e-14);
-
-        // Monte-Carlo (generates a grid of parameters).
-        final int mcRepeat = MONTE_CARLO_RUNS;
-        final int gridSize = (int) FastMath.sqrt(mcRepeat);
-
-        // Parameters found for each of Monte-Carlo run.
-        // Index 0 = slope
-        // Index 1 = offset
-        // Index 2 = normalized chi2
-        final List<double[]> paramsAndChi2 = new ArrayList<double[]>(gridSize * gridSize);
-
-        final double slopeRange = 10 * sigma[0];
-        final double offsetRange = 10 * sigma[1];
-        final double minSlope = slope - 0.5 * slopeRange;
-        final double minOffset = offset - 0.5 * offsetRange;
-        final double deltaSlope =  slopeRange/ gridSize;
-        final double deltaOffset = offsetRange / gridSize;
-        for (int i = 0; i < gridSize; i++) {
-            final double s = minSlope + i * deltaSlope;
-            for (int j = 0; j < gridSize; j++) {
-                final double o = minOffset + j * deltaOffset;
-                final double chi2N = getChi2N(optim, problem, new double[] {s, o});
-
-                paramsAndChi2.add(new double[] {s, o, chi2N});
-            }
-        }
-
-        // Output (for use with "gnuplot").
-
-        // Some info.
-
-        // For plotting separately sets of parameters that have a large chi2.
-        final double chi2NPlusOne = bestChi2N + 1;
-        int numLarger = 0;
-
-        final String lineFmt = "%+.10e %+.10e   %.8e\n";
-
-        // Point with smallest chi-square.
-        System.out.printf(lineFmt, regress[0], regress[1], bestChi2N);
-        System.out.println(); // Empty line.
-
-        // Points within the confidence interval.
-        for (double[] d : paramsAndChi2) {
-            if (d[2] <= chi2NPlusOne) {
-                System.out.printf(lineFmt, d[0], d[1], d[2]);
-            }
-        }
-        System.out.println(); // Empty line.
-
-        // Points outside the confidence interval.
-        for (double[] d : paramsAndChi2) {
-            if (d[2] > chi2NPlusOne) {
-                ++numLarger;
-                System.out.printf(lineFmt, d[0], d[1], d[2]);
-            }
-        }
-        System.out.println(); // Empty line.
-
-        System.out.println("# sigma=" + Arrays.toString(sigma));
-        System.out.println("# " + numLarger + " sets filtered out");
-    }
-
-    /**
-     * @return the normalized chi-square.
-     */
-    private double getChi2N(AbstractLeastSquaresOptimizer optim,
-                            StraightLineProblem problem,
-                            double[] params) {
-        final double[] t = problem.target();
-        final double[] w = problem.weight();
-
-        optim.optimize(new MaxEval(Integer.MAX_VALUE),
-                       problem.getModelFunction(),
-                       problem.getModelFunctionJacobian(),
-                       new Target(t),
-                       new Weight(w),
-                       new InitialGuess(params));
-
-        return optim.getChiSquare() / (t.length - params.length);
-    }
-}
-
-/**
- * A dummy optimizer.
- * Used for computing the covariance matrix.
- */
-@Deprecated
-class DummyOptimizer extends AbstractLeastSquaresOptimizer {
-    public DummyOptimizer() {
-        super(null);
-    }
-
-    /**
-     * This method does nothing and returns a dummy value.
-     */
-    @Override
-    public PointVectorValuePair doOptimize() {
-        final double[] params = getStartPoint();
-        final double[] res = computeResiduals(computeObjectiveValue(params));
-        setCost(computeCost(res));
-        return new PointVectorValuePair(params, null);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e31fde87/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/CircleProblem.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/CircleProblem.java b/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/CircleProblem.java
deleted file mode 100644
index 9458fe8..0000000
--- a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/CircleProblem.java
+++ /dev/null
@@ -1,179 +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 java.util.ArrayList;
-
-import org.apache.commons.math4.analysis.MultivariateMatrixFunction;
-import org.apache.commons.math4.analysis.MultivariateVectorFunction;
-import org.apache.commons.math4.optim.nonlinear.vector.ModelFunction;
-import org.apache.commons.math4.optim.nonlinear.vector.ModelFunctionJacobian;
-import org.apache.commons.math4.util.FastMath;
-import org.apache.commons.math4.util.MathUtils;
-
-/**
- * Class that models a circle.
- * The parameters of problem are:
- * <ul>
- *  <li>the x-coordinate of the circle center,</li>
- *  <li>the y-coordinate of the circle center,</li>
- *  <li>the radius of the circle.</li>
- * </ul>
- * The model functions are:
- * <ul>
- *  <li>for each triplet (cx, cy, r), the (x, y) coordinates of a point on the
- *   corresponding circle.</li>
- * </ul>
- */
-@Deprecated
-class CircleProblem {
-    /** Cloud of points assumed to be fitted by a circle. */
-    private final ArrayList<double[]> points;
-    /** Error on the x-coordinate of the points. */
-    private final double xSigma;
-    /** Error on the y-coordinate of the points. */
-    private final double ySigma;
-    /** Number of points on the circumference (when searching which
-        model point is closest to a given "observation". */
-    private final int resolution;
-
-    /**
-     * @param xError Assumed error for the x-coordinate of the circle points.
-     * @param yError Assumed error for the y-coordinate of the circle points.
-     * @param searchResolution Number of points to try when searching the one
-     * that is closest to a given "observed" point.
-     */
-    public CircleProblem(double xError,
-                         double yError,
-                         int searchResolution) {
-        points = new ArrayList<double[]>();
-        xSigma = xError;
-        ySigma = yError;
-        resolution = searchResolution;
-    }
-
-    /**
-     * @param xError Assumed error for the x-coordinate of the circle points.
-     * @param yError Assumed error for the y-coordinate of the circle points.
-     */
-    public CircleProblem(double xError,
-                         double yError) {
-        this(xError, yError, 500);
-    }
-
-    public void addPoint(double px, double py) {
-        points.add(new double[] { px, py });
-    }
-
-    public double[] target() {
-        final double[] t = new double[points.size() * 2];
-        for (int i = 0; i < points.size(); i++) {
-            final double[] p = points.get(i);
-            final int index = i * 2;
-            t[index] = p[0];
-            t[index + 1] = p[1];
-        }
-
-        return t;
-    }
-
-    public double[] weight() {
-        final double wX = 1 / (xSigma * xSigma);
-        final double wY = 1 / (ySigma * ySigma);
-        final double[] w = new double[points.size() * 2];
-        for (int i = 0; i < points.size(); i++) {
-            final int index = i * 2;
-            w[index] = wX;
-            w[index + 1] = wY;
-        }
-
-        return w;
-    }
-
-    public ModelFunction getModelFunction() {
-        return new ModelFunction(new MultivariateVectorFunction() {
-                public double[] value(double[] params) {
-                    final double cx = params[0];
-                    final double cy = params[1];
-                    final double r = params[2];
-
-                    final double[] model = new double[points.size() * 2];
-
-                    final double deltaTheta = MathUtils.TWO_PI / resolution;
-                    for (int i = 0; i < points.size(); i++) {
-                        final double[] p = points.get(i);
-                        final double px = p[0];
-                        final double py = p[1];
-
-                        double bestX = 0;
-                        double bestY = 0;
-                        double dMin = Double.POSITIVE_INFINITY;
-
-                        // Find the angle for which the circle passes closest to the
-                        // current point (using a resolution of 100 points along the
-                        // circumference).
-                        for (double theta = 0; theta <= MathUtils.TWO_PI; theta += deltaTheta) {
-                            final double currentX = cx + r * FastMath.cos(theta);
-                            final double currentY = cy + r * FastMath.sin(theta);
-                            final double dX = currentX - px;
-                            final double dY = currentY - py;
-                            final double d = dX * dX + dY * dY;
-                            if (d < dMin) {
-                                dMin = d;
-                                bestX = currentX;
-                                bestY = currentY;
-                            }
-                        }
-
-                        final int index = i * 2;
-                        model[index] = bestX;
-                        model[index + 1] = bestY;
-                    }
-
-                    return model;
-                }
-            });
-    }
-
-    public ModelFunctionJacobian getModelFunctionJacobian() {
-        return new ModelFunctionJacobian(new MultivariateMatrixFunction() {
-                public double[][] value(double[] point) {
-                    return jacobian(point);
-                }
-        });
-    }
-
-    private double[][] jacobian(double[] params) {
-        final double[][] jacobian = new double[points.size() * 2][3];
-
-        for (int i = 0; i < points.size(); i++) {
-            final int index = i * 2;
-            // Partial derivative wrt x-coordinate of center. 
-            jacobian[index][0] = 1;
-            jacobian[index + 1][0] = 0;
-            // Partial derivative wrt y-coordinate of center.
-            jacobian[index][1] = 0;
-            jacobian[index + 1][1] = 1;
-            // Partial derivative wrt radius.
-            final double[] p = points.get(i);
-            jacobian[index][2] = (p[0] - params[0]) / params[2];
-            jacobian[index + 1][2] = (p[1] - params[1]) / params[2];
-        }
-
-        return jacobian;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e31fde87/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/CircleVectorial.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/CircleVectorial.java b/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/CircleVectorial.java
deleted file mode 100644
index 7b6a310..0000000
--- a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/CircleVectorial.java
+++ /dev/null
@@ -1,99 +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 java.util.ArrayList;
-
-import org.apache.commons.math4.analysis.MultivariateMatrixFunction;
-import org.apache.commons.math4.analysis.MultivariateVectorFunction;
-import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math4.optim.nonlinear.vector.ModelFunction;
-import org.apache.commons.math4.optim.nonlinear.vector.ModelFunctionJacobian;
-
-/**
- * Class used in the tests.
- */
-@Deprecated
-class CircleVectorial {
-    private ArrayList<Vector2D> points;
-
-    public CircleVectorial() {
-        points  = new ArrayList<Vector2D>();
-    }
-
-    public void addPoint(double px, double py) {
-        points.add(new Vector2D(px, py));
-    }
-
-    public int getN() {
-        return points.size();
-    }
-
-    public double getRadius(Vector2D center) {
-        double r = 0;
-        for (Vector2D point : points) {
-            r += point.distance(center);
-        }
-        return r / points.size();
-    }
-
-    public ModelFunction getModelFunction() {
-        return new ModelFunction(new MultivariateVectorFunction() {
-                public double[] value(double[] params) {
-                    Vector2D center = new Vector2D(params[0], params[1]);
-                    double radius = getRadius(center);
-                    double[] residuals = new double[points.size()];
-                    for (int i = 0; i < residuals.length; i++) {
-                        residuals[i] = points.get(i).distance(center) - radius;
-                    }
-
-                    return residuals;
-                }
-        });
-    }
-
-    public ModelFunctionJacobian getModelFunctionJacobian() {
-        return new ModelFunctionJacobian(new MultivariateMatrixFunction() {
-                public double[][] value(double[] params) {
-                    final int n = points.size();
-                    final Vector2D center = new Vector2D(params[0], params[1]);
-
-                    double dRdX = 0;
-                    double dRdY = 0;
-                    for (Vector2D pk : points) {
-                        double dk = pk.distance(center);
-                        dRdX += (center.getX() - pk.getX()) / dk;
-                        dRdY += (center.getY() - pk.getY()) / dk;
-                    }
-                    dRdX /= n;
-                    dRdY /= n;
-
-                    // Jacobian of the radius residuals.
-                    double[][] jacobian = new double[n][2];
-                    for (int i = 0; i < n; i++) {
-                        final Vector2D pi = points.get(i);
-                        final double di = pi.distance(center);
-                        jacobian[i][0] = (center.getX() - pi.getX()) / di - dRdX;
-                        jacobian[i][1] = (center.getY() - pi.getY()) / di - dRdY;
-                    }
-
-                    return jacobian;
-                }
-        });
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e31fde87/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/GaussNewtonOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/GaussNewtonOptimizerTest.java b/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/GaussNewtonOptimizerTest.java
deleted file mode 100644
index 7e73a9a..0000000
--- a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/GaussNewtonOptimizerTest.java
+++ /dev/null
@@ -1,173 +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 java.io.IOException;
-
-import org.apache.commons.math4.exception.ConvergenceException;
-import org.apache.commons.math4.exception.MathUnsupportedOperationException;
-import org.apache.commons.math4.exception.TooManyEvaluationsException;
-import org.apache.commons.math4.optim.InitialGuess;
-import org.apache.commons.math4.optim.MaxEval;
-import org.apache.commons.math4.optim.SimpleBounds;
-import org.apache.commons.math4.optim.SimpleVectorValueChecker;
-import org.apache.commons.math4.optim.nonlinear.vector.Target;
-import org.apache.commons.math4.optim.nonlinear.vector.Weight;
-import org.apache.commons.math4.optim.nonlinear.vector.jacobian.AbstractLeastSquaresOptimizer;
-import org.apache.commons.math4.optim.nonlinear.vector.jacobian.GaussNewtonOptimizer;
-import org.junit.Test;
-
-/**
- * <p>Some of the unit tests are re-implementations of the MINPACK <a
- * href="http://www.netlib.org/minpack/ex/file17">file17</a> and <a
- * href="http://www.netlib.org/minpack/ex/file22">file22</a> test files.
- * The redistribution policy for MINPACK is available <a
- * href="http://www.netlib.org/minpack/disclaimer">here</a>, for
- * convenience, it is reproduced below.</p>
-
- * <table border="0" width="80%" cellpadding="10" align="center" bgcolor="#E0E0E0">
- * <tr><td>
- *    Minpack Copyright Notice (1999) University of Chicago.
- *    All rights reserved
- * </td></tr>
- * <tr><td>
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * <ol>
- *  <li>Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.</li>
- * <li>Redistributions in binary form must reproduce the above
- *     copyright notice, this list of conditions and the following
- *     disclaimer in the documentation and/or other materials provided
- *     with the distribution.</li>
- * <li>The end-user documentation included with the redistribution, if any,
- *     must include the following acknowledgment:
- *     <code>This product includes software developed by the University of
- *           Chicago, as Operator of Argonne National Laboratory.</code>
- *     Alternately, this acknowledgment may appear in the software itself,
- *     if and wherever such third-party acknowledgments normally appear.</li>
- * <li><strong>WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS"
- *     WITHOUT WARRANTY OF ANY KIND. THE COPYRIGHT HOLDER, THE
- *     UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND
- *     THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR
- *     IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES
- *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE
- *     OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL LIABILITY
- *     OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR
- *     USEFULNESS OF THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF
- *     THE SOFTWARE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS, (4)
- *     DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION
- *     UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL
- *     BE CORRECTED.</strong></li>
- * <li><strong>LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT
- *     HOLDER, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF
- *     ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT,
- *     INCIDENTAL, CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF
- *     ANY KIND OR NATURE, INCLUDING BUT NOT LIMITED TO LOSS OF
- *     PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, WHETHER
- *     SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT
- *     (INCLUDING NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE,
- *     EVEN IF ANY OF SAID PARTIES HAS BEEN WARNED OF THE
- *     POSSIBILITY OF SUCH LOSS OR DAMAGES.</strong></li>
- * <ol></td></tr>
- * </table>
-
- * @author Argonne National Laboratory. MINPACK project. March 1980 (original fortran minpack tests)
- * @author Burton S. Garbow (original fortran minpack tests)
- * @author Kenneth E. Hillstrom (original fortran minpack tests)
- * @author Jorge J. More (original fortran minpack tests)
- * @author Luc Maisonobe (non-minpack tests and minpack tests Java translation)
- */
-@Deprecated
-public class GaussNewtonOptimizerTest
-    extends AbstractLeastSquaresOptimizerAbstractTest {
-
-    @Override
-    public AbstractLeastSquaresOptimizer createOptimizer() {
-        return new GaussNewtonOptimizer(new SimpleVectorValueChecker(1.0e-6, 1.0e-6));
-    }
-
-    @Test(expected=MathUnsupportedOperationException.class)
-    public void testConstraintsUnsupported() {
-        createOptimizer().optimize(new MaxEval(100),
-                                   new Target(new double[] { 2 }),
-                                   new Weight(new double[] { 1 }),
-                                   new InitialGuess(new double[] { 1, 2 }),
-                                   new SimpleBounds(new double[] { -10, 0 },
-                                                    new double[] { 20, 30 }));
-    }
-
-    @Override
-    @Test(expected = ConvergenceException.class)
-    public void testMoreEstimatedParametersSimple() {
-        /*
-         * Exception is expected with this optimizer
-         */
-        super.testMoreEstimatedParametersSimple();
-    }
-
-    @Override
-    @Test(expected=ConvergenceException.class)
-    public void testMoreEstimatedParametersUnsorted() {
-        /*
-         * Exception is expected with this optimizer
-         */
-        super.testMoreEstimatedParametersUnsorted();
-    }
-
-    @Test(expected=TooManyEvaluationsException.class)
-    public void testMaxEvaluations() throws Exception {
-        CircleVectorial circle = new CircleVectorial();
-        circle.addPoint( 30.0,  68.0);
-        circle.addPoint( 50.0,  -6.0);
-        circle.addPoint(110.0, -20.0);
-        circle.addPoint( 35.0,  15.0);
-        circle.addPoint( 45.0,  97.0);
-
-        GaussNewtonOptimizer optimizer
-            = new GaussNewtonOptimizer(new SimpleVectorValueChecker(1e-30, 1e-30));
-
-        optimizer.optimize(new MaxEval(100),
-                           circle.getModelFunction(),
-                           circle.getModelFunctionJacobian(),
-                           new Target(new double[] { 0, 0, 0, 0, 0 }),
-                           new Weight(new double[] { 1, 1, 1, 1, 1 }),
-                           new InitialGuess(new double[] { 98.680, 47.345 }));
-    }
-
-    @Override
-    @Test(expected=ConvergenceException.class)
-    public void testCircleFittingBadInit() {
-        /*
-         * This test does not converge with this optimizer.
-         */
-        super.testCircleFittingBadInit();
-    }
-
-    @Override
-    @Test(expected = ConvergenceException.class)
-    public void testHahn1()
-        throws IOException {
-        /*
-         * TODO This test leads to a singular problem with the Gauss-Newton
-         * optimizer. This should be inquired.
-         */
-        super.testHahn1();
-    }
-}


[3/5] [math] Remove deprecated classes in optim package.

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e31fde87/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/RandomCirclePointGenerator.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/RandomCirclePointGenerator.java b/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/RandomCirclePointGenerator.java
deleted file mode 100644
index d969b57..0000000
--- a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/RandomCirclePointGenerator.java
+++ /dev/null
@@ -1,91 +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.distribution.NormalDistribution;
-import org.apache.commons.math4.distribution.RealDistribution;
-import org.apache.commons.math4.distribution.UniformRealDistribution;
-import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math4.random.RandomGenerator;
-import org.apache.commons.math4.random.Well44497b;
-import org.apache.commons.math4.util.FastMath;
-import org.apache.commons.math4.util.MathUtils;
-
-/**
- * Factory for generating a cloud of points that approximate a circle.
- */
-@Deprecated
-public class RandomCirclePointGenerator {
-    /** RNG for the x-coordinate of the center. */
-    private final RealDistribution cX;
-    /** RNG for the y-coordinate of the center. */
-    private final RealDistribution cY;
-    /** RNG for the parametric position of the point. */
-    private final RealDistribution tP;
-    /** Radius of the circle. */
-    private final double radius;
-
-    /**
-     * @param x Abscissa of the circle center.
-     * @param y Ordinate of the circle center.
-     * @param radius Radius of the circle.
-     * @param xSigma Error on the x-coordinate of the circumference points.
-     * @param ySigma Error on the y-coordinate of the circumference points.
-     * @param seed RNG seed.
-     */
-    public RandomCirclePointGenerator(double x,
-                                      double y,
-                                      double radius,
-                                      double xSigma,
-                                      double ySigma,
-                                      long seed) {
-        final RandomGenerator rng = new Well44497b(seed);
-        this.radius = radius;
-        cX = new NormalDistribution(rng, x, xSigma,
-                                    NormalDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
-        cY = new NormalDistribution(rng, y, ySigma,
-                                    NormalDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
-        tP = new UniformRealDistribution(rng, 0, MathUtils.TWO_PI);
-    }
-
-    /**
-     * Point generator.
-     *
-     * @param n Number of points to create.
-     * @return the cloud of {@code n} points.
-     */
-    public Vector2D[] generate(int n) {
-        final Vector2D[] cloud = new Vector2D[n];
-        for (int i = 0; i < n; i++) {
-            cloud[i] = create();
-        }
-        return cloud;
-    }
-
-    /**
-     * Create one point.
-     *
-     * @return a point.
-     */
-    private Vector2D create() {
-        final double t = tP.sample();
-        final double pX = cX.sample() + radius * FastMath.cos(t);
-        final double pY = cY.sample() + radius * FastMath.sin(t);
-
-        return new Vector2D(pX, pY);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e31fde87/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/RandomStraightLinePointGenerator.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/RandomStraightLinePointGenerator.java b/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/RandomStraightLinePointGenerator.java
deleted file mode 100644
index 41def57..0000000
--- a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/RandomStraightLinePointGenerator.java
+++ /dev/null
@@ -1,99 +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 java.awt.geom.Point2D;
-
-import org.apache.commons.math4.distribution.NormalDistribution;
-import org.apache.commons.math4.distribution.RealDistribution;
-import org.apache.commons.math4.distribution.UniformRealDistribution;
-import org.apache.commons.math4.random.RandomGenerator;
-import org.apache.commons.math4.random.Well44497b;
-
-/**
- * Factory for generating a cloud of points that approximate a straight line.
- */
-@Deprecated
-public class RandomStraightLinePointGenerator {
-    /** Slope. */
-    private final double slope;
-    /** Intercept. */
-    private final double intercept;
-    /** RNG for the x-coordinate. */
-    private final RealDistribution x;
-    /** RNG for the error on the y-coordinate. */
-    private final RealDistribution error;
-
-    /**
-     * The generator will create a cloud of points whose x-coordinates
-     * will be randomly sampled between {@code xLo} and {@code xHi}, and
-     * the corresponding y-coordinates will be computed as
-     * <pre><code>
-     *  y = a x + b + N(0, error)
-     * </code></pre>
-     * where {@code N(mean, sigma)} is a Gaussian distribution with the
-     * given mean and standard deviation.
-     *
-     * @param a Slope.
-     * @param b Intercept.
-     * @param sigma Standard deviation on the y-coordinate of the point.
-     * @param lo Lowest value of the x-coordinate.
-     * @param hi Highest value of the x-coordinate.
-     * @param seed RNG seed.
-     */
-    public RandomStraightLinePointGenerator(double a,
-                                            double b,
-                                            double sigma,
-                                            double lo,
-                                            double hi,
-                                            long seed) {
-        final RandomGenerator rng = new Well44497b(seed);
-        slope = a;
-        intercept = b;
-        error = new NormalDistribution(rng, 0, sigma,
-                                       NormalDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
-        x = new UniformRealDistribution(rng, lo, hi);
-    }
-
-    /**
-     * Point generator.
-     *
-     * @param n Number of points to create.
-     * @return the cloud of {@code n} points.
-     */
-    public Point2D.Double[] generate(int n) {
-        final Point2D.Double[] cloud = new Point2D.Double[n];
-        for (int i = 0; i < n; i++) {
-            cloud[i] = create();
-        }
-        return cloud;
-    }
-
-    /**
-     * Create one point.
-     *
-     * @return a point.
-     */
-    private Point2D.Double create() {
-        final double abscissa = x.sample();
-        final double yModel = slope * abscissa + intercept;
-        final double ordinate = yModel + error.sample();
-
-        return new Point2D.Double(abscissa, ordinate);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e31fde87/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/StatisticalReferenceDataset.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/StatisticalReferenceDataset.java b/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/StatisticalReferenceDataset.java
deleted file mode 100644
index 8265215..0000000
--- a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/StatisticalReferenceDataset.java
+++ /dev/null
@@ -1,385 +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 java.io.BufferedReader;
-import java.io.IOException;
-import java.util.ArrayList;
-
-import org.apache.commons.math4.analysis.MultivariateMatrixFunction;
-import org.apache.commons.math4.analysis.MultivariateVectorFunction;
-import org.apache.commons.math4.optim.nonlinear.vector.ModelFunction;
-import org.apache.commons.math4.optim.nonlinear.vector.ModelFunctionJacobian;
-import org.apache.commons.math4.util.MathArrays;
-
-/**
- * This class gives access to the statistical reference datasets provided by the
- * NIST (available
- * <a href="http://www.itl.nist.gov/div898/strd/general/dataarchive.html">here</a>).
- * Instances of this class can be created by invocation of the
- * {@link StatisticalReferenceDatasetFactory}.
- */
-@Deprecated
-public abstract class StatisticalReferenceDataset {
-
-    /** The name of this dataset. */
-    private final String name;
-
-    /** The total number of observations (data points). */
-    private final int numObservations;
-
-    /** The total number of parameters. */
-    private final int numParameters;
-
-    /** The total number of starting points for the optimizations. */
-    private final int numStartingPoints;
-
-    /** The values of the predictor. */
-    private final double[] x;
-
-    /** The values of the response. */
-    private final double[] y;
-
-    /**
-     * The starting values. {@code startingValues[j][i]} is the value of the
-     * {@code i}-th parameter in the {@code j}-th set of starting values.
-     */
-    private final double[][] startingValues;
-
-    /** The certified values of the parameters. */
-    private final double[] a;
-
-    /** The certified values of the standard deviation of the parameters. */
-    private final double[] sigA;
-
-    /** The certified value of the residual sum of squares. */
-    private double residualSumOfSquares;
-
-    /** The least-squares problem. */
-    private final LeastSquaresProblem problem;
-
-    /**
-     * Creates a new instance of this class from the specified data file. The
-     * file must follow the StRD format.
-     *
-     * @param in the data file
-     * @throws IOException if an I/O error occurs
-     */
-    public StatisticalReferenceDataset(final BufferedReader in)
-        throws IOException {
-
-        final ArrayList<String> lines = new ArrayList<String>();
-        for (String line = in.readLine(); line != null; line = in.readLine()) {
-            lines.add(line);
-        }
-        int[] index = findLineNumbers("Data", lines);
-        if (index == null) {
-            throw new AssertionError("could not find line indices for data");
-        }
-        this.numObservations = index[1] - index[0] + 1;
-        this.x = new double[this.numObservations];
-        this.y = new double[this.numObservations];
-        for (int i = 0; i < this.numObservations; i++) {
-            final String line = lines.get(index[0] + i - 1);
-            final String[] tokens = line.trim().split(" ++");
-            // Data columns are in reverse order!!!
-            this.y[i] = Double.parseDouble(tokens[0]);
-            this.x[i] = Double.parseDouble(tokens[1]);
-        }
-
-        index = findLineNumbers("Starting Values", lines);
-        if (index == null) {
-            throw new AssertionError(
-                                     "could not find line indices for starting values");
-        }
-        this.numParameters = index[1] - index[0] + 1;
-
-        double[][] start = null;
-        this.a = new double[numParameters];
-        this.sigA = new double[numParameters];
-        for (int i = 0; i < numParameters; i++) {
-            final String line = lines.get(index[0] + i - 1);
-            final String[] tokens = line.trim().split(" ++");
-            if (start == null) {
-                start = new double[tokens.length - 4][numParameters];
-            }
-            for (int j = 2; j < tokens.length - 2; j++) {
-                start[j - 2][i] = Double.parseDouble(tokens[j]);
-            }
-            this.a[i] = Double.parseDouble(tokens[tokens.length - 2]);
-            this.sigA[i] = Double.parseDouble(tokens[tokens.length - 1]);
-        }
-        if (start == null) {
-            throw new IOException("could not find starting values");
-        }
-        this.numStartingPoints = start.length;
-        this.startingValues = start;
-
-        double dummyDouble = Double.NaN;
-        String dummyString = null;
-        for (String line : lines) {
-            if (line.contains("Dataset Name:")) {
-                dummyString = line
-                    .substring(line.indexOf("Dataset Name:") + 13,
-                               line.indexOf("(")).trim();
-            }
-            if (line.contains("Residual Sum of Squares")) {
-                final String[] tokens = line.split(" ++");
-                dummyDouble = Double.parseDouble(tokens[4].trim());
-            }
-        }
-        if (Double.isNaN(dummyDouble)) {
-            throw new IOException(
-                                  "could not find certified value of residual sum of squares");
-        }
-        this.residualSumOfSquares = dummyDouble;
-
-        if (dummyString == null) {
-            throw new IOException("could not find dataset name");
-        }
-        this.name = dummyString;
-
-        this.problem = new LeastSquaresProblem();
-    }
-
-    class LeastSquaresProblem {
-        public ModelFunction getModelFunction() {
-            return new ModelFunction(new MultivariateVectorFunction() {
-                    public double[] value(final double[] a) {
-                        final int n = getNumObservations();
-                        final double[] yhat = new double[n];
-                        for (int i = 0; i < n; i++) {
-                            yhat[i] = getModelValue(getX(i), a);
-                        }
-                        return yhat;
-                    }
-                });
-        }
-
-        public ModelFunctionJacobian getModelFunctionJacobian() {
-            return new ModelFunctionJacobian(new MultivariateMatrixFunction() {
-                    public double[][] value(final double[] a)
-                        throws IllegalArgumentException {
-                        final int n = getNumObservations();
-                        final double[][] j = new double[n][];
-                        for (int i = 0; i < n; i++) {
-                            j[i] = getModelDerivatives(getX(i), a);
-                        }
-                        return j;
-                    }
-                });
-        }
-    }
-
-    /**
-     * Returns the name of this dataset.
-     *
-     * @return the name of the dataset
-     */
-    public String getName() {
-        return name;
-    }
-
-    /**
-     * Returns the total number of observations (data points).
-     *
-     * @return the number of observations
-     */
-    public int getNumObservations() {
-        return numObservations;
-    }
-
-    /**
-     * Returns a copy of the data arrays. The data is laid out as follows <li>
-     * {@code data[0][i] = x[i]},</li> <li>{@code data[1][i] = y[i]},</li>
-     *
-     * @return the array of data points.
-     */
-    public double[][] getData() {
-        return new double[][] {
-            MathArrays.copyOf(x), MathArrays.copyOf(y)
-        };
-    }
-
-    /**
-     * Returns the x-value of the {@code i}-th data point.
-     *
-     * @param i the index of the data point
-     * @return the x-value
-     */
-    public double getX(final int i) {
-        return x[i];
-    }
-
-    /**
-     * Returns the y-value of the {@code i}-th data point.
-     *
-     * @param i the index of the data point
-     * @return the y-value
-     */
-    public double getY(final int i) {
-        return y[i];
-    }
-
-    /**
-     * Returns the total number of parameters.
-     *
-     * @return the number of parameters
-     */
-    public int getNumParameters() {
-        return numParameters;
-    }
-
-    /**
-     * Returns the certified values of the paramters.
-     *
-     * @return the values of the parameters
-     */
-    public double[] getParameters() {
-        return MathArrays.copyOf(a);
-    }
-
-    /**
-     * Returns the certified value of the {@code i}-th parameter.
-     *
-     * @param i the index of the parameter
-     * @return the value of the parameter
-     */
-    public double getParameter(final int i) {
-        return a[i];
-    }
-
-    /**
-     * Reurns the certified values of the standard deviations of the parameters.
-     *
-     * @return the standard deviations of the parameters
-     */
-    public double[] getParametersStandardDeviations() {
-        return MathArrays.copyOf(sigA);
-    }
-
-    /**
-     * Returns the certified value of the standard deviation of the {@code i}-th
-     * parameter.
-     *
-     * @param i the index of the parameter
-     * @return the standard deviation of the parameter
-     */
-    public double getParameterStandardDeviation(final int i) {
-        return sigA[i];
-    }
-
-    /**
-     * Returns the certified value of the residual sum of squares.
-     *
-     * @return the residual sum of squares
-     */
-    public double getResidualSumOfSquares() {
-        return residualSumOfSquares;
-    }
-
-    /**
-     * Returns the total number of starting points (initial guesses for the
-     * optimization process).
-     *
-     * @return the number of starting points
-     */
-    public int getNumStartingPoints() {
-        return numStartingPoints;
-    }
-
-    /**
-     * Returns the {@code i}-th set of initial values of the parameters.
-     *
-     * @param i the index of the starting point
-     * @return the starting point
-     */
-    public double[] getStartingPoint(final int i) {
-        return MathArrays.copyOf(startingValues[i]);
-    }
-
-    /**
-     * Returns the least-squares problem corresponding to fitting the model to
-     * the specified data.
-     *
-     * @return the least-squares problem
-     */
-    public LeastSquaresProblem getLeastSquaresProblem() {
-        return problem;
-    }
-
-    /**
-     * Returns the value of the model for the specified values of the predictor
-     * variable and the parameters.
-     *
-     * @param x the predictor variable
-     * @param a the parameters
-     * @return the value of the model
-     */
-    public abstract double getModelValue(final double x, final double[] a);
-
-    /**
-     * Returns the values of the partial derivatives of the model with respect
-     * to the parameters.
-     *
-     * @param x the predictor variable
-     * @param a the parameters
-     * @return the partial derivatives
-     */
-    public abstract double[] getModelDerivatives(final double x,
-                                                 final double[] a);
-
-    /**
-     * <p>
-     * Parses the specified text lines, and extracts the indices of the first
-     * and last lines of the data defined by the specified {@code key}. This key
-     * must be one of
-     * </p>
-     * <ul>
-     * <li>{@code "Starting Values"},</li>
-     * <li>{@code "Certified Values"},</li>
-     * <li>{@code "Data"}.</li>
-     * </ul>
-     * <p>
-     * In the NIST data files, the line indices are separated by the keywords
-     * {@code "lines"} and {@code "to"}.
-     * </p>
-     *
-     * @param lines the line of text to be parsed
-     * @return an array of two {@code int}s. First value is the index of the
-     *         first line, second value is the index of the last line.
-     *         {@code null} if the line could not be parsed.
-     */
-    private static int[] findLineNumbers(final String key,
-                                         final Iterable<String> lines) {
-        for (String text : lines) {
-            boolean flag = text.contains(key) && text.contains("lines") &&
-                           text.contains("to") && text.contains(")");
-            if (flag) {
-                final int[] numbers = new int[2];
-                final String from = text.substring(text.indexOf("lines") + 5,
-                                                   text.indexOf("to"));
-                numbers[0] = Integer.parseInt(from.trim());
-                final String to = text.substring(text.indexOf("to") + 2,
-                                                 text.indexOf(")"));
-                numbers[1] = Integer.parseInt(to.trim());
-                return numbers;
-            }
-        }
-        return null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e31fde87/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/StatisticalReferenceDatasetFactory.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/StatisticalReferenceDatasetFactory.java b/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/StatisticalReferenceDatasetFactory.java
deleted file mode 100644
index 99995e8..0000000
--- a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/StatisticalReferenceDatasetFactory.java
+++ /dev/null
@@ -1,203 +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 java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-
-import org.apache.commons.math4.util.FastMath;
-
-/**
- * A factory to create instances of {@link StatisticalReferenceDataset} from
- * available resources.
- */
-@Deprecated
-public class StatisticalReferenceDatasetFactory {
-
-    private StatisticalReferenceDatasetFactory() {
-        // Do nothing
-    }
-
-    /**
-     * Creates a new buffered reader from the specified resource name.
-     *
-     * @param name the name of the resource
-     * @return a buffered reader
-     * @throws IOException if an I/O error occurred
-     */
-    public static BufferedReader createBufferedReaderFromResource(final String name)
-        throws IOException {
-        final InputStream resourceAsStream;
-        resourceAsStream = StatisticalReferenceDatasetFactory.class
-            .getResourceAsStream(name);
-        if (resourceAsStream == null) {
-            throw new IOException("could not find resource " + name);
-        }
-        return new BufferedReader(new InputStreamReader(resourceAsStream));
-    }
-
-    public static StatisticalReferenceDataset createKirby2()
-        throws IOException {
-        final BufferedReader in = createBufferedReaderFromResource("Kirby2.dat");
-        StatisticalReferenceDataset dataset = null;
-        try {
-            dataset = new StatisticalReferenceDataset(in) {
-
-                @Override
-                public double getModelValue(final double x, final double[] a) {
-                    final double p = a[0] + x * (a[1] + x * a[2]);
-                    final double q = 1.0 + x * (a[3] + x * a[4]);
-                    return p / q;
-                }
-
-                @Override
-                public double[] getModelDerivatives(final double x,
-                                                    final double[] a) {
-                    final double[] dy = new double[5];
-                    final double p = a[0] + x * (a[1] + x * a[2]);
-                    final double q = 1.0 + x * (a[3] + x * a[4]);
-                    dy[0] = 1.0 / q;
-                    dy[1] = x / q;
-                    dy[2] = x * dy[1];
-                    dy[3] = -x * p / (q * q);
-                    dy[4] = x * dy[3];
-                    return dy;
-                }
-            };
-        } finally {
-            in.close();
-        }
-        return dataset;
-    }
-
-    public static StatisticalReferenceDataset createHahn1()
-        throws IOException {
-        final BufferedReader in = createBufferedReaderFromResource("Hahn1.dat");
-        StatisticalReferenceDataset dataset = null;
-        try {
-            dataset = new StatisticalReferenceDataset(in) {
-
-                @Override
-                public double getModelValue(final double x, final double[] a) {
-                    final double p = a[0] + x * (a[1] + x * (a[2] + x * a[3]));
-                    final double q = 1.0 + x * (a[4] + x * (a[5] + x * a[6]));
-                    return p / q;
-                }
-
-                @Override
-                public double[] getModelDerivatives(final double x,
-                                                    final double[] a) {
-                    final double[] dy = new double[7];
-                    final double p = a[0] + x * (a[1] + x * (a[2] + x * a[3]));
-                    final double q = 1.0 + x * (a[4] + x * (a[5] + x * a[6]));
-                    dy[0] = 1.0 / q;
-                    dy[1] = x * dy[0];
-                    dy[2] = x * dy[1];
-                    dy[3] = x * dy[2];
-                    dy[4] = -x * p / (q * q);
-                    dy[5] = x * dy[4];
-                    dy[6] = x * dy[5];
-                    return dy;
-                }
-            };
-        } finally {
-            in.close();
-        }
-        return dataset;
-    }
-
-    public static StatisticalReferenceDataset createMGH17()
-        throws IOException {
-        final BufferedReader in = createBufferedReaderFromResource("MGH17.dat");
-        StatisticalReferenceDataset dataset = null;
-        try {
-            dataset = new StatisticalReferenceDataset(in) {
-
-                @Override
-                public double getModelValue(final double x, final double[] a) {
-                    return a[0] + a[1] * FastMath.exp(-a[3] * x) + a[2] *
-                           FastMath.exp(-a[4] * x);
-                }
-
-                @Override
-                public double[] getModelDerivatives(final double x,
-                                                    final double[] a) {
-                    final double[] dy = new double[5];
-                    dy[0] = 1.0;
-                    dy[1] = FastMath.exp(-x * a[3]);
-                    dy[2] = FastMath.exp(-x * a[4]);
-                    dy[3] = -x * a[1] * dy[1];
-                    dy[4] = -x * a[2] * dy[2];
-                    return dy;
-                }
-            };
-        } finally {
-            in.close();
-        }
-        return dataset;
-    }
-
-    public static StatisticalReferenceDataset createLanczos1()
-        throws IOException {
-        final BufferedReader in =
-            createBufferedReaderFromResource("Lanczos1.dat");
-        StatisticalReferenceDataset dataset = null;
-        try {
-            dataset = new StatisticalReferenceDataset(in) {
-
-                @Override
-                public double getModelValue(final double x, final double[] a) {
-                    System.out.println(a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]);
-                    return a[0] * FastMath.exp(-a[3] * x) +
-                           a[1] * FastMath.exp(-a[4] * x) +
-                           a[2] * FastMath.exp(-a[5] * x);
-                }
-
-                @Override
-                public double[] getModelDerivatives(final double x,
-                    final double[] a) {
-                    final double[] dy = new double[6];
-                    dy[0] = FastMath.exp(-x * a[3]);
-                    dy[1] = FastMath.exp(-x * a[4]);
-                    dy[2] = FastMath.exp(-x * a[5]);
-                    dy[3] = -x * a[0] * dy[0];
-                    dy[4] = -x * a[1] * dy[1];
-                    dy[5] = -x * a[2] * dy[2];
-                    return dy;
-                }
-            };
-        } finally {
-            in.close();
-        }
-        return dataset;
-    }
-
-    /**
-     * Returns an array with all available reference datasets.
-     *
-     * @return the array of datasets
-     * @throws IOException if an I/O error occurs
-     */
-    public StatisticalReferenceDataset[] createAll()
-        throws IOException {
-        return new StatisticalReferenceDataset[] {
-            createKirby2(), createMGH17()
-        };
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e31fde87/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/StraightLineProblem.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/StraightLineProblem.java b/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/StraightLineProblem.java
deleted file mode 100644
index e93c604..0000000
--- a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/StraightLineProblem.java
+++ /dev/null
@@ -1,169 +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 java.util.ArrayList;
-
-import org.apache.commons.math4.analysis.MultivariateMatrixFunction;
-import org.apache.commons.math4.analysis.MultivariateVectorFunction;
-import org.apache.commons.math4.analysis.UnivariateFunction;
-import org.apache.commons.math4.optim.nonlinear.vector.ModelFunction;
-import org.apache.commons.math4.optim.nonlinear.vector.ModelFunctionJacobian;
-import org.apache.commons.math4.stat.regression.SimpleRegression;
-
-/**
- * Class that models a straight line defined as {@code y = a x + b}.
- * The parameters of problem are:
- * <ul>
- *  <li>{@code a}</li>
- *  <li>{@code b}</li>
- * </ul>
- * The model functions are:
- * <ul>
- *  <li>for each pair (a, b), the y-coordinate of the line.</li>
- * </ul>
- */
-@Deprecated
-class StraightLineProblem {
-    /** Cloud of points assumed to be fitted by a straight line. */
-    private final ArrayList<double[]> points;
-    /** Error (on the y-coordinate of the points). */
-    private final double sigma;
-
-    /**
-     * @param error Assumed error for the y-coordinate.
-     */
-    public StraightLineProblem(double error) {
-        points = new ArrayList<double[]>();
-        sigma = error;
-    }
-
-    public void addPoint(double px, double py) {
-        points.add(new double[] { px, py });
-    }
-
-    /**
-     * @return the list of x-coordinates.
-     */
-    public double[] x() {
-        final double[] v = new double[points.size()];
-        for (int i = 0; i < points.size(); i++) {
-            final double[] p = points.get(i);
-            v[i] = p[0]; // x-coordinate.
-        }
-
-        return v;
-    }
-
-    /**
-     * @return the list of y-coordinates.
-     */
-    public double[] y() {
-        final double[] v = new double[points.size()];
-        for (int i = 0; i < points.size(); i++) {
-            final double[] p = points.get(i);
-            v[i] = p[1]; // y-coordinate.
-        }
-
-        return v;
-    }
-
-    public double[] target() {
-        return y();
-    }
-
-    public double[] weight() {
-        final double weight = 1 / (sigma * sigma);
-        final double[] w = new double[points.size()];
-        for (int i = 0; i < points.size(); i++) {
-            w[i] = weight;
-        }
-
-        return w;
-    }
-
-    public ModelFunction getModelFunction() {
-        return new ModelFunction(new MultivariateVectorFunction() {
-                public double[] value(double[] params) {
-                    final Model line = new Model(params[0], params[1]);
-
-                    final double[] model = new double[points.size()];
-                    for (int i = 0; i < points.size(); i++) {
-                        final double[] p = points.get(i);
-                        model[i] = line.value(p[0]);
-                    }
-
-                    return model;
-                }
-            });
-    }
-
-    public ModelFunctionJacobian getModelFunctionJacobian() {
-        return new ModelFunctionJacobian(new MultivariateMatrixFunction() {
-                public double[][] value(double[] point) {
-                    return jacobian(point);
-                }
-            });
-    }
-
-    /**
-     * Directly solve the linear problem, using the {@link SimpleRegression}
-     * class.
-     */
-    public double[] solve() {
-        final SimpleRegression regress = new SimpleRegression(true);
-        for (double[] d : points) {
-            regress.addData(d[0], d[1]);
-        }
-
-        final double[] result = { regress.getSlope(), regress.getIntercept() };
-        return result;
-    }
-
-    private double[][] jacobian(double[] params) {
-        final double[][] jacobian = new double[points.size()][2];
-
-        for (int i = 0; i < points.size(); i++) {
-            final double[] p = points.get(i);
-            // Partial derivative wrt "a".
-            jacobian[i][0] = p[0];
-            // Partial derivative wrt "b".
-            jacobian[i][1] = 1;
-        }
-
-        return jacobian;
-    }
-
-    /**
-     * Linear function.
-     */
-    public static class Model implements UnivariateFunction {
-        final double a;
-        final double b;
-
-        public Model(double a,
-                     double b) {
-            this.a = a;
-            this.b = b;
-        }
-
-        public double value(double x) {
-            return a * x + b;
-        }
-    }
-}


[2/5] [math] Remove deprecated classes in optim package.

Posted by tn...@apache.org.
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 <th...@gmail.com>
Authored: Sat Apr 11 16:04:53 2015 +0200
Committer: Thomas Neidhart <th...@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);
-        }
-    }
-}