Class GaussNewtonOptimizer
- java.lang.Object
-
- org.hipparchus.optim.nonlinear.vector.leastsquares.GaussNewtonOptimizer
-
- All Implemented Interfaces:
LeastSquaresOptimizer
public class GaussNewtonOptimizer extends Object implements LeastSquaresOptimizer
Gauss-Newton least-squares solver.This class solve a least-square problem by solving the normal equations of the linearized problem at each iteration. Either LU decomposition or Cholesky decomposition can be used to solve the normal equations, or QR decomposition or SVD decomposition can be used to solve the linear system. Cholesky/LU decomposition is faster but QR decomposition is more robust for difficult problems, and SVD can compute a solution for rank-deficient problems.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGaussNewtonOptimizer.DecompositionDeprecated.UseMatrixDecomposerinstead.-
Nested classes/interfaces inherited from interface org.hipparchus.optim.nonlinear.vector.leastsquares.LeastSquaresOptimizer
LeastSquaresOptimizer.Optimum
-
-
Constructor Summary
Constructors Constructor Description GaussNewtonOptimizer()Creates a Gauss Newton optimizer.GaussNewtonOptimizer(MatrixDecomposer decomposer, boolean formNormalEquations)Create a Gauss Newton optimizer that uses the given matrix decomposition algorithm to solve the normal equations.GaussNewtonOptimizer(GaussNewtonOptimizer.Decomposition decomposition)Deprecated.UseGaussNewtonOptimizer(MatrixDecomposer, boolean)instead.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description MatrixDecomposergetDecomposer()Get the matrix decomposition algorithm.GaussNewtonOptimizer.DecompositiongetDecomposition()Deprecated.UsegetDecomposer()andisFormNormalEquations()instead.booleanisFormNormalEquations()Get if the normal equations are explicitly formed.LeastSquaresOptimizer.Optimumoptimize(LeastSquaresProblem lsp)Solve the non-linear least squares problem.StringtoString()GaussNewtonOptimizerwithDecomposer(MatrixDecomposer newDecomposer)Configure the matrix decomposition algorithm.GaussNewtonOptimizerwithDecomposition(GaussNewtonOptimizer.Decomposition newDecomposition)Deprecated.UsewithDecomposer(MatrixDecomposer)andwithFormNormalEquations(boolean)instead.GaussNewtonOptimizerwithFormNormalEquations(boolean newFormNormalEquations)Configure if the normal equations should be explicitly formed.
-
-
-
Constructor Detail
-
GaussNewtonOptimizer
public GaussNewtonOptimizer()
Creates a Gauss Newton optimizer. The default for the algorithm is to solve the normal equations using QR decomposition.
-
GaussNewtonOptimizer
@Deprecated public GaussNewtonOptimizer(GaussNewtonOptimizer.Decomposition decomposition)
Deprecated.UseGaussNewtonOptimizer(MatrixDecomposer, boolean)instead. The new constructor provides control of the numerical tolerances in the decomposition.Create a Gauss Newton optimizer that uses the given decomposition algorithm to solve the normal equations.- Parameters:
decomposition- theGaussNewtonOptimizer.Decompositionalgorithm.
-
GaussNewtonOptimizer
public GaussNewtonOptimizer(MatrixDecomposer decomposer, boolean formNormalEquations)
Create a Gauss Newton optimizer that uses the given matrix decomposition algorithm to solve the normal equations.- Parameters:
decomposer- the decomposition algorithm to use.formNormalEquations- whether the normal equations should be explicitly formed. Iftruethendecomposeris used to solve JTJx=JTr, otherwisedecomposeris used to solve Jx=r. Ifdecomposercan only solve square systems then this parameter should betrue.
-
-
Method Detail
-
getDecomposition
@Deprecated public GaussNewtonOptimizer.Decomposition getDecomposition()
Deprecated.UsegetDecomposer()andisFormNormalEquations()instead.Get the matrix decomposition algorithm used to solve the normal equations.- Returns:
- the matrix
GaussNewtonOptimizer.Decompositionalgorithm. May benull.
-
withDecomposition
@Deprecated public GaussNewtonOptimizer withDecomposition(GaussNewtonOptimizer.Decomposition newDecomposition)
Deprecated.UsewithDecomposer(MatrixDecomposer)andwithFormNormalEquations(boolean)instead. the new methods allow the numerical tolerance of the decomposition to be set.Configure the decomposition algorithm.- Parameters:
newDecomposition- theGaussNewtonOptimizer.Decompositionalgorithm to use.- Returns:
- a new instance.
-
getDecomposer
public MatrixDecomposer getDecomposer()
Get the matrix decomposition algorithm.- Returns:
- the decomposition algorithm.
-
withDecomposer
public GaussNewtonOptimizer withDecomposer(MatrixDecomposer newDecomposer)
Configure the matrix decomposition algorithm.- Parameters:
newDecomposer- the decomposition algorithm to use.- Returns:
- a new instance.
-
isFormNormalEquations
public boolean isFormNormalEquations()
Get if the normal equations are explicitly formed.- Returns:
- if the normal equations should be explicitly formed. If
truethendecomposeris used to solve JTJx=JTr, otherwisedecomposeris used to solve Jx=r.
-
withFormNormalEquations
public GaussNewtonOptimizer withFormNormalEquations(boolean newFormNormalEquations)
Configure if the normal equations should be explicitly formed.- Parameters:
newFormNormalEquations- whether the normal equations should be explicitly formed. Iftruethendecomposeris used to solve JTJx=JTr, otherwisedecomposeris used to solve Jx=r. Ifdecomposercan only solve square systems then this parameter should betrue.- Returns:
- a new instance.
-
optimize
public LeastSquaresOptimizer.Optimum optimize(LeastSquaresProblem lsp)
Solve the non-linear least squares problem.- Specified by:
optimizein interfaceLeastSquaresOptimizer- Parameters:
lsp- the problem definition, including model function and convergence criteria.- Returns:
- The optimum.
-
-