1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- #ifndef _BOOST_POLYGAMMA_2013_07_30_HPP_
- #define _BOOST_POLYGAMMA_2013_07_30_HPP_
- #include <boost/math/special_functions/factorials.hpp>
- #include <boost/math/special_functions/detail/polygamma.hpp>
- #include <boost/math/special_functions/trigamma.hpp>
- namespace boost { namespace math {
-
- template<class T, class Policy>
- inline typename tools::promote_args<T>::type polygamma(const int n, T x, const Policy& pol)
- {
-
-
-
- if(n == 0)
- return boost::math::digamma(x, pol);
- if(n == 1)
- return boost::math::trigamma(x, pol);
-
-
-
-
-
- BOOST_FPU_EXCEPTION_GUARD
-
-
-
-
- typedef typename tools::promote_args<T>::type result_type;
-
-
-
-
- typedef typename policies::evaluation<result_type, Policy>::type value_type;
-
-
-
-
-
-
-
-
-
-
- typedef typename policies::normalise<
- Policy,
- policies::promote_float<false>,
- policies::promote_double<false>,
- policies::discrete_quantile<>,
- policies::assert_undefined<> >::type forwarding_policy;
-
-
-
-
-
-
- return policies::checked_narrowing_cast<result_type, forwarding_policy>(
- detail::polygamma_imp(n, static_cast<value_type>(x), forwarding_policy()),
- "boost::math::polygamma<%1%>(int, %1%)");
- }
- template<class T>
- inline typename tools::promote_args<T>::type polygamma(const int n, T x)
- {
- return boost::math::polygamma(n, x, policies::policy<>());
- }
- } }
- #endif
|