org.apache.commons.math3.fitting.leastsquares

## Class GaussNewtonOptimizer

- java.lang.Object
- - org.apache.commons.math3.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
  Version:
    $Id: GaussNewtonOptimizer.java 1573351 2014-03-02 19:54:43Z luc $

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `GaussNewtonOptimizer.Decomposition` 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

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

  - ### Method Summary

    Methods
    Modifier and Type | Method and 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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### 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` - the `GaussNewtonOptimizer.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` - the `GaussNewtonOptimizer.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 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`

Copyright © 2003–2014 The Apache Software Foundation. All rights reserved.