mirror of
https://gitlab.com/libeigen/eigen.git
synced 2024-12-21 07:19:46 +08:00
Make EIGEN_HAS_C99_MATH user configurable
This commit is contained in:
parent
48bf5ec216
commit
1395056fc0
@ -116,7 +116,7 @@ struct lgamma_retval {
|
||||
typedef Scalar type;
|
||||
};
|
||||
|
||||
#ifdef EIGEN_HAS_C99_MATH
|
||||
#if EIGEN_HAS_C99_MATH
|
||||
template <>
|
||||
struct lgamma_impl<float> {
|
||||
EIGEN_DEVICE_FUNC
|
||||
@ -336,7 +336,7 @@ struct erf_retval {
|
||||
typedef Scalar type;
|
||||
};
|
||||
|
||||
#ifdef EIGEN_HAS_C99_MATH
|
||||
#if EIGEN_HAS_C99_MATH
|
||||
template <>
|
||||
struct erf_impl<float> {
|
||||
EIGEN_DEVICE_FUNC
|
||||
@ -369,7 +369,7 @@ struct erfc_retval {
|
||||
typedef Scalar type;
|
||||
};
|
||||
|
||||
#ifdef EIGEN_HAS_C99_MATH
|
||||
#if EIGEN_HAS_C99_MATH
|
||||
template <>
|
||||
struct erfc_impl<float> {
|
||||
EIGEN_DEVICE_FUNC
|
||||
@ -426,7 +426,7 @@ struct igamma_helper<double> {
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef EIGEN_HAS_C99_MATH
|
||||
#if !EIGEN_HAS_C99_MATH
|
||||
|
||||
template <typename Scalar>
|
||||
struct igammac_impl {
|
||||
@ -608,7 +608,7 @@ struct igamma_retval {
|
||||
typedef Scalar type;
|
||||
};
|
||||
|
||||
#ifndef EIGEN_HAS_C99_MATH
|
||||
#if !EIGEN_HAS_C99_MATH
|
||||
|
||||
template <typename Scalar>
|
||||
struct igamma_impl {
|
||||
@ -967,7 +967,7 @@ struct polygamma_retval {
|
||||
typedef Scalar type;
|
||||
};
|
||||
|
||||
#ifndef EIGEN_HAS_C99_MATH
|
||||
#if !EIGEN_HAS_C99_MATH
|
||||
|
||||
template <typename Scalar>
|
||||
struct polygamma_impl {
|
||||
|
@ -466,7 +466,7 @@ template <> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half maxi(const Eigen::
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef EIGEN_HAS_C99_MATH
|
||||
#if EIGEN_HAS_C99_MATH
|
||||
template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half lgamma(const Eigen::half& a) {
|
||||
return Eigen::half(Eigen::numext::lgamma(static_cast<float>(a)));
|
||||
}
|
||||
|
@ -360,11 +360,15 @@
|
||||
#endif
|
||||
|
||||
// Does the compiler support C99?
|
||||
#ifndef EIGEN_HAS_C99_MATH
|
||||
#if EIGEN_MAX_CPP_VER>=11 && \
|
||||
((defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901)) \
|
||||
|| (defined(__GNUC__) && defined(_GLIBCXX_USE_C99)) \
|
||||
|| (defined(_LIBCPP_VERSION) && !defined(_MSC_VER)))
|
||||
#define EIGEN_HAS_C99_MATH 1
|
||||
#define EIGEN_HAS_C99_MATH 1
|
||||
#else
|
||||
#define EIGEN_HAS_C99_MATH 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Does the compiler support result_of?
|
||||
|
@ -217,7 +217,7 @@ template<typename ArrayType> void array_real(const ArrayType& m)
|
||||
VERIFY_IS_APPROX(m1.sinh(), sinh(m1));
|
||||
VERIFY_IS_APPROX(m1.cosh(), cosh(m1));
|
||||
VERIFY_IS_APPROX(m1.tanh(), tanh(m1));
|
||||
#ifdef EIGEN_HAS_C99_MATH
|
||||
#if EIGEN_HAS_C99_MATH
|
||||
VERIFY_IS_APPROX(m1.lgamma(), lgamma(m1));
|
||||
VERIFY_IS_APPROX(m1.digamma(), digamma(m1));
|
||||
VERIFY_IS_APPROX(m1.erf(), erf(m1));
|
||||
@ -312,7 +312,7 @@ template<typename ArrayType> void array_real(const ArrayType& m)
|
||||
|
||||
|
||||
|
||||
#ifdef EIGEN_HAS_C99_MATH
|
||||
#if EIGEN_HAS_C99_MATH
|
||||
// check special functions (comparing against numpy implementation)
|
||||
if (!NumTraits<Scalar>::IsComplex)
|
||||
{
|
||||
@ -582,7 +582,7 @@ template<typename ArrayType> void array_special_functions()
|
||||
}
|
||||
|
||||
|
||||
#ifdef EIGEN_HAS_C99_MATH
|
||||
#if EIGEN_HAS_C99_MATH
|
||||
{
|
||||
ArrayType n(11), x(11), res(11), ref(11);
|
||||
n << 1, 1, 1, 1.5, 17, 31, 28, 8, 42, 147, 170;
|
||||
|
@ -367,7 +367,7 @@ template<typename Scalar> void packetmath_real()
|
||||
VERIFY((numext::isnan)(data2[0]));
|
||||
}
|
||||
|
||||
#ifdef EIGEN_HAS_C99_MATH
|
||||
#if EIGEN_HAS_C99_MATH
|
||||
{
|
||||
data1[0] = std::numeric_limits<Scalar>::quiet_NaN();
|
||||
packet_helper<internal::packet_traits<Scalar>::HasLGamma,Packet> h;
|
||||
@ -398,7 +398,7 @@ template<typename Scalar> void packetmath_real()
|
||||
data1[internal::random<int>(0, PacketSize)] = 0;
|
||||
CHECK_CWISE1_IF(PacketTraits::HasSqrt, std::sqrt, internal::psqrt);
|
||||
CHECK_CWISE1_IF(PacketTraits::HasLog, std::log, internal::plog);
|
||||
#if defined(EIGEN_HAS_C99_MATH) && (__cplusplus > 199711L)
|
||||
#if EIGEN_HAS_C99_MATH && (__cplusplus > 199711L)
|
||||
CHECK_CWISE1_IF(internal::packet_traits<Scalar>::HasLGamma, std::lgamma, internal::plgamma);
|
||||
CHECK_CWISE1_IF(internal::packet_traits<Scalar>::HasErf, std::erf, internal::perf);
|
||||
CHECK_CWISE1_IF(internal::packet_traits<Scalar>::HasErfc, std::erfc, internal::perfc);
|
||||
|
Loading…
Reference in New Issue
Block a user