public class GaussNewtonOptimizer extends java.lang.Object implements LeastSquaresOptimizer
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.
Modifier and Type | Class and Description |
---|---|
static class |
GaussNewtonOptimizer.Decomposition
The decomposition algorithm to use to solve the normal equations.
|
LeastSquaresOptimizer.Optimum
Modifier and Type | Field and Description |
---|---|
private GaussNewtonOptimizer.Decomposition |
decomposition
Indicator for using LU decomposition.
|
private static double |
SINGULARITY_THRESHOLD
The singularity threshold for matrix decompositions.
|
Constructor and 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.
|
Modifier and Type | Method and Description |
---|---|
private static Pair<RealMatrix,RealVector> |
computeNormalMatrix(RealMatrix jacobian,
RealVector residuals)
Compute the normal matrix, JTJ.
|
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.
|
java.lang.String |
toString() |
GaussNewtonOptimizer |
withDecomposition(GaussNewtonOptimizer.Decomposition newDecomposition)
Configure the decomposition algorithm.
|
private static final double SINGULARITY_THRESHOLD
ConvergenceException
is thrown. The current value was the default value for LUDecomposition
.private final GaussNewtonOptimizer.Decomposition decomposition
public GaussNewtonOptimizer()
public GaussNewtonOptimizer(GaussNewtonOptimizer.Decomposition decomposition)
decomposition
- the GaussNewtonOptimizer.Decomposition
algorithm.public GaussNewtonOptimizer.Decomposition getDecomposition()
GaussNewtonOptimizer.Decomposition
algoritm.public GaussNewtonOptimizer withDecomposition(GaussNewtonOptimizer.Decomposition newDecomposition)
newDecomposition
- the GaussNewtonOptimizer.Decomposition
algorithm to use.public LeastSquaresOptimizer.Optimum optimize(LeastSquaresProblem lsp)
optimize
in interface LeastSquaresOptimizer
lsp
- the problem definition, including model function and
convergence criteria.public java.lang.String toString()
toString
in class java.lang.Object
private static Pair<RealMatrix,RealVector> computeNormalMatrix(RealMatrix jacobian, RealVector residuals)
jacobian
- the m by n jacobian matrix, J. Input.residuals
- the m by 1 residual vector, r. Input.Copyright (c) 2003-2016 Apache Software Foundation