aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/Fuzzy.h
diff options
context:
space:
mode:
Diffstat (limited to 'Eigen/src/Core/Fuzzy.h')
-rw-r--r--Eigen/src/Core/Fuzzy.h33
1 files changed, 18 insertions, 15 deletions
diff --git a/Eigen/src/Core/Fuzzy.h b/Eigen/src/Core/Fuzzy.h
index e10446398..dfa042377 100644
--- a/Eigen/src/Core/Fuzzy.h
+++ b/Eigen/src/Core/Fuzzy.h
@@ -47,14 +47,17 @@
*/
template<typename Derived>
template<typename OtherDerived>
-bool MatrixBase<Derived>::isApprox(
- const MatrixBase<OtherDerived>& other,
+bool DenseBase<Derived>::isApprox(
+ const DenseBase<OtherDerived>& other,
RealScalar prec
) const
{
const typename ei_nested<Derived,2>::type nested(derived());
const typename ei_nested<OtherDerived,2>::type otherNested(other.derived());
- return (nested - otherNested).cwise().abs2().sum() <= prec * prec * std::min(nested.cwise().abs2().sum(), otherNested.cwise().abs2().sum());
+// std::cerr << typeid(Derived).name() << " => " << typeid(typename ei_nested<Derived,2>::type).name() << "\n";
+// std::cerr << typeid(OtherDerived).name() << " => " << typeid(typename ei_nested<OtherDerived,2>::type).name() << "\n";
+// return false;
+ return (nested - otherNested).cwiseAbs2().sum() <= prec * prec * std::min(nested.cwiseAbs2().sum(), otherNested.cwiseAbs2().sum());
}
/** \returns \c true if the norm of \c *this is much smaller than \a other,
@@ -68,15 +71,15 @@ bool MatrixBase<Derived>::isApprox(
* the value of the reference scalar \a other should come from the Hilbert-Schmidt norm
* of a reference matrix of same dimensions.
*
- * \sa isApprox(), isMuchSmallerThan(const MatrixBase<OtherDerived>&, RealScalar) const
+ * \sa isApprox(), isMuchSmallerThan(const DenseBase<OtherDerived>&, RealScalar) const
*/
template<typename Derived>
-bool MatrixBase<Derived>::isMuchSmallerThan(
+bool DenseBase<Derived>::isMuchSmallerThan(
const typename NumTraits<Scalar>::Real& other,
RealScalar prec
) const
{
- return cwise().abs2().sum() <= prec * prec * other * other;
+ return derived().cwiseAbs2().sum() <= prec * prec * other * other;
}
/** \returns \c true if the norm of \c *this is much smaller than the norm of \a other,
@@ -91,12 +94,12 @@ bool MatrixBase<Derived>::isMuchSmallerThan(
*/
template<typename Derived>
template<typename OtherDerived>
-bool MatrixBase<Derived>::isMuchSmallerThan(
- const MatrixBase<OtherDerived>& other,
+bool DenseBase<Derived>::isMuchSmallerThan(
+ const DenseBase<OtherDerived>& other,
RealScalar prec
) const
{
- return this->cwise().abs2().sum() <= prec * prec * other.cwise().abs2().sum();
+ return derived().cwiseAbs2().sum() <= prec * prec * other.derived().cwiseAbs2().sum();
}
#else
@@ -122,8 +125,8 @@ struct ei_fuzzy_selector;
*/
template<typename Derived>
template<typename OtherDerived>
-bool MatrixBase<Derived>::isApprox(
- const MatrixBase<OtherDerived>& other,
+bool DenseBase<Derived>::isApprox(
+ const DenseBase<OtherDerived>& other,
RealScalar prec
) const
{
@@ -138,10 +141,10 @@ bool MatrixBase<Derived>::isApprox(
* \f[ \Vert v \Vert \leqslant p\,\vert x\vert. \f]
* For matrices, the comparison is done on all columns.
*
- * \sa isApprox(), isMuchSmallerThan(const MatrixBase<OtherDerived>&, RealScalar) const
+ * \sa isApprox(), isMuchSmallerThan(const DenseBase<OtherDerived>&, RealScalar) const
*/
template<typename Derived>
-bool MatrixBase<Derived>::isMuchSmallerThan(
+bool DenseBase<Derived>::isMuchSmallerThan(
const typename NumTraits<Scalar>::Real& other,
RealScalar prec
) const
@@ -161,8 +164,8 @@ bool MatrixBase<Derived>::isMuchSmallerThan(
*/
template<typename Derived>
template<typename OtherDerived>
-bool MatrixBase<Derived>::isMuchSmallerThan(
- const MatrixBase<OtherDerived>& other,
+bool DenseBase<Derived>::isMuchSmallerThan(
+ const DenseBase<OtherDerived>& other,
RealScalar prec
) const
{