diff options
Diffstat (limited to 'boost/math/special_functions/detail/erf_inv.hpp')
-rw-r--r-- | boost/math/special_functions/detail/erf_inv.hpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/boost/math/special_functions/detail/erf_inv.hpp b/boost/math/special_functions/detail/erf_inv.hpp index f2f625f991..d51db9d52f 100644 --- a/boost/math/special_functions/detail/erf_inv.hpp +++ b/boost/math/special_functions/detail/erf_inv.hpp @@ -322,12 +322,47 @@ T erf_inv_imp(const T& p, const T& q, const Policy& pol, const boost::mpl::int_< return result; } +template <class T, class Policy> +struct erf_inv_initializer +{ + struct init + { + init() + { + do_init(); + } + static void do_init() + { + boost::math::erf_inv(static_cast<T>(0.25), Policy()); + boost::math::erf_inv(static_cast<T>(0.55), Policy()); + boost::math::erf_inv(static_cast<T>(0.95), Policy()); + boost::math::erfc_inv(static_cast<T>(1e-15), Policy()); + if(static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1e-130)) != 0) + boost::math::erfc_inv(static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1e-130)), Policy()); + if(static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1e-800)) != 0) + boost::math::erfc_inv(static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1e-800)), Policy()); + if(static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1e-900)) != 0) + boost::math::erfc_inv(static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1e-900)), Policy()); + } + void force_instantiate()const{} + }; + static const init initializer; + static void force_instantiate() + { + initializer.force_instantiate(); + } +}; + +template <class T, class Policy> +const typename erf_inv_initializer<T, Policy>::init erf_inv_initializer<T, Policy>::initializer; + } // namespace detail template <class T, class Policy> typename tools::promote_args<T>::type erfc_inv(T z, const Policy& pol) { typedef typename tools::promote_args<T>::type result_type; + // // Begin by testing for domain errors, and other special cases: // @@ -378,6 +413,8 @@ typename tools::promote_args<T>::type erfc_inv(T z, const Policy& pol) policies::discrete_quantile<>, policies::assert_undefined<> >::type forwarding_policy; + detail::erf_inv_initializer<eval_type, forwarding_policy>::force_instantiate(); + // // And get the result, negating where required: // @@ -389,6 +426,7 @@ template <class T, class Policy> typename tools::promote_args<T>::type erf_inv(T z, const Policy& pol) { typedef typename tools::promote_args<T>::type result_type; + // // Begin by testing for domain errors, and other special cases: // @@ -445,6 +483,8 @@ typename tools::promote_args<T>::type erf_inv(T z, const Policy& pol) // precision internally if it's appropriate: // typedef typename policies::evaluation<result_type, Policy>::type eval_type; + + detail::erf_inv_initializer<eval_type, forwarding_policy>::force_instantiate(); // // And get the result, negating where required: // |