diff --git a/Eigen/src/Core/SpecialFunctions.h b/Eigen/src/Core/SpecialFunctions.h index c6a50bb1d..38debb4d1 100644 --- a/Eigen/src/Core/SpecialFunctions.h +++ b/Eigen/src/Core/SpecialFunctions.h @@ -98,7 +98,7 @@ struct polevl { } // end namespace cephes /**************************************************************************** - * Implementation of lgamma * + * Implementation of lgamma, requires C++11/C99 * ****************************************************************************/ template @@ -131,7 +131,7 @@ struct lgamma_impl { #endif /**************************************************************************** - * Implementation of digamma (psi) * + * Implementation of digamma (psi), based on Cephes * ****************************************************************************/ template @@ -139,20 +139,6 @@ struct digamma_retval { typedef Scalar type; }; -#ifndef EIGEN_HAS_C99_MATH - -template -struct digamma_impl { - EIGEN_DEVICE_FUNC - static EIGEN_STRONG_INLINE Scalar run(Scalar x) { - EIGEN_STATIC_ASSERT((internal::is_same::value == false), - THIS_TYPE_IS_NOT_SUPPORTED); - return Scalar(0); - } -}; - -#else - /* * * Polynomial evaluation helper for the Psi (digamma) function. @@ -331,10 +317,8 @@ struct digamma_impl { } }; -#endif // EIGEN_HAS_C99_MATH - /**************************************************************************** - * Implementation of erf * + * Implementation of erf, requires C++11/C99 * ****************************************************************************/ template @@ -367,7 +351,7 @@ struct erf_impl { #endif // EIGEN_HAS_C99_MATH /*************************************************************************** -* Implementation of erfc * +* Implementation of erfc, requires C++11/C99 * ****************************************************************************/ template @@ -399,31 +383,16 @@ struct erfc_impl { }; #endif // EIGEN_HAS_C99_MATH -/**************************************************************************** - * Implementation of igammac (complemented incomplete gamma integral) * - ****************************************************************************/ +/************************************************************************************************************** + * Implementation of igammac (complemented incomplete gamma integral), based on Cephes but requires C++11/C99 * + **************************************************************************************************************/ template struct igammac_retval { typedef Scalar type; }; -#ifndef EIGEN_HAS_C99_MATH - -template -struct igammac_impl { - EIGEN_DEVICE_FUNC - static Scalar run(Scalar a, Scalar x) { - EIGEN_STATIC_ASSERT((internal::is_same::value == false), - THIS_TYPE_IS_NOT_SUPPORTED); - return Scalar(0); - } -}; - -#else - -template struct igamma_impl; // predeclare igamma_impl - +// NOTE: igamma_helper is also used to implement zeta template struct igamma_helper { EIGEN_DEVICE_FUNC @@ -457,6 +426,22 @@ struct igamma_helper { } }; +#ifndef EIGEN_HAS_C99_MATH + +template +struct igammac_impl { + EIGEN_DEVICE_FUNC + static Scalar run(Scalar a, Scalar x) { + EIGEN_STATIC_ASSERT((internal::is_same::value == false), + THIS_TYPE_IS_NOT_SUPPORTED); + return Scalar(0); + } +}; + +#else + +template struct igamma_impl; // predeclare igamma_impl + template struct igammac_impl { EIGEN_DEVICE_FUNC @@ -614,9 +599,9 @@ struct igammac_impl { #endif // EIGEN_HAS_C99_MATH -/**************************************************************************** - * Implementation of igamma (incomplete gamma integral) * - ****************************************************************************/ +/************************************************************************************************ + * Implementation of igamma (incomplete gamma integral), based on Cephes but requires C++11/C99 * + ************************************************************************************************/ template struct igamma_retval { @@ -778,20 +763,6 @@ template struct zeta_retval { typedef Scalar type; }; - -#ifndef EIGEN_HAS_C99_MATH - -template -struct zeta_impl { - EIGEN_DEVICE_FUNC - static EIGEN_STRONG_INLINE Scalar run(Scalar x, Scalar q) { - EIGEN_STATIC_ASSERT((internal::is_same::value == false), - THIS_TYPE_IS_NOT_SUPPORTED); - return Scalar(0); - } -}; - -#else template struct zeta_impl_series { @@ -986,11 +957,9 @@ struct zeta_impl { return s; } }; - -#endif // EIGEN_HAS_C99_MATH /**************************************************************************** - * Implementation of polygamma function * + * Implementation of polygamma function, requires C++11/C99 * ****************************************************************************/ template