mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-06 19:10:36 +08:00
Add numeric_limits min and max for bool
This will allow (among other things) computation of argmax and argmin of bool tensors
This commit is contained in:
parent
54a0a9c9dd
commit
bcc0e9e15c
@ -284,6 +284,8 @@ private:
|
||||
// Empty specialization for void to allow template specialization based on NumTraits<T>::Real with T==void and SFINAE.
|
||||
template<> struct NumTraits<void> {};
|
||||
|
||||
template<> NumTraits<bool> : GenericNumTraits<bool> {};
|
||||
|
||||
} // end namespace Eigen
|
||||
|
||||
#endif // EIGEN_NUMTRAITS_H
|
||||
|
@ -359,6 +359,15 @@ template<> struct numeric_limits<unsigned long long>
|
||||
EIGEN_DEVICE_FUNC
|
||||
static unsigned long long (min)() { return 0; }
|
||||
};
|
||||
template<> struct numeric_limits<bool>
|
||||
{
|
||||
EIGEN_DEVICE_FUNC
|
||||
static bool epsilon() { return false; }
|
||||
EIGEN_DEVICE_FUNC
|
||||
static bool (max)() { return true; }
|
||||
EIGEN_DEVICE_FUNC
|
||||
static bool (min)() { return false; }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user