Class LeastSquaresAdapter
- java.lang.Object
-
- org.apache.commons.math4.legacy.fitting.leastsquares.LeastSquaresAdapter
-
- All Implemented Interfaces:
LeastSquaresProblem
,OptimizationProblem<LeastSquaresProblem.Evaluation>
public class LeastSquaresAdapter extends Object implements LeastSquaresProblem
An adapter that delegates to another implementation ofLeastSquaresProblem
.- Since:
- 3.3
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.commons.math4.legacy.fitting.leastsquares.LeastSquaresProblem
LeastSquaresProblem.Evaluation
-
-
Constructor Summary
Constructors Constructor Description LeastSquaresAdapter(LeastSquaresProblem problem)
Delegate theLeastSquaresProblem
interface to the given implementation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LeastSquaresProblem.Evaluation
evaluate(RealVector point)
Evaluate the model at the specified point.ConvergenceChecker<LeastSquaresProblem.Evaluation>
getConvergenceChecker()
Gets the convergence checker.IntegerSequence.Incrementor
getEvaluationCounter()
Get a independent Incrementor that counts up to the maximum number of evaluations and then throws an exception.IntegerSequence.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.
-
-
-
Constructor Detail
-
LeastSquaresAdapter
public LeastSquaresAdapter(LeastSquaresProblem problem)
Delegate theLeastSquaresProblem
interface to the given implementation.- Parameters:
problem
- the delegate
-
-
Method Detail
-
getStart
public RealVector getStart()
Gets the initial guess.- Specified by:
getStart
in interfaceLeastSquaresProblem
- 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 interfaceLeastSquaresProblem
- 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 interfaceLeastSquaresProblem
- Returns:
- the number of scalar parameters
-
evaluate
public LeastSquaresProblem.Evaluation evaluate(RealVector point)
Evaluate the model at the specified point.- Specified by:
evaluate
in interfaceLeastSquaresProblem
- Parameters:
point
- the parameter values.- Returns:
- the model's value and derivative at the given point.
-
getEvaluationCounter
public IntegerSequence.Incrementor getEvaluationCounter()
Get a independent Incrementor that counts up to the maximum number of evaluations and then throws an exception.- Specified by:
getEvaluationCounter
in interfaceOptimizationProblem<LeastSquaresProblem.Evaluation>
- Returns:
- a counter for the evaluations.
-
getIterationCounter
public IntegerSequence.Incrementor getIterationCounter()
Get a independent Incrementor that counts up to the maximum number of iterations and then throws an exception.- Specified by:
getIterationCounter
in interfaceOptimizationProblem<LeastSquaresProblem.Evaluation>
- Returns:
- a counter for the evaluations.
-
getConvergenceChecker
public ConvergenceChecker<LeastSquaresProblem.Evaluation> getConvergenceChecker()
Gets the convergence checker.- Specified by:
getConvergenceChecker
in interfaceOptimizationProblem<LeastSquaresProblem.Evaluation>
- Returns:
- the object used to check for convergence.
-
-