mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Rework the unit-tests to use lower precision, so as to eliminate
false positives. Also some cleanup in the fuzzy compares.
This commit is contained in:
@@ -50,18 +50,18 @@ bool MatrixBase<Scalar, Derived>::isApprox(
|
||||
|
||||
template<typename Scalar, typename Derived>
|
||||
bool MatrixBase<Scalar, Derived>::isMuchSmallerThan(
|
||||
const Scalar& other,
|
||||
const typename NumTraits<Scalar>::Real& other,
|
||||
const typename NumTraits<Scalar>::Real& prec
|
||||
) const
|
||||
{
|
||||
if(IsVector)
|
||||
{
|
||||
return(norm2() <= abs2(other) * prec * prec);
|
||||
return(norm2() <= abs2(other * prec));
|
||||
}
|
||||
else
|
||||
{
|
||||
for(int i = 0; i < cols(); i++)
|
||||
if(col(i).norm2() > abs2(other) * prec * prec)
|
||||
if(col(i).norm2() > abs2(other * prec))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -34,21 +34,6 @@ template<typename Scalar, typename Derived> class MatrixBase
|
||||
template<typename OtherDerived>
|
||||
void _copy_helper(const MatrixBase<Scalar, OtherDerived>& other);
|
||||
|
||||
template<typename OtherDerived>
|
||||
bool _isApprox_helper(
|
||||
const OtherDerived& other,
|
||||
const typename NumTraits<Scalar>::Real& prec = precision<Scalar>()
|
||||
) const;
|
||||
bool _isMuchSmallerThan_helper(
|
||||
const Scalar& other,
|
||||
const typename NumTraits<Scalar>::Real& prec = precision<Scalar>()
|
||||
) const;
|
||||
template<typename OtherDerived>
|
||||
bool _isMuchSmallerThan_helper(
|
||||
const MatrixBase<Scalar, OtherDerived>& other,
|
||||
const typename NumTraits<Scalar>::Real& prec = precision<Scalar>()
|
||||
) const;
|
||||
|
||||
public:
|
||||
static const int SizeAtCompileTime
|
||||
= RowsAtCompileTime == Dynamic || ColsAtCompileTime == Dynamic
|
||||
@@ -124,7 +109,7 @@ template<typename Scalar, typename Derived> class MatrixBase
|
||||
const typename NumTraits<Scalar>::Real& prec = precision<Scalar>()
|
||||
) const;
|
||||
bool isMuchSmallerThan(
|
||||
const Scalar& other,
|
||||
const typename NumTraits<Scalar>::Real& other,
|
||||
const typename NumTraits<Scalar>::Real& prec = precision<Scalar>()
|
||||
) const;
|
||||
template<typename OtherDerived>
|
||||
|
||||
Reference in New Issue
Block a user