Main MRPT website > C++ reference for MRPT 1.9.9
List of all members | Classes | Public Types | Public Member Functions
mrpt::math::CLevenbergMarquardtTempl< VECTORTYPE, USERPARAM > Class Template Reference

Detailed Description

template<typename VECTORTYPE = Eigen::VectorXd, class USERPARAM = VECTORTYPE>
class mrpt::math::CLevenbergMarquardtTempl< VECTORTYPE, USERPARAM >

An implementation of the Levenberg-Marquardt algorithm for least-square minimization.

Refer to this page for more details on the algorithm and its usage.

Template Parameters
NUMTYPEThe numeric type for all the operations (float, double, or long double)
USERPARAMThe type of the "y" input to the user supplied evaluation functor. Default type is a vector of NUMTYPE.

Definition at line 37 of file CLevenbergMarquardt.h.

#include <mrpt/math/CLevenbergMarquardt.h>

Inheritance diagram for mrpt::math::CLevenbergMarquardtTempl< VECTORTYPE, USERPARAM >:
Inheritance graph

Classes

struct  TResultInfo
 

Public Types

typedef VECTORTYPE::Scalar NUMTYPE
 
typedef Eigen::Matrix< NUMTYPE, Eigen::Dynamic, Eigen::Dynamic > matrix_t
 
typedef VECTORTYPE vector_t
 
using TFunctorEval = std::function< void(const VECTORTYPE &x, const USERPARAM &y, VECTORTYPE &out)>
 The type of the function passed to execute. More...
 
using TFunctorIncrement = std::function< void(VECTORTYPE &x_new, const VECTORTYPE &x_old, const VECTORTYPE &x_incr, const USERPARAM &user_param)>
 The type of an optional functor passed to execute to replace the Euclidean addition "x_new = x_old + x_incr" by any other operation. More...
 

Public Member Functions

 CLevenbergMarquardtTempl ()
 
void execute (VECTORTYPE &out_optimal_x, const VECTORTYPE &x0, TFunctorEval functor, const VECTORTYPE &increments, const USERPARAM &userParam, TResultInfo &out_info, mrpt::utils::VerbosityLevel verbosity=mrpt::utils::LVL_INFO, const size_t maxIter=200, const NUMTYPE tau=1e-3, const NUMTYPE e1=1e-8, const NUMTYPE e2=1e-8, bool returnPath=true, TFunctorIncrement x_increment_adder=nullptr)
 Executes the LM-method, with derivatives estimated from functor is a user-provided function which takes as input two vectors, in this order: More...
 

Member Typedef Documentation

◆ matrix_t

template<typename VECTORTYPE = Eigen::VectorXd, class USERPARAM = VECTORTYPE>
typedef Eigen::Matrix<NUMTYPE, Eigen::Dynamic, Eigen::Dynamic> mrpt::math::CLevenbergMarquardtTempl< VECTORTYPE, USERPARAM >::matrix_t

Definition at line 41 of file CLevenbergMarquardt.h.

◆ NUMTYPE

template<typename VECTORTYPE = Eigen::VectorXd, class USERPARAM = VECTORTYPE>
typedef VECTORTYPE::Scalar mrpt::math::CLevenbergMarquardtTempl< VECTORTYPE, USERPARAM >::NUMTYPE

Definition at line 40 of file CLevenbergMarquardt.h.

◆ TFunctorEval

template<typename VECTORTYPE = Eigen::VectorXd, class USERPARAM = VECTORTYPE>
using mrpt::math::CLevenbergMarquardtTempl< VECTORTYPE, USERPARAM >::TFunctorEval = std::function<void( const VECTORTYPE& x, const USERPARAM& y, VECTORTYPE& out)>

The type of the function passed to execute.

The user must supply a function which evaluates the error of a given point in the solution space.

Parameters
xThe state point under examination.
yThe same object passed to "execute" as the parameter "userParam".
outThe vector of (non-squared) errors, of the average square root error, for the given "x". The functor code must set the size of this vector.

Definition at line 60 of file CLevenbergMarquardt.h.

◆ TFunctorIncrement

template<typename VECTORTYPE = Eigen::VectorXd, class USERPARAM = VECTORTYPE>
using mrpt::math::CLevenbergMarquardtTempl< VECTORTYPE, USERPARAM >::TFunctorIncrement = std::function<void( VECTORTYPE& x_new, const VECTORTYPE& x_old, const VECTORTYPE& x_incr, const USERPARAM& user_param)>

The type of an optional functor passed to execute to replace the Euclidean addition "x_new = x_old + x_incr" by any other operation.

Definition at line 67 of file CLevenbergMarquardt.h.

◆ vector_t

template<typename VECTORTYPE = Eigen::VectorXd, class USERPARAM = VECTORTYPE>
typedef VECTORTYPE mrpt::math::CLevenbergMarquardtTempl< VECTORTYPE, USERPARAM >::vector_t

Definition at line 42 of file CLevenbergMarquardt.h.

Constructor & Destructor Documentation

◆ CLevenbergMarquardtTempl()

template<typename VECTORTYPE = Eigen::VectorXd, class USERPARAM = VECTORTYPE>
mrpt::math::CLevenbergMarquardtTempl< VECTORTYPE, USERPARAM >::CLevenbergMarquardtTempl ( )
inline

Definition at line 44 of file CLevenbergMarquardt.h.

Member Function Documentation

◆ execute()

template<typename VECTORTYPE = Eigen::VectorXd, class USERPARAM = VECTORTYPE>
void mrpt::math::CLevenbergMarquardtTempl< VECTORTYPE, USERPARAM >::execute ( VECTORTYPE &  out_optimal_x,
const VECTORTYPE &  x0,
TFunctorEval  functor,
const VECTORTYPE &  increments,
const USERPARAM &  userParam,
TResultInfo out_info,
mrpt::utils::VerbosityLevel  verbosity = mrpt::utils::LVL_INFO,
const size_t  maxIter = 200,
const NUMTYPE  tau = 1e-3,
const NUMTYPE  e1 = 1e-8,
const NUMTYPE  e2 = 1e-8,
bool  returnPath = true,
TFunctorIncrement  x_increment_adder = nullptr 
)
inline

Executes the LM-method, with derivatives estimated from functor is a user-provided function which takes as input two vectors, in this order:

  • x: The parameters to be optimized.
  • userParam: The vector passed to the LM algorithm, unmodified. and must return the "error vector", or the error (not squared) in each measured dimension, so the sum of the square of that output is the overall square error.

x_increment_adder Is an optional functor which may replace the Euclidean "x_new = x + x_increment" at the core of the incremental optimizer by any other operation. It can be used for example, in on-manifold optimizations.

Definition at line 102 of file CLevenbergMarquardt.h.

References ASSERT_, mrpt::math::estimateJacobian(), mrpt::math::CLevenbergMarquardtTempl< VECTORTYPE, USERPARAM >::TResultInfo::final_sqr_err, mrpt::math::CLevenbergMarquardtTempl< VECTORTYPE, USERPARAM >::TResultInfo::H, mrpt::math::CLevenbergMarquardtTempl< VECTORTYPE, USERPARAM >::TResultInfo::iterations_executed, mrpt::math::CLevenbergMarquardtTempl< VECTORTYPE, USERPARAM >::TResultInfo::last_err_vector, MRPT_END, MRPT_START, mrpt::math::norm(), mrpt::math::norm_inf(), mrpt::math::CLevenbergMarquardtTempl< VECTORTYPE, USERPARAM >::TResultInfo::path, and mrpt::utils::sprintf_vector().

Here is the call graph for this function:



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019