Class GaussNewtonOptimizer
java.lang.Object
org.apache.commons.math3.fitting.leastsquares.GaussNewtonOptimizer
- All Implemented Interfaces:
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. LU decomposition is faster but QR decomposition is more robust for difficult problems, and SVD can compute a solution for rank-deficient problems.
- Since:
- 3.3
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
The decomposition algorithm to use to solve the normal equations.Nested classes/interfaces inherited from interface org.apache.commons.math3.fitting.leastsquares.LeastSquaresOptimizer
LeastSquaresOptimizer.Optimum
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a Gauss Newton optimizer.GaussNewtonOptimizer
(GaussNewtonOptimizer.Decomposition decomposition) Create a Gauss Newton optimizer that uses the given decomposition algorithm to solve the normal equations. -
Method Summary
Modifier and TypeMethodDescriptionGet the matrix decomposition algorithm used to solve the normal equations.Solve the non-linear least squares problem.toString()
withDecomposition
(GaussNewtonOptimizer.Decomposition newDecomposition) Configure the decomposition algorithm.
-
Constructor Details
-
GaussNewtonOptimizer
public GaussNewtonOptimizer()Creates a Gauss Newton optimizer. The default for the algorithm is to solve the normal equations using QR decomposition. -
GaussNewtonOptimizer
Create a Gauss Newton optimizer that uses the given decomposition algorithm to solve the normal equations.- Parameters:
decomposition
- theGaussNewtonOptimizer.Decomposition
algorithm.
-
-
Method Details
-
getDecomposition
Get the matrix decomposition algorithm used to solve the normal equations.- Returns:
- the matrix
GaussNewtonOptimizer.Decomposition
algoritm.
-
withDecomposition
Configure the decomposition algorithm.- Parameters:
newDecomposition
- theGaussNewtonOptimizer.Decomposition
algorithm to use.- Returns:
- a new instance.
-
optimize
Solve the non-linear least squares problem.- Specified by:
optimize
in interfaceLeastSquaresOptimizer
- Parameters:
lsp
- the problem definition, including model function and convergence criteria.- Returns:
- The optimum.
-
toString
-