diff --git a/include/boost/math/special_functions/beta.hpp b/include/boost/math/special_functions/beta.hpp index d758696e3..27f31b43e 100644 --- a/include/boost/math/special_functions/beta.hpp +++ b/include/boost/math/special_functions/beta.hpp @@ -799,20 +799,22 @@ struct Pn_size BOOST_STATIC_CONSTANT(unsigned, value = 15); // ~8-15 digit accuracy BOOST_STATIC_ASSERT(::boost::math::max_factorial::value >= 30); }; -#ifndef __CUDA_ARCH__ template <> struct Pn_size { BOOST_STATIC_CONSTANT(unsigned, value = 30); // 16-20 digit accuracy +#ifndef __CUDA_ARCH__ BOOST_STATIC_ASSERT(::boost::math::max_factorial::value >= 60); +#endif }; template <> struct Pn_size { BOOST_STATIC_CONSTANT(unsigned, value = 50); // ~35-50 digit accuracy +#ifndef __CUDA_ARCH__ BOOST_STATIC_ASSERT(::boost::math::max_factorial::value >= 100); -}; #endif +}; template BOOST_GPU_ENABLED T beta_small_b_large_a_series(T a, T b, T x, T y, T s0, T mult, const Policy& pol, bool normalised) diff --git a/include/boost/math/special_functions/binomial.hpp b/include/boost/math/special_functions/binomial.hpp index 9a24fc15b..558c9fb89 100644 --- a/include/boost/math/special_functions/binomial.hpp +++ b/include/boost/math/special_functions/binomial.hpp @@ -18,11 +18,11 @@ namespace boost{ namespace math{ template -T binomial_coefficient(unsigned n, unsigned k, const Policy& pol) +BOOST_GPU_ENABLED T binomial_coefficient(unsigned n, unsigned k, const Policy& pol) { BOOST_STATIC_ASSERT(!boost::is_integral::value); BOOST_MATH_STD_USING - static const char* function = "boost::math::binomial_coefficient<%1%>(unsigned, unsigned)"; + BOOST_MATH_GPU_STATIC const char* function = "boost::math::binomial_coefficient<%1%>(unsigned, unsigned)"; if(k > n) return policies::raise_domain_error( function, @@ -61,13 +61,13 @@ T binomial_coefficient(unsigned n, unsigned k, const Policy& pol) // we'll promote to double: // template <> -inline float binomial_coefficient >(unsigned n, unsigned k, const policies::policy<>& pol) +inline BOOST_GPU_ENABLED float binomial_coefficient >(unsigned n, unsigned k, const policies::policy<>& pol) { return policies::checked_narrowing_cast >(binomial_coefficient(n, k, pol), "boost::math::binomial_coefficient<%1%>(unsigned,unsigned)"); } template -inline T binomial_coefficient(unsigned n, unsigned k) +inline BOOST_GPU_ENABLED T binomial_coefficient(unsigned n, unsigned k) { return binomial_coefficient(n, k, policies::policy<>()); } diff --git a/include/boost/math/special_functions/factorials.hpp b/include/boost/math/special_functions/factorials.hpp index e36a098bb..bc5e6b31b 100644 --- a/include/boost/math/special_functions/factorials.hpp +++ b/include/boost/math/special_functions/factorials.hpp @@ -27,7 +27,7 @@ namespace boost { namespace math { template -inline T factorial(unsigned i, const Policy& pol) +inline BOOST_GPU_ENABLED T factorial(unsigned i, const Policy& pol) { BOOST_STATIC_ASSERT(!boost::is_integral::value); // factorial(n) is not implemented @@ -48,7 +48,7 @@ inline T factorial(unsigned i, const Policy& pol) } template -inline T factorial(unsigned i) +inline BOOST_GPU_ENABLED T factorial(unsigned i) { return factorial(i, policies::policy<>()); } @@ -71,7 +71,7 @@ inline double factorial(unsigned i) } */ template -T double_factorial(unsigned i, const Policy& pol) +BOOST_GPU_ENABLED T double_factorial(unsigned i, const Policy& pol) { BOOST_STATIC_ASSERT(!boost::is_integral::value); BOOST_MATH_STD_USING // ADL lookup of std names @@ -106,7 +106,7 @@ T double_factorial(unsigned i, const Policy& pol) } template -inline T double_factorial(unsigned i) +inline BOOST_GPU_ENABLED T double_factorial(unsigned i) { return double_factorial(i, policies::policy<>()); } @@ -114,7 +114,7 @@ inline T double_factorial(unsigned i) namespace detail{ template -T rising_factorial_imp(T x, int n, const Policy& pol) +BOOST_GPU_ENABLED T rising_factorial_imp(T x, int n, const Policy& pol) { BOOST_STATIC_ASSERT(!boost::is_integral::value); if(x < 0) @@ -162,7 +162,7 @@ T rising_factorial_imp(T x, int n, const Policy& pol) } template -inline T falling_factorial_imp(T x, unsigned n, const Policy& pol) +inline BOOST_GPU_ENABLED T falling_factorial_imp(T x, unsigned n, const Policy& pol) { BOOST_STATIC_ASSERT(!boost::is_integral::value); BOOST_MATH_STD_USING // ADL of std names @@ -226,7 +226,7 @@ inline T falling_factorial_imp(T x, unsigned n, const Policy& pol) } // namespace detail template -inline typename tools::promote_args::type +inline BOOST_GPU_ENABLED typename tools::promote_args::type falling_factorial(RT x, unsigned n) { typedef typename tools::promote_args::type result_type; @@ -235,7 +235,7 @@ inline typename tools::promote_args::type } template -inline typename tools::promote_args::type +inline BOOST_GPU_ENABLED typename tools::promote_args::type falling_factorial(RT x, unsigned n, const Policy& pol) { typedef typename tools::promote_args::type result_type; @@ -244,7 +244,7 @@ inline typename tools::promote_args::type } template -inline typename tools::promote_args::type +inline BOOST_GPU_ENABLED typename tools::promote_args::type rising_factorial(RT x, int n) { typedef typename tools::promote_args::type result_type; @@ -253,7 +253,7 @@ inline typename tools::promote_args::type } template -inline typename tools::promote_args::type +inline BOOST_GPU_ENABLED typename tools::promote_args::type rising_factorial(RT x, int n, const Policy& pol) { typedef typename tools::promote_args::type result_type; diff --git a/include/boost/math/special_functions/math_fwd.hpp b/include/boost/math/special_functions/math_fwd.hpp index eb8b31cc2..5dbb7318e 100644 --- a/include/boost/math/special_functions/math_fwd.hpp +++ b/include/boost/math/special_functions/math_fwd.hpp @@ -148,9 +148,9 @@ namespace boost // Binomial: template - T binomial_coefficient(unsigned n, unsigned k, const Policy& pol); + BOOST_GPU_ENABLED T binomial_coefficient(unsigned n, unsigned k, const Policy& pol); template - T binomial_coefficient(unsigned n, unsigned k); + BOOST_GPU_ENABLED T binomial_coefficient(unsigned n, unsigned k); // erf & erfc error functions. template // Error function. @@ -381,27 +381,27 @@ namespace boost template struct max_factorial; template - RT factorial(unsigned int); + BOOST_GPU_ENABLED RT factorial(unsigned int); template - RT factorial(unsigned int, const Policy& pol); + BOOST_GPU_ENABLED RT factorial(unsigned int, const Policy& pol); template BOOST_GPU_ENABLED RT unchecked_factorial(unsigned int BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(RT)); template - RT double_factorial(unsigned i); + BOOST_GPU_ENABLED RT double_factorial(unsigned i); template - RT double_factorial(unsigned i, const Policy& pol); + BOOST_GPU_ENABLED RT double_factorial(unsigned i, const Policy& pol); template - typename tools::promote_args::type falling_factorial(RT x, unsigned n); + BOOST_GPU_ENABLED typename tools::promote_args::type falling_factorial(RT x, unsigned n); template - typename tools::promote_args::type falling_factorial(RT x, unsigned n, const Policy& pol); + BOOST_GPU_ENABLED typename tools::promote_args::type falling_factorial(RT x, unsigned n, const Policy& pol); template - typename tools::promote_args::type rising_factorial(RT x, int n); + BOOST_GPU_ENABLED typename tools::promote_args::type rising_factorial(RT x, int n); template - typename tools::promote_args::type rising_factorial(RT x, int n, const Policy& pol); + BOOST_GPU_ENABLED typename tools::promote_args::type rising_factorial(RT x, int n, const Policy& pol); // Gamma functions. template