mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-02-23 18:20:47 +08:00
fpclassify isn't portable enough. In particular, the return values of the function are not available on all the platforms Eigen supportes: remove it from Eigen.
This commit is contained in:
parent
f629fe95c8
commit
c61170e87d
@ -937,15 +937,6 @@ template<typename T> EIGEN_DEVICE_FUNC bool (isnan) (const T &x) { return inte
|
||||
template<typename T> EIGEN_DEVICE_FUNC bool (isinf) (const T &x) { return internal::isinf_impl(x); }
|
||||
template<typename T> EIGEN_DEVICE_FUNC bool (isfinite)(const T &x) { return internal::isfinite_impl(x); }
|
||||
|
||||
template<typename T> EIGEN_DEVICE_FUNC int (fpclassify)(const T& x){
|
||||
#ifdef __CUDA_ARCH__
|
||||
return (::fpclassify)(x);
|
||||
#else
|
||||
using std::fpclassify;
|
||||
return fpclassify(x);
|
||||
#endif
|
||||
}
|
||||
|
||||
template<typename Scalar>
|
||||
EIGEN_DEVICE_FUNC
|
||||
inline EIGEN_MATHFUNC_RETVAL(round, Scalar) round(const Scalar& x)
|
||||
|
@ -407,27 +407,6 @@ static EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bool (isnan)(const Eigen::half& a)
|
||||
static EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bool (isfinite)(const Eigen::half& a) {
|
||||
return !(Eigen::numext::isinf)(a) && !(Eigen::numext::isnan)(a);
|
||||
}
|
||||
template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC int (fpclassify)(const Eigen::half& a) {
|
||||
const int exponent = a.x & 0x7c00;
|
||||
const int mantissa = a.x & 0x03ff;
|
||||
if (exponent == 0) {
|
||||
if (mantissa == 0) {
|
||||
// Positive or negative zero.
|
||||
return FP_ZERO;
|
||||
} else {
|
||||
return FP_SUBNORMAL;
|
||||
}
|
||||
} else if (exponent == 0x7c00) {
|
||||
// Maximum possible exponent signifies either NaN or +/- inf.
|
||||
if (mantissa == 0) {
|
||||
return FP_INFINITE;
|
||||
} else {
|
||||
return FP_NAN;
|
||||
}
|
||||
} else {
|
||||
return FP_NORMAL;
|
||||
}
|
||||
}
|
||||
|
||||
template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half abs(const Eigen::half& a) {
|
||||
Eigen::half result;
|
||||
|
Loading…
Reference in New Issue
Block a user