2
0
mirror of https://github.com/boostorg/math.git synced 2026-01-30 08:02:11 +00:00

Mark up a few more functions.

This commit is contained in:
jzmaddock
2016-01-23 18:17:01 +00:00
parent c043cabcb0
commit 6fd5d42db2
4 changed files with 28 additions and 26 deletions

View File

@@ -799,20 +799,22 @@ struct Pn_size<float>
BOOST_STATIC_CONSTANT(unsigned, value = 15); // ~8-15 digit accuracy
BOOST_STATIC_ASSERT(::boost::math::max_factorial<float>::value >= 30);
};
#ifndef __CUDA_ARCH__
template <>
struct Pn_size<double>
{
BOOST_STATIC_CONSTANT(unsigned, value = 30); // 16-20 digit accuracy
#ifndef __CUDA_ARCH__
BOOST_STATIC_ASSERT(::boost::math::max_factorial<double>::value >= 60);
#endif
};
template <>
struct Pn_size<long double>
{
BOOST_STATIC_CONSTANT(unsigned, value = 50); // ~35-50 digit accuracy
#ifndef __CUDA_ARCH__
BOOST_STATIC_ASSERT(::boost::math::max_factorial<long double>::value >= 100);
};
#endif
};
template <class T, class Policy>
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)

View File

@@ -18,11 +18,11 @@
namespace boost{ namespace math{
template <class T, class Policy>
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<T>::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<T>(
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<float, policies::policy<> >(unsigned n, unsigned k, const policies::policy<>& pol)
inline BOOST_GPU_ENABLED float binomial_coefficient<float, policies::policy<> >(unsigned n, unsigned k, const policies::policy<>& pol)
{
return policies::checked_narrowing_cast<float, policies::policy<> >(binomial_coefficient<double>(n, k, pol), "boost::math::binomial_coefficient<%1%>(unsigned,unsigned)");
}
template <class T>
inline T binomial_coefficient(unsigned n, unsigned k)
inline BOOST_GPU_ENABLED T binomial_coefficient(unsigned n, unsigned k)
{
return binomial_coefficient<T>(n, k, policies::policy<>());
}

View File

@@ -27,7 +27,7 @@ namespace boost { namespace math
{
template <class T, class Policy>
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<T>::value);
// factorial<unsigned int>(n) is not implemented
@@ -48,7 +48,7 @@ inline T factorial(unsigned i, const Policy& pol)
}
template <class T>
inline T factorial(unsigned i)
inline BOOST_GPU_ENABLED T factorial(unsigned i)
{
return factorial<T>(i, policies::policy<>());
}
@@ -71,7 +71,7 @@ inline double factorial<double>(unsigned i)
}
*/
template <class T, class Policy>
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<T>::value);
BOOST_MATH_STD_USING // ADL lookup of std names
@@ -106,7 +106,7 @@ T double_factorial(unsigned i, const Policy& pol)
}
template <class T>
inline T double_factorial(unsigned i)
inline BOOST_GPU_ENABLED T double_factorial(unsigned i)
{
return double_factorial<T>(i, policies::policy<>());
}
@@ -114,7 +114,7 @@ inline T double_factorial(unsigned i)
namespace detail{
template <class T, class Policy>
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<T>::value);
if(x < 0)
@@ -162,7 +162,7 @@ T rising_factorial_imp(T x, int n, const Policy& pol)
}
template <class T, class Policy>
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<T>::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 <class RT>
inline typename tools::promote_args<RT>::type
inline BOOST_GPU_ENABLED typename tools::promote_args<RT>::type
falling_factorial(RT x, unsigned n)
{
typedef typename tools::promote_args<RT>::type result_type;
@@ -235,7 +235,7 @@ inline typename tools::promote_args<RT>::type
}
template <class RT, class Policy>
inline typename tools::promote_args<RT>::type
inline BOOST_GPU_ENABLED typename tools::promote_args<RT>::type
falling_factorial(RT x, unsigned n, const Policy& pol)
{
typedef typename tools::promote_args<RT>::type result_type;
@@ -244,7 +244,7 @@ inline typename tools::promote_args<RT>::type
}
template <class RT>
inline typename tools::promote_args<RT>::type
inline BOOST_GPU_ENABLED typename tools::promote_args<RT>::type
rising_factorial(RT x, int n)
{
typedef typename tools::promote_args<RT>::type result_type;
@@ -253,7 +253,7 @@ inline typename tools::promote_args<RT>::type
}
template <class RT, class Policy>
inline typename tools::promote_args<RT>::type
inline BOOST_GPU_ENABLED typename tools::promote_args<RT>::type
rising_factorial(RT x, int n, const Policy& pol)
{
typedef typename tools::promote_args<RT>::type result_type;

View File

@@ -148,9 +148,9 @@ namespace boost
// Binomial:
template <class T, class Policy>
T binomial_coefficient(unsigned n, unsigned k, const Policy& pol);
BOOST_GPU_ENABLED T binomial_coefficient(unsigned n, unsigned k, const Policy& pol);
template <class T>
T binomial_coefficient(unsigned n, unsigned k);
BOOST_GPU_ENABLED T binomial_coefficient(unsigned n, unsigned k);
// erf & erfc error functions.
template <class RT> // Error function.
@@ -381,27 +381,27 @@ namespace boost
template <class RT>
struct max_factorial;
template <class RT>
RT factorial(unsigned int);
BOOST_GPU_ENABLED RT factorial(unsigned int);
template <class RT, class Policy>
RT factorial(unsigned int, const Policy& pol);
BOOST_GPU_ENABLED RT factorial(unsigned int, const Policy& pol);
template <class RT>
BOOST_GPU_ENABLED RT unchecked_factorial(unsigned int BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(RT));
template <class RT>
RT double_factorial(unsigned i);
BOOST_GPU_ENABLED RT double_factorial(unsigned i);
template <class RT, class Policy>
RT double_factorial(unsigned i, const Policy& pol);
BOOST_GPU_ENABLED RT double_factorial(unsigned i, const Policy& pol);
template <class RT>
typename tools::promote_args<RT>::type falling_factorial(RT x, unsigned n);
BOOST_GPU_ENABLED typename tools::promote_args<RT>::type falling_factorial(RT x, unsigned n);
template <class RT, class Policy>
typename tools::promote_args<RT>::type falling_factorial(RT x, unsigned n, const Policy& pol);
BOOST_GPU_ENABLED typename tools::promote_args<RT>::type falling_factorial(RT x, unsigned n, const Policy& pol);
template <class RT>
typename tools::promote_args<RT>::type rising_factorial(RT x, int n);
BOOST_GPU_ENABLED typename tools::promote_args<RT>::type rising_factorial(RT x, int n);
template <class RT, class Policy>
typename tools::promote_args<RT>::type rising_factorial(RT x, int n, const Policy& pol);
BOOST_GPU_ENABLED typename tools::promote_args<RT>::type rising_factorial(RT x, int n, const Policy& pol);
// Gamma functions.
template <class RT>