You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2021/05/15 04:02:08 UTC

[commons-math] branch modularized_master created (now 9d1741b)

This is an automated email from the ASF dual-hosted git repository.

erans pushed a change to branch modularized_master
in repository https://gitbox.apache.org/repos/asf/commons-math.git.


      at 9d1741b  Modularization.

This branch includes the following new commits:

     new 9d1741b  Modularization.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


[commons-math] 01/01: Modularization.

Posted by er...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

erans pushed a commit to branch modularized_master
in repository https://gitbox.apache.org/repos/asf/commons-math.git

commit 9d1741bfe4a7808cfa0c313891a717adf98a3087
Author: Gilles Sadowski <gi...@gmail.com>
AuthorDate: Fri May 14 17:18:27 2021 +0200

    Modularization.
    
    For now, all codes were placed in module "commons-math-legacy".
    Selected parts should gradually be moved out of that module into their own.
---
 RELEASE-NOTES.txt                                  |   25 -
 build.xml                                          |  376 --
 commons-math-legacy/LICENCE                        |  457 ++
 commons-math-legacy/NOTICE                         |    9 +
 commons-math-legacy/pom.xml                        |  131 +
 .../org/apache/commons/math4/legacy/Field.java     |   58 +
 .../apache/commons/math4/legacy/FieldElement.java  |   87 +
 .../commons/math4/legacy/RealFieldElement.java     |  402 ++
 .../math4/legacy/analysis/BivariateFunction.java   |   35 +
 .../math4/legacy/analysis/FunctionUtils.java       |  544 ++
 .../legacy/analysis/MultivariateFunction.java      |   42 +
 .../analysis/MultivariateMatrixFunction.java       |   35 +
 .../analysis/MultivariateVectorFunction.java       |   35 +
 .../analysis/ParametricUnivariateFunction.java     |   44 +
 .../analysis/RealFieldUnivariateFunction.java      |   86 +
 .../math4/legacy/analysis/TrivariateFunction.java  |   35 +
 .../math4/legacy/analysis/UnivariateFunction.java  |   81 +
 .../legacy/analysis/UnivariateMatrixFunction.java  |   33 +
 .../legacy/analysis/UnivariateVectorFunction.java  |   33 +
 .../analysis/differentiation/DSCompiler.java       | 1834 ++++++
 .../differentiation/DerivativeStructure.java       | 1256 ++++
 .../FiniteDifferencesDifferentiator.java           |  393 ++
 .../analysis/differentiation/GradientFunction.java |   66 +
 .../analysis/differentiation/JacobianFunction.java |   70 +
 .../MultivariateDifferentiableFunction.java        |   42 +
 .../MultivariateDifferentiableVectorFunction.java  |   43 +
 .../analysis/differentiation/SparseGradient.java   |  937 +++
 .../UnivariateDifferentiableFunction.java          |   43 +
 .../UnivariateDifferentiableMatrixFunction.java    |   40 +
 .../UnivariateDifferentiableVectorFunction.java    |   40 +
 .../UnivariateFunctionDifferentiator.java          |   33 +
 .../UnivariateMatrixFunctionDifferentiator.java    |   33 +
 .../UnivariateVectorFunctionDifferentiator.java    |   33 +
 .../analysis/differentiation/package-info.java     |   42 +
 .../math4/legacy/analysis/function/Abs.java        |   34 +
 .../math4/legacy/analysis/function/Acos.java       |   44 +
 .../math4/legacy/analysis/function/Acosh.java      |   44 +
 .../math4/legacy/analysis/function/Add.java        |   33 +
 .../math4/legacy/analysis/function/Asin.java       |   44 +
 .../math4/legacy/analysis/function/Asinh.java      |   44 +
 .../math4/legacy/analysis/function/Atan.java       |   44 +
 .../math4/legacy/analysis/function/Atan2.java      |   34 +
 .../math4/legacy/analysis/function/Atanh.java      |   44 +
 .../math4/legacy/analysis/function/Cbrt.java       |   44 +
 .../math4/legacy/analysis/function/Ceil.java       |   34 +
 .../math4/legacy/analysis/function/Constant.java   |   53 +
 .../math4/legacy/analysis/function/Cos.java        |   44 +
 .../math4/legacy/analysis/function/Cosh.java       |   44 +
 .../math4/legacy/analysis/function/Divide.java     |   33 +
 .../math4/legacy/analysis/function/Exp.java        |   44 +
 .../math4/legacy/analysis/function/Expm1.java      |   44 +
 .../math4/legacy/analysis/function/Floor.java      |   34 +
 .../math4/legacy/analysis/function/Gaussian.java   |  252 +
 .../analysis/function/HarmonicOscillator.java      |  176 +
 .../math4/legacy/analysis/function/Identity.java   |   43 +
 .../math4/legacy/analysis/function/Inverse.java    |   43 +
 .../math4/legacy/analysis/function/Log.java        |   44 +
 .../math4/legacy/analysis/function/Log10.java      |   45 +
 .../math4/legacy/analysis/function/Log1p.java      |   44 +
 .../math4/legacy/analysis/function/Logistic.java   |  221 +
 .../math4/legacy/analysis/function/Logit.java      |  205 +
 .../math4/legacy/analysis/function/Max.java        |   34 +
 .../math4/legacy/analysis/function/Min.java        |   34 +
 .../math4/legacy/analysis/function/Minus.java      |   43 +
 .../math4/legacy/analysis/function/Multiply.java   |   33 +
 .../math4/legacy/analysis/function/Pow.java        |   34 +
 .../math4/legacy/analysis/function/Power.java      |   54 +
 .../math4/legacy/analysis/function/Rint.java       |   34 +
 .../math4/legacy/analysis/function/Sigmoid.java    |  211 +
 .../math4/legacy/analysis/function/Signum.java     |   34 +
 .../math4/legacy/analysis/function/Sin.java        |   44 +
 .../math4/legacy/analysis/function/Sinc.java       |  196 +
 .../math4/legacy/analysis/function/Sinh.java       |   44 +
 .../math4/legacy/analysis/function/Sqrt.java       |   44 +
 .../legacy/analysis/function/StepFunction.java     |  102 +
 .../math4/legacy/analysis/function/Subtract.java   |   33 +
 .../math4/legacy/analysis/function/Tan.java        |   44 +
 .../math4/legacy/analysis/function/Tanh.java       |   44 +
 .../math4/legacy/analysis/function/Ulp.java        |   34 +
 .../legacy/analysis/function/package-info.java     |   26 +
 .../BaseAbstractUnivariateIntegrator.java          |  273 +
 .../IterativeLegendreGaussIntegrator.java          |  178 +
 .../analysis/integration/MidPointIntegrator.java   |  166 +
 .../analysis/integration/RombergIntegrator.java    |  134 +
 .../analysis/integration/SimpsonIntegrator.java    |  120 +
 .../analysis/integration/TrapezoidIntegrator.java  |  154 +
 .../analysis/integration/UnivariateIntegrator.java |   88 +
 .../integration/gauss/BaseRuleFactory.java         |  151 +
 .../integration/gauss/GaussIntegrator.java         |  126 +
 .../integration/gauss/GaussIntegratorFactory.java  |  181 +
 .../integration/gauss/HermiteRuleFactory.java      |  174 +
 .../integration/gauss/LaguerreRuleFactory.java     |   81 +
 .../gauss/LegendreHighPrecisionRuleFactory.java    |  212 +
 .../integration/gauss/LegendreRuleFactory.java     |  137 +
 .../gauss/SymmetricGaussIntegrator.java            |   99 +
 .../analysis/integration/gauss/package-info.java   |   22 +
 .../legacy/analysis/integration/package-info.java  |   22 +
 .../interpolation/AkimaSplineInterpolator.java     |  248 +
 .../BicubicInterpolatingFunction.java              |  329 ++
 .../interpolation/BicubicInterpolator.java         |  114 +
 .../interpolation/BivariateGridInterpolator.java   |   51 +
 .../DividedDifferenceInterpolator.java             |  122 +
 .../interpolation/FieldHermiteInterpolator.java    |  210 +
 .../interpolation/HermiteInterpolator.java         |  242 +
 .../interpolation/InterpolatingMicrosphere.java    |  387 ++
 .../interpolation/InterpolatingMicrosphere2D.java  |   87 +
 .../analysis/interpolation/LinearInterpolator.java |   80 +
 .../analysis/interpolation/LoessInterpolator.java  |  474 ++
 .../MicrosphereProjectionInterpolator.java         |  168 +
 .../interpolation/MultivariateInterpolator.java    |   51 +
 .../interpolation/NevilleInterpolator.java         |   61 +
 ...iecewiseBicubicSplineInterpolatingFunction.java |  212 +
 .../PiecewiseBicubicSplineInterpolator.java        |   62 +
 .../analysis/interpolation/SplineInterpolator.java |  137 +
 .../TricubicInterpolatingFunction.java             |  509 ++
 .../interpolation/TricubicInterpolator.java        |  144 +
 .../interpolation/TrivariateGridInterpolator.java  |   54 +
 .../interpolation/UnivariateInterpolator.java      |   41 +
 .../UnivariatePeriodicInterpolator.java            |  126 +
 .../analysis/interpolation/package-info.java       |   22 +
 .../math4/legacy/analysis/package-info.java        |   32 +
 .../analysis/polynomials/PolynomialFunction.java   |  406 ++
 .../PolynomialFunctionLagrangeForm.java            |  327 ++
 .../polynomials/PolynomialFunctionNewtonForm.java  |  247 +
 .../polynomials/PolynomialSplineFunction.java      |  237 +
 .../analysis/polynomials/PolynomialsUtils.java     |  454 ++
 .../legacy/analysis/polynomials/package-info.java  |   23 +
 .../analysis/solvers/AbstractPolynomialSolver.java |   80 +
 .../AbstractUnivariateDifferentiableSolver.java    |   82 +
 .../analysis/solvers/AbstractUnivariateSolver.java |   60 +
 .../legacy/analysis/solvers/AllowedSolution.java   |   75 +
 .../solvers/BaseAbstractUnivariateSolver.java      |  315 +
 .../legacy/analysis/solvers/BaseSecantSolver.java  |  280 +
 .../analysis/solvers/BaseUnivariateSolver.java     |  142 +
 .../legacy/analysis/solvers/BisectionSolver.java   |   91 +
 .../BracketedRealFieldUnivariateSolver.java        |  142 +
 .../solvers/BracketedUnivariateSolver.java         |   92 +
 .../solvers/BracketingNthOrderBrentSolver.java     |  413 ++
 .../math4/legacy/analysis/solvers/BrentSolver.java |  109 +
 .../FieldBracketingNthOrderBrentSolver.java        |  453 ++
 .../legacy/analysis/solvers/IllinoisSolver.java    |   82 +
 .../legacy/analysis/solvers/LaguerreSolver.java    |  384 ++
 .../legacy/analysis/solvers/MullerSolver.java      |  202 +
 .../legacy/analysis/solvers/MullerSolver2.java     |  168 +
 .../analysis/solvers/NewtonRaphsonSolver.java      |   92 +
 .../legacy/analysis/solvers/PegasusSolver.java     |   84 +
 .../legacy/analysis/solvers/PolynomialSolver.java  |   28 +
 .../legacy/analysis/solvers/RegulaFalsiSolver.java |   94 +
 .../legacy/analysis/solvers/RiddersSolver.java     |  142 +
 .../legacy/analysis/solvers/SecantSolver.java      |  135 +
 .../solvers/UnivariateDifferentiableSolver.java    |   29 +
 .../legacy/analysis/solvers/UnivariateSolver.java  |   28 +
 .../analysis/solvers/UnivariateSolverUtils.java    |  467 ++
 .../legacy/analysis/solvers/package-info.java      |   22 +
 .../math4/legacy/complex/ComplexFormat.java        |  428 ++
 .../commons/math4/legacy/complex/package-info.java |   23 +
 .../org/apache/commons/math4/legacy/dfp/Dfp.java   | 2928 ++++++++++
 .../apache/commons/math4/legacy/dfp/DfpDec.java    |  368 ++
 .../apache/commons/math4/legacy/dfp/DfpField.java  |  762 +++
 .../apache/commons/math4/legacy/dfp/DfpMath.java   |  965 +++
 .../commons/math4/legacy/dfp/package-info.java     |   88 +
 .../distribution/AbstractIntegerDistribution.java  |  228 +
 .../AbstractMultivariateRealDistribution.java      |   72 +
 .../distribution/AbstractRealDistribution.java     |  278 +
 .../legacy/distribution/EmpiricalDistribution.java |  753 +++
 .../distribution/EnumeratedDistribution.java       |  254 +
 .../EnumeratedIntegerDistribution.java             |  247 +
 .../distribution/EnumeratedRealDistribution.java   |  294 +
 .../MixtureMultivariateNormalDistribution.java     |   91 +
 .../MixtureMultivariateRealDistribution.java       |  166 +
 .../MultivariateNormalDistribution.java            |  225 +
 .../distribution/MultivariateRealDistribution.java |   77 +
 ...ariateNormalMixtureExpectationMaximization.java |  455 ++
 .../legacy/distribution/fitting/package-info.java  |   20 +
 .../math4/legacy/distribution/package-info.java    |   21 +
 .../legacy/exception/ConvergenceException.java     |   49 +
 .../exception/DimensionMismatchException.java      |   64 +
 .../exception/InsufficientDataException.java       |   49 +
 .../legacy/exception/MathArithmeticException.java  |   52 +
 .../exception/MathIllegalArgumentException.java    |   41 +
 .../exception/MathIllegalNumberException.java      |   60 +
 .../exception/MathIllegalStateException.java       |   63 +
 .../math4/legacy/exception/MathInternalError.java  |   57 +
 .../math4/legacy/exception/MathParseException.java |   51 +
 .../legacy/exception/MathRuntimeException.java     |   80 +
 .../MathUnsupportedOperationException.java         |   49 +
 .../exception/MaxCountExceededException.java       |   63 +
 .../exception/MultiDimensionMismatchException.java |   90 +
 .../legacy/exception/NoBracketingException.java    |  106 +
 .../math4/legacy/exception/NoDataException.java    |   46 +
 .../exception/NonMonotonicSequenceException.java   |  120 +
 .../legacy/exception/NotANumberException.java      |   37 +
 .../legacy/exception/NotFiniteNumberException.java |   54 +
 .../legacy/exception/NotPositiveException.java     |   48 +
 .../exception/NotStrictlyPositiveException.java    |   49 +
 .../legacy/exception/NullArgumentException.java    |   84 +
 .../exception/NumberIsTooLargeException.java       |   85 +
 .../exception/NumberIsTooSmallException.java       |   86 +
 .../legacy/exception/OutOfRangeException.java      |   79 +
 .../exception/TooManyEvaluationsException.java     |   39 +
 .../exception/TooManyIterationsException.java      |   39 +
 .../math4/legacy/exception/ZeroException.java      |   48 +
 .../math4/legacy/exception/package-info.java       |   23 +
 .../math4/legacy/exception/util/ArgUtils.java      |   54 +
 .../legacy/exception/util/DummyLocalizable.java    |   59 +
 .../legacy/exception/util/ExceptionContext.java    |  334 ++
 .../exception/util/ExceptionContextProvider.java   |   33 +
 .../math4/legacy/exception/util/Localizable.java   |   43 +
 .../legacy/exception/util/LocalizedFormats.java    |  417 ++
 .../math4/legacy/exception/util/package-info.java  |   22 +
 .../field/linalg/FieldDecompositionSolver.java     |   57 +
 .../legacy/field/linalg/FieldDenseMatrix.java      |  354 ++
 .../legacy/field/linalg/FieldLUDecomposition.java  |  359 ++
 .../math4/legacy/field/linalg/package-info.java    |   21 +
 .../commons/math4/legacy/field/package-info.java   |   22 +
 .../legacy/filter/DefaultMeasurementModel.java     |   86 +
 .../math4/legacy/filter/DefaultProcessModel.java   |  170 +
 .../commons/math4/legacy/filter/KalmanFilter.java  |  388 ++
 .../math4/legacy/filter/MeasurementModel.java      |   44 +
 .../commons/math4/legacy/filter/ProcessModel.java  |   73 +
 .../commons/math4/legacy/filter/package-info.java  |   20 +
 .../math4/legacy/fitting/AbstractCurveFitter.java  |  139 +
 .../math4/legacy/fitting/GaussianCurveFitter.java  |  427 ++
 .../math4/legacy/fitting/HarmonicCurveFitter.java  |  445 ++
 .../legacy/fitting/PolynomialCurveFitter.java      |  131 +
 .../math4/legacy/fitting/SimpleCurveFitter.java    |  125 +
 .../legacy/fitting/WeightedObservedPoint.java      |   78 +
 .../legacy/fitting/WeightedObservedPoints.java     |  112 +
 .../fitting/leastsquares/AbstractEvaluation.java   |  101 +
 .../leastsquares/DenseWeightedEvaluation.java      |   71 +
 ...entiatorVectorMultivariateJacobianFunction.java |   95 +
 .../fitting/leastsquares/EvaluationRmsChecker.java |   76 +
 .../fitting/leastsquares/GaussNewtonOptimizer.java |  300 +
 .../fitting/leastsquares/LeastSquaresAdapter.java  |   84 +
 .../fitting/leastsquares/LeastSquaresBuilder.java  |  226 +
 .../fitting/leastsquares/LeastSquaresFactory.java  |  541 ++
 .../leastsquares/LeastSquaresOptimizer.java        |   62 +
 .../fitting/leastsquares/LeastSquaresProblem.java  |  174 +
 .../leastsquares/LevenbergMarquardtOptimizer.java  | 1043 ++++
 .../leastsquares/MultivariateJacobianFunction.java |   39 +
 .../legacy/fitting/leastsquares/OptimumImpl.java   |  118 +
 .../fitting/leastsquares/ParameterValidator.java   |   34 +
 .../leastsquares/ValueAndJacobianFunction.java     |   44 +
 .../legacy/fitting/leastsquares/package-info.java  |   39 +
 .../commons/math4/legacy/fitting/package-info.java |   26 +
 .../legacy/genetics/AbstractListChromosome.java    |  106 +
 .../math4/legacy/genetics/BinaryChromosome.java    |   98 +
 .../math4/legacy/genetics/BinaryMutation.java      |   57 +
 .../commons/math4/legacy/genetics/Chromosome.java  |  105 +
 .../math4/legacy/genetics/ChromosomePair.java      |   66 +
 .../math4/legacy/genetics/CrossoverPolicy.java     |   38 +
 .../math4/legacy/genetics/CycleCrossover.java      |  182 +
 .../legacy/genetics/ElitisticListPopulation.java   |  118 +
 .../commons/math4/legacy/genetics/Fitness.java     |   32 +
 .../math4/legacy/genetics/FixedElapsedTime.java    |   79 +
 .../legacy/genetics/FixedGenerationCount.java      |   74 +
 .../math4/legacy/genetics/GeneticAlgorithm.java    |  232 +
 .../genetics/InvalidRepresentationException.java   |   42 +
 .../math4/legacy/genetics/ListPopulation.java      |  201 +
 .../math4/legacy/genetics/MutationPolicy.java      |   35 +
 .../math4/legacy/genetics/NPointCrossover.java     |  179 +
 .../math4/legacy/genetics/OnePointCrossover.java   |  129 +
 .../math4/legacy/genetics/OrderedCrossover.java    |  151 +
 .../legacy/genetics/PermutationChromosome.java     |   40 +
 .../commons/math4/legacy/genetics/Population.java  |   59 +
 .../commons/math4/legacy/genetics/RandomKey.java   |  300 +
 .../math4/legacy/genetics/RandomKeyMutation.java   |   55 +
 .../math4/legacy/genetics/SelectionPolicy.java     |   34 +
 .../math4/legacy/genetics/StoppingCondition.java   |   33 +
 .../math4/legacy/genetics/TournamentSelection.java |  117 +
 .../math4/legacy/genetics/UniformCrossover.java    |  135 +
 .../math4/legacy/genetics/package-info.java        |   20 +
 .../math4/legacy/linear/AbstractFieldMatrix.java   | 1114 ++++
 .../math4/legacy/linear/AbstractRealMatrix.java    | 1026 ++++
 .../commons/math4/legacy/linear/AnyMatrix.java     |   97 +
 .../math4/legacy/linear/Array2DRowFieldMatrix.java |  612 ++
 .../math4/legacy/linear/Array2DRowRealMatrix.java  |  589 ++
 .../math4/legacy/linear/ArrayFieldVector.java      | 1123 ++++
 .../math4/legacy/linear/ArrayRealVector.java       |  953 +++
 .../math4/legacy/linear/BiDiagonalTransformer.java |  380 ++
 .../math4/legacy/linear/BlockFieldMatrix.java      | 1588 +++++
 .../math4/legacy/linear/BlockRealMatrix.java       | 1580 +++++
 .../math4/legacy/linear/CholeskyDecomposition.java |  314 +
 .../math4/legacy/linear/ConjugateGradient.java     |  234 +
 .../math4/legacy/linear/DecompositionSolver.java   |   97 +
 .../linear/DefaultFieldMatrixChangingVisitor.java  |   61 +
 .../DefaultFieldMatrixPreservingVisitor.java       |   59 +
 .../linear/DefaultIterativeLinearSolverEvent.java  |  143 +
 .../linear/DefaultRealMatrixChangingVisitor.java   |   47 +
 .../linear/DefaultRealMatrixPreservingVisitor.java |   45 +
 .../math4/legacy/linear/DiagonalMatrix.java        |  370 ++
 .../math4/legacy/linear/EigenDecomposition.java    |  942 +++
 .../legacy/linear/EigenDecomposition.java_PRINT    |  945 +++
 .../legacy/linear/FieldDecompositionSolver.java    |   75 +
 .../math4/legacy/linear/FieldLUDecomposition.java  |  448 ++
 .../commons/math4/legacy/linear/FieldMatrix.java   |  814 +++
 .../legacy/linear/FieldMatrixChangingVisitor.java  |   57 +
 .../linear/FieldMatrixPreservingVisitor.java       |   56 +
 .../commons/math4/legacy/linear/FieldVector.java   |  290 +
 .../legacy/linear/FieldVectorChangingVisitor.java  |   56 +
 .../linear/FieldVectorPreservingVisitor.java       |   55 +
 .../math4/legacy/linear/HessenbergTransformer.java |  232 +
 .../linear/IllConditionedOperatorException.java    |   42 +
 .../math4/legacy/linear/IterativeLinearSolver.java |  173 +
 .../legacy/linear/IterativeLinearSolverEvent.java  |  115 +
 .../math4/legacy/linear/JacobiPreconditioner.java  |  135 +
 .../math4/legacy/linear/LUDecomposition.java       |  394 ++
 .../linear/MatrixDimensionMismatchException.java   |   73 +
 .../commons/math4/legacy/linear/MatrixUtils.java   | 1026 ++++
 .../linear/NonPositiveDefiniteMatrixException.java |   73 +
 .../NonPositiveDefiniteOperatorException.java      |   43 +
 .../linear/NonSelfAdjointOperatorException.java    |   46 +
 .../legacy/linear/NonSquareMatrixException.java    |   41 +
 .../legacy/linear/NonSquareOperatorException.java  |   40 +
 .../legacy/linear/NonSymmetricMatrixException.java |   71 +
 .../math4/legacy/linear/OpenMapRealMatrix.java     |  308 +
 .../math4/legacy/linear/OpenMapRealVector.java     |  812 +++
 .../PreconditionedIterativeLinearSolver.java       |  214 +
 .../math4/legacy/linear/QRDecomposition.java       |  507 ++
 .../math4/legacy/linear/RRQRDecomposition.java     |  247 +
 .../math4/legacy/linear/RealLinearOperator.java    |  109 +
 .../commons/math4/legacy/linear/RealMatrix.java    |  828 +++
 .../legacy/linear/RealMatrixChangingVisitor.java   |   55 +
 .../math4/legacy/linear/RealMatrixFormat.java      |  392 ++
 .../legacy/linear/RealMatrixPreservingVisitor.java |   54 +
 .../commons/math4/legacy/linear/RealVector.java    | 1629 ++++++
 .../legacy/linear/RealVectorChangingVisitor.java   |   58 +
 .../math4/legacy/linear/RealVectorFormat.java      |  288 +
 .../legacy/linear/RealVectorPreservingVisitor.java |   57 +
 .../linear/RectangularCholeskyDecomposition.java   |  195 +
 .../math4/legacy/linear/SchurTransformer.java      |  453 ++
 .../legacy/linear/SingularMatrixException.java     |   37 +
 .../legacy/linear/SingularOperatorException.java   |   38 +
 .../legacy/linear/SingularValueDecomposition.java  |  744 +++
 .../math4/legacy/linear/SparseFieldMatrix.java     |  187 +
 .../math4/legacy/linear/SparseFieldVector.java     |  811 +++
 .../math4/legacy/linear/SparseRealMatrix.java      |   34 +
 .../math4/legacy/linear/SparseRealVector.java      |   31 +
 .../apache/commons/math4/legacy/linear/SymmLQ.java | 1221 ++++
 .../legacy/linear/TriDiagonalTransformer.java      |  253 +
 .../commons/math4/legacy/linear/package-info.java  |   20 +
 .../legacy/ml/clustering/CentroidCluster.java      |   53 +
 .../math4/legacy/ml/clustering/Cluster.java        |   84 +
 .../legacy/ml/clustering/ClusterEvaluator.java     |   55 +
 .../math4/legacy/ml/clustering/ClusterRanking.java |   39 +
 .../math4/legacy/ml/clustering/Clusterable.java    |   32 +
 .../math4/legacy/ml/clustering/Clusterer.java      |   80 +
 .../legacy/ml/clustering/DBSCANClusterer.java      |  220 +
 .../math4/legacy/ml/clustering/DoublePoint.java    |   87 +
 .../legacy/ml/clustering/FuzzyKMeansClusterer.java |  421 ++
 .../ml/clustering/KMeansPlusPlusClusterer.java     |  543 ++
 .../ml/clustering/MiniBatchKMeansClusterer.java    |  301 +
 .../clustering/MultiKMeansPlusPlusClusterer.java   |  105 +
 .../ml/clustering/evaluation/CalinskiHarabasz.java |  171 +
 .../evaluation/SumOfClusterVariances.java          |   88 +
 .../ml/clustering/evaluation/package-info.java     |   24 +
 .../math4/legacy/ml/clustering/package-info.java   |   20 +
 .../math4/legacy/ml/distance/CanberraDistance.java |   47 +
 .../legacy/ml/distance/ChebyshevDistance.java      |   39 +
 .../math4/legacy/ml/distance/DistanceMeasure.java  |   41 +
 .../legacy/ml/distance/EarthMoversDistance.java    |   49 +
 .../legacy/ml/distance/EuclideanDistance.java      |   39 +
 .../legacy/ml/distance/ManhattanDistance.java      |   39 +
 .../math4/legacy/ml/distance/package-info.java     |   20 +
 .../legacy/ml/neuralnet/FeatureInitializer.java    |   32 +
 .../ml/neuralnet/FeatureInitializerFactory.java    |  116 +
 .../math4/legacy/ml/neuralnet/MapRanking.java      |  156 +
 .../math4/legacy/ml/neuralnet/MapUtils.java        |   99 +
 .../commons/math4/legacy/ml/neuralnet/Network.java |  489 ++
 .../commons/math4/legacy/ml/neuralnet/Neuron.java  |  272 +
 .../legacy/ml/neuralnet/SquareNeighbourhood.java   |   38 +
 .../math4/legacy/ml/neuralnet/UpdateAction.java    |   34 +
 .../legacy/ml/neuralnet/oned/NeuronString.java     |  239 +
 .../legacy/ml/neuralnet/oned/package-info.java     |   22 +
 .../math4/legacy/ml/neuralnet/package-info.java    |   22 +
 .../ml/neuralnet/sofm/KohonenTrainingTask.java     |   61 +
 .../ml/neuralnet/sofm/KohonenUpdateAction.java     |  228 +
 .../ml/neuralnet/sofm/LearningFactorFunction.java  |   34 +
 .../sofm/LearningFactorFunctionFactory.java        |  119 +
 .../neuralnet/sofm/NeighbourhoodSizeFunction.java  |   37 +
 .../sofm/NeighbourhoodSizeFunctionFactory.java     |  109 +
 .../legacy/ml/neuralnet/sofm/package-info.java     |   22 +
 .../sofm/util/ExponentialDecayFunction.java        |   83 +
 .../sofm/util/QuasiSigmoidDecayFunction.java       |   87 +
 .../ml/neuralnet/sofm/util/package-info.java       |   22 +
 .../ml/neuralnet/twod/NeuronSquareMesh2D.java      |  868 +++
 .../legacy/ml/neuralnet/twod/package-info.java     |   22 +
 .../ml/neuralnet/twod/util/LocationFinder.java     |  105 +
 .../neuralnet/twod/util/MapDataVisualization.java  |   38 +
 .../ml/neuralnet/twod/util/MapVisualization.java   |   34 +
 .../neuralnet/twod/util/SmoothedDataHistogram.java |   98 +
 .../neuralnet/twod/util/UnifiedDistanceMatrix.java |  155 +
 .../ml/neuralnet/twod/util/package-info.java       |   22 +
 .../commons/math4/legacy/ml/package-info.java      |   20 +
 .../math4/legacy/ode/AbstractFieldIntegrator.java  |  467 ++
 .../math4/legacy/ode/AbstractIntegrator.java       |  471 ++
 .../math4/legacy/ode/AbstractParameterizable.java  |   76 +
 .../legacy/ode/ContinuousOutputFieldModel.java     |  345 ++
 .../math4/legacy/ode/ContinuousOutputModel.java    |  445 ++
 .../commons/math4/legacy/ode/EquationsMapper.java  |   97 +
 .../math4/legacy/ode/ExpandableStatefulODE.java    |  330 ++
 .../math4/legacy/ode/FieldEquationsMapper.java     |  203 +
 .../math4/legacy/ode/FieldExpandableODE.java       |  147 +
 .../commons/math4/legacy/ode/FieldODEState.java    |  139 +
 .../legacy/ode/FieldODEStateAndDerivative.java     |   82 +
 .../math4/legacy/ode/FieldSecondaryEquations.java  |   75 +
 .../math4/legacy/ode/FirstOrderConverter.java      |  116 +
 .../ode/FirstOrderDifferentialEquations.java       |   68 +
 .../ode/FirstOrderFieldDifferentialEquations.java  |   73 +
 .../legacy/ode/FirstOrderFieldIntegrator.java      |  188 +
 .../math4/legacy/ode/FirstOrderIntegrator.java     |   66 +
 .../commons/math4/legacy/ode/JacobianMatrices.java |  496 ++
 .../legacy/ode/MainStateJacobianProvider.java      |   41 +
 .../math4/legacy/ode/MultistepFieldIntegrator.java |  456 ++
 .../math4/legacy/ode/MultistepIntegrator.java      |  465 ++
 .../commons/math4/legacy/ode/ODEIntegrator.java    |  158 +
 .../math4/legacy/ode/ParameterConfiguration.java   |   67 +
 .../legacy/ode/ParameterJacobianProvider.java      |   48 +
 .../math4/legacy/ode/ParameterJacobianWrapper.java |  102 +
 .../commons/math4/legacy/ode/Parameterizable.java  |   42 +
 .../commons/math4/legacy/ode/ParameterizedODE.java |   42 +
 .../math4/legacy/ode/ParameterizedWrapper.java     |   88 +
 .../ode/SecondOrderDifferentialEquations.java      |   64 +
 .../math4/legacy/ode/SecondOrderIntegrator.java    |   60 +
 .../math4/legacy/ode/SecondaryEquations.java       |   61 +
 .../legacy/ode/UnknownParameterException.java      |   52 +
 .../commons/math4/legacy/ode/events/Action.java    |   56 +
 .../math4/legacy/ode/events/EventFilter.java       |  208 +
 .../math4/legacy/ode/events/EventHandler.java      |  219 +
 .../math4/legacy/ode/events/EventState.java        |  432 ++
 .../math4/legacy/ode/events/FieldEventHandler.java |  180 +
 .../math4/legacy/ode/events/FieldEventState.java   |  345 ++
 .../math4/legacy/ode/events/FilterType.java        |  400 ++
 .../math4/legacy/ode/events/Transformer.java       |  107 +
 .../math4/legacy/ode/events/package-info.java      |   94 +
 .../nonstiff/AdamsBashforthFieldIntegrator.java    |  353 ++
 .../ode/nonstiff/AdamsBashforthIntegrator.java     |  361 ++
 .../legacy/ode/nonstiff/AdamsFieldIntegrator.java  |  146 +
 .../ode/nonstiff/AdamsFieldStepInterpolator.java   |  189 +
 .../math4/legacy/ode/nonstiff/AdamsIntegrator.java |  136 +
 .../ode/nonstiff/AdamsMoultonFieldIntegrator.java  |  418 ++
 .../ode/nonstiff/AdamsMoultonIntegrator.java       |  423 ++
 .../nonstiff/AdamsNordsieckFieldTransformer.java   |  359 ++
 .../ode/nonstiff/AdamsNordsieckTransformer.java    |  364 ++
 .../nonstiff/AdaptiveStepsizeFieldIntegrator.java  |  366 ++
 .../ode/nonstiff/AdaptiveStepsizeIntegrator.java   |  375 ++
 .../ClassicalRungeKuttaFieldIntegrator.java        |  113 +
 .../ClassicalRungeKuttaFieldStepInterpolator.java  |  135 +
 .../nonstiff/ClassicalRungeKuttaIntegrator.java    |   74 +
 .../ClassicalRungeKuttaStepInterpolator.java       |  135 +
 .../nonstiff/DormandPrince54FieldIntegrator.java   |  235 +
 .../DormandPrince54FieldStepInterpolator.java      |  249 +
 .../ode/nonstiff/DormandPrince54Integrator.java    |  161 +
 .../nonstiff/DormandPrince54StepInterpolator.java  |  225 +
 .../nonstiff/DormandPrince853FieldIntegrator.java  |  457 ++
 .../DormandPrince853FieldStepInterpolator.java     |  302 +
 .../ode/nonstiff/DormandPrince853Integrator.java   |  286 +
 .../nonstiff/DormandPrince853StepInterpolator.java |  501 ++
 .../EmbeddedRungeKuttaFieldIntegrator.java         |  385 ++
 .../ode/nonstiff/EmbeddedRungeKuttaIntegrator.java |  379 ++
 .../legacy/ode/nonstiff/EulerFieldIntegrator.java  |   99 +
 .../ode/nonstiff/EulerFieldStepInterpolator.java   |  107 +
 .../math4/legacy/ode/nonstiff/EulerIntegrator.java |   72 +
 .../legacy/ode/nonstiff/EulerStepInterpolator.java |  101 +
 .../ode/nonstiff/FieldButcherArrayProvider.java    |   46 +
 .../legacy/ode/nonstiff/GillFieldIntegrator.java   |  124 +
 .../ode/nonstiff/GillFieldStepInterpolator.java    |  147 +
 .../math4/legacy/ode/nonstiff/GillIntegrator.java  |   74 +
 .../legacy/ode/nonstiff/GillStepInterpolator.java  |  150 +
 .../ode/nonstiff/GraggBulirschStoerIntegrator.java |  948 +++
 .../GraggBulirschStoerStepInterpolator.java        |  406 ++
 .../ode/nonstiff/HighamHall54FieldIntegrator.java  |  208 +
 .../HighamHall54FieldStepInterpolator.java         |  116 +
 .../ode/nonstiff/HighamHall54Integrator.java       |  135 +
 .../ode/nonstiff/HighamHall54StepInterpolator.java |  122 +
 .../legacy/ode/nonstiff/LutherFieldIntegrator.java |  149 +
 .../ode/nonstiff/LutherFieldStepInterpolator.java  |  224 +
 .../legacy/ode/nonstiff/LutherIntegrator.java      |   89 +
 .../ode/nonstiff/LutherStepInterpolator.java       |  182 +
 .../ode/nonstiff/MidpointFieldIntegrator.java      |   98 +
 .../nonstiff/MidpointFieldStepInterpolator.java    |  117 +
 .../legacy/ode/nonstiff/MidpointIntegrator.java    |   68 +
 .../ode/nonstiff/MidpointStepInterpolator.java     |  115 +
 .../ode/nonstiff/RungeKuttaFieldIntegrator.java    |  273 +
 .../nonstiff/RungeKuttaFieldStepInterpolator.java  |  147 +
 .../legacy/ode/nonstiff/RungeKuttaIntegrator.java  |  268 +
 .../ode/nonstiff/RungeKuttaStepInterpolator.java   |  211 +
 .../ode/nonstiff/ThreeEighthesFieldIntegrator.java |  112 +
 .../ThreeEighthesFieldStepInterpolator.java        |  138 +
 .../ode/nonstiff/ThreeEighthesIntegrator.java      |   71 +
 .../nonstiff/ThreeEighthesStepInterpolator.java    |  145 +
 .../math4/legacy/ode/nonstiff/package-info.java    |   25 +
 .../commons/math4/legacy/ode/package-info.java     |  161 +
 .../sampling/AbstractFieldStepInterpolator.java    |  175 +
 .../ode/sampling/AbstractStepInterpolator.java     |  617 ++
 .../legacy/ode/sampling/DummyStepHandler.java      |   91 +
 .../legacy/ode/sampling/FieldFixedStepHandler.java |   69 +
 .../legacy/ode/sampling/FieldStepHandler.java      |   75 +
 .../legacy/ode/sampling/FieldStepInterpolator.java |   76 +
 .../legacy/ode/sampling/FieldStepNormalizer.java   |  273 +
 .../legacy/ode/sampling/FixedStepHandler.java      |   71 +
 .../ode/sampling/NordsieckStepInterpolator.java    |  293 +
 .../math4/legacy/ode/sampling/StepHandler.java     |   75 +
 .../legacy/ode/sampling/StepInterpolator.java      |  181 +
 .../math4/legacy/ode/sampling/StepNormalizer.java  |  300 +
 .../legacy/ode/sampling/StepNormalizerBounds.java  |   84 +
 .../legacy/ode/sampling/StepNormalizerMode.java    |   70 +
 .../math4/legacy/ode/sampling/package-info.java    |   60 +
 .../legacy/optim/AbstractConvergenceChecker.java   |   70 +
 .../legacy/optim/AbstractOptimizationProblem.java  |  111 +
 .../optim/BaseMultiStartMultivariateOptimizer.java |  230 +
 .../legacy/optim/BaseMultivariateOptimizer.java    |  155 +
 .../commons/math4/legacy/optim/BaseOptimizer.java  |  277 +
 .../math4/legacy/optim/ConvergenceChecker.java     |   55 +
 .../commons/math4/legacy/optim/InitialGuess.java   |   46 +
 .../apache/commons/math4/legacy/optim/MaxEval.java |   61 +
 .../apache/commons/math4/legacy/optim/MaxIter.java |   61 +
 .../math4/legacy/optim/OptimizationData.java       |   28 +
 .../math4/legacy/optim/OptimizationProblem.java    |   53 +
 .../commons/math4/legacy/optim/PointValuePair.java |  122 +
 .../math4/legacy/optim/PointVectorValuePair.java   |  147 +
 .../commons/math4/legacy/optim/SimpleBounds.java   |   79 +
 .../math4/legacy/optim/SimplePointChecker.java     |  133 +
 .../math4/legacy/optim/SimpleValueChecker.java     |  125 +
 .../legacy/optim/SimpleVectorValueChecker.java     |  134 +
 .../legacy/optim/linear/LinearConstraint.java      |  230 +
 .../legacy/optim/linear/LinearConstraintSet.java   |   62 +
 .../optim/linear/LinearObjectiveFunction.java      |  151 +
 .../math4/legacy/optim/linear/LinearOptimizer.java |  132 +
 .../optim/linear/NoFeasibleSolutionException.java  |   37 +
 .../legacy/optim/linear/NonNegativeConstraint.java |   47 +
 .../legacy/optim/linear/PivotSelectionRule.java    |   38 +
 .../math4/legacy/optim/linear/Relationship.java    |   65 +
 .../math4/legacy/optim/linear/SimplexSolver.java   |  409 ++
 .../math4/legacy/optim/linear/SimplexTableau.java  |  915 +++
 .../legacy/optim/linear/SolutionCallback.java      |   62 +
 .../optim/linear/UnboundedSolutionException.java   |   37 +
 .../math4/legacy/optim/linear/package-info.java    |   21 +
 .../legacy/optim/nonlinear/scalar/GoalType.java    |   32 +
 .../scalar/GradientMultivariateOptimizer.java      |  102 +
 .../nonlinear/scalar/LeastSquaresConverter.java    |  187 +
 .../legacy/optim/nonlinear/scalar/LineSearch.java  |  139 +
 .../scalar/MultiStartMultivariateOptimizer.java    |  113 +
 .../scalar/MultivariateFunctionMappingAdapter.java |  303 +
 .../scalar/MultivariateFunctionPenaltyAdapter.java |  187 +
 .../nonlinear/scalar/MultivariateOptimizer.java    |  117 +
 .../optim/nonlinear/scalar/ObjectiveFunction.java  |   46 +
 .../scalar/ObjectiveFunctionGradient.java          |   46 +
 .../optim/nonlinear/scalar/PopulationSize.java     |   50 +
 .../math4/legacy/optim/nonlinear/scalar/Sigma.java |   51 +
 .../NonLinearConjugateGradientOptimizer.java       |  337 ++
 .../nonlinear/scalar/gradient/Preconditioner.java  |   44 +
 .../nonlinear/scalar/gradient/package-info.java    |   21 +
 .../nonlinear/scalar/noderiv/AbstractSimplex.java  |  345 ++
 .../nonlinear/scalar/noderiv/BOBYQAOptimizer.java  | 2475 ++++++++
 .../nonlinear/scalar/noderiv/CMAESOptimizer.java   | 1358 +++++
 .../scalar/noderiv/MultiDirectionalSimplex.java    |  215 +
 .../scalar/noderiv/NelderMeadSimplex.java          |  280 +
 .../nonlinear/scalar/noderiv/PowellOptimizer.java  |  299 +
 .../nonlinear/scalar/noderiv/SimplexOptimizer.java |  231 +
 .../scalar/noderiv/SimplexOptimizer.java.DEBUG     |  339 ++
 .../nonlinear/scalar/noderiv/package-info.java     |   21 +
 .../optim/nonlinear/scalar/package-info.java       |   21 +
 .../commons/math4/legacy/optim/package-info.java   |   59 +
 .../legacy/optim/univariate/BracketFinder.java     |  314 +
 .../legacy/optim/univariate/BrentOptimizer.java    |  314 +
 .../univariate/MultiStartUnivariateOptimizer.java  |  230 +
 .../legacy/optim/univariate/SearchInterval.java    |   95 +
 .../univariate/SimpleUnivariateValueChecker.java   |  127 +
 .../univariate/UnivariateObjectiveFunction.java    |   46 +
 .../optim/univariate/UnivariateOptimizer.java      |  151 +
 .../optim/univariate/UnivariatePointValuePair.java |   66 +
 .../legacy/optim/univariate/package-info.java      |   21 +
 .../apache/commons/math4/legacy/package-info.java  |   20 +
 .../random/CorrelatedRandomVectorGenerator.java    |  185 +
 .../legacy/random/GaussianRandomGenerator.java     |   51 +
 .../legacy/random/HaltonSequenceGenerator.java     |  184 +
 .../legacy/random/NormalizedRandomGenerator.java   |   37 +
 .../math4/legacy/random/RandomGenerator.java       |  148 +
 .../commons/math4/legacy/random/RandomUtils.java   |  403 ++
 .../math4/legacy/random/RandomVectorGenerator.java |   32 +
 .../commons/math4/legacy/random/RngAdaptor.java    |  231 +
 .../legacy/random/SobolSequenceGenerator.java      |  326 ++
 .../math4/legacy/random/StableRandomGenerator.java |  133 +
 .../legacy/random/SynchronizedRandomGenerator.java |  134 +
 .../random/UncorrelatedRandomVectorGenerator.java  |   92 +
 .../legacy/random/UniformRandomGenerator.java      |   58 +
 .../commons/math4/legacy/random/package-info.java  |   33 +
 .../commons/math4/legacy/special/BesselJ.java      |  649 ++
 .../commons/math4/legacy/special/package-info.java |   20 +
 .../commons/math4/legacy/stat/Frequency.java       |  390 ++
 .../commons/math4/legacy/stat/StatUtils.java       |  856 +++
 .../math4/legacy/stat/correlation/Covariance.java  |  290 +
 .../stat/correlation/KendallsCorrelation.java      |  273 +
 .../stat/correlation/PearsonsCorrelation.java      |  330 ++
 .../stat/correlation/SpearmansCorrelation.java     |  203 +
 .../correlation/StorelessBivariateCovariance.java  |  138 +
 .../stat/correlation/StorelessCovariance.java      |  229 +
 .../legacy/stat/correlation/package-info.java      |   22 +
 .../AbstractStorelessUnivariateStatistic.java      |  192 +
 .../descriptive/AbstractUnivariateStatistic.java   |  132 +
 .../descriptive/AggregateSummaryStatistics.java    |  429 ++
 .../stat/descriptive/DescriptiveStatistics.java    |  802 +++
 .../descriptive/MultivariateSummaryStatistics.java |  646 ++
 .../StatisticalMultivariateSummary.java            |  119 +
 .../stat/descriptive/StatisticalSummary.java       |   64 +
 .../stat/descriptive/StatisticalSummaryValues.java |  193 +
 .../descriptive/StorelessUnivariateStatistic.java  |   91 +
 .../legacy/stat/descriptive/SummaryStatistics.java |  772 +++
 .../SynchronizedDescriptiveStatistics.java         |  192 +
 .../SynchronizedMultivariateSummaryStatistics.java |  297 +
 .../descriptive/SynchronizedSummaryStatistics.java |  366 ++
 .../stat/descriptive/UnivariateStatistic.java      |   56 +
 .../stat/descriptive/WeightedEvaluation.java       |   57 +
 .../stat/descriptive/moment/FirstMoment.java       |  166 +
 .../stat/descriptive/moment/FourthMoment.java      |  150 +
 .../stat/descriptive/moment/GeometricMean.java     |  209 +
 .../legacy/stat/descriptive/moment/Kurtosis.java   |  226 +
 .../math4/legacy/stat/descriptive/moment/Mean.java |  288 +
 .../stat/descriptive/moment/SecondMoment.java      |  132 +
 .../stat/descriptive/moment/SemiVariance.java      |  363 ++
 .../legacy/stat/descriptive/moment/Skewness.java   |  227 +
 .../stat/descriptive/moment/StandardDeviation.java |  277 +
 .../stat/descriptive/moment/ThirdMoment.java       |  148 +
 .../legacy/stat/descriptive/moment/Variance.java   |  627 ++
 .../descriptive/moment/VectorialCovariance.java    |  157 +
 .../stat/descriptive/moment/VectorialMean.java     |  105 +
 .../stat/descriptive/moment/package-info.java      |   20 +
 .../legacy/stat/descriptive/package-info.java      |   44 +
 .../math4/legacy/stat/descriptive/rank/Max.java    |  170 +
 .../math4/legacy/stat/descriptive/rank/Median.java |   96 +
 .../math4/legacy/stat/descriptive/rank/Min.java    |  170 +
 .../stat/descriptive/rank/PSquarePercentile.java   |  990 ++++
 .../legacy/stat/descriptive/rank/Percentile.java   | 1382 +++++
 .../legacy/stat/descriptive/rank/package-info.java |   20 +
 .../legacy/stat/descriptive/summary/Product.java   |  231 +
 .../math4/legacy/stat/descriptive/summary/Sum.java |  225 +
 .../legacy/stat/descriptive/summary/SumOfLogs.java |  171 +
 .../stat/descriptive/summary/SumOfSquares.java     |  160 +
 .../stat/descriptive/summary/package-info.java     |   20 +
 .../stat/inference/AlternativeHypothesis.java      |   40 +
 .../math4/legacy/stat/inference/BinomialTest.java  |  163 +
 .../math4/legacy/stat/inference/ChiSquareTest.java |  602 ++
 .../commons/math4/legacy/stat/inference/GTest.java |  538 ++
 .../legacy/stat/inference/InferenceTestUtils.java  |  745 +++
 .../stat/inference/KolmogorovSmirnovTest.java      | 1228 ++++
 .../legacy/stat/inference/MannWhitneyUTest.java    |  236 +
 .../math4/legacy/stat/inference/OneWayAnova.java   |  355 ++
 .../commons/math4/legacy/stat/inference/TTest.java | 1183 ++++
 .../stat/inference/WilcoxonSignedRankTest.java     |  323 +
 .../math4/legacy/stat/inference/package-info.java  |   22 +
 .../legacy/stat/interval/AgrestiCoullInterval.java |   49 +
 .../stat/interval/BinomialConfidenceInterval.java  |   61 +
 .../stat/interval/ClopperPearsonInterval.java      |   60 +
 .../legacy/stat/interval/ConfidenceInterval.java   |  108 +
 .../math4/legacy/stat/interval/IntervalUtils.java  |  173 +
 .../stat/interval/NormalApproximationInterval.java |   45 +
 .../legacy/stat/interval/WilsonScoreInterval.java  |   51 +
 .../math4/legacy/stat/interval/package-info.java   |   22 +
 .../commons/math4/legacy/stat/package-info.java    |   20 +
 .../math4/legacy/stat/ranking/NaNStrategy.java     |   55 +
 .../math4/legacy/stat/ranking/NaturalRanking.java  |  478 ++
 .../legacy/stat/ranking/RankingAlgorithm.java      |   40 +
 .../math4/legacy/stat/ranking/TiesStrategy.java    |   54 +
 .../math4/legacy/stat/ranking/package-info.java    |   22 +
 .../AbstractMultipleLinearRegression.java          |  386 ++
 .../regression/GLSMultipleLinearRegression.java    |  135 +
 .../stat/regression/MillerUpdatingRegression.java  | 1108 ++++
 .../regression/ModelSpecificationException.java    |   39 +
 .../stat/regression/MultipleLinearRegression.java  |   69 +
 .../regression/OLSMultipleLinearRegression.java    |  285 +
 .../legacy/stat/regression/RegressionResults.java  |  421 ++
 .../legacy/stat/regression/SimpleRegression.java   |  889 +++
 .../UpdatingMultipleLinearRegression.java          |   93 +
 .../math4/legacy/stat/regression/package-info.java |   22 +
 .../math4/legacy/transform/DctNormalization.java   |   66 +
 .../math4/legacy/transform/DftNormalization.java   |   56 +
 .../math4/legacy/transform/DstNormalization.java   |   56 +
 .../legacy/transform/FastCosineTransformer.java    |  183 +
 .../legacy/transform/FastFourierTransformer.java   |  416 ++
 .../legacy/transform/FastHadamardTransformer.java  |  325 ++
 .../legacy/transform/FastSineTransformer.java      |  182 +
 .../math4/legacy/transform/RealTransformer.java    |   67 +
 .../math4/legacy/transform/TransformType.java      |   30 +
 .../math4/legacy/transform/TransformUtils.java     |  163 +
 .../math4/legacy/transform/package-info.java       |   22 +
 .../apache/commons/math4/legacy/util/BigReal.java  |  334 ++
 .../commons/math4/legacy/util/BigRealField.java    |   86 +
 .../math4/legacy/util/CentralPivotingStrategy.java |   47 +
 .../math4/legacy/util/CombinatoricsUtils.java      |  125 +
 .../commons/math4/legacy/util/CompositeFormat.java |  218 +
 .../commons/math4/legacy/util/Decimal64.java       |  754 +++
 .../commons/math4/legacy/util/Decimal64Field.java  |   64 +
 .../math4/legacy/util/DefaultTransformer.java      |   81 +
 .../commons/math4/legacy/util/DoubleArray.java     |  110 +
 .../apache/commons/math4/legacy/util/FastMath.java | 4351 ++++++++++++++
 .../commons/math4/legacy/util/FastMathCalc.java    |  658 +++
 .../math4/legacy/util/FastMathLiteralArrays.java   | 6175 ++++++++++++++++++++
 .../commons/math4/legacy/util/IntegerSequence.java |  376 ++
 .../commons/math4/legacy/util/IterationEvent.java  |   55 +
 .../math4/legacy/util/IterationListener.java       |   57 +
 .../math4/legacy/util/IterationManager.java        |  185 +
 .../commons/math4/legacy/util/KthSelector.java     |  157 +
 .../commons/math4/legacy/util/MathArrays.java      | 1284 ++++
 .../commons/math4/legacy/util/MathUtils.java       |  284 +
 .../legacy/util/MedianOf3PivotingStrategy.java     |   64 +
 .../math4/legacy/util/NumberTransformer.java       |   38 +
 .../math4/legacy/util/OpenIntToDoubleHashMap.java  |  596 ++
 .../math4/legacy/util/OpenIntToFieldHashMap.java   |  617 ++
 .../org/apache/commons/math4/legacy/util/Pair.java |  156 +
 .../legacy/util/PivotingStrategyInterface.java     |   44 +
 .../math4/legacy/util/RandomPivotingStrategy.java  |  101 +
 .../math4/legacy/util/ResizableDoubleArray.java    |  849 +++
 .../commons/math4/legacy/util/TransformerMap.java  |  190 +
 .../commons/math4/legacy/util/package-info.java    |   20 +
 .../exception/util/LocalizedFormats_en.properties  |    0
 .../exception/util/LocalizedFormats_fr.properties  |  343 ++
 .../math4/legacy}/random/new-joe-kuo-6.21201       |    0
 .../src}/test/R/ChiSquareDistributionTestCases.R   |    0
 .../src}/test/R/FDistributionTestCases.R           |    0
 .../src}/test/R/GammaDistributionTestCases.R       |    0
 .../R/KolmogorovSmirnovDistributionTestCases.R     |    0
 .../src}/test/R/KolmogorovSmirnovTestCases.R       |    0
 .../src}/test/R/LevyDistributionTestCases.R        |    0
 {src => commons-math-legacy/src}/test/R/README.txt |    0
 .../src}/test/R/TDistributionTestCases.R           |    0
 {src => commons-math-legacy/src}/test/R/TTestCases |    0
 .../src}/test/R/WeibullDistributionTestCases.R     |    0
 .../src}/test/R/anovaTestCases                     |    0
 .../src}/test/R/binomialTestCases                  |    0
 .../src}/test/R/cauchyTestCases.R                  |    0
 .../src}/test/R/chiSquareTestCases                 |    0
 .../src}/test/R/correlationTestCases               |    0
 .../src}/test/R/covarianceTestCases                |    0
 .../src}/test/R/descriptiveTestCases               |    0
 .../src}/test/R/exponentialTestCases               |    0
 .../src}/test/R/geometricTestCases                 |    0
 .../src}/test/R/gumbelTestCases.R                  |    0
 .../src}/test/R/hypergeometricTestCases            |    0
 .../src}/test/R/laplaceTestCases.R                 |    0
 .../src}/test/R/logNormalTestCases                 |    0
 .../src}/test/R/logisticsTestCases.R               |    0
 .../src}/test/R/multipleOLSRegressionTestCases     |    0
 .../src}/test/R/nakagamiTestCases.R                |    0
 .../src}/test/R/normalTestCases                    |    0
 .../src}/test/R/paretoTestCases                    |    0
 .../src}/test/R/pascalTestCases                    |    0
 .../src}/test/R/poissonTestCases                   |    0
 .../src}/test/R/regressionTestCases                |    0
 {src => commons-math-legacy/src}/test/R/testAll    |    0
 .../src}/test/R/testFunctions                      |    0
 .../src}/test/R/zipfTestCases                      |    0
 .../legacy/ExtendedFieldElementAbstractTest.java   |  540 ++
 .../apache/commons/math4/legacy/PerfTestUtils.java |  384 ++
 .../org/apache/commons/math4/legacy/Retry.java     |   29 +
 .../apache/commons/math4/legacy/RetryRunner.java   |   81 +
 .../commons/math4/legacy/RetryRunnerTest.java      |   54 +
 .../org/apache/commons/math4/legacy/TestUtils.java |  586 ++
 .../math4/legacy/analysis/FunctionUtilsTest.java   |  431 ++
 .../math4/legacy/analysis/MonitoredFunction.java   |   48 +
 .../math4/legacy/analysis/QuinticFunction.java     |   41 +
 .../math4/legacy/analysis/SumSincFunction.java     |   55 +
 .../math4/legacy/analysis/XMinus5Function.java     |   41 +
 .../analysis/differentiation/DSCompilerTest.java   |  477 ++
 .../differentiation/DerivativeStructureTest.java   | 1632 ++++++
 .../FiniteDifferencesDifferentiatorTest.java       |  413 ++
 .../differentiation/GradientFunctionTest.java      |   90 +
 .../differentiation/JacobianFunctionTest.java      |   97 +
 .../differentiation/SparseGradientTest.java        | 1131 ++++
 .../analysis/function/BivariateFunctionTest.java   |   44 +
 .../legacy/analysis/function/GaussianTest.java     |  161 +
 .../analysis/function/HarmonicOscillatorTest.java  |  139 +
 .../legacy/analysis/function/LogisticTest.java     |  199 +
 .../math4/legacy/analysis/function/LogitTest.java  |  227 +
 .../legacy/analysis/function/SigmoidTest.java      |  110 +
 .../math4/legacy/analysis/function/SincTest.java   |  122 +
 .../math4/legacy/analysis/function/SqrtTest.java   |   72 +
 .../legacy/analysis/function/StepFunctionTest.java |  115 +
 .../UnivariateDifferentiableFunctionTest.java      |  227 +
 .../analysis/function/UnivariateFunctionTest.java  |  124 +
 .../IterativeLegendreGaussIntegratorTest.java      |  171 +
 .../integration/MidPointIntegratorTest.java        |  175 +
 .../integration/RombergIntegratorTest.java         |  123 +
 .../integration/SimpsonIntegratorTest.java         |  385 ++
 .../integration/TrapezoidIntegratorTest.java       |  123 +
 .../integration/gauss/BaseRuleFactoryTest.java     |  113 +
 .../integration/gauss/GaussIntegratorTest.java     |   74 +
 .../gauss/GaussianQuadratureAbstractTest.java      |  116 +
 .../integration/gauss/HermiteParametricTest.java   |   96 +
 .../analysis/integration/gauss/HermiteTest.java    |  112 +
 .../analysis/integration/gauss/LaguerreTest.java   |   50 +
 .../gauss/LegendreHighPrecisionParametricTest.java |   85 +
 .../gauss/LegendreHighPrecisionTest.java           |   58 +
 .../integration/gauss/LegendreParametricTest.java  |   85 +
 .../analysis/integration/gauss/LegendreTest.java   |   58 +
 .../interpolation/AkimaSplineInterpolatorTest.java |  267 +
 .../BicubicInterpolatingFunctionTest.java          |  391 ++
 .../interpolation/BicubicInterpolatorTest.java     |  178 +
 .../DividedDifferenceInterpolatorTest.java         |  146 +
 .../FieldHermiteInterpolatorTest.java              |  276 +
 .../interpolation/HermiteInterpolatorTest.java     |  257 +
 .../interpolation/LinearInterpolatorTest.java      |  147 +
 .../interpolation/LoessInterpolatorTest.java       |  259 +
 .../MicrosphereProjectionInterpolatorTest.java     |  149 +
 .../interpolation/NevilleInterpolatorTest.java     |  146 +
 ...wiseBicubicSplineInterpolatingFunctionTest.java |  271 +
 .../PiecewiseBicubicSplineInterpolatorTest.java    |  229 +
 .../interpolation/SplineInterpolatorTest.java      |  223 +
 .../TricubicInterpolatingFunctionTest.java         |  653 +++
 .../interpolation/TricubicInterpolatorTest.java    |  227 +
 .../UnivariatePeriodicInterpolatorTest.java        |  163 +
 .../PolynomialFunctionLagrangeFormTest.java        |  153 +
 .../PolynomialFunctionNewtonFormTest.java          |  178 +
 .../polynomials/PolynomialFunctionTest.java        |  263 +
 .../polynomials/PolynomialSplineFunctionTest.java  |  187 +
 .../analysis/polynomials/PolynomialsUtilsTest.java |  394 ++
 .../solvers/BaseSecantSolverAbstractTest.java      |  259 +
 .../analysis/solvers/BisectionSolverTest.java      |   90 +
 .../solvers/BracketingNthOrderBrentSolverTest.java |  214 +
 .../legacy/analysis/solvers/BrentSolverTest.java   |  268 +
 .../FieldBracketingNthOrderBrentSolverTest.java    |  180 +
 .../analysis/solvers/IllinoisSolverTest.java       |   36 +
 .../analysis/solvers/LaguerreSolverTest.java       |  159 +
 .../legacy/analysis/solvers/MullerSolver2Test.java |  145 +
 .../legacy/analysis/solvers/MullerSolverTest.java  |  148 +
 .../analysis/solvers/NewtonRaphsonSolverTest.java  |   90 +
 .../legacy/analysis/solvers/PegasusSolverTest.java |   36 +
 .../analysis/solvers/RegulaFalsiSolverTest.java    |   60 +
 .../legacy/analysis/solvers/RiddersSolverTest.java |  141 +
 .../legacy/analysis/solvers/SecantSolverTest.java  |   39 +
 .../solvers/UnivariateSolverUtilsTest.java         |  217 +
 .../legacy/complex/ComplexFormatAbstractTest.java  |  416 ++
 .../math4/legacy/complex/ComplexFormatTest.java    |   33 +
 .../legacy/complex/FrenchComplexFormatTest.java    |   34 +
 .../apache/commons/math4/legacy/dfp/Decimal10.java |   99 +
 .../commons/math4/legacy/dfp/DfpDecTest.java       |  566 ++
 .../commons/math4/legacy/dfp/DfpMathTest.java      |  588 ++
 .../apache/commons/math4/legacy/dfp/DfpTest.java   | 1674 ++++++
 .../AbstractIntegerDistributionTest.java           |  130 +
 .../distribution/AbstractRealDistributionTest.java |  211 +
 .../distribution/EmpiricalDistributionTest.java    |  689 +++
 .../EnumeratedIntegerDistributionTest.java         |  198 +
 .../EnumeratedRealDistributionTest.java            |  254 +
 .../IntegerDistributionAbstractTest.java           |  426 ++
 .../MixtureMultivariateNormalDistributionTest.java |  265 +
 .../MultivariateNormalDistributionTest.java        |  156 +
 .../distribution/RealDistributionAbstractTest.java |  515 ++
 ...teNormalMixtureExpectationMaximizationTest.java |  349 ++
 .../exception/DimensionMismatchExceptionTest.java  |   33 +
 .../exception/MaxCountExceededExceptionTest.java   |   32 +
 .../NonMonotonicSequenceExceptionTest.java         |   45 +
 .../legacy/exception/NotPositiveExceptionTest.java |   34 +
 .../NotStrictlyPositiveExceptionTest.java          |   34 +
 .../exception/NumberIsTooLargeExceptionTest.java   |   34 +
 .../exception/NumberIsTooSmallExceptionTest.java   |   34 +
 .../legacy/exception/OutOfRangeExceptionTest.java  |   34 +
 .../exception/TooManyEvaluationsExceptionTest.java |   39 +
 .../math4/legacy/exception/util/ArgUtilsTest.java  |   75 +
 .../exception/util/ExceptionContextTest.java       |  130 +
 .../exception/util/LocalizedFormatsTest.java       |  104 +
 .../field/linalg/FP64FieldDenseMatrixTest.java     |  285 +
 .../field/linalg/FieldLUDecompositionTest.java     |  314 +
 .../math4/legacy/filter/KalmanFilterTest.java      |  442 ++
 .../legacy/fitting/GaussianCurveFitterTest.java    |  424 ++
 .../legacy/fitting/HarmonicCurveFitterTest.java    |  182 +
 .../legacy/fitting/PolynomialCurveFitterTest.java  |  167 +
 .../legacy/fitting/SimpleCurveFitterTest.java      |   59 +
 .../legacy/fitting/WeightedObservedPointsTest.java |  126 +
 .../AbstractLeastSquaresOptimizerAbstractTest.java |  607 ++
 .../fitting/leastsquares/BevingtonProblem.java     |   79 +
 .../legacy/fitting/leastsquares/CircleProblem.java |  178 +
 .../fitting/leastsquares/CircleVectorial.java      |   97 +
 ...atorVectorMultivariateJacobianFunctionTest.java |  154 +
 .../leastsquares/EvaluationRmsCheckerTest.java     |  103 +
 .../fitting/leastsquares/EvaluationTest.java       |  335 ++
 .../leastsquares/EvaluationTestValidation.java     |  304 +
 .../GaussNewtonOptimizerWithCholeskyTest.java      |  133 +
 .../GaussNewtonOptimizerWithLUTest.java            |  133 +
 .../GaussNewtonOptimizerWithQRTest.java            |  119 +
 .../GaussNewtonOptimizerWithSVDTest.java           |  151 +
 .../LevenbergMarquardtOptimizerTest.java           |  350 ++
 .../legacy/fitting/leastsquares/MinpackTest.java   | 1484 +++++
 .../leastsquares/RandomCirclePointGenerator.java   |   88 +
 .../RandomStraightLinePointGenerator.java          |   97 +
 .../leastsquares/StatisticalReferenceDataset.java  |  373 ++
 .../StatisticalReferenceDatasetFactory.java        |  202 +
 .../fitting/leastsquares/StraightLineProblem.java  |  169 +
 .../legacy/genetics/BinaryChromosomeTest.java      |   66 +
 .../math4/legacy/genetics/BinaryMutationTest.java  |   45 +
 .../math4/legacy/genetics/ChromosomeTest.java      |  120 +
 .../math4/legacy/genetics/CycleCrossoverTest.java  |  151 +
 .../legacy/genetics/DummyBinaryChromosome.java     |   45 +
 .../math4/legacy/genetics/DummyListChromosome.java |   79 +
 .../math4/legacy/genetics/DummyRandomKey.java      |   45 +
 .../genetics/ElitisticListPopulationTest.java      |  106 +
 .../math4/legacy/genetics/FitnessCachingTest.java  |   95 +
 .../legacy/genetics/FixedElapsedTimeTest.java      |   80 +
 .../legacy/genetics/FixedGenerationCountTest.java  |   70 +
 .../genetics/GeneticAlgorithmTestBinary.java       |  125 +
 .../genetics/GeneticAlgorithmTestPermutations.java |  133 +
 .../math4/legacy/genetics/ListPopulationTest.java  |  220 +
 .../math4/legacy/genetics/NPointCrossoverTest.java |  131 +
 .../legacy/genetics/OnePointCrossoverTest.java     |   61 +
 .../legacy/genetics/OrderedCrossoverTest.java      |  104 +
 .../legacy/genetics/RandomKeyMutationTest.java     |   44 +
 .../math4/legacy/genetics/RandomKeyTest.java       |  173 +
 .../legacy/genetics/TournamentSelectionTest.java   |   57 +
 .../legacy/genetics/UniformCrossoverTest.java      |  153 +
 .../legacy/linear/Array2DRowRealMatrixTest.java    | 1171 ++++
 .../math4/legacy/linear/ArrayFieldVectorTest.java  | 1265 ++++
 .../math4/legacy/linear/ArrayRealVectorTest.java   |  172 +
 .../legacy/linear/BiDiagonalTransformerTest.java   |  201 +
 .../math4/legacy/linear/BlockFieldMatrixTest.java  | 1391 +++++
 .../math4/legacy/linear/BlockRealMatrixTest.java   | 1280 ++++
 .../legacy/linear/CholeskyDecompositionTest.java   |  138 +
 .../math4/legacy/linear/CholeskySolverTest.java    |  112 +
 .../math4/legacy/linear/ConjugateGradientTest.java |  622 ++
 .../apache/commons/math4/legacy/linear/Dfp25.java  |   41 +
 .../math4/legacy/linear/DiagonalMatrixTest.java    |  368 ++
 .../legacy/linear/EigenComplexSolverTest.java_NEW  |  322 +
 .../legacy/linear/EigenDecompositionTest.java      |  785 +++
 .../math4/legacy/linear/EigenSolverTest.java       |  199 +
 .../legacy/linear/FieldLUDecompositionTest.java    |  301 +
 .../math4/legacy/linear/FieldLUSolverTest.java     |  176 +
 .../math4/legacy/linear/FieldMatrixImplTest.java   | 1158 ++++
 .../legacy/linear/FrenchRealVectorFormatTest.java  |   34 +
 .../legacy/linear/HessenbergTransformerTest.java   |  225 +
 .../commons/math4/legacy/linear/HilbertMatrix.java |   75 +
 .../math4/legacy/linear/InverseHilbertMatrix.java  |  100 +
 .../math4/legacy/linear/LUDecompositionTest.java   |  291 +
 .../commons/math4/legacy/linear/LUSolverTest.java  |  168 +
 .../MatrixDimensionMismatchExceptionTest.java      |   36 +
 .../math4/legacy/linear/MatrixUtilsTest.java       |  488 ++
 .../math4/legacy/linear/OpenMapRealMatrixTest.java |   49 +
 .../math4/legacy/linear/QRDecompositionTest.java   |  285 +
 .../commons/math4/legacy/linear/QRSolverTest.java  |  195 +
 .../math4/legacy/linear/RRQRDecompositionTest.java |  257 +
 .../math4/legacy/linear/RRQRSolverTest.java        |  201 +
 .../linear/RealMatrixFormatAbstractTest.java       |  362 ++
 .../math4/legacy/linear/RealMatrixFormatTest.java  |   34 +
 .../legacy/linear/RealVectorAbstractTest.java      | 2008 +++++++
 .../linear/RealVectorFormatAbstractTest.java       |  354 ++
 .../math4/legacy/linear/RealVectorFormatTest.java  |   34 +
 .../math4/legacy/linear/RealVectorTest.java        |  233 +
 .../RectangularCholeskyDecompositionTest.java      |  114 +
 .../math4/legacy/linear/SchurTransformerTest.java  |  206 +
 .../linear/SingularValueDecompositionTest.java     |  331 ++
 .../legacy/linear/SingularValueSolverTest.java     |  158 +
 .../math4/legacy/linear/SparseFieldMatrixTest.java |  700 +++
 .../math4/legacy/linear/SparseFieldVectorTest.java |  816 +++
 .../math4/legacy/linear/SparseRealMatrixTest.java  |  697 +++
 .../math4/legacy/linear/SparseRealVectorTest.java  |  150 +
 .../commons/math4/legacy/linear/SymmLQTest.java    |  700 +++
 .../legacy/linear/TriDiagonalTransformerTest.java  |  177 +
 .../linear/UnmodifiableArrayRealVectorTest.java    |   39 +
 .../linear/UnmodifiableOpenMapRealVectorTest.java  |   45 +
 .../linear/UnmodifiableRealVectorAbstractTest.java |  455 ++
 .../legacy/ml/clustering/DBSCANClustererTest.java  |  190 +
 .../ml/clustering/FuzzyKMeansClustererTest.java    |  135 +
 .../ml/clustering/KMeansPlusPlusClustererTest.java |  188 +
 .../clustering/MiniBatchKMeansClustererTest.java   |  181 +
 .../MultiKMeansPlusPlusClustererTest.java          |   98 +
 .../evaluation/CalinskiHarabaszTest.java           |  165 +
 .../evaluation/SumOfClusterVariancesTest.java      |   81 +
 .../legacy/ml/distance/CanberraDistanceTest.java   |   48 +
 .../legacy/ml/distance/ChebyshevDistanceTest.java  |   42 +
 .../ml/distance/EarthMoversDistanceTest.java       |   48 +
 .../legacy/ml/distance/EuclideanDistanceTest.java  |   43 +
 .../legacy/ml/distance/ManhattanDistanceTest.java  |   42 +
 .../math4/legacy/ml/neuralnet/MapRankingTest.java  |  119 +
 .../math4/legacy/ml/neuralnet/NetworkTest.java     |  209 +
 .../math4/legacy/ml/neuralnet/NeuronTest.java      |  139 +
 .../ml/neuralnet/OffsetFeatureInitializer.java     |   48 +
 .../legacy/ml/neuralnet/oned/NeuronStringTest.java |  184 +
 .../ml/neuralnet/sofm/KohonenTrainingTaskTest.java |  221 +
 .../ml/neuralnet/sofm/KohonenUpdateActionTest.java |   93 +
 .../sofm/LearningFactorFunctionFactoryTest.java    |   94 +
 .../sofm/NeighbourhoodSizeFunctionFactoryTest.java |   83 +
 .../neuralnet/sofm/TravellingSalesmanSolver.java   |  427 ++
 .../sofm/util/ExponentialDecayFunctionTest.java    |   57 +
 .../sofm/util/QuasiSigmoidDecayFunctionTest.java   |   54 +
 .../ml/neuralnet/twod/NeuronSquareMesh2DTest.java  |  914 +++
 .../ml/neuralnet/twod/util/LocationFinderTest.java |   69 +
 .../legacy/ode/ContinuousOutputFieldModelTest.java |  229 +
 .../legacy/ode/ContinuousOutputModelTest.java      |  206 +
 .../math4/legacy/ode/FieldExpandableODETest.java   |  345 ++
 .../math4/legacy/ode/FirstOrderConverterTest.java  |  114 +
 .../math4/legacy/ode/JacobianMatricesTest.java     |  619 ++
 .../math4/legacy/ode/TestFieldProblem1.java        |   79 +
 .../math4/legacy/ode/TestFieldProblem2.java        |   78 +
 .../math4/legacy/ode/TestFieldProblem3.java        |  124 +
 .../math4/legacy/ode/TestFieldProblem4.java        |  168 +
 .../math4/legacy/ode/TestFieldProblem5.java        |   41 +
 .../math4/legacy/ode/TestFieldProblem6.java        |   84 +
 .../math4/legacy/ode/TestFieldProblemAbstract.java |  204 +
 .../math4/legacy/ode/TestFieldProblemHandler.java  |  156 +
 .../commons/math4/legacy/ode/TestProblem1.java     |   74 +
 .../commons/math4/legacy/ode/TestProblem2.java     |   76 +
 .../commons/math4/legacy/ode/TestProblem3.java     |  113 +
 .../commons/math4/legacy/ode/TestProblem4.java     |  151 +
 .../commons/math4/legacy/ode/TestProblem5.java     |   34 +
 .../commons/math4/legacy/ode/TestProblem6.java     |   75 +
 .../math4/legacy/ode/TestProblemAbstract.java      |  162 +
 .../math4/legacy/ode/TestProblemHandler.java       |  161 +
 .../math4/legacy/ode/events/CloseEventsTest.java   |  133 +
 .../math4/legacy/ode/events/EventFilterTest.java   |  275 +
 .../math4/legacy/ode/events/EventStateTest.java    |  297 +
 .../legacy/ode/events/OverlappingEventsTest.java   |  174 +
 .../legacy/ode/events/ReappearingEventTest.java    |  101 +
 ...tractEmbeddedRungeKuttaFieldIntegratorTest.java |  616 ++
 .../AbstractRungeKuttaFieldIntegratorTest.java     |  682 +++
 .../AdamsBashforthFieldIntegratorTest.java         |   86 +
 .../ode/nonstiff/AdamsBashforthIntegratorTest.java |  302 +
 .../nonstiff/AdamsFieldIntegratorAbstractTest.java |  265 +
 .../nonstiff/AdamsMoultonFieldIntegratorTest.java  |   86 +
 .../ode/nonstiff/AdamsMoultonIntegratorTest.java   |  289 +
 .../nonstiff/AdamsNordsieckTransformerTest.java    |  120 +
 ...lassicalRungKuttaFieldStepInterpolatorTest.java |   68 +
 .../ClassicalRungeKuttaFieldIntegratorTest.java    |  104 +
 .../ClassicalRungeKuttaIntegratorTest.java         |  354 ++
 .../ClassicalRungeKuttaStepInterpolatorTest.java   |   98 +
 .../DormandPrince54FieldIntegratorTest.java        |   99 +
 .../DormandPrince54FieldStepInterpolatorTest.java  |   68 +
 .../nonstiff/DormandPrince54IntegratorTest.java    |  360 ++
 .../DormandPrince54StepInterpolatorTest.java       |  155 +
 .../DormandPrince853FieldIntegratorTest.java       |   99 +
 .../DormandPrince853FieldStepInterpolatorTest.java |   68 +
 .../nonstiff/DormandPrince853IntegratorTest.java   |  499 ++
 .../DormandPrince853StepInterpolatorTest.java      |  155 +
 ...eddedRungeKuttaFieldIntegratorAbstractTest.java |  616 ++
 .../ode/nonstiff/EulerFieldIntegratorTest.java     |  105 +
 .../nonstiff/EulerFieldStepInterpolatorTest.java   |   67 +
 .../legacy/ode/nonstiff/EulerIntegratorTest.java   |  197 +
 .../ode/nonstiff/EulerStepInterpolatorTest.java    |  194 +
 .../ode/nonstiff/GillFieldIntegratorTest.java      |  104 +
 .../nonstiff/GillFieldStepInterpolatorTest.java    |   68 +
 .../legacy/ode/nonstiff/GillIntegratorTest.java    |  253 +
 .../ode/nonstiff/GillStepInterpolatorTest.java     |   98 +
 .../nonstiff/GraggBulirschStoerIntegratorTest.java |  436 ++
 .../GraggBulirschStoerStepInterpolatorTest.java    |  157 +
 .../nonstiff/HighamHall54FieldIntegratorTest.java  |   99 +
 .../HighamHall54FieldStepInterpolatorTest.java     |   68 +
 .../ode/nonstiff/HighamHall54IntegratorTest.java   |  377 ++
 .../nonstiff/HighamHall54StepInterpolatorTest.java |  155 +
 .../ode/nonstiff/LutherFieldIntegratorTest.java    |  123 +
 .../nonstiff/LutherFieldStepInterpolatorTest.java  |   68 +
 .../legacy/ode/nonstiff/LutherIntegratorTest.java  |  344 ++
 .../ode/nonstiff/LutherStepInterpolatorTest.java   |   98 +
 .../ode/nonstiff/MidpointFieldIntegratorTest.java  |  104 +
 .../MidpointFieldStepInterpolatorTest.java         |   68 +
 .../ode/nonstiff/MidpointIntegratorTest.java       |  197 +
 .../ode/nonstiff/MidpointStepInterpolatorTest.java |   99 +
 .../RungeKuttaFieldIntegratorAbstractTest.java     |  682 +++
 ...ungeKuttaFieldStepInterpolatorAbstractTest.java |  308 +
 .../legacy/ode/nonstiff/StepFieldProblem.java      |   85 +
 .../math4/legacy/ode/nonstiff/StepProblem.java     |   71 +
 .../nonstiff/ThreeEighthesFieldIntegratorTest.java |  104 +
 .../ThreeEighthesFieldStepInterpolatorTest.java    |   68 +
 .../ode/nonstiff/ThreeEighthesIntegratorTest.java  |  247 +
 .../ThreeEighthesStepInterpolatorTest.java         |   98 +
 .../ode/sampling/DummyFieldStepInterpolator.java   |   55 +
 .../legacy/ode/sampling/DummyStepInterpolator.java |  153 +
 .../ode/sampling/DummyStepInterpolatorTest.java    |  136 +
 .../sampling/NordsieckStepInterpolatorTest.java    |   96 +
 .../ode/sampling/StepInterpolatorTestUtils.java    |  146 +
 .../sampling/StepNormalizerOutputOverlapTest.java  |   69 +
 .../ode/sampling/StepNormalizerOutputTest.java     |   69 +
 .../ode/sampling/StepNormalizerOutputTestBase.java |  286 +
 .../legacy/ode/sampling/StepNormalizerTest.java    |  130 +
 .../math4/legacy/optim/PointValuePairTest.java     |   35 +
 .../legacy/optim/PointVectorValuePairTest.java     |   39 +
 .../math4/legacy/optim/SimplePointCheckerTest.java |   53 +
 .../math4/legacy/optim/SimpleValueCheckerTest.java |   52 +
 .../legacy/optim/SimpleVectorValueCheckerTest.java |   53 +
 .../legacy/optim/linear/SimplexSolverTest.java     |  905 +++
 .../legacy/optim/linear/SimplexTableauTest.java    |  109 +
 .../MultiStartMultivariateOptimizerTest.java       |  134 +
 .../MultivariateFunctionMappingAdapterTest.java    |  193 +
 .../MultivariateFunctionPenaltyAdapterTest.java    |  203 +
 .../nonlinear/scalar/gradient/CircleScalar.java    |   87 +
 .../NonLinearConjugateGradientOptimizerTest.java   |  480 ++
 .../scalar/noderiv/BOBYQAOptimizerTest.java        |  355 ++
 .../scalar/noderiv/CMAESOptimizerTest.java         |  852 +++
 .../nonlinear/scalar/noderiv/OptimTestUtils.java   |  397 ++
 .../scalar/noderiv/PowellOptimizerTest.java        |  272 +
 .../SimplexOptimizerMultiDirectionalTest.java      |  337 ++
 .../SimplexOptimizerMultiDirectionalTest.java.NEW  |  409 ++
 .../noderiv/SimplexOptimizerNelderMeadTest.java    |  423 ++
 .../legacy/optim/univariate/BracketFinderTest.java |  121 +
 .../optim/univariate/BrentOptimizerTest.java       |  303 +
 .../MultiStartUnivariateOptimizerTest.java         |  127 +
 .../SimpleUnivariateValueCheckerTest.java          |   52 +
 .../CorrelatedRandomVectorGeneratorTest.java       |  192 +
 .../legacy/random/GaussianRandomGeneratorTest.java |   38 +
 .../legacy/random/HaltonSequenceGeneratorTest.java |  134 +
 .../RandomUtilsDataGeneratorAbstractTest.java      |  303 +
 .../RandomUtilsDataGeneratorJDKRandomTest.java     |   31 +
 .../legacy/random/SobolSequenceGeneratorTest.java  |  107 +
 .../legacy/random/StableRandomGeneratorTest.java   |  130 +
 .../random/SynchronizedRandomGeneratorTest.java    |  120 +
 .../UncorrelatedRandomVectorGeneratorTest.java     |   65 +
 .../legacy/random/UniformRandomGeneratorTest.java  |   40 +
 .../commons/math4/legacy/special/BesselJTest.java  |  775 +++
 .../math4/legacy/stat/CertifiedDataTest.java       |  149 +
 .../commons/math4/legacy/stat/FrequencyTest.java   |  354 ++
 .../commons/math4/legacy/stat/StatUtilsTest.java   |  556 ++
 .../math4/legacy/stat/StatUtilsTest.java.orig      |    0
 .../legacy/stat/correlation/CovarianceTest.java    |  253 +
 .../stat/correlation/KendallsCorrelationTest.java  |  280 +
 .../stat/correlation/PearsonsCorrelationTest.java  |  318 +
 .../correlation/SpearmansRankCorrelationTest.java  |  163 +
 .../stat/correlation/StorelessCovarianceTest.java  |  264 +
 .../stat/data/CertifiedDataAbstractTest.java       |  158 +
 .../commons/math4/legacy/stat/data/LewTest.java    |   28 +
 .../math4/legacy/stat/data/LotteryTest.java        |   28 +
 .../AggregateSummaryStatisticsTest.java            |  341 ++
 .../descriptive/DescriptiveStatisticsTest.java     |  485 ++
 .../stat/descriptive/ListUnivariateImpl.java       |  197 +
 .../stat/descriptive/ListUnivariateImplTest.java   |  157 +
 .../descriptive/MixedListUnivariateImplTest.java   |  204 +
 .../MultivariateSummaryStatisticsTest.java         |  321 +
 .../descriptive/StatisticalSummaryValuesTest.java  |   82 +
 .../StorelessUnivariateStatisticAbstractTest.java  |  239 +
 .../stat/descriptive/SummaryStatisticsTest.java    |  372 ++
 .../SynchronizedDescriptiveStatisticsTest.java     |   27 +
 ...chronizedMultivariateSummaryStatisticsTest.java |   27 +
 .../SynchronizedSummaryStatisticsTest.java         |   26 +
 .../UnivariateStatisticAbstractTest.java           |  223 +
 .../stat/descriptive/moment/FirstMomentTest.java   |  111 +
 .../stat/descriptive/moment/FourthMomentTest.java  |   46 +
 .../stat/descriptive/moment/GeometricMeanTest.java |   78 +
 .../stat/descriptive/moment/InteractionTest.java   |   79 +
 .../stat/descriptive/moment/KurtosisTest.java      |   64 +
 .../legacy/stat/descriptive/moment/MeanTest.java   |   67 +
 .../stat/descriptive/moment/SecondMomentTest.java  |   46 +
 .../stat/descriptive/moment/SemiVarianceTest.java  |  153 +
 .../stat/descriptive/moment/SkewnessTest.java      |   63 +
 .../descriptive/moment/StandardDeviationTest.java  |   95 +
 .../stat/descriptive/moment/ThirdMomentTest.java   |   46 +
 .../stat/descriptive/moment/VarianceTest.java      |  117 +
 .../moment/VectorialCovarianceTest.java            |   91 +
 .../stat/descriptive/moment/VectorialMeanTest.java |   86 +
 .../legacy/stat/descriptive/rank/MaxTest.java      |   73 +
 .../legacy/stat/descriptive/rank/MedianTest.java   |  115 +
 .../legacy/stat/descriptive/rank/MinTest.java      |   73 +
 .../descriptive/rank/PSquarePercentileTest.java    |  763 +++
 .../stat/descriptive/rank/PercentileTest.java      | 1046 ++++
 .../stat/descriptive/summary/ProductTest.java      |   91 +
 .../stat/descriptive/summary/SumLogTest.java       |   84 +
 .../legacy/stat/descriptive/summary/SumSqTest.java |   69 +
 .../legacy/stat/descriptive/summary/SumTest.java   |   81 +
 .../legacy/stat/inference/BinomialTestTest.java    |  129 +
 .../legacy/stat/inference/ChiSquareTestTest.java   |  260 +
 .../math4/legacy/stat/inference/GTestTest.java     |  291 +
 .../stat/inference/InferenceTestUtilsTest.java     |  554 ++
 .../stat/inference/KolmogorovSmirnovTestTest.java  |  956 +++
 .../stat/inference/MannWhitneyUTestTest.java       |  127 +
 .../legacy/stat/inference/OneWayAnovaTest.java     |  154 +
 .../math4/legacy/stat/inference/TTestTest.java     |  297 +
 .../stat/inference/WilcoxonSignedRankTestTest.java |  183 +
 .../stat/interval/AgrestiCoullIntervalTest.java    |   40 +
 .../BinomialConfidenceIntervalAbstractTest.java    |   80 +
 .../stat/interval/ClopperPearsonIntervalTest.java  |  110 +
 .../legacy/stat/interval/IntervalUtilsTest.java    |   64 +
 .../interval/NormalApproximationIntervalTest.java  |   40 +
 .../stat/interval/WilsonScoreIntervalTest.java     |   45 +
 .../legacy/stat/ranking/NaturalRankingTest.java    |  271 +
 .../GLSMultipleLinearRegressionTest.java           |  300 +
 .../regression/MillerUpdatingRegressionTest.java   | 1110 ++++
 .../MultipleLinearRegressionAbstractTest.java      |  136 +
 .../OLSMultipleLinearRegressionTest.java           |  822 +++
 .../stat/regression/SimpleRegressionTest.java      |  693 +++
 .../transform/FastCosineTransformerTest.java       |  276 +
 .../transform/FastFourierTransformerTest.java      |  482 ++
 .../transform/FastHadamardTransformerTest.java     |  127 +
 .../legacy/transform/FastSineTransformerTest.java  |  300 +
 .../transform/RealTransformerAbstractTest.java     |  344 ++
 .../math4/legacy/util/BigRealFieldTest.java        |   43 +
 .../commons/math4/legacy/util/BigRealTest.java     |  189 +
 .../math4/legacy/util/CombinatoricsUtilsTest.java  |   95 +
 .../commons/math4/legacy/util/Decimal64Test.java   |  426 ++
 .../math4/legacy/util/DefaultTransformerTest.java  |  104 +
 .../math4/legacy/util/DoubleArrayAbstractTest.java |  132 +
 .../legacy/util/FastMathStrictComparisonTest.java  |  262 +
 .../commons/math4/legacy/util/FastMathTest.java    | 1965 +++++++
 .../math4/legacy/util/IntegerSequenceTest.java     |  327 ++
 .../commons/math4/legacy/util/KthSelectorTest.java |   56 +
 .../commons/math4/legacy/util/MathArraysTest.java  |  848 +++
 .../commons/math4/legacy/util/MathUtilsTest.java   |  348 ++
 .../legacy/util/OpenIntToDoubleHashMapTest.java    |  332 ++
 .../math4/legacy/util/OpenIntToFieldTest.java      |  335 ++
 .../apache/commons/math4/legacy/util/PairTest.java |  118 +
 .../legacy/util/ResizableDoubleArrayTest.java      |  581 ++
 .../apache/commons/math4/legacy/util/TestBean.java |   71 +
 .../math4/legacy/util/TransformerMapTest.java      |  122 +
 .../special/RealFunctionValidation/MANIFEST.txt    |    0
 .../special/RealFunctionValidation/README.txt      |    0
 .../RealFunctionValidation.java                    |  361 ++
 .../RealFunctionValidation.sh                      |    0
 .../src}/test/maxima/special/reference/gamma.mac   |    0
 .../test/maxima/special/reference/gamma.properties |    0
 .../src}/test/maxima/special/reference/logBeta.mac |    0
 .../maxima/special/reference/logBeta.properties    |    0
 .../test/maxima/special/reference/logGamma.mac     |    0
 .../maxima/special/reference/logGamma.properties   |    0
 .../distribution/gamma-distribution-shape-1.csv    |    0
 .../distribution/gamma-distribution-shape-10.csv   |    0
 .../distribution/gamma-distribution-shape-100.csv  |    0
 .../distribution/gamma-distribution-shape-1000.csv |    0
 .../distribution/gamma-distribution-shape-142.csv  |    0
 .../distribution/gamma-distribution-shape-8.csv    |    0
 .../legacy}/distribution/gamma-distribution.mac    |    0
 .../math4/legacy}/distribution/testData.txt        |    0
 .../math4/legacy/fitting/leastsquares}/Hahn1.dat   |    0
 .../math4/legacy/fitting/leastsquares}/Kirby2.dat  |    0
 .../legacy/fitting/leastsquares}/Lanczos1.dat      |    0
 .../math4/legacy/fitting/leastsquares}/MGH17.dat   |    0
 .../commons/math4/legacy}/linear/matrix1.csv       |    0
 .../commons/math4/legacy}/linear/matrix2.csv       |    0
 .../optim/nonlinear/vector/jacobian/Hahn1.dat      |    0
 .../optim/nonlinear/vector/jacobian/Kirby2.dat     |    0
 .../optim/nonlinear/vector/jacobian/Lanczos1.dat   |    0
 .../optim/nonlinear/vector/jacobian/MGH17.dat      |    0
 .../math4/legacy/optimization/general}/Hahn1.dat   |    0
 .../math4/legacy/optimization/general}/Kirby2.dat  |    0
 .../legacy/optimization/general}/Lanczos1.dat      |    0
 .../math4/legacy/optimization/general}/MGH17.dat   |    0
 .../commons/math4/legacy}/random/emptyFile.txt     |    0
 .../apache/commons/math4/legacy}/stat/data/Lew.txt |    0
 .../commons/math4/legacy}/stat/data/Lottery.txt    |    0
 .../commons/math4/legacy}/stat/data/Mavro.txt      |    0
 .../commons/math4/legacy}/stat/data/Michelso.txt   |    0
 .../commons/math4/legacy}/stat/data/NumAcc1.txt    |    0
 .../commons/math4/legacy}/stat/data/NumAcc2.txt    |    0
 .../commons/math4/legacy}/stat/data/NumAcc3.txt    |    0
 .../commons/math4/legacy}/stat/data/NumAcc4.txt    |    0
 .../commons/math4/legacy}/stat/data/PiDigits.txt   |    0
 dist-archive/pom.xml                               |  119 +
 dist-archive/src/assembly/bin.xml                  |   42 +
 dist-archive/src/assembly/src.xml                  |   35 +
 findbugs-exclude-filter.xml                        |  331 --
 math-RC.sh                                         |   76 -
 math-pre-RC.sh                                     |   30 -
 pmd-ruleset.xml                                    |   73 -
 pom.xml                                            |  785 ++-
 src/main/java/org/apache/commons/math4/Field.java  |   58 -
 .../org/apache/commons/math4/FieldElement.java     |   87 -
 .../org/apache/commons/math4/RealFieldElement.java |  402 --
 .../commons/math4/analysis/BivariateFunction.java  |   35 -
 .../commons/math4/analysis/FunctionUtils.java      |  544 --
 .../math4/analysis/MultivariateFunction.java       |   42 -
 .../math4/analysis/MultivariateMatrixFunction.java |   35 -
 .../math4/analysis/MultivariateVectorFunction.java |   35 -
 .../analysis/ParametricUnivariateFunction.java     |   44 -
 .../analysis/RealFieldUnivariateFunction.java      |   86 -
 .../commons/math4/analysis/TrivariateFunction.java |   35 -
 .../commons/math4/analysis/UnivariateFunction.java |   81 -
 .../math4/analysis/UnivariateMatrixFunction.java   |   33 -
 .../math4/analysis/UnivariateVectorFunction.java   |   33 -
 .../math4/analysis/differentiation/DSCompiler.java | 1834 ------
 .../differentiation/DerivativeStructure.java       | 1256 ----
 .../FiniteDifferencesDifferentiator.java           |  393 --
 .../analysis/differentiation/GradientFunction.java |   66 -
 .../analysis/differentiation/JacobianFunction.java |   70 -
 .../MultivariateDifferentiableFunction.java        |   42 -
 .../MultivariateDifferentiableVectorFunction.java  |   43 -
 .../analysis/differentiation/SparseGradient.java   |  937 ---
 .../UnivariateDifferentiableFunction.java          |   43 -
 .../UnivariateDifferentiableMatrixFunction.java    |   40 -
 .../UnivariateDifferentiableVectorFunction.java    |   40 -
 .../UnivariateFunctionDifferentiator.java          |   33 -
 .../UnivariateMatrixFunctionDifferentiator.java    |   33 -
 .../UnivariateVectorFunctionDifferentiator.java    |   33 -
 .../analysis/differentiation/package-info.java     |   42 -
 .../commons/math4/analysis/function/Abs.java       |   34 -
 .../commons/math4/analysis/function/Acos.java      |   44 -
 .../commons/math4/analysis/function/Acosh.java     |   44 -
 .../commons/math4/analysis/function/Add.java       |   33 -
 .../commons/math4/analysis/function/Asin.java      |   44 -
 .../commons/math4/analysis/function/Asinh.java     |   44 -
 .../commons/math4/analysis/function/Atan.java      |   44 -
 .../commons/math4/analysis/function/Atan2.java     |   34 -
 .../commons/math4/analysis/function/Atanh.java     |   44 -
 .../commons/math4/analysis/function/Cbrt.java      |   44 -
 .../commons/math4/analysis/function/Ceil.java      |   34 -
 .../commons/math4/analysis/function/Constant.java  |   53 -
 .../commons/math4/analysis/function/Cos.java       |   44 -
 .../commons/math4/analysis/function/Cosh.java      |   44 -
 .../commons/math4/analysis/function/Divide.java    |   33 -
 .../commons/math4/analysis/function/Exp.java       |   44 -
 .../commons/math4/analysis/function/Expm1.java     |   44 -
 .../commons/math4/analysis/function/Floor.java     |   34 -
 .../commons/math4/analysis/function/Gaussian.java  |  252 -
 .../analysis/function/HarmonicOscillator.java      |  176 -
 .../commons/math4/analysis/function/Identity.java  |   43 -
 .../commons/math4/analysis/function/Inverse.java   |   43 -
 .../commons/math4/analysis/function/Log.java       |   44 -
 .../commons/math4/analysis/function/Log10.java     |   45 -
 .../commons/math4/analysis/function/Log1p.java     |   44 -
 .../commons/math4/analysis/function/Logistic.java  |  221 -
 .../commons/math4/analysis/function/Logit.java     |  205 -
 .../commons/math4/analysis/function/Max.java       |   34 -
 .../commons/math4/analysis/function/Min.java       |   34 -
 .../commons/math4/analysis/function/Minus.java     |   43 -
 .../commons/math4/analysis/function/Multiply.java  |   33 -
 .../commons/math4/analysis/function/Pow.java       |   34 -
 .../commons/math4/analysis/function/Power.java     |   54 -
 .../commons/math4/analysis/function/Rint.java      |   34 -
 .../commons/math4/analysis/function/Sigmoid.java   |  211 -
 .../commons/math4/analysis/function/Signum.java    |   34 -
 .../commons/math4/analysis/function/Sin.java       |   44 -
 .../commons/math4/analysis/function/Sinc.java      |  196 -
 .../commons/math4/analysis/function/Sinh.java      |   44 -
 .../commons/math4/analysis/function/Sqrt.java      |   44 -
 .../math4/analysis/function/StepFunction.java      |  102 -
 .../commons/math4/analysis/function/Subtract.java  |   33 -
 .../commons/math4/analysis/function/Tan.java       |   44 -
 .../commons/math4/analysis/function/Tanh.java      |   44 -
 .../commons/math4/analysis/function/Ulp.java       |   34 -
 .../math4/analysis/function/package-info.java      |   26 -
 .../BaseAbstractUnivariateIntegrator.java          |  273 -
 .../IterativeLegendreGaussIntegrator.java          |  178 -
 .../analysis/integration/MidPointIntegrator.java   |  166 -
 .../analysis/integration/RombergIntegrator.java    |  134 -
 .../analysis/integration/SimpsonIntegrator.java    |  120 -
 .../analysis/integration/TrapezoidIntegrator.java  |  154 -
 .../analysis/integration/UnivariateIntegrator.java |   88 -
 .../integration/gauss/BaseRuleFactory.java         |  151 -
 .../integration/gauss/GaussIntegrator.java         |  126 -
 .../integration/gauss/GaussIntegratorFactory.java  |  181 -
 .../integration/gauss/HermiteRuleFactory.java      |  174 -
 .../integration/gauss/LaguerreRuleFactory.java     |   81 -
 .../gauss/LegendreHighPrecisionRuleFactory.java    |  212 -
 .../integration/gauss/LegendreRuleFactory.java     |  137 -
 .../gauss/SymmetricGaussIntegrator.java            |   99 -
 .../analysis/integration/gauss/package-info.java   |   22 -
 .../math4/analysis/integration/package-info.java   |   22 -
 .../interpolation/AkimaSplineInterpolator.java     |  248 -
 .../BicubicInterpolatingFunction.java              |  329 --
 .../interpolation/BicubicInterpolator.java         |  114 -
 .../interpolation/BivariateGridInterpolator.java   |   51 -
 .../DividedDifferenceInterpolator.java             |  122 -
 .../interpolation/FieldHermiteInterpolator.java    |  210 -
 .../interpolation/HermiteInterpolator.java         |  242 -
 .../interpolation/InterpolatingMicrosphere.java    |  387 --
 .../interpolation/InterpolatingMicrosphere2D.java  |   87 -
 .../analysis/interpolation/LinearInterpolator.java |   80 -
 .../analysis/interpolation/LoessInterpolator.java  |  474 --
 .../MicrosphereProjectionInterpolator.java         |  168 -
 .../interpolation/MultivariateInterpolator.java    |   51 -
 .../interpolation/NevilleInterpolator.java         |   61 -
 ...iecewiseBicubicSplineInterpolatingFunction.java |  212 -
 .../PiecewiseBicubicSplineInterpolator.java        |   62 -
 .../analysis/interpolation/SplineInterpolator.java |  137 -
 .../TricubicInterpolatingFunction.java             |  509 --
 .../interpolation/TricubicInterpolator.java        |  144 -
 .../interpolation/TrivariateGridInterpolator.java  |   54 -
 .../interpolation/UnivariateInterpolator.java      |   41 -
 .../UnivariatePeriodicInterpolator.java            |  126 -
 .../math4/analysis/interpolation/package-info.java |   22 -
 .../commons/math4/analysis/package-info.java       |   32 -
 .../analysis/polynomials/PolynomialFunction.java   |  406 --
 .../PolynomialFunctionLagrangeForm.java            |  327 --
 .../polynomials/PolynomialFunctionNewtonForm.java  |  247 -
 .../polynomials/PolynomialSplineFunction.java      |  237 -
 .../analysis/polynomials/PolynomialsUtils.java     |  454 --
 .../math4/analysis/polynomials/package-info.java   |   23 -
 .../analysis/solvers/AbstractPolynomialSolver.java |   80 -
 .../AbstractUnivariateDifferentiableSolver.java    |   82 -
 .../analysis/solvers/AbstractUnivariateSolver.java |   60 -
 .../math4/analysis/solvers/AllowedSolution.java    |   75 -
 .../solvers/BaseAbstractUnivariateSolver.java      |  315 -
 .../math4/analysis/solvers/BaseSecantSolver.java   |  280 -
 .../analysis/solvers/BaseUnivariateSolver.java     |  142 -
 .../math4/analysis/solvers/BisectionSolver.java    |   91 -
 .../BracketedRealFieldUnivariateSolver.java        |  142 -
 .../solvers/BracketedUnivariateSolver.java         |   92 -
 .../solvers/BracketingNthOrderBrentSolver.java     |  413 --
 .../math4/analysis/solvers/BrentSolver.java        |  109 -
 .../FieldBracketingNthOrderBrentSolver.java        |  453 --
 .../math4/analysis/solvers/IllinoisSolver.java     |   82 -
 .../math4/analysis/solvers/LaguerreSolver.java     |  384 --
 .../math4/analysis/solvers/MullerSolver.java       |  202 -
 .../math4/analysis/solvers/MullerSolver2.java      |  168 -
 .../analysis/solvers/NewtonRaphsonSolver.java      |   92 -
 .../math4/analysis/solvers/PegasusSolver.java      |   84 -
 .../math4/analysis/solvers/PolynomialSolver.java   |   28 -
 .../math4/analysis/solvers/RegulaFalsiSolver.java  |   94 -
 .../math4/analysis/solvers/RiddersSolver.java      |  142 -
 .../math4/analysis/solvers/SecantSolver.java       |  135 -
 .../solvers/UnivariateDifferentiableSolver.java    |   29 -
 .../math4/analysis/solvers/UnivariateSolver.java   |   28 -
 .../analysis/solvers/UnivariateSolverUtils.java    |  467 --
 .../math4/analysis/solvers/package-info.java       |   22 -
 .../commons/math4/complex/ComplexFormat.java       |  428 --
 .../apache/commons/math4/complex/package-info.java |   23 -
 .../java/org/apache/commons/math4/dfp/Dfp.java     | 2928 ----------
 .../java/org/apache/commons/math4/dfp/DfpDec.java  |  368 --
 .../org/apache/commons/math4/dfp/DfpField.java     |  762 ---
 .../java/org/apache/commons/math4/dfp/DfpMath.java |  965 ---
 .../org/apache/commons/math4/dfp/package-info.java |   88 -
 .../distribution/AbstractIntegerDistribution.java  |  228 -
 .../AbstractMultivariateRealDistribution.java      |   72 -
 .../distribution/AbstractRealDistribution.java     |  278 -
 .../math4/distribution/EmpiricalDistribution.java  |  753 ---
 .../math4/distribution/EnumeratedDistribution.java |  254 -
 .../EnumeratedIntegerDistribution.java             |  247 -
 .../distribution/EnumeratedRealDistribution.java   |  294 -
 .../MixtureMultivariateNormalDistribution.java     |   91 -
 .../MixtureMultivariateRealDistribution.java       |  166 -
 .../MultivariateNormalDistribution.java            |  225 -
 .../distribution/MultivariateRealDistribution.java |   77 -
 ...ariateNormalMixtureExpectationMaximization.java |  455 --
 .../math4/distribution/fitting/package-info.java   |   20 -
 .../commons/math4/distribution/package-info.java   |   21 -
 .../math4/exception/ConvergenceException.java      |   49 -
 .../exception/DimensionMismatchException.java      |   64 -
 .../math4/exception/InsufficientDataException.java |   49 -
 .../math4/exception/MathArithmeticException.java   |   52 -
 .../exception/MathIllegalArgumentException.java    |   41 -
 .../exception/MathIllegalNumberException.java      |   60 -
 .../math4/exception/MathIllegalStateException.java |   63 -
 .../commons/math4/exception/MathInternalError.java |   57 -
 .../math4/exception/MathParseException.java        |   51 -
 .../math4/exception/MathRuntimeException.java      |   80 -
 .../MathUnsupportedOperationException.java         |   49 -
 .../math4/exception/MaxCountExceededException.java |   63 -
 .../exception/MultiDimensionMismatchException.java |   90 -
 .../math4/exception/NoBracketingException.java     |  106 -
 .../commons/math4/exception/NoDataException.java   |   46 -
 .../exception/NonMonotonicSequenceException.java   |  120 -
 .../math4/exception/NotANumberException.java       |   37 -
 .../math4/exception/NotFiniteNumberException.java  |   54 -
 .../math4/exception/NotPositiveException.java      |   48 -
 .../exception/NotStrictlyPositiveException.java    |   49 -
 .../math4/exception/NullArgumentException.java     |   84 -
 .../math4/exception/NumberIsTooLargeException.java |   85 -
 .../math4/exception/NumberIsTooSmallException.java |   86 -
 .../math4/exception/OutOfRangeException.java       |   79 -
 .../exception/TooManyEvaluationsException.java     |   39 -
 .../exception/TooManyIterationsException.java      |   39 -
 .../commons/math4/exception/ZeroException.java     |   48 -
 .../commons/math4/exception/package-info.java      |   23 -
 .../commons/math4/exception/util/ArgUtils.java     |   54 -
 .../math4/exception/util/DummyLocalizable.java     |   59 -
 .../math4/exception/util/ExceptionContext.java     |  334 --
 .../exception/util/ExceptionContextProvider.java   |   33 -
 .../commons/math4/exception/util/Localizable.java  |   43 -
 .../math4/exception/util/LocalizedFormats.java     |  417 --
 .../commons/math4/exception/util/package-info.java |   22 -
 .../field/linalg/FieldDecompositionSolver.java     |   57 -
 .../math4/field/linalg/FieldDenseMatrix.java       |  354 --
 .../math4/field/linalg/FieldLUDecomposition.java   |  359 --
 .../commons/math4/field/linalg/package-info.java   |   21 -
 .../apache/commons/math4/field/package-info.java   |   22 -
 .../math4/filter/DefaultMeasurementModel.java      |   86 -
 .../commons/math4/filter/DefaultProcessModel.java  |  170 -
 .../apache/commons/math4/filter/KalmanFilter.java  |  388 --
 .../commons/math4/filter/MeasurementModel.java     |   44 -
 .../apache/commons/math4/filter/ProcessModel.java  |   73 -
 .../apache/commons/math4/filter/package-info.java  |   20 -
 .../commons/math4/fitting/AbstractCurveFitter.java |  139 -
 .../commons/math4/fitting/GaussianCurveFitter.java |  427 --
 .../commons/math4/fitting/HarmonicCurveFitter.java |  445 --
 .../math4/fitting/PolynomialCurveFitter.java       |  131 -
 .../commons/math4/fitting/SimpleCurveFitter.java   |  125 -
 .../math4/fitting/WeightedObservedPoint.java       |   78 -
 .../math4/fitting/WeightedObservedPoints.java      |  112 -
 .../fitting/leastsquares/AbstractEvaluation.java   |  101 -
 .../leastsquares/DenseWeightedEvaluation.java      |   71 -
 ...entiatorVectorMultivariateJacobianFunction.java |   95 -
 .../fitting/leastsquares/EvaluationRmsChecker.java |   76 -
 .../fitting/leastsquares/GaussNewtonOptimizer.java |  300 -
 .../fitting/leastsquares/LeastSquaresAdapter.java  |   84 -
 .../fitting/leastsquares/LeastSquaresBuilder.java  |  226 -
 .../fitting/leastsquares/LeastSquaresFactory.java  |  541 --
 .../leastsquares/LeastSquaresOptimizer.java        |   62 -
 .../fitting/leastsquares/LeastSquaresProblem.java  |  174 -
 .../leastsquares/LevenbergMarquardtOptimizer.java  | 1043 ----
 .../leastsquares/MultivariateJacobianFunction.java |   39 -
 .../math4/fitting/leastsquares/OptimumImpl.java    |  118 -
 .../fitting/leastsquares/ParameterValidator.java   |   34 -
 .../leastsquares/ValueAndJacobianFunction.java     |   44 -
 .../math4/fitting/leastsquares/package-info.java   |   39 -
 .../apache/commons/math4/fitting/package-info.java |   26 -
 .../math4/genetics/AbstractListChromosome.java     |  106 -
 .../commons/math4/genetics/BinaryChromosome.java   |   98 -
 .../commons/math4/genetics/BinaryMutation.java     |   57 -
 .../apache/commons/math4/genetics/Chromosome.java  |  105 -
 .../commons/math4/genetics/ChromosomePair.java     |   66 -
 .../commons/math4/genetics/CrossoverPolicy.java    |   38 -
 .../commons/math4/genetics/CycleCrossover.java     |  182 -
 .../math4/genetics/ElitisticListPopulation.java    |  118 -
 .../org/apache/commons/math4/genetics/Fitness.java |   32 -
 .../commons/math4/genetics/FixedElapsedTime.java   |   79 -
 .../math4/genetics/FixedGenerationCount.java       |   74 -
 .../commons/math4/genetics/GeneticAlgorithm.java   |  232 -
 .../genetics/InvalidRepresentationException.java   |   42 -
 .../commons/math4/genetics/ListPopulation.java     |  201 -
 .../commons/math4/genetics/MutationPolicy.java     |   35 -
 .../commons/math4/genetics/NPointCrossover.java    |  179 -
 .../commons/math4/genetics/OnePointCrossover.java  |  129 -
 .../commons/math4/genetics/OrderedCrossover.java   |  151 -
 .../math4/genetics/PermutationChromosome.java      |   40 -
 .../apache/commons/math4/genetics/Population.java  |   59 -
 .../apache/commons/math4/genetics/RandomKey.java   |  300 -
 .../commons/math4/genetics/RandomKeyMutation.java  |   55 -
 .../commons/math4/genetics/SelectionPolicy.java    |   34 -
 .../commons/math4/genetics/StoppingCondition.java  |   33 -
 .../math4/genetics/TournamentSelection.java        |  117 -
 .../commons/math4/genetics/UniformCrossover.java   |  135 -
 .../commons/math4/genetics/package-info.java       |   20 -
 .../commons/math4/linear/AbstractFieldMatrix.java  | 1114 ----
 .../commons/math4/linear/AbstractRealMatrix.java   | 1026 ----
 .../org/apache/commons/math4/linear/AnyMatrix.java |   97 -
 .../math4/linear/Array2DRowFieldMatrix.java        |  612 --
 .../commons/math4/linear/Array2DRowRealMatrix.java |  589 --
 .../commons/math4/linear/ArrayFieldVector.java     | 1123 ----
 .../commons/math4/linear/ArrayRealVector.java      |  953 ---
 .../math4/linear/BiDiagonalTransformer.java        |  380 --
 .../commons/math4/linear/BlockFieldMatrix.java     | 1588 -----
 .../commons/math4/linear/BlockRealMatrix.java      | 1580 -----
 .../math4/linear/CholeskyDecomposition.java        |  314 -
 .../commons/math4/linear/ConjugateGradient.java    |  234 -
 .../commons/math4/linear/DecompositionSolver.java  |   97 -
 .../linear/DefaultFieldMatrixChangingVisitor.java  |   61 -
 .../DefaultFieldMatrixPreservingVisitor.java       |   59 -
 .../linear/DefaultIterativeLinearSolverEvent.java  |  143 -
 .../linear/DefaultRealMatrixChangingVisitor.java   |   47 -
 .../linear/DefaultRealMatrixPreservingVisitor.java |   45 -
 .../commons/math4/linear/DiagonalMatrix.java       |  370 --
 .../commons/math4/linear/EigenDecomposition.java   |  942 ---
 .../math4/linear/FieldDecompositionSolver.java     |   75 -
 .../commons/math4/linear/FieldLUDecomposition.java |  448 --
 .../apache/commons/math4/linear/FieldMatrix.java   |  814 ---
 .../math4/linear/FieldMatrixChangingVisitor.java   |   57 -
 .../math4/linear/FieldMatrixPreservingVisitor.java |   56 -
 .../apache/commons/math4/linear/FieldVector.java   |  290 -
 .../math4/linear/FieldVectorChangingVisitor.java   |   56 -
 .../math4/linear/FieldVectorPreservingVisitor.java |   55 -
 .../math4/linear/HessenbergTransformer.java        |  232 -
 .../linear/IllConditionedOperatorException.java    |   42 -
 .../math4/linear/IterativeLinearSolver.java        |  173 -
 .../math4/linear/IterativeLinearSolverEvent.java   |  115 -
 .../commons/math4/linear/JacobiPreconditioner.java |  135 -
 .../commons/math4/linear/LUDecomposition.java      |  394 --
 .../linear/MatrixDimensionMismatchException.java   |   73 -
 .../apache/commons/math4/linear/MatrixUtils.java   | 1026 ----
 .../linear/NonPositiveDefiniteMatrixException.java |   73 -
 .../NonPositiveDefiniteOperatorException.java      |   43 -
 .../linear/NonSelfAdjointOperatorException.java    |   46 -
 .../math4/linear/NonSquareMatrixException.java     |   41 -
 .../math4/linear/NonSquareOperatorException.java   |   40 -
 .../math4/linear/NonSymmetricMatrixException.java  |   71 -
 .../commons/math4/linear/OpenMapRealMatrix.java    |  308 -
 .../commons/math4/linear/OpenMapRealVector.java    |  812 ---
 .../PreconditionedIterativeLinearSolver.java       |  214 -
 .../commons/math4/linear/QRDecomposition.java      |  507 --
 .../commons/math4/linear/RRQRDecomposition.java    |  247 -
 .../commons/math4/linear/RealLinearOperator.java   |  109 -
 .../apache/commons/math4/linear/RealMatrix.java    |  828 ---
 .../math4/linear/RealMatrixChangingVisitor.java    |   55 -
 .../commons/math4/linear/RealMatrixFormat.java     |  392 --
 .../math4/linear/RealMatrixPreservingVisitor.java  |   54 -
 .../apache/commons/math4/linear/RealVector.java    | 1629 ------
 .../math4/linear/RealVectorChangingVisitor.java    |   58 -
 .../commons/math4/linear/RealVectorFormat.java     |  288 -
 .../math4/linear/RealVectorPreservingVisitor.java  |   57 -
 .../linear/RectangularCholeskyDecomposition.java   |  195 -
 .../commons/math4/linear/SchurTransformer.java     |  453 --
 .../math4/linear/SingularMatrixException.java      |   37 -
 .../math4/linear/SingularOperatorException.java    |   38 -
 .../math4/linear/SingularValueDecomposition.java   |  744 ---
 .../commons/math4/linear/SparseFieldMatrix.java    |  187 -
 .../commons/math4/linear/SparseFieldVector.java    |  811 ---
 .../commons/math4/linear/SparseRealMatrix.java     |   34 -
 .../commons/math4/linear/SparseRealVector.java     |   31 -
 .../org/apache/commons/math4/linear/SymmLQ.java    | 1221 ----
 .../math4/linear/TriDiagonalTransformer.java       |  253 -
 .../apache/commons/math4/linear/package-info.java  |   20 -
 .../math4/ml/clustering/CentroidCluster.java       |   53 -
 .../commons/math4/ml/clustering/Cluster.java       |   84 -
 .../math4/ml/clustering/ClusterEvaluator.java      |   55 -
 .../math4/ml/clustering/ClusterRanking.java        |   39 -
 .../commons/math4/ml/clustering/Clusterable.java   |   32 -
 .../commons/math4/ml/clustering/Clusterer.java     |   80 -
 .../math4/ml/clustering/DBSCANClusterer.java       |  220 -
 .../commons/math4/ml/clustering/DoublePoint.java   |   87 -
 .../math4/ml/clustering/FuzzyKMeansClusterer.java  |  421 --
 .../ml/clustering/KMeansPlusPlusClusterer.java     |  543 --
 .../ml/clustering/MiniBatchKMeansClusterer.java    |  301 -
 .../clustering/MultiKMeansPlusPlusClusterer.java   |  105 -
 .../ml/clustering/evaluation/CalinskiHarabasz.java |  171 -
 .../evaluation/SumOfClusterVariances.java          |   88 -
 .../ml/clustering/evaluation/package-info.java     |   24 -
 .../commons/math4/ml/clustering/package-info.java  |   20 -
 .../math4/ml/distance/CanberraDistance.java        |   47 -
 .../math4/ml/distance/ChebyshevDistance.java       |   39 -
 .../commons/math4/ml/distance/DistanceMeasure.java |   41 -
 .../math4/ml/distance/EarthMoversDistance.java     |   49 -
 .../math4/ml/distance/EuclideanDistance.java       |   39 -
 .../math4/ml/distance/ManhattanDistance.java       |   39 -
 .../commons/math4/ml/distance/package-info.java    |   20 -
 .../math4/ml/neuralnet/FeatureInitializer.java     |   32 -
 .../ml/neuralnet/FeatureInitializerFactory.java    |  116 -
 .../commons/math4/ml/neuralnet/MapRanking.java     |  156 -
 .../commons/math4/ml/neuralnet/MapUtils.java       |   99 -
 .../apache/commons/math4/ml/neuralnet/Network.java |  489 --
 .../apache/commons/math4/ml/neuralnet/Neuron.java  |  272 -
 .../math4/ml/neuralnet/SquareNeighbourhood.java    |   38 -
 .../commons/math4/ml/neuralnet/UpdateAction.java   |   34 -
 .../math4/ml/neuralnet/oned/NeuronString.java      |  239 -
 .../math4/ml/neuralnet/oned/package-info.java      |   22 -
 .../commons/math4/ml/neuralnet/package-info.java   |   22 -
 .../ml/neuralnet/sofm/KohonenTrainingTask.java     |   61 -
 .../ml/neuralnet/sofm/KohonenUpdateAction.java     |  228 -
 .../ml/neuralnet/sofm/LearningFactorFunction.java  |   34 -
 .../sofm/LearningFactorFunctionFactory.java        |  119 -
 .../neuralnet/sofm/NeighbourhoodSizeFunction.java  |   37 -
 .../sofm/NeighbourhoodSizeFunctionFactory.java     |  109 -
 .../math4/ml/neuralnet/sofm/package-info.java      |   22 -
 .../sofm/util/ExponentialDecayFunction.java        |   83 -
 .../sofm/util/QuasiSigmoidDecayFunction.java       |   87 -
 .../math4/ml/neuralnet/sofm/util/package-info.java |   22 -
 .../ml/neuralnet/twod/NeuronSquareMesh2D.java      |  868 ---
 .../math4/ml/neuralnet/twod/package-info.java      |   22 -
 .../ml/neuralnet/twod/util/LocationFinder.java     |  105 -
 .../neuralnet/twod/util/MapDataVisualization.java  |   38 -
 .../ml/neuralnet/twod/util/MapVisualization.java   |   34 -
 .../neuralnet/twod/util/SmoothedDataHistogram.java |   98 -
 .../neuralnet/twod/util/UnifiedDistanceMatrix.java |  155 -
 .../math4/ml/neuralnet/twod/util/package-info.java |   22 -
 .../org/apache/commons/math4/ml/package-info.java  |   20 -
 .../commons/math4/ode/AbstractFieldIntegrator.java |  467 --
 .../commons/math4/ode/AbstractIntegrator.java      |  471 --
 .../commons/math4/ode/AbstractParameterizable.java |   76 -
 .../math4/ode/ContinuousOutputFieldModel.java      |  345 --
 .../commons/math4/ode/ContinuousOutputModel.java   |  445 --
 .../apache/commons/math4/ode/EquationsMapper.java  |   97 -
 .../commons/math4/ode/ExpandableStatefulODE.java   |  330 --
 .../commons/math4/ode/FieldEquationsMapper.java    |  203 -
 .../commons/math4/ode/FieldExpandableODE.java      |  147 -
 .../apache/commons/math4/ode/FieldODEState.java    |  139 -
 .../math4/ode/FieldODEStateAndDerivative.java      |   82 -
 .../commons/math4/ode/FieldSecondaryEquations.java |   75 -
 .../commons/math4/ode/FirstOrderConverter.java     |  116 -
 .../math4/ode/FirstOrderDifferentialEquations.java |   68 -
 .../ode/FirstOrderFieldDifferentialEquations.java  |   73 -
 .../math4/ode/FirstOrderFieldIntegrator.java       |  188 -
 .../commons/math4/ode/FirstOrderIntegrator.java    |   66 -
 .../apache/commons/math4/ode/JacobianMatrices.java |  496 --
 .../math4/ode/MainStateJacobianProvider.java       |   41 -
 .../math4/ode/MultistepFieldIntegrator.java        |  456 --
 .../commons/math4/ode/MultistepIntegrator.java     |  465 --
 .../apache/commons/math4/ode/ODEIntegrator.java    |  158 -
 .../commons/math4/ode/ParameterConfiguration.java  |   67 -
 .../math4/ode/ParameterJacobianProvider.java       |   48 -
 .../math4/ode/ParameterJacobianWrapper.java        |  102 -
 .../apache/commons/math4/ode/Parameterizable.java  |   42 -
 .../apache/commons/math4/ode/ParameterizedODE.java |   42 -
 .../commons/math4/ode/ParameterizedWrapper.java    |   88 -
 .../ode/SecondOrderDifferentialEquations.java      |   64 -
 .../commons/math4/ode/SecondOrderIntegrator.java   |   60 -
 .../commons/math4/ode/SecondaryEquations.java      |   61 -
 .../math4/ode/UnknownParameterException.java       |   52 -
 .../apache/commons/math4/ode/events/Action.java    |   56 -
 .../commons/math4/ode/events/EventFilter.java      |  208 -
 .../commons/math4/ode/events/EventHandler.java     |  219 -
 .../commons/math4/ode/events/EventState.java       |  432 --
 .../math4/ode/events/FieldEventHandler.java        |  180 -
 .../commons/math4/ode/events/FieldEventState.java  |  345 --
 .../commons/math4/ode/events/FilterType.java       |  400 --
 .../commons/math4/ode/events/Transformer.java      |  107 -
 .../commons/math4/ode/events/package-info.java     |   94 -
 .../nonstiff/AdamsBashforthFieldIntegrator.java    |  353 --
 .../ode/nonstiff/AdamsBashforthIntegrator.java     |  361 --
 .../math4/ode/nonstiff/AdamsFieldIntegrator.java   |  146 -
 .../ode/nonstiff/AdamsFieldStepInterpolator.java   |  189 -
 .../math4/ode/nonstiff/AdamsIntegrator.java        |  136 -
 .../ode/nonstiff/AdamsMoultonFieldIntegrator.java  |  418 --
 .../math4/ode/nonstiff/AdamsMoultonIntegrator.java |  423 --
 .../nonstiff/AdamsNordsieckFieldTransformer.java   |  359 --
 .../ode/nonstiff/AdamsNordsieckTransformer.java    |  364 --
 .../nonstiff/AdaptiveStepsizeFieldIntegrator.java  |  366 --
 .../ode/nonstiff/AdaptiveStepsizeIntegrator.java   |  375 --
 .../ClassicalRungeKuttaFieldIntegrator.java        |  113 -
 .../ClassicalRungeKuttaFieldStepInterpolator.java  |  135 -
 .../nonstiff/ClassicalRungeKuttaIntegrator.java    |   74 -
 .../ClassicalRungeKuttaStepInterpolator.java       |  135 -
 .../nonstiff/DormandPrince54FieldIntegrator.java   |  235 -
 .../DormandPrince54FieldStepInterpolator.java      |  249 -
 .../ode/nonstiff/DormandPrince54Integrator.java    |  161 -
 .../nonstiff/DormandPrince54StepInterpolator.java  |  225 -
 .../nonstiff/DormandPrince853FieldIntegrator.java  |  457 --
 .../DormandPrince853FieldStepInterpolator.java     |  302 -
 .../ode/nonstiff/DormandPrince853Integrator.java   |  286 -
 .../nonstiff/DormandPrince853StepInterpolator.java |  501 --
 .../EmbeddedRungeKuttaFieldIntegrator.java         |  385 --
 .../ode/nonstiff/EmbeddedRungeKuttaIntegrator.java |  379 --
 .../math4/ode/nonstiff/EulerFieldIntegrator.java   |   99 -
 .../ode/nonstiff/EulerFieldStepInterpolator.java   |  107 -
 .../math4/ode/nonstiff/EulerIntegrator.java        |   72 -
 .../math4/ode/nonstiff/EulerStepInterpolator.java  |  101 -
 .../ode/nonstiff/FieldButcherArrayProvider.java    |   46 -
 .../math4/ode/nonstiff/GillFieldIntegrator.java    |  124 -
 .../ode/nonstiff/GillFieldStepInterpolator.java    |  147 -
 .../commons/math4/ode/nonstiff/GillIntegrator.java |   74 -
 .../math4/ode/nonstiff/GillStepInterpolator.java   |  150 -
 .../ode/nonstiff/GraggBulirschStoerIntegrator.java |  948 ---
 .../GraggBulirschStoerStepInterpolator.java        |  406 --
 .../ode/nonstiff/HighamHall54FieldIntegrator.java  |  208 -
 .../HighamHall54FieldStepInterpolator.java         |  116 -
 .../math4/ode/nonstiff/HighamHall54Integrator.java |  135 -
 .../ode/nonstiff/HighamHall54StepInterpolator.java |  122 -
 .../math4/ode/nonstiff/LutherFieldIntegrator.java  |  149 -
 .../ode/nonstiff/LutherFieldStepInterpolator.java  |  224 -
 .../math4/ode/nonstiff/LutherIntegrator.java       |   89 -
 .../math4/ode/nonstiff/LutherStepInterpolator.java |  182 -
 .../ode/nonstiff/MidpointFieldIntegrator.java      |   98 -
 .../nonstiff/MidpointFieldStepInterpolator.java    |  117 -
 .../math4/ode/nonstiff/MidpointIntegrator.java     |   68 -
 .../ode/nonstiff/MidpointStepInterpolator.java     |  115 -
 .../ode/nonstiff/RungeKuttaFieldIntegrator.java    |  273 -
 .../nonstiff/RungeKuttaFieldStepInterpolator.java  |  147 -
 .../math4/ode/nonstiff/RungeKuttaIntegrator.java   |  268 -
 .../ode/nonstiff/RungeKuttaStepInterpolator.java   |  211 -
 .../ode/nonstiff/ThreeEighthesFieldIntegrator.java |  112 -
 .../ThreeEighthesFieldStepInterpolator.java        |  138 -
 .../ode/nonstiff/ThreeEighthesIntegrator.java      |   71 -
 .../nonstiff/ThreeEighthesStepInterpolator.java    |  145 -
 .../commons/math4/ode/nonstiff/package-info.java   |   25 -
 .../org/apache/commons/math4/ode/package-info.java |  161 -
 .../sampling/AbstractFieldStepInterpolator.java    |  175 -
 .../ode/sampling/AbstractStepInterpolator.java     |  617 --
 .../math4/ode/sampling/DummyStepHandler.java       |   91 -
 .../math4/ode/sampling/FieldFixedStepHandler.java  |   69 -
 .../math4/ode/sampling/FieldStepHandler.java       |   75 -
 .../math4/ode/sampling/FieldStepInterpolator.java  |   76 -
 .../math4/ode/sampling/FieldStepNormalizer.java    |  273 -
 .../math4/ode/sampling/FixedStepHandler.java       |   71 -
 .../ode/sampling/NordsieckStepInterpolator.java    |  293 -
 .../commons/math4/ode/sampling/StepHandler.java    |   75 -
 .../math4/ode/sampling/StepInterpolator.java       |  181 -
 .../commons/math4/ode/sampling/StepNormalizer.java |  300 -
 .../math4/ode/sampling/StepNormalizerBounds.java   |   84 -
 .../math4/ode/sampling/StepNormalizerMode.java     |   70 -
 .../commons/math4/ode/sampling/package-info.java   |   60 -
 .../math4/optim/AbstractConvergenceChecker.java    |   70 -
 .../math4/optim/AbstractOptimizationProblem.java   |  111 -
 .../optim/BaseMultiStartMultivariateOptimizer.java |  230 -
 .../math4/optim/BaseMultivariateOptimizer.java     |  155 -
 .../apache/commons/math4/optim/BaseOptimizer.java  |  277 -
 .../commons/math4/optim/ConvergenceChecker.java    |   55 -
 .../apache/commons/math4/optim/InitialGuess.java   |   46 -
 .../org/apache/commons/math4/optim/MaxEval.java    |   61 -
 .../org/apache/commons/math4/optim/MaxIter.java    |   61 -
 .../commons/math4/optim/OptimizationData.java      |   28 -
 .../commons/math4/optim/OptimizationProblem.java   |   53 -
 .../apache/commons/math4/optim/PointValuePair.java |  122 -
 .../commons/math4/optim/PointVectorValuePair.java  |  147 -
 .../apache/commons/math4/optim/SimpleBounds.java   |   79 -
 .../commons/math4/optim/SimplePointChecker.java    |  133 -
 .../commons/math4/optim/SimpleValueChecker.java    |  125 -
 .../math4/optim/SimpleVectorValueChecker.java      |  134 -
 .../math4/optim/linear/LinearConstraint.java       |  230 -
 .../math4/optim/linear/LinearConstraintSet.java    |   62 -
 .../optim/linear/LinearObjectiveFunction.java      |  151 -
 .../math4/optim/linear/LinearOptimizer.java        |  132 -
 .../optim/linear/NoFeasibleSolutionException.java  |   37 -
 .../math4/optim/linear/NonNegativeConstraint.java  |   47 -
 .../math4/optim/linear/PivotSelectionRule.java     |   38 -
 .../commons/math4/optim/linear/Relationship.java   |   65 -
 .../commons/math4/optim/linear/SimplexSolver.java  |  409 --
 .../commons/math4/optim/linear/SimplexTableau.java |  915 ---
 .../math4/optim/linear/SolutionCallback.java       |   62 -
 .../optim/linear/UnboundedSolutionException.java   |   37 -
 .../commons/math4/optim/linear/package-info.java   |   21 -
 .../math4/optim/nonlinear/scalar/GoalType.java     |   32 -
 .../scalar/GradientMultivariateOptimizer.java      |  102 -
 .../nonlinear/scalar/LeastSquaresConverter.java    |  187 -
 .../math4/optim/nonlinear/scalar/LineSearch.java   |  139 -
 .../scalar/MultiStartMultivariateOptimizer.java    |  113 -
 .../scalar/MultivariateFunctionMappingAdapter.java |  303 -
 .../scalar/MultivariateFunctionPenaltyAdapter.java |  187 -
 .../nonlinear/scalar/MultivariateOptimizer.java    |  117 -
 .../optim/nonlinear/scalar/ObjectiveFunction.java  |   46 -
 .../scalar/ObjectiveFunctionGradient.java          |   46 -
 .../NonLinearConjugateGradientOptimizer.java       |  337 --
 .../nonlinear/scalar/gradient/Preconditioner.java  |   44 -
 .../nonlinear/scalar/gradient/package-info.java    |   21 -
 .../nonlinear/scalar/noderiv/AbstractSimplex.java  |  345 --
 .../nonlinear/scalar/noderiv/BOBYQAOptimizer.java  | 2475 --------
 .../nonlinear/scalar/noderiv/CMAESOptimizer.java   | 1358 -----
 .../scalar/noderiv/MultiDirectionalSimplex.java    |  215 -
 .../scalar/noderiv/NelderMeadSimplex.java          |  280 -
 .../nonlinear/scalar/noderiv/PowellOptimizer.java  |  299 -
 .../nonlinear/scalar/noderiv/SimplexOptimizer.java |  231 -
 .../nonlinear/scalar/noderiv/package-info.java     |   21 -
 .../math4/optim/nonlinear/scalar/package-info.java |   21 -
 .../apache/commons/math4/optim/package-info.java   |   59 -
 .../math4/optim/univariate/BracketFinder.java      |  314 -
 .../math4/optim/univariate/BrentOptimizer.java     |  314 -
 .../univariate/MultiStartUnivariateOptimizer.java  |  230 -
 .../math4/optim/univariate/SearchInterval.java     |   95 -
 .../univariate/SimpleUnivariateValueChecker.java   |  127 -
 .../univariate/UnivariateObjectiveFunction.java    |   46 -
 .../optim/univariate/UnivariateOptimizer.java      |  151 -
 .../optim/univariate/UnivariatePointValuePair.java |   66 -
 .../math4/optim/univariate/package-info.java       |   21 -
 .../org/apache/commons/math4/package-info.java     |   20 -
 .../random/CorrelatedRandomVectorGenerator.java    |  185 -
 .../math4/random/GaussianRandomGenerator.java      |   51 -
 .../math4/random/HaltonSequenceGenerator.java      |  184 -
 .../math4/random/NormalizedRandomGenerator.java    |   37 -
 .../commons/math4/random/RandomGenerator.java      |  148 -
 .../apache/commons/math4/random/RandomUtils.java   |  403 --
 .../math4/random/RandomVectorGenerator.java        |   32 -
 .../apache/commons/math4/random/RngAdaptor.java    |  231 -
 .../math4/random/SobolSequenceGenerator.java       |  326 --
 .../math4/random/StableRandomGenerator.java        |  133 -
 .../math4/random/SynchronizedRandomGenerator.java  |  134 -
 .../random/UncorrelatedRandomVectorGenerator.java  |   92 -
 .../math4/random/UniformRandomGenerator.java       |   58 -
 .../apache/commons/math4/random/package-info.java  |   33 -
 .../org/apache/commons/math4/special/BesselJ.java  |  649 --
 .../apache/commons/math4/special/package-info.java |   20 -
 .../org/apache/commons/math4/stat/Frequency.java   |  390 --
 .../org/apache/commons/math4/stat/StatUtils.java   |  856 ---
 .../commons/math4/stat/correlation/Covariance.java |  290 -
 .../stat/correlation/KendallsCorrelation.java      |  273 -
 .../stat/correlation/PearsonsCorrelation.java      |  330 --
 .../stat/correlation/SpearmansCorrelation.java     |  203 -
 .../correlation/StorelessBivariateCovariance.java  |  138 -
 .../stat/correlation/StorelessCovariance.java      |  229 -
 .../math4/stat/correlation/package-info.java       |   22 -
 .../AbstractStorelessUnivariateStatistic.java      |  192 -
 .../descriptive/AbstractUnivariateStatistic.java   |  132 -
 .../descriptive/AggregateSummaryStatistics.java    |  429 --
 .../stat/descriptive/DescriptiveStatistics.java    |  802 ---
 .../descriptive/MultivariateSummaryStatistics.java |  646 --
 .../StatisticalMultivariateSummary.java            |  119 -
 .../math4/stat/descriptive/StatisticalSummary.java |   64 -
 .../stat/descriptive/StatisticalSummaryValues.java |  193 -
 .../descriptive/StorelessUnivariateStatistic.java  |   91 -
 .../math4/stat/descriptive/SummaryStatistics.java  |  772 ---
 .../SynchronizedDescriptiveStatistics.java         |  192 -
 .../SynchronizedMultivariateSummaryStatistics.java |  297 -
 .../descriptive/SynchronizedSummaryStatistics.java |  366 --
 .../stat/descriptive/UnivariateStatistic.java      |   56 -
 .../math4/stat/descriptive/WeightedEvaluation.java |   57 -
 .../math4/stat/descriptive/moment/FirstMoment.java |  166 -
 .../stat/descriptive/moment/FourthMoment.java      |  150 -
 .../stat/descriptive/moment/GeometricMean.java     |  209 -
 .../math4/stat/descriptive/moment/Kurtosis.java    |  226 -
 .../math4/stat/descriptive/moment/Mean.java        |  288 -
 .../stat/descriptive/moment/SecondMoment.java      |  132 -
 .../stat/descriptive/moment/SemiVariance.java      |  363 --
 .../math4/stat/descriptive/moment/Skewness.java    |  227 -
 .../stat/descriptive/moment/StandardDeviation.java |  277 -
 .../math4/stat/descriptive/moment/ThirdMoment.java |  148 -
 .../math4/stat/descriptive/moment/Variance.java    |  627 --
 .../descriptive/moment/VectorialCovariance.java    |  157 -
 .../stat/descriptive/moment/VectorialMean.java     |  105 -
 .../stat/descriptive/moment/package-info.java      |   20 -
 .../math4/stat/descriptive/package-info.java       |   44 -
 .../commons/math4/stat/descriptive/rank/Max.java   |  170 -
 .../math4/stat/descriptive/rank/Median.java        |   96 -
 .../commons/math4/stat/descriptive/rank/Min.java   |  170 -
 .../stat/descriptive/rank/PSquarePercentile.java   |  990 ----
 .../math4/stat/descriptive/rank/Percentile.java    | 1382 -----
 .../math4/stat/descriptive/rank/package-info.java  |   20 -
 .../math4/stat/descriptive/summary/Product.java    |  231 -
 .../math4/stat/descriptive/summary/Sum.java        |  225 -
 .../math4/stat/descriptive/summary/SumOfLogs.java  |  171 -
 .../stat/descriptive/summary/SumOfSquares.java     |  160 -
 .../stat/descriptive/summary/package-info.java     |   20 -
 .../stat/inference/AlternativeHypothesis.java      |   40 -
 .../commons/math4/stat/inference/BinomialTest.java |  163 -
 .../math4/stat/inference/ChiSquareTest.java        |  602 --
 .../apache/commons/math4/stat/inference/GTest.java |  538 --
 .../math4/stat/inference/InferenceTestUtils.java   |  745 ---
 .../stat/inference/KolmogorovSmirnovTest.java      | 1228 ----
 .../math4/stat/inference/MannWhitneyUTest.java     |  236 -
 .../commons/math4/stat/inference/OneWayAnova.java  |  355 --
 .../apache/commons/math4/stat/inference/TTest.java | 1183 ----
 .../stat/inference/WilcoxonSignedRankTest.java     |  323 -
 .../commons/math4/stat/inference/package-info.java |   22 -
 .../math4/stat/interval/AgrestiCoullInterval.java  |   49 -
 .../stat/interval/BinomialConfidenceInterval.java  |   61 -
 .../stat/interval/ClopperPearsonInterval.java      |   60 -
 .../math4/stat/interval/ConfidenceInterval.java    |  108 -
 .../commons/math4/stat/interval/IntervalUtils.java |  173 -
 .../stat/interval/NormalApproximationInterval.java |   45 -
 .../math4/stat/interval/WilsonScoreInterval.java   |   51 -
 .../commons/math4/stat/interval/package-info.java  |   22 -
 .../apache/commons/math4/stat/package-info.java    |   20 -
 .../commons/math4/stat/ranking/NaNStrategy.java    |   55 -
 .../commons/math4/stat/ranking/NaturalRanking.java |  478 --
 .../math4/stat/ranking/RankingAlgorithm.java       |   40 -
 .../commons/math4/stat/ranking/TiesStrategy.java   |   54 -
 .../commons/math4/stat/ranking/package-info.java   |   22 -
 .../AbstractMultipleLinearRegression.java          |  386 --
 .../regression/GLSMultipleLinearRegression.java    |  135 -
 .../stat/regression/MillerUpdatingRegression.java  | 1108 ----
 .../regression/ModelSpecificationException.java    |   39 -
 .../stat/regression/MultipleLinearRegression.java  |   69 -
 .../regression/OLSMultipleLinearRegression.java    |  285 -
 .../math4/stat/regression/RegressionResults.java   |  421 --
 .../math4/stat/regression/SimpleRegression.java    |  889 ---
 .../UpdatingMultipleLinearRegression.java          |   93 -
 .../math4/stat/regression/package-info.java        |   22 -
 .../commons/math4/transform/DctNormalization.java  |   66 -
 .../commons/math4/transform/DftNormalization.java  |   56 -
 .../commons/math4/transform/DstNormalization.java  |   56 -
 .../math4/transform/FastCosineTransformer.java     |  183 -
 .../math4/transform/FastFourierTransformer.java    |  416 --
 .../math4/transform/FastHadamardTransformer.java   |  325 --
 .../math4/transform/FastSineTransformer.java       |  182 -
 .../commons/math4/transform/RealTransformer.java   |   67 -
 .../commons/math4/transform/TransformType.java     |   30 -
 .../commons/math4/transform/TransformUtils.java    |  163 -
 .../commons/math4/transform/package-info.java      |   22 -
 .../org/apache/commons/math4/util/BigReal.java     |  334 --
 .../apache/commons/math4/util/BigRealField.java    |   86 -
 .../math4/util/CentralPivotingStrategy.java        |   47 -
 .../commons/math4/util/CombinatoricsUtils.java     |  125 -
 .../apache/commons/math4/util/CompositeFormat.java |  218 -
 .../org/apache/commons/math4/util/Decimal64.java   |  754 ---
 .../apache/commons/math4/util/Decimal64Field.java  |   64 -
 .../commons/math4/util/DefaultTransformer.java     |   81 -
 .../org/apache/commons/math4/util/DoubleArray.java |  110 -
 .../org/apache/commons/math4/util/FastMath.java    | 4351 --------------
 .../apache/commons/math4/util/FastMathCalc.java    |  658 ---
 .../commons/math4/util/FastMathLiteralArrays.java  | 6175 --------------------
 .../apache/commons/math4/util/IntegerSequence.java |  376 --
 .../apache/commons/math4/util/IterationEvent.java  |   55 -
 .../commons/math4/util/IterationListener.java      |   57 -
 .../commons/math4/util/IterationManager.java       |  185 -
 .../org/apache/commons/math4/util/KthSelector.java |  157 -
 .../org/apache/commons/math4/util/MathArrays.java  | 1284 ----
 .../org/apache/commons/math4/util/MathUtils.java   |  284 -
 .../math4/util/MedianOf3PivotingStrategy.java      |   64 -
 .../commons/math4/util/NumberTransformer.java      |   38 -
 .../commons/math4/util/OpenIntToDoubleHashMap.java |  596 --
 .../commons/math4/util/OpenIntToFieldHashMap.java  |  617 --
 .../java/org/apache/commons/math4/util/Pair.java   |  156 -
 .../math4/util/PivotingStrategyInterface.java      |   44 -
 .../commons/math4/util/RandomPivotingStrategy.java |  101 -
 .../commons/math4/util/ResizableDoubleArray.java   |  849 ---
 .../apache/commons/math4/util/TransformerMap.java  |  190 -
 .../apache/commons/math4/util/package-info.java    |   20 -
 .../exception/util/LocalizedFormats_fr.properties  |  343 --
 .../checkstyle/checkstyle-suppressions.xml         |   26 +
 src/main/resources/checkstyle/checkstyle.xml       |  294 +-
 .../main/resources/clirr/clirr-ignored.xml         |    0
 src/main/resources/pmd/pmd-ruleset.xml             |  161 +
 .../resources/spotbugs/spotbugs-exclude-filter.xml |   51 +
 .../math4/ExtendedFieldElementAbstractTest.java    |  540 --
 .../org/apache/commons/math4/PerfTestUtils.java    |  384 --
 src/test/java/org/apache/commons/math4/Retry.java  |   29 -
 .../java/org/apache/commons/math4/RetryRunner.java |   81 -
 .../org/apache/commons/math4/RetryRunnerTest.java  |   54 -
 .../java/org/apache/commons/math4/TestUtils.java   |  586 --
 .../commons/math4/analysis/FunctionUtilsTest.java  |  431 --
 .../commons/math4/analysis/MonitoredFunction.java  |   48 -
 .../commons/math4/analysis/QuinticFunction.java    |   41 -
 .../commons/math4/analysis/SumSincFunction.java    |   55 -
 .../commons/math4/analysis/XMinus5Function.java    |   41 -
 .../analysis/differentiation/DSCompilerTest.java   |  477 --
 .../differentiation/DerivativeStructureTest.java   | 1632 ------
 .../FiniteDifferencesDifferentiatorTest.java       |  413 --
 .../differentiation/GradientFunctionTest.java      |   90 -
 .../differentiation/JacobianFunctionTest.java      |   97 -
 .../differentiation/SparseGradientTest.java        | 1131 ----
 .../analysis/function/BivariateFunctionTest.java   |   44 -
 .../math4/analysis/function/GaussianTest.java      |  161 -
 .../analysis/function/HarmonicOscillatorTest.java  |  139 -
 .../math4/analysis/function/LogisticTest.java      |  199 -
 .../commons/math4/analysis/function/LogitTest.java |  227 -
 .../math4/analysis/function/SigmoidTest.java       |  110 -
 .../commons/math4/analysis/function/SincTest.java  |  122 -
 .../commons/math4/analysis/function/SqrtTest.java  |   72 -
 .../math4/analysis/function/StepFunctionTest.java  |  115 -
 .../UnivariateDifferentiableFunctionTest.java      |  227 -
 .../analysis/function/UnivariateFunctionTest.java  |  124 -
 .../IterativeLegendreGaussIntegratorTest.java      |  171 -
 .../integration/MidPointIntegratorTest.java        |  175 -
 .../integration/RombergIntegratorTest.java         |  123 -
 .../integration/SimpsonIntegratorTest.java         |  385 --
 .../integration/TrapezoidIntegratorTest.java       |  123 -
 .../integration/gauss/BaseRuleFactoryTest.java     |  113 -
 .../integration/gauss/GaussIntegratorTest.java     |   74 -
 .../gauss/GaussianQuadratureAbstractTest.java      |  116 -
 .../integration/gauss/HermiteParametricTest.java   |   96 -
 .../analysis/integration/gauss/HermiteTest.java    |  112 -
 .../analysis/integration/gauss/LaguerreTest.java   |   50 -
 .../gauss/LegendreHighPrecisionParametricTest.java |   85 -
 .../gauss/LegendreHighPrecisionTest.java           |   58 -
 .../integration/gauss/LegendreParametricTest.java  |   85 -
 .../analysis/integration/gauss/LegendreTest.java   |   58 -
 .../interpolation/AkimaSplineInterpolatorTest.java |  267 -
 .../BicubicInterpolatingFunctionTest.java          |  391 --
 .../interpolation/BicubicInterpolatorTest.java     |  178 -
 .../DividedDifferenceInterpolatorTest.java         |  146 -
 .../FieldHermiteInterpolatorTest.java              |  276 -
 .../interpolation/HermiteInterpolatorTest.java     |  257 -
 .../interpolation/LinearInterpolatorTest.java      |  147 -
 .../interpolation/LoessInterpolatorTest.java       |  259 -
 .../MicrosphereProjectionInterpolatorTest.java     |  149 -
 .../interpolation/NevilleInterpolatorTest.java     |  146 -
 ...wiseBicubicSplineInterpolatingFunctionTest.java |  271 -
 .../PiecewiseBicubicSplineInterpolatorTest.java    |  229 -
 .../interpolation/SplineInterpolatorTest.java      |  223 -
 .../TricubicInterpolatingFunctionTest.java         |  653 ---
 .../interpolation/TricubicInterpolatorTest.java    |  227 -
 .../UnivariatePeriodicInterpolatorTest.java        |  163 -
 .../PolynomialFunctionLagrangeFormTest.java        |  153 -
 .../PolynomialFunctionNewtonFormTest.java          |  178 -
 .../polynomials/PolynomialFunctionTest.java        |  263 -
 .../polynomials/PolynomialSplineFunctionTest.java  |  187 -
 .../analysis/polynomials/PolynomialsUtilsTest.java |  394 --
 .../solvers/BaseSecantSolverAbstractTest.java      |  259 -
 .../analysis/solvers/BisectionSolverTest.java      |   90 -
 .../solvers/BracketingNthOrderBrentSolverTest.java |  214 -
 .../math4/analysis/solvers/BrentSolverTest.java    |  268 -
 .../FieldBracketingNthOrderBrentSolverTest.java    |  180 -
 .../math4/analysis/solvers/IllinoisSolverTest.java |   36 -
 .../math4/analysis/solvers/LaguerreSolverTest.java |  159 -
 .../math4/analysis/solvers/MullerSolver2Test.java  |  145 -
 .../math4/analysis/solvers/MullerSolverTest.java   |  148 -
 .../analysis/solvers/NewtonRaphsonSolverTest.java  |   90 -
 .../math4/analysis/solvers/PegasusSolverTest.java  |   36 -
 .../analysis/solvers/RegulaFalsiSolverTest.java    |   60 -
 .../math4/analysis/solvers/RiddersSolverTest.java  |  141 -
 .../math4/analysis/solvers/SecantSolverTest.java   |   39 -
 .../solvers/UnivariateSolverUtilsTest.java         |  217 -
 .../math4/complex/ComplexFormatAbstractTest.java   |  416 --
 .../commons/math4/complex/ComplexFormatTest.java   |   33 -
 .../math4/complex/FrenchComplexFormatTest.java     |   34 -
 .../org/apache/commons/math4/dfp/Decimal10.java    |   99 -
 .../org/apache/commons/math4/dfp/DfpDecTest.java   |  566 --
 .../org/apache/commons/math4/dfp/DfpMathTest.java  |  588 --
 .../java/org/apache/commons/math4/dfp/DfpTest.java | 1674 ------
 .../AbstractIntegerDistributionTest.java           |  130 -
 .../distribution/AbstractRealDistributionTest.java |  211 -
 .../distribution/EmpiricalDistributionTest.java    |  689 ---
 .../EnumeratedIntegerDistributionTest.java         |  198 -
 .../EnumeratedRealDistributionTest.java            |  254 -
 .../IntegerDistributionAbstractTest.java           |  426 --
 .../MixtureMultivariateNormalDistributionTest.java |  265 -
 .../MultivariateNormalDistributionTest.java        |  156 -
 .../distribution/RealDistributionAbstractTest.java |  515 --
 ...teNormalMixtureExpectationMaximizationTest.java |  349 --
 .../exception/DimensionMismatchExceptionTest.java  |   33 -
 .../exception/MaxCountExceededExceptionTest.java   |   32 -
 .../NonMonotonicSequenceExceptionTest.java         |   45 -
 .../math4/exception/NotPositiveExceptionTest.java  |   34 -
 .../NotStrictlyPositiveExceptionTest.java          |   34 -
 .../exception/NumberIsTooLargeExceptionTest.java   |   34 -
 .../exception/NumberIsTooSmallExceptionTest.java   |   34 -
 .../math4/exception/OutOfRangeExceptionTest.java   |   34 -
 .../exception/TooManyEvaluationsExceptionTest.java |   39 -
 .../commons/math4/exception/util/ArgUtilsTest.java |   75 -
 .../math4/exception/util/ExceptionContextTest.java |  130 -
 .../math4/exception/util/LocalizedFormatsTest.java |  104 -
 .../field/linalg/FP64FieldDenseMatrixTest.java     |  285 -
 .../field/linalg/FieldLUDecompositionTest.java     |  314 -
 .../commons/math4/filter/KalmanFilterTest.java     |  442 --
 .../math4/fitting/GaussianCurveFitterTest.java     |  424 --
 .../math4/fitting/HarmonicCurveFitterTest.java     |  182 -
 .../math4/fitting/PolynomialCurveFitterTest.java   |  167 -
 .../math4/fitting/SimpleCurveFitterTest.java       |   59 -
 .../math4/fitting/WeightedObservedPointsTest.java  |  126 -
 .../AbstractLeastSquaresOptimizerAbstractTest.java |  607 --
 .../fitting/leastsquares/BevingtonProblem.java     |   79 -
 .../math4/fitting/leastsquares/CircleProblem.java  |  178 -
 .../fitting/leastsquares/CircleVectorial.java      |   97 -
 ...atorVectorMultivariateJacobianFunctionTest.java |  154 -
 .../leastsquares/EvaluationRmsCheckerTest.java     |  103 -
 .../math4/fitting/leastsquares/EvaluationTest.java |  335 --
 .../leastsquares/EvaluationTestValidation.java     |  304 -
 .../GaussNewtonOptimizerWithCholeskyTest.java      |  133 -
 .../GaussNewtonOptimizerWithLUTest.java            |  133 -
 .../GaussNewtonOptimizerWithQRTest.java            |  119 -
 .../GaussNewtonOptimizerWithSVDTest.java           |  151 -
 .../LevenbergMarquardtOptimizerTest.java           |  350 --
 .../math4/fitting/leastsquares/MinpackTest.java    | 1484 -----
 .../leastsquares/RandomCirclePointGenerator.java   |   88 -
 .../RandomStraightLinePointGenerator.java          |   97 -
 .../leastsquares/StatisticalReferenceDataset.java  |  373 --
 .../StatisticalReferenceDatasetFactory.java        |  202 -
 .../fitting/leastsquares/StraightLineProblem.java  |  169 -
 .../math4/genetics/BinaryChromosomeTest.java       |   66 -
 .../commons/math4/genetics/BinaryMutationTest.java |   45 -
 .../commons/math4/genetics/ChromosomeTest.java     |  120 -
 .../commons/math4/genetics/CycleCrossoverTest.java |  151 -
 .../math4/genetics/DummyBinaryChromosome.java      |   45 -
 .../math4/genetics/DummyListChromosome.java        |   79 -
 .../commons/math4/genetics/DummyRandomKey.java     |   45 -
 .../genetics/ElitisticListPopulationTest.java      |  106 -
 .../commons/math4/genetics/FitnessCachingTest.java |   95 -
 .../math4/genetics/FixedElapsedTimeTest.java       |   80 -
 .../math4/genetics/FixedGenerationCountTest.java   |   70 -
 .../math4/genetics/GeneticAlgorithmTestBinary.java |  125 -
 .../genetics/GeneticAlgorithmTestPermutations.java |  133 -
 .../commons/math4/genetics/ListPopulationTest.java |  220 -
 .../math4/genetics/NPointCrossoverTest.java        |  131 -
 .../math4/genetics/OnePointCrossoverTest.java      |   61 -
 .../math4/genetics/OrderedCrossoverTest.java       |  104 -
 .../math4/genetics/RandomKeyMutationTest.java      |   44 -
 .../commons/math4/genetics/RandomKeyTest.java      |  173 -
 .../math4/genetics/TournamentSelectionTest.java    |   57 -
 .../math4/genetics/UniformCrossoverTest.java       |  153 -
 .../math4/linear/Array2DRowRealMatrixTest.java     | 1171 ----
 .../commons/math4/linear/ArrayFieldVectorTest.java | 1265 ----
 .../commons/math4/linear/ArrayRealVectorTest.java  |  172 -
 .../math4/linear/BiDiagonalTransformerTest.java    |  201 -
 .../commons/math4/linear/BlockFieldMatrixTest.java | 1391 -----
 .../commons/math4/linear/BlockRealMatrixTest.java  | 1280 ----
 .../math4/linear/CholeskyDecompositionTest.java    |  138 -
 .../commons/math4/linear/CholeskySolverTest.java   |  112 -
 .../math4/linear/ConjugateGradientTest.java        |  622 --
 .../org/apache/commons/math4/linear/Dfp25.java     |   41 -
 .../commons/math4/linear/DiagonalMatrixTest.java   |  368 --
 .../math4/linear/EigenDecompositionTest.java       |  785 ---
 .../commons/math4/linear/EigenSolverTest.java      |  199 -
 .../math4/linear/FieldLUDecompositionTest.java     |  301 -
 .../commons/math4/linear/FieldLUSolverTest.java    |  176 -
 .../commons/math4/linear/FieldMatrixImplTest.java  | 1158 ----
 .../math4/linear/FrenchRealVectorFormatTest.java   |   34 -
 .../math4/linear/HessenbergTransformerTest.java    |  225 -
 .../apache/commons/math4/linear/HilbertMatrix.java |   75 -
 .../commons/math4/linear/InverseHilbertMatrix.java |  100 -
 .../commons/math4/linear/LUDecompositionTest.java  |  291 -
 .../apache/commons/math4/linear/LUSolverTest.java  |  168 -
 .../MatrixDimensionMismatchExceptionTest.java      |   36 -
 .../commons/math4/linear/MatrixUtilsTest.java      |  488 --
 .../math4/linear/OpenMapRealMatrixTest.java        |   49 -
 .../commons/math4/linear/QRDecompositionTest.java  |  285 -
 .../apache/commons/math4/linear/QRSolverTest.java  |  195 -
 .../math4/linear/RRQRDecompositionTest.java        |  257 -
 .../commons/math4/linear/RRQRSolverTest.java       |  201 -
 .../math4/linear/RealMatrixFormatAbstractTest.java |  362 --
 .../commons/math4/linear/RealMatrixFormatTest.java |   34 -
 .../math4/linear/RealVectorAbstractTest.java       | 2008 -------
 .../math4/linear/RealVectorFormatAbstractTest.java |  354 --
 .../commons/math4/linear/RealVectorFormatTest.java |   34 -
 .../commons/math4/linear/RealVectorTest.java       |  233 -
 .../RectangularCholeskyDecompositionTest.java      |  114 -
 .../commons/math4/linear/SchurTransformerTest.java |  206 -
 .../linear/SingularValueDecompositionTest.java     |  331 --
 .../math4/linear/SingularValueSolverTest.java      |  158 -
 .../math4/linear/SparseFieldMatrixTest.java        |  700 ---
 .../math4/linear/SparseFieldVectorTest.java        |  816 ---
 .../commons/math4/linear/SparseRealMatrixTest.java |  697 ---
 .../commons/math4/linear/SparseRealVectorTest.java |  150 -
 .../apache/commons/math4/linear/SymmLQTest.java    |  700 ---
 .../math4/linear/TriDiagonalTransformerTest.java   |  177 -
 .../linear/UnmodifiableArrayRealVectorTest.java    |   39 -
 .../linear/UnmodifiableOpenMapRealVectorTest.java  |   45 -
 .../linear/UnmodifiableRealVectorAbstractTest.java |  455 --
 .../math4/ml/clustering/DBSCANClustererTest.java   |  190 -
 .../ml/clustering/FuzzyKMeansClustererTest.java    |  135 -
 .../ml/clustering/KMeansPlusPlusClustererTest.java |  188 -
 .../clustering/MiniBatchKMeansClustererTest.java   |  181 -
 .../MultiKMeansPlusPlusClustererTest.java          |   98 -
 .../evaluation/CalinskiHarabaszTest.java           |  165 -
 .../evaluation/SumOfClusterVariancesTest.java      |   81 -
 .../math4/ml/distance/CanberraDistanceTest.java    |   48 -
 .../math4/ml/distance/ChebyshevDistanceTest.java   |   42 -
 .../math4/ml/distance/EarthMoversDistanceTest.java |   48 -
 .../math4/ml/distance/EuclideanDistanceTest.java   |   43 -
 .../math4/ml/distance/ManhattanDistanceTest.java   |   42 -
 .../commons/math4/ml/neuralnet/MapRankingTest.java |  119 -
 .../commons/math4/ml/neuralnet/NetworkTest.java    |  209 -
 .../commons/math4/ml/neuralnet/NeuronTest.java     |  139 -
 .../ml/neuralnet/OffsetFeatureInitializer.java     |   48 -
 .../math4/ml/neuralnet/oned/NeuronStringTest.java  |  184 -
 .../ml/neuralnet/sofm/KohonenTrainingTaskTest.java |  221 -
 .../ml/neuralnet/sofm/KohonenUpdateActionTest.java |   93 -
 .../sofm/LearningFactorFunctionFactoryTest.java    |   94 -
 .../sofm/NeighbourhoodSizeFunctionFactoryTest.java |   83 -
 .../neuralnet/sofm/TravellingSalesmanSolver.java   |  427 --
 .../sofm/util/ExponentialDecayFunctionTest.java    |   57 -
 .../sofm/util/QuasiSigmoidDecayFunctionTest.java   |   54 -
 .../ml/neuralnet/twod/NeuronSquareMesh2DTest.java  |  914 ---
 .../ml/neuralnet/twod/util/LocationFinderTest.java |   69 -
 .../math4/ode/ContinuousOutputFieldModelTest.java  |  229 -
 .../math4/ode/ContinuousOutputModelTest.java       |  206 -
 .../commons/math4/ode/FieldExpandableODETest.java  |  345 --
 .../commons/math4/ode/FirstOrderConverterTest.java |  114 -
 .../commons/math4/ode/JacobianMatricesTest.java    |  619 --
 .../commons/math4/ode/TestFieldProblem1.java       |   79 -
 .../commons/math4/ode/TestFieldProblem2.java       |   78 -
 .../commons/math4/ode/TestFieldProblem3.java       |  124 -
 .../commons/math4/ode/TestFieldProblem4.java       |  168 -
 .../commons/math4/ode/TestFieldProblem5.java       |   41 -
 .../commons/math4/ode/TestFieldProblem6.java       |   84 -
 .../math4/ode/TestFieldProblemAbstract.java        |  204 -
 .../commons/math4/ode/TestFieldProblemHandler.java |  156 -
 .../org/apache/commons/math4/ode/TestProblem1.java |   74 -
 .../org/apache/commons/math4/ode/TestProblem2.java |   76 -
 .../org/apache/commons/math4/ode/TestProblem3.java |  113 -
 .../org/apache/commons/math4/ode/TestProblem4.java |  151 -
 .../org/apache/commons/math4/ode/TestProblem5.java |   34 -
 .../org/apache/commons/math4/ode/TestProblem6.java |   75 -
 .../commons/math4/ode/TestProblemAbstract.java     |  162 -
 .../commons/math4/ode/TestProblemHandler.java      |  161 -
 .../commons/math4/ode/events/CloseEventsTest.java  |  133 -
 .../commons/math4/ode/events/EventFilterTest.java  |  275 -
 .../commons/math4/ode/events/EventStateTest.java   |  297 -
 .../math4/ode/events/OverlappingEventsTest.java    |  174 -
 .../math4/ode/events/ReappearingEventTest.java     |  101 -
 ...tractEmbeddedRungeKuttaFieldIntegratorTest.java |  616 --
 .../AbstractRungeKuttaFieldIntegratorTest.java     |  682 ---
 .../AdamsBashforthFieldIntegratorTest.java         |   86 -
 .../ode/nonstiff/AdamsBashforthIntegratorTest.java |  302 -
 .../nonstiff/AdamsFieldIntegratorAbstractTest.java |  265 -
 .../nonstiff/AdamsMoultonFieldIntegratorTest.java  |   86 -
 .../ode/nonstiff/AdamsMoultonIntegratorTest.java   |  289 -
 .../nonstiff/AdamsNordsieckTransformerTest.java    |  120 -
 ...lassicalRungKuttaFieldStepInterpolatorTest.java |   68 -
 .../ClassicalRungeKuttaFieldIntegratorTest.java    |  104 -
 .../ClassicalRungeKuttaIntegratorTest.java         |  354 --
 .../ClassicalRungeKuttaStepInterpolatorTest.java   |   98 -
 .../DormandPrince54FieldIntegratorTest.java        |   99 -
 .../DormandPrince54FieldStepInterpolatorTest.java  |   68 -
 .../nonstiff/DormandPrince54IntegratorTest.java    |  360 --
 .../DormandPrince54StepInterpolatorTest.java       |  155 -
 .../DormandPrince853FieldIntegratorTest.java       |   99 -
 .../DormandPrince853FieldStepInterpolatorTest.java |   68 -
 .../nonstiff/DormandPrince853IntegratorTest.java   |  499 --
 .../DormandPrince853StepInterpolatorTest.java      |  155 -
 ...eddedRungeKuttaFieldIntegratorAbstractTest.java |  616 --
 .../ode/nonstiff/EulerFieldIntegratorTest.java     |  105 -
 .../nonstiff/EulerFieldStepInterpolatorTest.java   |   67 -
 .../math4/ode/nonstiff/EulerIntegratorTest.java    |  197 -
 .../ode/nonstiff/EulerStepInterpolatorTest.java    |  194 -
 .../ode/nonstiff/GillFieldIntegratorTest.java      |  104 -
 .../nonstiff/GillFieldStepInterpolatorTest.java    |   68 -
 .../math4/ode/nonstiff/GillIntegratorTest.java     |  253 -
 .../ode/nonstiff/GillStepInterpolatorTest.java     |   98 -
 .../nonstiff/GraggBulirschStoerIntegratorTest.java |  436 --
 .../GraggBulirschStoerStepInterpolatorTest.java    |  157 -
 .../nonstiff/HighamHall54FieldIntegratorTest.java  |   99 -
 .../HighamHall54FieldStepInterpolatorTest.java     |   68 -
 .../ode/nonstiff/HighamHall54IntegratorTest.java   |  377 --
 .../nonstiff/HighamHall54StepInterpolatorTest.java |  155 -
 .../ode/nonstiff/LutherFieldIntegratorTest.java    |  123 -
 .../nonstiff/LutherFieldStepInterpolatorTest.java  |   68 -
 .../math4/ode/nonstiff/LutherIntegratorTest.java   |  344 --
 .../ode/nonstiff/LutherStepInterpolatorTest.java   |   98 -
 .../ode/nonstiff/MidpointFieldIntegratorTest.java  |  104 -
 .../MidpointFieldStepInterpolatorTest.java         |   68 -
 .../math4/ode/nonstiff/MidpointIntegratorTest.java |  197 -
 .../ode/nonstiff/MidpointStepInterpolatorTest.java |   99 -
 .../RungeKuttaFieldIntegratorAbstractTest.java     |  682 ---
 ...ungeKuttaFieldStepInterpolatorAbstractTest.java |  308 -
 .../math4/ode/nonstiff/StepFieldProblem.java       |   85 -
 .../commons/math4/ode/nonstiff/StepProblem.java    |   71 -
 .../nonstiff/ThreeEighthesFieldIntegratorTest.java |  104 -
 .../ThreeEighthesFieldStepInterpolatorTest.java    |   68 -
 .../ode/nonstiff/ThreeEighthesIntegratorTest.java  |  247 -
 .../ThreeEighthesStepInterpolatorTest.java         |   98 -
 .../ode/sampling/DummyFieldStepInterpolator.java   |   55 -
 .../math4/ode/sampling/DummyStepInterpolator.java  |  153 -
 .../ode/sampling/DummyStepInterpolatorTest.java    |  136 -
 .../sampling/NordsieckStepInterpolatorTest.java    |   96 -
 .../ode/sampling/StepInterpolatorTestUtils.java    |  146 -
 .../sampling/StepNormalizerOutputOverlapTest.java  |   69 -
 .../ode/sampling/StepNormalizerOutputTest.java     |   69 -
 .../ode/sampling/StepNormalizerOutputTestBase.java |  286 -
 .../math4/ode/sampling/StepNormalizerTest.java     |  130 -
 .../commons/math4/optim/PointValuePairTest.java    |   35 -
 .../math4/optim/PointVectorValuePairTest.java      |   39 -
 .../math4/optim/SimplePointCheckerTest.java        |   53 -
 .../math4/optim/SimpleValueCheckerTest.java        |   52 -
 .../math4/optim/SimpleVectorValueCheckerTest.java  |   53 -
 .../math4/optim/linear/SimplexSolverTest.java      |  905 ---
 .../math4/optim/linear/SimplexTableauTest.java     |  109 -
 .../MultiStartMultivariateOptimizerTest.java       |  134 -
 .../MultivariateFunctionMappingAdapterTest.java    |  193 -
 .../MultivariateFunctionPenaltyAdapterTest.java    |  203 -
 .../nonlinear/scalar/gradient/CircleScalar.java    |   87 -
 .../NonLinearConjugateGradientOptimizerTest.java   |  480 --
 .../scalar/noderiv/BOBYQAOptimizerTest.java        |  355 --
 .../scalar/noderiv/CMAESOptimizerTest.java         |  852 ---
 .../nonlinear/scalar/noderiv/OptimTestUtils.java   |  397 --
 .../scalar/noderiv/PowellOptimizerTest.java        |  272 -
 .../SimplexOptimizerMultiDirectionalTest.java      |  337 --
 .../noderiv/SimplexOptimizerNelderMeadTest.java    |  423 --
 .../math4/optim/univariate/BracketFinderTest.java  |  121 -
 .../math4/optim/univariate/BrentOptimizerTest.java |  303 -
 .../MultiStartUnivariateOptimizerTest.java         |  127 -
 .../SimpleUnivariateValueCheckerTest.java          |   52 -
 .../CorrelatedRandomVectorGeneratorTest.java       |  192 -
 .../math4/random/GaussianRandomGeneratorTest.java  |   38 -
 .../math4/random/HaltonSequenceGeneratorTest.java  |  134 -
 .../RandomUtilsDataGeneratorAbstractTest.java      |  303 -
 .../RandomUtilsDataGeneratorJDKRandomTest.java     |   31 -
 .../math4/random/SobolSequenceGeneratorTest.java   |  107 -
 .../math4/random/StableRandomGeneratorTest.java    |  130 -
 .../random/SynchronizedRandomGeneratorTest.java    |  120 -
 .../UncorrelatedRandomVectorGeneratorTest.java     |   65 -
 .../math4/random/UniformRandomGeneratorTest.java   |   40 -
 .../apache/commons/math4/special/BesselJTest.java  |  775 ---
 .../commons/math4/stat/CertifiedDataTest.java      |  149 -
 .../apache/commons/math4/stat/FrequencyTest.java   |  354 --
 .../math4/stat/correlation/CovarianceTest.java     |  253 -
 .../stat/correlation/KendallsCorrelationTest.java  |  280 -
 .../stat/correlation/PearsonsCorrelationTest.java  |  318 -
 .../correlation/SpearmansRankCorrelationTest.java  |  163 -
 .../stat/correlation/StorelessCovarianceTest.java  |  264 -
 .../math4/stat/data/CertifiedDataAbstractTest.java |  158 -
 .../apache/commons/math4/stat/data/LewTest.java    |   28 -
 .../commons/math4/stat/data/LotteryTest.java       |   28 -
 .../AggregateSummaryStatisticsTest.java            |  341 --
 .../descriptive/DescriptiveStatisticsTest.java     |  485 --
 .../math4/stat/descriptive/ListUnivariateImpl.java |  197 -
 .../stat/descriptive/ListUnivariateImplTest.java   |  157 -
 .../descriptive/MixedListUnivariateImplTest.java   |  204 -
 .../MultivariateSummaryStatisticsTest.java         |  321 -
 .../descriptive/StatisticalSummaryValuesTest.java  |   82 -
 .../StorelessUnivariateStatisticAbstractTest.java  |  239 -
 .../stat/descriptive/SummaryStatisticsTest.java    |  372 --
 .../SynchronizedDescriptiveStatisticsTest.java     |   27 -
 ...chronizedMultivariateSummaryStatisticsTest.java |   27 -
 .../SynchronizedSummaryStatisticsTest.java         |   26 -
 .../UnivariateStatisticAbstractTest.java           |  223 -
 .../stat/descriptive/moment/FirstMomentTest.java   |  111 -
 .../stat/descriptive/moment/FourthMomentTest.java  |   46 -
 .../stat/descriptive/moment/GeometricMeanTest.java |   78 -
 .../stat/descriptive/moment/InteractionTest.java   |   79 -
 .../stat/descriptive/moment/KurtosisTest.java      |   64 -
 .../math4/stat/descriptive/moment/MeanTest.java    |   67 -
 .../stat/descriptive/moment/SecondMomentTest.java  |   46 -
 .../stat/descriptive/moment/SemiVarianceTest.java  |  153 -
 .../stat/descriptive/moment/SkewnessTest.java      |   63 -
 .../descriptive/moment/StandardDeviationTest.java  |   95 -
 .../stat/descriptive/moment/ThirdMomentTest.java   |   46 -
 .../stat/descriptive/moment/VarianceTest.java      |  117 -
 .../moment/VectorialCovarianceTest.java            |   91 -
 .../stat/descriptive/moment/VectorialMeanTest.java |   86 -
 .../math4/stat/descriptive/rank/MaxTest.java       |   73 -
 .../math4/stat/descriptive/rank/MedianTest.java    |  115 -
 .../math4/stat/descriptive/rank/MinTest.java       |   73 -
 .../descriptive/rank/PSquarePercentileTest.java    |  763 ---
 .../stat/descriptive/rank/PercentileTest.java      | 1046 ----
 .../stat/descriptive/summary/ProductTest.java      |   91 -
 .../math4/stat/descriptive/summary/SumLogTest.java |   84 -
 .../math4/stat/descriptive/summary/SumSqTest.java  |   69 -
 .../math4/stat/descriptive/summary/SumTest.java    |   81 -
 .../math4/stat/inference/BinomialTestTest.java     |  129 -
 .../math4/stat/inference/ChiSquareTestTest.java    |  260 -
 .../commons/math4/stat/inference/GTestTest.java    |  291 -
 .../stat/inference/InferenceTestUtilsTest.java     |  554 --
 .../stat/inference/KolmogorovSmirnovTestTest.java  |  956 ---
 .../math4/stat/inference/MannWhitneyUTestTest.java |  127 -
 .../math4/stat/inference/OneWayAnovaTest.java      |  154 -
 .../commons/math4/stat/inference/TTestTest.java    |  297 -
 .../stat/inference/WilcoxonSignedRankTestTest.java |  183 -
 .../stat/interval/AgrestiCoullIntervalTest.java    |   40 -
 .../BinomialConfidenceIntervalAbstractTest.java    |   80 -
 .../stat/interval/ClopperPearsonIntervalTest.java  |  110 -
 .../math4/stat/interval/IntervalUtilsTest.java     |   64 -
 .../interval/NormalApproximationIntervalTest.java  |   40 -
 .../stat/interval/WilsonScoreIntervalTest.java     |   45 -
 .../math4/stat/ranking/NaturalRankingTest.java     |  271 -
 .../GLSMultipleLinearRegressionTest.java           |  300 -
 .../regression/MillerUpdatingRegressionTest.java   | 1110 ----
 .../MultipleLinearRegressionAbstractTest.java      |  136 -
 .../OLSMultipleLinearRegressionTest.java           |  822 ---
 .../stat/regression/SimpleRegressionTest.java      |  693 ---
 .../math4/transform/FastCosineTransformerTest.java |  276 -
 .../transform/FastFourierTransformerTest.java      |  482 --
 .../transform/FastHadamardTransformerTest.java     |  127 -
 .../math4/transform/FastSineTransformerTest.java   |  300 -
 .../transform/RealTransformerAbstractTest.java     |  344 --
 .../commons/math4/util/BigRealFieldTest.java       |   43 -
 .../org/apache/commons/math4/util/BigRealTest.java |  189 -
 .../commons/math4/util/CombinatoricsUtilsTest.java |   95 -
 .../apache/commons/math4/util/Decimal64Test.java   |  426 --
 .../commons/math4/util/DefaultTransformerTest.java |  104 -
 .../math4/util/DoubleArrayAbstractTest.java        |  132 -
 .../math4/util/FastMathStrictComparisonTest.java   |  262 -
 .../apache/commons/math4/util/FastMathTest.java    | 1965 -------
 .../commons/math4/util/IntegerSequenceTest.java    |  327 --
 .../apache/commons/math4/util/KthSelectorTest.java |   56 -
 .../apache/commons/math4/util/MathArraysTest.java  |  848 ---
 .../apache/commons/math4/util/MathUtilsTest.java   |  348 --
 .../math4/util/OpenIntToDoubleHashMapTest.java     |  332 --
 .../commons/math4/util/OpenIntToFieldTest.java     |  335 --
 .../org/apache/commons/math4/util/PairTest.java    |  118 -
 .../math4/util/ResizableDoubleArrayTest.java       |  581 --
 .../org/apache/commons/math4/util/TestBean.java    |   71 -
 .../commons/math4/util/TransformerMapTest.java     |  122 -
 .../RealFunctionValidation.java                    |  361 --
 .../math4/geometry/euclidean/threed/issue-1211.bsp |   15 -
 .../threed/pentomino-N-bad-orientation.ply         |   40 -
 .../geometry/euclidean/threed/pentomino-N-hole.ply |   39 -
 .../euclidean/threed/pentomino-N-out-of-plane.ply  |   40 -
 .../euclidean/threed/pentomino-N-too-close.ply     |   86 -
 .../geometry/euclidean/threed/pentomino-N.ply      |   39 -
 src/userguide/resources/references.txt             |    4 -
 2404 files changed, 262681 insertions(+), 260153 deletions(-)

diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
deleted file mode 100644
index 94e476f..0000000
--- a/RELEASE-NOTES.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-
-              Apache Commons Math 3.4.1 RELEASE NOTES
-
-The Apache Commons Math team is pleased to announce the release of commons-math3-3.4.1
-
-The Apache Commons Math project is a library of lightweight, self-contained mathematics
-and statistics components addressing the most common practical problems not immediately
-available in the Java programming language or commons-lang.
-
-This is a maintenance release: It fixes issue MATH-1188.
-
-Changes in this version include:
-
-
-Fixed Bugs:
-o MATH-1188:  Fixed non-Java1.5 code in BesselJ. 
-
-
-
-For complete information on Apache Commons Math, including instructions on how to submit bug reports,
-patches, or suggestions for improvement, see the Apache Commons Math website:
-
-http://commons.apache.org/proper/commons-math/
-
-
diff --git a/build.xml b/build.xml
deleted file mode 100644
index 747f243..0000000
--- a/build.xml
+++ /dev/null
@@ -1,376 +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.
--->
-<project name="Commons Math" default="jar" basedir=".">
-
-
-<!--
-        "Math" component of the Apache Commons Project
--->
-
-
-<!-- ========== Initialize Properties ===================================== -->
-
-  <property file="build.properties"/>                <!-- Component local   -->
-  <property file="${user.home}/build.properties"/>   <!-- User local        -->
-
-
-<!-- ========== External Dependencies ===================================== -->
-
-  <property name="repository"              value = "${user.home}/.m2/repository"/>
-
-  <!-- Junit -->
-  <property name="junit.version"           value="4.11"/>
-  <property name="junit.jar"               value="$junit-{junit.version}.jar"/>
-  <property name="hamcrest.jar"            value="hamcrest-core-1.3.jar"/>
-
-<!-- ========== Component Declarations ==================================== -->
-
-
-  <!-- The name of this component -->
-  <property name="component.name"          value="commons-math"/>
-
-  <!-- The primary package name of this component -->
-  <property name="component.package"       value="org.apache.commons.math4"/>
-
-  <!-- The title of this component -->
-  <property name="component.title"         value="Commons MATH"/>
-
-  <!-- The current version number of this component -->
-  <property name="component.version"       value="4.0-SNAPSHOT"/>
-
-  <!-- The base directory for component sources -->
-  <property name="source.home"             value="src/main/java"/>
-
-  <!-- The base directory for component resources -->
-  <property name="source.resources"        value="src/main/resources"/>
-
-  <!-- The base directory for unit test sources -->
-  <property name="test.home"               value="src/test/java"/>
-
-  <!-- The base directory for unit test resources -->
-  <property name="test.resources"          value="src/test/resources"/>
-
-  <!-- Download lib dir -->
-  <property name="download.lib.dir"        value="lib"/>
-
-  <!-- The base directory for compilation targets -->
-  <property name="build.home"              value="target"/>
-
-  <!-- The base directory for distribution targets -->
-  <property name="dist.home"               value="${build.home}/dist"/>
-
-  <!-- The base directory for test reports -->
-  <property name="test.reports"            value="${build.home}/test-reports"/>
-
-  <!-- Base file name for dist files -->
-  <property name="final.name"              value="${component.name}-${component.version}"/>
-
-  <!-- Directory where binary release files are staged -->
-  <property name="stage.bin.dir"           value="${dist.home}/stage-bin"/>
-
-  <!-- Directory where source release files are staged -->
-  <property name="stage.src.dir"           value="${dist.home}/stage-src"/>
-
-<!-- ========== Compiler Defaults ========================================= -->
-
-  <!-- Should Java compilations set the 'debug' compiler option? -->
-  <property name="compile.debug"           value="true"/>
-
-  <!-- Should Java compilations set the 'deprecation' compiler option? -->
-  <property name="compile.deprecation"     value="false"/>
-
-  <!-- Should Java compilations set the 'optimize' compiler option? -->
-  <property name="compile.optimize"        value="true"/>
-
-  <!-- File encoding -->
-  <property name="source.encoding"         value="UTF-8"/>
-    
-  <!-- JDK level -->
-  <property name="compile.source"          value="1.5"/>
-  <property name="compile.target"          value="1.5"/>
-
-  <!-- Base compile classpath -->
-  <path id="compile.classpath">
-    <pathelement location="${build.home}/classes"/>
-  </path>
-
-  <!-- External dependency classpath -->
-  <path id="downloaded.lib.classpath">
-    <pathelement location="${download.lib.dir}/junit-${junit.version}.jar"/>
-	<pathelement location="${download.lib.dir}/${hamcrest.jar}"/>
-  </path>
-
-<!-- ========== Test Execution Defaults =================================== -->
-
-
-  <!-- Construct unit test classpath -->
-  <path id="test.classpath">
-    <pathelement location="${build.home}/classes"/>
-    <pathelement location="${build.home}/test-classes"/>
-    <pathelement location="${junit.jar}"/>
-	<pathelement location="${hamcrest.jar}"/>
-    <path refid="downloaded.lib.classpath"/>
-  </path>
-
-  <!-- Should the build fail if there are test failures? -->
-  <property name="test.failonerror"        value="true"/>
-
-<!-- ========== Executable Targets ======================================== -->
-
-  <target name="clean" description="Clean build and distribution directories">
-    <delete    dir="${build.home}"/>
-  </target>
-
-
-  <target name="init"
-   description="Initialize and evaluate conditionals">
-    <echo message="-------- ${component.title} ${component.version} --------"/>
-    <filter  token="name"                  value="${component.name}"/>
-    <filter  token="package"               value="${component.package}"/>
-    <filter  token="version"               value="${component.version}"/>
-    <filter  token="compilesource"         value="${compile.source}"/>
-    <filter  token="compiletarget"         value="${compile.target}"/>
-    <tstamp/>
-    <mkdir dir="${build.home}"/>
-    <mkdir dir="${build.home}/classes"/>
-    <mkdir dir="${build.home}/test-classes"/>
-    <copy todir="${build.home}/classes/">
-       <fileset dir="${source.resources}" />
-    </copy>
-
-  </target>
-
-<!-- ========== Compile Targets =========================================== -->
-
-  <target name="compile" depends="init" description="Compile">
-
-    <javac  srcdir="${source.home}"
-           destdir="${build.home}/classes"
-             source="${compile.source}"
-             target="${compile.target}"
-             debug="${compile.debug}"
-       deprecation="${compile.deprecation}"
- includeantruntime="false"
-          encoding="${source.encoding}"
-          optimize="${compile.optimize}">
-      <classpath refid="compile.classpath"/>
-    </javac>
-  </target>
-
-
-<!-- ========== Unit Test Targets ========================================= -->
-
-    <target name="compile.tests" depends="compile, download-dependencies" description="Compile unit tests.">
-
-      <javac srcdir="${test.home}"
-             destdir="${build.home}/test-classes"
-             debug="${compile.debug}"
-             deprecation="${compile.deprecation}"
-             encoding="${source.encoding}"
-             includeantruntime="false"
-             optimize="${compile.optimize}">
-          <classpath refid="test.classpath"/>
-      </javac>
-    
-      <copy todir="${build.home}/test-classes">
-          <fileset dir="${test.resources}">
-          </fileset>
-      </copy>
-
-    </target>
-
-  <target name="test"  depends="compile.tests"
-                       description="Run unit tests">
-      <mkdir dir="${test.reports}"/>
-      <junit printsummary="true"
-               errorProperty="test.failed"
-               failureProperty="test.failed"
-               fork="true"
-               showOutput="true">
-               <formatter type="brief"/>
-               <classpath refid="test.classpath"/>
-               <!-- If test.entry is defined, run a single test, otherwise run all valid tests -->
-               <!-- N.B. test.entry must be the full path to the test class, for example:
-               ant test -Dtest.entry=org.apache.commons.math4.util.FastMathTestPerformance
-               -->
-               <test name="${test.entry}" todir="${test.reports}" if="test.entry"/>
-               <batchtest todir="${test.reports}" unless="test.entry">
-                   <fileset dir="${test.home}">
-                      <include name="**/*Test.java"/> 
-                      <include name="**/*TestBinary.java"/> 
-                      <include name="**/*TestPermutations.java"/> 
-                      <exclude name="**/*AbstractTest.java"/>
-                   </fileset>
-               </batchtest>
-       </junit>
-       <fail message="There were test failures.">
-           <condition>
-               <and>
-                   <istrue value="${test.failonerror}"/>
-                   <isset property="test.failed"/>
-               </and>
-           </condition>
-     </fail>
-  </target>
-
-
-<!-- ========== Produce Javadocs ========================================== -->
-
-  <target name="javadoc" depends="compile" description="Create component Javadoc documentation">
-    <mkdir dir="${build.home}/apidocs"/>
-    <tstamp>
-        <format property="current.year" pattern="yyyy"/>
-    </tstamp>
-    <javadoc sourcepath="${source.home}"
-                destdir="${build.home}/apidocs"
-           packagenames="org.apache.commons.*"
-                 author="true"
-                private="true"
-                version="true"
-               encoding="${source.encoding}"
-                charset="${source.encoding}"
-            docencoding="${source.encoding}"
-               doctitle="&lt;h1&gt;${component.title} ${component.version}&lt;/h1&gt;"
-            windowtitle="${component.title} ${component.version}"
-                 bottom="Copyright (c) 2003-${current.year}  Apache Software Foundation"
-        additionalparam="-header &apos;&lt;script type=&quot;text/javascript&quot; src=&quot;http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML&quot;&gt;&lt;/script&gt;&apos;"
-           classpathref="compile.classpath">
-        <link href="http://java.sun.com/j2se/1.5.0/docs/api/"/>  
-    </javadoc>
-  </target>
-
-
-<!-- ========== Create Jar ================================================ -->
-
-  <target name="jar" depends="test" description="Create jar file">
-
-    <copy file="LICENSE.txt" tofile="${build.home}/classes/META-INF/LICENSE.txt"/>
-    <copy file="NOTICE.txt"  tofile="${build.home}/classes/META-INF/NOTICE.txt"/>
-
-    <manifest file="${build.home}/MANIFEST.MF">
-        <attribute name="Specification-Title"      value="${component.title}"/>
-        <attribute name="Specification-Version"    value="${component.version}"/>
-        <attribute name="Specification-Vendor"     value="Apache Software Foundation"/>
-        <attribute name="Implementation-Title"     value="${component.title}"/>
-        <attribute name="Implementation-Version"   value="${component.version}"/> 
-        <attribute name="Implementation-Vendor"    value="Apache Software Foundation"/>
-        <attribute name="Implementation-Vendor-Id" value="org.apache"/>
-        <attribute name="X-Compile-Source-JDK"     value="${compile.source}"/>
-        <attribute name="X-Compile-Target-JDK"     value="${compile.target}"/>
-    </manifest>
-
-    <jar jarfile="${build.home}/${final.name}.jar"
-         basedir="${build.home}/classes"
-        manifest="${build.home}/MANIFEST.MF"/>
-  </target>
-
-
-<!-- ========== Distribution Target =========================================== -->
-
-  <target name="dist" depends="clean,jar,javadoc" description="Create distribution artifacts">
-
-    <mkdir dir="${dist.home}"/>
-
-    <!-- jar(s) -->
-    <copy todir="${dist.home}">
-      <fileset dir=".">
-        <include name="RELEASE-NOTES.txt"/>
-      </fileset>
-      <fileset dir="${build.home}">
-        <include name="*.jar"/>
-      </fileset>
-    </copy>
-
-    <!-- Binary Distro -->
-    <mkdir dir="${stage.bin.dir}/${final.name}"/>
-    <copy todir="${stage.bin.dir}/${final.name}">
-      <fileset dir=".">
-        <include name="LICENSE.txt"/>
-        <include name="NOTICE.txt"/>
-        <include name="RELEASE-NOTES.txt"/>
-      </fileset>
-      <fileset dir="${build.home}">
-        <include name="*.jar"/>
-      </fileset>
-    </copy>
-    <copy todir="${stage.bin.dir}/${final.name}/apidocs">
-      <fileset dir="${build.home}/apidocs" />
-    </copy>
-
-    <!-- Source Distro -->
-    <mkdir dir="${stage.src.dir}/${final.name}-src"/>
-    <copy todir="${stage.src.dir}/${final.name}-src">
-      <fileset dir=".">
-        <include name="*.xml"/>
-        <include name="*.txt"/>
-        <include name="*.html"/>
-      </fileset>
-    </copy>
-    <copy todir="${stage.src.dir}/${final.name}-src/src">
-      <fileset dir="src" excludes="mantissa/**,experimental/**" />
-    </copy>
-    <zip  zipfile="${dist.home}/${final.name}.zip"     basedir="${stage.bin.dir}"/>
-    <zip  zipfile="${dist.home}/${final.name}-src.zip" basedir="${stage.src.dir}"/>
-    <tar  tarfile="${dist.home}/${final.name}.tar"     basedir="${stage.bin.dir}" longfile="gnu"/>
-    <tar  tarfile="${dist.home}/${final.name}-src.tar" basedir="${stage.src.dir}" longfile="gnu"/>
-    <gzip     src="${dist.home}/${final.name}.tar"     zipfile="${dist.home}/${final.name}.tar.gz"/>
-    <gzip     src="${dist.home}/${final.name}-src.tar" zipfile="${dist.home}/${final.name}-src.tar.gz"/>
-
-    <!-- clean up staging directories -->
-    <delete    dir="${stage.bin.dir}"/>
-    <delete    dir="${stage.src.dir}"/>
-
-  </target>
-
-
-<!-- ========== Gump Target ===================================================== -->
-
-  <target name="gump" depends="clean,test,javadoc,jar" description="Gump Target - clean,test,javadoc,jar"/>
-
-
-<!-- ========== Download Dependencies =========================================== -->
-
-    <target name="download-dependencies" 
-         depends="check-availability" unless="skip.download">
-        <echo message="doing download-dependencies..." />
-        <antcall target="download-junit" />
-        <antcall target="download-hamcrest" />
-    </target>
-
-    <target name="check-availability">
-        <echo message="doing check-availability..." />
-        <available file="${junit.jar}" property="junit.found"/>
-    </target>
-
-    <target name="download-junit" unless="junit.found">
-        <echo message="Downloading junit..."/>
-        <mkdir dir="${download.lib.dir}" />
-        <get dest="${download.lib.dir}/junit-${junit.version}.jar"
-            usetimestamp="true" ignoreerrors="true"
-            src="http://repo1.maven.org/maven2/junit/junit/${junit.version}/junit-${junit.version}.jar"/>
-    </target>
-
-	<target name="download-hamcrest" unless="hamcrest.found">
-	        <echo message="Downloading hamcrest..."/>
-	        <mkdir dir="${download.lib.dir}" />
-	        <get dest="${download.lib.dir}/${hamcrest.jar}"
-	            usetimestamp="true" ignoreerrors="true"
-	            src="http://repo1.maven.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar"/>
-	</target>
-      
-</project>
-
diff --git a/commons-math-legacy/LICENCE b/commons-math-legacy/LICENCE
new file mode 100644
index 0000000..d97b49a
--- /dev/null
+++ b/commons-math-legacy/LICENCE
@@ -0,0 +1,457 @@
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.
+
+
+Apache Commons Math includes the following code provided to the ASF under the
+Apache License 2.0:
+
+ - The inverse error function implementation in the Erf class is based on CUDA
+   code developed by Mike Giles, Oxford-Man Institute of Quantitative Finance,
+   and published in GPU Computing Gems, volume 2, 2010 (grant received on
+   March 23th 2013)
+ - The LinearConstraint, LinearObjectiveFunction, LinearOptimizer,
+   RelationShip, SimplexSolver and SimplexTableau classes in package
+   org.apache.commons.math3.optimization.linear include software developed by
+   Benjamin McCann (http://www.benmccann.com) and distributed with
+   the following copyright: Copyright 2009 Google Inc. (grant received on
+   March 16th 2009)
+ - The class "org.apache.commons.math3.exception.util.LocalizedFormatsTest" which
+   is an adapted version of "OrekitMessagesTest" test class for the Orekit library
+ - The "org.apache.commons.math3.analysis.interpolation.HermiteInterpolator"
+   has been imported from the Orekit space flight dynamics library.
+
+===============================================================================
+ 
+
+
+APACHE COMMONS MATH DERIVATIVE WORKS: 
+
+The Apache commons-math library includes a number of subcomponents
+whose implementation is derived from original sources written
+in C or Fortran.  License terms of the original sources
+are reproduced below.
+
+===============================================================================
+For the lmder, lmpar and qrsolv Fortran routine from minpack and translated in
+the LevenbergMarquardtOptimizer class in package
+org.apache.commons.math3.optimization.general 
+Original source copyright and license statement:
+
+Minpack Copyright Notice (1999) University of Chicago.  All rights reserved
+
+Redistribution and use in source and binary forms, with or
+without modification, are permitted provided that the
+following conditions are met:
+
+1. Redistributions of source code must retain the above
+copyright notice, this list of conditions and the following
+disclaimer.
+
+2. 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.
+
+3. The end-user documentation included with the
+redistribution, if any, must include the following
+acknowledgment:
+
+   "This product includes software developed by the
+   University of Chicago, as Operator of Argonne National
+   Laboratory.
+
+Alternately, this acknowledgment may appear in the software
+itself, if and wherever such third-party acknowledgments
+normally appear.
+
+4. 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.
+
+5. 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.
+===============================================================================
+
+Copyright and license statement for the odex Fortran routine developed by
+E. Hairer and G. Wanner and translated in GraggBulirschStoerIntegrator class
+in package org.apache.commons.math3.ode.nonstiff:
+
+
+Copyright (c) 2004, Ernst Hairer
+
+Redistribution and use in source and binary forms, with or without 
+modification, are permitted provided that the following conditions are 
+met:
+
+- Redistributions of source code must retain the above copyright 
+notice, this list of conditions and the following disclaimer.
+
+- 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.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 
+IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 
+TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 
+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR 
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+===============================================================================
+
+Copyright and license statement for the original Mersenne twister C
+routines translated in MersenneTwister class in package 
+org.apache.commons.math3.random:
+
+   Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
+   All rights reserved.                          
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+
+     1. Redistributions of source code must retain the above copyright
+        notice, this list of conditions and the following disclaimer.
+
+     2. 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.
+
+     3. The names of its contributors may not be used to endorse or promote 
+        products derived from this software without specific prior written 
+        permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+===============================================================================
+
+The initial code for shuffling an array (originally in class
+"org.apache.commons.math3.random.RandomDataGenerator", now replaced by
+a method in class "org.apache.commons.math3.util.MathArrays") was
+inspired from the algorithm description provided in
+"Algorithms", by Ian Craw and John Pulham (University of Aberdeen 1999).
+The textbook (containing a proof that the shuffle is uniformly random) is
+available here:
+  http://citeseerx.ist.psu.edu/viewdoc/download;?doi=10.1.1.173.1898&rep=rep1&type=pdf
+
+===============================================================================
+License statement for the direction numbers in the resource files for Sobol sequences.
+
+-----------------------------------------------------------------------------
+Licence pertaining to sobol.cc and the accompanying sets of direction numbers
+
+-----------------------------------------------------------------------------
+Copyright (c) 2008, Frances Y. Kuo and Stephen Joe
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+
+    * 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.
+
+    * Neither the names of the copyright holders nor the names of the
+      University of New South Wales and the University of Waikato
+      and its contributors may be used to endorse or promote products derived
+      from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+===============================================================================
+
+The initial commit of package "org.apache.commons.math3.ml.neuralnet" is
+an adapted version of code developed in the context of the Data Processing
+and Analysis Consortium (DPAC) of the "Gaia" project of the European Space
+Agency (ESA).
+===============================================================================
+
+The initial commit of the class "org.apache.commons.math3.special.BesselJ" is
+an adapted version of code translated from the netlib Fortran program, rjbesl
+http://www.netlib.org/specfun/rjbesl by R.J. Cody at Argonne National
+Laboratory (USA).  There is no license or copyright statement included with the
+original Fortran sources.
+===============================================================================
+
+
+The BracketFinder (package org.apache.commons.math3.optimization.univariate)
+and PowellOptimizer (package org.apache.commons.math3.optimization.general)
+classes are based on the Python code in module "optimize.py" (version 0.5)
+developed by Travis E. Oliphant for the SciPy library (http://www.scipy.org/)
+Copyright © 2003-2009 SciPy Developers.
+
+SciPy license
+Copyright © 2001, 2002 Enthought, Inc.
+All rights reserved.
+
+Copyright © 2003-2013 SciPy Developers.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+
+    * 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.
+
+    * Neither the name of Enthought nor the names of the SciPy Developers may
+      be used to endorse or promote products derived from this software without
+      specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+===============================================================================
+
diff --git a/commons-math-legacy/NOTICE b/commons-math-legacy/NOTICE
new file mode 100644
index 0000000..587cd7f
--- /dev/null
+++ b/commons-math-legacy/NOTICE
@@ -0,0 +1,9 @@
+Apache Commons Math
+Copyright 2001-2020 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+This product includes software developed for Orekit by
+CS Systèmes d'Information (http://www.c-s.fr/)
+Copyright 2010-2012 CS Systèmes d'Information
diff --git a/commons-math-legacy/pom.xml b/commons-math-legacy/pom.xml
new file mode 100644
index 0000000..8795be8
--- /dev/null
+++ b/commons-math-legacy/pom.xml
@@ -0,0 +1,131 @@
+<?xml version="1.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.
+-->
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+         xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.commons</groupId>
+    <artifactId>commons-math-parent</artifactId>
+    <version>4.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>commons-math-legacy</artifactId>
+  <name>Apache Commons Math (Legacy)</name>
+
+  <description>Legacy codes that are either currently unsupported or not yet modularized.</description>
+
+  <properties>
+    <!-- The Java Module System Name -->
+    <commons.module.name>org.apache.commons.math4.legacy</commons.module.name>
+    <!-- This value must reflect the current name of the base package. -->
+    <commons.osgi.symbolicName>org.apache.commons.math4.legacy</commons.osgi.symbolicName>
+    <!-- OSGi -->
+    <commons.osgi.export>org.apache.commons.math4.legacy</commons.osgi.export>
+    <!-- Workaround to avoid duplicating config files. -->
+    <math.parent.dir>${basedir}/..</math.parent.dir>
+  </properties>
+
+  <dependencies>
+
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-math3</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-statistics-distribution</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-numbers-core</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-numbers-complex</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-numbers-complex-streams</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-numbers-gamma</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-numbers-combinatorics</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-numbers-arrays</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-numbers-angle</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-numbers-rootfinder</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-numbers-field</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-numbers-quaternion</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-rng-client-api</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-rng-simple</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-rng-sampling</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-geometry-euclidean</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+  </dependencies>
+
+</project>
diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/Field.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/Field.java
new file mode 100644
index 0000000..f6168c4
--- /dev/null
+++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/Field.java
@@ -0,0 +1,58 @@
+/*
+ * 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.legacy;
+
+/**
+ * Interface representing a <a href="http://mathworld.wolfram.com/Field.html">field</a>.
+ * <p>
+ * Classes implementing this interface will often be singletons.
+ * </p>
+ * @param <T> the type of the field elements
+ * @see FieldElement
+ * @since 2.0
+ */
+public interface Field<T> {
+
+    /** Get the additive identity of the field.
+     * <p>
+     * The additive identity is the element e<sub>0</sub> of the field such that
+     * for all elements a of the field, the equalities a + e<sub>0</sub> =
+     * e<sub>0</sub> + a = a hold.
+     * </p>
+     * @return additive identity of the field
+     */
+    T getZero();
+
+    /** Get the multiplicative identity of the field.
+     * <p>
+     * The multiplicative identity is the element e<sub>1</sub> of the field such that
+     * for all elements a of the field, the equalities a &times; e<sub>1</sub> =
+     * e<sub>1</sub> &times; a = a hold.
+     * </p>
+     * @return multiplicative identity of the field
+     */
+    T getOne();
+
+    /**
+     * Returns the runtime class of the FieldElement.
+     *
+     * @return The {@code Class} object that represents the runtime
+     *         class of this object.
+     */
+    Class<? extends FieldElement<T>> getRuntimeClass();
+
+}
diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/FieldElement.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/FieldElement.java
new file mode 100644
index 0000000..bcd1dae
--- /dev/null
+++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/FieldElement.java
@@ -0,0 +1,87 @@
+/*
+ * 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.legacy;
+
+import org.apache.commons.math4.legacy.exception.MathArithmeticException;
+import org.apache.commons.math4.legacy.exception.NullArgumentException;
+
+
+/**
+ * Interface representing <a href="http://mathworld.wolfram.com/Field.html">field</a> elements.
+ * @param <T> the type of the field elements
+ * @see Field
+ * @since 2.0
+ */
+public interface FieldElement<T> {
+
+    /** Compute this + a.
+     * @param a element to add
+     * @return a new element representing this + a
+     * @throws NullArgumentException if {@code a} is {@code null}.
+     */
+    T add(T a) throws NullArgumentException;
+
+    /** Compute this - a.
+     * @param a element to subtract
+     * @return a new element representing this - a
+     * @throws NullArgumentException if {@code a} is {@code null}.
+     */
+    T subtract(T a) throws NullArgumentException;
+
+    /**
+     * Returns the additive inverse of {@code this} element.
+     * @return the opposite of {@code this}.
+     */
+    T negate();
+
+    /** Compute n &times; this. Multiplication by an integer number is defined
+     * as the following sum
+     * <center>
+     * n &times; this = &sum;<sub>i=1</sub><sup>n</sup> this.
+     * </center>
+     * @param n Number of times {@code this} must be added to itself.
+     * @return A new element representing n &times; this.
+     */
+    T multiply(int n);
+
+    /** Compute this &times; a.
+     * @param a element to multiply
+     * @return a new element representing this &times; a
+     * @throws NullArgumentException if {@code a} is {@code null}.
+     */
+    T multiply(T a) throws NullArgumentException;
+
+    /** Compute this &divide; a.
+     * @param a element to divide by
+     * @return a new element representing this &divide; a
+     * @throws NullArgumentException if {@code a} is {@code null}.
+     * @throws MathArithmeticException if {@code a} is zero
+     */
+    T divide(T a) throws NullArgumentException, MathArithmeticException;
+
+    /**
+     * Returns the multiplicative inverse of {@code this} element.
+     * @return the inverse of {@code this}.
+     * @throws MathArithmeticException if {@code this} is zero
+     */
+    T reciprocal() throws MathArithmeticException;
+
+    /** Get the {@link Field} to which the instance belongs.
+     * @return {@link Field} to which the instance belongs
+     */
+    Field<T> getField();
+}
diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/RealFieldElement.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/RealFieldElement.java
new file mode 100644
index 0000000..3defca5
--- /dev/null
+++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/RealFieldElement.java
@@ -0,0 +1,402 @@
+/*
+ * 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.legacy;
+
+import org.apache.commons.math4.legacy.exception.DimensionMismatchException;
+
+/**
+ * Interface representing a <a href="http://mathworld.wolfram.com/RealNumber.html">real</a>
+ * <a href="http://mathworld.wolfram.com/Field.html">field</a>.
+ * @param <T> the type of the field elements
+ * @see FieldElement
+ * @since 3.2
+ */
+public interface RealFieldElement<T> extends FieldElement<T> {
+
+    /** Get the real value of the number.
+     * @return real value
+     */
+    double getReal();
+
+    /** '+' operator.
+     * @param a right hand side parameter of the operator
+     * @return this+a
+     */
+    T add(double a);
+
+    /** '-' operator.
+     * @param a right hand side parameter of the operator
+     * @return this-a
+     */
+    T subtract(double a);
+
+    /** '&times;' operator.
+     * @param a right hand side parameter of the operator
+     * @return this&times;a
+     */
+    T multiply(double a);
+
+    /** '&divide;' operator.
+     * @param a right hand side parameter of the operator
+     * @return this&divide;a
+     */
+    T divide(double a);
+
+    /** IEEE remainder operator.
+     * @param a right hand side parameter of the operator
+     * @return this - n &times; a where n is the closest integer to this/a
+     * (the even integer is chosen for n if this/a is halfway between two integers)
+     */
+    T remainder(double a);
+
+    /** IEEE remainder operator.
+     * @param a right hand side parameter of the operator
+     * @return this - n &times; a where n is the closest integer to this/a
+     * (the even integer is chosen for n if this/a is halfway between two integers)
+     * @exception DimensionMismatchException if number of free parameters or orders are inconsistent
+     */
+    T remainder(T a)
+        throws DimensionMismatchException;
+
+    /** absolute value.
+     * @return abs(this)
+     */
+    T abs();
+
+    /** Get the smallest whole number larger than instance.
+     * @return ceil(this)
+     */
+    T ceil();
+
+    /** Get the largest whole number smaller than instance.
+     * @return floor(this)
+     */
+    T floor();
+
+    /** Get the whole number that is the nearest to the instance, or the even one if x is exactly half way between two integers.
+     * @return a double number r such that r is an integer r - 0.5 &le; this &le; r + 0.5
+     */
+    T rint();
+
+    /** Get the closest long to instance value.
+     * @return closest long to {@link #getReal()}
+     */
+    long round();
+
+    /** Compute the signum of the instance.
+     * The signum is -1 for negative numbers, +1 for positive numbers and 0 otherwise
+     * @return -1.0, -0.0, +0.0, +1.0 or NaN depending on sign of a
+     */
+    T signum();
+
+    /**
+     * Returns the instance with the sign of the argument.
+     * A NaN {@code sign} argument is treated as positive.
+     *
+     * @param sign the sign for the returned value
+     * @return the instance with the same sign as the {@code sign} argument
+     */
+    T copySign(T sign);
+
+    /**
+     * Returns the instance with the sign of the argument.
+     * A NaN {@code sign} argument is treated as positive.
+     *
+     * @param sign the sign for the returned value
+     * @return the instance with the same sign as the {@code sign} argument
+     */
+    T copySign(double sign);
+
+    /**
+     * Multiply the instance by a power of 2.
+     * @param n power of 2
+     * @return this &times; 2<sup>n</sup>
+     */
+    T scalb(int n);
+
+    /**
+     * Returns the hypotenuse of a triangle with sides {@code this} and {@code y}
+     * - sqrt(<i>this</i><sup>2</sup>&nbsp;+<i>y</i><sup>2</sup>)
+     * avoiding intermediate overflow or underflow.
+     *
+     * <ul>
+     * <li> If either argument is infinite, then the result is positive infinity.</li>
+     * <li> else, if either argument is NaN then the result is NaN.</li>
+     * </ul>
+     *
+     * @param y a value
+     * @return sqrt(<i>this</i><sup>2</sup>&nbsp;+<i>y</i><sup>2</sup>)
+     * @exception DimensionMismatchException if number of free parameters or orders are inconsistent
+     */
+    T hypot(T y)
+        throws DimensionMismatchException;
+
+    /** {@inheritDoc} */
+    @Override
+    T reciprocal();
+
+    /** Square root.
+     * @return square root of the instance
+     */
+    T sqrt();
+
+    /** Cubic root.
+     * @return cubic root of the instance
+     */
+    T cbrt();
+
+    /** N<sup>th</sup> root.
+     * @param n order of the root
+     * @return n<sup>th</sup> root of the instance
+     */
+    T rootN(int n);
+
+    /** Power operation.
+     * @param p power to apply
+     * @return this<sup>p</sup>
+     */
+    T pow(double p);
+
+    /** Integer power operation.
+     * @param n power to apply
+     * @return this<sup>n</sup>
+     */
+    T pow(int n);
+
+    /** Power operation.
+     * @param e exponent
+     * @return this<sup>e</sup>
+     * @exception DimensionMismatchException if number of free parameters or orders are inconsistent
+     */
+    T pow(T e)
+        throws DimensionMismatchException;
+
+    /** Exponential.
+     * @return exponential of the instance
+     */
+    T exp();
+
+    /** Exponential minus 1.
+     * @return exponential minus one of the instance
+     */
+    T expm1();
+
+    /** Natural logarithm.
+     * @return logarithm of the instance
+     */
+    T log();
+
+    /** Shifted natural logarithm.
+     * @return logarithm of one plus the instance
+     */
+    T log1p();
+
+    /** Base 10 logarithm.
+     * @return base 10 logarithm of the instance
+     * @since 4.0
+     */
+    T log10();
+
+    /** Cosine operation.
+     * @return cos(this)
+     */
+    T cos();
+
+    /** Sine operation.
+     * @return sin(this)
+     */
+    T sin();
+
+    /** Tangent operation.
+     * @return tan(this)
+     */
+    T tan();
+
+    /** Arc cosine operation.
+     * @return acos(this)
+     */
+    T acos();
+
+    /** Arc sine operation.
+     * @return asin(this)
+     */
+    T asin();
+
+    /** Arc tangent operation.
+     * @return atan(this)
+     */
+    T atan();
+
+    /** Two arguments arc tangent operation.
+     * @param x second argument of the arc tangent
+     * @return atan2(this, x)
+     * @exception DimensionMismatchException if number of free parameters or orders are inconsistent
+     */
+    T atan2(T x)
+        throws DimensionMismatchException;
+
+    /** Hyperbolic cosine operation.
+     * @return cosh(this)
+     */
+    T cosh();
+
+    /** Hyperbolic sine operation.
+     * @return sinh(this)
+     */
+    T sinh();
+
+    /** Hyperbolic tangent operation.
+     * @return tanh(this)
+     */
+    T tanh();
+
+    /** Inverse hyperbolic cosine operation.
+     * @return acosh(this)
+     */
+    T acosh();
+
+    /** Inverse hyperbolic sine operation.
+     * @return asin(this)
+     */
+    T asinh();
+
+    /** Inverse hyperbolic  tangent operation.
+     * @return atanh(this)
+     */
+    T atanh();
+
+    /**
+     * Compute a linear combination.
+     * @param a Factors.
+     * @param b Factors.
+     * @return <code>&Sigma;<sub>i</sub> a<sub>i</sub> b<sub>i</sub></code>.
+     * @throws DimensionMismatchException if arrays dimensions don't match
+     * @since 3.2
+     */
+    T linearCombination(T[] a, T[] b)
+        throws DimensionMismatchException;
+
+    /**
+     * Compute a linear combination.
+     * @param a Factors.
+     * @param b Factors.
+     * @return <code>&Sigma;<sub>i</sub> a<sub>i</sub> b<sub>i</sub></code>.
+     * @throws DimensionMismatchException if arrays dimensions don't match
+     * @since 3.2
+     */
+    T linearCombination(double[] a, T[] b)
+        throws DimensionMismatchException;
+
+    /**
+     * Compute a linear combination.
+     * @param a1 first factor of the first term
+     * @param b1 second factor of the first term
+     * @param a2 first factor of the second term
+     * @param b2 second factor of the second term
+     * @return a<sub>1</sub>&times;b<sub>1</sub> +
+     * a<sub>2</sub>&times;b<sub>2</sub>
+     * @see #linearCombination(Object, Object, Object, Object, Object, Object)
+     * @see #linearCombination(Object, Object, Object, Object, Object, Object, Object, Object)
+     * @since 3.2
+     */
+    T linearCombination(T a1, T b1, T a2, T b2);
+
+    /**
+     * Compute a linear combination.
+     * @param a1 first factor of the first term
+     * @param b1 second factor of the first term
+     * @param a2 first factor of the second term
+     * @param b2 second factor of the second term
+     * @return a<sub>1</sub>&times;b<sub>1</sub> +
+     * a<sub>2</sub>&times;b<sub>2</sub>
+     * @see #linearCombination(double, Object, double, Object, double, Object)
+     * @see #linearCombination(double, Object, double, Object, double, Object, double, Object)
+     * @since 3.2
+     */
+    T linearCombination(double a1, T b1, double a2, T b2);
+
+    /**
+     * Compute a linear combination.
+     * @param a1 first factor of the first term
+     * @param b1 second factor of the first term
+     * @param a2 first factor of the second term
+     * @param b2 second factor of the second term
+     * @param a3 first factor of the third term
+     * @param b3 second factor of the third term
+     * @return a<sub>1</sub>&times;b<sub>1</sub> +
+     * a<sub>2</sub>&times;b<sub>2</sub> + a<sub>3</sub>&times;b<sub>3</sub>
+     * @see #linearCombination(Object, Object, Object, Object)
+     * @see #linearCombination(Object, Object, Object, Object, Object, Object, Object, Object)
+     * @since 3.2
+     */
+    T linearCombination(T a1, T b1, T a2, T b2, T a3, T b3);
+
+    /**
+     * Compute a linear combination.
+     * @param a1 first factor of the first term
+     * @param b1 second factor of the first term
+     * @param a2 first factor of the second term
+     * @param b2 second factor of the second term
+     * @param a3 first factor of the third term
+     * @param b3 second factor of the third term
+     * @return a<sub>1</sub>&times;b<sub>1</sub> +
+     * a<sub>2</sub>&times;b<sub>2</sub> + a<sub>3</sub>&times;b<sub>3</sub>
+     * @see #linearCombination(double, Object, double, Object)
+     * @see #linearCombination(double, Object, double, Object, double, Object, double, Object)
+     * @since 3.2
+     */
+    T linearCombination(double a1, T b1,  double a2, T b2, double a3, T b3);
+
+    /**
+     * Compute a linear combination.
+     * @param a1 first factor of the first term
+     * @param b1 second factor of the first term
+     * @param a2 first factor of the second term
+     * @param b2 second factor of the second term
+     * @param a3 first factor of the third term
+     * @param b3 second factor of the third term
+     * @param a4 first factor of the third term
+     * @param b4 second factor of the third term
+     * @return a<sub>1</sub>&times;b<sub>1</sub> +
+     * a<sub>2</sub>&times;b<sub>2</sub> + a<sub>3</sub>&times;b<sub>3</sub> +
+     * a<sub>4</sub>&times;b<sub>4</sub>
+     * @see #linearCombination(Object, Object, Object, Object)
+     * @see #linearCombination(Object, Object, Object, Object, Object, Object)
+     * @since 3.2
+     */
+    T linearCombination(T a1, T b1, T a2, T b2, T a3, T b3, T a4, T b4);
+
+    /**
+     * Compute a linear combination.
+     * @param a1 first factor of the first term
+     * @param b1 second factor of the first term
+     * @param a2 first factor of the second term
+     * @param b2 second factor of the second term
+     * @param a3 first factor of the third term
+     * @param b3 second factor of the third term
+     * @param a4 first factor of the third term
+     * @param b4 second factor of the third term
+     * @return a<sub>1</sub>&times;b<sub>1</sub> +
+     * a<sub>2</sub>&times;b<sub>2</sub> + a<sub>3</sub>&times;b<sub>3</sub> +
+     * a<sub>4</sub>&times;b<sub>4</sub>
+     * @see #linearCombination(double, Object, double, Object)
+     * @see #linearCombination(double, Object, double, Object, double, Object)
+     * @since 3.2
+     */
+    T linearCombination(double a1, T b1, double a2, T b2, double a3, T b3, double a4, T b4);
+
+}
diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/BivariateFunction.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/BivariateFunction.java
new file mode 100644
index 0000000..19b5383
--- /dev/null
+++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/BivariateFunction.java
@@ -0,0 +1,35 @@
+/*
+ * 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.legacy.analysis;
+
+/**
+ * An interface representing a bivariate real function.
+ *
+ * @since 2.1
+ */
+public interface BivariateFunction {
+    /**
+     * Compute the value for the function.
+     *
+     * @param x Abscissa for which the function value should be computed.
+     * @param y Ordinate for which the function value should be computed.
+     * @return the value.
+     */
+    double value(double x, double y);
+
+}
diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/FunctionUtils.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/FunctionUtils.java
new file mode 100644
index 0000000..6f0e550
--- /dev/null
+++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/FunctionUtils.java
@@ -0,0 +1,544 @@
+/*
+ * 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.legacy.analysis;
+
+import org.apache.commons.numbers.arrays.LinearCombination;
+import org.apache.commons.math4.legacy.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.legacy.analysis.differentiation.MultivariateDifferentiableFunction;
+import org.apache.commons.math4.legacy.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.legacy.analysis.function.Identity;
+import org.apache.commons.math4.legacy.exception.DimensionMismatchException;
+import org.apache.commons.math4.legacy.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.legacy.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.legacy.exception.util.LocalizedFormats;
+
+/**
+ * Utilities for manipulating function objects.
+ *
+ * @since 3.0
+ */
+public class FunctionUtils {
+    /**
+     * Class only contains static methods.
+     */
+    private FunctionUtils() {}
+
+    /**
+     * Composes functions.
+     * <p>
+     * The functions in the argument list are composed sequentially, in the
+     * given order.  For example, compose(f1,f2,f3) acts like f1(f2(f3(x))).</p>
+     *
+     * @param f List of functions.
+     * @return the composite function.
+     */
+    public static UnivariateFunction compose(final UnivariateFunction ... f) {
+        return new UnivariateFunction() {
+            /** {@inheritDoc} */
+            @Override
+            public double value(double x) {
+                double r = x;
+                for (int i = f.length - 1; i >= 0; i--) {
+                    r = f[i].value(r);
+                }
+                return r;
+            }
+        };
+    }
+
+    /**
+     * Composes functions.
+     * <p>
+     * The functions in the argument list are composed sequentially, in the
+     * given order.  For example, compose(f1,f2,f3) acts like f1(f2(f3(x))).</p>
+     *
+     * @param f List of functions.
+     * @return the composite function.
+     * @since 3.1
+     */
+    public static UnivariateDifferentiableFunction compose(final UnivariateDifferentiableFunction ... f) {
+        return new UnivariateDifferentiableFunction() {
+
+            /** {@inheritDoc} */
+            @Override
+            public double value(final double t) {
+                double r = t;
+                for (int i = f.length - 1; i >= 0; i--) {
+                    r = f[i].value(r);
+                }
+                return r;
+            }
+
+            /** {@inheritDoc} */
+            @Override
+            public DerivativeStructure value(final DerivativeStructure t) {
+                DerivativeStructure r = t;
+                for (int i = f.length - 1; i >= 0; i--) {
+                    r = f[i].value(r);
+                }
+                return r;
+            }
+
+        };
+    }
+
+    /**
+     * Adds functions.
+     *
+     * @param f List of functions.
+     * @return a function that computes the sum of the functions.
+     */
+    public static UnivariateFunction add(final UnivariateFunction ... f) {
+        return new UnivariateFunction() {
+            /** {@inheritDoc} */
+            @Override
+            public double value(double x) {
+                double r = f[0].value(x);
+                for (int i = 1; i < f.length; i++) {
+                    r += f[i].value(x);
+                }
+                return r;
+            }
+        };
+    }
+
+    /**
+     * Adds functions.
+     *
+     * @param f List of functions.
+     * @return a function that computes the sum of the functions.
+     * @since 3.1
+     */
+    public static UnivariateDifferentiableFunction add(final UnivariateDifferentiableFunction ... f) {
+        return new UnivariateDifferentiableFunction() {
+
+            /** {@inheritDoc} */
+            @Override
+            public double value(final double t) {
+                double r = f[0].value(t);
+                for (int i = 1; i < f.length; i++) {
+                    r += f[i].value(t);
+                }
+                return r;
+            }
+
+            /** {@inheritDoc}
+             * @throws DimensionMismatchException if functions are not consistent with each other
+             */
+            @Override
+            public DerivativeStructure value(final DerivativeStructure t)
+                throws DimensionMismatchException {
+                DerivativeStructure r = f[0].value(t);
+                for (int i = 1; i < f.length; i++) {
+                    r = r.add(f[i].value(t));
+                }
+                return r;
+            }
+
+        };
+    }
+
+    /**
+     * Multiplies functions.
+     *
+     * @param f List of functions.
+     * @return a function that computes the product of the functions.
+     */
+    public static UnivariateFunction multiply(final UnivariateFunction ... f) {
+        return new UnivariateFunction() {
+            /** {@inheritDoc} */
+            @Override
+            public double value(double x) {
+                double r = f[0].value(x);
+                for (int i = 1; i < f.length; i++) {
+                    r *= f[i].value(x);
+                }
+                return r;
+            }
+        };
+    }
+
+    /**
+     * Multiplies functions.
+     *
+     * @param f List of functions.
+     * @return a function that computes the product of the functions.
+     * @since 3.1
+     */
+    public static UnivariateDifferentiableFunction multiply(final UnivariateDifferentiableFunction ... f) {
+        return new UnivariateDifferentiableFunction() {
+
+            /** {@inheritDoc} */
+            @Override
+            public double value(final double t) {
+                double r = f[0].value(t);
+                for (int i = 1; i < f.length; i++) {
+                    r  *= f[i].value(t);
+                }
+                return r;
+            }
+
+            /** {@inheritDoc} */
+            @Override
+            public DerivativeStructure value(final DerivativeStructure t) {
+                DerivativeStructure r = f[0].value(t);
+                for (int i = 1; i < f.length; i++) {
+                    r = r.multiply(f[i].value(t));
+                }
+                return r;
+            }
+
+        };
+    }
+
+    /**
+     * Returns the univariate function
+     * {@code h(x) = combiner(f(x), g(x)).}
+     *
+     * @param combiner Combiner function.
+     * @param f Function.
+     * @param g Function.
+     * @return the composite function.
+     */
+    public static UnivariateFunction combine(final BivariateFunction combiner,
+                                             final UnivariateFunction f,
+                                             final UnivariateFunction g) {
+        return new UnivariateFunction() {
+            /** {@inheritDoc} */
+            @Override
+            public double value(double x) {
+                return combiner.value(f.value(x), g.value(x));
+            }
+        };
+    }
+
+    /**
+     * Returns a MultivariateFunction h(x[]) defined by <pre> <code>
+     * h(x[]) = combiner(...combiner(combiner(initialValue,f(x[0])),f(x[1]))...),f(x[x.length-1]))
+     * </code></pre>
+     *
+     * @param combiner Combiner function.
+     * @param f Function.
+     * @param initialValue Initial value.
+     * @return a collector function.
+     */
+    public static MultivariateFunction collector(final BivariateFunction combiner,
+                                                 final UnivariateFunction f,
+                                                 final double initialValue) {
+        return new MultivariateFunction() {
+            /** {@inheritDoc} */
+            @Override
+            public double value(double[] point) {
+                double result = combiner.value(initialValue, f.value(point[0]));
+                for (int i = 1; i < point.length; i++) {
+                    result = combiner.value(result, f.value(point[i]));
+                }
+                return result;
+            }
+        };
+    }
+
+    /**
+     * Returns a MultivariateFunction h(x[]) defined by <pre> <code>
+     * h(x[]) = combiner(...combiner(combiner(initialValue,x[0]),x[1])...),x[x.length-1])
+     * </code></pre>
+     *
+     * @param combiner Combiner function.
+     * @param initialValue Initial value.
+     * @return a collector function.
+     */
+    public static MultivariateFunction collector(final BivariateFunction combiner,
+                                                 final double initialValue) {
+        return collector(combiner, new Identity(), initialValue);
+    }
+
+    /**
+     * Creates a unary function by fixing the first argument of a binary function.
+     *
+     * @param f Binary function.
+     * @param fixed value to which the first argument of {@code f} is set.
+     * @return the unary function h(x) = f(fixed, x)
+     */
+    public static UnivariateFunction fix1stArgument(final BivariateFunction f,
+                                                    final double fixed) {
+        return new UnivariateFunction() {
+            /** {@inheritDoc} */
+            @Override
+            public double value(double x) {
+                return f.value(fixed, x);
+            }
+        };
+    }
+    /**
+     * Creates a unary function by fixing the second argument of a binary function.
+     *
+     * @param f Binary function.
+     * @param fixed value to which the second argument of {@code f} is set.
+     * @return the unary function h(x) = f(x, fixed)
+     */
+    public static UnivariateFunction fix2ndArgument(final BivariateFunction f,
+                                                    final double fixed) {
+        return new UnivariateFunction() {
+            /** {@inheritDoc} */
+            @Override
+            public double value(double x) {
+                return f.value(x, fixed);
+            }
+        };
+    }
+
+    /**
+     * Samples the specified univariate real function on the specified interval.
+     * <p>
+     * The interval is divided equally into {@code n} sections and sample points
+     * are taken from {@code min} to {@code max - (max - min) / n}; therefore
+     * {@code f} is not sampled at the upper bound {@code max}.</p>
+     *
+     * @param f Function to be sampled
+     * @param min Lower bound of the interval (included).
+     * @param max Upper bound of the interval (excluded).
+     * @param n Number of sample points.
+     * @return the array of samples.
+     * @throws NumberIsTooLargeException if the lower bound {@code min} is
+     * greater than, or equal to the upper bound {@code max}.
+     * @throws NotStrictlyPositiveException if the number of sample points
+     * {@code n} is negative.
+     */
+    public static double[] sample(UnivariateFunction f, double min, double max, int n)
+       throws NumberIsTooLargeException, NotStrictlyPositiveException {
+
+        if (n <= 0) {
+            throw new NotStrictlyPositiveException(
+                    LocalizedFormats.NOT_POSITIVE_NUMBER_OF_SAMPLES,
+                    Integer.valueOf(n));
+        }
+        if (min >= max) {
+            throw new NumberIsTooLargeException(min, max, false);
+        }
+
+        final double[] s = new double[n];
+        final double h = (max - min) / n;
+        for (int i = 0; i < n; i++) {
+            s[i] = f.value(min + i * h);
+        }
+        return s;
+    }
+
+    /** Convert regular functions to {@link UnivariateDifferentiableFunction}.
+     * <p>
+     * This method handle the case with one free parameter and several derivatives.
+     * For the case with several free parameters and only first order derivatives,
+     * see {@link #toDifferentiable(MultivariateFunction, MultivariateVectorFunction)}.
+     * There are no direct support for intermediate cases, with several free parameters
+     * and order 2 or more derivatives, as is would be difficult to specify all the
+     * cross derivatives.
+     * </p>
+     * <p>
+     * Note that the derivatives are expected to be computed only with respect to the
+     * raw parameter x of the base function, i.e. they are df/dx, df<sup>2</sup>/dx<sup>2</sup>, ...
+     * Even if the built function is later used in a composition like f(sin(t)), the provided
+     * derivatives should <em>not</em> apply the composition with sine and its derivatives by
+     * themselves. The composition will be done automatically here and the result will properly
+     * contain f(sin(t)), df(sin(t))/dt, df<sup>2</sup>(sin(t))/dt<sup>2</sup> despite the
+     * provided derivatives functions know nothing about the sine function.
+     * </p>
+     * @param f base function f(x)
+     * @param derivatives derivatives of the base function, in increasing differentiation order
+     * @return a differentiable function with value and all specified derivatives
+     * @see #toDifferentiable(MultivariateFunction, MultivariateVectorFunction)
+     * @see #derivative(UnivariateDifferentiableFunction, int)
+     */
+    public static UnivariateDifferentiableFunction toDifferentiable(final UnivariateFunction f,
+                                                                       final UnivariateFunction ... derivatives) {
+
+        return new UnivariateDifferentiableFunction() {
+
+            /** {@inheritDoc} */
+            @Override
+            public double value(final double x) {
+                return f.value(x);
+            }
+
+            /** {@inheritDoc} */
+            @Override
+            public DerivativeStructure value(final DerivativeStructure x) {
+                if (x.getOrder() > derivatives.length) {
+                    throw new NumberIsTooLargeException(x.getOrder(), derivatives.length, true);
+                }
+                final double[] packed = new double[x.getOrder() + 1];
+                packed[0] = f.value(x.getValue());
+                for (int i = 0; i < x.getOrder(); ++i) {
+                    packed[i + 1] = derivatives[i].value(x.getValue());
+                }
+                return x.compose(packed);
+            }
+
+        };
+
+    }
+
+    /** Convert regular functions to {@link MultivariateDifferentiableFunction}.
+     * <p>
+     * This method handle the case with several free parameters and only first order derivatives.
+     * For the case with one free parameter and several derivatives,
+     * see {@link #toDifferentiable(UnivariateFunction, UnivariateFunction...)}.
+     * There are no direct support for intermediate cases, with several free parameters
+     * and order 2 or more derivatives, as is would be difficult to specify all the
+     * cross derivatives.
+     * </p>
+     * <p>
+     * Note that the gradient is expected to be computed only with respect to the
+     * raw parameter x of the base function, i.e. it is df/dx<sub>1</sub>, df/dx<sub>2</sub>, ...
+     * Even if the built function is later used in a composition like f(sin(t), cos(t)), the provided
+     * gradient should <em>not</em> apply the composition with sine or cosine and their derivative by
+     * itself. The composition will be done automatically here and the result will properly
+     * contain f(sin(t), cos(t)), df(sin(t), cos(t))/dt despite the provided derivatives functions
+     * know nothing about the sine or cosine functions.
+     * </p>
+     * @param f base function f(x)
+     * @param gradient gradient of the base function
+     * @return a differentiable function with value and gradient
+     * @see #toDifferentiable(UnivariateFunction, UnivariateFunction...)
+     * @see #derivative(MultivariateDifferentiableFunction, int[])
+     */
+    public static MultivariateDifferentiableFunction toDifferentiable(final MultivariateFunction f,
+                                                                         final MultivariateVectorFunction gradient) {
+
+        return new MultivariateDifferentiableFunction() {
+
+            /** {@inheritDoc} */
+            @Override
+            public double value(final double[] point) {
+                return f.value(point);
+            }
+
+            /** {@inheritDoc} */
+            @Override
+            public DerivativeStructure value(final DerivativeStructure[] point) {
+
+                // set up the input parameters
+                final double[] dPoint = new double[point.length];
+                for (int i = 0; i < point.length; ++i) {
+                    dPoint[i] = point[i].getValue();
+                    if (point[i].getOrder() > 1) {
+                        throw new NumberIsTooLargeException(point[i].getOrder(), 1, true);
+                    }
+                }
+
+                // evaluate regular functions
+                final double    v = f.value(dPoint);
+                final double[] dv = gradient.value(dPoint);
+                if (dv.length != point.length) {
+                    // the gradient function is inconsistent
+                    throw new DimensionMismatchException(dv.length, point.length);
+                }
+
+                // build the combined derivative
+                final int parameters = point[0].getFreeParameters();
+                final double[] partials = new double[point.length];
+                final double[] packed = new double[parameters + 1];
+                packed[0] = v;
+                final int orders[] = new int[parameters];
+                for (int i = 0; i < parameters; ++i) {
+
+                    // we differentiate once with respect to parameter i
+                    orders[i] = 1;
+                    for (int j = 0; j < point.length; ++j) {
+                        partials[j] = point[j].getPartialDerivative(orders);
+                    }
+                    orders[i] = 0;
+
+                    // compose partial derivatives
+                    packed[i + 1] = LinearCombination.value(dv, partials);
+
+                }
+
+                return new DerivativeStructure(parameters, 1, packed);
+
+            }
+
+        };
+
+    }
+
+    /** Convert an {@link UnivariateDifferentiableFunction} to an
+     * {@link UnivariateFunction} computing n<sup>th</sup> order derivative.
+     * <p>
+     * This converter is only a convenience method. Beware computing only one derivative does
+     * not save any computation as the original function will really be called under the hood.
+     * The derivative will be extracted from the full {@link DerivativeStructure} result.
+     * </p>
+     * @param f original function, with value and all its derivatives
+     * @param order of the derivative to extract
+     * @return function computing the derivative at required order
+     * @see #derivative(MultivariateDifferentiableFunction, int[])
+     * @see #toDifferentiable(UnivariateFunction, UnivariateFunction...)
+     */
+    public static UnivariateFunction derivative(final UnivariateDifferentiableFunction f, final int order) {
+        return new UnivariateFunction() {
+
+            /** {@inheritDoc} */
+            @Override
+            public double value(final double x) {
+                final DerivativeStructure dsX = new DerivativeStructure(1, order, 0, x);
+                return f.value(dsX).getPartialDerivative(order);
+            }
+
+        };
+    }
+
+    /** Convert an {@link MultivariateDifferentiableFunction} to an
+     * {@link MultivariateFunction} computing n<sup>th</sup> order derivative.
+     * <p>
+     * This converter is only a convenience method. Beware computing only one derivative does
+     * not save any computation as the original function will really be called under the hood.
+     * The derivative will be extracted from the full {@link DerivativeStructure} result.
+     * </p>
+     * @param f original function, with value and all its derivatives
+     * @param orders of the derivative to extract, for each free parameters
+     * @return function computing the derivative at required order
+     * @see #derivative(UnivariateDifferentiableFunction, int)
+     * @see #toDifferentiable(MultivariateFunction, MultivariateVectorFunction)
+     */
+    public static MultivariateFunction derivative(final MultivariateDifferentiableFunction f, final int[] orders) {
+        return new MultivariateFunction() {
+
+            /** {@inheritDoc} */
+            @Override
+            public double value(final double[] point) {
+
+                // the maximum differentiation order is the sum of all orders
+                int sumOrders = 0;
+                for (final int order : orders) {
+                    sumOrders += order;
+                }
+
+                // set up the input parameters
+                final DerivativeStructure[] dsPoint = new DerivativeStructure[point.length];
+                for (int i = 0; i < point.length; ++i) {
+                    dsPoint[i] = new DerivativeStructure(point.length, sumOrders, i, point[i]);
+                }
+
+                return f.value(dsPoint).getPartialDerivative(orders);
+
+            }
+
+        };
+    }
+
+}
diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/MultivariateFunction.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/MultivariateFunction.java
new file mode 100644
index 0000000..9809217
--- /dev/null
+++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/MultivariateFunction.java
@@ -0,0 +1,42 @@
+/*
+ * 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.legacy.analysis;
+
+/**
+ * An interface representing a multivariate real function.
+ *
+ * @since 2.0
+ */
+public interface MultivariateFunction {
+
+    /**
+     * Compute the value for the function at the given point.
+     *
+     * @param point Point at which the function must be evaluated.
+     * @return the function value for the given point.
+     * @throws org.apache.commons.math4.legacy.exception.DimensionMismatchException
+     * if the parameter's dimension is wrong for the function being evaluated.
+     * @throws  org.apache.commons.math4.legacy.exception.MathIllegalArgumentException
+     * when the activated method itself can ascertain that preconditions,
+     * specified in the API expressed at the level of the activated method,
+     * have been violated.  In the vast majority of cases where Commons Math
+     * throws this exception, it is the result of argument checking of actual
+     * parameters immediately passed to a method.
+     */
+    double value(double[] point);
+}
diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/MultivariateMatrixFunction.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/MultivariateMatrixFunction.java
new file mode 100644
index 0000000..1d1ba59
--- /dev/null
+++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/MultivariateMatrixFunction.java
@@ -0,0 +1,35 @@
+/*
+ * 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.legacy.analysis;
+
+/**
+ * An interface representing a multivariate matrix function.
+ * @since 2.0
+ */
+public interface MultivariateMatrixFunction {
+
+    /**
+     * Compute the value for the function at the given point.
+     * @param point point at which the function must be evaluated
+     * @return function value for the given point
+     * @exception IllegalArgumentException if point's dimension is wrong
+     */
+    double[][] value(double[] point)
+        throws IllegalArgumentException;
+
+}
diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/MultivariateVectorFunction.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/MultivariateVectorFunction.java
new file mode 100644
index 0000000..2e2d41c
--- /dev/null
+++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/MultivariateVectorFunction.java
@@ -0,0 +1,35 @@
+/*
+ * 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.legacy.analysis;
+
+/**
+ * An interface representing a multivariate vectorial function.
+ * @since 2.0
+ */
+public interface MultivariateVectorFunction {
+
+    /**
+     * Compute the value for the function at the given point.
+     * @param point point at which the function must be evaluated
+     * @return function value for the given point
+     * @exception IllegalArgumentException if point's dimension is wrong
+     */
+    double[] value(double[] point)
+        throws IllegalArgumentException;
+
+}
diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/ParametricUnivariateFunction.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/ParametricUnivariateFunction.java
new file mode 100644
index 0000000..dca2be9
--- /dev/null
+++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/ParametricUnivariateFunction.java
@@ -0,0 +1,44 @@
+/*
+ * 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.legacy.analysis;
+
+/**
+ * An interface representing a real function that depends on one independent
+ * variable plus some extra parameters.
+ *
+ * @since 3.0
+ */
+public interface ParametricUnivariateFunction {
+    /**
+     * Compute the value of the function.
+     *
+     * @param x Point for which the function value should be computed.
+     * @param parameters Function parameters.
+     * @return the value.
+     */
+    double value(double x, double ... parameters);
+
+    /**
+     * Compute the gradient of the function with respect to its parameters.
+     *
+     * @param x Point for which the function value should be computed.
+     * @param parameters Function parameters.
+     * @return the value.
+     */
+    double[] gradient(double x, double ... parameters);
+}
diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/RealFieldUnivariateFunction.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/RealFieldUnivariateFunction.java
new file mode 100644
index 0000000..e08744c
--- /dev/null
+++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/RealFieldUnivariateFunction.java
@@ -0,0 +1,86 @@
+/*
+ * 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.legacy.analysis;
+
+import org.apache.commons.math4.legacy.RealFieldElement;
+
+/**
+ * An interface representing a univariate real function.
+ * <p>
+ * When a <em>user-defined</em> function encounters an error during
+ * evaluation, the {@link #value(RealFieldElement) value} method should throw a
+ * <em>user-defined</em> unchecked exception.</p>
+ * <p>
+ * The following code excerpt shows the recommended way to do that using
+ * a root solver as an example, but the same construct is applicable to
+ * ODE integrators or optimizers.
+ *
+ * <pre>
+ * private static class LocalException extends RuntimeException {
+ *     // The x value that caused the problem.
+ *     private final SomeFieldType x;
+ *
+ *     public LocalException(SomeFieldType x) {
+ *         this.x = x;
+ *     }
+ *
+ *     public double getX() {
+ *         return x;
+ *     }
+ * }
+ *
+ * private static class MyFunction implements FieldUnivariateFunction&lt;SomeFieldType&gt; {
+ *     public SomeFieldType value(SomeFieldType x) {
+ *         SomeFieldType y = hugeFormula(x);
+ *         if (somethingBadHappens) {
+ *           throw new LocalException(x);
+ *         }
+ *         return y;
+ *     }
+ * }
+ *
+ * public void compute() {
+ *     try {
+ *         solver.solve(maxEval, new MyFunction(a, b, c), min, max);
+ *     } catch (LocalException le) {
+ *         // Retrieve the x value.
+ *     }
+ * }
+ * </pre>
+ *<p>
+ * As shown, the exception is local to the user's code and it is guaranteed
+ * that Apache Commons Math will not catch it.</p>
+ *
+ * @param <T> the type of the field elements
+ * @since 3.6
+ * @see UnivariateFunction
+ */
+public interface RealFieldUnivariateFunction<T extends RealFieldElement<T>> {
+    /**
+     * Compute the value of the function.
+     *
+     * @param x Point at which the function value should be computed.
+     * @return the value of the function.
+     * @throws IllegalArgumentException when the activated method itself can
+     * ascertain that a precondition, specified in the API expressed at the
+     * level of the activated method, has been violated.
+     * When Commons Math throws an {@code IllegalArgumentException}, it is
+     * usually the consequence of checking the actual parameters passed to
+     * the method.
+     */
+    T value(T x);
+}
diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/TrivariateFunction.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/TrivariateFunction.java
new file mode 100644
index 0000000..351018f
--- /dev/null
+++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/TrivariateFunction.java
@@ -0,0 +1,35 @@
+/*
+ * 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.legacy.analysis;
+
+/**
+ * An interface representing a trivariate real function.
+ *
+ * @since 2.2
+ */
+public interface TrivariateFunction {
+    /**
+     * Compute the value for the function.
+     *
+     * @param x x-coordinate for which the function value should be computed.
+     * @param y y-coordinate for which the function value should be computed.
+     * @param z z-coordinate for which the function value should be computed.
+     * @return the value.
+     */
+    double value(double x, double y, double z);
+}
diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/UnivariateFunction.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/UnivariateFunction.java
new file mode 100644
index 0000000..ff66cbb
--- /dev/null
+++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/UnivariateFunction.java
@@ -0,0 +1,81 @@
+/*
+ * 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.legacy.analysis;
+
+/**
+ * An interface representing a univariate real function.
+ * <p>
+ * When a <em>user-defined</em> function encounters an error during
+ * evaluation, the {@link #value(double) value} method should throw a
+ * <em>user-defined</em> unchecked exception.</p>
+ * <p>
+ * The following code excerpt shows the recommended way to do that using
+ * a root solver as an example, but the same construct is applicable to
+ * ODE integrators or optimizers.</p>
+ *
+ * <pre>
+ * private static class LocalException extends RuntimeException {
+ *     // The x value that caused the problem.
+ *     private final double x;
+ *
+ *     public LocalException(double x) {
+ *         this.x = x;
+ *     }
+ *
+ *     public double getX() {
+ *         return x;
+ *     }
+ * }
+ *
+ * private static class MyFunction implements UnivariateFunction {
+ *     public double value(double x) {
+ *         double y = hugeFormula(x);
+ *         if (somethingBadHappens) {
+ *           throw new LocalException(x);
+ *         }
+ *         return y;
+ *     }
+ * }
+ *
+ * public void compute() {
+ *     try {
+ *         solver.solve(maxEval, new MyFunction(a, b, c), min, max);
+ *     } catch (LocalException le) {
+ *         // Retrieve the x value.
+ *     }
+ * }
+ * </pre>
+ *
+ * As shown, the exception is local to the user's code and it is guaranteed
+ * that Apache Commons Math will not catch it.
+ *
+ */
+public interface UnivariateFunction {
+    /**
+     * Compute the value of the function.
+     *
+     * @param x Point at which the function value should be computed.
+     * @return the value of the function.
+     * @throws IllegalArgumentException when the activated method itself can
+     * ascertain that a precondition, specified in the API expressed at the
+     * level of the activated method, has been violated.
+     * When Commons Math throws an {@code IllegalArgumentException}, it is
+     * usually the consequence of checking the actual parameters passed to
+     * the method.
+     */
+    double value(double x);
+}
diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/UnivariateMatrixFunction.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/UnivariateMatrixFunction.java
new file mode 100644
index 0000000..ab5282e
--- /dev/null
+++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/UnivariateMatrixFunction.java
@@ -0,0 +1,33 @@
+/*
+ * 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.legacy.analysis;
+
+/**
+ * An interface representing a univariate matrix function.
+ *
+ * @since 2.0
+ */
+public interface UnivariateMatrixFunction {
+
+    /**
+     * Compute the value for the function.
+     * @param x the point for which the function value should be computed
+     * @return the value
+     */
+    double[][] value(double x);
+
+}
diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/UnivariateVectorFunction.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/UnivariateVectorFunction.java
new file mode 100644
index 0000000..1688b1c
--- /dev/null
+++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/UnivariateVectorFunction.java
@@ -0,0 +1,33 @@
+/*
+ * 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.legacy.analysis;
+
+/**
+ * An interface representing a univariate vectorial function.
+ *
+ * @since 2.0
+ */
+public interface UnivariateVectorFunction {
+
+    /**
+     * Compute the value for the function.
+     * @param x the point for which the function value should be computed
+     * @return the value
+     */
+    double[] value(double x);
+
+}
diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/differentiation/DSCompiler.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/differentiation/DSCompiler.java
new file mode 100644
index 0000000..6310c1f
--- /dev/null
+++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/differentiation/DSCompiler.java
@@ -0,0 +1,1834 @@
+/*
+ * 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.legacy.analysis.differentiation;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.apache.commons.numbers.arrays.LinearCombination;
+import org.apache.commons.math4.legacy.exception.DimensionMismatchException;
+import org.apache.commons.math4.legacy.exception.MathArithmeticException;
+import org.apache.commons.math4.legacy.exception.MathInternalError;
+import org.apache.commons.math4.legacy.exception.NotPositiveException;
+import org.apache.commons.math4.legacy.exception.NumberIsTooLargeException;
+import org.apache.commons.numbers.combinatorics.FactorialDouble;
+import org.apache.commons.math4.legacy.util.FastMath;
+
+/** Class holding "compiled" computation rules for derivative structures.
+ * <p>This class implements the computation rules described in Dan Kalman's paper <a
+ * href="http://www1.american.edu/cas/mathstat/People/kalman/pdffiles/mmgautodiff.pdf">Doubly
+ * Recursive Multivariate Automatic Differentiation</a>, Mathematics Magazine, vol. 75,
+ * no. 3, June 2002. However, in order to avoid performances bottlenecks, the recursive
+ * rules are "compiled" once in an unfold form. This class does this recursion unrolling
+ * and stores the computation rules as simple loops with pre-computed indirection arrays.</p>
+ * <p>
+ * This class maps all derivative computation into single dimension arrays that hold the
+ * value and partial derivatives. The class does not hold these arrays, which remains under
+ * the responsibility of the caller. For each combination of number of free parameters and
+ * derivation order, only one compiler is necessary, and this compiler will be used to
+ * perform computations on all arrays provided to it, which can represent hundreds or
+ * thousands of different parameters kept together with all their partial derivatives.
+ * </p>
+ * <p>
+ * The arrays on which compilers operate contain only the partial derivatives together
+ * with the 0<sup>th</sup> derivative, i.e. the value. The partial derivatives are stored in
+ * a compiler-specific order, which can be retrieved using methods {@link
+ * #getPartialDerivativeIndex(int...) getPartialDerivativeIndex} and {@link
+ * #getPartialDerivativeOrders(int)}. The value is guaranteed to be stored as the first element
+ * (i.e. the {@link #getPartialDerivativeIndex(int...) getPartialDerivativeIndex} method returns
+ * 0 when called with 0 for all derivation orders and {@link #getPartialDerivativeOrders(int)
+ * getPartialDerivativeOrders} returns an array filled with 0 when called with 0 as the index).
+ * </p>
+ * <p>
+ * Note that the ordering changes with number of parameters and derivation order. For example
+ * given 2 parameters x and y, df/dy is stored at index 2 when derivation order is set to 1 (in
+ * this case the array has three elements: f, df/dx and df/dy). If derivation order is set to
+ * 2, then df/dy will be stored at index 3 (in this case the array has six elements: f, df/dx,
+ * df/dxdx, df/dy, df/dxdy and df/dydy).
+ * </p>
+ * <p>
+ * Given this structure, users can perform some simple operations like adding, subtracting
+ * or multiplying constants and negating the elements by themselves, knowing if they want to
+ * mutate their array or create a new array. These simple operations are not provided by
+ * the compiler. The compiler provides only the more complex operations between several arrays.
+ * </p>
+ * <p>This class is mainly used as the engine for scalar variable {@link DerivativeStructure}.
+ * It can also be used directly to hold several variables in arrays for more complex data
+ * structures. User can for example store a vector of n variables depending on three x, y
+ * and z free parameters in one array as follows:</p> <pre>
+ *   // parameter 0 is x, parameter 1 is y, parameter 2 is z
+ *   int parameters = 3;
+ *   DSCompiler compiler = DSCompiler.getCompiler(parameters, order);
+ *   int size = compiler.getSize();
+ *
+ *   // pack all elements in a single array
+ *   double[] array = new double[n * size];
+ *   for (int i = 0; i &lt; n; ++i) {
+ *
+ *     // we know value is guaranteed to be the first element
+ *     array[i * size] = v[i];
+ *
+ *     // we don't know where first derivatives are stored, so we ask the compiler
+ *     array[i * size + compiler.getPartialDerivativeIndex(1, 0, 0) = dvOnDx[i][0];
+ *     array[i * size + compiler.getPartialDerivativeIndex(0, 1, 0) = dvOnDy[i][0];
+ *     array[i * size + compiler.getPartialDerivativeIndex(0, 0, 1) = dvOnDz[i][0];
+ *
+ *     // we let all higher order derivatives set to 0
+ *
+ *   }
+ * </pre>
+ * <p>Then in another function, user can perform some operations on all elements stored
+ * in the single array, such as a simple product of all variables:</p> <pre>
+ *   // compute the product of all elements
+ *   double[] product = new double[size];
+ *   prod[0] = 1.0;
+ *   for (int i = 0; i &lt; n; ++i) {
+ *     double[] tmp = product.clone();
+ *     compiler.multiply(tmp, 0, array, i * size, product, 0);
+ *   }
+ *
+ *   // value
+ *   double p = product[0];
+ *
+ *   // first derivatives
+ *   double dPdX = product[compiler.getPartialDerivativeIndex(1, 0, 0)];
+ *   double dPdY = product[compiler.getPartialDerivativeIndex(0, 1, 0)];
+ *   double dPdZ = product[compiler.getPartialDerivativeIndex(0, 0, 1)];
+ *
+ *   // cross derivatives (assuming order was at least 2)
+ *   double dPdXdX = product[compiler.getPartialDerivativeIndex(2, 0, 0)];
+ *   double dPdXdY = product[compiler.getPartialDerivativeIndex(1, 1, 0)];
+ *   double dPdXdZ = product[compiler.getPartialDerivativeIndex(1, 0, 1)];
+ *   double dPdYdY = product[compiler.getPartialDerivativeIndex(0, 2, 0)];
+ *   double dPdYdZ = product[compiler.getPartialDerivativeIndex(0, 1, 1)];
+ *   double dPdZdZ = product[compiler.getPartialDerivativeIndex(0, 0, 2)];
+ * </pre>
+ * @see DerivativeStructure
+ * @since 3.1
+ */
+public class DSCompiler {
+    /** Cache for factorials. */
+    private static FactorialDouble FACTORIAL = FactorialDouble.create().withCache(30);
+
+    /** Array of all compilers created so far. */
+    private static AtomicReference<DSCompiler[][]> compilers =
+            new AtomicReference<>(null);
+
+    /** Number of free parameters. */
+    private final int parameters;
+
+    /** Derivation order. */
+    private final int order;
+
+    /** Number of partial derivatives (including the single 0 order derivative element). */
+    private final int[][] sizes;
+
+    /** Indirection array for partial derivatives. */
+    private final int[][] derivativesIndirection;
+
+    /** Indirection array of the lower derivative elements. */
+    private final int[] lowerIndirection;
+
+    /** Indirection arrays for multiplication. */
+    private final int[][][] multIndirection;
+
+    /** Indirection arrays for function composition. */
+    private final int[][][] compIndirection;
+
+    /** Private constructor, reserved for the factory method {@link #getCompiler(int, int)}.
+     * @param parameters number of free parameters
+     * @param order derivation order
+     * @param valueCompiler compiler for the value part
+     * @param derivativeCompiler compiler for the derivative part
+     * @throws NumberIsTooLargeException if order is too large
+     */
+    private DSCompiler(final int parameters, final int order,
+                       final DSCompiler valueCompiler, final DSCompiler derivativeCompiler)
+        throws NumberIsTooLargeException {
+
+        this.parameters = parameters;
+        this.order      = order;
+        this.sizes      = compileSizes(parameters, order, valueCompiler);
+        this.derivativesIndirection =
+                compileDerivativesIndirection(parameters, order,
+                                              valueCompiler, derivativeCompiler);
+        this.lowerIndirection =
+                compileLowerIndirection(parameters, order,
+                                        valueCompiler, derivativeCompiler);
+        this.multIndirection =
+                compileMultiplicationIndirection(parameters, order,
+                                                 valueCompiler, derivativeCompiler, lowerIndirection);
+        this.compIndirection =
+                compileCompositionIndirection(parameters, order,
+                                              valueCompiler, derivativeCompiler,
+                                              sizes, derivativesIndirection);
+
+    }
+
+    /** Get the compiler for number of free parameters and order.
+     * @param parameters number of free parameters
+     * @param order derivation order
+     * @return cached rules set
+     * @throws NumberIsTooLargeException if order is too large
+     */
+    public static DSCompiler getCompiler(int parameters, int order)
+        throws NumberIsTooLargeException {
+
+        // get the cached compilers
+        final DSCompiler[][] cache = compilers.get();
+        if (cache != null && cache.length > parameters &&
+            cache[parameters].length > order && cache[parameters][order] != null) {
+            // the compiler has already been created
+            return cache[parameters][order];
+        }
+
+        // we need to create more compilers
+        final int maxParameters = FastMath.max(parameters, cache == null ? 0 : cache.length);
+        final int maxOrder      = FastMath.max(order,     cache == null ? 0 : cache[0].length);
+        final DSCompiler[][] newCache = new DSCompiler[maxParameters + 1][maxOrder + 1];
+
+        if (cache != null) {
+            // preserve the already created compilers
+            for (int i = 0; i < cache.length; ++i) {
+                System.arraycopy(cache[i], 0, newCache[i], 0, cache[i].length);
+            }
+        }
+
+        // create the array in increasing diagonal order
+        for (int diag = 0; diag <= parameters + order; ++diag) {
+            for (int o = FastMath.max(0, diag - parameters); o <= FastMath.min(order, diag); ++o) {
+                final int p = diag - o;
+                if (newCache[p][o] == null) {
+                    final DSCompiler valueCompiler      = (p == 0) ? null : newCache[p - 1][o];
+                    final DSCompiler derivativeCompiler = (o == 0) ? null : newCache[p][o - 1];
+                    newCache[p][o] = new DSCompiler(p, o, valueCompiler, derivativeCompiler);
+                }
+            }
+        }
+
+        // atomically reset the cached compilers array
+        compilers.compareAndSet(cache, newCache);
+
+        return newCache[parameters][order];
+
+    }
+
+    /** Compile the sizes array.
+     * @param parameters number of free parameters
+     * @param order derivation order
+     * @param valueCompiler compiler for the value part
+     * @return sizes array
+     */
+    private static int[][] compileSizes(final int parameters, final int order,
+                                        final DSCompiler valueCompiler) {
+
+        final int[][] sizes = new int[parameters + 1][order + 1];
+        if (parameters == 0) {
+            Arrays.fill(sizes[0], 1);
+        } else {
+            System.arraycopy(valueCompiler.sizes, 0, sizes, 0, parameters);
+            sizes[parameters][0] = 1;
+            for (int i = 0; i < order; ++i) {
+                sizes[parameters][i + 1] = sizes[parameters][i] + sizes[parameters - 1][i + 1];
+            }
+        }
+
+        return sizes;
+
+    }
+
+    /** Compile the derivatives indirection array.
+     * @param parameters number of free parameters
+     * @param order derivation order
+     * @param valueCompiler compiler for the value part
+     * @param derivativeCompiler compiler for the derivative part
+     * @return derivatives indirection array
+     */
+    private static int[][] compileDerivativesIndirection(final int parameters, final int order,
+                                                      final DSCompiler valueCompiler,
+                                                      final DSCompiler derivativeCompiler) {
+
+        if (parameters == 0 || order == 0) {
+            return new int[1][parameters];
+        }
+
+        final int vSize = valueCompiler.derivativesIndirection.length;
+        final int dSize = derivativeCompiler.derivativesIndirection.length;
+        final int[][] derivativesIndirection = new int[vSize + dSize][parameters];
+
+        // set up the indices for the value part
+        for (int i = 0; i < vSize; ++i) {
+            // copy the first indices, the last one remaining set to 0
+            System.arraycopy(valueCompiler.derivativesIndirection[i], 0,
+                             derivativesIndirection[i], 0,
+                             parameters - 1);
+        }
+
+        // set up the indices for the derivative part
+        for (int i = 0; i < dSize; ++i) {
+
+            // copy the indices
+            System.arraycopy(derivativeCompiler.derivativesIndirection[i], 0,
+                             derivativesIndirection[vSize + i], 0,
+                             parameters);
+
+            // increment the derivation order for the last parameter
+            derivativesIndirection[vSize + i][parameters - 1]++;
+
+        }
+
+        return derivativesIndirection;
+
+    }
+
+    /** Compile the lower derivatives indirection array.
+     * <p>
+     * This indirection array contains the indices of all elements
+     * except derivatives for last derivation order.
+     * </p>
+     * @param parameters number of free parameters
+     * @param order derivation order
+     * @param valueCompiler compiler for the value part
+     * @param derivativeCompiler compiler for the derivative part
+     * @return lower derivatives indirection array
+     */
+    private static int[] compileLowerIndirection(final int parameters, final int order,
+                                              final DSCompiler valueCompiler,
+                                              final DSCompiler derivativeCompiler) {
+
+        if (parameters == 0 || order <= 1) {
+            return new int[] { 0 };
+        }
+
+        // this is an implementation of definition 6 in Dan Kalman's paper.
+        final int vSize = valueCompiler.lowerIndirection.length;
+        final int dSize = derivativeCompiler.lowerIndirection.length;
+        final int[] lowerIndirection = new int[vSize + dSize];
+        System.arraycopy(valueCompiler.lowerIndirection, 0, lowerIndirection, 0, vSize);
+        for (int i = 0; i < dSize; ++i) {
+            lowerIndirection[vSize + i] = valueCompiler.getSize() + derivativeCompiler.lowerIndirection[i];
+        }
+
+        return lowerIndirection;
+
+    }
+
+    /** Compile the multiplication indirection array.
+     * <p>
+     * This indirection array contains the indices of all pairs of elements
+     * involved when computing a multiplication. This allows a straightforward
+     * loop-based multiplication (see {@link #multiply(double[], int, double[], int, double[], int)}).
+     * </p>
+     * @param parameters number of free parameters
+     * @param order derivation order
+     * @param valueCompiler compiler for the value part
+     * @param derivativeCompiler compiler for the derivative part
+     * @param lowerIndirection lower derivatives indirection array
+     * @return multiplication indirection array
+     */
+    private static int[][][] compileMultiplicationIndirection(final int parameters, final int order,
+                                                           final DSCompiler valueCompiler,
+                                                           final DSCompiler derivativeCompiler,
+                                                           final int[] lowerIndirection) {
+
+        if ((parameters == 0) || (order == 0)) {
+            return new int[][][] { { { 1, 0, 0 } } };
+        }
+
+        // this is an implementation of definition 3 in Dan Kalman's paper.
+        final int vSize = valueCompiler.multIndirection.length;
+        final int dSize = derivativeCompiler.multIndirection.length;
+        final int[][][] multIndirection = new int[vSize + dSize][][];
+
+        System.arraycopy(valueCompiler.multIndirection, 0, multIndirection, 0, vSize);
+
+        for (int i = 0; i < dSize; ++i) {
+            final int[][] dRow = derivativeCompiler.multIndirection[i];
+            List<int[]> row = new ArrayList<>(dRow.length * 2);
+            for (int j = 0; j < dRow.length; ++j) {
+                row.add(new int[] { dRow[j][0], lowerIndirection[dRow[j][1]], vSize + dRow[j][2] });
+                row.add(new int[] { dRow[j][0], vSize + dRow[j][1], lowerIndirection[dRow[j][2]] });
+            }
+
+            // combine terms with similar derivation orders
+            final List<int[]> combined = new ArrayList<>(row.size());
+            for (int j = 0; j < row.size(); ++j) {
+                final int[] termJ = row.get(j);
+                if (termJ[0] > 0) {
+                    for (int k = j + 1; k < row.size(); ++k) {
+                        final int[] termK = row.get(k);
+                        if (termJ[1] == termK[1] && termJ[2] == termK[2]) {
+                            // combine termJ and termK
+                            termJ[0] += termK[0];
+                            // make sure we will skip termK later on in the outer loop
+                            termK[0] = 0;
+                        }
+                    }
+                    combined.add(termJ);
+                }
+            }
+
+            multIndirection[vSize + i] = combined.toArray(new int[combined.size()][]);
+
+        }
+
+        return multIndirection;
+
+    }
+
+    /** Compile the function composition indirection array.
+     * <p>
+     * This indirection array contains the indices of all sets of elements
+     * involved when computing a composition. This allows a straightforward
+     * loop-based composition (see {@link #compose(double[], int, double[], double[], int)}).
+     * </p>
+     * @param parameters number of free parameters
+     * @param order derivation order
+     * @param valueCompiler compiler for the value part
+     * @param derivativeCompiler compiler for the derivative part
+     * @param sizes sizes array
+     * @param derivativesIndirection derivatives indirection array
+     * @return multiplication indirection array
+     * @throws NumberIsTooLargeException if order is too large
+     */
+    private static int[][][] compileCompositionIndirection(final int parameters, final int order,
+                                                           final DSCompiler valueCompiler,
+                                                           final DSCompiler derivativeCompiler,
+                                                           final int[][] sizes,
+                                                           final int[][] derivativesIndirection)
+       throws NumberIsTooLargeException {
+
+        if ((parameters == 0) || (order == 0)) {
+            return new int[][][] { { { 1, 0 } } };
+        }
+
+        final int vSize = valueCompiler.compIndirection.length;
+        final int dSize = derivativeCompiler.compIndirection.length;
+        final int[][][] compIndirection = new int[vSize + dSize][][];
+
+        // the composition rules from the value part can be reused as is
+        System.arraycopy(valueCompiler.compIndirection, 0, compIndirection, 0, vSize);
+
+        // the composition rules for the derivative part are deduced by
+        // differentiation the rules from the underlying compiler once
+        // with respect to the parameter this compiler handles and the
+        // underlying one did not handle
+        for (int i = 0; i < dSize; ++i) {
+            List<int[]> row = new ArrayList<>();
+            for (int[] term : derivativeCompiler.compIndirection[i]) {
+
+                // handle term p * f_k(g(x)) * g_l1(x) * g_l2(x) * ... * g_lp(x)
+
+                // derive the first factor in the term: f_k with respect to new parameter
+                int[] derivedTermF = new int[term.length + 1];
+                derivedTermF[0] = term[0];     // p
+                derivedTermF[1] = term[1] + 1; // f_(k+1)
+                int[] orders = new int[parameters];
+                orders[parameters - 1] = 1;
+                derivedTermF[term.length] = getPartialDerivativeIndex(parameters, order, sizes, orders);  // g_1
+                for (int j = 2; j < term.length; ++j) {
+                    // convert the indices as the mapping for the current order
+                    // is different from the mapping with one less order
+                    derivedTermF[j] = convertIndex(term[j], parameters,
+                                                   derivativeCompiler.derivativesIndirection,
+                                                   parameters, order, sizes);
+                }
+                Arrays.sort(derivedTermF, 2, derivedTermF.length);
+                row.add(derivedTermF);
+
+                // derive the various g_l
+                for (int l = 2; l < term.length; ++l) {
+                    int[] derivedTermG = new int[term.length];
+                    derivedTermG[0] = term[0];
+                    derivedTermG[1] = term[1];
+                    for (int j = 2; j < term.length; ++j) {
+                        // convert the indices as the mapping for the current order
+                        // is different from the mapping with one less order
+                        derivedTermG[j] = convertIndex(term[j], parameters,
+                                                       derivativeCompiler.derivativesIndirection,
+                                                       parameters, order, sizes);
+                        if (j == l) {
+                            // derive this term
+                            System.arraycopy(derivativesIndirection[derivedTermG[j]], 0, orders, 0, parameters);
+                            orders[parameters - 1]++;
+                            derivedTermG[j] = getPartialDerivativeIndex(parameters, order, sizes, orders);
+                        }
+                    }
+                    Arrays.sort(derivedTermG, 2, derivedTermG.length);
+                    row.add(derivedTermG);
+                }
+
+            }
+
+            // combine terms with similar derivation orders
+            final List<int[]> combined = new ArrayList<>(row.size());
+            for (int j = 0; j < row.size(); ++j) {
+                final int[] termJ = row.get(j);
+                if (termJ[0] > 0) {
+                    for (int k = j + 1; k < row.size(); ++k) {
+                        final int[] termK = row.get(k);
+                        boolean equals = termJ.length == termK.length;
+                        for (int l = 1; equals && l < termJ.length; ++l) {
+                            equals &= termJ[l] == termK[l];
+                        }
+                        if (equals) {
+                            // combine termJ and termK
+                            termJ[0] += termK[0];
+                            // make sure we will skip termK later on in the outer loop
+                            termK[0] = 0;
+                        }
+                    }
+                    combined.add(termJ);
+                }
+            }
+
+            compIndirection[vSize + i] = combined.toArray(new int[combined.size()][]);
+
+        }
+
+        return compIndirection;
+
+    }
+
+    /** Get the index of a partial derivative in the array.
+     * <p>
+     * If all orders are set to 0, then the 0<sup>th</sup> order derivative
+     * is returned, which is the value of the function.
+     * </p>
+     * <p>The indices of derivatives are between 0 and {@link #getSize() getSize()} - 1.
+     * Their specific order is fixed for a given compiler, but otherwise not
+     * publicly specified. There are however some simple cases which have guaranteed
+     * indices:
+     * </p>
+     * <ul>
+     *   <li>the index of 0<sup>th</sup> order derivative is always 0</li>
+     *   <li>if there is only 1 {@link #getFreeParameters() free parameter}, then the
+     *   derivatives are sorted in increasing derivation order (i.e. f at index 0, df/dp
+     *   at index 1, d<sup>2</sup>f/dp<sup>2</sup> at index 2 ...
+     *   d<sup>k</sup>f/dp<sup>k</sup> at index k),</li>
+     *   <li>if the {@link #getOrder() derivation order} is 1, then the derivatives
+     *   are sorted in increasing free parameter order (i.e. f at index 0, df/dx<sub>1</sub>
+     *   at index 1, df/dx<sub>2</sub> at index 2 ... df/dx<sub>k</sub> at index k),</li>
+     *   <li>all other cases are not publicly specified</li>
+     * </ul>
+     * <p>
+     * This method is the inverse of method {@link #getPartialDerivativeOrders(int)}
+     * </p>
+     * @param orders derivation orders with respect to each parameter
+     * @return index of the partial derivative
+     * @exception DimensionMismatchException if the numbers of parameters does not
+     * match the instance
+     * @exception NumberIsTooLargeException if sum of derivation orders is larger
+     * than the instance limits
+     * @see #getPartialDerivativeOrders(int)
+     */
+    public int getPartialDerivativeIndex(final int ... orders)
+            throws DimensionMismatchException, NumberIsTooLargeException {
+
+        // safety check
+        if (orders.length != getFreeParameters()) {
+            throw new DimensionMismatchException(orders.length, getFreeParameters());
+        }
+
+        return getPartialDerivativeIndex(parameters, order, sizes, orders);
+
+    }
+
+    /** Get the index of a partial derivative in an array.
+     * @param parameters number of free parameters
+     * @param order derivation order
+     * @param sizes sizes array
+     * @param orders derivation orders with respect to each parameter
+     * (the length of this array must match the number of parameters)
+     * @return index of the partial derivative
+     * @exception NumberIsTooLargeException if sum of derivation orders is larger
+     * than the instance limits
+     */
+    private static int getPartialDerivativeIndex(final int parameters, final int order,
+                                                 final int[][] sizes, final int ... orders)
+        throws NumberIsTooLargeException {
+
+        // the value is obtained by diving into the recursive Dan Kalman's structure
+        // this is theorem 2 of his paper, with recursion replaced by iteration
+        int index     = 0;
+        int m         = order;
+        int ordersSum = 0;
+        for (int i = parameters - 1; i >= 0; --i) {
+
+            // derivative order for current free parameter
+            int derivativeOrder = orders[i];
+
+            // safety check
+            ordersSum += derivativeOrder;
+            if (ordersSum > order) {
+                throw new NumberIsTooLargeException(ordersSum, order, true);
+            }
+
+            while (derivativeOrder-- > 0) {
+                // as long as we differentiate according to current free parameter,
+                // we have to skip the value part and dive into the derivative part
+                // so we add the size of the value part to the base index
+                index += sizes[i][m--];
+            }
+
+        }
+
+        return index;
+
+    }
+
+    /** Convert an index from one (parameters, order) structure to another.
+     * @param index index of a partial derivative in source derivative structure
+     * @param srcP number of free parameters in source derivative structure
+     * @param srcDerivativesIndirection derivatives indirection array for the source
+     * derivative structure
+     * @param destP number of free parameters in destination derivative structure
+     * @param destO derivation order in destination derivative structure
+     * @param destSizes sizes array for the destination derivative structure
+     * @return index of the partial derivative with the <em>same</em> characteristics
+     * in destination derivative structure
+     * @throws NumberIsTooLargeException if order is too large
+     */
+    private static int convertIndex(final int index,
+                                    final int srcP, final int[][] srcDerivativesIndirection,
+                                    final int destP, final int destO, final int[][] destSizes)
+        throws NumberIsTooLargeException {
+        int[] orders = new int[destP];
+        System.arraycopy(srcDerivativesIndirection[index], 0, orders, 0, FastMath.min(srcP, destP));
+        return getPartialDerivativeIndex(destP, destO, destSizes, orders);
+    }
+
+    /** Get the derivation orders for a specific index in the array.
+     * <p>
+     * This method is the inverse of {@link #getPartialDerivativeIndex(int...)}.
+     * </p>
+     * @param index of the partial derivative
+     * @return orders derivation orders with respect to each parameter
+     * @see #getPartialDerivativeIndex(int...)
+     */
+    public int[] getPartialDerivativeOrders(final int index) {
+        return derivativesIndirection[index];
+    }
+
+    /** Get the number of free parameters.
+     * @return number of free parameters
+     */
+    public int getFreeParameters() {
+        return parameters;
+    }
+
+    /** Get the derivation order.
+     * @return derivation order
+     */
+    public int getOrder() {
+        return order;
+    }
+
+    /** Get the array size required for holding partial derivatives data.
+     * <p>
+     * This number includes the single 0 order derivative element, which is
+     * guaranteed to be stored in the first element of the array.
+     * </p>
+     * @return array size required for holding partial derivatives data
+     */
+    public int getSize() {
+        return sizes[parameters][order];
+    }
+
+    /** Compute linear combination.
+     * The derivative structure built will be a1 * ds1 + a2 * ds2
+     * @param a1 first scale factor
+     * @param c1 first base (unscaled) component
+     * @param offset1 offset of first operand in its array
+     * @param a2 second scale factor
+     * @param c2 second base (unscaled) component
+     * @param offset2 offset of second operand in its array
+     * @param result array where result must be stored (it may be
+     * one of the input arrays)
+     * @param resultOffset offset of the result in its array
+     */
+    public void linearCombination(final double a1, final double[] c1, final int offset1,
+                                  final double a2, final double[] c2, final int offset2,
+                                  final double[] result, final int resultOffset) {
+        for (int i = 0; i < getSize(); ++i) {
+            result[resultOffset + i] =
+                    LinearCombination.value(a1, c1[offset1 + i], a2, c2[offset2 + i]);
+        }
+    }
+
+    /** Compute linear combination.
+     * The derivative structure built will be a1 * ds1 + a2 * ds2 + a3 * ds3 + a4 * ds4
+     * @param a1 first scale factor
+     * @param c1 first base (unscaled) component
+     * @param offset1 offset of first operand in its array
+     * @param a2 second scale factor
+     * @param c2 second base (unscaled) component
+     * @param offset2 offset of second operand in its array
+     * @param a3 third scale factor
+     * @param c3 third base (unscaled) component
+     * @param offset3 offset of third operand in its array
+     * @param result array where result must be stored (it may be
+     * one of the input arrays)
+     * @param resultOffset offset of the result in its array
+     */
+    public void linearCombination(final double a1, final double[] c1, final int offset1,
+                                  final double a2, final double[] c2, final int offset2,
+                                  final double a3, final double[] c3, final int offset3,
+                                  final double[] result, final int resultOffset) {
+        for (int i = 0; i < getSize(); ++i) {
+            result[resultOffset + i] =
+                    LinearCombination.value(a1, c1[offset1 + i],
+                                                 a2, c2[offset2 + i],
+                                                 a3, c3[offset3 + i]);
+        }
+    }
+
+    /** Compute linear combination.
+     * The derivative structure built will be a1 * ds1 + a2 * ds2 + a3 * ds3 + a4 * ds4
+     * @param a1 first scale factor
+     * @param c1 first base (unscaled) component
+     * @param offset1 offset of first operand in its array
+     * @param a2 second scale factor
+     * @param c2 second base (unscaled) component
+     * @param offset2 offset of second operand in its array
+     * @param a3 third scale factor
+     * @param c3 third base (unscaled) component
+     * @param offset3 offset of third operand in its array
+     * @param a4 fourth scale factor
+     * @param c4 fourth base (unscaled) component
+     * @param offset4 offset of fourth operand in its array
+     * @param result array where result must be stored (it may be
+     * one of the input arrays)
+     * @param resultOffset offset of the result in its array
+     */
+    public void linearCombination(final double a1, final double[] c1, final int offset1,
+                                  final double a2, final double[] c2, final int offset2,
+                                  final double a3, final double[] c3, final int offset3,
+                                  final double a4, final double[] c4, final int offset4,
+                                  final double[] result, final int resultOffset) {
+        for (int i = 0; i < getSize(); ++i) {
+            result[resultOffset + i] =
+                    LinearCombination.value(a1, c1[offset1 + i],
+                                                 a2, c2[offset2 + i],
+                                                 a3, c3[offset3 + i],
+                                                 a4, c4[offset4 + i]);
+        }
+    }
+
+    /** Perform addition of two derivative structures.
+     * @param lhs array holding left hand side of addition
+     * @param lhsOffset offset of the left hand side in its array
+     * @param rhs array right hand side of addition
+     * @param rhsOffset offset of the right hand side in its array
+     * @param result array where result must be stored (it may be
+     * one of the input arrays)
+     * @param resultOffset offset of the result in its array
+     */
+    public void add(final double[] lhs, final int lhsOffset,
+                    final double[] rhs, final int rhsOffset,
+                    final double[] result, final int resultOffset) {
+        for (int i = 0; i < getSize(); ++i) {
+            result[resultOffset + i] = lhs[lhsOffset + i] + rhs[rhsOffset + i];
+        }
+    }
+    /** Perform subtraction of two derivative structures.
+     * @param lhs array holding left hand side of subtraction
+     * @param lhsOffset offset of the left hand side in its array
+     * @param rhs array right hand side of subtraction
+     * @param rhsOffset offset of the right hand side in its array
+     * @param result array where result must be stored (it may be
+     * one of the input arrays)
+     * @param resultOffset offset of the result in its array
+     */
+    public void subtract(final double[] lhs, final int lhsOffset,
+                         final double[] rhs, final int rhsOffset,
+                         final double[] result, final int resultOffset) {
+        for (int i = 0; i < getSize(); ++i) {
+            result[resultOffset + i] = lhs[lhsOffset + i] - rhs[rhsOffset + i];
+        }
+    }
+
+    /** Perform multiplication of two derivative structures.
+     * @param lhs array holding left hand side of multiplication
+     * @param lhsOffset offset of the left hand side in its array
+     * @param rhs array right hand side of multiplication
+     * @param rhsOffset offset of the right hand side in its array
+     * @param result array where result must be stored (for
+     * multiplication the result array <em>cannot</em> be one of
+     * the input arrays)
+     * @param resultOffset offset of the result in its array
+     */
+    public void multiply(final double[] lhs, final int lhsOffset,
+                         final double[] rhs, final int rhsOffset,
+                         final double[] result, final int resultOffset) {
+        for (int i = 0; i < multIndirection.length; ++i) {
+            final int[][] mappingI = multIndirection[i];
+            double r = 0;
+            for (int j = 0; j < mappingI.length; ++j) {
+                r += mappingI[j][0] *
+                     lhs[lhsOffset + mappingI[j][1]] *
+                     rhs[rhsOffset + mappingI[j][2]];
+            }
+            result[resultOffset + i] = r;
+        }
+    }
+
+    /** Perform division of two derivative structures.
+     * @param lhs array holding left hand side of division
+     * @param lhsOffset offset of the left hand side in its array
+     * @param rhs array right hand side of division
+     * @param rhsOffset offset of the right hand side in its array
+     * @param result array where result must be stored (for
+     * division the result array <em>cannot</em> be one of
+     * the input arrays)
+     * @param resultOffset offset of the result in its array
+     */
+    public void divide(final double[] lhs, final int lhsOffset,
+                       final double[] rhs, final int rhsOffset,
+                       final double[] result, final int resultOffset) {
+        final double[] reciprocal = new double[getSize()];
+        pow(rhs, lhsOffset, -1, reciprocal, 0);
+        multiply(lhs, lhsOffset, reciprocal, 0, result, resultOffset);
+    }
+
+    /** Perform remainder of two derivative structures.
+     * @param lhs array holding left hand side of remainder
+     * @param lhsOffset offset of the left hand side in its array
+     * @param rhs array right hand side of remainder
+     * @param rhsOffset offset of the right hand side in its array
+     * @param result array where result must be stored (it may be
+     * one of the input arrays)
+     * @param resultOffset offset of the result in its array
+     */
+    public void remainder(final double[] lhs, final int lhsOffset,
+                          final double[] rhs, final int rhsOffset,
+                          final double[] result, final int resultOffset) {
+
+        // compute k such that lhs % rhs = lhs - k rhs
+        final double rem = FastMath.IEEEremainder(lhs[lhsOffset], rhs[rhsOffset]);
+        final double k   = FastMath.rint((lhs[lhsOffset] - rem) / rhs[rhsOffset]);
+
+        // set up value
+        result[resultOffset] = rem;
+
+        // set up partial derivatives
+        for (int i = 1; i < getSize(); ++i) {
+            result[resultOffset + i] = lhs[lhsOffset + i] - k * rhs[rhsOffset + i];
+        }
+
+    }
+
+    /** Compute power of a double to a derivative structure.
+     * @param a number to exponentiate
+     * @param operand array holding the power
+     * @param operandOffset offset of the power in its array
+     * @param result array where result must be stored (for
+     * power the result array <em>cannot</em> be the input
+     * array)
+     * @param resultOffset offset of the result in its array
+     * @since 3.3
+     */
+    public void pow(final double a,
+                    final double[] operand, final int operandOffset,
+                    final double[] result, final int resultOffset) {
+
+        // create the function value and derivatives
+        // [a^x, ln(a) a^x, ln(a)^2 a^x,, ln(a)^3 a^x, ... ]
+        final double[] function = new double[1 + order];
+        if (a == 0) {
+            if (operand[operandOffset] == 0) {
+                function[0] = 1;
+                double infinity = Double.POSITIVE_INFINITY;
+                for (int i = 1; i < function.length; ++i) {
+                    infinity = -infinity;
+                    function[i] = infinity;
+                }
+            } else if (operand[operandOffset] < 0) {
+                Arrays.fill(function, Double.NaN);
+            }
+        } else {
+            function[0] = FastMath.pow(a, operand[operandOffset]);
+            final double lnA = FastMath.log(a);
+            for (int i = 1; i < function.length; ++i) {
+                function[i] = lnA * function[i - 1];
+            }
+        }
+
+
+        // apply function composition
+        compose(operand, operandOffset, function, result, resultOffset);
+
+    }
+
+    /** Compute power of a derivative structure.
+     * @param operand array holding the operand
+     * @param operandOffset offset of the operand in its array
+     * @param p power to apply
+     * @param result array where result must be stored (for
+     * power the result array <em>cannot</em> be the input
+     * array)
+     * @param resultOffset offset of the result in its array
+     */
+    public void pow(final double[] operand, final int operandOffset, final double p,
+                    final double[] result, final int resultOffset) {
+
+        if (p == 0) {
+            // special case, x^0 = 1 for all x
+            result[resultOffset] = 1.0;
+            Arrays.fill(result, resultOffset + 1, resultOffset + getSize(), 0);
+            return;
+        }
+
+        if (operand[operandOffset] == 0) {
+            // special case, 0^p = 0 for all p
+            Arrays.fill(result, resultOffset, resultOffset + getSize(), 0);
+            return;
+        }
+
+        // create the function value and derivatives
+        // [x^p, px^(p-1), p(p-1)x^(p-2), ... ]
+        double[] function = new double[1 + order];
+        double xk = FastMath.pow(operand[operandOffset], p - order);
+        for (int i = order; i > 0; --i) {
+            function[i] = xk;
+            xk *= operand[operandOffset];
+        }
+        function[0] = xk;
+        double coefficient = p;
+        for (int i = 1; i <= order; ++i) {
+            function[i] *= coefficient;
+            coefficient *= p - i;
+        }
+
+        // apply function composition
+        compose(operand, operandOffset, function, result, resultOffset);
+
+    }
+
+    /** Compute integer power of a derivative structure.
+     * @param operand array holding the operand
+     * @param operandOffset offset of the operand in its array
+     * @param n power to apply
+     * @param result array where result must be stored (for
+     * power the result array <em>cannot</em> be the input
+     * array)
+     * @param resultOffset offset of the result in its array
+     */
+    public void pow(final double[] operand, final int operandOffset, final int n,
+                    final double[] result, final int resultOffset) {
+
+        if (n == 0) {
+            // special case, x^0 = 1 for all x
+            result[resultOffset] = 1.0;
+            Arrays.fill(result, resultOffset + 1, resultOffset + getSize(), 0);
+            return;
+        }
+
+        // create the power function value and derivatives
+        // [x^n, nx^(n-1), n(n-1)x^(n-2), ... ]
+        double[] function = new double[1 + order];
+
+        if (n > 0) {
+            // strictly positive power
+            final int maxOrder = FastMath.min(order, n);
+            double xk = FastMath.pow(operand[operandOffset], n - maxOrder);
+            for (int i = maxOrder; i > 0; --i) {
+                function[i] = xk;
+                xk *= operand[operandOffset];
+            }
+            function[0] = xk;
+        } else {
+            // strictly negative power
+            final double inv = 1.0 / operand[operandOffset];
+            double xk = FastMath.pow(inv, -n);
+            for (int i = 0; i <= order; ++i) {
+                function[i] = xk;
+                xk *= inv;
+            }
+        }
+
+        double coefficient = n;
+        for (int i = 1; i <= order; ++i) {
+            function[i] *= coefficient;
+            coefficient *= n - i;
+        }
+
+        // apply function composition
+        compose(operand, operandOffset, function, result, resultOffset);
+
+    }
+
+    /** Compute power of a derivative structure.
+     * @param x array holding the base
+     * @param xOffset offset of the base in its array
+     * @param y array holding the exponent
+     * @param yOffset offset of the exponent in its array
+     * @param result array where result must be stored (for
+     * power the result array <em>cannot</em> be the input
+     * array)
+     * @param resultOffset offset of the result in its array
+     */
+    public void pow(final double[] x, final int xOffset,
+                    final double[] y, final int yOffset,
+                    final double[] result, final int resultOffset) {
+        final double[] logX = new double[getSize()];
+        log(x, xOffset, logX, 0);
+        final double[] yLogX = new double[getSize()];
+        multiply(logX, 0, y, yOffset, yLogX, 0);
+        exp(yLogX, 0, result, resultOffset);
+    }
+
+    /** Compute n<sup>th</sup> root of a derivative structure.
+     * @param operand array holding the operand
+     * @param operandOffset offset of the operand in its array
+     * @param n order of the root
+     * @param result array where result must be stored (for
+     * n<sup>th</sup> root the result array <em>cannot</em> be the input
+     * array)
+     * @param resultOffset offset of the result in its array
+     */
+    public void rootN(final double[] operand, final int operandOffset, final int n,
+                      final double[] result, final int resultOffset) {
+
+        // create the function value and derivatives
+        // [x^(1/n), (1/n)x^((1/n)-1), (1-n)/n^2x^((1/n)-2), ... ]
+        double[] function = new double[1 + order];
+        double xk;
+        if (n == 2) {
+            function[0] = FastMath.sqrt(operand[operandOffset]);
+            xk          = 0.5 / function[0];
+        } else if (n == 3) {
+            function[0] = FastMath.cbrt(operand[operandOffset]);
+            xk          = 1.0 / (3.0 * function[0] * function[0]);
+        } else {
+            function[0] = FastMath.pow(operand[operandOffset], 1.0 / n);
+            xk          = 1.0 / (n * FastMath.pow(function[0], n - 1));
+        }
+        final double nReciprocal = 1.0 / n;
+        final double xReciprocal = 1.0 / operand[operandOffset];
+        for (int i = 1; i <= order; ++i) {
+            function[i] = xk;
+            xk *= xReciprocal * (nReciprocal - i);
+        }
+
+        // apply function composition
+        compose(operand, operandOffset, function, result, resultOffset);
+
+    }
+
+    /** Compute exponential of a derivative structure.
+     * @param operand array holding the operand
+     * @param operandOffset offset of the operand in its array
+     * @param result array where result must be stored (for
+     * exponential the result array <em>cannot</em> be the input
+     * array)
+     * @param resultOffset offset of the result in its array
+     */
+    public void exp(final double[] operand, final int operandOffset,
+                    final double[] result, final int resultOffset) {
+
+        // create the function value and derivatives
+        double[] function = new double[1 + order];
+        Arrays.fill(function, FastMath.exp(operand[operandOffset]));
+
+        // apply function composition
+        compose(operand, operandOffset, function, result, resultOffset);
+
+    }
+
+    /** Compute exp(x) - 1 of a derivative structure.
+     * @param operand array holding the operand
+     * @param operandOffset offset of the operand in its array
+     * @param result array where result must be stored (for
+     * exponential the result array <em>cannot</em> be the input
+     * array)
+     * @param resultOffset offset of the result in its array
+     */
+    public void expm1(final double[] operand, final int operandOffset,
+                      final double[] result, final int resultOffset) {
+
+        // create the function value and derivatives
+        double[] function = new double[1 + order];
+        function[0] = FastMath.expm1(operand[operandOffset]);
+        Arrays.fill(function, 1, 1 + order, FastMath.exp(operand[operandOffset]));
+
+        // apply function composition
+        compose(operand, operandOffset, function, result, resultOffset);
+
+    }
+
+    /** Compute natural logarithm of a derivative structure.
+     * @param operand array holding the operand
+     * @param operandOffset offset of the operand in its array
+     * @param result array where result must be stored (for
+     * logarithm the result array <em>cannot</em> be the input
+     * array)
+     * @param resultOffset offset of the result in its array
+     */
+    public void log(final double[] operand, final int operandOffset,
+                    final double[] result, final int resultOffset) {
+
+        // create the function value and derivatives
+        double[] function = new double[1 + order];
+        function[0] = FastMath.log(operand[operandOffset]);
+        if (order > 0) {
+            double inv = 1.0 / operand[operandOffset];
+            double xk  = inv;
+            for (int i = 1; i <= order; ++i) {
+                function[i] = xk;
+                xk *= -i * inv;
+            }
+        }
+
+        // apply function composition
+        compose(operand, operandOffset, function, result, resultOffset);
+
+    }
+
+    /** Computes shifted logarithm of a derivative structure.
+     * @param operand array holding the operand
+     * @param operandOffset offset of the operand in its array
+     * @param result array where result must be stored (for
+     * shifted logarithm the result array <em>cannot</em> be the input array)
+     * @param resultOffset offset of the result in its array
+     */
+    public void log1p(final double[] operand, final int operandOffset,
+                      final double[] result, final int resultOffset) {
+
+        // create the function value and derivatives
+        double[] function = new double[1 + order];
+        function[0] = FastMath.log1p(operand[operandOffset]);
+        if (order > 0) {
+            double inv = 1.0 / (1.0 + operand[operandOffset]);
+            double xk  = inv;
+            for (int i = 1; i <= order; ++i) {
+                function[i] = xk;
+                xk *= -i * inv;
+            }
+        }
+
+        // apply function composition
+        compose(operand, operandOffset, function, result, resultOffset);
+
+    }
+
+    /** Computes base 10 logarithm of a derivative structure.
+     * @param operand array holding the operand
+     * @param operandOffset offset of the operand in its array
+     * @param result array where result must be stored (for
+     * base 10 logarithm the result array <em>cannot</em> be the input array)
+     * @param resultOffset offset of the result in its array
+     */
+    public void log10(final double[] operand, final int operandOffset,
+                      final double[] result, final int resultOffset) {
+
+        // create the function value and derivatives
+        double[] function = new double[1 + order];
+        function[0] = FastMath.log10(operand[operandOffset]);
+        if (order > 0) {
+            double inv = 1.0 / operand[operandOffset];
+            double xk  = inv / FastMath.log(10.0);
+            for (int i = 1; i <= order; ++i) {
+                function[i] = xk;
+                xk *= -i * inv;
+            }
+        }
+
+        // apply function composition
+        compose(operand, operandOffset, function, result, resultOffset);
+
+    }
+
+    /** Compute cosine of a derivative structure.
+     * @param operand array holding the operand
+     * @param operandOffset offset of the operand in its array
+     * @param result array where result must be stored (for
+     * cosine the result array <em>cannot</em> be the input
+     * array)
+     * @param resultOffset offset of the result in its array
+     */
+    public void cos(final double[] operand, final int operandOffset,
+                    final double[] result, final int resultOffset) {
+
+        // create the function value and derivatives
+        double[] function = new double[1 + order];
+        function[0] = FastMath.cos(operand[operandOffset]);
+        if (order > 0) {
+            function[1] = -FastMath.sin(operand[operandOffset]);
+            for (int i = 2; i <= order; ++i) {
+                function[i] = -function[i - 2];
+            }
+        }
+
+        // apply function composition
+        compose(operand, operandOffset, function, result, resultOffset);
+
+    }
+
+    /** Compute sine of a derivative structure.
+     * @param operand array holding the operand
+     * @param operandOffset offset of the operand in its array
+     * @param result array where result must be stored (for
+     * sine the result array <em>cannot</em> be the input
+     * array)
+     * @param resultOffset offset of the result in its array
+     */
+    public void sin(final double[] operand, final int operandOffset,
+                    final double[] result, final int resultOffset) {
+
+        // create the function value and derivatives
+        double[] function = new double[1 + order];
+        function[0] = FastMath.sin(operand[operandOffset]);
+        if (order > 0) {
+            function[1] = FastMath.cos(operand[operandOffset]);
+            for (int i = 2; i <= order; ++i) {
+                function[i] = -function[i - 2];
+            }
+        }
+
+        // apply function composition
+        compose(operand, operandOffset, function, result, resultOffset);
+
+    }
+
+    /** Compute tangent of a derivative structure.
+     * @param operand array holding the operand
+     * @param operandOffset offset of the operand in its array
+     * @param result array where result must be stored (for
+     * tangent the result array <em>cannot</em> be the input
+     * array)
+     * @param resultOffset offset of the result in its array
+     */
+    public void tan(final double[] operand, final int operandOffset,
+                    final double[] result, final int resultOffset) {
+
+        // create the function value and derivatives
+        final double[] function = new double[1 + order];
+        final double t = FastMath.tan(operand[operandOffset]);
+        function[0] = t;
+
+        if (order > 0) {
+
+            // the nth order derivative of tan has the form:
+            // dn(tan(x)/dxn = P_n(tan(x))
+            // where P_n(t) is a degree n+1 polynomial with same parity as n+1
+            // P_0(t) = t, P_1(t) = 1 + t^2, P_2(t) = 2 t (1 + t^2) ...
+            // the general recurrence relation for P_n is:
+            // P_n(x) = (1+t^2) P_(n-1)'(t)
+            // as per polynomial parity, we can store coefficients of both P_(n-1) and P_n in the same array
+            final double[] p = new double[order + 2];
+            p[1] = 1;
+            final double t2 = t * t;
+            for (int n = 1; n <= order; ++n) {
+
+                // update and evaluate polynomial P_n(t)
+                double v = 0;
+                p[n + 1] = n * p[n];
+                for (int k = n + 1; k >= 0; k -= 2) {
+                    v = v * t2 + p[k];
+                    if (k > 2) {
+                        p[k - 2] = (k - 1) * p[k - 1] + (k - 3) * p[k - 3];
+                    } else if (k == 2) {
+                        p[0] = p[1];
+                    }
+                }
+                if ((n & 0x1) == 0) {
+                    v *= t;
+                }
+
+                function[n] = v;
+
+            }
+        }
+
+        // apply function composition
+        compose(operand, operandOffset, function, result, resultOffset);
+
+    }
+
+    /** Compute arc cosine of a derivative structure.
+     * @param operand array holding the operand
+     * @param operandOffset offset of the operand in its array
+     * @param result array where result must be stored (for
+     * arc cosine the result array <em>cannot</em> be the input
+     * array)
+     * @param resultOffset offset of the result in its array
+     */
+    public void acos(final double[] operand, final int operandOffset,
+                    final double[] result, final int resultOffset) {
+
+        // create the function value and derivatives
+        double[] function = new double[1 + order];
+        final double x = operand[operandOffset];
+        function[0] = FastMath.acos(x);
+        if (order > 0) {
+            // the nth order derivative of acos has the form:
+            // dn(acos(x)/dxn = P_n(x) / [1 - x^2]^((2n-1)/2)
+            // where P_n(x) is a degree n-1 polynomial with same parity as n-1
+            // P_1(x) = -1, P_2(x) = -x, P_3(x) = -2x^2 - 1 ...
+            // the general recurrence relation for P_n is:
+            // P_n(x) = (1-x^2) P_(n-1)'(x) + (2n-3) x P_(n-1)(x)
+            // as per polynomial parity, we can store coefficients of both P_(n-1) and P_n in the same array
+            final double[] p = new double[order];
+            p[0] = -1;
+            final double x2    = x * x;
+            final double f     = 1.0 / (1 - x2);
+            double coeff = FastMath.sqrt(f);
+            function[1] = coeff * p[0];
+            for (int n = 2; n <= order; ++n) {
+
+                // update and evaluate polynomial P_n(x)
+                double v = 0;
+                p[n - 1] = (n - 1) * p[n - 2];
+                for (int k = n - 1; k >= 0; k -= 2) {
+                    v = v * x2 + p[k];
+                    if (k > 2) {
+                        p[k - 2] = (k - 1) * p[k - 1] + (2 * n - k) * p[k - 3];
+                    } else if (k == 2) {
+                        p[0] = p[1];
+                    }
+                }
+                if ((n & 0x1) == 0) {
+                    v *= x;
+                }
+
+                coeff *= f;
+                function[n] = coeff * v;
+
+            }
+        }
+
+        // apply function composition
+        compose(operand, operandOffset, function, result, resultOffset);
+
+    }
+
+    /** Compute arc sine of a derivative structure.
+     * @param operand array holding the operand
+     * @param operandOffset offset of the operand in its array
+     * @param result array where result must be stored (for
+     * arc sine the result array <em>cannot</em> be the input
+     * array)
+     * @param resultOffset offset of the result in its array
+     */
+    public void asin(final double[] operand, final int operandOffset,
+                    final double[] result, final int resultOffset) {
+
+        // create the function value and derivatives
+        double[] function = new double[1 + order];
+        final double x = operand[operandOffset];
+        function[0] = FastMath.asin(x);
+        if (order > 0) {
+            // the nth order derivative of asin has the form:
+            // dn(asin(x)/dxn = P_n(x) / [1 - x^2]^((2n-1)/2)
+            // where P_n(x) is a degree n-1 polynomial with same parity as n-1
+            // P_1(x) = 1, P_2(x) = x, P_3(x) = 2x^2 + 1 ...
+            // the general recurrence relation for P_n is:
+            // P_n(x) = (1-x^2) P_(n-1)'(x) + (2n-3) x P_(n-1)(x)
+            // as per polynomial parity, we can store coefficients of both P_(n-1) and P_n in the same array
+            final double[] p = new double[order];
+            p[0] = 1;
+            final double x2    = x * x;
+            final double f     = 1.0 / (1 - x2);
+            double coeff = FastMath.sqrt(f);
+            function[1] = coeff * p[0];
+            for (int n = 2; n <= order; ++n) {
+
+                // update and evaluate polynomial P_n(x)
+                double v = 0;
+                p[n - 1] = (n - 1) * p[n - 2];
+                for (int k = n - 1; k >= 0; k -= 2) {
+                    v = v * x2 + p[k];
+                    if (k > 2) {
+                        p[k - 2] = (k - 1) * p[k - 1] + (2 * n - k) * p[k - 3];
+                    } else if (k == 2) {
+                        p[0] = p[1];
+                    }
+                }
+                if ((n & 0x1) == 0) {
+                    v *= x;
+                }
+
+                coeff *= f;
+                function[n] = coeff * v;
+
+            }
+        }
+
+        // apply function composition
+        compose(operand, operandOffset, function, result, resultOffset);
+
+    }
+
+    /** Compute arc tangent of a derivative structure.
+     * @param operand array holding the operand
+     * @param operandOffset offset of the operand in its array
+     * @param result array where result must be stored (for
+     * arc tangent the result array <em>cannot</em> be the input
+     * array)
+     * @param resultOffset offset of the result in its array
+     */
+    public void atan(final double[] operand, final int operandOffset,
+                     final double[] result, final int resultOffset) {
+
+        // create the function value and derivatives
+        double[] function = new double[1 + order];
+        final double x = operand[operandOffset];
+        function[0] = FastMath.atan(x);
+        if (order > 0) {
+            // the nth order derivative of atan has the form:
+            // dn(atan(x)/dxn = Q_n(x) / (1 + x^2)^n
+            // where Q_n(x) is a degree n-1 polynomial with same parity as n-1
+            // Q_1(x) = 1, Q_2(x) = -2x, Q_3(x) = 6x^2 - 2 ...
+            // the general recurrence relation for Q_n is:
+            // Q_n(x) = (1+x^2) Q_(n-1)'(x) - 2(n-1) x Q_(n-1)(x)
+            // as per polynomial parity, we can store coefficients of both Q_(n-1) and Q_n in the same array
+            final double[] q = new double[order];
+            q[0] = 1;
+            final double x2    = x * x;
+            final double f     = 1.0 / (1 + x2);
+            double coeff = f;
+            function[1] = coeff * q[0];
+            for (int n = 2; n <= order; ++n) {
+
+                // update and evaluate polynomial Q_n(x)
+                double v = 0;
+                q[n - 1] = -n * q[n - 2];
+                for (int k = n - 1; k >= 0; k -= 2) {
+                    v = v * x2 + q[k];
+                    if (k > 2) {
+                        q[k - 2] = (k - 1) * q[k - 1] + (k - 1 - 2 * n) * q[k - 3];
+                    } else if (k == 2) {
+                        q[0] = q[1];
+                    }
+                }
+                if ((n & 0x1) == 0) {
+                    v *= x;
+                }
+
+                coeff *= f;
+                function[n] = coeff * v;
+
+            }
+        }
+
+        // apply function composition
+        compose(operand, operandOffset, function, result, resultOffset);
+
+    }
+
+    /** Compute two arguments arc tangent of a derivative structure.
+     * @param y array holding the first operand
+     * @param yOffset offset of the first operand in its array
+     * @param x array holding the second operand
+     * @param xOffset offset of the second operand in its array
+     * @param result array where result must be stored (for
+     * two arguments arc tangent the result array <em>cannot</em>
+     * be the input array)
+     * @param resultOffset offset of the result in its array
+     */
+    public void atan2(final double[] y, final int yOffset,
+                      final double[] x, final int xOffset,
+                      final double[] result, final int resultOffset) {
+
+        // compute r = sqrt(x^2+y^2)
+        double[] tmp1 = new double[getSize()];
+        multiply(x, xOffset, x, xOffset, tmp1, 0);      // x^2
+        double[] tmp2 = new double[getSize()];
+        multiply(y, yOffset, y, yOffset, tmp2, 0);      // y^2
+        add(tmp1, 0, tmp2, 0, tmp2, 0);                 // x^2 + y^2
+        rootN(tmp2, 0, 2, tmp1, 0);                     // r = sqrt(x^2 + y^2)
+
+        if (x[xOffset] >= 0) {
+
+            // compute atan2(y, x) = 2 atan(y / (r + x))
+            add(tmp1, 0, x, xOffset, tmp2, 0);          // r + x
+            divide(y, yOffset, tmp2, 0, tmp1, 0);       // y /(r + x)
+            atan(tmp1, 0, tmp2, 0);                     // atan(y / (r + x))
+            for (int i = 0; i < tmp2.length; ++i) {
+                result[resultOffset + i] = 2 * tmp2[i]; // 2 * atan(y / (r + x))
+            }
+
+        } else {
+
+            // compute atan2(y, x) = +/- pi - 2 atan(y / (r - x))
+            subtract(tmp1, 0, x, xOffset, tmp2, 0);     // r - x
+            divide(y, yOffset, tmp2, 0, tmp1, 0);       // y /(r - x)
+            atan(tmp1, 0, tmp2, 0);                     // atan(y / (r - x))
+            result[resultOffset] =
+                    ((tmp2[0] <= 0) ? -FastMath.PI : FastMath.PI) - 2 * tmp2[0]; // +/-pi - 2 * atan(y / (r - x))
+            for (int i = 1; i < tmp2.length; ++i) {
+                result[resultOffset + i] = -2 * tmp2[i]; // +/-pi - 2 * atan(y / (r - x))
+            }
+
+        }
+
+        // fix value to take special cases (+0/+0, +0/-0, -0/+0, -0/-0, +/-infinity) correctly
+        result[resultOffset] = FastMath.atan2(y[yOffset], x[xOffset]);
+
+    }
+
+    /** Compute hyperbolic cosine of a derivative structure.
+     * @param operand array holding the operand
+     * @param operandOffset offset of the operand in its array
+     * @param result array where result must be stored (for
+     * hyperbolic cosine the result array <em>cannot</em> be the input
+     * array)
+     * @param resultOffset offset of the result in its array
+     */
+    public void cosh(final double[] operand, final int operandOffset,
+                     final double[] result, final int resultOffset) {
+
+        // create the function value and derivatives
+        double[] function = new double[1 + order];
+        function[0] = FastMath.cosh(operand[operandOffset]);
+        if (order > 0) {
+            function[1] = FastMath.sinh(operand[operandOffset]);
+            for (int i = 2; i <= order; ++i) {
+                function[i] = function[i - 2];
+            }
+        }
+
+        // apply function composition
+        compose(operand, operandOffset, function, result, resultOffset);
+
+    }
+
+    /** Compute hyperbolic sine of a derivative structure.
+     * @param operand array holding the operand
+     * @param operandOffset offset of the operand in its array
+     * @param result array where result must be stored (for
+     * hyperbolic sine the result array <em>cannot</em> be the input
+     * array)
+     * @param resultOffset offset of the result in its array
+     */
+    public void sinh(final double[] operand, final int operandOffset,
+                     final double[] result, final int resultOffset) {
+
+        // create the function value and derivatives
+        double[] function = new double[1 + order];
+        function[0] = FastMath.sinh(operand[operandOffset]);
+        if (order > 0) {
+            function[1] = FastMath.cosh(operand[operandOffset]);
+            for (int i = 2; i <= order; ++i) {
+                function[i] = function[i - 2];
+            }
+        }
+
+        // apply function composition
+        compose(operand, operandOffset, function, result, resultOffset);
+
+    }
+
+    /** Compute hyperbolic tangent of a derivative structure.
+     * @param operand array holding the operand
+     * @param operandOffset offset of the operand in its array
+     * @param result array where result must be stored (for
+     * hyperbolic tangent the result array <em>cannot</em> be the input
+     * array)
+     * @param resultOffset offset of the result in its array
+     */
+    public void tanh(final double[] operand, final int operandOffset,
+                     final double[] result, final int resultOffset) {
+
+        // create the function value and derivatives
+        final double[] function = new double[1 + order];
+        final double t = FastMath.tanh(operand[operandOffset]);
+        function[0] = t;
+
+        if (order > 0) {
+
+            // the nth order derivative of tanh has the form:
+            // dn(tanh(x)/dxn = P_n(tanh(x))
+            // where P_n(t) is a degree n+1 polynomial with same parity as n+1
+            // P_0(t) = t, P_1(t) = 1 - t^2, P_2(t) = -2 t (1 - t^2) ...
+            // the general recurrence relation for P_n is:
+            // P_n(x) = (1-t^2) P_(n-1)'(t)
+            // as per polynomial parity, we can store coefficients of both P_(n-1) and P_n in the same array
+            final double[] p = new double[order + 2];
+            p[1] = 1;
+            final double t2 = t * t;
+            for (int n = 1; n <= order; ++n) {
+
+                // update and evaluate polynomial P_n(t)
+                double v = 0;
+                p[n + 1] = -n * p[n];
+                for (int k = n + 1; k >= 0; k -= 2) {
+                    v = v * t2 + p[k];
+                    if (k > 2) {
+                        p[k - 2] = (k - 1) * p[k - 1] - (k - 3) * p[k - 3];
+                    } else if (k == 2) {
+                        p[0] = p[1];
+                    }
+                }
+                if ((n & 0x1) == 0) {
+                    v *= t;
+                }
+
+                function[n] = v;
+
+            }
+        }
+
+        // apply function composition
+        compose(operand, operandOffset, function, result, resultOffset);
+
+    }
+
+    /** Compute inverse hyperbolic cosine of a derivative structure.
+     * @param operand array holding the operand
+     * @param operandOffset offset of the operand in its array
+     * @param result array where result must be stored (for
+     * inverse hyperbolic cosine the result array <em>cannot</em> be the input
+     * array)
+     * @param resultOffset offset of the result in its array
+     */
+    public void acosh(final double[] operand, final int operandOffset,
+                     final double[] result, final int resultOffset) {
+
+        // create the function value and derivatives
+        double[] function = new double[1 + order];
+        final double x = operand[operandOffset];
+        function[0] = FastMath.acosh(x);
+        if (order > 0) {
+            // the nth order derivative of acosh has the form:
+            // dn(acosh(x)/dxn = P_n(x) / [x^2 - 1]^((2n-1)/2)
+            // where P_n(x) is a degree n-1 polynomial with same parity as n-1
+            // P_1(x) = 1, P_2(x) = -x, P_3(x) = 2x^2 + 1 ...
+            // the general recurrence relation for P_n is:
+            // P_n(x) = (x^2-1) P_(n-1)'(x) - (2n-3) x P_(n-1)(x)
+            // as per polynomial parity, we can store coefficients of both P_(n-1) and P_n in the same array
+            final double[] p = new double[order];
+            p[0] = 1;
+            final double x2  = x * x;
+            final double f   = 1.0 / (x2 - 1);
+            double coeff = FastMath.sqrt(f);
+            function[1] = coeff * p[0];
+            for (int n = 2; n <= order; ++n) {
+
+                // update and evaluate polynomial P_n(x)
+                double v = 0;
+                p[n - 1] = (1 - n) * p[n - 2];
+                for (int k = n - 1; k >= 0; k -= 2) {
+                    v = v * x2 + p[k];
+                    if (k > 2) {
+                        p[k - 2] = (1 - k) * p[k - 1] + (k - 2 * n) * p[k - 3];
+                    } else if (k == 2) {
+                        p[0] = -p[1];
+                    }
+                }
+                if ((n & 0x1) == 0) {
+                    v *= x;
+                }
+
+                coeff *= f;
+                function[n] = coeff * v;
+
+            }
+        }
+
+        // apply function composition
+        compose(operand, operandOffset, function, result, resultOffset);
+
+    }
+
+    /** Compute inverse hyperbolic sine of a derivative structure.
+     * @param operand array holding the operand
+     * @param operandOffset offset of the operand in its array
+     * @param result array where result must be stored (for
+     * inverse hyperbolic sine the result array <em>cannot</em> be the input
+     * array)
+     * @param resultOffset offset of the result in its array
+     */
+    public void asinh(final double[] operand, final int operandOffset,
+                     final double[] result, final int resultOffset) {
+
+        // create the function value and derivatives
+        double[] function = new double[1 + order];
+        final double x = operand[operandOffset];
+        function[0] = FastMath.asinh(x);
+        if (order > 0) {
+            // the nth order derivative of asinh has the form:
+            // dn(asinh(x)/dxn = P_n(x) / [x^2 + 1]^((2n-1)/2)
+            // where P_n(x) is a degree n-1 polynomial with same parity as n-1
+            // P_1(x) = 1, P_2(x) = -x, P_3(x) = 2x^2 - 1 ...
+            // the general recurrence relation for P_n is:
+            // P_n(x) = (x^2+1) P_(n-1)'(x) - (2n-3) x P_(n-1)(x)
+            // as per polynomial parity, we can store coefficients of both P_(n-1) and P_n in the same array
+            final double[] p = new double[order];
+            p[0] = 1;
+            final double x2    = x * x;
+            final double f     = 1.0 / (1 + x2);
+            double coeff = FastMath.sqrt(f);
+            function[1] = coeff * p[0];
+            for (int n = 2; n <= order; ++n) {
+
+                // update and evaluate polynomial P_n(x)
+                double v = 0;
+                p[n - 1] = (1 - n) * p[n - 2];
+                for (int k = n - 1; k >= 0; k -= 2) {
+                    v = v * x2 + p[k];
+                    if (k > 2) {
+                        p[k - 2] = (k - 1) * p[k - 1] + (k - 2 * n) * p[k - 3];
+                    } else if (k == 2) {
+                        p[0] = p[1];
+                    }
+                }
+                if ((n & 0x1) == 0) {
+                    v *= x;
+                }
+
+                coeff *= f;
+                function[n] = coeff * v;
+
+            }
+        }
+
+        // apply function composition
+        compose(operand, operandOffset, function, result, resultOffset);
+
+    }
+
+    /** Compute inverse hyperbolic tangent of a derivative structure.
+     * @param operand array holding the operand
+     * @param operandOffset offset of the operand in its array
+     * @param result array where result must be stored (for
+     * inverse hyperbolic tangent the result array <em>cannot</em> be the input
+     * array)
+     * @param resultOffset offset of the result in its array
+     */
+    public void atanh(final double[] operand, final int operandOffset,
+                      final double[] result, final int resultOffset) {
+
+        // create the function value and derivatives
+        double[] function = new double[1 + order];
+        final double x = operand[operandOffset];
+        function[0] = FastMath.atanh(x);
+        if (order > 0) {
+            // the nth order derivative of atanh has the form:
+            // dn(atanh(x)/dxn = Q_n(x) / (1 - x^2)^n
+            // where Q_n(x) is a degree n-1 polynomial with same parity as n-1
+            // Q_1(x) = 1, Q_2(x) = 2x, Q_3(x) = 6x^2 + 2 ...
+            // the general recurrence relation for Q_n is:
+            // Q_n(x) = (1-x^2) Q_(n-1)'(x) + 2(n-1) x Q_(n-1)(x)
+            // as per polynomial parity, we can store coefficients of both Q_(n-1) and Q_n in the same array
+            final double[] q = new double[order];
+            q[0] = 1;
+            final double x2 = x * x;
+            final double f  = 1.0 / (1 - x2);
+            double coeff = f;
+            function[1] = coeff * q[0];
+            for (int n = 2; n <= order; ++n) {
+
+                // update and evaluate polynomial Q_n(x)
+                double v = 0;
+                q[n - 1] = n * q[n - 2];
+                for (int k = n - 1; k >= 0; k -= 2) {
+                    v = v * x2 + q[k];
+                    if (k > 2) {
+                        q[k - 2] = (k - 1) * q[k - 1] + (2 * n - k + 1) * q[k - 3];
+                    } else if (k == 2) {
+                        q[0] = q[1];
+                    }
+                }
+                if ((n & 0x1) == 0) {
+                    v *= x;
+                }
+
+                coeff *= f;
+                function[n] = coeff * v;
+
+            }
+        }
+
+        // apply function composition
+        compose(operand, operandOffset, function, result, resultOffset);
+
+    }
+
+    /** Compute composition of a derivative structure by a function.
+     * @param operand array holding the operand
+     * @param operandOffset offset of the operand in its array
+     * @param f array of value and derivatives of the function at
+     * the current point (i.e. at {@code operand[operandOffset]}).
+     * @param result array where result must be stored (for
+     * composition the result array <em>cannot</em> be the input
+     * array)
+     * @param resultOffset offset of the result in its array
+     */
+    public void compose(final double[] operand, final int operandOffset, final double[] f,
+                        final double[] result, final int resultOffset) {
+        for (int i = 0; i < compIndirection.length; ++i) {
+            final int[][] mappingI = compIndirection[i];
+            double r = 0;
+            for (int j = 0; j < mappingI.length; ++j) {
+                final int[] mappingIJ = mappingI[j];
+                double product = mappingIJ[0] * f[mappingIJ[1]];
+                for (int k = 2; k < mappingIJ.length; ++k) {
+                    product *= operand[operandOffset + mappingIJ[k]];
+                }
+                r += product;
+            }
+            result[resultOffset + i] = r;
+        }
+    }
+
+    /** Evaluate Taylor expansion of a derivative structure.
+     * @param ds array holding the derivative structure
+     * @param dsOffset offset of the derivative structure in its array
+     * @param delta parameters offsets (&Delta;x, &Delta;y, ...)
+     * @return value of the Taylor expansion at x + &Delta;x, y + &Delta;y, ...
+     * @throws MathArithmeticException if factorials becomes too large
+     */
+    public double taylor(final double[] ds, final int dsOffset, final double ... delta)
+       throws MathArithmeticException {
+        double value = 0;
+        for (int i = getSize() - 1; i >= 0; --i) {
+            final int[] orders = getPartialDerivativeOrders(i);
+            double term = ds[dsOffset + i];
+            for (int k = 0; k < orders.length; ++k) {
+                if (orders[k] > 0) {
+                    try {
+                        term *= FastMath.pow(delta[k], orders[k]) / FACTORIAL.value(orders[k]);
+                    } catch (NotPositiveException e) {
+                        // this cannot happen
+                        throw new MathInternalError(e);
+                    }
+                }
+            }
+            value += term;
+        }
+        return value;
+    }
+
+    /** Check rules set compatibility.
+     * @param compiler other compiler to check against instance
+     * @exception DimensionMismatchException if number of free parameters or orders are inconsistent
+     */
+    public void checkCompatibility(final DSCompiler compiler)
+            throws DimensionMismatchException {
+        if (parameters != compiler.parameters) {
+            throw new DimensionMismatchException(parameters, compiler.parameters);
+        }
+        if (order != compiler.order) {
+            throw new DimensionMismatchException(order, compiler.order);
+        }
+    }
+
+}
diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/differentiation/DerivativeStructure.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/differentiation/DerivativeStructure.java
new file mode 100644
index 0000000..56ea24c
--- /dev/null
+++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/differentiation/DerivativeStructure.java
@@ -0,0 +1,1256 @@
+/*
+ * 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.legacy.analysis.differentiation;
+
+import java.io.Serializable;
+
+import org.apache.commons.numbers.arrays.LinearCombination;
+import org.apache.commons.math4.legacy.Field;
+import org.apache.commons.math4.legacy.FieldElement;
+import org.apache.commons.math4.legacy.RealFieldElement;
+import org.apache.commons.math4.legacy.exception.DimensionMismatchException;
+import org.apache.commons.math4.legacy.exception.MathArithmeticException;
+import org.apache.commons.math4.legacy.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.legacy.util.FastMath;
+import org.apache.commons.math4.legacy.util.MathArrays;
+import org.apache.commons.math4.legacy.util.MathUtils;
+
+/** Class representing both the value and the differentials of a function.
+ * <p>This class is the workhorse of the differentiation package.</p>
+ * <p>This class is an implementation of the extension to Rall's
+ * numbers described in Dan Kalman's paper <a
+ * href="http://www1.american.edu/cas/mathstat/People/kalman/pdffiles/mmgautodiff.pdf">Doubly
+ * Recursive Multivariate Automatic Differentiation</a>, Mathematics Magazine, vol. 75,
+ * no. 3, June 2002. Rall's numbers are an extension to the real numbers used
+ * throughout mathematical expressions; they hold the derivative together with the
+ * value of a function. Dan Kalman's derivative structures hold all partial derivatives
+ * up to any specified order, with respect to any number of free parameters. Rall's
+ * numbers therefore can be seen as derivative structures for order one derivative and
+ * one free parameter, and real numbers can be seen as derivative structures with zero
+ * order derivative and no free parameters.</p>
+ * <p>{@link DerivativeStructure} instances can be used directly thanks to
+ * the arithmetic operators to the mathematical functions provided as
+ * methods by this class (+, -, *, /, %, sin, cos ...).</p>
+ * <p>Implementing complex expressions by hand using these classes is
+ * a tedious and error-prone task but has the advantage of having no limitation
+ * on the derivation order despite not requiring users to compute the derivatives by
+ * themselves. Implementing complex expression can also be done by developing computation
+ * code using standard primitive double values and to use {@link
+ * UnivariateFunctionDifferentiator differentiators} to create the {@link
+ * DerivativeStructure}-based instances. This method is simpler but may be limited in
+ * the accuracy and derivation orders and may be computationally intensive (this is
+ * typically the case for {@link FiniteDifferencesDifferentiator finite differences
+ * differentiator}.</p>
+ * <p>Instances of this class are guaranteed to be immutable.</p>
+ * @see DSCompiler
+ * @since 3.1
+ */
+public class DerivativeStructure implements RealFieldElement<DerivativeStructure>, Serializable {
+
+    /** Serializable UID. */
+    private static final long serialVersionUID = 20120730L;
+
+    /** Compiler for the current dimensions. */
+    private transient DSCompiler compiler;
+
+    /** Combined array holding all values. */
+    private final double[] data;
+
+    /** Build an instance with all values and derivatives set to 0.
+     * @param compiler compiler to use for computation
+     */
+    private DerivativeStructure(final DSCompiler compiler) {
+        this.compiler = compiler;
+        this.data     = new double[compiler.getSize()];
+    }
+
+    /** Build an instance with all values and derivatives set to 0.
+     * @param parameters number of free parameters
+     * @param order derivation order
+     * @throws NumberIsTooLargeException if order is too large
+     */
+    public DerivativeStructure(final int parameters, final int order)
+        throws NumberIsTooLargeException {
+        this(DSCompiler.getCompiler(parameters, order));
+    }
+
+    /** Build an instance representing a constant value.
+     * @param parameters number of free parameters
+     * @param order derivation order
+     * @param value value of the constant
+     * @throws NumberIsTooLargeException if order is too large
+     * @see #DerivativeStructure(int, int, int, double)
+     */
+    public DerivativeStructure(final int parameters, final int order, final double value)
+        throws NumberIsTooLargeException {
+        this(parameters, order);
+        this.data[0] = value;
+    }
+
+    /** Build an instance representing a variable.
+     * <p>Instances built using this constructor are considered
+     * to be the free variables with respect to which differentials
+     * are computed. As such, their differential with respect to
+     * themselves is +1.</p>
+     * @param parameters number of free parameters
+     * @param order derivation order
+     * @param index index of the variable (from 0 to {@code parameters - 1})
+     * @param value value of the variable
+     * @exception NumberIsTooLargeException if {@code index &ge; parameters}.
+     * @see #DerivativeStructure(int, int, double)
+     */
+    public DerivativeStructure(final int parameters, final int order,
+                               final int index, final double value)
+        throws NumberIsTooLargeException {
+        this(parameters, order, value);
+
+        if (index >= parameters) {
+            throw new NumberIsTooLargeException(index, parameters, false);
+        }
+
+        if (order > 0) {
+            // the derivative of the variable with respect to itself is 1.
+            data[DSCompiler.getCompiler(index, order).getSize()] = 1.0;
+        }
+
+    }
+
+    /** Linear combination constructor.
+     * The derivative structure built will be a1 * ds1 + a2 * ds2
+     * @param a1 first scale factor
+     * @param ds1 first base (unscaled) derivative structure
+     * @param a2 second scale factor
+     * @param ds2 second base (unscaled) derivative structure
+     * @exception DimensionMismatchException if number of free parameters or orders are inconsistent
+     */
+    public DerivativeStructure(final double a1, final DerivativeStructure ds1,
+                               final double a2, final DerivativeStructure ds2)
+        throws DimensionMismatchException {
+        this(ds1.compiler);
+        compiler.checkCompatibility(ds2.compiler);
+        compiler.linearCombination(a1, ds1.data, 0, a2, ds2.data, 0, data, 0);
+    }
+
+    /** Linear combination constructor.
+     * The derivative structure built will be a1 * ds1 + a2 * ds2 + a3 * ds3
+     * @param a1 first scale factor
+     * @param ds1 first base (unscaled) derivative structure
+     * @param a2 second scale factor
+     * @param ds2 second base (unscaled) derivative structure
+     * @param a3 third scale factor
+     * @param ds3 third base (unscaled) derivative structure
+     * @exception DimensionMismatchException if number of free parameters or orders are inconsistent
+     */
+    public DerivativeStructure(final double a1, final DerivativeStructure ds1,
+                               final double a2, final DerivativeStructure ds2,
+                               final double a3, final DerivativeStructure ds3)
+        throws DimensionMismatchException {
+        this(ds1.compiler);
+        compiler.checkCompatibility(ds2.compiler);
+        compiler.checkCompatibility(ds3.compiler);
+        compiler.linearCombination(a1, ds1.data, 0, a2, ds2.data, 0, a3, ds3.data, 0, data, 0);
+    }
+
+    /** Linear combination constructor.
+     * The derivative structure built will be a1 * ds1 + a2 * ds2 + a3 * ds3 + a4 * ds4
+     * @param a1 first scale factor
+     * @param ds1 first base (unscaled) derivative structure
+     * @param a2 second scale factor
+     * @param ds2 second base (unscaled) derivative structure
+     * @param a3 third scale factor
+     * @param ds3 third base (unscaled) derivative structure
+     * @param a4 fourth scale factor
+     * @param ds4 fourth base (unscaled) derivative structure
+     * @exception DimensionMismatchException if number of free parameters or orders are inconsistent
+     */
+    public DerivativeStructure(final double a1, final DerivativeStructure ds1,
+                               final double a2, final DerivativeStructure ds2,
+                               final double a3, final DerivativeStructure ds3,
+                               final double a4, final DerivativeStructure ds4)
+        throws DimensionMismatchException {
+        this(ds1.compiler);
+        compiler.checkCompatibility(ds2.compiler);
+        compiler.checkCompatibility(ds3.compiler);
+        compiler.checkCompatibility(ds4.compiler);
+        compiler.linearCombination(a1, ds1.data, 0, a2, ds2.data, 0,
+                                   a3, ds3.data, 0, a4, ds4.data, 0,
+                                   data, 0);
+    }
+
+    /** Build an instance from all its derivatives.
+     * @param parameters number of free parameters
+     * @param order derivation order
+     * @param derivatives derivatives sorted according to
+     * {@link DSCompiler#getPartialDerivativeIndex(int...)}
+     * @exception DimensionMismatchException if derivatives array does not match the
+     * {@link DSCompiler#getSize() size} expected by the compiler
+     * @throws NumberIsTooLargeException if order is too large
+     * @see #getAllDerivatives()
+     */
+    public DerivativeStructure(final int parameters, final int order, final double ... derivatives)
+        throws DimensionMismatchException, NumberIsTooLargeException {
+        this(parameters, order);
+        if (derivatives.length != data.length) {
+            throw new DimensionMismatchException(derivatives.length, data.length);
+        }
+        System.arraycopy(derivatives, 0, data, 0, data.length);
+    }
+
+    /** Copy constructor.
+     * @param ds instance to copy
+     */
+    private DerivativeStructure(final DerivativeStructure ds) {
+        this.compiler = ds.compiler;
+        this.data     = ds.data.clone();
+    }
+
+    /** Get the number of free parameters.
+     * @return number of free parameters
+     */
+    public int getFreeParameters() {
+        return compiler.getFreeParameters();
+    }
+
+    /** Get the derivation order.
+     * @return derivation order
+     */
+    public int getOrder() {
+        return compiler.getOrder();
+    }
+
+    /** Create a constant compatible with instance order and number of parameters.
+     * <p>
+     * This method is a convenience factory method, it simply calls
+     * {@code new DerivativeStructure(getFreeParameters(), getOrder(), c)}
+     * </p>
+     * @param c value of the constant
+     * @return a constant compatible with instance order and number of parameters
+     * @see #DerivativeStructure(int, int, double)
+     * @since 3.3
+     */
+    public DerivativeStructure createConstant(final double c) {
+        return new DerivativeStructure(getFreeParameters(), getOrder(), c);
+    }
+
+    /** {@inheritDoc}
+     * @since 3.2
+     */
+    @Override
+    public double getReal() {
+        return data[0];
+    }
+
+    /** Get the value part of the derivative structure.
+     * @return value part of the derivative structure
+     * @see #getPartialDerivative(int...)
+     */
+    public double getValue() {
+        return data[0];
+    }
+
+    /** Get a partial derivative.
+     * @param orders derivation orders with respect to each variable (if all orders are 0,
+     * the value is returned)
+     * @return partial derivative
+     * @see #getValue()
+     * @exception DimensionMismatchException if the numbers of variables does not
+     * match the instance
+     * @exception NumberIsTooLargeException if sum of derivation orders is larger
+     * than the instance limits
+     */
+    public double getPartialDerivative(final int ... orders)
+        throws DimensionMismatchException, NumberIsTooLargeException {
+        return data[compiler.getPartialDerivativeIndex(orders)];
+    }
+
+    /** Get all partial derivatives.
+     * @return a fresh copy of partial derivatives, in an array sorted according to
+     * {@link DSCompiler#getPartialDerivativeIndex(int...)}
+     */
+    public double[] getAllDerivatives() {
+        return data.clone();
+    }
+
+    /** {@inheritDoc}
+     * @since 3.2
+     */
+    @Override
+    public DerivativeStructure add(final double a) {
+        final DerivativeStructure ds = new DerivativeStructure(this);
+        ds.data[0] += a;
+        return ds;
+    }
+
+    /** {@inheritDoc}
+     * @exception DimensionMismatchException if number of free parameters
+     * or orders do not match
+     */
+    @Override
+    public DerivativeStructure add(final DerivativeStructure a)
+        throws DimensionMismatchException {
+        compiler.checkCompatibility(a.compiler);
+        final DerivativeStructure ds = new DerivativeStructure(this);
+        compiler.add(data, 0, a.data, 0, ds.data, 0);
+        return ds;
+    }
+
+    /** {@inheritDoc}
+     * @since 3.2
+     */
+    @Override
+    public DerivativeStructure subtract(final double a) {
+        return add(-a);
+    }
+
+    /** {@inheritDoc}
+     * @exception DimensionMismatchException if number of free parameters
+     * or orders do not match
+     */
+    @Override
+    public DerivativeStructure subtract(final DerivativeStructure a)
+        throws DimensionMismatchException {
+        compiler.checkCompatibility(a.compiler);
+        final DerivativeStructure ds = new DerivativeStructure(this);
+        compiler.subtract(data, 0, a.data, 0, ds.data, 0);
+        return ds;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public DerivativeStructure multiply(final int n) {
+        return multiply((double) n);
+    }
+
+    /** {@inheritDoc}
+     * @since 3.2
+     */
+    @Override
+    public DerivativeStructure multiply(final double a) {
+        final DerivativeStructure ds = new DerivativeStructure(this);
+        for (int i = 0; i < ds.data.length; ++i) {
+            ds.data[i] *= a;
+        }
+        return ds;
+    }
+
+    /** {@inheritDoc}
+     * @exception DimensionMismatchException if number of free parameters
+     * or orders do not match
+     */
+    @Override
+    public DerivativeStructure multiply(final DerivativeStructure a)
+        throws DimensionMismatchException {
+        compiler.checkCompatibility(a.compiler);
+        final DerivativeStructure result = new DerivativeStructure(compiler);
+        compiler.multiply(data, 0, a.data, 0, result.data, 0);
+        return result;
+    }
+
+    /** {@inheritDoc}
+     * @since 3.2
+     */
+    @Override
+    public DerivativeStructure divide(final double a) {
+        final DerivativeStructure ds = new DerivativeStructure(this);
+        for (int i = 0; i < ds.data.length; ++i) {
+            ds.data[i] /= a;
+        }
+        return ds;
+    }
+
+    /** {@inheritDoc}
+     * @exception DimensionMismatchException if number of free parameters
+     * or orders do not match
+     */
+    @Override
+    public DerivativeStructure divide(final DerivativeStructure a)
+        throws DimensionMismatchException {
+        compiler.checkCompatibility(a.compiler);
+        final DerivativeStructure result = new DerivativeStructure(compiler);
+        compiler.divide(data, 0, a.data, 0, result.data, 0);
+        return result;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public DerivativeStructure remainder(final double a) {
+        final DerivativeStructure ds = new DerivativeStructure(this);
+        ds.data[0] = FastMath.IEEEremainder(ds.data[0], a);
+        return ds;
+    }
+
+    /** {@inheritDoc}
+     * @exception DimensionMismatchException if number of free parameters
+     * or orders do not match
+     * @since 3.2
+     */
+    @Override
+    public DerivativeStructure remainder(final DerivativeStructure a)
+        throws DimensionMismatchException {
+        compiler.checkCompatibility(a.compiler);
+        final DerivativeStructure result = new DerivativeStructure(compiler);
+        compiler.remainder(data, 0, a.data, 0, result.data, 0);
+        return result;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public DerivativeStructure negate() {
+        final DerivativeStructure ds = new DerivativeStructure(compiler);
+        for (int i = 0; i < ds.data.length; ++i) {
+            ds.data[i] = -data[i];
+        }
+        return ds;
+    }
+
+    /** {@inheritDoc}
+     * @since 3.2
+     */
+    @Override
+    public DerivativeStructure abs() {
+        if (Double.doubleToLongBits(data[0]) < 0) {
+            // we use the bits representation to also handle -0.0
+            return negate();
+        } else {
+            return this;
+        }
+    }
+
+    /** {@inheritDoc}
+     * @since 3.2
+     */
+    @Override
+    public DerivativeStructure ceil() {
+        return new DerivativeStructure(compiler.getFreeParameters(),
+                                       compiler.getOrder(),
+                                       FastMath.ceil(data[0]));
+    }
+
+    /** {@inheritDoc}
+     * @since 3.2
+     */
+    @Override
+    public DerivativeStructure floor() {
+        return new DerivativeStructure(compiler.getFreeParameters(),
+                                       compiler.getOrder(),
+                                       FastMath.floor(data[0]));
+    }
+
+    /** {@inheritDoc}
+     * @since 3.2
+     */
+    @Override
+    public DerivativeStructure rint() {
+        return new DerivativeStructure(compiler.getFreeParameters(),
+                                       compiler.getOrder(),
+                                       FastMath.rint(data[0]));
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public long round() {
+        return FastMath.round(data[0]);
+    }
+
+    /** {@inheritDoc}
+     * @since 3.2
+     */
+    @Override
+    public DerivativeStructure signum() {
+        return new DerivativeStructure(compiler.getFreeParameters(),
+                                       compiler.getOrder(),
+                                       FastMath.signum(data[0]));
+    }
+
+    /** {@inheritDoc}
+     * @since 3.2
+     */
+    @Override
+    public DerivativeStructure copySign(final DerivativeStructure sign){
+        long m = Double.doubleToLongBits(data[0]);
+        long s = Double.doubleToLongBits(sign.data[0]);
+        if ((m >= 0 && s >= 0) || (m < 0 && s < 0)) { // Sign is currently OK
+            return this;
+        }
+        return negate(); // flip sign
+    }
+
+    /** {@inheritDoc}
+     * @since 3.2
+     */
+    @Override
+    public DerivativeStructure copySign(final double sign) {
+        long m = Double.doubleToLongBits(data[0]);
+        long s = Double.doubleToLongBits(sign);
+        if ((m >= 0 && s >= 0) || (m < 0 && s < 0)) { // Sign is currently OK
+            return this;
+        }
+        return negate(); // flip sign
+    }
+
+    /**
+     * Return the exponent of the instance value, removing the bias.
+     * <p>
+     * For double numbers of the form 2<sup>x</sup>, the unbiased
+     * exponent is exactly x.
+     * </p>
+     * @return exponent for instance in IEEE754 representation, without bias
+     */
+    public int getExponent() {
+        return FastMath.getExponent(data[0]);
+    }
+
+    /** {@inheritDoc}
+     * @since 3.2
+     */
+    @Override
+    public DerivativeStructure scalb(final int n) {
+        final DerivativeStructure ds = new DerivativeStructure(compiler);
+        for (int i = 0; i < ds.data.length; ++i) {
+            ds.data[i] = FastMath.scalb(data[i], n);
+        }
+        return ds;
+    }
+
+    /** {@inheritDoc}
+     * @exception DimensionMismatchException if number of free parameters
+     * or orders do not match
+     * @since 3.2
+     */
+    @Override
+    public DerivativeStructure hypot(final DerivativeStructure y)
+        throws DimensionMismatchException {
+
+        compiler.checkCompatibility(y.compiler);
+
+        if (Double.isInfinite(data[0]) || Double.isInfinite(y.data[0])) {
+            return new DerivativeStructure(compiler.getFreeParameters(),
+                                           compiler.getFreeParameters(),
+                                           Double.POSITIVE_INFINITY);
+        } else if (Double.isNaN(data[0]) || Double.isNaN(y.data[0])) {
+            return new DerivativeStructure(compiler.getFreeParameters(),
+                                           compiler.getFreeParameters(),
+                                           Double.NaN);
+        } else {
+
+            final int expX = getExponent();
+            final int expY = y.getExponent();
+            if (expX > expY + 27) {
+                // y is neglectible with respect to x
+                return abs();
+            } else if (expY > expX + 27) {
+                // x is neglectible with respect to y
+                return y.abs();
+            } else {
+
+                // find an intermediate scale to avoid both overflow and underflow
+                final int middleExp = (expX + expY) / 2;
+
+                // scale parameters without losing precision
+                final DerivativeStructure scaledX = scalb(-middleExp);
+                final DerivativeStructure scaledY = y.scalb(-middleExp);
+
+                // compute scaled hypotenuse
+                final DerivativeStructure scaledH =
+                        scaledX.multiply(scaledX).add(scaledY.multiply(scaledY)).sqrt();
+
+                // remove scaling
+                return scaledH.scalb(middleExp);
+
+            }
+
+        }
+    }
+
+    /**
+     * Returns the hypotenuse of a triangle with sides {@code x} and {@code y}
+     * - sqrt(<i>x</i><sup>2</sup>&nbsp;+<i>y</i><sup>2</sup>)
+     * avoiding intermediate overflow or underflow.
+     *
+     * <ul>
+     * <li> If either argument is infinite, then the result is positive infinity.</li>
+     * <li> else, if either argument is NaN then the result is NaN.</li>
+     * </ul>
+     *
+     * @param x a value
+     * @param y a value
+     * @return sqrt(<i>x</i><sup>2</sup>&nbsp;+<i>y</i><sup>2</sup>)
+     * @exception DimensionMismatchException if number of free parameters
+     * or orders do not match
+     * @since 3.2
+     */
+    public static DerivativeStructure hypot(final DerivativeStructure x, final DerivativeStructure y)
+        throws DimensionMismatchException {
+        return x.hypot(y);
+    }
+
+    /** Compute composition of the instance by a univariate function.
+     * @param f array of value and derivatives of the function at
+     * the current point (i.e. [f({@link #getValue()}),
+     * f'({@link #getValue()}), f''({@link #getValue()})...]).
+     * @return f(this)
+     * @exception DimensionMismatchException if the number of derivatives
+     * in the array is not equal to {@link #getOrder() order} + 1
+     */
+    public DerivativeStructure compose(final double ... f)
+        throws DimensionMismatchException {
+        if (f.length != getOrder() + 1) {
+            throw new DimensionMismatchException(f.length, getOrder() + 1);
+        }
+        final DerivativeStructure result = new DerivativeStructure(compiler);
+        compiler.compose(data, 0, f, result.data, 0);
+        return result;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public DerivativeStructure reciprocal() {
+        final DerivativeStructure result = new DerivativeStructure(compiler);
+        compiler.pow(data, 0, -1, result.data, 0);
+        return result;
+    }
+
+    /** {@inheritDoc}
+     * @since 3.2
+     */
+    @Override
+    public DerivativeStructure sqrt() {
+        return rootN(2);
+    }
+
+    /** {@inheritDoc}
+     * @since 3.2
+     */
+    @Override
+    public DerivativeStructure cbrt() {
+        return rootN(3);
+    }
+
+    /** {@inheritDoc}
+     * @since 3.2
+     */
+    @Override
+    public DerivativeStructure rootN(final int n) {
+        final DerivativeStructure result = new DerivativeStructure(compiler);
+        compiler.rootN(data, 0, n, result.data, 0);
+        return result;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public Field<DerivativeStructure> getField() {
+        return new Field<DerivativeStructure>() {
+
+            /** {@inheritDoc} */
+            @Override
+            public DerivativeStructure getZero() {
+                return new DerivativeStructure(compiler.getFreeParameters(), compiler.getOrder(), 0.0);
+            }
+
+            /** {@inheritDoc} */
+            @Override
+            public DerivativeStructure getOne() {
+                return new DerivativeStructure(compiler.getFreeParameters(), compiler.getOrder(), 1.0);
+            }
+
+            /** {@inheritDoc} */
+            @Override
+            public Class<? extends FieldElement<DerivativeStructure>> getRuntimeClass() {
+                return DerivativeStructure.class;
+            }
+
+        };
+    }
+
+    /** Compute a<sup>x</sup> where a is a double and x a {@link DerivativeStructure}
+     * @param a number to exponentiate
+     * @param x power to apply
+     * @return a<sup>x</sup>
+     * @since 3.3
+     */
+    public static DerivativeStructure pow(final double a, final DerivativeStructure x) {
+        final DerivativeStructure result = new DerivativeStructure(x.compiler);
+        x.compiler.pow(a, x.data, 0, result.data, 0);
+        return result;
+    }
+
+    /** {@inheritDoc}
+     * @since 3.2
+     */
+    @Override
+    public DerivativeStructure pow(final double p) {
+        final DerivativeStructure result = new DerivativeStructure(compiler);
+        compiler.pow(data, 0, p, result.data, 0);
+        return result;
+    }
+
+    /** {@inheritDoc}
+     * @since 3.2
+     */
+    @Override
+    public DerivativeStructure pow(final int n) {
+        final DerivativeStructure result = new DerivativeStructure(compiler);
+        compiler.pow(data, 0, n, result.data, 0);
+        return result;
+    }
+
+    /** {@inheritDoc}
+     * @exception DimensionMismatchException if number of free parameters
+     * or orders do not match
+     * @since 3.2
+     */
+    @Override
+    public DerivativeStructure pow(final DerivativeStructure e)
+        throws DimensionMismatchException {
+        compiler.checkCompatibility(e.compiler);
+        final DerivativeStructure result = new DerivativeStructure(compiler);
+        compiler.pow(data, 0, e.data, 0, result.data, 0);
+        return result;
+    }
+
+    /** {@inheritDoc}
+     * @since 3.2
+     */
+    @Override
+    public DerivativeStructure exp() {
+        final DerivativeStructure result = new DerivativeStructure(compiler);
+        compiler.exp(data, 0, result.data, 0);
+        return result;
+    }
+
+    /** {@inheritDoc}
+     * @since 3.2
+     */
+    @Override
+    public DerivativeStructure expm1() {
+        final DerivativeStructure result = new DerivativeStructure(compiler);
+        compiler.expm1(data, 0, result.data, 0);
+        return result;
+    }
+
+    /** {@inheritDoc}
+     * @since 3.2
+     */
+    @Override
+    public DerivativeStructure log() {
+        final DerivativeStructure result = new DerivativeStructure(compiler);
+        compiler.log(data, 0, result.data, 0);
+        return result;
+    }
+
+    /** {@inheritDoc}
+     * @since 3.2
+     */
+    @Override
+    public DerivativeStructure log1p() {
+        final DerivativeStructure result = new DerivativeStructure(compiler);
+        compiler.log1p(data, 0, result.data, 0);
+        return result;
+    }
+
+    /** Base 10 logarithm.
+     * @return base 10 logarithm of the instance
+     */
+    @Override
+    public DerivativeStructure log10() {
+        final DerivativeStructure result = new DerivativeStructure(compiler);
+        compiler.log10(data, 0, result.data, 0);
+        return result;
+    }
+
+    /** {@inheritDoc}
+     * @since 3.2
+     */
+    @Override
+    public DerivativeStructure cos() {
+        final DerivativeStructure result = new DerivativeStructure(compiler);
+        compiler.cos(data, 0, result.data, 0);
+        return result;
+    }
+
+    /** {@inheritDoc}
+     * @since 3.2
+     */
+    @Override
+    public DerivativeStructure sin() {
+        final DerivativeStructure result = new DerivativeStructure(compiler);
+        compiler.sin(data, 0, result.data, 0);
+        return result;
+    }
+
+    /** {@inheritDoc}
+     * @since 3.2
+     */
+    @Override
+    public DerivativeStructure tan() {
+        final DerivativeStructure result = new DerivativeStructure(compiler);
+        compiler.tan(data, 0, result.data, 0);
+        return result;
+    }
+
+    /** {@inheritDoc}
+     * @since 3.2
+     */
+    @Override
+    public DerivativeStructure acos() {
+        final DerivativeStructure result = new DerivativeStructure(compiler);
+        compiler.acos(data, 0, result.data, 0);
+        return result;
+    }
+
+    /** {@inheritDoc}
+     * @since 3.2
+     */
+    @Override
+    public DerivativeStructure asin() {
+        final DerivativeStructure result = new DerivativeStructure(compiler);
+        compiler.asin(data, 0, result.data, 0);
+        return result;
+    }
+
+    /** {@inheritDoc}
+     * @since 3.2
+     */
+    @Override
+    public DerivativeStructure atan() {
+        final DerivativeStructure result = new DerivativeStructure(compiler);
+        compiler.atan(data, 0, result.data, 0);
+        return result;
+    }
+
+    /** {@inheritDoc}
+     * @since 3.2
+     */
+    @Override
+    public DerivativeStructure atan2(final DerivativeStructure x)
+        throws DimensionMismatchException {
+        compiler.checkCompatibility(x.compiler);
+        final DerivativeStructure result = new DerivativeStructure(compiler);
+        compiler.atan2(data, 0, x.data, 0, result.data, 0);
+        return result;
+    }
+
+    /** Two arguments arc tangent operation.
+     * @param y first argument of the arc tangent
+     * @param x second argument of the arc tangent
+     * @return atan2(y, x)
+     * @exception DimensionMismatchException if number of free parameters
+     * or orders do not match
+     * @since 3.2
+     */
+    public static DerivativeStructure atan2(final DerivativeStructure y, final DerivativeStructure x)
+        throws DimensionMismatchException {
+        return y.atan2(x);
+    }
+
+    /** {@inheritDoc}
+     * @since 3.2
+     */
+    @Override
+    public DerivativeStructure cosh() {
+        final DerivativeStructure result = new DerivativeStructure(compiler);
+        compiler.cosh(data, 0, result.data, 0);
+        return result;
+    }
+
+    /** {@inheritDoc}
+     * @since 3.2
+     */
+    @Override
+    public DerivativeStructure sinh() {
+        final DerivativeStructure result = new DerivativeStructure(compiler);
+        compiler.sinh(data, 0, result.data, 0);
+        return result;
+    }
+
+    /** {@inheritDoc}
+     * @since 3.2
+     */
+    @Override
+    public DerivativeStructure tanh() {
+        final DerivativeStructure result = new DerivativeStructure(compiler);
+        compiler.tanh(data, 0, result.data, 0);
+        return result;
+    }
+
+    /** {@inheritDoc}
+     * @since 3.2
+     */
+    @Override
+    public DerivativeStructure acosh() {
+        final DerivativeStructure result = new DerivativeStructure(compiler);
+        compiler.acosh(data, 0, result.data, 0);
+        return result;
+    }
+
+    /** {@inheritDoc}
+     * @since 3.2
+     */
+    @Override
+    public DerivativeStructure asinh() {
+        final DerivativeStructure result = new DerivativeStructure(compiler);
+        compiler.asinh(data, 0, result.data, 0);
+        return result;
+    }
+
+    /** {@inheritDoc}
+     * @since 3.2
+     */
+    @Override
+    public DerivativeStructure atanh() {
+        final DerivativeStructure result = new DerivativeStructure(compiler);
+        compiler.atanh(data, 0, result.data, 0);
+        return result;
+    }
+
+    /** Convert radians to degrees, with error of less than 0.5 ULP
+     *  @return instance converted into degrees
+     */
+    public DerivativeStructure toDegrees() {
+        final DerivativeStructure ds = new DerivativeStructure(compiler);
+        for (int i = 0; i < ds.data.length; ++i) {
+            ds.data[i] = FastMath.toDegrees(data[i]);
+        }
+        return ds;
+    }
+
+    /** Convert degrees to radians, with error of less than 0.5 ULP
+     *  @return instance converted into radians
+     */
+    public DerivativeStructure toRadians() {
+        final DerivativeStructure ds = new DerivativeStructure(compiler);
+        for (int i = 0; i < ds.data.length; ++i) {
+            ds.data[i] = FastMath.toRadians(data[i]);
+        }
+        return ds;
+    }
+
+    /** Evaluate Taylor expansion a derivative structure.
+     * @param delta parameters offsets (&Delta;x, &Delta;y, ...)
+     * @return value of the Taylor expansion at x + &Delta;x, y + &Delta;y, ...
+     * @throws MathArithmeticException if factorials becomes too large
+     */
+    public double taylor(final double ... delta) throws MathArithmeticException {
+        return compiler.taylor(data, 0, delta);
+    }
+
+    /** {@inheritDoc}
+     * @exception DimensionMismatchException if number of free parameters
+     * or orders do not match
+     * @since 3.2
+     */
+    @Override
+    public DerivativeStructure linearCombination(final DerivativeStructure[] a, final DerivativeStructure[] b)
+        throws DimensionMismatchException {
+
+        // compute an accurate value, taking care of cancellations
+        final double[] aDouble = new double[a.length];
+        for (int i = 0; i < a.length; ++i) {
+            aDouble[i] = a[i].getValue();
+        }
+        final double[] bDouble = new double[b.length];
+        for (int i = 0; i < b.length; ++i) {
+            bDouble[i] = b[i].getValue();
+        }
+        final double accurateValue = LinearCombination.value(aDouble, bDouble);
+
+        // compute a simple value, with all partial derivatives
+        DerivativeStructure simpleValue = a[0].getField().getZero();
+        for (int i = 0; i < a.length; ++i) {
+            simpleValue = simpleValue.add(a[i].multiply(b[i]));
+        }
+
+        // create a result with accurate value and all derivatives (not necessarily as accurate as the value)
+        final double[] all = simpleValue.getAllDerivatives();
+        all[0] = accurateValue;
+        return new DerivativeStructure(simpleValue.getFreeParameters(), simpleValue.getOrder(), all);
+
+    }
+
+    /** {@inheritDoc}
+     * @exception DimensionMismatchException if number of free parameters
+     * or orders do not match
+     * @since 3.2
+     */
+    @Override
+    public DerivativeStructure linearCombination(final double[] a, final DerivativeStructure[] b)
+        throws DimensionMismatchException {
+
+        // compute an accurate value, taking care of cancellations
+        final double[] bDouble = new double[b.length];
+        for (int i = 0; i < b.length; ++i) {
+            bDouble[i] = b[i].getValue();
+        }
+        final double accurateValue = LinearCombination.value(a, bDouble);
+
+        // compute a simple value, with all partial derivatives
+        DerivativeStructure simpleValue = b[0].getField().getZero();
+        for (int i = 0; i < a.length; ++i) {
+            simpleValue = simpleValue.add(b[i].multiply(a[i]));
+        }
+
+        // create a result with accurate value and all derivatives (not necessarily as accurate as the value)
+        final double[] all = simpleValue.getAllDerivatives();
+        all[0] = accurateValue;
+        return new DerivativeStructure(simpleValue.getFreeParameters(), simpleValue.getOrder(), all);
+
+    }
+
+    /** {@inheritDoc}
+     * @exception DimensionMismatchException if number of free parameters
+     * or orders do not match
+     * @since 3.2
+     */
+    @Override
+    public DerivativeStructure linearCombination(final DerivativeStructure a1, final DerivativeStructure b1,
+                                                 final DerivativeStructure a2, final DerivativeStructure b2)
+        throws DimensionMismatchException {
+
+        // compute an accurate value, taking care of cancellations
+        final double accurateValue = LinearCombination.value(a1.getValue(), b1.getValue(),
+                                                                  a2.getValue(), b2.getValue());
+
+        // compute a simple value, with all partial derivatives
+        final DerivativeStructure simpleValue = a1.multiply(b1).add(a2.multiply(b2));
+
+        // create a result with accurate value and all derivatives (not necessarily as accurate as the value)
+        final double[] all = simpleValue.getAllDerivatives();
+        all[0] = accurateValue;
+        return new DerivativeStructure(getFreeParameters(), getOrder(), all);
+
+    }
+
+    /** {@inheritDoc}
+     * @exception DimensionMismatchException if number of free parameters
+     * or orders do not match
+     * @since 3.2
+     */
+    @Override
+    public DerivativeStructure linearCombination(final double a1, final DerivativeStructure b1,
+                                                 final double a2, final DerivativeStructure b2)
+        throws DimensionMismatchException {
+
+        // compute an accurate value, taking care of cancellations
+        final double accurateValue = LinearCombination.value(a1, b1.getValue(),
+                                                                  a2, b2.getValue());
+
+        // compute a simple value, with all partial derivatives
+        final DerivativeStructure simpleValue = b1.multiply(a1).add(b2.multiply(a2));
+
+        // create a result with accurate value and all derivatives (not necessarily as accurate as the value)
+        final double[] all = simpleValue.getAllDerivatives();
+        all[0] = accurateValue;
+        return new DerivativeStructure(getFreeParameters(), getOrder(), all);
+
+    }
+
+    /** {@inheritDoc}
+     * @exception DimensionMismatchException if number of free parameters
+     * or orders do not match
+     * @since 3.2
+     */
+    @Override
+    public DerivativeStructure linearCombination(final DerivativeStructure a1, final DerivativeStructure b1,
+                                                 final DerivativeStructure a2, final DerivativeStructure b2,
+                                                 final DerivativeStructure a3, final DerivativeStructure b3)
+        throws DimensionMismatchException {
+
+        // compute an accurate value, taking care of cancellations
+        final double accurateValue = LinearCombination.value(a1.getValue(), b1.getValue(),
+                                                                  a2.getValue(), b2.getValue(),
+                                                                  a3.getValue(), b3.getValue());
+
+        // compute a simple value, with all partial derivatives
+        final DerivativeStructure simpleValue = a1.multiply(b1).add(a2.multiply(b2)).add(a3.multiply(b3));
+
+        // create a result with accurate value and all derivatives (not necessarily as accurate as the value)
+        final double[] all = simpleValue.getAllDerivatives();
+        all[0] = accurateValue;
+        return new DerivativeStructure(getFreeParameters(), getOrder(), all);
+
+    }
+
+    /** {@inheritDoc}
+     * @exception DimensionMismatchException if number of free parameters
+     * or orders do not match
+     * @since 3.2
+     */
+    @Override
+    public DerivativeStructure linearCombination(final double a1, final DerivativeStructure b1,
+                                                 final double a2, final DerivativeStructure b2,
+                                                 final double a3, final DerivativeStructure b3)
+        throws DimensionMismatchException {
+
+        // compute an accurate value, taking care of cancellations
+        final double accurateValue = LinearCombination.value(a1, b1.getValue(),
+                                                                  a2, b2.getValue(),
+                                                                  a3, b3.getValue());
+
+        // compute a simple value, with all partial derivatives
+        final DerivativeStructure simpleValue = b1.multiply(a1).add(b2.multiply(a2)).add(b3.multiply(a3));
+
+        // create a result with accurate value and all derivatives (not necessarily as accurate as the value)
+        final double[] all = simpleValue.getAllDerivatives();
+        all[0] = accurateValue;
+        return new DerivativeStructure(getFreeParameters(), getOrder(), all);
+
+    }
+
+    /** {@inheritDoc}
+     * @exception DimensionMismatchException if number of free parameters
+     * or orders do not match
+     * @since 3.2
+     */
+    @Override
+    public DerivativeStructure linearCombination(final DerivativeStructure a1, final DerivativeStructure b1,
+                                                 final DerivativeStructure a2, final DerivativeStructure b2,
+                                                 final DerivativeStructure a3, final DerivativeStructure b3,
+                                                 final DerivativeStructure a4, final DerivativeStructure b4)
+        throws DimensionMismatchException {
+
+        // compute an accurate value, taking care of cancellations
+        final double accurateValue = LinearCombination.value(a1.getValue(), b1.getValue(),
+                                                                  a2.getValue(), b2.getValue(),
+                                                                  a3.getValue(), b3.getValue(),
+                                                                  a4.getValue(), b4.getValue());
+
+        // compute a simple value, with all partial derivatives
+        final DerivativeStructure simpleValue = a1.multiply(b1).add(a2.multiply(b2)).add(a3.multiply(b3)).add(a4.multiply(b4));
+
+        // create a result with accurate value and all derivatives (not necessarily as accurate as the value)
+        final double[] all = simpleValue.getAllDerivatives();
+        all[0] = accurateValue;
+        return new DerivativeStructure(getFreeParameters(), getOrder(), all);
+
+    }
+
+    /** {@inheritDoc}
+     * @exception DimensionMismatchException if number of free parameters
+     * or orders do not match
+     * @since 3.2
+     */
+    @Override
+    public DerivativeStructure linearCombination(final double a1, final DerivativeStructure b1,
+                                                 final double a2, final DerivativeStructure b2,
+                                                 final double a3, final DerivativeStructure b3,
+                                                 final double a4, final DerivativeStructure b4)
+        throws DimensionMismatchException {
+
+        // compute an accurate value, taking care of cancellations
+        final double accurateValue = LinearCombination.value(a1, b1.getValue(),
+                                                                  a2, b2.getValue(),
+                                                                  a3, b3.getValue(),
+                                                                  a4, b4.getValue());
+
+        // compute a simple value, with all partial derivatives
+        final DerivativeStructure simpleValue = b1.multiply(a1).add(b2.multiply(a2)).add(b3.multiply(a3)).add(b4.multiply(a4));
+
+        // create a result with accurate value and all derivatives (not necessarily as accurate as the value)
+        final double[] all = simpleValue.getAllDerivatives();
+        all[0] = accurateValue;
+        return new DerivativeStructure(getFreeParameters(), getOrder(), all);
+
+    }
+
+    /**
+     * Test for the equality of two derivative structures.
+     * <p>
+     * Derivative structures are considered equal if they have the same number
+     * of free parameters, the same derivation order, and the same derivatives.
+     * </p>
+     * @param other Object to test for equality to this
+     * @return true if two derivative structures are equal
+     * @since 3.2
+     */
+    @Override
+    public boolean equals(Object other) {
+
+        if (this == other) {
+            return true;
+        }
+
+        if (other instanceof DerivativeStructure) {
+            final DerivativeStructure rhs = (DerivativeStructure)other;
+            return (getFreeParameters() == rhs.getFreeParameters()) &&
+                   (getOrder() == rhs.getOrder()) &&
+                   MathArrays.equals(data, rhs.data);
+        }
+
+        return false;
+
+    }
+
+    /**
+     * Get a hashCode for the derivative structure.
+     * @return a hash code value for this object
+     * @since 3.2
+     */
+    @Override
+    public int hashCode() {
+        return 227 + 229 * getFreeParameters() + 233 * getOrder() + 239 * MathUtils.hash(data);
+    }
+
+    /**
+     * Replace the instance with a data transfer object for serialization.
+     * @return data transfer object that will be serialized
+     */
+    private Object writeReplace() {
+        return new DataTransferObject(compiler.getFreeParameters(), compiler.getOrder(), data);
+    }
+
+    /** Internal class used only for serialization. */
+    private static class DataTransferObject implements Serializable {
+
+        /** Serializable UID. */
+        private static final long serialVersionUID = 20120730L;
+
+        /** Number of variables.
+         * @serial
+         */
+        private final int variables;
+
+        /** Derivation order.
+         * @serial
+         */
+        private final int order;
+
+        /** Partial derivatives.
+         * @serial
+         */
+        private final double[] data;
+
+        /** Simple constructor.
+         * @param variables number of variables
+         * @param order derivation order
+         * @param data partial derivatives
+         */
+        DataTransferObject(final int variables, final int order, final double[] data) {
+            this.variables = variables;
+            this.order     = order;
+            this.data      = data;
+        }
+
+        /** Replace the deserialized data transfer object with a {@link DerivativeStructure}.
+         * @return replacement {@link DerivativeStructure}
+         */
+        private Object readResolve() {
+            return new DerivativeStructure(variables, order, data);
+        }
+
+    }
+
+}
diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/differentiation/FiniteDifferencesDifferentiator.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/differentiation/FiniteDifferencesDifferentiator.java
new file mode 100644
index 0000000..c008751
--- /dev/null
+++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/differentiation/FiniteDifferencesDifferentiator.java
@@ -0,0 +1,393 @@
+/*
+ * 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.legacy.analysis.differentiation;
+
+import java.io.Serializable;
+
+import org.apache.commons.math4.legacy.analysis.UnivariateFunction;
+import org.apache.commons.math4.legacy.analysis.UnivariateMatrixFunction;
+import org.apache.commons.math4.legacy.analysis.UnivariateVectorFunction;
+import org.apache.commons.math4.legacy.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.legacy.exception.NotPositiveException;
+import org.apache.commons.math4.legacy.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.legacy.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.legacy.util.FastMath;
+
+/** Univariate functions differentiator using finite differences.
+ * <p>
+ * This class creates some wrapper objects around regular
+ * {@link UnivariateFunction univariate functions} (or {@link
+ * UnivariateVectorFunction univariate vector functions} or {@link
+ * UnivariateMatrixFunction univariate matrix functions}). These
+ * wrapper objects compute derivatives in addition to function
+ * values.
+ * </p>
+ * <p>
+ * The wrapper objects work by calling the underlying function on
+ * a sampling grid around the current point and performing polynomial
+ * interpolation. A finite differences scheme with n points is
+ * theoretically able to compute derivatives up to order n-1, but
+ * it is generally better to have a slight margin. The step size must
+ * also be small enough in order for the polynomial approximation to
+ * be good in the current point neighborhood, but it should not be too
+ * small because numerical instability appears quickly (there are several
+ * differences of close points). Choosing the number of points and
+ * the step size is highly problem dependent.
+ * </p>
+ * <p>
+ * As an example of good and bad settings, lets consider the quintic
+ * polynomial function {@code f(x) = (x-1)*(x-0.5)*x*(x+0.5)*(x+1)}.
+ * Since it is a polynomial, finite differences with at least 6 points
+ * should theoretically recover the exact same polynomial and hence
+ * compute accurate derivatives for any order. However, due to numerical
+ * errors, we get the following results for a 7 points finite differences
+ * for abscissae in the [-10, 10] range:
+ * <ul>
+ *   <li>step size = 0.25, second order derivative error about 9.97e-10</li>
+ *   <li>step size = 0.25, fourth order derivative error about 5.43e-8</li>
+ *   <li>step size = 1.0e-6, second order derivative error about 148</li>
+ *   <li>step size = 1.0e-6, fourth order derivative error about 6.35e+14</li>
+ * </ul>
+ * <p>
+ * This example shows that the small step size is really bad, even simply
+ * for second order derivative!</p>
+ *
+ * @since 3.1
+ */
+public class FiniteDifferencesDifferentiator
+    implements UnivariateFunctionDifferentiator, UnivariateVectorFunctionDifferentiator,
+               UnivariateMatrixFunctionDifferentiator, Serializable {
+
+    /** Serializable UID. */
+    private static final long serialVersionUID = 20120917L;
+
+    /** Number of points to use. */
+    private final int nbPoints;
+
+    /** Step size. */
+    private final double stepSize;
+
+    /** Half sample span. */
+    private final double halfSampleSpan;
+
+    /** Lower bound for independent variable. */
+    private final double tMin;
+
+    /** Upper bound for independent variable. */
+    private final double tMax;
+
+    /**
+     * Build a differentiator with number of points and step size when independent variable is unbounded.
+     * <p>
+     * Beware that wrong settings for the finite differences differentiator
+     * can lead to highly unstable and inaccurate results, especially for
+     * high derivation orders. Using very small step sizes is often a
+     * <em>bad</em> idea.
+     * </p>
+     * @param nbPoints number of points to use
+     * @param stepSize step size (gap between each point)
+     * @exception NotPositiveException if {@code stepsize <= 0} (note that
+     * {@link NotPositiveException} extends {@link NumberIsTooSmallException})
+     * @exception NumberIsTooSmallException {@code nbPoint <= 1}
+     */
+    public FiniteDifferencesDifferentiator(final int nbPoints, final double stepSize)
+        throws NotPositiveException, NumberIsTooSmallException {
+        this(nbPoints, stepSize, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY);
+    }
+
+    /**
+     * Build a differentiator with number of points and step size when independent variable is bounded.
+     * <p>
+     * When the independent variable is bounded (tLower &lt; t &lt; tUpper), the sampling
+     * points used for differentiation will be adapted to ensure the constraint holds
+     * even near the boundaries. This means the sample will not be centered anymore in
+     * these cases. At an extreme case, computing derivatives exactly at the lower bound
+     * will lead the sample to be entirely on the right side of the derivation point.
+     * </p>
+     * <p>
+     * Note that the boundaries are considered to be excluded for function evaluation.
+     * </p>
+     * <p>
+     * Beware that wrong settings for the finite differences differentiator
+     * can lead to highly unstable and inaccurate results, especially for
+     * high derivation orders. Using very small step sizes is often a
+     * <em>bad</em> idea.
+     * </p>
+     * @param nbPoints number of points to use
+     * @param stepSize step size (gap between each point)
+     * @param tLower lower bound for independent variable (may be {@code Double.NEGATIVE_INFINITY}
+     * if there are no lower bounds)
+     * @param tUpper upper bound for independent variable (may be {@code Double.POSITIVE_INFINITY}
+     * if there are no upper bounds)
+     * @exception NotPositiveException if {@code stepsize <= 0} (note that
+     * {@link NotPositiveException} extends {@link NumberIsTooSmallException})
+     * @exception NumberIsTooSmallException {@code nbPoint <= 1}
+     * @exception NumberIsTooLargeException {@code stepSize * (nbPoints - 1) >= tUpper - tLower}
+     */
+    public FiniteDifferencesDifferentiator(final int nbPoints, final double stepSize,
+                                           final double tLower, final double tUpper)
+            throws NotPositiveException, NumberIsTooSmallException, NumberIsTooLargeException {
+
+        if (nbPoints <= 1) {
+            throw new NumberIsTooSmallException(stepSize, 1, false);
+        }
+        this.nbPoints = nbPoints;
+
+        if (stepSize <= 0) {
+            throw new NotPositiveException(stepSize);
+        }
+        this.stepSize = stepSize;
+
+        halfSampleSpan = 0.5 * stepSize * (nbPoints - 1);
+        if (2 * halfSampleSpan >= tUpper - tLower) {
+            throw new NumberIsTooLargeException(2 * halfSampleSpan, tUpper - tLower, false);
+        }
+        final double safety = FastMath.ulp(halfSampleSpan);
+        this.tMin = tLower + halfSampleSpan + safety;
+        this.tMax = tUpper - halfSampleSpan - safety;
+
+    }
+
+    /**
+     * Get the number of points to use.
+     * @return number of points to use
+     */
+    public int getNbPoints() {
+        return nbPoints;
+    }
+
+    /**
+     * Get the step size.
+     * @return step size
+     */
+    public double getStepSize() {
+        return stepSize;
+    }
+
+    /**
+     * Evaluate derivatives from a sample.
+     * <p>
+     * Evaluation is done using divided differences.
+     * </p>
+     * @param t evaluation abscissa value and derivatives
+     * @param t0 first sample point abscissa
+     * @param y function values sample {@code y[i] = f(t[i]) = f(t0 + i * stepSize)}
+     * @return value and derivatives at {@code t}
+     * @exception NumberIsTooLargeException if the requested derivation order
+     * is larger or equal to the number of points
+     */
+    private DerivativeStructure evaluate(final DerivativeStructure t, final double t0,
+                                         final double[] y)
+        throws NumberIsTooLargeException {
+
+        // create divided differences diagonal arrays
+        final double[] top    = new double[nbPoints];
+        final double[] bottom = new double[nbPoints];
+
+        for (int i = 0; i < nbPoints; ++i) {
+
+            // update the bottom diagonal of the divided differences array
+            bottom[i] = y[i];
+            for (int j = 1; j <= i; ++j) {
+                bottom[i - j] = (bottom[i - j + 1] - bottom[i - j]) / (j * stepSize);
+            }
+
+            // update the top diagonal of the divided differences array
+            top[i] = bottom[0];
+
+        }
+
+        // evaluate interpolation polynomial (represented by top diagonal) at t
+        final int order            = t.getOrder();
+        final int parameters       = t.getFreeParameters();
+        final double[] derivatives = t.getAllDerivatives();
+        final double dt0           = t.getValue() - t0;
+        DerivativeStructure interpolation = new DerivativeStructure(parameters, order, 0.0);
+        DerivativeStructure monomial = null;
+        for (int i = 0; i < nbPoints; ++i) {
+            if (i == 0) {
+                // start with monomial(t) = 1
+                monomial = new DerivativeStructure(parameters, order, 1.0);
+            } else {
+                // monomial(t) = (t - t0) * (t - t1) * ... * (t - t(i-1))
+                derivatives[0] = dt0 - (i - 1) * stepSize;
+                final DerivativeStructure deltaX = new DerivativeStructure(parameters, order, derivatives);
+                monomial = monomial.multiply(deltaX);
+            }
+            interpolation = interpolation.add(monomial.multiply(top[i]));
+        }
+
+        return interpolation;
+
+    }
+
+    /** {@inheritDoc}
+     * <p>The returned object cannot compute derivatives to arbitrary orders. The
+     * value function will throw a {@link NumberIsTooLargeException} if the requested
+     * derivation order is larger or equal to the number of points.
+     * </p>
+     */
+    @Override
+    public UnivariateDifferentiableFunction differentiate(final UnivariateFunction function) {
+        return new UnivariateDifferentiableFunction() {
+
+            /** {@inheritDoc} */
+            @Override
+            public double value(final double x) throws MathIllegalArgumentException {
+                return function.value(x);
+            }
+
+            /** {@inheritDoc} */
+            @Override
+            public DerivativeStructure value(final DerivativeStructure t)
+                throws MathIllegalArgumentException {
+
+                // check we can achieve the requested derivation order with the sample
+                if (t.getOrder() >= nbPoints) {
+                    throw new NumberIsTooLargeException(t.getOrder(), nbPoints, false);
+                }
+
+                // compute sample position, trying to be centered if possible
+                final double t0 = FastMath.max(FastMath.min(t.getValue(), tMax), tMin) - halfSampleSpan;
+
+                // compute sample points
+                final double[] y = new double[nbPoints];
+                for (int i = 0; i < nbPoints; ++i) {
+                    y[i] = function.value(t0 + i * stepSize);
+                }
+
+                // evaluate derivatives
+                return evaluate(t, t0, y);
+
+            }
+
+        };
+    }
+
+    /** {@inheritDoc}
+     * <p>The returned object cannot compute derivatives to arbitrary orders. The
+     * value function will throw a {@link NumberIsTooLargeException} if the requested
+     * derivation order is larger or equal to the number of points.
+     * </p>
+     */
+    @Override
+    public UnivariateDifferentiableVectorFunction differentiate(final UnivariateVectorFunction function) {
+        return new UnivariateDifferentiableVectorFunction() {
+
+            /** {@inheritDoc} */
+            @Override
+            public double[]value(final double x) throws MathIllegalArgumentException {
+                return function.value(x);
+            }
+
+            /** {@inheritDoc} */
+            @Override
+            public DerivativeStructure[] value(final DerivativeStructure t)
+                throws MathIllegalArgumentException {
+
+                // check we can achieve the requested derivation order with the sample
+                if (t.getOrder() >= nbPoints) {
+                    throw new NumberIsTooLargeException(t.getOrder(), nbPoints, false);
+                }
+
+                // compute sample position, trying to be centered if possible
+                final double t0 = FastMath.max(FastMath.min(t.getValue(), tMax), tMin) - halfSampleSpan;
+
+                // compute sample points
+                double[][] y = null;
+                for (int i = 0; i < nbPoints; ++i) {
+                    final double[] v = function.value(t0 + i * stepSize);
+                    if (i == 0) {
+                        y = new double[v.length][nbPoints];
+                    }
+                    for (int j = 0; j < v.length; ++j) {
+                        y[j][i] = v[j];
+                    }
+                }
+
+                // evaluate derivatives
+                final DerivativeStructure[] value = new DerivativeStructure[y.length];
+                for (int j = 0; j < value.length; ++j) {
+                    value[j] = evaluate(t, t0, y[j]);
+                }
+
+                return value;
+
+            }
+
+        };
+    }
+
+    /** {@inheritDoc}
+     * <p>The returned object cannot compute derivatives to arbitrary orders. The
+     * value function will throw a {@link NumberIsTooLargeException} if the requested
+     * derivation order is larger or equal to the number of points.
+     * </p>
+     */
+    @Override
+    public UnivariateDifferentiableMatrixFunction differentiate(final UnivariateMatrixFunction function) {
+        return new UnivariateDifferentiableMatrixFunction() {
+
+            /** {@inheritDoc} */
+            @Override
+            public double[][]  value(final double x) throws MathIllegalArgumentException {
+                return function.value(x);
+            }
+
+            /** {@inheritDoc} */
+            @Override
+            public DerivativeStructure[][]  value(final DerivativeStructure t)
+                throws MathIllegalArgumentException {
+
+                // check we can achieve the requested derivation order with the sample
+                if (t.getOrder() >= nbPoints) {
+                    throw new NumberIsTooLargeException(t.getOrder(), nbPoints, false);
+                }
+
+                // compute sample position, trying to be centered if possible
+                final double t0 = FastMath.max(FastMath.min(t.getValue(), tMax), tMin) - halfSampleSpan;
+
+                // compute sample points
+                double[][][] y = null;
+                for (int i = 0; i < nbPoints; ++i) {
+                    final double[][] v = function.value(t0 + i * stepSize);
+                    if (i == 0) {
+                        y = new double[v.length][v[0].length][nbPoints];
+                    }
+                    for (int j = 0; j < v.length; ++j) {
+                        for (int k = 0; k < v[j].length; ++k) {
+                            y[j][k][i] = v[j][k];
+                        }
+                    }
+                }
+
+                // evaluate derivatives
+                final DerivativeStructure[][] value = new DerivativeStructure[y.length][y[0].length];
+                for (int j = 0; j < value.length; ++j) {
+                    for (int k = 0; k < y[j].length; ++k) {
+                        value[j][k] = evaluate(t, t0, y[j][k]);
+                    }
+                }
+
+                return value;
+
+            }
+
+        };
+    }
+
+}
diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/differentiation/GradientFunction.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/differentiation/GradientFunction.java
new file mode 100644
index 0000000..c9c9d33
--- /dev/null
+++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/differentiation/GradientFunction.java
@@ -0,0 +1,66 @@
+/*
+ * 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.legacy.analysis.differentiation;
+
+import org.apache.commons.math4.legacy.analysis.MultivariateVectorFunction;
+
+/** Class representing the gradient of a multivariate function.
+ * <p>
+ * The vectorial components of the function represent the derivatives
+ * with respect to each function parameters.
+ * </p>
+ * @since 3.1
+ */
+public class GradientFunction implements MultivariateVectorFunction {
+
+    /** Underlying real-valued function. */
+    private final MultivariateDifferentiableFunction f;
+
+    /** Simple constructor.
+     * @param f underlying real-valued function
+     */
+    public GradientFunction(final MultivariateDifferentiableFunction f) {
+        this.f = f;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public double[] value(double[] point) {
+
+        // set up parameters
+        final DerivativeStructure[] dsX = new DerivativeStructure[point.length];
+        for (int i = 0; i < point.length; ++i) {
+            dsX[i] = new DerivativeStructure(point.length, 1, i, point[i]);
+        }
+
+        // compute the derivatives
+        final DerivativeStructure dsY = f.value(dsX);
+
+        // extract the gradient
+        final double[] y = new double[point.length];
+        final int[] orders = new int[point.length];
+        for (int i = 0; i < point.length; ++i) {
+            orders[i] = 1;
+            y[i] = dsY.getPartialDerivative(orders);
+            orders[i] = 0;
+        }
+
+        return y;
+
+    }
+
+}
diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/differentiation/JacobianFunction.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/differentiation/JacobianFunction.java
new file mode 100644
index 0000000..4795950
--- /dev/null
+++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/differentiation/JacobianFunction.java
@@ -0,0 +1,70 @@
+/*
+ * 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.legacy.analysis.differentiation;
+
+import org.apache.commons.math4.legacy.analysis.MultivariateMatrixFunction;
+
+/** Class representing the Jacobian of a multivariate vector function.
+ * <p>
+ * The rows iterate on the model functions while the columns iterate on the parameters; thus,
+ * the numbers of rows is equal to the dimension of the underlying function vector
+ * value and the number of columns is equal to the number of free parameters of
+ * the underlying function.
+ * </p>
+ * @since 3.1
+ */
+public class JacobianFunction implements MultivariateMatrixFunction {
+
+    /** Underlying vector-valued function. */
+    private final MultivariateDifferentiableVectorFunction f;
+
+    /** Simple constructor.
+     * @param f underlying vector-valued function
+     */
+    public JacobianFunction(final MultivariateDifferentiableVectorFunction f) {
+        this.f = f;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public double[][] value(double[] point) {
+
+        // set up parameters
+        final DerivativeStructure[] dsX = new DerivativeStructure[point.length];
+        for (int i = 0; i < point.length; ++i) {
+            dsX[i] = new DerivativeStructure(point.length, 1, i, point[i]);
+        }
+
+        // compute the derivatives
+        final DerivativeStructure[] dsY = f.value(dsX);
+
+        // extract the Jacobian
+        final double[][] y = new double[dsY.length][point.length];
+        final int[] orders = new int[point.length];
+        for (int i = 0; i < dsY.length; ++i) {
+            for (int j = 0; j < point.length; ++j) {
+                orders[j] = 1;
+                y[i][j] = dsY[i].getPartialDerivative(orders);
+                orders[j] = 0;
+            }
+        }
+
+        return y;
+
+    }
+
+}
diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/differentiation/MultivariateDifferentiableFunction.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/differentiation/MultivariateDifferentiableFunction.java
new file mode 100644
index 0000000..e6c0504
--- /dev/null
+++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/differentiation/MultivariateDifferentiableFunction.java
@@ -0,0 +1,42 @@
+/*
+ * 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.legacy.analysis.differentiation;
+
+import org.apache.commons.math4.legacy.analysis.MultivariateFunction;
+import org.apache.commons.math4.legacy.exception.MathIllegalArgumentException;
+
+/**
+ * Extension of {@link MultivariateFunction} representing a
+ * multivariate differentiable real function.
+ * @since 3.1
+ */
+public interface MultivariateDifferentiableFunction extends MultivariateFunction {
+
+    /**
+     * Compute the value for the function at the given point.
+     *
+     * @param point Point at which the function must be evaluated.
+     * @return the function value for the given point.
+     * @exception MathIllegalArgumentException if {@code point} does not
+     * satisfy the function's constraints (wrong dimension, argument out of bound,
+     * or unsupported derivative order for example)
+     */
+    DerivativeStructure value(DerivativeStructure[] point)
+        throws MathIllegalArgumentException;
+
+}
diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/differentiation/MultivariateDifferentiableVectorFunction.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/differentiation/MultivariateDifferentiableVectorFunction.java
new file mode 100644
index 0000000..31426eb4
--- /dev/null
+++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/differentiation/MultivariateDifferentiableVectorFunction.java
@@ -0,0 +1,43 @@
+/*
+ * 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.legacy.analysis.differentiation;
+
+import org.apache.commons.math4.legacy.analysis.MultivariateVectorFunction;
+import org.apache.commons.math4.legacy.exception.MathIllegalArgumentException;
+
+
+/**
+ * Extension of {@link MultivariateVectorFunction} representing a
+ * multivariate differentiable vectorial function.
+ * @since 3.1
+ */
+public interface MultivariateDifferentiableVectorFunction
+    extends MultivariateVectorFunction {
+
+    /**
+     * Compute the value for the function at the given point.
+     * @param point point at which the function must be evaluated
+     * @return function value for the given point
+     * @exception MathIllegalArgumentException if {@code point} does not
+     * satisfy the function's constraints (wrong dimension, argument out of bound,
+     * or unsupported derivative order for example)
+     */
+    DerivativeStructure[] value(DerivativeStructure[] point)
+        throws MathIllegalArgumentException;
+
+}
diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/differentiation/SparseGradient.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/differentiation/SparseGradient.java
new file mode 100644
index 0000000..4deb958
--- /dev/null
+++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/differentiation/SparseGradient.java
@@ -0,0 +1,937 @@
+/*
+ * 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.legacy.analysis.differentiation;
+
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.commons.numbers.arrays.LinearCombination;
+import org.apache.commons.numbers.core.Precision;
+import org.apache.commons.math4.legacy.Field;
+import org.apache.commons.math4.legacy.FieldElement;
+import org.apache.commons.math4.legacy.RealFieldElement;
+import org.apache.commons.math4.legacy.exception.DimensionMismatchException;
+import org.apache.commons.math4.legacy.util.FastMath;
+import org.apache.commons.math4.legacy.util.MathUtils;
+
+/**
+ * First derivative computation with large number of variables.
+ * <p>
+ * This class plays a similar role to {@link DerivativeStructure}, with
+ * a focus on efficiency when dealing with large number of independent variables
+ * and most computation depend only on a few of them, and when only first derivative
+ * is desired. When these conditions are met, this class should be much faster than
+ * {@link DerivativeStructure} and use less memory.
+ * </p>
+ *
+ * @since 3.3
+ */
+public class SparseGradient implements RealFieldElement<SparseGradient>, Serializable {
+
+    /** Serializable UID. */
+    private static final long serialVersionUID = 20131025L;
+
+    /** Value of the calculation. */
+    private double value;
+
+    /** Stored derivative, each key representing a different independent variable. */
+    private final Map<Integer, Double> derivatives;
+
+    /** Internal constructor.
+     * @param value value of the function
+     * @param derivatives derivatives map, a deep copy will be performed,
+     * so the map given here will remain safe from changes in the new instance,
+     * may be null to create an empty derivatives map, i.e. a constant value
+     */
+    private SparseGradient(final double value, final Map<Integer, Double> derivatives) {
+        this.value = value;
+        this.derivatives = new HashMap<>();
+        if (derivatives != null) {
+            this.derivatives.putAll(derivatives);
+        }
+    }
+
+    /** Internal constructor.
+     * @param value value of the function
+     * @param scale scaling factor to apply to all derivatives
+     * @param derivatives derivatives map, a deep copy will be performed,
+     * so the map given here will remain safe from changes in the new instance,
+     * may be null to create an empty derivatives map, i.e. a constant value
+     */
+    private SparseGradient(final double value, final double scale,
+                             final Map<Integer, Double> derivatives) {
+        this.value = value;
+        this.derivatives = new HashMap<>();
+        if (derivatives != null) {
+            for (final Map.Entry<Integer, Double> entry : derivatives.entrySet()) {
+                this.derivatives.put(entry.getKey(), scale * entry.getValue());
+            }
+        }
+    }
+
+    /** Factory method creating a constant.
+     * @param value value of the constant
+     * @return a new instance
+     */
+    public static SparseGradient createConstant(final double value) {
+        return new SparseGradient(value, Collections.<Integer, Double> emptyMap());
+    }
+
+    /** Factory method creating an independent variable.
+     * @param idx index of the variable
+     * @param value value of the variable
+     * @return a new instance
+     */
+    public static SparseGradient createVariable(final int idx, final double value) {
+        return new SparseGradient(value, Collections.singletonMap(idx, 1.0));
+    }
+
+    /**
+     * Find the number of variables.
+     * @return number of variables
+     */
+    public int numVars() {
+        return derivatives.size();
+    }
+
+    /**
+     * Get the derivative with respect to a particular index variable.
+     *
+     * @param index index to differentiate with.
+     * @return derivative with respect to a particular index variable
+     */
+    public double getDerivative(final int index) {
+        final Double out = derivatives.get(index);
+        return (out == null) ? 0.0 : out;
+    }
+
+    /**
+     * Get the value of the function.
+     * @return value of the function.
+     */
+    public double getValue() {
+        return value;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public double getReal() {
+        return value;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient add(final SparseGradient a) {
+        final SparseGradient out = new SparseGradient(value + a.value, derivatives);
+        for (Map.Entry<Integer, Double> entry : a.derivatives.entrySet()) {
+            final int id = entry.getKey();
+            final Double old = out.derivatives.get(id);
+            if (old == null) {
+                out.derivatives.put(id, entry.getValue());
+            } else {
+                out.derivatives.put(id, old + entry.getValue());
+            }
+        }
+
+        return out;
+    }
+
+    /**
+     * Add in place.
+     * <p>
+     * This method is designed to be faster when used multiple times in a loop.
+     * </p>
+     * <p>
+     * The instance is changed here, in order to not change the
+     * instance the {@link #add(SparseGradient)} method should
+     * be used.
+     * </p>
+     * @param a instance to add
+     */
+    public void addInPlace(final SparseGradient a) {
+        value += a.value;
+        for (final Map.Entry<Integer, Double> entry : a.derivatives.entrySet()) {
+            final int id = entry.getKey();
+            final Double old = derivatives.get(id);
+            if (old == null) {
+                derivatives.put(id, entry.getValue());
+            } else {
+                derivatives.put(id, old + entry.getValue());
+            }
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient add(final double c) {
+        final SparseGradient out = new SparseGradient(value + c, derivatives);
+        return out;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient subtract(final SparseGradient a) {
+        final SparseGradient out = new SparseGradient(value - a.value, derivatives);
+        for (Map.Entry<Integer, Double> entry : a.derivatives.entrySet()) {
+            final int id = entry.getKey();
+            final Double old = out.derivatives.get(id);
+            if (old == null) {
+                out.derivatives.put(id, -entry.getValue());
+            } else {
+                out.derivatives.put(id, old - entry.getValue());
+            }
+        }
+        return out;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient subtract(double c) {
+        return new SparseGradient(value - c, derivatives);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient multiply(final SparseGradient a) {
+        final SparseGradient out =
+            new SparseGradient(value * a.value, Collections.<Integer, Double> emptyMap());
+
+        // Derivatives.
+        for (Map.Entry<Integer, Double> entry : derivatives.entrySet()) {
+            out.derivatives.put(entry.getKey(), a.value * entry.getValue());
+        }
+        for (Map.Entry<Integer, Double> entry : a.derivatives.entrySet()) {
+            final int id = entry.getKey();
+            final Double old = out.derivatives.get(id);
+            if (old == null) {
+                out.derivatives.put(id, value * entry.getValue());
+            } else {
+                out.derivatives.put(id, old + value * entry.getValue());
+            }
+        }
+        return out;
+    }
+
+    /**
+     * Multiply in place.
+     * <p>
+     * This method is designed to be faster when used multiple times in a loop.
+     * </p>
+     * <p>
+     * The instance is changed here, in order to not change the
+     * instance the {@link #add(SparseGradient)} method should
+     * be used.
+     * </p>
+     * @param a instance to multiply
+     */
+    public void multiplyInPlace(final SparseGradient a) {
+        // Derivatives.
+        for (Map.Entry<Integer, Double> entry : derivatives.entrySet()) {
+            derivatives.put(entry.getKey(), a.value * entry.getValue());
+        }
+        for (Map.Entry<Integer, Double> entry : a.derivatives.entrySet()) {
+            final int id = entry.getKey();
+            final Double old = derivatives.get(id);
+            if (old == null) {
+                derivatives.put(id, value * entry.getValue());
+            } else {
+                derivatives.put(id, old + value * entry.getValue());
+            }
+        }
+        value *= a.value;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient multiply(final double c) {
+        return new SparseGradient(value * c, c, derivatives);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient multiply(final int n) {
+        return new SparseGradient(value * n, n, derivatives);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient divide(final SparseGradient a) {
+        final SparseGradient out = new SparseGradient(value / a.value, Collections.<Integer, Double> emptyMap());
+
+        // Derivatives.
+        for (Map.Entry<Integer, Double> entry : derivatives.entrySet()) {
+            out.derivatives.put(entry.getKey(), entry.getValue() / a.value);
+        }
+        for (Map.Entry<Integer, Double> entry : a.derivatives.entrySet()) {
+            final int id = entry.getKey();
+            final Double old = out.derivatives.get(id);
+            if (old == null) {
+                out.derivatives.put(id, -out.value / a.value * entry.getValue());
+            } else {
+                out.derivatives.put(id, old - out.value / a.value * entry.getValue());
+            }
+        }
+        return out;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient divide(final double c) {
+        return new SparseGradient(value / c, 1.0 / c, derivatives);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient negate() {
+        return new SparseGradient(-value, -1.0, derivatives);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public Field<SparseGradient> getField() {
+        return new Field<SparseGradient>() {
+
+            /** {@inheritDoc} */
+            @Override
+            public SparseGradient getZero() {
+                return createConstant(0);
+            }
+
+            /** {@inheritDoc} */
+            @Override
+            public SparseGradient getOne() {
+                return createConstant(1);
+            }
+
+            /** {@inheritDoc} */
+            @Override
+            public Class<? extends FieldElement<SparseGradient>> getRuntimeClass() {
+                return SparseGradient.class;
+            }
+
+        };
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient remainder(final double a) {
+        return new SparseGradient(FastMath.IEEEremainder(value, a), derivatives);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient remainder(final SparseGradient a) {
+
+        // compute k such that lhs % rhs = lhs - k rhs
+        final double rem = FastMath.IEEEremainder(value, a.value);
+        final double k   = FastMath.rint((value - rem) / a.value);
+
+        return subtract(a.multiply(k));
+
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient abs() {
+        if (Double.doubleToLongBits(value) < 0) {
+            // we use the bits representation to also handle -0.0
+            return negate();
+        } else {
+            return this;
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient ceil() {
+        return createConstant(FastMath.ceil(value));
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient floor() {
+        return createConstant(FastMath.floor(value));
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient rint() {
+        return createConstant(FastMath.rint(value));
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public long round() {
+        return FastMath.round(value);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient signum() {
+        return createConstant(FastMath.signum(value));
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient copySign(final SparseGradient sign) {
+        final long m = Double.doubleToLongBits(value);
+        final long s = Double.doubleToLongBits(sign.value);
+        if ((m >= 0 && s >= 0) || (m < 0 && s < 0)) { // Sign is currently OK
+            return this;
+        }
+        return negate(); // flip sign
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient copySign(final double sign) {
+        final long m = Double.doubleToLongBits(value);
+        final long s = Double.doubleToLongBits(sign);
+        if ((m >= 0 && s >= 0) || (m < 0 && s < 0)) { // Sign is currently OK
+            return this;
+        }
+        return negate(); // flip sign
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient scalb(final int n) {
+        final SparseGradient out = new SparseGradient(FastMath.scalb(value, n), Collections.<Integer, Double> emptyMap());
+        for (Map.Entry<Integer, Double> entry : derivatives.entrySet()) {
+            out.derivatives.put(entry.getKey(), FastMath.scalb(entry.getValue(), n));
+        }
+        return out;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient hypot(final SparseGradient y) {
+        if (Double.isInfinite(value) || Double.isInfinite(y.value)) {
+            return createConstant(Double.POSITIVE_INFINITY);
+        } else if (Double.isNaN(value) || Double.isNaN(y.value)) {
+            return createConstant(Double.NaN);
+        } else {
+
+            final int expX = FastMath.getExponent(value);
+            final int expY = FastMath.getExponent(y.value);
+            if (expX > expY + 27) {
+                // y is negligible with respect to x
+                return abs();
+            } else if (expY > expX + 27) {
+                // x is negligible with respect to y
+                return y.abs();
+            } else {
+
+                // find an intermediate scale to avoid both overflow and underflow
+                final int middleExp = (expX + expY) / 2;
+
+                // scale parameters without losing precision
+                final SparseGradient scaledX = scalb(-middleExp);
+                final SparseGradient scaledY = y.scalb(-middleExp);
+
+                // compute scaled hypotenuse
+                final SparseGradient scaledH =
+                        scaledX.multiply(scaledX).add(scaledY.multiply(scaledY)).sqrt();
+
+                // remove scaling
+                return scaledH.scalb(middleExp);
+
+            }
+
+        }
+    }
+
+    /**
+     * Returns the hypotenuse of a triangle with sides {@code x} and {@code y}
+     * - sqrt(<i>x</i><sup>2</sup>&nbsp;+<i>y</i><sup>2</sup>)
+     * avoiding intermediate overflow or underflow.
+     *
+     * <ul>
+     * <li> If either argument is infinite, then the result is positive infinity.</li>
+     * <li> else, if either argument is NaN then the result is NaN.</li>
+     * </ul>
+     *
+     * @param x a value
+     * @param y a value
+     * @return sqrt(<i>x</i><sup>2</sup>&nbsp;+<i>y</i><sup>2</sup>)
+     */
+    public static SparseGradient hypot(final SparseGradient x, final SparseGradient y) {
+        return x.hypot(y);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient reciprocal() {
+        return new SparseGradient(1.0 / value, -1.0 / (value * value), derivatives);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient sqrt() {
+        final double sqrt = FastMath.sqrt(value);
+        return new SparseGradient(sqrt, 0.5 / sqrt, derivatives);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient cbrt() {
+        final double cbrt = FastMath.cbrt(value);
+        return new SparseGradient(cbrt, 1.0 / (3 * cbrt * cbrt), derivatives);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient rootN(final int n) {
+        if (n == 2) {
+            return sqrt();
+        } else if (n == 3) {
+            return cbrt();
+        } else {
+            final double root = FastMath.pow(value, 1.0 / n);
+            return new SparseGradient(root, 1.0 / (n * FastMath.pow(root, n - 1)), derivatives);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient pow(final double p) {
+        return new SparseGradient(FastMath.pow(value,  p), p * FastMath.pow(value,  p - 1), derivatives);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient pow(final int n) {
+        if (n == 0) {
+            return getField().getOne();
+        } else {
+            final double valueNm1 = FastMath.pow(value,  n - 1);
+            return new SparseGradient(value * valueNm1, n * valueNm1, derivatives);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient pow(final SparseGradient e) {
+        return log().multiply(e).exp();
+    }
+
+    /** Compute a<sup>x</sup> where a is a double and x a {@link SparseGradient}
+     * @param a number to exponentiate
+     * @param x power to apply
+     * @return a<sup>x</sup>
+     */
+    public static SparseGradient pow(final double a, final SparseGradient x) {
+        if (a == 0) {
+            if (x.value == 0) {
+                return x.compose(1.0, Double.NEGATIVE_INFINITY);
+            } else if (x.value < 0) {
+                return x.compose(Double.NaN, Double.NaN);
+            } else {
+                return x.getField().getZero();
+            }
+        } else {
+            final double ax = FastMath.pow(a, x.value);
+            return new SparseGradient(ax, ax * FastMath.log(a), x.derivatives);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient exp() {
+        final double e = FastMath.exp(value);
+        return new SparseGradient(e, e, derivatives);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient expm1() {
+        return new SparseGradient(FastMath.expm1(value), FastMath.exp(value), derivatives);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient log() {
+        return new SparseGradient(FastMath.log(value), 1.0 / value, derivatives);
+    }
+
+    /** Base 10 logarithm.
+     * @return base 10 logarithm of the instance
+     */
+    @Override
+    public SparseGradient log10() {
+        return new SparseGradient(FastMath.log10(value), 1.0 / (FastMath.log(10.0) * value), derivatives);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient log1p() {
+        return new SparseGradient(FastMath.log1p(value), 1.0 / (1.0 + value), derivatives);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient cos() {
+        return new SparseGradient(FastMath.cos(value), -FastMath.sin(value), derivatives);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient sin() {
+        return new SparseGradient(FastMath.sin(value), FastMath.cos(value), derivatives);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient tan() {
+        final double t = FastMath.tan(value);
+        return new SparseGradient(t, 1 + t * t, derivatives);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient acos() {
+        return new SparseGradient(FastMath.acos(value), -1.0 / FastMath.sqrt(1 - value * value), derivatives);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient asin() {
+        return new SparseGradient(FastMath.asin(value), 1.0 / FastMath.sqrt(1 - value * value), derivatives);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient atan() {
+        return new SparseGradient(FastMath.atan(value), 1.0 / (1 + value * value), derivatives);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient atan2(final SparseGradient x) {
+
+        // compute r = sqrt(x^2+y^2)
+        final SparseGradient r = multiply(this).add(x.multiply(x)).sqrt();
+
+        final SparseGradient a;
+        if (x.value >= 0) {
+
+            // compute atan2(y, x) = 2 atan(y / (r + x))
+            a = divide(r.add(x)).atan().multiply(2);
+
+        } else {
+
+            // compute atan2(y, x) = +/- pi - 2 atan(y / (r - x))
+            final SparseGradient tmp = divide(r.subtract(x)).atan().multiply(-2);
+            a = tmp.add(tmp.value <= 0 ? -FastMath.PI : FastMath.PI);
+
+        }
+
+        // fix value to take special cases (+0/+0, +0/-0, -0/+0, -0/-0, +/-infinity) correctly
+        a.value = FastMath.atan2(value, x.value);
+
+        return a;
+
+    }
+
+    /** Two arguments arc tangent operation.
+     * @param y first argument of the arc tangent
+     * @param x second argument of the arc tangent
+     * @return atan2(y, x)
+     */
+    public static SparseGradient atan2(final SparseGradient y, final SparseGradient x) {
+        return y.atan2(x);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient cosh() {
+        return new SparseGradient(FastMath.cosh(value), FastMath.sinh(value), derivatives);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient sinh() {
+        return new SparseGradient(FastMath.sinh(value), FastMath.cosh(value), derivatives);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient tanh() {
+        final double t = FastMath.tanh(value);
+        return new SparseGradient(t, 1 - t * t, derivatives);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient acosh() {
+        return new SparseGradient(FastMath.acosh(value), 1.0 / FastMath.sqrt(value * value - 1.0), derivatives);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient asinh() {
+        return new SparseGradient(FastMath.asinh(value), 1.0 / FastMath.sqrt(value * value + 1.0), derivatives);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient atanh() {
+        return new SparseGradient(FastMath.atanh(value), 1.0 / (1.0 - value * value), derivatives);
+    }
+
+    /** Convert radians to degrees, with error of less than 0.5 ULP
+     *  @return instance converted into degrees
+     */
+    public SparseGradient toDegrees() {
+        return new SparseGradient(FastMath.toDegrees(value), FastMath.toDegrees(1.0), derivatives);
+    }
+
+    /** Convert degrees to radians, with error of less than 0.5 ULP
+     *  @return instance converted into radians
+     */
+    public SparseGradient toRadians() {
+        return new SparseGradient(FastMath.toRadians(value), FastMath.toRadians(1.0), derivatives);
+    }
+
+    /** Evaluate Taylor expansion of a sparse gradient.
+     * @param delta parameters offsets (&Delta;x, &Delta;y, ...)
+     * @return value of the Taylor expansion at x + &Delta;x, y + &Delta;y, ...
+     */
+    public double taylor(final double ... delta) {
+        double y = value;
+        for (int i = 0; i < delta.length; ++i) {
+            y += delta[i] * getDerivative(i);
+        }
+        return y;
+    }
+
+    /** Compute composition of the instance by a univariate function.
+     * @param f0 value of the function at (i.e. f({@link #getValue()}))
+     * @param f1 first derivative of the function at
+     * the current point (i.e. f'({@link #getValue()}))
+     * @return f(this)
+    */
+    public SparseGradient compose(final double f0, final double f1) {
+        return new SparseGradient(f0, f1, derivatives);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient linearCombination(final SparseGradient[] a,
+                                              final SparseGradient[] b)
+        throws DimensionMismatchException {
+
+        // compute a simple value, with all partial derivatives
+        SparseGradient out = a[0].getField().getZero();
+        for (int i = 0; i < a.length; ++i) {
+            out = out.add(a[i].multiply(b[i]));
+        }
+
+        // recompute an accurate value, taking care of cancellations
+        final double[] aDouble = new double[a.length];
+        for (int i = 0; i < a.length; ++i) {
+            aDouble[i] = a[i].getValue();
+        }
+        final double[] bDouble = new double[b.length];
+        for (int i = 0; i < b.length; ++i) {
+            bDouble[i] = b[i].getValue();
+        }
+        out.value = LinearCombination.value(aDouble, bDouble);
+
+        return out;
+
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient linearCombination(final double[] a, final SparseGradient[] b) {
+
+        // compute a simple value, with all partial derivatives
+        SparseGradient out = b[0].getField().getZero();
+        for (int i = 0; i < a.length; ++i) {
+            out = out.add(b[i].multiply(a[i]));
+        }
+
+        // recompute an accurate value, taking care of cancellations
+        final double[] bDouble = new double[b.length];
+        for (int i = 0; i < b.length; ++i) {
+            bDouble[i] = b[i].getValue();
+        }
+        out.value = LinearCombination.value(a, bDouble);
+
+        return out;
+
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient linearCombination(final SparseGradient a1, final SparseGradient b1,
+                                              final SparseGradient a2, final SparseGradient b2) {
+
+        // compute a simple value, with all partial derivatives
+        SparseGradient out = a1.multiply(b1).add(a2.multiply(b2));
+
+        // recompute an accurate value, taking care of cancellations
+        out.value = LinearCombination.value(a1.value, b1.value, a2.value, b2.value);
+
+        return out;
+
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient linearCombination(final double a1, final SparseGradient b1,
+                                              final double a2, final SparseGradient b2) {
+
+        // compute a simple value, with all partial derivatives
+        SparseGradient out = b1.multiply(a1).add(b2.multiply(a2));
+
+        // recompute an accurate value, taking care of cancellations
+        out.value = LinearCombination.value(a1, b1.value, a2, b2.value);
+
+        return out;
+
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient linearCombination(final SparseGradient a1, final SparseGradient b1,
+                                              final SparseGradient a2, final SparseGradient b2,
+                                              final SparseGradient a3, final SparseGradient b3) {
+
+        // compute a simple value, with all partial derivatives
+        SparseGradient out = a1.multiply(b1).add(a2.multiply(b2)).add(a3.multiply(b3));
+
+        // recompute an accurate value, taking care of cancellations
+        out.value = LinearCombination.value(a1.value, b1.value,
+                                                 a2.value, b2.value,
+                                                 a3.value, b3.value);
+
+        return out;
+
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient linearCombination(final double a1, final SparseGradient b1,
+                                              final double a2, final SparseGradient b2,
+                                              final double a3, final SparseGradient b3) {
+
+        // compute a simple value, with all partial derivatives
+        SparseGradient out = b1.multiply(a1).add(b2.multiply(a2)).add(b3.multiply(a3));
+
+        // recompute an accurate value, taking care of cancellations
+        out.value = LinearCombination.value(a1, b1.value,
+                                                 a2, b2.value,
+                                                 a3, b3.value);
+
+        return out;
+
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient linearCombination(final SparseGradient a1, final SparseGradient b1,
+                                              final SparseGradient a2, final SparseGradient b2,
+                                              final SparseGradient a3, final SparseGradient b3,
+                                              final SparseGradient a4, final SparseGradient b4) {
+
+        // compute a simple value, with all partial derivatives
+        SparseGradient out = a1.multiply(b1).add(a2.multiply(b2)).add(a3.multiply(b3)).add(a4.multiply(b4));
+
+        // recompute an accurate value, taking care of cancellations
+        out.value = LinearCombination.value(a1.value, b1.value,
+                                                 a2.value, b2.value,
+                                                 a3.value, b3.value,
+                                                 a4.value, b4.value);
+
+        return out;
+
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public SparseGradient linearCombination(final double a1, final SparseGradient b1,
+                                              final double a2, final SparseGradient b2,
+                                              final double a3, final SparseGradient b3,
+                                              final double a4, final SparseGradient b4) {
+
+        // compute a simple value, with all partial derivatives
+        SparseGradient out = b1.multiply(a1).add(b2.multiply(a2)).add(b3.multiply(a3)).add(b4.multiply(a4));
+
+        // recompute an accurate value, taking care of cancellations
+        out.value = LinearCombination.value(a1, b1.value,
+                                                 a2, b2.value,
+                                                 a3, b3.value,
+                                                 a4, b4.value);
+
+        return out;
+
+    }
+
+    /**
+     * Test for the equality of two sparse gradients.
+     * <p>
+     * Sparse gradients are considered equal if they have the same value
+     * and the same derivatives.
+     * </p>
+     * @param other Object to test for equality to this
+     * @return true if two sparse gradients are equal
+     */
+    @Override
+    public boolean equals(Object other) {
+
+        if (this == other) {
+            return true;
+        }
+
+        if (other instanceof SparseGradient) {
+            final SparseGradient rhs = (SparseGradient)other;
+            if (!Precision.equals(value, rhs.value, 1)) {
+                return false;
+            }
+            if (derivatives.size() != rhs.derivatives.size()) {
+                return false;
+            }
+            for (final Map.Entry<Integer, Double> entry : derivatives.entrySet()) {
+                if (!rhs.derivatives.containsKey(entry.getKey())) {
+                    return false;
+                }
+                if (!Precision.equals(entry.getValue(), rhs.derivatives.get(entry.getKey()), 1)) {
+                    return false;
+                }
+            }
+            return true;
+        }
+
+        return false;
+
+    }
+
+    /**
+     * Get a hashCode for the derivative structure.
+     * @return a hash code value for this object
+     * @since 3.2
+     */
+    @Override
+    public int hashCode() {
+        return 743 + 809 * MathUtils.hash(value) + 167 * derivatives.hashCode();
+    }
+
+}
diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/differentiation/UnivariateDifferentiableFunction.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/differentiation/UnivariateDifferentiableFunction.java
new file mode 100644
index 0000000..1adf189
--- /dev/null
+++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/differentiation/UnivariateDifferentiableFunction.java
@@ -0,0 +1,43 @@
+/*
+ * 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.legacy.analysis.differentiation;
+
+import org.apache.commons.math4.legacy.analysis.UnivariateFunction;
+import org.apache.commons.math4.legacy.exception.DimensionMismatchException;
+
+/** Interface for univariate functions derivatives.
+ * <p>This interface represents a simple function which computes
+ * both the value and the first derivative of a mathematical function.
+ * The derivative is computed with respect to the input variable.</p>
+ * @see UnivariateDifferentiableFunction
+ * @see UnivariateFunctionDifferentiator
+ * @since 3.1
+ */
+public interface UnivariateDifferentiableFunction extends UnivariateFunction {
+
+    /** Simple mathematical function.
+     * <p>{@link UnivariateDifferentiableFunction} classes compute both the
+     * value and the first derivative of the function.</p>
+     * @param t function input value
+     * @return function result
+     * @exception DimensionMismatchException if t is inconsistent with the
+     * function's free parameters or order
+     */
+    DerivativeStructure value(DerivativeStructure t)
+        throws DimensionMismatchException;
+
+}
diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/differentiation/UnivariateDifferentiableMatrixFunction.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/differentiation/UnivariateDifferentiableMatrixFunction.java
new file mode 100644
index 0000000..49d5106
--- /dev/null
+++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/differentiation/UnivariateDifferentiableMatrixFunction.java
@@ -0,0 +1,40 @@
+/*
+ * 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.legacy.analysis.differentiation;
+
+import org.apache.commons.math4.legacy.analysis.UnivariateMatrixFunction;
+import org.apache.commons.math4.legacy.exception.MathIllegalArgumentException;
+
+/**
+ * Extension of {@link UnivariateMatrixFunction} representing a univariate differentiable matrix function.
+ *
+ * @since 3.1
+ */
+public interface UnivariateDifferentiableMatrixFunction
+    extends UnivariateMatrixFunction {
+
+    /**
+     * Compute the value for the function.
+     * @param x the point for which the function value should be computed
+     * @return the value
+     * @exception MathIllegalArgumentException if {@code x} does not
+     * satisfy the function's constraints (argument out of bound, or unsupported
+     * derivative order for example)
+     */
+    DerivativeStructure[][] value(DerivativeStructure x) throws MathIllegalArgumentException;
+
+}
diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/differentiation/UnivariateDifferentiableVectorFunction.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/differentiation/UnivariateDifferentiableVectorFunction.java
new file mode 100644
index 0000000..0304675
--- /dev/null
+++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/differentiation/UnivariateDifferentiableVectorFunction.java
@@ -0,0 +1,40 @@
+/*
+ * 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.legacy.analysis.differentiation;
+
+import org.apache.commons.math4.legacy.analysis.UnivariateVectorFunction;
+import org.apache.commons.math4.legacy.exception.MathIllegalArgumentException;
+
+/**
+ * Extension of {@link UnivariateVectorFunction} representing a univariate differentiable vectorial function.
+ *
+ * @since 3.1
+ */
+public interface UnivariateDifferentiableVectorFunction
+    extends UnivariateVectorFunction {
+
+    /**
+     * Compute the value for the function.
+     * @param x the point for which the function value should be computed
+     * @return the value
+     * @exception MathIllegalArgumentException if {@code x} does not
+     * satisfy the function's constraints (argument out of bound, or unsupported
+     * derivative order for example)
+     */
+    DerivativeStructure[] value(DerivativeStructure x) throws MathIllegalArgumentException;
+
+}
diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/differentiation/UnivariateFunctionDifferentiator.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/differentiation/UnivariateFunctionDifferentiator.java
new file mode 100644
index 0000000..c9ef9c1
--- /dev/null
+++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/differentiation/UnivariateFunctionDifferentiator.java
@@ -0,0 +1,33 @@
+/*
+ * 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.legacy.analysis.differentiation;
+
+import org.apache.commons.math4.legacy.analysis.UnivariateFunction;
+
+/** Interface defining the function differentiation operation.
+ * @since 3.1
+ */
+public interface UnivariateFunctionDifferentiator {
+
+    /** Create an implementation of a {@link UnivariateDifferentiableFunction
+     * differential} from a regular {@link UnivariateFunction function}.
+     * @param function function to differentiate
+     * @return differential function
+     */
+    UnivariateDifferentiableFunction differentiate(UnivariateFunction function);
+
+}
diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/differentiation/UnivariateMatrixFunctionDifferentiator.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/differentiation/UnivariateMatrixFunctionDifferentiator.java
new file mode 100644
index 0000000..fe21d51
--- /dev/null
+++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/differentiation/UnivariateMatrixFunctionDifferentiator.java
@@ -0,0 +1,33 @@
+/*
+ * 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.legacy.analysis.differentiation;
+
+import org.apache.commons.math4.legacy.analysis.UnivariateMatrixFunction;
+
+/** Interface defining the function differentiation operation.
+ * @since 3.1
+ */
+public interface UnivariateMatrixFunctionDifferentiator {
+
+    /** Create an implementation of a {@link UnivariateDifferentiableMatrixFunction
+     * differential} from a regular {@link UnivariateMatrixFunction matrix function}.
+     * @param function function to differentiate
+     * @return differential function
+     */
+    UnivariateDifferentiableMatrixFunction differentiate(UnivariateMatrixFunction function);
+
+}
diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/differentiation/UnivariateVectorFunctionDifferentiator.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/differentiation/UnivariateVectorFunctionDifferentiator.java
new file mode 100644
index 0000000..5fb7ff7
--- /dev/null
+++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/differentiation/UnivariateVectorFunctionDifferentiator.java
@@ -0,0 +1,33 @@
+/*
+ * 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
... 529851 lines suppressed ...