diff --git a/include/boost/math/quadrature/detail/quadrature_constant.hpp b/include/boost/math/quadrature/detail/quadrature_constant.hpp new file mode 100644 index 0000000000..ea09288a9d --- /dev/null +++ b/include/boost/math/quadrature/detail/quadrature_constant.hpp @@ -0,0 +1,61 @@ +// Copyright John Maddock 2015. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + +#ifndef BOOST_MATH_QUADRATURE_DETAIL_QUADRATURE_CONSTANT_HPP +#define BOOST_MATH_QUADRATURE_DETAIL_QUADRATURE_CONSTANT_HPP + +#ifndef BOOST_MATH_BUILD_MODULE +#include +#include +#endif + +BOOST_MATH_NAMESPACE_BEGIN namespace quadrature{ namespace detail { + +template +struct quadrature_constant_category +{ + static const unsigned value = + (std::numeric_limits::is_specialized == 0) ? 999 : + (std::numeric_limits::radix == 2) ? + ( +#ifdef BOOST_HAS_FLOAT128 + (std::numeric_limits::digits <= 113) && std::is_constructible::value ? 0 : +#else + (std::numeric_limits::digits <= std::numeric_limits::digits) && std::is_constructible::value ? 0 : +#endif + (std::numeric_limits::digits10 <= 110) && std::is_constructible::value ? 4 : 999 + ) : (std::numeric_limits::digits10 <= 110) && std::is_constructible::value ? 4 : 999; + + using storage_type = + std::conditional_t<(std::numeric_limits::is_specialized == 0), T, + std::conditional_t<(std::numeric_limits::radix == 2), + std::conditional_t< ((std::numeric_limits::digits <= std::numeric_limits::digits) && std::is_constructible::value), + float, + std::conditional_t<((std::numeric_limits::digits <= std::numeric_limits::digits) && std::is_constructible::value), + double, + std::conditional_t<((std::numeric_limits::digits <= std::numeric_limits::digits) && std::is_constructible::value), + long double, +#ifdef BOOST_HAS_FLOAT128 + std::conditional_t<((std::numeric_limits::digits <= 113) && std::is_constructible::value), + __float128, + T + > + > +#else + T + > +#endif + > + >, T + > + >; +}; + +} // namespace detail +} // namespace quadrature +BOOST_MATH_NAMESPACE_END + +#endif // BOOST_MATH_QUADRATURE_DETAIL_QUADRATURE_CONSTANT_HPP \ No newline at end of file diff --git a/include/boost/math/quadrature/gauss.hpp b/include/boost/math/quadrature/gauss.hpp index 80d800c870..6d12cfdc75 100644 --- a/include/boost/math/quadrature/gauss.hpp +++ b/include/boost/math/quadrature/gauss.hpp @@ -16,53 +16,14 @@ #endif #include #include +#include #ifdef _MSC_VER #pragma warning(push) #pragma warning(disable:4127) #endif -BOOST_MATH_NAMESPACE_BEGIN namespace quadrature{ namespace detail{ - -template -struct gauss_constant_category -{ - static const unsigned value = - (std::numeric_limits::is_specialized == 0) ? 999 : - (std::numeric_limits::radix == 2) ? - ( -#ifdef BOOST_HAS_FLOAT128 - (std::numeric_limits::digits <= 113) && std::is_constructible::value ? 0 : -#else - (std::numeric_limits::digits <= std::numeric_limits::digits) && std::is_constructible::value ? 0 : -#endif - (std::numeric_limits::digits10 <= 110) && std::is_constructible::value ? 4 : 999 - ) : (std::numeric_limits::digits10 <= 110) && std::is_constructible::value ? 4 : 999; - - using storage_type = - std::conditional_t<(std::numeric_limits::is_specialized == 0), T, - std::conditional_t<(std::numeric_limits::radix == 2), - std::conditional_t< ((std::numeric_limits::digits <= std::numeric_limits::digits) && std::is_constructible::value), - float, - std::conditional_t<((std::numeric_limits::digits <= std::numeric_limits::digits) && std::is_constructible::value), - double, - std::conditional_t<((std::numeric_limits::digits <= std::numeric_limits::digits) && std::is_constructible::value), - long double, -#ifdef BOOST_HAS_FLOAT128 - std::conditional_t<((std::numeric_limits::digits <= 113) && std::is_constructible::value), - __float128, - T - > - > -#else - T - > -#endif - > - >, T - > - >; -}; +BOOST_MATH_NAMESPACE_BEGIN namespace quadrature{ namespace detail { #ifndef BOOST_MATH_GAUSS_NO_COMPUTE_ON_DEMAND @@ -103,7 +64,7 @@ class gauss_detail; template class gauss_detail { - using storage_type = typename gauss_constant_category::storage_type; + using storage_type = typename quadrature_constant_category::storage_type; public: static std::array const & abscissa() { @@ -130,7 +91,7 @@ class gauss_detail template class gauss_detail { - using storage_type = typename gauss_constant_category::storage_type; + using storage_type = typename quadrature_constant_category::storage_type; public: static std::array const & abscissa() { @@ -183,7 +144,7 @@ class gauss_detail template class gauss_detail { - using storage_type = typename gauss_constant_category::storage_type; + using storage_type = typename quadrature_constant_category::storage_type; public: static std::array const & abscissa() { @@ -212,7 +173,7 @@ class gauss_detail template class gauss_detail { - using storage_type = typename gauss_constant_category::storage_type; + using storage_type = typename quadrature_constant_category::storage_type; public: static std::array const & abscissa() { @@ -270,7 +231,7 @@ class gauss_detail template class gauss_detail { - using storage_type = typename gauss_constant_category::storage_type; + using storage_type = typename quadrature_constant_category::storage_type; public: static std::array const & abscissa() { @@ -305,7 +266,7 @@ class gauss_detail template class gauss_detail { - using storage_type = typename gauss_constant_category::storage_type; + using storage_type = typename quadrature_constant_category::storage_type; public: static std::array const & abscissa() { @@ -375,7 +336,7 @@ class gauss_detail template class gauss_detail { - using storage_type = typename gauss_constant_category::storage_type; + using storage_type = typename quadrature_constant_category::storage_type; public: static std::array const & abscissa() { @@ -414,7 +375,7 @@ class gauss_detail template class gauss_detail { - using storage_type = typename gauss_constant_category::storage_type; + using storage_type = typename quadrature_constant_category::storage_type; public: static std::array const & abscissa() { @@ -492,7 +453,7 @@ class gauss_detail template class gauss_detail { - using storage_type = typename gauss_constant_category::storage_type; + using storage_type = typename quadrature_constant_category::storage_type; public: static std::array const & abscissa() { @@ -537,7 +498,7 @@ class gauss_detail template class gauss_detail { - using storage_type = typename gauss_constant_category::storage_type; + using storage_type = typename quadrature_constant_category::storage_type; public: static std::array const & abscissa() { @@ -628,7 +589,7 @@ class gauss_detail template class gauss_detail { - using storage_type = typename gauss_constant_category::storage_type; + using storage_type = typename quadrature_constant_category::storage_type; public: static std::array const & abscissa() { @@ -677,7 +638,7 @@ class gauss_detail template class gauss_detail { - using storage_type = typename gauss_constant_category::storage_type; + using storage_type = typename quadrature_constant_category::storage_type; public: static std::array const & abscissa() { @@ -774,9 +735,9 @@ class gauss_detail } BOOST_MATH_EXPORT template > -class gauss : public detail::gauss_detail::value> +class gauss : public detail::gauss_detail::value> { - typedef detail::gauss_detail::value> base; + typedef detail::gauss_detail::value> base; public: template diff --git a/include/boost/math/quadrature/gauss_hermite.hpp b/include/boost/math/quadrature/gauss_hermite.hpp index a8bd05a002..2330983a7a 100644 --- a/include/boost/math/quadrature/gauss_hermite.hpp +++ b/include/boost/math/quadrature/gauss_hermite.hpp @@ -32,49 +32,10 @@ #include #include #include +#include BOOST_MATH_NAMESPACE_BEGIN namespace quadrature { namespace detail { -template -struct gauss_hermite_constant_category -{ - static const unsigned value = - (std::numeric_limits::is_specialized == 0) ? 999 : - (std::numeric_limits::radix == 2) ? - ( -#ifdef BOOST_HAS_FLOAT128 - (std::numeric_limits::digits <= 113) && std::is_constructible::value ? 0 : -#else - (std::numeric_limits::digits <= std::numeric_limits::digits) && std::is_constructible::value ? 0 : -#endif - (std::numeric_limits::digits10 <= 110) && std::is_constructible::value ? 4 : 999 - ) : (std::numeric_limits::digits10 <= 110) && std::is_constructible::value ? 4 : 999; - - using storage_type = - std::conditional_t<(std::numeric_limits::is_specialized == 0), T, - std::conditional_t<(std::numeric_limits::radix == 2), - std::conditional_t< ((std::numeric_limits::digits <= std::numeric_limits::digits) && std::is_constructible::value), - float, - std::conditional_t<((std::numeric_limits::digits <= std::numeric_limits::digits) && std::is_constructible::value), - double, - std::conditional_t<((std::numeric_limits::digits <= std::numeric_limits::digits) && std::is_constructible::value), - long double, -#ifdef BOOST_HAS_FLOAT128 - std::conditional_t<((std::numeric_limits::digits <= 113) && std::is_constructible::value), - __float128, - T - > - > -#else - T - > -#endif - > - >, T - > - >; -}; - #ifndef BOOST_MATH_GAUSS_NO_COMPUTE_ON_DEMAND template @@ -252,7 +213,7 @@ class gauss_hermite_detail; template class gauss_hermite_detail { - using storage_type = typename gauss_hermite_constant_category::storage_type; + using storage_type = typename quadrature_constant_category::storage_type; public: static std::array const & abscissa() { @@ -280,7 +241,7 @@ class gauss_hermite_detail template class gauss_hermite_detail { - using storage_type = typename gauss_hermite_constant_category::storage_type; + using storage_type = typename quadrature_constant_category::storage_type; public: static std::array const & abscissa() { @@ -308,7 +269,7 @@ class gauss_hermite_detail template class gauss_hermite_detail { - using storage_type = typename gauss_hermite_constant_category::storage_type; + using storage_type = typename quadrature_constant_category::storage_type; public: static std::array const & abscissa() { @@ -336,7 +297,7 @@ class gauss_hermite_detail template class gauss_hermite_detail { - using storage_type = typename gauss_hermite_constant_category::storage_type; + using storage_type = typename quadrature_constant_category::storage_type; public: static std::array const & abscissa() { @@ -366,7 +327,7 @@ class gauss_hermite_detail template class gauss_hermite_detail { - using storage_type = typename gauss_hermite_constant_category::storage_type; + using storage_type = typename quadrature_constant_category::storage_type; public: static std::array const & abscissa() { @@ -396,7 +357,7 @@ class gauss_hermite_detail template class gauss_hermite_detail { - using storage_type = typename gauss_hermite_constant_category::storage_type; + using storage_type = typename quadrature_constant_category::storage_type; public: static std::array const & abscissa() { @@ -426,7 +387,7 @@ class gauss_hermite_detail template class gauss_hermite_detail { - using storage_type = typename gauss_hermite_constant_category::storage_type; + using storage_type = typename quadrature_constant_category::storage_type; public: static std::array const & abscissa() { @@ -462,7 +423,7 @@ class gauss_hermite_detail template class gauss_hermite_detail { - using storage_type = typename gauss_hermite_constant_category::storage_type; + using storage_type = typename quadrature_constant_category::storage_type; public: static std::array const & abscissa() { @@ -498,7 +459,7 @@ class gauss_hermite_detail template class gauss_hermite_detail { - using storage_type = typename gauss_hermite_constant_category::storage_type; + using storage_type = typename quadrature_constant_category::storage_type; public: static std::array const & abscissa() { @@ -533,9 +494,9 @@ class gauss_hermite_detail } // namespace detail template > -class gauss_hermite : public detail::gauss_hermite_detail::value> +class gauss_hermite : public detail::gauss_hermite_detail::value> { - using base = detail::gauss_hermite_detail::value>; + using base = detail::gauss_hermite_detail::value>; // Abscissas computed on demand are NaN when the recurrence overflows Real. static bool overflowed() diff --git a/include/boost/math/quadrature/gauss_kronrod.hpp b/include/boost/math/quadrature/gauss_kronrod.hpp index e776f5bb7a..f66b9de5d0 100644 --- a/include/boost/math/quadrature/gauss_kronrod.hpp +++ b/include/boost/math/quadrature/gauss_kronrod.hpp @@ -21,6 +21,7 @@ #include #include #include +#include BOOST_MATH_NAMESPACE_BEGIN namespace quadrature{ namespace detail{ @@ -88,7 +89,7 @@ class gauss_kronrod_detail; template class gauss_kronrod_detail { - using storage_type = typename gauss_constant_category::storage_type; + using storage_type = typename quadrature_constant_category::storage_type; public: static std::array const & abscissa() { @@ -124,7 +125,7 @@ class gauss_kronrod_detail template class gauss_kronrod_detail { - using storage_type = typename gauss_constant_category::storage_type; + using storage_type = typename quadrature_constant_category::storage_type; public: static std::array const & abscissa() { @@ -196,7 +197,7 @@ class gauss_kronrod_detail template class gauss_kronrod_detail { - using storage_type = typename gauss_constant_category::storage_type; + using storage_type = typename quadrature_constant_category::storage_type; public: static std::array const & abscissa() { @@ -238,7 +239,7 @@ class gauss_kronrod_detail template class gauss_kronrod_detail { - using storage_type = typename gauss_constant_category::storage_type; + using storage_type = typename quadrature_constant_category::storage_type; public: static std::array const & abscissa() { @@ -322,7 +323,7 @@ class gauss_kronrod_detail template class gauss_kronrod_detail { - using storage_type = typename gauss_constant_category::storage_type; + using storage_type = typename quadrature_constant_category::storage_type; public: static std::array const & abscissa() { @@ -375,7 +376,7 @@ class gauss_kronrod_detail template class gauss_kronrod_detail { - using storage_type = typename gauss_constant_category::storage_type; + using storage_type = typename quadrature_constant_category::storage_type; public: static std::array const & abscissa() { @@ -479,7 +480,7 @@ class gauss_kronrod_detail template class gauss_kronrod_detail { - using storage_type = typename gauss_constant_category::storage_type; + using storage_type = typename quadrature_constant_category::storage_type; public: static std::array const & abscissa() { @@ -542,7 +543,7 @@ class gauss_kronrod_detail template class gauss_kronrod_detail { - using storage_type = typename gauss_constant_category::storage_type; + using storage_type = typename quadrature_constant_category::storage_type; public: static std::array const & abscissa() { @@ -666,7 +667,7 @@ class gauss_kronrod_detail template class gauss_kronrod_detail { - using storage_type = typename gauss_constant_category::storage_type; + using storage_type = typename quadrature_constant_category::storage_type; public: static std::array const & abscissa() { @@ -739,7 +740,7 @@ class gauss_kronrod_detail template class gauss_kronrod_detail { - using storage_type = typename gauss_constant_category::storage_type; + using storage_type = typename quadrature_constant_category::storage_type; public: static std::array const & abscissa() { @@ -883,7 +884,7 @@ class gauss_kronrod_detail template class gauss_kronrod_detail { - using storage_type = typename gauss_constant_category::storage_type; + using storage_type = typename quadrature_constant_category::storage_type; public: static std::array const & abscissa() { @@ -966,7 +967,7 @@ class gauss_kronrod_detail template class gauss_kronrod_detail { - using storage_type = typename gauss_constant_category::storage_type; + using storage_type = typename quadrature_constant_category::storage_type; public: static std::array const & abscissa() { @@ -1128,9 +1129,9 @@ class gauss_kronrod_detail } BOOST_MATH_EXPORT template > -class gauss_kronrod : public detail::gauss_kronrod_detail::value> +class gauss_kronrod : public detail::gauss_kronrod_detail::value> { - typedef detail::gauss_kronrod_detail::value> base; + typedef detail::gauss_kronrod_detail::value> base; public: typedef Real value_type; private: