From 68e04a0bede480769ff9fcf7b3146be1ba9cffbf Mon Sep 17 00:00:00 2001 From: Christopher Kormanyos Date: Fri, 25 Jan 2013 21:51:40 +0000 Subject: [PATCH] Corrected Bessel zeros when used with a multiprecision type having et_on. [SVN r82615] --- .../boost/math/special_functions/bessel.hpp | 4 ++-- .../detail/bessel_jy_zero.hpp | 22 +++++++++---------- .../boost/math/special_functions/math_fwd.hpp | 12 ---------- 3 files changed, 13 insertions(+), 25 deletions(-) diff --git a/include/boost/math/special_functions/bessel.hpp b/include/boost/math/special_functions/bessel.hpp index cb835ad3e..5d1fd921a 100644 --- a/include/boost/math/special_functions/bessel.hpp +++ b/include/boost/math/special_functions/bessel.hpp @@ -376,7 +376,7 @@ inline T cyl_bessel_j_zero_imp(T v, unsigned m, const Policy& pol) // Handle negative order or if the zero'th zero is requested. // Return NaN if NaN is available or return 0 if NaN is not available. - if((v < T(0)) || (m == 0U)) + if((v < 0) || (m == 0U)) return (std::numeric_limits::has_quiet_NaN ? std::numeric_limits::quiet_NaN() : T(0)); // Set up the initial guess for the upcoming root-finding. @@ -419,7 +419,7 @@ inline void cyl_bessel_j_zero_imp(output_iterator out_it, while(out_it != end_it) { - *out_it = boost::math::detail::cyl_bessel_j_zero_imp(v, start_index, pol); + *out_it = boost::math::detail::cyl_bessel_j_zero_imp(v, start_index, pol); ++start_index; ++out_it; } diff --git a/include/boost/math/special_functions/detail/bessel_jy_zero.hpp b/include/boost/math/special_functions/detail/bessel_jy_zero.hpp index 8b32b2616..b86e5ef33 100644 --- a/include/boost/math/special_functions/detail/bessel_jy_zero.hpp +++ b/include/boost/math/special_functions/detail/bessel_jy_zero.hpp @@ -33,7 +33,7 @@ namespace bessel_zero { template - T equation_nist_10_21_19(const T& v, const T& a) + T equation_nist_10_21_19(T v, T a) { // Get the initial estimate of the m'th root of Jv or Yv. // This subroutine is used for the order m with m > 1. @@ -60,9 +60,9 @@ class equation_as_9_3_39_and_its_derivative { public: - equation_as_9_3_39_and_its_derivative(const T& zt) : zeta(zt) { } + equation_as_9_3_39_and_its_derivative(T zt) : zeta(zt) { } - boost::math::tuple operator()(const T& z) const + boost::math::tuple operator()(T z) const { BOOST_MATH_STD_USING // ADL of std names, needed for acos, sqrt. @@ -86,7 +86,7 @@ }; template - static T equation_as_9_5_26(const T& v, const T& ai_bi_root) + static T equation_as_9_5_26(T v, T ai_bi_root) { BOOST_MATH_STD_USING // ADL of std names, needed for pow. @@ -165,7 +165,7 @@ namespace cyl_bessel_j_zero_detail { template - T equation_nist_10_21_40_a(const T& v) + T equation_nist_10_21_40_a(T v) { BOOST_MATH_STD_USING // ADL of std names, needed for pow. @@ -180,7 +180,7 @@ } template - T initial_guess(const T& v, unsigned m) + T initial_guess(T v, unsigned m) { // Compute an estimate of the m'th root of cyl_bessel_j. @@ -241,11 +241,11 @@ class function_object { public: - function_object(const T& v, + function_object(T v, const Policy& pol) : my_v(v), my_pol(pol) { } - boost::math::tuple operator()(const T& x) const + boost::math::tuple operator()(T x) const { // Obtain Jv(x) and Jv'(x). const T j_v (boost::math::detail::cyl_bessel_j_imp( my_v, x, boost::math::detail::bessel_no_int_tag(), my_pol)); @@ -265,7 +265,7 @@ namespace cyl_neumann_zero_detail { template - T equation_nist_10_21_40_b(const T& v) + T equation_nist_10_21_40_b(T v) { BOOST_MATH_STD_USING // ADL of std names, needed for pow. @@ -341,11 +341,11 @@ class function_object { public: - function_object(const T& v, + function_object(T v, const Policy& pol) : my_v(v), my_pol(pol) { } - boost::math::tuple operator()(const T& x) const + boost::math::tuple operator()(T x) const { // Obtain Yv(x) and Yv'(x). const T y_v (boost::math::detail::cyl_neumann_imp( my_v, x, boost::math::detail::bessel_no_int_tag(), my_pol)); diff --git a/include/boost/math/special_functions/math_fwd.hpp b/include/boost/math/special_functions/math_fwd.hpp index ad16cee6b..4bc048912 100644 --- a/include/boost/math/special_functions/math_fwd.hpp +++ b/include/boost/math/special_functions/math_fwd.hpp @@ -623,12 +623,6 @@ namespace boost template std::complex::result_type> cyl_hankel_1(T1 v, T2 x, const Policy& pol); - template - inline void cyl_bessel_j_zero_imp(output_iterator out_it, - T v, - std::size_t number_of_zeros, - unsigned start_index); - template typename detail::bessel_traits::result_type cyl_neuman_zero(T v, unsigned m, const Policy& pol); @@ -638,12 +632,6 @@ namespace boost template std::complex::result_type> cyl_hankel_1(T1 v, T2 x, const Policy& pol); - template - inline void cyl_neuman_zero_imp(output_iterator out_it, - T v, - std::size_t number_of_zeros, - unsigned start_index); - template std::complex >::result_type> cyl_hankel_1(T1 v, T2 x);