Class 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.

    • Constructor Detail

      • GaussNewtonOptimizer

        public GaussNewtonOptimizer()
        Creates a Gauss Newton optimizer.

        The default for the algorithm is to use QR decomposition and not form normal equations.

      • 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. 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.
    • Method Detail

      • 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 true then decomposer is used to solve JTJx=JTr, otherwise decomposer is 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. 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.