From 156a31b0e91c178ddb4d422fc5f27e98d3bbd032 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Thu, 25 Nov 2010 18:00:30 +0100 Subject: [PATCH] fully implement scalar_fuzzy_impl as, e.g., the missing isMuchSmallerThan is convenient to filter out false values. --- Eigen/src/Core/MathFunctions.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Eigen/src/Core/MathFunctions.h b/Eigen/src/Core/MathFunctions.h index 990509d48..6651b6535 100644 --- a/Eigen/src/Core/MathFunctions.h +++ b/Eigen/src/Core/MathFunctions.h @@ -862,10 +862,24 @@ template<> struct random_impl template<> struct scalar_fuzzy_impl { + typedef bool RealScalar; + + template + static inline bool isMuchSmallerThan(const bool& x, const bool&, const bool&) + { + return !x; + } + static inline bool isApprox(bool x, bool y, bool) { return x == y; } + + static inline bool isApproxOrLessThan(const bool& x, const bool& y, const bool&) + { + return (!x) || y; + } + }; } // end namespace internal