File indexing completed on 2025-01-18 09:40:14
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_MATH_HYPERGEOMETRIC_1F0_HPP
0012 #define BOOST_MATH_HYPERGEOMETRIC_1F0_HPP
0013
0014 #include <boost/math/policies/policy.hpp>
0015 #include <boost/math/policies/error_handling.hpp>
0016 #include <boost/math/tools/promotion.hpp>
0017
0018
0019 namespace boost { namespace math { namespace detail {
0020
0021 template <class T, class Policy>
0022 inline T hypergeometric_1F0_imp(const T& a, const T& z, const Policy& pol)
0023 {
0024 static const char* function = "boost::math::hypergeometric_1F0<%1%,%1%>(%1%, %1%)";
0025 BOOST_MATH_STD_USING
0026
0027 if (z == 1)
0028 return policies::raise_pole_error<T>(
0029 function,
0030 "Evaluation of 1F0 with z = %1%.",
0031 z,
0032 pol);
0033 if (1 - z < 0)
0034 {
0035 if (floor(a) != a)
0036 return policies::raise_domain_error<T>(function,
0037 "Result is complex when a is non-integral and z > 1, but got z = %1%", z, pol);
0038 }
0039
0040 return pow(T(1 - z), T(-a));
0041 }
0042
0043 }
0044
0045 template <class T1, class T2, class Policy>
0046 inline typename tools::promote_args<T1, T2>::type hypergeometric_1F0(T1 a, T2 z, const Policy&)
0047 {
0048 BOOST_FPU_EXCEPTION_GUARD
0049 typedef typename tools::promote_args<T1, T2>::type result_type;
0050 typedef typename policies::evaluation<result_type, Policy>::type value_type;
0051 typedef typename policies::normalise<
0052 Policy,
0053 policies::promote_float<false>,
0054 policies::promote_double<false>,
0055 policies::discrete_quantile<>,
0056 policies::assert_undefined<> >::type forwarding_policy;
0057 return policies::checked_narrowing_cast<result_type, Policy>(
0058 detail::hypergeometric_1F0_imp<value_type>(
0059 static_cast<value_type>(a),
0060 static_cast<value_type>(z),
0061 forwarding_policy()),
0062 "boost::math::hypergeometric_1F0<%1%>(%1%,%1%)");
0063 }
0064
0065 template <class T1, class T2>
0066 inline typename tools::promote_args<T1, T2>::type hypergeometric_1F0(T1 a, T2 z)
0067 {
0068 return hypergeometric_1F0(a, z, policies::policy<>());
0069 }
0070
0071
0072 } }
0073
0074 #endif