org.hipparchus.optim.nonlinear.vector.leastsquares

## Class SequentialGaussNewtonOptimizer

• java.lang.Object
• org.hipparchus.optim.nonlinear.vector.leastsquares.SequentialGaussNewtonOptimizer
• All Implemented Interfaces:
LeastSquaresOptimizer

public class SequentialGaussNewtonOptimizer
extends Object
implements LeastSquaresOptimizer
Sequential Gauss-Newton least-squares solver.

This class solve a least-square problem by solving the normal equations of the linearized problem at each iteration.

• ### Nested classes/interfaces inherited from interface org.hipparchus.optim.nonlinear.vector.leastsquares.LeastSquaresOptimizer

LeastSquaresOptimizer.Optimum
• ### Constructor Summary

Constructors
Constructor and Description
SequentialGaussNewtonOptimizer()
Create a sequential Gauss Newton optimizer.
SequentialGaussNewtonOptimizer(MatrixDecomposer decomposer, boolean formNormalEquations, LeastSquaresProblem.Evaluation evaluation)
Create a sequential Gauss Newton optimizer that uses the given matrix decomposition algorithm to solve the normal equations.
• ### Method Summary

All Methods
Modifier and Type Method and Description
MatrixDecomposer getDecomposer()
Get the matrix decomposition algorithm.
LeastSquaresProblem.Evaluation getOldEvaluation()
Get the previous evaluation used by the optimizer.
boolean isFormNormalEquations()
Get if the normal equations are explicitly formed.
LeastSquaresOptimizer.Optimum optimize(LeastSquaresProblem lsp)
Solve the non-linear least squares problem.
String toString()
SequentialGaussNewtonOptimizer withAPrioriData(RealVector aPrioriState, RealMatrix aPrioriCovariance)
Configure from a priori state and covariance.
SequentialGaussNewtonOptimizer withAPrioriData(RealVector aPrioriState, RealMatrix aPrioriCovariance, double relativeSymmetryThreshold, double absolutePositivityThreshold)
Configure from a priori state and covariance.
SequentialGaussNewtonOptimizer withDecomposer(MatrixDecomposer newDecomposer)
Configure the matrix decomposition algorithm.
SequentialGaussNewtonOptimizer withEvaluation(LeastSquaresProblem.Evaluation previousEvaluation)
Configure the previous evaluation used by the optimizer.
SequentialGaussNewtonOptimizer withFormNormalEquations(boolean newFormNormalEquations)
Configure if the normal equations should be explicitly formed.
• ### Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
• ### Constructor Detail

• #### SequentialGaussNewtonOptimizer

public SequentialGaussNewtonOptimizer()
Create a sequential Gauss Newton optimizer.

The default for the algorithm is to use QR decomposition, not form normal equations and have no previous evaluation

• #### SequentialGaussNewtonOptimizer

public SequentialGaussNewtonOptimizer(MatrixDecomposer decomposer,
boolean formNormalEquations,
LeastSquaresProblem.Evaluation evaluation)
Create a sequential Gauss Newton optimizer that uses the given matrix decomposition algorithm to solve the normal equations.

The decomposer is used to solve JTJx=JTr.

Parameters:
decomposer - the decomposition algorithm to use.
formNormalEquations - whether the normal equations should be explicitly formed. If true then decomposer is used to solve JTJx=JTr, otherwise decomposer is used to solve Jx=r. If decomposer can only solve square systems then this parameter should be true.
evaluation - old evaluation previously computed, null if there are no previous evaluations.
• ### Method Detail

• #### getDecomposer

public MatrixDecomposer getDecomposer()
Get the matrix decomposition algorithm.
Returns:
the decomposition algorithm.
• #### withDecomposer

public SequentialGaussNewtonOptimizer 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 true then decomposer is used to solve JTJx=JTr, otherwise decomposer is used to solve Jx=r.
• #### withFormNormalEquations

public SequentialGaussNewtonOptimizer withFormNormalEquations(boolean newFormNormalEquations)
Configure if the normal equations should be explicitly formed.
Parameters:
newFormNormalEquations - whether the normal equations should be explicitly formed. If true then decomposer is used to solve JTJx=JTr, otherwise decomposer is used to solve Jx=r. If decomposer can only solve square systems then this parameter should be true.
Returns:
a new instance.
• #### getOldEvaluation

public LeastSquaresProblem.Evaluation getOldEvaluation()
Get the previous evaluation used by the optimizer.
Returns:
the previous evaluation.
• #### withAPrioriData

public SequentialGaussNewtonOptimizer withAPrioriData(RealVector aPrioriState,
RealMatrix aPrioriCovariance,
double relativeSymmetryThreshold,
double absolutePositivityThreshold)
Configure from a priori state and covariance.

This building method generates a fake evaluation and calls withEvaluation(LeastSquaresProblem.Evaluation), so either withAPrioriData(RealVector, RealMatrix) or withEvaluation(LeastSquaresProblem.Evaluation) should be called, but not both as the last one called will override the previous one.

A Cholesky decomposition is used to compute the weighted jacobian from the a priori covariance.

Parameters:
aPrioriState - a priori state to use
aPrioriCovariance - a priori covariance to use
relativeSymmetryThreshold - Cholesky decomposition threshold above which off-diagonal elements are considered too different and matrix not symmetric
absolutePositivityThreshold - Cholesky decomposition threshold below which diagonal elements are considered null and matrix not positive definite
Returns:
a new instance.
Since:
2.3
• #### optimize

public LeastSquaresOptimizer.Optimum optimize(LeastSquaresProblem lsp)
Solve the non-linear least squares problem.
Specified by:
optimize in interface LeastSquaresOptimizer
Parameters:
lsp - the problem definition, including model function and convergence criteria.
Returns:
The optimum.
• #### toString

public String toString()
Overrides:
toString in class Object