mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-06-04 18:54:00 +08:00
isApprox must honors nested_eval
This commit is contained in:
parent
5b78780def
commit
c16b80746a
@ -23,8 +23,13 @@ struct isApprox_selector
|
|||||||
static bool run(const Derived& x, const OtherDerived& y, const typename Derived::RealScalar& prec)
|
static bool run(const Derived& x, const OtherDerived& y, const typename Derived::RealScalar& prec)
|
||||||
{
|
{
|
||||||
EIGEN_USING_STD_MATH(min);
|
EIGEN_USING_STD_MATH(min);
|
||||||
|
#ifdef EIGEN_TEST_EVALUATORS
|
||||||
|
typename internal::nested_eval<Derived,2>::type nested(x);
|
||||||
|
typename internal::nested_eval<OtherDerived,2>::type otherNested(y);
|
||||||
|
#else
|
||||||
typename internal::nested<Derived,2>::type nested(x);
|
typename internal::nested<Derived,2>::type nested(x);
|
||||||
typename internal::nested<OtherDerived,2>::type otherNested(y);
|
typename internal::nested<OtherDerived,2>::type otherNested(y);
|
||||||
|
#endif
|
||||||
return (nested - otherNested).cwiseAbs2().sum() <= prec * prec * (min)(nested.cwiseAbs2().sum(), otherNested.cwiseAbs2().sum());
|
return (nested - otherNested).cwiseAbs2().sum() <= prec * prec * (min)(nested.cwiseAbs2().sum(), otherNested.cwiseAbs2().sum());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user