mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-03-07 18:27:40 +08:00
Add infinity() support to numext::numeric_limits, use it in lgamma.
This makes the infinity access a __device__ function, removing nvcc warnings.
This commit is contained in:
parent
832380c455
commit
6afea46838
@ -90,6 +90,11 @@ template<typename T> struct GenericNumTraits
|
||||
static inline T lowest() {
|
||||
return IsInteger ? (numext::numeric_limits<T>::min)() : (-(numext::numeric_limits<T>::max)());
|
||||
}
|
||||
|
||||
EIGEN_DEVICE_FUNC
|
||||
static inline T infinity() {
|
||||
return numext::numeric_limits<T>::infinity();
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T> struct NumTraits : GenericNumTraits<T>
|
||||
|
@ -283,7 +283,7 @@ struct digamma_impl {
|
||||
Scalar p, q, nz, s, w, y;
|
||||
bool negative;
|
||||
|
||||
const Scalar maxnum = std::numeric_limits<Scalar>::infinity();
|
||||
const Scalar maxnum = numext::numeric_limits<Scalar>::infinity();
|
||||
const Scalar m_pi = 3.14159265358979323846;
|
||||
|
||||
negative = 0;
|
||||
|
@ -147,6 +147,7 @@ template<typename T> struct numeric_limits
|
||||
static T epsilon() { return 0; }
|
||||
static T (max)() { assert(false && "Highest not supported for this type"); }
|
||||
static T (min)() { assert(false && "Lowest not supported for this type"); }
|
||||
static T infinity() { assert(false && "Infinity not supported for this type"); }
|
||||
};
|
||||
template<> struct numeric_limits<float>
|
||||
{
|
||||
@ -156,6 +157,8 @@ template<> struct numeric_limits<float>
|
||||
static float (max)() { return CUDART_MAX_NORMAL_F; }
|
||||
EIGEN_DEVICE_FUNC
|
||||
static float (min)() { return FLT_MIN; }
|
||||
EIGEN_DEVICE_FUNC
|
||||
static float infinity() { return CUDART_INF_F; }
|
||||
};
|
||||
template<> struct numeric_limits<double>
|
||||
{
|
||||
@ -165,6 +168,8 @@ template<> struct numeric_limits<double>
|
||||
static double (max)() { return DBL_MAX; }
|
||||
EIGEN_DEVICE_FUNC
|
||||
static double (min)() { return DBL_MIN; }
|
||||
EIGEN_DEVICE_FUNC
|
||||
static float infinity() { return CUDART_INF; }
|
||||
};
|
||||
template<> struct numeric_limits<int>
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user