mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-01-24 14:45:14 +08:00
Allow LevenbergMarquardt to work with non-standard types.
This commit is contained in:
parent
0ba490cf80
commit
c3e4080474
@ -144,11 +144,13 @@ class LevenbergMarquardt : internal::no_assignment_operator
|
||||
|
||||
/** Sets the default parameters */
|
||||
void resetParameters()
|
||||
{
|
||||
{
|
||||
using std::sqrt;
|
||||
|
||||
m_factor = 100.;
|
||||
m_maxfev = 400;
|
||||
m_ftol = std::sqrt(NumTraits<RealScalar>::epsilon());
|
||||
m_xtol = std::sqrt(NumTraits<RealScalar>::epsilon());
|
||||
m_ftol = sqrt(NumTraits<RealScalar>::epsilon());
|
||||
m_xtol = sqrt(NumTraits<RealScalar>::epsilon());
|
||||
m_gtol = 0. ;
|
||||
m_epsfcn = 0. ;
|
||||
}
|
||||
|
@ -55,8 +55,8 @@ public:
|
||||
Parameters()
|
||||
: factor(Scalar(100.))
|
||||
, maxfev(400)
|
||||
, ftol(std::sqrt(NumTraits<Scalar>::epsilon()))
|
||||
, xtol(std::sqrt(NumTraits<Scalar>::epsilon()))
|
||||
, ftol(sqrt_(NumTraits<Scalar>::epsilon()))
|
||||
, xtol(sqrt_(NumTraits<Scalar>::epsilon()))
|
||||
, gtol(Scalar(0.))
|
||||
, epsfcn(Scalar(0.)) {}
|
||||
Scalar factor;
|
||||
@ -72,7 +72,7 @@ public:
|
||||
|
||||
LevenbergMarquardtSpace::Status lmder1(
|
||||
FVectorType &x,
|
||||
const Scalar tol = std::sqrt(NumTraits<Scalar>::epsilon())
|
||||
const Scalar tol = sqrt_(NumTraits<Scalar>::epsilon())
|
||||
);
|
||||
|
||||
LevenbergMarquardtSpace::Status minimize(FVectorType &x);
|
||||
@ -83,12 +83,12 @@ public:
|
||||
FunctorType &functor,
|
||||
FVectorType &x,
|
||||
Index *nfev,
|
||||
const Scalar tol = std::sqrt(NumTraits<Scalar>::epsilon())
|
||||
const Scalar tol = sqrt_(NumTraits<Scalar>::epsilon())
|
||||
);
|
||||
|
||||
LevenbergMarquardtSpace::Status lmstr1(
|
||||
FVectorType &x,
|
||||
const Scalar tol = std::sqrt(NumTraits<Scalar>::epsilon())
|
||||
const Scalar tol = sqrt_(NumTraits<Scalar>::epsilon())
|
||||
);
|
||||
|
||||
LevenbergMarquardtSpace::Status minimizeOptimumStorage(FVectorType &x);
|
||||
@ -109,6 +109,8 @@ public:
|
||||
|
||||
Scalar lm_param(void) { return par; }
|
||||
private:
|
||||
static Scalar sqrt_(const Scalar& x) { using std::sqrt; return sqrt(x); }
|
||||
|
||||
FunctorType &functor;
|
||||
Index n;
|
||||
Index m;
|
||||
|
Loading…
Reference in New Issue
Block a user