2
0
mirror of https://github.com/boostorg/math.git synced 2026-01-19 04:22:09 +00:00

lgamma_q: Tweak expected error rates.

Hook up concept checks.
Hook up include test.
Add forward declarations.
This commit is contained in:
jzmaddock
2026-01-07 12:39:34 +00:00
parent da1a7e4031
commit a3bae10684
4 changed files with 24 additions and 1 deletions

View File

@@ -561,6 +561,12 @@ namespace boost
template <class RT1, class RT2, class Policy>
BOOST_MATH_GPU_ENABLED tools::promote_args_t<RT1, RT2> gamma_q(RT1 a, RT2 z, const Policy&);
template <class RT1, class RT2>
BOOST_MATH_GPU_ENABLED tools::promote_args_t<RT1, RT2> lgamma_q(RT1 a, RT2 z);
template <class RT1, class RT2, class Policy>
BOOST_MATH_GPU_ENABLED tools::promote_args_t<RT1, RT2> lgamma_q(RT1 a, RT2 z, const Policy&);
template <class RT1, class RT2>
BOOST_MATH_GPU_ENABLED tools::promote_args_t<RT1, RT2> gamma_p(RT1 a, RT2 z);
@@ -1516,6 +1522,9 @@ namespace boost
\
template <class RT1, class RT2>\
BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t<RT1, RT2> gamma_q(RT1 a, RT2 z){ return boost::math::gamma_q(a, z, Policy()); }\
\
template <class RT1, class RT2>\
BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t<RT1, RT2> lgamma_q(RT1 a, RT2 z){ return boost::math::lgamma_q(a, z, Policy()); }\
\
template <class RT1, class RT2>\
BOOST_MATH_GPU_ENABLED inline boost::math::tools::promote_args_t<RT1, RT2> gamma_p(RT1 a, RT2 z){ return boost::math::gamma_p(a, z, Policy()); }\

View File

@@ -263,6 +263,7 @@ void instantiate(RealType)
boost::math::tgamma_lower(v1, v2);
boost::math::gamma_p(v1, v2);
boost::math::gamma_q(v1, v2);
boost::math::lgamma_q(v1, v2);
boost::math::gamma_p_inv(v1, v2);
boost::math::gamma_q_inv(v1, v2);
boost::math::gamma_p_inva(v1, v2);
@@ -542,6 +543,7 @@ void instantiate(RealType)
boost::math::tgamma_lower(v1 * 1, v2 - 0);
boost::math::gamma_p(v1 * 1, v2 + 0);
boost::math::gamma_q(v1 * 1, v2 + 0);
boost::math::lgamma_q(v1 * 1, v2 + 0);
boost::math::gamma_p_inv(v1 * 1, v2 + 0);
boost::math::gamma_q_inv(v1 * 1, v2 + 0);
boost::math::gamma_p_inva(v1 * 1, v2 + 0);
@@ -793,6 +795,7 @@ void instantiate(RealType)
boost::math::tgamma_lower(v1, v2, pol);
boost::math::gamma_p(v1, v2, pol);
boost::math::gamma_q(v1, v2, pol);
boost::math::lgamma_q(v1, v2, pol);
boost::math::gamma_p_inv(v1, v2, pol);
boost::math::gamma_q_inv(v1, v2, pol);
boost::math::gamma_p_inva(v1, v2, pol);
@@ -1070,6 +1073,7 @@ void instantiate(RealType)
test::tgamma_lower(v1, v2);
test::gamma_p(v1, v2);
test::gamma_q(v1, v2);
test::lgamma_q(v1, v2);
test::gamma_p_inv(v1, v2);
test::gamma_q_inv(v1, v2);
test::gamma_p_inva(v1, v2);
@@ -1351,6 +1355,7 @@ void instantiate_mixed(RealType)
boost::math::gamma_p(i, s);
boost::math::gamma_p(fr, lr);
boost::math::gamma_q(i, s);
boost::math::lgamma_q(i, s);
boost::math::gamma_q(fr, lr);
boost::math::gamma_p_inv(i, fr);
boost::math::gamma_q_inv(s, fr);
@@ -1566,6 +1571,7 @@ void instantiate_mixed(RealType)
boost::math::gamma_p(i, s, pol);
boost::math::gamma_p(fr, lr, pol);
boost::math::gamma_q(i, s, pol);
boost::math::lgamma_q(i, s, pol);
boost::math::gamma_q(fr, lr, pol);
boost::math::gamma_p_inv(i, fr, pol);
boost::math::gamma_q_inv(s, fr, pol);
@@ -1777,7 +1783,9 @@ void instantiate_mixed(RealType)
test::gamma_p(i, s);
test::gamma_p(fr, lr);
test::gamma_q(i, s);
test::lgamma_q(i, s);
test::gamma_q(fr, lr);
test::lgamma_q(fr, lr);
test::gamma_p_inv(i, fr);
test::gamma_q_inv(s, fr);
test::gamma_p_inva(i, lr);

View File

@@ -39,6 +39,12 @@ void compile_and_link_test()
check_result<long double>(boost::math::gamma_q<long double>(l, l));
#endif
check_result<float>(boost::math::lgamma_q<float>(f, f));
check_result<double>(boost::math::lgamma_q<double>(d, d));
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
check_result<long double>(boost::math::lgamma_q<long double>(l, l));
#endif
check_result<float>(boost::math::gamma_p_inv<float>(f, f));
check_result<double>(boost::math::gamma_p_inv<double>(d, d));
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS

View File

@@ -280,7 +280,7 @@ void test_spots(T, const char* name = nullptr)
BOOST_CHECK_CLOSE(::boost::math::lgamma_q(static_cast<T>(800), static_cast<T>(1000.25)), static_cast<T>(-24.43514173634027477093666725985191846106997808357863808910970142L), tolerance * (boost::math::tools::digits<T>() > 54 ? 20 : 1));
// Once we get large a,x then error start to accumulate no matter what we do:
BOOST_CHECK_CLOSE(::boost::math::lgamma_q(static_cast<T>(1200), static_cast<T>(1249.75)), static_cast<T>(-2.565496161584661216769813239648606145255794643472303927896044375L), tolerance * (std::is_floating_point<T>::value ? 1 : 4));
BOOST_CHECK_CLOSE(::boost::math::lgamma_q(static_cast<T>(1200), static_cast<T>(1250.25)), static_cast<T>(-2.591934862117586205519309712218581885256650074210410262843591453L), tolerance * ((std::numeric_limits<T>::max_digits10 >= 36) ? 500 : (std::is_same<T, float>::value ? 1 : 50)));
BOOST_CHECK_CLOSE(::boost::math::lgamma_q(static_cast<T>(1200), static_cast<T>(1250.25)), static_cast<T>(-2.591934862117586205519309712218581885256650074210410262843591453L), tolerance * ((std::numeric_limits<T>::max_digits10 >= 36) ? 750 : (std::is_same<T, float>::value ? 1 : 50)));
BOOST_CHECK_CLOSE(::boost::math::lgamma_q(static_cast<T>(2200), static_cast<T>(2249.75)), static_cast<T>(-1.933779894897391651410597618307863427927461116308937004149240320L), tolerance * (std::is_floating_point<T>::value ? 1 : 10));
BOOST_CHECK_CLOSE(::boost::math::lgamma_q(static_cast<T>(2200), static_cast<T>(2250.25)), static_cast<T>(-1.950346484067948344620463026377077515919992808640737320057812268L), tolerance * (std::is_same<T, float>::value ? 1 : (std::is_floating_point<T>::value ? 100 : 200)));
//