Eigen::LevenbergMarquardt< FunctorType_ > Class Template Reference

Performs non linear optimization over a non-linear function, using a variant of the Levenberg Marquardt algorithm. More...

#include <LevenbergMarquardt.h>

+ Inheritance diagram for Eigen::LevenbergMarquardt< FunctorType_ >:

Classes

struct  Parameters
 

Public Types

typedef FunctorType_ FunctorType
 
typedef FunctorType::QRSolver QRSolver
 
typedef FunctorType::JacobianType JacobianType
 
typedef JacobianType::Scalar Scalar
 
typedef JacobianType::RealScalar RealScalar
 
typedef QRSolver::StorageIndex PermIndex
 
typedef Matrix< Scalar, Dynamic, 1 > FVectorType
 
typedef PermutationMatrix< Dynamic, Dynamic, intPermutationType
 
typedef DenseIndex Index
 
typedef Matrix< Scalar, Dynamic, 1 > FVectorType
 
typedef Matrix< Scalar, Dynamic, DynamicJacobianType
 

Public Member Functions

 LevenbergMarquardt (FunctorType &functor)
 
LevenbergMarquardtSpace::Status minimize (FVectorType &x)
 
LevenbergMarquardtSpace::Status minimizeInit (FVectorType &x)
 
LevenbergMarquardtSpace::Status minimizeOneStep (FVectorType &x)
 
LevenbergMarquardtSpace::Status lmder1 (FVectorType &x, const Scalar tol=std::sqrt(NumTraits< Scalar >::epsilon()))
 
void resetParameters ()
 
void setXtol (RealScalar xtol)
 
void setFtol (RealScalar ftol)
 
void setGtol (RealScalar gtol)
 
void setFactor (RealScalar factor)
 
void setEpsilon (RealScalar epsfcn)
 
void setMaxfev (Index maxfev)
 
void setExternalScaling (bool value)
 
RealScalar xtol () const
 
RealScalar ftol () const
 
RealScalar gtol () const
 
RealScalar factor () const
 
RealScalar epsilon () const
 
Index maxfev () const
 
FVectorTypediag ()
 
Index iterations ()
 
Index nfev ()
 
Index njev ()
 
RealScalar fnorm ()
 
RealScalar gnorm ()
 
RealScalar lm_param (void)
 
FVectorTypefvec ()
 
JacobianTypejacobian ()
 
JacobianTypematrixR ()
 
PermutationType permutation ()
 
ComputationInfo info () const
 Reports whether the minimization was successful. More...
 
 LevenbergMarquardt (FunctorType &_functor)
 
LevenbergMarquardtSpace::Status lmder1 (FVectorType &x, const Scalar tol=sqrt_epsilon())
 
LevenbergMarquardtSpace::Status minimize (FVectorType &x)
 
LevenbergMarquardtSpace::Status minimizeInit (FVectorType &x)
 
LevenbergMarquardtSpace::Status minimizeOneStep (FVectorType &x)
 
LevenbergMarquardtSpace::Status lmstr1 (FVectorType &x, const Scalar tol=sqrt_epsilon())
 
LevenbergMarquardtSpace::Status minimizeOptimumStorage (FVectorType &x)
 
LevenbergMarquardtSpace::Status minimizeOptimumStorageInit (FVectorType &x)
 
LevenbergMarquardtSpace::Status minimizeOptimumStorageOneStep (FVectorType &x)
 
void resetParameters (void)
 
Scalar lm_param (void)
 

Static Public Member Functions

static LevenbergMarquardtSpace::Status lmdif1 (FunctorType &functor, FVectorType &x, Index *nfev, const Scalar tol=std::sqrt(NumTraits< Scalar >::epsilon()))
 
static LevenbergMarquardtSpace::Status lmdif1 (FunctorType &functor, FVectorType &x, Index *nfev, const Scalar tol=sqrt_epsilon())
 

Public Attributes

Parameters parameters
 
FVectorType fvec
 
FVectorType qtf
 
FVectorType diag
 
JacobianType fjac
 
PermutationMatrix< Dynamic, Dynamicpermutation
 
Index nfev
 
Index njev
 
Index iter
 
Scalar fnorm
 
Scalar gnorm
 
bool useExternalScaling
 

Private Member Functions

LevenbergMarquardtoperator= (const LevenbergMarquardt &)
 

Static Private Member Functions

static Scalar sqrt_epsilon ()
 

Private Attributes

JacobianType m_fjac
 
JacobianType m_rfactor
 
FunctorTypem_functor
 
FVectorType m_fvec
 
FVectorType m_qtf
 
FVectorType m_diag
 
Index n
 
Index m
 
Index m_nfev
 
Index m_njev
 
RealScalar m_fnorm
 
RealScalar m_gnorm
 
RealScalar m_factor
 
Index m_maxfev
 
RealScalar m_ftol
 
RealScalar m_xtol
 
RealScalar m_gtol
 
RealScalar m_epsfcn
 
Index m_iter
 
RealScalar m_delta
 
bool m_useExternalScaling
 
PermutationType m_permutation
 
FVectorType m_wa1
 
FVectorType m_wa2
 
FVectorType m_wa3
 
FVectorType m_wa4
 
RealScalar m_par
 
bool m_isInitialized
 
ComputationInfo m_info
 
FunctorTypefunctor
 
FVectorType wa1
 
FVectorType wa2
 
FVectorType wa3
 
FVectorType wa4
 
Scalar par
 
Scalar sum
 
Scalar temp
 
Scalar temp1
 
Scalar temp2
 
Scalar delta
 
Scalar ratio
 
Scalar pnorm
 
Scalar xnorm
 
Scalar fnorm1
 
Scalar actred
 
Scalar dirder
 
Scalar prered
 

Detailed Description

template<typename FunctorType_>
class Eigen::LevenbergMarquardt< FunctorType_ >

Performs non linear optimization over a non-linear function, using a variant of the Levenberg Marquardt algorithm.

Check wikipedia for more information. http://en.wikipedia.org/wiki/Levenberg%E2%80%93Marquardt_algorithm

Member Typedef Documentation

◆ FunctorType

template<typename FunctorType_ >
typedef FunctorType_ Eigen::LevenbergMarquardt< FunctorType_ >::FunctorType

◆ FVectorType [1/2]

template<typename FunctorType_ >
typedef Matrix<Scalar, Dynamic, 1> Eigen::LevenbergMarquardt< FunctorType_ >::FVectorType

◆ FVectorType [2/2]

template<typename FunctorType_ >
typedef Matrix<Scalar, Dynamic, 1> Eigen::LevenbergMarquardt< FunctorType_ >::FVectorType

◆ Index

template<typename FunctorType_ >
typedef DenseIndex Eigen::LevenbergMarquardt< FunctorType_ >::Index

◆ JacobianType [1/2]

template<typename FunctorType_ >
typedef FunctorType::JacobianType Eigen::LevenbergMarquardt< FunctorType_ >::JacobianType

◆ JacobianType [2/2]

template<typename FunctorType_ >
typedef Matrix<Scalar, Dynamic, Dynamic> Eigen::LevenbergMarquardt< FunctorType_ >::JacobianType

◆ PermIndex

template<typename FunctorType_ >
typedef QRSolver::StorageIndex Eigen::LevenbergMarquardt< FunctorType_ >::PermIndex

◆ PermutationType

template<typename FunctorType_ >
typedef PermutationMatrix<Dynamic, Dynamic, int> Eigen::LevenbergMarquardt< FunctorType_ >::PermutationType

◆ QRSolver

template<typename FunctorType_ >
typedef FunctorType::QRSolver Eigen::LevenbergMarquardt< FunctorType_ >::QRSolver

◆ RealScalar

template<typename FunctorType_ >
typedef JacobianType::RealScalar Eigen::LevenbergMarquardt< FunctorType_ >::RealScalar

◆ Scalar

template<typename FunctorType_ >
typedef JacobianType::Scalar Eigen::LevenbergMarquardt< FunctorType_ >::Scalar

Constructor & Destructor Documentation

◆ LevenbergMarquardt() [1/2]

template<typename FunctorType_ >
Eigen::LevenbergMarquardt< FunctorType_ >::LevenbergMarquardt ( FunctorType functor)
inline
115  : m_functor(functor),
116  m_nfev(0),
117  m_njev(0),
118  m_fnorm(0.0),
119  m_gnorm(0),
120  m_isInitialized(false),
122  resetParameters();
123  m_useExternalScaling = false;
124  }
void resetParameters()
Definition: LevenbergMarquardt/LevenbergMarquardt.h:134
FunctorType & m_functor
Definition: LevenbergMarquardt/LevenbergMarquardt.h:236
FunctorType & functor
Definition: NonLinearOptimization/LevenbergMarquardt.h:111
bool m_useExternalScaling
Definition: LevenbergMarquardt/LevenbergMarquardt.h:252
RealScalar m_fnorm
Definition: LevenbergMarquardt/LevenbergMarquardt.h:242
RealScalar m_gnorm
Definition: LevenbergMarquardt/LevenbergMarquardt.h:243
ComputationInfo m_info
Definition: LevenbergMarquardt/LevenbergMarquardt.h:257
Index m_nfev
Definition: LevenbergMarquardt/LevenbergMarquardt.h:240
bool m_isInitialized
Definition: LevenbergMarquardt/LevenbergMarquardt.h:256
Index m_njev
Definition: LevenbergMarquardt/LevenbergMarquardt.h:241
@ InvalidInput
Definition: Constants.h:447

References Eigen::LevenbergMarquardt< FunctorType_ >::m_useExternalScaling, and Eigen::LevenbergMarquardt< FunctorType_ >::resetParameters().

◆ LevenbergMarquardt() [2/2]

template<typename FunctorType_ >
Eigen::LevenbergMarquardt< FunctorType_ >::LevenbergMarquardt ( FunctorType _functor)
inline
54  : functor(_functor) {
55  nfev = njev = iter = 0;
56  fnorm = gnorm = 0.;
57  useExternalScaling = false;
58  }
bool useExternalScaling
Definition: NonLinearOptimization/LevenbergMarquardt.h:106
Index iter
Definition: NonLinearOptimization/LevenbergMarquardt.h:104
Index njev
Definition: NonLinearOptimization/LevenbergMarquardt.h:103
Index nfev
Definition: NonLinearOptimization/LevenbergMarquardt.h:102
Scalar gnorm
Definition: NonLinearOptimization/LevenbergMarquardt.h:105
Scalar fnorm
Definition: NonLinearOptimization/LevenbergMarquardt.h:105

References Eigen::LevenbergMarquardt< FunctorType_ >::fnorm, Eigen::LevenbergMarquardt< FunctorType_ >::gnorm, Eigen::LevenbergMarquardt< FunctorType_ >::iter, Eigen::LevenbergMarquardt< FunctorType_ >::nfev, Eigen::LevenbergMarquardt< FunctorType_ >::njev, and Eigen::LevenbergMarquardt< FunctorType_ >::useExternalScaling.

Member Function Documentation

◆ diag()

template<typename FunctorType_ >
FVectorType& Eigen::LevenbergMarquardt< FunctorType_ >::diag ( )
inline
Returns
a reference to the diagonal of the jacobian
185 { return m_diag; }
FVectorType m_diag
Definition: LevenbergMarquardt/LevenbergMarquardt.h:237

References Eigen::LevenbergMarquardt< FunctorType_ >::m_diag.

◆ epsilon()

template<typename FunctorType_ >
RealScalar Eigen::LevenbergMarquardt< FunctorType_ >::epsilon ( ) const
inline
Returns
the error precision
179 { return m_epsfcn; }
RealScalar m_epsfcn
Definition: LevenbergMarquardt/LevenbergMarquardt.h:249

References Eigen::LevenbergMarquardt< FunctorType_ >::m_epsfcn.

◆ factor()

template<typename FunctorType_ >
RealScalar Eigen::LevenbergMarquardt< FunctorType_ >::factor ( ) const
inline
Returns
the step bound for the diagonal shift
176 { return m_factor; }
RealScalar m_factor
Definition: LevenbergMarquardt/LevenbergMarquardt.h:244

References Eigen::LevenbergMarquardt< FunctorType_ >::m_factor.

Referenced by Eigen::LevenbergMarquardt< FunctorType_ >::setFactor().

◆ fnorm()

template<typename FunctorType_ >
RealScalar Eigen::LevenbergMarquardt< FunctorType_ >::fnorm ( )
inline
Returns
the norm of current vector function
197 { return m_fnorm; }

References Eigen::LevenbergMarquardt< FunctorType_ >::m_fnorm.

◆ ftol()

template<typename FunctorType_ >
RealScalar Eigen::LevenbergMarquardt< FunctorType_ >::ftol ( ) const
inline
Returns
the tolerance for the norm of the vector function
170 { return m_ftol; }
RealScalar m_ftol
Definition: LevenbergMarquardt/LevenbergMarquardt.h:246

References Eigen::LevenbergMarquardt< FunctorType_ >::m_ftol.

Referenced by Eigen::LevenbergMarquardt< FunctorType_ >::setFtol().

◆ fvec()

template<typename FunctorType_ >
FVectorType& Eigen::LevenbergMarquardt< FunctorType_ >::fvec ( )
inline
Returns
a reference to the current vector function
207 { return m_fvec; }
FVectorType m_fvec
Definition: LevenbergMarquardt/LevenbergMarquardt.h:237

References Eigen::LevenbergMarquardt< FunctorType_ >::m_fvec.

◆ gnorm()

template<typename FunctorType_ >
RealScalar Eigen::LevenbergMarquardt< FunctorType_ >::gnorm ( )
inline
Returns
the norm of the gradient of the error
200 { return m_gnorm; }

References Eigen::LevenbergMarquardt< FunctorType_ >::m_gnorm.

◆ gtol()

template<typename FunctorType_ >
RealScalar Eigen::LevenbergMarquardt< FunctorType_ >::gtol ( ) const
inline
Returns
the tolerance for the norm of the gradient of the error vector
173 { return m_gtol; }
RealScalar m_gtol
Definition: LevenbergMarquardt/LevenbergMarquardt.h:248

References Eigen::LevenbergMarquardt< FunctorType_ >::m_gtol.

Referenced by Eigen::LevenbergMarquardt< FunctorType_ >::setGtol().

◆ info()

template<typename FunctorType_ >
ComputationInfo Eigen::LevenbergMarquardt< FunctorType_ >::info ( ) const
inline

Reports whether the minimization was successful.

Returns
Success if the minimization was successful, NumericalIssue if a numerical problem arises during the minimization process, for example during the QR factorization NoConvergence if the minimization did not converge after the maximum number of function evaluation allowed InvalidInput if the input matrix is invalid
231 { return m_info; }

References Eigen::LevenbergMarquardt< FunctorType_ >::m_info.

◆ iterations()

template<typename FunctorType_ >
Index Eigen::LevenbergMarquardt< FunctorType_ >::iterations ( )
inline
Returns
the number of iterations performed
188 { return m_iter; }
Index m_iter
Definition: LevenbergMarquardt/LevenbergMarquardt.h:250

References Eigen::LevenbergMarquardt< FunctorType_ >::m_iter.

◆ jacobian()

template<typename FunctorType_ >
JacobianType& Eigen::LevenbergMarquardt< FunctorType_ >::jacobian ( )
inline
Returns
a reference to the matrix where the current Jacobian matrix is stored
211 { return m_fjac; }
JacobianType m_fjac
Definition: LevenbergMarquardt/LevenbergMarquardt.h:234

References Eigen::LevenbergMarquardt< FunctorType_ >::m_fjac.

◆ lm_param() [1/2]

template<typename FunctorType_ >
RealScalar Eigen::LevenbergMarquardt< FunctorType_ >::lm_param ( void  )
inline
Returns
the LevenbergMarquardt parameter
203 { return m_par; }
RealScalar m_par
Definition: LevenbergMarquardt/LevenbergMarquardt.h:255

References Eigen::LevenbergMarquardt< FunctorType_ >::m_par.

◆ lm_param() [2/2]

template<typename FunctorType_ >
Scalar Eigen::LevenbergMarquardt< FunctorType_ >::lm_param ( void  )
inline
108 { return par; }
Scalar par
Definition: NonLinearOptimization/LevenbergMarquardt.h:116

References Eigen::LevenbergMarquardt< FunctorType_ >::par.

◆ lmder1() [1/2]

template<typename FunctorType_ >
LevenbergMarquardtSpace::Status Eigen::LevenbergMarquardt< FunctorType_ >::lmder1 ( FVectorType x,
const Scalar  tol = sqrt_epsilon() 
)

◆ lmder1() [2/2]

template<typename FunctorType , typename Scalar >
LevenbergMarquardtSpace::Status Eigen::LevenbergMarquardt< FunctorType, Scalar >::lmder1 ( FVectorType x,
const Scalar  tol = std::sqrt(NumTraits<Scalar>::epsilon()) 
)
324  {
325  n = x.size();
326  m = m_functor.values();
327 
328  /* check the input parameters for errors. */
329  if (n <= 0 || m < n || tol < 0.) return LevenbergMarquardtSpace::ImproperInputParameters;
330 
331  resetParameters();
332  m_ftol = tol;
333  m_xtol = tol;
334  m_maxfev = 100 * (n + 1);
335 
336  return minimize(x);
337 }
Index m
Definition: LevenbergMarquardt/LevenbergMarquardt.h:239
Index m_maxfev
Definition: LevenbergMarquardt/LevenbergMarquardt.h:245
LevenbergMarquardtSpace::Status minimize(FVectorType &x)
Definition: LevenbergMarquardt/LevenbergMarquardt.h:261
Index n
Definition: LevenbergMarquardt/LevenbergMarquardt.h:238
RealScalar m_xtol
Definition: LevenbergMarquardt/LevenbergMarquardt.h:247
@ ImproperInputParameters
Definition: LevenbergMarquardt/LevenbergMarquardt.h:30
list x
Definition: plotDoE.py:28

References Eigen::LevenbergMarquardtSpace::ImproperInputParameters, m, n, and plotDoE::x.

Referenced by test_lmder(), and testLmder1().

◆ lmdif1() [1/2]

template<typename FunctorType_ >
static LevenbergMarquardtSpace::Status Eigen::LevenbergMarquardt< FunctorType_ >::lmdif1 ( FunctorType functor,
FVectorType x,
Index nfev,
const Scalar  tol = sqrt_epsilon() 
)
static

◆ lmdif1() [2/2]

template<typename FunctorType , typename Scalar >
LevenbergMarquardtSpace::Status Eigen::LevenbergMarquardt< FunctorType, Scalar >::lmdif1 ( FunctorType functor,
FVectorType x,
Index nfev,
const Scalar  tol = std::sqrt(NumTraits<Scalar>::epsilon()) 
)
static
341  {
342  Index n = x.size();
343  Index m = functor.values();
344 
345  /* check the input parameters for errors. */
346  if (n <= 0 || m < n || tol < 0.) return LevenbergMarquardtSpace::ImproperInputParameters;
347 
348  NumericalDiff<FunctorType> numDiff(functor);
349  // embedded LevenbergMarquardt
350  LevenbergMarquardt<NumericalDiff<FunctorType> > lm(numDiff);
351  lm.setFtol(tol);
352  lm.setXtol(tol);
353  lm.setMaxfev(200 * (n + 1));
354 
356  if (nfev) *nfev = lm.nfev();
357  return info;
358 }
ComputationInfo info() const
Reports whether the minimization was successful.
Definition: LevenbergMarquardt/LevenbergMarquardt.h:231
DenseIndex Index
Definition: NonLinearOptimization/LevenbergMarquardt.h:60
Status
Definition: LevenbergMarquardt/LevenbergMarquardt.h:27

References Eigen::LevenbergMarquardtSpace::ImproperInputParameters, info, m, Eigen::LevenbergMarquardt< FunctorType_ >::minimize(), n, Eigen::LevenbergMarquardt< FunctorType_ >::nfev, Eigen::LevenbergMarquardt< FunctorType_ >::setFtol(), Eigen::LevenbergMarquardt< FunctorType_ >::setMaxfev(), Eigen::LevenbergMarquardt< FunctorType_ >::setXtol(), and plotDoE::x.

◆ lmstr1()

template<typename FunctorType , typename Scalar >
LevenbergMarquardtSpace::Status Eigen::LevenbergMarquardt< FunctorType, Scalar >::lmstr1 ( FVectorType x,
const Scalar  tol = sqrt_epsilon() 
)
328  {
329  n = x.size();
330  m = functor.values();
331 
332  /* check the input parameters for errors. */
333  if (n <= 0 || m < n || tol < 0.) return LevenbergMarquardtSpace::ImproperInputParameters;
334 
335  resetParameters();
336  parameters.ftol = tol;
337  parameters.xtol = tol;
338  parameters.maxfev = 100 * (n + 1);
339 
340  return minimizeOptimumStorage(x);
341 }
LevenbergMarquardtSpace::Status minimizeOptimumStorage(FVectorType &x)
Definition: NonLinearOptimization/LevenbergMarquardt.h:553
Parameters parameters
Definition: NonLinearOptimization/LevenbergMarquardt.h:98
Index maxfev
Definition: NonLinearOptimization/LevenbergMarquardt.h:71
Scalar ftol
Definition: NonLinearOptimization/LevenbergMarquardt.h:72
Scalar xtol
Definition: NonLinearOptimization/LevenbergMarquardt.h:73

References Eigen::LevenbergMarquardtSpace::ImproperInputParameters, m, n, and plotDoE::x.

Referenced by testLmstr1().

◆ matrixR()

template<typename FunctorType_ >
JacobianType& Eigen::LevenbergMarquardt< FunctorType_ >::matrixR ( )
inline
Returns
a reference to the triangular matrix R from the QR of the jacobian matrix.
See also
jacobian()
216 { return m_rfactor; }
JacobianType m_rfactor
Definition: LevenbergMarquardt/LevenbergMarquardt.h:235

References Eigen::LevenbergMarquardt< FunctorType_ >::m_rfactor.

Referenced by testLmder(), and testLmdif().

◆ maxfev()

template<typename FunctorType_ >
Index Eigen::LevenbergMarquardt< FunctorType_ >::maxfev ( ) const
inline
Returns
the maximum number of function evaluation
182 { return m_maxfev; }

References Eigen::LevenbergMarquardt< FunctorType_ >::m_maxfev.

Referenced by Eigen::LevenbergMarquardt< FunctorType_ >::setMaxfev().

◆ minimize() [1/2]

template<typename FunctorType , typename Scalar >
LevenbergMarquardtSpace::Status Eigen::LevenbergMarquardt< FunctorType, Scalar >::minimize ( FVectorType x)
261  {
264  m_isInitialized = true;
265  return status;
266  }
267  do {
268  // std::cout << " uv " << x.transpose() << "\n";
269  status = minimizeOneStep(x);
270  } while (status == LevenbergMarquardtSpace::Running);
271  m_isInitialized = true;
272  return status;
273 }
LevenbergMarquardtSpace::Status minimizeOneStep(FVectorType &x)
Definition: LMonestep.h:23
LevenbergMarquardtSpace::Status minimizeInit(FVectorType &x)
Definition: LevenbergMarquardt/LevenbergMarquardt.h:276
@ Running
Definition: LevenbergMarquardt/LevenbergMarquardt.h:29

References Eigen::LevenbergMarquardtSpace::ImproperInputParameters, Eigen::LevenbergMarquardtSpace::Running, and plotDoE::x.

Referenced by Eigen::LevenbergMarquardt< FunctorType_ >::lmdif1(), test_minimizeLM(), testLmder(), testLmdif(), testNistBennett5(), testNistBoxBOD(), testNistChwirut2(), testNistEckerle4(), testNistHahn1(), testNistLanczos1(), testNistMGH09(), testNistMGH10(), testNistMGH17(), testNistMisra1a(), testNistMisra1d(), testNistRat42(), testNistRat43(), and testNistThurber().

◆ minimize() [2/2]

template<typename FunctorType_ >
LevenbergMarquardtSpace::Status Eigen::LevenbergMarquardt< FunctorType_ >::minimize ( FVectorType x)

◆ minimizeInit() [1/2]

template<typename FunctorType , typename Scalar >
LevenbergMarquardtSpace::Status Eigen::LevenbergMarquardt< FunctorType, Scalar >::minimizeInit ( FVectorType x)
276  {
277  n = x.size();
278  m = m_functor.values();
279 
280  m_wa1.resize(n);
281  m_wa2.resize(n);
282  m_wa3.resize(n);
283  m_wa4.resize(m);
284  m_fvec.resize(m);
285  // FIXME Sparse Case : Allocate space for the jacobian
286  m_fjac.resize(m, n);
287  // m_fjac.reserve(VectorXi::Constant(n,5)); // FIXME Find a better alternative
289  eigen_assert((!m_useExternalScaling || m_diag.size() == n) &&
290  "When m_useExternalScaling is set, the caller must provide a valid 'm_diag'");
291  m_qtf.resize(n);
292 
293  /* Function Body */
294  m_nfev = 0;
295  m_njev = 0;
296 
297  /* check the input parameters for errors. */
298  if (n <= 0 || m < n || m_ftol < 0. || m_xtol < 0. || m_gtol < 0. || m_maxfev <= 0 || m_factor <= 0.) {
301  }
302 
304  for (Index j = 0; j < n; ++j)
305  if (m_diag[j] <= 0.) {
308  }
309 
310  /* evaluate the function at the starting point */
311  /* and calculate its norm. */
312  m_nfev = 1;
314  m_fnorm = m_fvec.stableNorm();
315 
316  /* initialize levenberg-marquardt parameter and iteration counter. */
317  m_par = 0.;
318  m_iter = 1;
319 
321 }
#define eigen_assert(x)
Definition: Macros.h:910
FVectorType m_wa2
Definition: LevenbergMarquardt/LevenbergMarquardt.h:254
FVectorType m_qtf
Definition: LevenbergMarquardt/LevenbergMarquardt.h:237
FVectorType m_wa3
Definition: LevenbergMarquardt/LevenbergMarquardt.h:254
FVectorType m_wa1
Definition: LevenbergMarquardt/LevenbergMarquardt.h:254
FVectorType m_wa4
Definition: LevenbergMarquardt/LevenbergMarquardt.h:254
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE void resize(Index rows, Index cols)
Definition: PlainObjectBase.h:294
@ NotStarted
Definition: LevenbergMarquardt/LevenbergMarquardt.h:28
@ UserAsked
Definition: LevenbergMarquardt/LevenbergMarquardt.h:39
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2

References eigen_assert, Eigen::LevenbergMarquardtSpace::ImproperInputParameters, Eigen::InvalidInput, j, m, n, Eigen::LevenbergMarquardtSpace::NotStarted, Eigen::LevenbergMarquardtSpace::UserAsked, and plotDoE::x.

Referenced by test_minimizeSteps(), and test_sparseLM_T().

◆ minimizeInit() [2/2]

template<typename FunctorType_ >
LevenbergMarquardtSpace::Status Eigen::LevenbergMarquardt< FunctorType_ >::minimizeInit ( FVectorType x)

◆ minimizeOneStep() [1/2]

template<typename FunctorType , typename Scalar >
LevenbergMarquardtSpace::Status Eigen::LevenbergMarquardt< FunctorType, Scalar >::minimizeOneStep ( FVectorType x)
23  {
24  using std::abs;
25  using std::sqrt;
29  eigen_assert(x.size() == n); // check the caller is not cheating us
30 
31  temp = 0.0;
32  xnorm = 0.0;
33  /* calculate the jacobian matrix. */
34  Index df_ret = m_functor.df(x, m_fjac);
35  if (df_ret < 0) return LevenbergMarquardtSpace::UserAsked;
36  if (df_ret > 0)
37  // numerical diff, we evaluated the function df_ret times
38  m_nfev += df_ret;
39  else
40  m_njev++;
41 
42  /* compute the qr factorization of the jacobian. */
43  for (int j = 0; j < x.size(); ++j) m_wa2(j) = m_fjac.col(j).blueNorm();
44  QRSolver qrfac(m_fjac);
45  if (qrfac.info() != Success) {
48  }
49  // Make a copy of the first factor with the associated permutation
50  m_rfactor = qrfac.matrixR();
51  m_permutation = (qrfac.colsPermutation());
52 
53  /* on the first iteration and if external scaling is not used, scale according */
54  /* to the norms of the columns of the initial jacobian. */
55  if (m_iter == 1) {
57  for (Index j = 0; j < n; ++j) m_diag[j] = (m_wa2[j] == 0.) ? 1. : m_wa2[j];
58 
59  /* on the first iteration, calculate the norm of the scaled x */
60  /* and initialize the step bound m_delta. */
61  xnorm = m_diag.cwiseProduct(x).stableNorm();
63  if (m_delta == 0.) m_delta = m_factor;
64  }
65 
66  /* form (q transpose)*m_fvec and store the first n components in */
67  /* m_qtf. */
68  m_wa4 = m_fvec;
69  m_wa4 = qrfac.matrixQ().adjoint() * m_fvec;
70  m_qtf = m_wa4.head(n);
71 
72  /* compute the norm of the scaled gradient. */
73  m_gnorm = 0.;
74  if (m_fnorm != 0.)
75  for (Index j = 0; j < n; ++j)
76  if (m_wa2[m_permutation.indices()[j]] != 0.)
77  m_gnorm = (std::max)(m_gnorm, abs(m_rfactor.col(j).head(j + 1).dot(m_qtf.head(j + 1) / m_fnorm) /
79 
80  /* test for convergence of the gradient norm. */
81  if (m_gnorm <= m_gtol) {
82  m_info = Success;
84  }
85 
86  /* rescale if necessary. */
87  if (!m_useExternalScaling) m_diag = m_diag.cwiseMax(m_wa2);
88 
89  do {
90  /* determine the levenberg-marquardt parameter. */
92 
93  /* store the direction p and x + p. calculate the norm of p. */
94  m_wa1 = -m_wa1;
95  m_wa2 = x + m_wa1;
96  pnorm = m_diag.cwiseProduct(m_wa1).stableNorm();
97 
98  /* on the first iteration, adjust the initial step bound. */
99  if (m_iter == 1) m_delta = (std::min)(m_delta, pnorm);
100 
101  /* evaluate the function at x + p and calculate its norm. */
103  ++m_nfev;
104  fnorm1 = m_wa4.stableNorm();
105 
106  /* compute the scaled actual reduction. */
107  actred = -1.;
108  if (Scalar(.1) * fnorm1 < m_fnorm) actred = 1. - numext::abs2(fnorm1 / m_fnorm);
109 
110  /* compute the scaled predicted reduction and */
111  /* the scaled directional derivative. */
112  m_wa3 = m_rfactor.template triangularView<Upper>() * (m_permutation.inverse() * m_wa1);
113  temp1 = numext::abs2(m_wa3.stableNorm() / m_fnorm);
115  prered = temp1 + temp2 / Scalar(.5);
116  dirder = -(temp1 + temp2);
117 
118  /* compute the ratio of the actual to the predicted */
119  /* reduction. */
120  ratio = 0.;
121  if (prered != 0.) ratio = actred / prered;
122 
123  /* update the step bound. */
124  if (ratio <= Scalar(.25)) {
125  if (actred >= 0.) temp = RealScalar(.5);
126  if (actred < 0.) temp = RealScalar(.5) * dirder / (dirder + RealScalar(.5) * actred);
127  if (RealScalar(.1) * fnorm1 >= m_fnorm || temp < RealScalar(.1)) temp = Scalar(.1);
128  /* Computing MIN */
130  m_par /= temp;
131  } else if (!(m_par != 0. && ratio < RealScalar(.75))) {
132  m_delta = pnorm / RealScalar(.5);
133  m_par = RealScalar(.5) * m_par;
134  }
135 
136  /* test for successful iteration. */
137  if (ratio >= RealScalar(1e-4)) {
138  /* successful iteration. update x, m_fvec, and their norms. */
139  x = m_wa2;
140  m_wa2 = m_diag.cwiseProduct(x);
141  m_fvec = m_wa4;
142  xnorm = m_wa2.stableNorm();
143  m_fnorm = fnorm1;
144  ++m_iter;
145  }
146 
147  /* tests for convergence. */
148  if (abs(actred) <= m_ftol && prered <= m_ftol && Scalar(.5) * ratio <= 1. && m_delta <= m_xtol * xnorm) {
149  m_info = Success;
151  }
152  if (abs(actred) <= m_ftol && prered <= m_ftol && Scalar(.5) * ratio <= 1.) {
153  m_info = Success;
155  }
156  if (m_delta <= m_xtol * xnorm) {
157  m_info = Success;
159  }
160 
161  /* tests for termination and stringent tolerances. */
162  if (m_nfev >= m_maxfev) {
165  }
167  Scalar(.5) * ratio <= 1.) {
168  m_info = Success;
170  }
172  m_info = Success;
174  }
176  m_info = Success;
178  }
179 
180  } while (ratio < Scalar(1e-4));
181 
183 }
AnnoyingScalar abs(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:135
AnnoyingScalar sqrt(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:134
Array< double, 1, 3 > e(1./3., 0.5, 2.)
NumTraits< Scalar >::Real RealScalar
Definition: bench_gemm.cpp:46
JacobianType::Scalar Scalar
Definition: LevenbergMarquardt/LevenbergMarquardt.h:107
FunctorType::QRSolver QRSolver
Definition: LevenbergMarquardt/LevenbergMarquardt.h:105
JacobianType::RealScalar RealScalar
Definition: LevenbergMarquardt/LevenbergMarquardt.h:108
Scalar temp2
Definition: NonLinearOptimization/LevenbergMarquardt.h:117
Scalar pnorm
Definition: NonLinearOptimization/LevenbergMarquardt.h:120
Scalar dirder
Definition: NonLinearOptimization/LevenbergMarquardt.h:120
Scalar temp
Definition: NonLinearOptimization/LevenbergMarquardt.h:117
Scalar xnorm
Definition: NonLinearOptimization/LevenbergMarquardt.h:120
Scalar prered
Definition: NonLinearOptimization/LevenbergMarquardt.h:120
Scalar fnorm1
Definition: NonLinearOptimization/LevenbergMarquardt.h:120
RealScalar m_delta
Definition: LevenbergMarquardt/LevenbergMarquardt.h:251
PermutationType m_permutation
Definition: LevenbergMarquardt/LevenbergMarquardt.h:253
Scalar temp1
Definition: NonLinearOptimization/LevenbergMarquardt.h:117
Scalar ratio
Definition: NonLinearOptimization/LevenbergMarquardt.h:119
Scalar actred
Definition: NonLinearOptimization/LevenbergMarquardt.h:120
InverseReturnType inverse() const
Definition: PermutationMatrix.h:172
const IndicesType & indices() const
Definition: PermutationMatrix.h:334
#define min(a, b)
Definition: datatypes.h:22
#define max(a, b)
Definition: datatypes.h:23
@ NumericalIssue
Definition: Constants.h:442
@ Success
Definition: Constants.h:440
@ NoConvergence
Definition: Constants.h:444
@ RelativeReductionTooSmall
Definition: LevenbergMarquardt/LevenbergMarquardt.h:31
@ GtolTooSmall
Definition: LevenbergMarquardt/LevenbergMarquardt.h:38
@ FtolTooSmall
Definition: LevenbergMarquardt/LevenbergMarquardt.h:36
@ TooManyFunctionEvaluation
Definition: LevenbergMarquardt/LevenbergMarquardt.h:35
@ XtolTooSmall
Definition: LevenbergMarquardt/LevenbergMarquardt.h:37
@ CosinusTooSmall
Definition: LevenbergMarquardt/LevenbergMarquardt.h:34
@ RelativeErrorTooSmall
Definition: LevenbergMarquardt/LevenbergMarquardt.h:32
@ RelativeErrorAndReductionTooSmall
Definition: LevenbergMarquardt/LevenbergMarquardt.h:33
void lmpar2(const QRSolver &qr, const VectorType &diag, const VectorType &qtb, typename VectorType::Scalar m_delta, typename VectorType::Scalar &par, VectorType &x)
Definition: LMpar.h:23
EIGEN_DEVICE_FUNC bool abs2(bool x)
Definition: MathFunctions.h:1102
double epsilon
Definition: osc_ring_sarah_asymptotics.h:43

References abs(), Eigen::numext::abs2(), Eigen::LevenbergMarquardtSpace::CosinusTooSmall, e(), eigen_assert, Eigen::LevenbergMarquardtSpace::FtolTooSmall, Eigen::LevenbergMarquardtSpace::GtolTooSmall, Eigen::LevenbergMarquardtSpace::ImproperInputParameters, j, Eigen::internal::lmpar2(), max, min, n, Eigen::NoConvergence, Eigen::NumericalIssue, Eigen::LevenbergMarquardtSpace::RelativeErrorAndReductionTooSmall, Eigen::LevenbergMarquardtSpace::RelativeErrorTooSmall, Eigen::LevenbergMarquardtSpace::RelativeReductionTooSmall, Eigen::LevenbergMarquardtSpace::Running, sqrt(), Eigen::Success, Eigen::LevenbergMarquardtSpace::TooManyFunctionEvaluation, Eigen::LevenbergMarquardtSpace::UserAsked, plotDoE::x, and Eigen::LevenbergMarquardtSpace::XtolTooSmall.

Referenced by test_minimizeSteps().

◆ minimizeOneStep() [2/2]

template<typename FunctorType_ >
LevenbergMarquardtSpace::Status Eigen::LevenbergMarquardt< FunctorType_ >::minimizeOneStep ( FVectorType x)

◆ minimizeOptimumStorage()

template<typename FunctorType , typename Scalar >
LevenbergMarquardtSpace::Status Eigen::LevenbergMarquardt< FunctorType, Scalar >::minimizeOptimumStorage ( FVectorType x)
553  {
555  if (status == LevenbergMarquardtSpace::ImproperInputParameters) return status;
556  do {
558  } while (status == LevenbergMarquardtSpace::Running);
559  return status;
560 }
LevenbergMarquardtSpace::Status minimizeOptimumStorageOneStep(FVectorType &x)
Definition: NonLinearOptimization/LevenbergMarquardt.h:391
LevenbergMarquardtSpace::Status minimizeOptimumStorageInit(FVectorType &x)
Definition: NonLinearOptimization/LevenbergMarquardt.h:344

References Eigen::LevenbergMarquardtSpace::ImproperInputParameters, Eigen::LevenbergMarquardtSpace::Running, and plotDoE::x.

Referenced by testLmstr().

◆ minimizeOptimumStorageInit()

template<typename FunctorType , typename Scalar >
LevenbergMarquardtSpace::Status Eigen::LevenbergMarquardt< FunctorType, Scalar >::minimizeOptimumStorageInit ( FVectorType x)
344  {
345  n = x.size();
346  m = functor.values();
347 
348  wa1.resize(n);
349  wa2.resize(n);
350  wa3.resize(n);
351  wa4.resize(m);
352  fvec.resize(m);
353  // Only R is stored in fjac. Q is only used to compute 'qtf', which is
354  // Q.transpose()*rhs. qtf will be updated using givens rotation,
355  // instead of storing them in Q.
356  // The purpose it to only use a nxn matrix, instead of mxn here, so
357  // that we can handle cases where m>>n :
358  fjac.resize(n, n);
360  eigen_assert((!useExternalScaling || diag.size() == n) &&
361  "When useExternalScaling is set, the caller must provide a valid 'diag'");
362  qtf.resize(n);
363 
364  /* Function Body */
365  nfev = 0;
366  njev = 0;
367 
368  /* check the input parameters for errors. */
369  if (n <= 0 || m < n || parameters.ftol < 0. || parameters.xtol < 0. || parameters.gtol < 0. ||
370  parameters.maxfev <= 0 || parameters.factor <= 0.)
372 
373  if (useExternalScaling)
374  for (Index j = 0; j < n; ++j)
376 
377  /* evaluate the function at the starting point */
378  /* and calculate its norm. */
379  nfev = 1;
381  fnorm = fvec.stableNorm();
382 
383  /* initialize levenberg-marquardt parameter and iteration counter. */
384  par = 0.;
385  iter = 1;
386 
388 }
FVectorType diag
Definition: NonLinearOptimization/LevenbergMarquardt.h:99
FVectorType wa4
Definition: NonLinearOptimization/LevenbergMarquardt.h:114
JacobianType fjac
Definition: NonLinearOptimization/LevenbergMarquardt.h:100
FVectorType fvec
Definition: NonLinearOptimization/LevenbergMarquardt.h:99
FVectorType wa1
Definition: NonLinearOptimization/LevenbergMarquardt.h:114
FVectorType wa2
Definition: NonLinearOptimization/LevenbergMarquardt.h:114
FVectorType qtf
Definition: NonLinearOptimization/LevenbergMarquardt.h:99
FVectorType wa3
Definition: NonLinearOptimization/LevenbergMarquardt.h:114
Scalar factor
Definition: NonLinearOptimization/LevenbergMarquardt.h:70
Scalar gtol
Definition: NonLinearOptimization/LevenbergMarquardt.h:74

References diag, eigen_assert, Eigen::LevenbergMarquardtSpace::ImproperInputParameters, j, m, n, Eigen::LevenbergMarquardtSpace::NotStarted, calibrate::par, Eigen::LevenbergMarquardtSpace::UserAsked, and plotDoE::x.

◆ minimizeOptimumStorageOneStep()

template<typename FunctorType , typename Scalar >
LevenbergMarquardtSpace::Status Eigen::LevenbergMarquardt< FunctorType, Scalar >::minimizeOptimumStorageOneStep ( FVectorType x)
391  {
392  using std::abs;
393  using std::sqrt;
394 
395  eigen_assert(x.size() == n); // check the caller is not cheating us
396 
397  Index i, j;
398  bool sing;
399 
400  /* compute the qr factorization of the jacobian matrix */
401  /* calculated one row at a time, while simultaneously */
402  /* forming (q transpose)*fvec and storing the first */
403  /* n components in qtf. */
404  qtf.fill(0.);
405  fjac.fill(0.);
406  Index rownb = 2;
407  for (i = 0; i < m; ++i) {
408  if (functor.df(x, wa3, rownb) < 0) return LevenbergMarquardtSpace::UserAsked;
409  internal::rwupdt<Scalar>(fjac, wa3, qtf, fvec[i]);
410  ++rownb;
411  }
412  ++njev;
413 
414  /* if the jacobian is rank deficient, call qrfac to */
415  /* reorder its columns and update the components of qtf. */
416  sing = false;
417  for (j = 0; j < n; ++j) {
418  if (fjac(j, j) == 0.) sing = true;
419  wa2[j] = fjac.col(j).head(j).stableNorm();
420  }
422  if (sing) {
423  wa2 = fjac.colwise().blueNorm();
424  // TODO We have no unit test covering this code path, do not modify
425  // until it is carefully tested
426  ColPivHouseholderQR<JacobianType> qrfac(fjac);
427  fjac = qrfac.matrixQR();
428  wa1 = fjac.diagonal();
429  fjac.diagonal() = qrfac.hCoeffs();
430  permutation = qrfac.colsPermutation();
431  // TODO : avoid this:
432  for (Index ii = 0; ii < fjac.cols(); ii++)
433  fjac.col(ii).segment(ii + 1, fjac.rows() - ii - 1) *= fjac(ii, ii); // rescale vectors
434 
435  for (j = 0; j < n; ++j) {
436  if (fjac(j, j) != 0.) {
437  sum = 0.;
438  for (i = j; i < n; ++i) sum += fjac(i, j) * qtf[i];
439  temp = -sum / fjac(j, j);
440  for (i = j; i < n; ++i) qtf[i] += fjac(i, j) * temp;
441  }
442  fjac(j, j) = wa1[j];
443  }
444  }
445 
446  /* on the first iteration and if external scaling is not used, scale according */
447  /* to the norms of the columns of the initial jacobian. */
448  if (iter == 1) {
449  if (!useExternalScaling)
450  for (j = 0; j < n; ++j) diag[j] = (wa2[j] == 0.) ? 1. : wa2[j];
451 
452  /* on the first iteration, calculate the norm of the scaled x */
453  /* and initialize the step bound delta. */
454  xnorm = diag.cwiseProduct(x).stableNorm();
456  if (delta == 0.) delta = parameters.factor;
457  }
458 
459  /* compute the norm of the scaled gradient. */
460  gnorm = 0.;
461  if (fnorm != 0.)
462  for (j = 0; j < n; ++j)
463  if (wa2[permutation.indices()[j]] != 0.)
464  gnorm = (std::max)(gnorm,
465  abs(fjac.col(j).head(j + 1).dot(qtf.head(j + 1) / fnorm) / wa2[permutation.indices()[j]]));
466 
467  /* test for convergence of the gradient norm. */
469 
470  /* rescale if necessary. */
471  if (!useExternalScaling) diag = diag.cwiseMax(wa2);
472 
473  do {
474  /* determine the levenberg-marquardt parameter. */
475  internal::lmpar<Scalar>(fjac, permutation.indices(), diag, qtf, delta, par, wa1);
476 
477  /* store the direction p and x + p. calculate the norm of p. */
478  wa1 = -wa1;
479  wa2 = x + wa1;
480  pnorm = diag.cwiseProduct(wa1).stableNorm();
481 
482  /* on the first iteration, adjust the initial step bound. */
483  if (iter == 1) delta = (std::min)(delta, pnorm);
484 
485  /* evaluate the function at x + p and calculate its norm. */
487  ++nfev;
488  fnorm1 = wa4.stableNorm();
489 
490  /* compute the scaled actual reduction. */
491  actred = -1.;
492  if (Scalar(.1) * fnorm1 < fnorm) actred = 1. - numext::abs2(fnorm1 / fnorm);
493 
494  /* compute the scaled predicted reduction and */
495  /* the scaled directional derivative. */
496  wa3 = fjac.topLeftCorner(n, n).template triangularView<Upper>() * (permutation.inverse() * wa1);
497  temp1 = numext::abs2(wa3.stableNorm() / fnorm);
499  prered = temp1 + temp2 / Scalar(.5);
500  dirder = -(temp1 + temp2);
501 
502  /* compute the ratio of the actual to the predicted */
503  /* reduction. */
504  ratio = 0.;
505  if (prered != 0.) ratio = actred / prered;
506 
507  /* update the step bound. */
508  if (ratio <= Scalar(.25)) {
509  if (actred >= 0.) temp = Scalar(.5);
510  if (actred < 0.) temp = Scalar(.5) * dirder / (dirder + Scalar(.5) * actred);
511  if (Scalar(.1) * fnorm1 >= fnorm || temp < Scalar(.1)) temp = Scalar(.1);
512  /* Computing MIN */
513  delta = temp * (std::min)(delta, pnorm / Scalar(.1));
514  par /= temp;
515  } else if (!(par != 0. && ratio < Scalar(.75))) {
516  delta = pnorm / Scalar(.5);
517  par = Scalar(.5) * par;
518  }
519 
520  /* test for successful iteration. */
521  if (ratio >= Scalar(1e-4)) {
522  /* successful iteration. update x, fvec, and their norms. */
523  x = wa2;
524  wa2 = diag.cwiseProduct(x);
525  fvec = wa4;
526  xnorm = wa2.stableNorm();
527  fnorm = fnorm1;
528  ++iter;
529  }
530 
531  /* tests for convergence. */
532  if (abs(actred) <= parameters.ftol && prered <= parameters.ftol && Scalar(.5) * ratio <= 1. &&
533  delta <= parameters.xtol * xnorm)
535  if (abs(actred) <= parameters.ftol && prered <= parameters.ftol && Scalar(.5) * ratio <= 1.)
538 
539  /* tests for termination and stringent tolerances. */
542  Scalar(.5) * ratio <= 1.)
546 
547  } while (ratio < Scalar(1e-4));
548 
550 }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
SCALAR Scalar
Definition: bench_gemm.cpp:45
Scalar delta
Definition: NonLinearOptimization/LevenbergMarquardt.h:118
PermutationMatrix< Dynamic, Dynamic > permutation
Definition: NonLinearOptimization/LevenbergMarquardt.h:101
Scalar sum
Definition: NonLinearOptimization/LevenbergMarquardt.h:116
void setIdentity()
Definition: PermutationMatrix.h:122

References abs(), Eigen::numext::abs2(), Eigen::ColPivHouseholderQR< MatrixType_, PermutationIndex_ >::colsPermutation(), Eigen::LevenbergMarquardtSpace::CosinusTooSmall, MultiOpt::delta, diag, e(), eigen_assert, Eigen::LevenbergMarquardtSpace::FtolTooSmall, Eigen::LevenbergMarquardtSpace::GtolTooSmall, Eigen::ColPivHouseholderQR< MatrixType_, PermutationIndex_ >::hCoeffs(), i, j, m, Eigen::ColPivHouseholderQR< MatrixType_, PermutationIndex_ >::matrixQR(), max, min, n, calibrate::par, Eigen::LevenbergMarquardtSpace::RelativeErrorAndReductionTooSmall, Eigen::LevenbergMarquardtSpace::RelativeErrorTooSmall, Eigen::LevenbergMarquardtSpace::RelativeReductionTooSmall, Eigen::LevenbergMarquardtSpace::Running, sqrt(), Eigen::LevenbergMarquardtSpace::TooManyFunctionEvaluation, Eigen::LevenbergMarquardtSpace::UserAsked, plotDoE::x, and Eigen::LevenbergMarquardtSpace::XtolTooSmall.

◆ nfev()

template<typename FunctorType_ >
Index Eigen::LevenbergMarquardt< FunctorType_ >::nfev ( )
inline
Returns
the number of functions evaluation
191 { return m_nfev; }

References Eigen::LevenbergMarquardt< FunctorType_ >::m_nfev.

◆ njev()

template<typename FunctorType_ >
Index Eigen::LevenbergMarquardt< FunctorType_ >::njev ( )
inline
Returns
the number of jacobian evaluation
194 { return m_njev; }

References Eigen::LevenbergMarquardt< FunctorType_ >::m_njev.

◆ operator=()

template<typename FunctorType_ >
LevenbergMarquardt& Eigen::LevenbergMarquardt< FunctorType_ >::operator= ( const LevenbergMarquardt< FunctorType_ > &  )
private

◆ permutation()

template<typename FunctorType_ >
PermutationType Eigen::LevenbergMarquardt< FunctorType_ >::permutation ( )
inline

the permutation used in the QR factorization

220 { return m_permutation; }

References Eigen::LevenbergMarquardt< FunctorType_ >::m_permutation.

◆ resetParameters() [1/2]

◆ resetParameters() [2/2]

template<typename FunctorType_ >
void Eigen::LevenbergMarquardt< FunctorType_ >::resetParameters ( void  )
inline

◆ setEpsilon()

template<typename FunctorType_ >
void Eigen::LevenbergMarquardt< FunctorType_ >::setEpsilon ( RealScalar  epsfcn)
inline

Sets the error precision

158 { m_epsfcn = epsfcn; }

References Eigen::LevenbergMarquardt< FunctorType_ >::m_epsfcn.

◆ setExternalScaling()

template<typename FunctorType_ >
void Eigen::LevenbergMarquardt< FunctorType_ >::setExternalScaling ( bool  value)
inline

Use an external Scaling. If set to true, pass a nonzero diagonal to diag()

squared absolute value
Definition: GlobalFunctions.h:87

References Eigen::LevenbergMarquardt< FunctorType_ >::m_useExternalScaling, and Eigen::value.

◆ setFactor()

template<typename FunctorType_ >
void Eigen::LevenbergMarquardt< FunctorType_ >::setFactor ( RealScalar  factor)
inline

Sets the step bound for the diagonal shift

155 { m_factor = factor; }
RealScalar factor() const
Definition: LevenbergMarquardt/LevenbergMarquardt.h:176

References Eigen::LevenbergMarquardt< FunctorType_ >::factor(), and Eigen::LevenbergMarquardt< FunctorType_ >::m_factor.

Referenced by testNistBoxBOD().

◆ setFtol()

template<typename FunctorType_ >
void Eigen::LevenbergMarquardt< FunctorType_ >::setFtol ( RealScalar  ftol)
inline

Sets the tolerance for the norm of the vector function

149 { m_ftol = ftol; }
RealScalar ftol() const
Definition: LevenbergMarquardt/LevenbergMarquardt.h:170

References Eigen::LevenbergMarquardt< FunctorType_ >::ftol(), and Eigen::LevenbergMarquardt< FunctorType_ >::m_ftol.

Referenced by Eigen::LevenbergMarquardt< FunctorType_ >::lmdif1(), testNistBoxBOD(), testNistChwirut2(), testNistMGH17(), testNistRat43(), and testNistThurber().

◆ setGtol()

template<typename FunctorType_ >
void Eigen::LevenbergMarquardt< FunctorType_ >::setGtol ( RealScalar  gtol)
inline

Sets the tolerance for the norm of the gradient of the error vector

152 { m_gtol = gtol; }
RealScalar gtol() const
Definition: LevenbergMarquardt/LevenbergMarquardt.h:173

References Eigen::LevenbergMarquardt< FunctorType_ >::gtol(), and Eigen::LevenbergMarquardt< FunctorType_ >::m_gtol.

◆ setMaxfev()

template<typename FunctorType_ >
void Eigen::LevenbergMarquardt< FunctorType_ >::setMaxfev ( Index  maxfev)
inline

Sets the maximum number of function evaluation

161 { m_maxfev = maxfev; }
Index maxfev() const
Definition: LevenbergMarquardt/LevenbergMarquardt.h:182

References Eigen::LevenbergMarquardt< FunctorType_ >::m_maxfev, and Eigen::LevenbergMarquardt< FunctorType_ >::maxfev().

Referenced by Eigen::LevenbergMarquardt< FunctorType_ >::lmdif1(), testNistBennett5(), testNistMGH09(), and testNistMGH17().

◆ setXtol()

template<typename FunctorType_ >
void Eigen::LevenbergMarquardt< FunctorType_ >::setXtol ( RealScalar  xtol)
inline

Sets the tolerance for the norm of the solution vector

146 { m_xtol = xtol; }
RealScalar xtol() const
Definition: LevenbergMarquardt/LevenbergMarquardt.h:167

References Eigen::LevenbergMarquardt< FunctorType_ >::m_xtol, and Eigen::LevenbergMarquardt< FunctorType_ >::xtol().

Referenced by Eigen::LevenbergMarquardt< FunctorType_ >::lmdif1(), testNistBoxBOD(), testNistChwirut2(), testNistMGH17(), testNistRat43(), and testNistThurber().

◆ sqrt_epsilon()

template<typename FunctorType_ >
static Scalar Eigen::LevenbergMarquardt< FunctorType_ >::sqrt_epsilon ( )
inlinestaticprivate
48  {
49  using std::sqrt;
51  }

References sqrt().

◆ xtol()

template<typename FunctorType_ >
RealScalar Eigen::LevenbergMarquardt< FunctorType_ >::xtol ( ) const
inline
Returns
the tolerance for the norm of the solution vector
167 { return m_xtol; }

References Eigen::LevenbergMarquardt< FunctorType_ >::m_xtol.

Referenced by Eigen::LevenbergMarquardt< FunctorType_ >::setXtol().

Member Data Documentation

◆ actred

template<typename FunctorType_ >
Scalar Eigen::LevenbergMarquardt< FunctorType_ >::actred
private

◆ delta

template<typename FunctorType_ >
Scalar Eigen::LevenbergMarquardt< FunctorType_ >::delta
private

◆ diag

template<typename FunctorType_ >
FVectorType Eigen::LevenbergMarquardt< FunctorType_ >::diag

◆ dirder

template<typename FunctorType_ >
Scalar Eigen::LevenbergMarquardt< FunctorType_ >::dirder
private

◆ fjac

template<typename FunctorType_ >
JacobianType Eigen::LevenbergMarquardt< FunctorType_ >::fjac

Referenced by testLmder(), and testLmdif().

◆ fnorm

template<typename FunctorType_ >
Scalar Eigen::LevenbergMarquardt< FunctorType_ >::fnorm

◆ fnorm1

template<typename FunctorType_ >
Scalar Eigen::LevenbergMarquardt< FunctorType_ >::fnorm1
private

◆ functor

template<typename FunctorType_ >
FunctorType& Eigen::LevenbergMarquardt< FunctorType_ >::functor
private

◆ fvec

◆ gnorm

template<typename FunctorType_ >
Scalar Eigen::LevenbergMarquardt< FunctorType_ >::gnorm

◆ iter

template<typename FunctorType_ >
Index Eigen::LevenbergMarquardt< FunctorType_ >::iter

◆ m

template<typename FunctorType_ >
Index Eigen::LevenbergMarquardt< FunctorType_ >::m
private

◆ m_delta

template<typename FunctorType_ >
RealScalar Eigen::LevenbergMarquardt< FunctorType_ >::m_delta
private

◆ m_diag

template<typename FunctorType_ >
FVectorType Eigen::LevenbergMarquardt< FunctorType_ >::m_diag
private

◆ m_epsfcn

◆ m_factor

◆ m_fjac

template<typename FunctorType_ >
JacobianType Eigen::LevenbergMarquardt< FunctorType_ >::m_fjac
private

◆ m_fnorm

template<typename FunctorType_ >
RealScalar Eigen::LevenbergMarquardt< FunctorType_ >::m_fnorm
private

◆ m_ftol

◆ m_functor

template<typename FunctorType_ >
FunctorType& Eigen::LevenbergMarquardt< FunctorType_ >::m_functor
private

◆ m_fvec

template<typename FunctorType_ >
FVectorType Eigen::LevenbergMarquardt< FunctorType_ >::m_fvec
private

◆ m_gnorm

template<typename FunctorType_ >
RealScalar Eigen::LevenbergMarquardt< FunctorType_ >::m_gnorm
private

◆ m_gtol

◆ m_info

template<typename FunctorType_ >
ComputationInfo Eigen::LevenbergMarquardt< FunctorType_ >::m_info
private

◆ m_isInitialized

template<typename FunctorType_ >
bool Eigen::LevenbergMarquardt< FunctorType_ >::m_isInitialized
private

◆ m_iter

template<typename FunctorType_ >
Index Eigen::LevenbergMarquardt< FunctorType_ >::m_iter
private

◆ m_maxfev

◆ m_nfev

template<typename FunctorType_ >
Index Eigen::LevenbergMarquardt< FunctorType_ >::m_nfev
private

◆ m_njev

template<typename FunctorType_ >
Index Eigen::LevenbergMarquardt< FunctorType_ >::m_njev
private

◆ m_par

template<typename FunctorType_ >
RealScalar Eigen::LevenbergMarquardt< FunctorType_ >::m_par
private

◆ m_permutation

template<typename FunctorType_ >
PermutationType Eigen::LevenbergMarquardt< FunctorType_ >::m_permutation
private

◆ m_qtf

template<typename FunctorType_ >
FVectorType Eigen::LevenbergMarquardt< FunctorType_ >::m_qtf
private

◆ m_rfactor

template<typename FunctorType_ >
JacobianType Eigen::LevenbergMarquardt< FunctorType_ >::m_rfactor
private

◆ m_useExternalScaling

template<typename FunctorType_ >
bool Eigen::LevenbergMarquardt< FunctorType_ >::m_useExternalScaling
private

◆ m_wa1

template<typename FunctorType_ >
FVectorType Eigen::LevenbergMarquardt< FunctorType_ >::m_wa1
private

◆ m_wa2

template<typename FunctorType_ >
FVectorType Eigen::LevenbergMarquardt< FunctorType_ >::m_wa2
private

◆ m_wa3

template<typename FunctorType_ >
FVectorType Eigen::LevenbergMarquardt< FunctorType_ >::m_wa3
private

◆ m_wa4

template<typename FunctorType_ >
FVectorType Eigen::LevenbergMarquardt< FunctorType_ >::m_wa4
private

◆ m_xtol

◆ n

template<typename FunctorType_ >
Index Eigen::LevenbergMarquardt< FunctorType_ >::n
private

◆ nfev

◆ njev

◆ par

template<typename FunctorType_ >
Scalar Eigen::LevenbergMarquardt< FunctorType_ >::par
private

◆ parameters

◆ permutation

template<typename FunctorType_ >
PermutationMatrix<Dynamic, Dynamic> Eigen::LevenbergMarquardt< FunctorType_ >::permutation

Referenced by testLmder(), and testLmdif().

◆ pnorm

template<typename FunctorType_ >
Scalar Eigen::LevenbergMarquardt< FunctorType_ >::pnorm
private

◆ prered

template<typename FunctorType_ >
Scalar Eigen::LevenbergMarquardt< FunctorType_ >::prered
private

◆ qtf

template<typename FunctorType_ >
FVectorType Eigen::LevenbergMarquardt< FunctorType_ >::qtf

◆ ratio

template<typename FunctorType_ >
Scalar Eigen::LevenbergMarquardt< FunctorType_ >::ratio
private

◆ sum

template<typename FunctorType_ >
Scalar Eigen::LevenbergMarquardt< FunctorType_ >::sum
private

◆ temp

template<typename FunctorType_ >
Scalar Eigen::LevenbergMarquardt< FunctorType_ >::temp
private

◆ temp1

template<typename FunctorType_ >
Scalar Eigen::LevenbergMarquardt< FunctorType_ >::temp1
private

◆ temp2

template<typename FunctorType_ >
Scalar Eigen::LevenbergMarquardt< FunctorType_ >::temp2
private

◆ useExternalScaling

template<typename FunctorType_ >
bool Eigen::LevenbergMarquardt< FunctorType_ >::useExternalScaling

◆ wa1

template<typename FunctorType_ >
FVectorType Eigen::LevenbergMarquardt< FunctorType_ >::wa1
private

◆ wa2

template<typename FunctorType_ >
FVectorType Eigen::LevenbergMarquardt< FunctorType_ >::wa2
private

◆ wa3

template<typename FunctorType_ >
FVectorType Eigen::LevenbergMarquardt< FunctorType_ >::wa3
private

◆ wa4

template<typename FunctorType_ >
FVectorType Eigen::LevenbergMarquardt< FunctorType_ >::wa4
private

◆ xnorm

template<typename FunctorType_ >
Scalar Eigen::LevenbergMarquardt< FunctorType_ >::xnorm
private

The documentation for this class was generated from the following files: