|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r82623 - in trunk: boost/math/special_functions boost/math/special_functions/detail libs/math/test/compile_test
From: john_at_[hidden]
Date: 2013-01-26 07:58:57
Author: johnmaddock
Date: 2013-01-26 07:58:55 EST (Sat, 26 Jan 2013)
New Revision: 82623
URL: http://svn.boost.org/trac/boost/changeset/82623
Log:
Fix output iterator usage to meet conceptual requirements.
Remove use of long long constants and change to double as mpfr_class has no conversion from long long :(
Fix typos in math_fwd.hpp.
Add new functions to concept tests.
Text files modified:
trunk/boost/math/special_functions/bessel.hpp | 28 +++++++------------------
trunk/boost/math/special_functions/detail/airy_ai_bi_zero.hpp | 4 +-
trunk/boost/math/special_functions/math_fwd.hpp | 43 ++++++++++++++++++++++++++++++++++++---
trunk/libs/math/test/compile_test/instantiate.hpp | 15 +++++++++++++
4 files changed, 64 insertions(+), 26 deletions(-)
Modified: trunk/boost/math/special_functions/bessel.hpp
==============================================================================
--- trunk/boost/math/special_functions/bessel.hpp (original)
+++ trunk/boost/math/special_functions/bessel.hpp 2013-01-26 07:58:55 EST (Sat, 26 Jan 2013)
@@ -413,16 +413,10 @@
unsigned start_index,
const Policy& pol)
{
- if(number_of_zeros > 0U)
+ for(unsigned i = 0; i < number_of_zeros; ++i)
{
- const output_iterator end_it(out_it + number_of_zeros);
-
- while(out_it != end_it)
- {
- *out_it = boost::math::detail::cyl_bessel_j_zero_imp<T, Policy>(v, start_index, pol);
- ++start_index;
- ++out_it;
- }
+ *out_it = boost::math::detail::cyl_bessel_j_zero_imp<T, Policy>(v, start_index + i, pol);
+ ++out_it;
}
}
@@ -470,16 +464,10 @@
unsigned start_index,
const Policy& pol)
{
- if(number_of_zeros > 0U)
+ for(unsigned i = 0; i < number_of_zeros; ++i)
{
- const output_iterator end_it(out_it + number_of_zeros);
-
- while(out_it != end_it)
- {
- *out_it = boost::math::detail::cyl_neumann_zero_imp<T, Policy>(v, start_index, pol);
- ++start_index;
- ++out_it;
- }
+ *out_it = boost::math::detail::cyl_neumann_zero_imp<T, Policy>(v, start_index + i, pol);
+ ++out_it;
}
}
@@ -592,7 +580,7 @@
inline typename detail::bessel_traits<T, T, policies::policy<> >::result_type cyl_bessel_j_zero(T v, unsigned m)
{
BOOST_STATIC_ASSERT_MSG(false == std::numeric_limits<T>::is_integer, "Order must be a floating-point type.");
- return cyl_bessel_j_zero_imp<T, policies::policy<> >(v, m, policies::policy<>());
+ return cyl_bessel_j_zero<T, policies::policy<> >(v, m, policies::policy<>());
}
template <class output_iterator, class T, class Policy>
@@ -636,7 +624,7 @@
inline typename detail::bessel_traits<T, T, policies::policy<> >::result_type cyl_neumann_zero(T v, unsigned m)
{
BOOST_STATIC_ASSERT_MSG(false == std::numeric_limits<T>::is_integer, "Order must be a floating-point type.");
- return cyl_neumann_zero_imp<T, policies::policy<> >(v, m, policies::policy<>());
+ return cyl_neumann_zero<T, policies::policy<> >(v, m, policies::policy<>());
}
template <class output_iterator, class T, class Policy>
Modified: trunk/boost/math/special_functions/detail/airy_ai_bi_zero.hpp
==============================================================================
--- trunk/boost/math/special_functions/detail/airy_ai_bi_zero.hpp (original)
+++ trunk/boost/math/special_functions/detail/airy_ai_bi_zero.hpp 2013-01-26 07:58:55 EST (Sat, 26 Jan 2013)
@@ -29,8 +29,8 @@
const T z_pow_two_thirds(pow(z, T(2) / 3U));
// Implement the top line of Eq. 10.4.105.
- const T fz(z_pow_two_thirds * ((((( + (T(162375596875ULL) / 334430208UL)
- * one_over_z_squared - ( T(108056875ULL) / 6967296UL))
+ const T fz(z_pow_two_thirds * ((((( + (T(162375596875.0) / 334430208UL)
+ * one_over_z_squared - ( T(108056875.0) / 6967296UL))
* one_over_z_squared + ( T(77125UL) / 82944UL))
* one_over_z_squared - ( T(5U) / 36U))
* one_over_z_squared + ( T(5U) / 48U))
Modified: trunk/boost/math/special_functions/math_fwd.hpp
==============================================================================
--- trunk/boost/math/special_functions/math_fwd.hpp (original)
+++ trunk/boost/math/special_functions/math_fwd.hpp 2013-01-26 07:58:55 EST (Sat, 26 Jan 2013)
@@ -620,8 +620,17 @@
template <class T>
typename detail::bessel_traits<T, T, policies::policy<> >::result_type cyl_bessel_j_zero(T v, unsigned m);
- template <class T1, class T2, class Policy>
- std::complex<typename detail::bessel_traits<T1, T2, Policy>::result_type> cyl_hankel_1(T1 v, T2 x, const Policy& pol);
+ template <class output_iterator, class T>
+ void cyl_bessel_j_zero(output_iterator out_it,
+ T v,
+ std::size_t number_of_zeros,
+ unsigned start_index);
+
+ template <class output_iterator, class T, class Policy>
+ void cyl_bessel_j_zero(output_iterator out_it,
+ T v,
+ std::size_t number_of_zeros,
+ unsigned start_index, const Policy&);
template <class T, class Policy>
typename detail::bessel_traits<T, T, Policy>::result_type cyl_neuman_zero(T v, unsigned m, const Policy& pol);
@@ -629,13 +638,25 @@
template <class T>
typename detail::bessel_traits<T, T, policies::policy<> >::result_type cyl_neuman_zero(T v, unsigned m);
- template <class T1, class T2, class Policy>
- std::complex<typename detail::bessel_traits<T1, T2, Policy>::result_type> cyl_hankel_1(T1 v, T2 x, const Policy& pol);
+ template <class output_iterator, class T>
+ inline void cyl_neuman_zero(output_iterator out_it,
+ T v,
+ std::size_t number_of_zeros,
+ unsigned start_index);
+
+ template <class output_iterator, class T, class Policy>
+ inline void cyl_neuman_zero(output_iterator out_it,
+ T v,
+ std::size_t number_of_zeros,
+ unsigned start_index, const Policy&);
template <class T1, class T2>
std::complex<typename detail::bessel_traits<T1, T2, policies::policy<> >::result_type> cyl_hankel_1(T1 v, T2 x);
template <class T1, class T2, class Policy>
+ std::complex<typename detail::bessel_traits<T1, T2, Policy>::result_type> cyl_hankel_1(T1 v, T2 x, const Policy& pol);
+
+ template <class T1, class T2, class Policy>
std::complex<typename detail::bessel_traits<T1, T2, Policy>::result_type> cyl_hankel_2(T1 v, T2 x, const Policy& pol);
template <class T1, class T2>
@@ -1157,10 +1178,24 @@
inline typename boost::math::detail::bessel_traits<T, T, Policy >::result_type cyl_bessel_j_zero(T v, unsigned m)\
{ return boost::math::cyl_bessel_j_zero(v, m, Policy()); }\
\
+template <class output_iterator, class T>\
+ inline void cyl_bessel_j_zero(output_iterator out_it,\
+ T v,\
+ std::size_t number_of_zeros,\
+ unsigned start_index)\
+ { boost::math::cyl_bessel_j_zero(out_it, v, number_of_zeros, start_index, Policy()); }\
+\
template <class T>\
inline typename boost::math::detail::bessel_traits<T, T, Policy >::result_type cyl_neumann_zero(T v, unsigned m)\
{ return boost::math::cyl_neumann_zero(v, m, Policy()); }\
\
+template <class output_iterator, class T>\
+ inline void cyl_neumann_zero(output_iterator out_it,\
+ T v,\
+ std::size_t number_of_zeros,\
+ unsigned start_index)\
+ { boost::math::cyl_neumann_zero(out_it, v, number_of_zeros, start_index, Policy()); }\
+\
template <class T>\
inline typename boost::math::tools::promote_args<T>::type sin_pi(T x){ return boost::math::sin_pi(x); }\
\
Modified: trunk/libs/math/test/compile_test/instantiate.hpp
==============================================================================
--- trunk/libs/math/test/compile_test/instantiate.hpp (original)
+++ trunk/libs/math/test/compile_test/instantiate.hpp 2013-01-26 07:58:55 EST (Sat, 26 Jan 2013)
@@ -15,6 +15,7 @@
#include <boost/math/special_functions.hpp>
#include <boost/math/concepts/distributions.hpp>
+#include <boost/concept_archetype.hpp>
#ifndef BOOST_MATH_INSTANTIATE_MINIMUM
@@ -138,6 +139,8 @@
#endif
int i;
RealType v1(0.5), v2(0.5), v3(0.5);
+ boost::detail::dummy_constructor dc;
+ boost::output_iterator_archetype<RealType> oi(dc);
boost::math::tgamma(v1);
boost::math::tgamma1pm1(v1);
boost::math::lgamma(v1);
@@ -247,6 +250,10 @@
boost::math::sph_bessel(i, 1);
boost::math::sph_neumann(i, v2);
boost::math::sph_neumann(i, i);
+ boost::math::cyl_bessel_j_zero(v1, i);
+ boost::math::cyl_bessel_j_zero(oi, v1, i, i);
+ boost::math::cyl_neumann_zero(v1, i);
+ boost::math::cyl_neumann_zero(oi, v1, i, i);
#ifdef TEST_COMPLEX
boost::math::cyl_hankel_1(v1, v2);
boost::math::cyl_hankel_1(i, v2);
@@ -393,6 +400,10 @@
boost::math::sph_bessel(i, 1, pol);
boost::math::sph_neumann(i, v2, pol);
boost::math::sph_neumann(i, i, pol);
+ boost::math::cyl_bessel_j_zero(v1, i, pol);
+ boost::math::cyl_bessel_j_zero(oi, v1, i, i, pol);
+ boost::math::cyl_neumann_zero(v1, i, pol);
+ boost::math::cyl_neumann_zero(oi, v1, i, i, pol);
#ifdef TEST_COMPLEX
boost::math::cyl_hankel_1(v1, v2, pol);
boost::math::cyl_hankel_1(i, v2, pol);
@@ -550,6 +561,10 @@
test::sph_bessel(i, 1);
test::sph_neumann(i, v2);
test::sph_neumann(i, i);
+ test::cyl_bessel_j_zero(v1, i);
+ test::cyl_bessel_j_zero(oi, v1, i, i);
+ test::cyl_neumann_zero(v1, i);
+ test::cyl_neumann_zero(oi, v1, i, i);
#ifdef TEST_COMPLEX
test::cyl_hankel_1(v1, v2);
test::cyl_hankel_1(i, v2);
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk