org.apache.commons.math3.fitting.leastsquares

## Class LeastSquaresAdapter

- java.lang.Object
- - org.apache.commons.math3.fitting.leastsquares.LeastSquaresAdapter

- All Implemented Interfaces:
    LeastSquaresProblem, OptimizationProblem<LeastSquaresProblem.Evaluation>

      public class LeastSquaresAdapter
      extends Object
      implements LeastSquaresProblem

  An adapter that delegates to another implementation of `LeastSquaresProblem`.
  Since:
    3.3
  Version:
    $Id: LeastSquaresAdapter.java 1569362 2014-02-18 14:33:49Z luc $

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem

      `LeastSquaresProblem.Evaluation`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `LeastSquaresAdapter(LeastSquaresProblem problem)` Delegate the `LeastSquaresProblem` interface to the given implementation.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `LeastSquaresProblem.Evaluation` | `evaluate(RealVector point)` Evaluate the model at the specified point.
    `ConvergenceChecker<LeastSquaresProblem.Evaluation>` | `getConvergenceChecker()` Gets the convergence checker.
    `Incrementor` | `getEvaluationCounter()` Get a independent Incrementor that counts up to the maximum number of evaluations and then throws an exception.
    `Incrementor` | `getIterationCounter()` Get a independent Incrementor that counts up to the maximum number of iterations and then throws an exception.
    `int` | `getObservationSize()` Get the number of observations (rows in the Jacobian) in this problem.
    `int` | `getParameterSize()` Get the number of parameters (columns in the Jacobian) in this problem.
    `RealVector` | `getStart()` Gets the initial guess.

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

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

- - ### Constructor Detail

    - #### LeastSquaresAdapter

          public LeastSquaresAdapter(LeastSquaresProblem problem)

      Delegate the `LeastSquaresProblem` interface to the given implementation.
      Parameters:
        `problem` - the delegate

  - ### Method Detail

    - #### getStart

          public RealVector getStart()

      Gets the initial guess.
      Specified by:
        `getStart` in interface `LeastSquaresProblem`
      Returns:
        the initial guess values.

    - #### getObservationSize

          public int getObservationSize()

      Get the number of observations (rows in the Jacobian) in this problem.
      Specified by:
        `getObservationSize` in interface `LeastSquaresProblem`
      Returns:
        the number of scalar observations

    - #### getParameterSize

          public int getParameterSize()

      Get the number of parameters (columns in the Jacobian) in this problem.
      Specified by:
        `getParameterSize` in interface `LeastSquaresProblem`
      Returns:
        the number of scalar parameters

    - #### evaluate

          public LeastSquaresProblem.Evaluation evaluate(RealVector point)

      Evaluate the model at the specified point.
      Specified by:
        `evaluate` in interface `LeastSquaresProblem`
      Parameters:
        `point` -
      Returns:
        the model's value and derivative at the given point.

    - #### getEvaluationCounter

          public Incrementor getEvaluationCounter()

      Get a independent Incrementor that counts up to the maximum number of evaluations and then throws an exception.
      Specified by:
        `getEvaluationCounter` in interface `OptimizationProblem<LeastSquaresProblem.Evaluation>`
      Returns:
        a counter for the evaluations.

    - #### getIterationCounter

          public Incrementor getIterationCounter()

      Get a independent Incrementor that counts up to the maximum number of iterations and then throws an exception.
      Specified by:
        `getIterationCounter` in interface `OptimizationProblem<LeastSquaresProblem.Evaluation>`
      Returns:
        a counter for the evaluations.

    - #### getConvergenceChecker

          public ConvergenceChecker<LeastSquaresProblem.Evaluation> getConvergenceChecker()

      Gets the convergence checker.
      Specified by:
        `getConvergenceChecker` in interface `OptimizationProblem<LeastSquaresProblem.Evaluation>`
      Returns:
        the object used to check for convergence.

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