Class GaussNewtonOptimizer
- java.lang.Object
-
- org.apache.commons.math4.legacy.fitting.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. 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 Classes Modifier and Type Class Description static class
GaussNewtonOptimizer.Decomposition
The decomposition algorithm to use to solve the normal equations.-
Nested classes/interfaces inherited from interface org.apache.commons.math4.legacy.fitting.leastsquares.LeastSquaresOptimizer
LeastSquaresOptimizer.Optimum
-
-
Constructor Summary
Constructors Constructor Description GaussNewtonOptimizer()
Creates 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GaussNewtonOptimizer.Decomposition
getDecomposition()
Get the matrix decomposition algorithm used to solve the normal equations.LeastSquaresOptimizer.Optimum
optimize(LeastSquaresProblem lsp)
Solve the non-linear least squares problem.String
toString()
GaussNewtonOptimizer
withDecomposition(GaussNewtonOptimizer.Decomposition newDecomposition)
Configure the decomposition algorithm.
-
-
-
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
public GaussNewtonOptimizer(GaussNewtonOptimizer.Decomposition decomposition)
Create a Gauss Newton optimizer that uses the given decomposition algorithm to solve the normal equations.- Parameters:
decomposition
- theGaussNewtonOptimizer.Decomposition
algorithm.
-
-
Method Detail
-
getDecomposition
public GaussNewtonOptimizer.Decomposition getDecomposition()
Get the matrix decomposition algorithm used to solve the normal equations.- Returns:
- the matrix
GaussNewtonOptimizer.Decomposition
algoritm.
-
withDecomposition
public GaussNewtonOptimizer withDecomposition(GaussNewtonOptimizer.Decomposition newDecomposition)
Configure the decomposition algorithm.- Parameters:
newDecomposition
- theGaussNewtonOptimizer.Decomposition
algorithm to use.- Returns:
- a new instance.
-
optimize
public LeastSquaresOptimizer.Optimum optimize(LeastSquaresProblem lsp)
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.
-
-