X-Git-Url: https://git.donarmstrong.com/?p=rsem.git;a=blobdiff_plain;f=boost%2Fmath%2Fspecial_functions%2Fdetail%2Figamma_inverse.hpp;h=42c278473f1100159ccc6a6617f2008650de8979;hp=a7dce6f99b5667f5d1ba1fc789456800191f6425;hb=2d71eb92104693ca9baa5a2e1c23eeca776d8fd3;hpb=da57529b92adbb7ae74a89861cb39fb35ac7c62d diff --git a/boost/math/special_functions/detail/igamma_inverse.hpp b/boost/math/special_functions/detail/igamma_inverse.hpp index a7dce6f..42c2784 100644 --- a/boost/math/special_functions/detail/igamma_inverse.hpp +++ b/boost/math/special_functions/detail/igamma_inverse.hpp @@ -10,7 +10,7 @@ #pragma once #endif -#include +#include #include #include #include @@ -122,7 +122,7 @@ T find_inverse_gamma(T a, T p, T q, const Policy& pol, bool* p_has_10_digits) BOOST_MATH_INSTRUMENT_VARIABLE(b); if((b > 0.6) || ((b >= 0.45) && (a >= 0.3))) { - // DiDonato & Morris Eq 21: + // DiDonato & Morris Eq 21: // // There is a slight variation from DiDonato and Morris here: // the first form given here is unstable when p is close to 1, @@ -275,16 +275,17 @@ T find_inverse_gamma(T a, T p, T q, const Policy& pol, bool* p_has_10_digits) { T z = w; T ap1 = a + 1; + T ap2 = a + 2; if(w < 0.15f * ap1) { // DiDonato and Morris Eq 35: T v = log(p) + boost::math::lgamma(ap1, pol); - T s = 1; z = exp((v + w) / a); - s = boost::math::log1p(z / ap1 * (1 + z / (a + 2))); + s = boost::math::log1p(z / ap1 * (1 + z / ap2)); z = exp((v + z - s) / a); + s = boost::math::log1p(z / ap1 * (1 + z / ap2)); z = exp((v + z - s) / a); - s = boost::math::log1p(z / ap1 * (1 + z / (a + 2) * (1 + z / (a + 3)))); + s = boost::math::log1p(z / ap1 * (1 + z / ap2 * (1 + z / (a + 3)))); z = exp((v + z - s) / a); BOOST_MATH_INSTRUMENT_VARIABLE(z); } @@ -332,7 +333,7 @@ struct gamma_p_inverse_func } } - std::tr1::tuple operator()(const T& x)const + boost::math::tuple operator()(const T& x)const { BOOST_FPU_EXCEPTION_GUARD // @@ -340,7 +341,7 @@ struct gamma_p_inverse_func // flag is set, then Q(x) - q and it's derivatives. // typedef typename policies::evaluation::type value_type; - typedef typename lanczos::lanczos::type evaluation_type; + // typedef typename lanczos::lanczos::type evaluation_type; typedef typename policies::normalise< Policy, policies::promote_float, @@ -377,7 +378,7 @@ struct gamma_p_inverse_func f2 = -f2; } - return std::tr1::make_tuple(f - p, f1, f2); + return boost::math::make_tuple(static_cast(f - p), f1, f2); } private: T a, p; @@ -440,7 +441,7 @@ T gamma_p_inv_imp(T a, T p, const Policy& pol) tools::max_value(), digits, max_iter); - policies::check_root_iterations(function, max_iter, pol); + policies::check_root_iterations(function, max_iter, pol); BOOST_MATH_INSTRUMENT_VARIABLE(guess); if(guess == lower) guess = policies::raise_underflow_error(function, "Expected result known to be non-zero, but is smaller than the smallest available number.", pol); @@ -499,7 +500,7 @@ T gamma_q_inv_imp(T a, T q, const Policy& pol) tools::max_value(), digits, max_iter); - policies::check_root_iterations(function, max_iter, pol); + policies::check_root_iterations(function, max_iter, pol); if(guess == lower) guess = policies::raise_underflow_error(function, "Expected result known to be non-zero, but is smaller than the smallest available number.", pol); return guess;