ImFusion SDK 4.3
LevenbergMarquardt Class Reference

#include <ImFusion/Base/LevenbergMarquardt.h>

Levenberg-Marquardt optimizer. More...

Detailed Description

Levenberg-Marquardt optimizer.

Public Member Functions

 LevenbergMarquardt ()
 Constructor The Levenberg Marquardt algorithm tries to minimize the sum of squares of a cost function with m_numMeasurements values over m_numParameters parameters.
 
void init (int numParameters, int numMeasurements)
 Initialize buffers used in Levenberg Marquardt algorithm.
 
template<typename FuncEps, typename T>
int runWithFiniteDifferences (Eigen::VectorXd &p, const T &x, const FuncEps &computeEps, double finiteDifferenceStepSize, int maxIter, double deltaTol, double fTol, Progress *progress=nullptr, double lambda=0.01)
 Run Levenberg Marquard using a finite-difference approximation of the Jacobian.
 
template<typename FuncEps, typename FuncJ, typename T>
int run (Eigen::VectorXd &p, const T &x, const FuncEps &computeEps, const FuncJ &computeJ, int maxIter, double deltaTol, double fTol, Progress *progress=nullptr, double lambda=0.01)
 Run Levenberg Marquardt.
 

Member Function Documentation

◆ init()

void init ( int numParameters,
int numMeasurements )
inline

Initialize buffers used in Levenberg Marquardt algorithm.

Parameters
numParametersnumber of parameters
numMeasurementsnumber of measurements The Levenberg Marquardt algorithm tries to minimize the sum of squares of a cost function with m_numMeasurements values over m_numParameters parameters.

◆ runWithFiniteDifferences()

template<typename FuncEps, typename T>
int runWithFiniteDifferences ( Eigen::VectorXd & p,
const T & x,
const FuncEps & computeEps,
double finiteDifferenceStepSize,
int maxIter,
double deltaTol,
double fTol,
Progress * progress = nullptr,
double lambda = 0.01 )
inline

Run Levenberg Marquard using a finite-difference approximation of the Jacobian.

Parameters
pInitial parameter estimate. Is Replaced by optimized parameters by the algorithm.
xauxiliary parameters. These are not directly used in the algorithm, but are passed to computeEps and computeJ as the second argument.
computeEpsCost function with signature: void computeEps(const Eigen::Matrix<double,numParameters,1> &p, const T &x, Eigen::VectorXd &eps)
finiteDifferenceStepSizeStep size used for finite differences computing the Jacobian
maxIterMaximum number of iterations
deltaTolUpdate norm tolerance
fTolFunction tolerance
progressOptional progress object for algorithm progress output.
lambdaInitial damping factor used by algorithm, defaults to 0.01 return >= 0 if successful, -1 otherwise. 0 = delta error below tolerance, 1 = function error below tolerance, 2 = max iterations reached, 3 = cancelled by user

◆ run()

template<typename FuncEps, typename FuncJ, typename T>
int run ( Eigen::VectorXd & p,
const T & x,
const FuncEps & computeEps,
const FuncJ & computeJ,
int maxIter,
double deltaTol,
double fTol,
Progress * progress = nullptr,
double lambda = 0.01 )
inline

Run Levenberg Marquardt.

Parameters
pInitial parameter estimate. Is Replaced by optimized parameters by the algorithm.
xauxiliary parameters. These are not directly used in the algorithm, but are passed to computeEps and computeJ as the second argument.
computeEpsCost function with signature: void computeEps(const Eigen::Matrix<double,numParameters,1> &p, const T &x, Eigen::VectorXd &eps)
computeJFunction with signature void computeJ(const Eigen::Matrix<double,numParameters,1> &p, const T &x, Eigen::Matrix<double,numMeasurements,numParameters> &J) for computing the Jacobian
maxIterMaximum number of iterations
deltaTolUpdate norm tolerance
fTolFunction tolerance
progressOptional progress object for algorithm progress output.
lambdaInitial damping factor used by algorithm, defaults to 0.01 return >= 0 if successful, -1 otherwise. 0 = delta error below tolerance, 1 = function error below tolerance, 2 = max iterations reached, 3 = cancelled by user

The documentation for this class was generated from the following file:
Search Tab / S to search, Esc to close