mirror of
https://gitlab.com/libeigen/eigen.git
synced 2024-12-15 07:10:37 +08:00
Unify std::numeric_limits and device::numeric_limits within numext namespace
This commit is contained in:
parent
7b68cf2e0f
commit
06971223ef
@ -71,11 +71,7 @@ template<typename T> struct GenericNumTraits
|
|||||||
EIGEN_DEVICE_FUNC
|
EIGEN_DEVICE_FUNC
|
||||||
static inline Real epsilon()
|
static inline Real epsilon()
|
||||||
{
|
{
|
||||||
#if defined(__CUDA_ARCH__)
|
return numext::numeric_limits<T>::epsilon();
|
||||||
return internal::device::numeric_limits<T>::epsilon();
|
|
||||||
#else
|
|
||||||
return std::numeric_limits<T>::epsilon();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
EIGEN_DEVICE_FUNC
|
EIGEN_DEVICE_FUNC
|
||||||
static inline Real dummy_precision()
|
static inline Real dummy_precision()
|
||||||
@ -87,20 +83,12 @@ template<typename T> struct GenericNumTraits
|
|||||||
|
|
||||||
EIGEN_DEVICE_FUNC
|
EIGEN_DEVICE_FUNC
|
||||||
static inline T highest() {
|
static inline T highest() {
|
||||||
#if defined(__CUDA_ARCH__)
|
return (numext::numeric_limits<T>::max)();
|
||||||
return (internal::device::numeric_limits<T>::max)();
|
|
||||||
#else
|
|
||||||
return (std::numeric_limits<T>::max)();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EIGEN_DEVICE_FUNC
|
EIGEN_DEVICE_FUNC
|
||||||
static inline T lowest() {
|
static inline T lowest() {
|
||||||
#if defined(__CUDA_ARCH__)
|
return IsInteger ? (numext::numeric_limits<T>::min)() : (-(numext::numeric_limits<T>::max)());
|
||||||
return IsInteger ? (internal::device::numeric_limits<T>::min)() : (-(internal::device::numeric_limits<T>::max)());
|
|
||||||
#else
|
|
||||||
return IsInteger ? (std::numeric_limits<T>::min)() : (-(std::numeric_limits<T>::max)());
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -375,6 +375,12 @@ template<typename T> EIGEN_DEVICE_FUNC void swap(T &a, T &b) { T tmp = b; b =
|
|||||||
template<typename T> EIGEN_STRONG_INLINE void swap(T &a, T &b) { std::swap(a,b); }
|
template<typename T> EIGEN_STRONG_INLINE void swap(T &a, T &b) { std::swap(a,b); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__CUDA_ARCH__)
|
||||||
|
using internal::device::numeric_limits;
|
||||||
|
#else
|
||||||
|
using std::numeric_limits;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Integer division with rounding up.
|
// Integer division with rounding up.
|
||||||
// T is assumed to be an integer type with a>=0, and b>0
|
// T is assumed to be an integer type with a>=0, and b>0
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
Loading…
Reference in New Issue
Block a user