mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-01-06 14:14:46 +08:00
Use threadsafe versions of lgamma and lgammaf if possible.
This commit is contained in:
parent
530f20c21a
commit
2ebb314fa7
@ -120,13 +120,27 @@ struct lgamma_retval {
|
||||
template <>
|
||||
struct lgamma_impl<float> {
|
||||
EIGEN_DEVICE_FUNC
|
||||
static EIGEN_STRONG_INLINE float run(float x) { return ::lgammaf(x); }
|
||||
static EIGEN_STRONG_INLINE float run(float x) {
|
||||
#ifdef _BSD_SOURCE || _SVID_SOURCE
|
||||
int signgam;
|
||||
return ::lgammaf_r(x, &signgam);
|
||||
#else
|
||||
return ::lgammaf(x);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct lgamma_impl<double> {
|
||||
EIGEN_DEVICE_FUNC
|
||||
static EIGEN_STRONG_INLINE double run(double x) { return ::lgamma(x); }
|
||||
static EIGEN_STRONG_INLINE double run(double x) {
|
||||
#ifdef _BSD_SOURCE || _SVID_SOURCE
|
||||
int signgam;
|
||||
return ::lgammaf_r(x, &signgam);
|
||||
#else
|
||||
return ::lgamma(x);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user