Main MRPT website > C++ reference
MRPT logo
Classes | Public Types | Static Public Member Functions
mrpt::math::CLevenbergMarquardtTempl Class Reference

Detailed Description

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.

#include <mrpt/math/CLevenbergMarquardt.h>

Inheritance diagram for mrpt::math::CLevenbergMarquardtTempl:
Inheritance graph
[legend]

List of all members.

Classes

struct  TResultInfo

Public Types

typedef VECTORTYPE::value_type NUMTYPE
typedef void(* TFunctorEval )(const VECTORTYPE &x, const USERPARAM &y, VECTORTYPE &out)
 The type of the function passed to execute.
typedef void(* TFunctorIncrement )(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.

Static Public Member Functions

static void execute (VECTORTYPE &out_optimal_x, const VECTORTYPE &x0, TFunctorEval functor, const VECTORTYPE &increments, const USERPARAM &userParam, TResultInfo &out_info, bool verbose=false, 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=NULL)
 Executes the LM-method, with derivatives estimated from functor is a user-provided function which takes as input two vectors, in this order:
static void printf_debug (const char *frmt,...)
 Sends a formated text to "debugOut" if not NULL, or to cout otherwise.

Member Typedef Documentation

Definition at line 54 of file CLevenbergMarquardt.h.

typedef void(* mrpt::math::CLevenbergMarquardtTempl::TFunctorEval)(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 62 of file CLevenbergMarquardt.h.

typedef void(* mrpt::math::CLevenbergMarquardtTempl::TFunctorIncrement)(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 69 of file CLevenbergMarquardt.h.


Member Function Documentation

static void mrpt::math::CLevenbergMarquardtTempl::execute ( VECTORTYPE &  out_optimal_x,
const VECTORTYPE &  x0,
TFunctorEval  functor,
const VECTORTYPE &  increments,
const USERPARAM &  userParam,
TResultInfo out_info,
bool  verbose = false,
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 = NULL 
) [inline, static]

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 98 of file CLevenbergMarquardt.h.

References MRPT_START, ASSERT_, mrpt::math::estimateJacobian(), mrpt::math::norm_inf(), mrpt::utils::CDebugOutputCapable::printf_debug(), mrpt::math::norm(), mrpt::math::CLevenbergMarquardtTempl::TResultInfo::path, mrpt::format(), mrpt::utils::sprintf_vector(), mrpt::math::CLevenbergMarquardtTempl::TResultInfo::final_sqr_err, mrpt::math::CLevenbergMarquardtTempl::TResultInfo::iterations_executed, mrpt::math::CLevenbergMarquardtTempl::TResultInfo::last_err_vector, and MRPT_END.

static void mrpt::utils::CDebugOutputCapable::printf_debug ( const char *  frmt,
  ... 
) [static, inherited]

Sends a formated text to "debugOut" if not NULL, or to cout otherwise.

Referenced by execute().




Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Thu Oct 13 21:25:36 UTC 2011