mirror of
https://gitlab.com/libeigen/eigen.git
synced 2024-12-27 07:29:52 +08:00
fix usage of epsilon wrt to latest API change
This commit is contained in:
parent
fc5fa77743
commit
ccc58e935e
@ -63,7 +63,7 @@ public:
|
||||
Parameters()
|
||||
: factor(Scalar(100.))
|
||||
, maxfev(1000)
|
||||
, xtol(ei_sqrt(epsilon<Scalar>()))
|
||||
, xtol(ei_sqrt(NumTraits<Scalar>::epsilon()))
|
||||
, nb_of_subdiagonals(-1)
|
||||
, nb_of_superdiagonals(-1)
|
||||
, epsfcn(Scalar(0.)) {}
|
||||
@ -81,7 +81,7 @@ public:
|
||||
|
||||
HybridNonLinearSolverSpace::Status hybrj1(
|
||||
FVectorType &x,
|
||||
const Scalar tol = ei_sqrt(epsilon<Scalar>())
|
||||
const Scalar tol = ei_sqrt(NumTraits<Scalar>::epsilon())
|
||||
);
|
||||
|
||||
HybridNonLinearSolverSpace::Status solveInit(
|
||||
@ -99,7 +99,7 @@ public:
|
||||
|
||||
HybridNonLinearSolverSpace::Status hybrd1(
|
||||
FVectorType &x,
|
||||
const Scalar tol = ei_sqrt(epsilon<Scalar>())
|
||||
const Scalar tol = ei_sqrt(NumTraits<Scalar>::epsilon())
|
||||
);
|
||||
|
||||
HybridNonLinearSolverSpace::Status solveNumericalDiffInit(
|
||||
@ -341,7 +341,7 @@ HybridNonLinearSolver<FunctorType,Scalar>::solveOneStep(
|
||||
/* tests for termination and stringent tolerances. */
|
||||
if (nfev >= parameters.maxfev)
|
||||
return HybridNonLinearSolverSpace::TooManyFunctionEvaluation;
|
||||
if (Scalar(.1) * std::max(Scalar(.1) * delta, pnorm) <= epsilon<Scalar>() * xnorm)
|
||||
if (Scalar(.1) * std::max(Scalar(.1) * delta, pnorm) <= NumTraits<Scalar>::epsilon() * xnorm)
|
||||
return HybridNonLinearSolverSpace::TolTooSmall;
|
||||
if (nslow2 == 5)
|
||||
return HybridNonLinearSolverSpace::NotMakingProgressJacobian;
|
||||
@ -590,7 +590,7 @@ HybridNonLinearSolver<FunctorType,Scalar>::solveNumericalDiffOneStep(
|
||||
/* tests for termination and stringent tolerances. */
|
||||
if (nfev >= parameters.maxfev)
|
||||
return HybridNonLinearSolverSpace::TooManyFunctionEvaluation;
|
||||
if (Scalar(.1) * std::max(Scalar(.1) * delta, pnorm) <= epsilon<Scalar>() * xnorm)
|
||||
if (Scalar(.1) * std::max(Scalar(.1) * delta, pnorm) <= NumTraits<Scalar>::epsilon() * xnorm)
|
||||
return HybridNonLinearSolverSpace::TolTooSmall;
|
||||
if (nslow2 == 5)
|
||||
return HybridNonLinearSolverSpace::NotMakingProgressJacobian;
|
||||
|
@ -67,8 +67,8 @@ public:
|
||||
Parameters()
|
||||
: factor(Scalar(100.))
|
||||
, maxfev(400)
|
||||
, ftol(ei_sqrt(epsilon<Scalar>()))
|
||||
, xtol(ei_sqrt(epsilon<Scalar>()))
|
||||
, ftol(ei_sqrt(NumTraits<Scalar>::epsilon()))
|
||||
, xtol(ei_sqrt(NumTraits<Scalar>::epsilon()))
|
||||
, gtol(Scalar(0.))
|
||||
, epsfcn(Scalar(0.)) {}
|
||||
Scalar factor;
|
||||
@ -84,7 +84,7 @@ public:
|
||||
|
||||
LevenbergMarquardtSpace::Status lmder1(
|
||||
FVectorType &x,
|
||||
const Scalar tol = ei_sqrt(epsilon<Scalar>())
|
||||
const Scalar tol = ei_sqrt(NumTraits<Scalar>::epsilon())
|
||||
);
|
||||
|
||||
LevenbergMarquardtSpace::Status minimize(
|
||||
@ -104,12 +104,12 @@ public:
|
||||
FunctorType &functor,
|
||||
FVectorType &x,
|
||||
int *nfev,
|
||||
const Scalar tol = ei_sqrt(epsilon<Scalar>())
|
||||
const Scalar tol = ei_sqrt(NumTraits<Scalar>::epsilon())
|
||||
);
|
||||
|
||||
LevenbergMarquardtSpace::Status lmstr1(
|
||||
FVectorType &x,
|
||||
const Scalar tol = ei_sqrt(epsilon<Scalar>())
|
||||
const Scalar tol = ei_sqrt(NumTraits<Scalar>::epsilon())
|
||||
);
|
||||
|
||||
LevenbergMarquardtSpace::Status minimizeOptimumStorage(
|
||||
@ -370,11 +370,11 @@ LevenbergMarquardt<FunctorType,Scalar>::minimizeOneStep(
|
||||
/* tests for termination and stringent tolerances. */
|
||||
if (nfev >= parameters.maxfev)
|
||||
return LevenbergMarquardtSpace::TooManyFunctionEvaluation;
|
||||
if (ei_abs(actred) <= epsilon<Scalar>() && prered <= epsilon<Scalar>() && Scalar(.5) * ratio <= 1.)
|
||||
if (ei_abs(actred) <= NumTraits<Scalar>::epsilon() && prered <= NumTraits<Scalar>::epsilon() && Scalar(.5) * ratio <= 1.)
|
||||
return LevenbergMarquardtSpace::FtolTooSmall;
|
||||
if (delta <= epsilon<Scalar>() * xnorm)
|
||||
if (delta <= NumTraits<Scalar>::epsilon() * xnorm)
|
||||
return LevenbergMarquardtSpace::XtolTooSmall;
|
||||
if (gnorm <= epsilon<Scalar>())
|
||||
if (gnorm <= NumTraits<Scalar>::epsilon())
|
||||
return LevenbergMarquardtSpace::GtolTooSmall;
|
||||
|
||||
} while (ratio < Scalar(1e-4));
|
||||
@ -621,11 +621,11 @@ LevenbergMarquardt<FunctorType,Scalar>::minimizeOptimumStorageOneStep(
|
||||
/* tests for termination and stringent tolerances. */
|
||||
if (nfev >= parameters.maxfev)
|
||||
return LevenbergMarquardtSpace::TooManyFunctionEvaluation;
|
||||
if (ei_abs(actred) <= epsilon<Scalar>() && prered <= epsilon<Scalar>() && Scalar(.5) * ratio <= 1.)
|
||||
if (ei_abs(actred) <= NumTraits<Scalar>::epsilon() && prered <= NumTraits<Scalar>::epsilon() && Scalar(.5) * ratio <= 1.)
|
||||
return LevenbergMarquardtSpace::FtolTooSmall;
|
||||
if (delta <= epsilon<Scalar>() * xnorm)
|
||||
if (delta <= NumTraits<Scalar>::epsilon() * xnorm)
|
||||
return LevenbergMarquardtSpace::XtolTooSmall;
|
||||
if (gnorm <= epsilon<Scalar>())
|
||||
if (gnorm <= NumTraits<Scalar>::epsilon())
|
||||
return LevenbergMarquardtSpace::GtolTooSmall;
|
||||
|
||||
} while (ratio < Scalar(1e-4));
|
||||
|
@ -13,8 +13,8 @@ void ei_chkder(
|
||||
Matrix< Scalar, Dynamic, 1 > &err
|
||||
)
|
||||
{
|
||||
const Scalar eps = ei_sqrt(epsilon<Scalar>());
|
||||
const Scalar epsf = chkder_factor * epsilon<Scalar>();
|
||||
const Scalar eps = ei_sqrt(NumTraits<Scalar>::epsilon());
|
||||
const Scalar epsf = chkder_factor * NumTraits<Scalar>::epsilon();
|
||||
const Scalar epslog = chkder_log10e * ei_log(eps);
|
||||
Scalar temp;
|
||||
|
||||
@ -44,7 +44,7 @@ void ei_chkder(
|
||||
if (fvec[i] != 0. && fvecp[i] != 0. && ei_abs(fvecp[i] - fvec[i]) >= epsf * ei_abs(fvec[i]))
|
||||
temp = eps * ei_abs((fvecp[i] - fvec[i]) / eps - err[i]) / (ei_abs(fvec[i]) + ei_abs(fvecp[i]));
|
||||
err[i] = 1.;
|
||||
if (temp > epsilon<Scalar>() && temp < eps)
|
||||
if (temp > NumTraits<Scalar>::epsilon() && temp < eps)
|
||||
err[i] = (chkder_log10e * ei_log(temp) - epslog) / epslog;
|
||||
if (temp >= eps)
|
||||
err[i] = 0.;
|
||||
|
@ -3,7 +3,7 @@ template <typename Scalar>
|
||||
void ei_covar(
|
||||
Matrix< Scalar, Dynamic, Dynamic > &r,
|
||||
const VectorXi &ipvt,
|
||||
Scalar tol = ei_sqrt(epsilon<Scalar>()) )
|
||||
Scalar tol = ei_sqrt(NumTraits<Scalar>::epsilon()) )
|
||||
{
|
||||
/* Local variables */
|
||||
int i, j, k, l, ii, jj;
|
||||
|
@ -14,7 +14,7 @@ void ei_dogleg(
|
||||
Scalar sgnorm;
|
||||
|
||||
/* Function Body */
|
||||
const Scalar epsmch = epsilon<Scalar>();
|
||||
const Scalar epsmch = NumTraits<Scalar>::epsilon();
|
||||
const int n = qrfac.cols();
|
||||
assert(n==qtb.size());
|
||||
assert(n==x.size());
|
||||
|
@ -17,7 +17,7 @@ int ei_fdjac1(
|
||||
int start, length;
|
||||
|
||||
/* Function Body */
|
||||
const Scalar epsmch = epsilon<Scalar>();
|
||||
const Scalar epsmch = NumTraits<Scalar>::epsilon();
|
||||
const int n = x.size();
|
||||
assert(fvec.size()==n);
|
||||
Matrix< Scalar, Dynamic, 1 > wa1(n);
|
||||
|
Loading…
Reference in New Issue
Block a user