From bcc0e9e15ceb2fc90acb64843bd2d6161d5f0c71 Mon Sep 17 00:00:00 2001 From: Akshay Naresh Modi Date: Mon, 6 Apr 2020 23:38:57 +0000 Subject: [PATCH] Add numeric_limits min and max for bool This will allow (among other things) computation of argmax and argmin of bool tensors --- Eigen/src/Core/NumTraits.h | 2 ++ Eigen/src/Core/util/Meta.h | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/Eigen/src/Core/NumTraits.h b/Eigen/src/Core/NumTraits.h index 12a7cde6b..80f909630 100644 --- a/Eigen/src/Core/NumTraits.h +++ b/Eigen/src/Core/NumTraits.h @@ -284,6 +284,8 @@ private: // Empty specialization for void to allow template specialization based on NumTraits::Real with T==void and SFINAE. template<> struct NumTraits {}; +template<> NumTraits : GenericNumTraits {}; + } // end namespace Eigen #endif // EIGEN_NUMTRAITS_H diff --git a/Eigen/src/Core/util/Meta.h b/Eigen/src/Core/util/Meta.h index 301077fab..e9e2f1873 100755 --- a/Eigen/src/Core/util/Meta.h +++ b/Eigen/src/Core/util/Meta.h @@ -359,6 +359,15 @@ template<> struct numeric_limits EIGEN_DEVICE_FUNC static unsigned long long (min)() { return 0; } }; +template<> struct numeric_limits +{ + EIGEN_DEVICE_FUNC + static bool epsilon() { return false; } + EIGEN_DEVICE_FUNC + static bool (max)() { return true; } + EIGEN_DEVICE_FUNC + static bool (min)() { return false; } +}; }