isApprox must honors nested_eval

This commit is contained in:
Gael Guennebaud 2014-02-19 11:30:58 +01:00
parent 5b78780def
commit c16b80746a

View File

@ -23,8 +23,13 @@ struct isApprox_selector
static bool run(const Derived& x, const OtherDerived& y, const typename Derived::RealScalar& prec)
{
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<OtherDerived,2>::type otherNested(y);
#endif
return (nested - otherNested).cwiseAbs2().sum() <= prec * prec * (min)(nested.cwiseAbs2().sum(), otherNested.cwiseAbs2().sum());
}
};