Basic Image AlgorithmS Library
2.8.0
|
Base interface for classes using non-linear optimization of a target function using the Levenberg-Marquardt algorithm. More...
#include <MathAlgo/LevenbergMarquardtBase.hh>
Public Member Functions | |
LevenbergMarquardtBase () | |
int | LM_Compute (const int numResiduals, const int numParameters, BIAS::Vector< double > &startX, BIAS::Vector< double > &resultX, BIAS::Vector< double > &residuals) |
Compute Levenberg-Marquardt algorithm using the user defined target function f(x) implemented in LM_TargetFunction_, and the analytic Jacobian J(x) implemented in LM_Jacobian_. More... | |
int | LM_ComputeWithoutJacobian (const int numResiduals, const int numParameters, BIAS::Vector< double > &startX, BIAS::Vector< double > &resultX, BIAS::Vector< double > &residuals, const double epsilon=LM_DEF_EPSILON) |
Compute Levenberg-Marquardt algorithm using the user defined target function f(x) implemented in LM_TargetFunction_. More... | |
BIAS::Matrix< double > | LM_GetJacobianResult () const |
Return the resulting Jacobian J(x) from the last computation. More... | |
int | LM_GetMaxIterations () const |
Return the maximal number of iterations to perform. More... | |
int | LM_GetNumOfIterations () const |
Return the number of iterations performed in last computation. More... | |
BIAS::Vector< double > | LM_GetParameterResult () const |
Return the resulting parameter vector x from last computation. More... | |
BIAS::Vector< double > | LM_GetResidualsResult () const |
Return the resulting residual vector f(x) from last computation. More... | |
double | LM_GetSumOfSquaredErrors () const |
Return the sum of squared errors from the last computation. More... | |
double | LM_GetTolerance () const |
Return tolerance used to evaluate convergence. More... | |
void | LM_SetMaxIterations (const int iters) |
Set the maximal number of iterations to perform. More... | |
void | LM_SetTolerance (const double tol) |
Set tolerance used to evaluate convergence. More... | |
virtual | ~LevenbergMarquardtBase () |
Protected Member Functions | |
virtual int | LM_JacobianFunction_ (const BIAS::Vector< double > &x, BIAS::Matrix< double > &J) |
Compute Jacobian J(x) of target function f evaluated at vector x. More... | |
virtual int | LM_TargetFunction_ (const BIAS::Vector< double > &x, BIAS::Vector< double > &residuals)=0 |
Compute residuals of target function f for input vector x. More... | |
Base interface for classes using non-linear optimization of a target function using the Levenberg-Marquardt algorithm.
Provides a class interface to Minpack with convenient definition of target function f(x) and Jacobian J(x).
Definition at line 56 of file LevenbergMarquardtBase.hh.
|
inline |
Definition at line 76 of file LevenbergMarquardtBase.hh.
|
inlinevirtual |
Definition at line 84 of file LevenbergMarquardtBase.hh.
int LevenbergMarquardtBase::LM_Compute | ( | const int | numResiduals, |
const int | numParameters, | ||
BIAS::Vector< double > & | startX, | ||
BIAS::Vector< double > & | resultX, | ||
BIAS::Vector< double > & | residuals | ||
) |
Compute Levenberg-Marquardt algorithm using the user defined target function f(x) implemented in LM_TargetFunction_, and the analytic Jacobian J(x) implemented in LM_Jacobian_.
Definition at line 30 of file LevenbergMarquardtBase.cpp.
References BIAS::LevenbergMarquardtExtended(), TNT::Vector< T >::newsize(), and TNT::Matrix< T >::newsize().
int LevenbergMarquardtBase::LM_ComputeWithoutJacobian | ( | const int | numResiduals, |
const int | numParameters, | ||
BIAS::Vector< double > & | startX, | ||
BIAS::Vector< double > & | resultX, | ||
BIAS::Vector< double > & | residuals, | ||
const double | epsilon = LM_DEF_EPSILON |
||
) |
Compute Levenberg-Marquardt algorithm using the user defined target function f(x) implemented in LM_TargetFunction_.
The Jacobian of f is approximated numerically using the given value epsilon.
epsilon | is "an input variable used in determining a suitable step length for the forward-difference approximation" of the Jacobian of f (see documentation of minpack/fdjac2.c) |
Definition at line 57 of file LevenbergMarquardtBase.cpp.
References BIAS::ComputeJacobian(), BIAS::LevenbergMarquardtExtended(), TNT::Vector< T >::newsize(), TNT::Matrix< T >::newsize(), and BIAS::Matrix< T >::SetZero().
|
inline |
Return the resulting Jacobian J(x) from the last computation.
Definition at line 139 of file LevenbergMarquardtBase.hh.
|
inline |
Return the maximal number of iterations to perform.
Definition at line 119 of file LevenbergMarquardtBase.hh.
|
inline |
Return the number of iterations performed in last computation.
Definition at line 127 of file LevenbergMarquardtBase.hh.
|
inline |
Return the resulting parameter vector x from last computation.
Definition at line 131 of file LevenbergMarquardtBase.hh.
|
inline |
Return the resulting residual vector f(x) from last computation.
Definition at line 135 of file LevenbergMarquardtBase.hh.
|
inline |
Return the sum of squared errors from the last computation.
Definition at line 123 of file LevenbergMarquardtBase.hh.
|
inline |
Return tolerance used to evaluate convergence.
Definition at line 111 of file LevenbergMarquardtBase.hh.
|
inlineprotectedvirtual |
Compute Jacobian J(x) of target function f evaluated at vector x.
Definition at line 96 of file LevenbergMarquardtBase.hh.
|
inline |
Set the maximal number of iterations to perform.
Definition at line 115 of file LevenbergMarquardtBase.hh.
|
inline |
Set tolerance used to evaluate convergence.
Definition at line 107 of file LevenbergMarquardtBase.hh.
|
protectedpure virtual |
Compute residuals of target function f for input vector x.