diff options
Diffstat (limited to '3rdParty/Boost/src/boost/math')
11 files changed, 621 insertions, 322 deletions
diff --git a/3rdParty/Boost/src/boost/math/common_factor_ct.hpp b/3rdParty/Boost/src/boost/math/common_factor_ct.hpp index 848c925..bf58b94 100644 --- a/3rdParty/Boost/src/boost/math/common_factor_ct.hpp +++ b/3rdParty/Boost/src/boost/math/common_factor_ct.hpp @@ -23,7 +23,6 @@ namespace math namespace detail { -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION // Build GCD with Euclid's recursive algorithm template < static_gcd_type Value1, static_gcd_type Value2 > struct static_gcd_helper_t @@ -54,48 +53,7 @@ namespace detail { BOOST_STATIC_CONSTANT( static_gcd_type, value = Value1 ); }; -#else - // Use inner class template workaround from Peter Dimov - template < static_gcd_type Value1 > - struct static_gcd_helper2_t - { - template < static_gcd_type Value2 > - struct helper - { - BOOST_STATIC_CONSTANT( static_gcd_type, value - = static_gcd_helper2_t<Value2>::BOOST_NESTED_TEMPLATE - helper<Value1 % Value2>::value ); - }; - - template < > - struct helper< 0UL > - { - BOOST_STATIC_CONSTANT( static_gcd_type, value = Value1 ); - }; - }; - - // Special case - template < > - struct static_gcd_helper2_t< 0UL > - { - template < static_gcd_type Value2 > - struct helper - { - BOOST_STATIC_CONSTANT( static_gcd_type, value = Value2 ); - }; - }; - - // Build the GCD from the above template(s) - template < static_gcd_type Value1, static_gcd_type Value2 > - struct static_gcd_helper_t - { - BOOST_STATIC_CONSTANT( static_gcd_type, value - = static_gcd_helper2_t<Value1>::BOOST_NESTED_TEMPLATE - helper<Value2>::value ); - }; -#endif -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION // Build the LCM from the GCD template < static_gcd_type Value1, static_gcd_type Value2 > struct static_lcm_helper_t @@ -112,47 +70,6 @@ namespace detail { BOOST_STATIC_CONSTANT( static_gcd_type, value = 0UL ); }; -#else - // Adapt GCD's inner class template workaround for LCM - template < static_gcd_type Value1 > - struct static_lcm_helper2_t - { - template < static_gcd_type Value2 > - struct helper - { - typedef static_gcd_helper_t<Value1, Value2> gcd_type; - - BOOST_STATIC_CONSTANT( static_gcd_type, value = Value1 - / gcd_type::value * Value2 ); - }; - - template < > - struct helper< 0UL > - { - BOOST_STATIC_CONSTANT( static_gcd_type, value = 0UL ); - }; - }; - - // Special case - template < > - struct static_lcm_helper2_t< 0UL > - { - template < static_gcd_type Value2 > - struct helper - { - BOOST_STATIC_CONSTANT( static_gcd_type, value = 0UL ); - }; - }; - - // Build the LCM from the above template(s) - template < static_gcd_type Value1, static_gcd_type Value2 > - struct static_lcm_helper_t - { - BOOST_STATIC_CONSTANT( static_gcd_type, value - = static_lcm_helper2_t<Value1>::BOOST_NESTED_TEMPLATE - helper<Value2>::value ); - }; -#endif } // namespace detail diff --git a/3rdParty/Boost/src/boost/math/common_factor_rt.hpp b/3rdParty/Boost/src/boost/math/common_factor_rt.hpp index 4582a96..10a92eb 100644 --- a/3rdParty/Boost/src/boost/math/common_factor_rt.hpp +++ b/3rdParty/Boost/src/boost/math/common_factor_rt.hpp @@ -222,7 +222,6 @@ namespace detail // Function objects to find the best way of computing GCD or LCM #ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION template < typename T, bool IsSpecialized, bool IsSigned > struct gcd_optimal_evaluator_helper_t { @@ -240,40 +239,6 @@ namespace detail return gcd_integer( a, b ); } }; -#else - template < bool IsSpecialized, bool IsSigned > - struct gcd_optimal_evaluator_helper2_t - { - template < typename T > - struct helper - { - T operator ()( T const &a, T const &b ) - { - return gcd_euclidean( a, b ); - } - }; - }; - - template < > - struct gcd_optimal_evaluator_helper2_t< true, true > - { - template < typename T > - struct helper - { - T operator ()( T const &a, T const &b ) - { - return gcd_integer( a, b ); - } - }; - }; - - template < typename T, bool IsSpecialized, bool IsSigned > - struct gcd_optimal_evaluator_helper_t - : gcd_optimal_evaluator_helper2_t<IsSpecialized, IsSigned> - ::BOOST_NESTED_TEMPLATE helper<T> - { - }; -#endif template < typename T > struct gcd_optimal_evaluator @@ -348,7 +313,6 @@ namespace detail #undef BOOST_PRIVATE_GCD_SF #ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION template < typename T, bool IsSpecialized, bool IsSigned > struct lcm_optimal_evaluator_helper_t { @@ -366,40 +330,6 @@ namespace detail return lcm_integer( a, b ); } }; -#else - template < bool IsSpecialized, bool IsSigned > - struct lcm_optimal_evaluator_helper2_t - { - template < typename T > - struct helper - { - T operator ()( T const &a, T const &b ) - { - return lcm_euclidean( a, b ); - } - }; - }; - - template < > - struct lcm_optimal_evaluator_helper2_t< true, true > - { - template < typename T > - struct helper - { - T operator ()( T const &a, T const &b ) - { - return lcm_integer( a, b ); - } - }; - }; - - template < typename T, bool IsSpecialized, bool IsSigned > - struct lcm_optimal_evaluator_helper_t - : lcm_optimal_evaluator_helper2_t<IsSpecialized, IsSigned> - ::BOOST_NESTED_TEMPLATE helper<T> - { - }; -#endif template < typename T > struct lcm_optimal_evaluator diff --git a/3rdParty/Boost/src/boost/math/policies/policy.hpp b/3rdParty/Boost/src/boost/math/policies/policy.hpp index 01fe3d0..49068a6 100644 --- a/3rdParty/Boost/src/boost/math/policies/policy.hpp +++ b/3rdParty/Boost/src/boost/math/policies/policy.hpp @@ -94,8 +94,7 @@ namespace policies{ #define BOOST_MATH_MAX_ROOT_ITERATION_POLICY 200 #endif -#if !defined(__BORLANDC__) \ - && !(defined(__GNUC__) && (__GNUC__ == 3) && (__GNUC_MINOR__ <= 2)) +#if !defined(__BORLANDC__) #define BOOST_MATH_META_INT(type, name, Default)\ template <type N = Default> struct name : public boost::mpl::int_<N>{};\ namespace detail{\ @@ -813,6 +812,16 @@ struct precision #endif +#ifdef BOOST_MATH_USE_FLOAT128 + +template <class Policy> +struct precision<BOOST_MATH_FLOAT128_TYPE, Policy> +{ + typedef mpl::int_<113> type; +}; + +#endif + namespace detail{ template <class T, class Policy> diff --git a/3rdParty/Boost/src/boost/math/special_functions/detail/fp_traits.hpp b/3rdParty/Boost/src/boost/math/special_functions/detail/fp_traits.hpp index 50c034d..63ebf11 100644 --- a/3rdParty/Boost/src/boost/math/special_functions/detail/fp_traits.hpp +++ b/3rdParty/Boost/src/boost/math/special_functions/detail/fp_traits.hpp @@ -351,6 +351,13 @@ struct fp_traits_non_native<long double, extended_double_precision> // the Intel extended double precision format (80 bits) and // the IEEE extended double precision format with 15 exponent bits (128 bits). +#elif defined(__GNUC__) && (LDBL_MANT_DIG == 106) + +// +// Define nothing here and fall though to generic_tag: +// We have GCC's "double double" in effect, and any attempt +// to handle it via bit-fiddling is pretty much doomed to fail... +// // long double (>64 bits), PowerPC --------------------------------------------- @@ -546,7 +553,9 @@ struct select_native<long double> && !defined(__DECCXX)\ && !defined(__osf__) \ && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)\ - && !defined(BOOST_MATH_DISABLE_STD_FPCLASSIFY) + && !defined(__FAST_MATH__)\ + && !defined(BOOST_MATH_DISABLE_STD_FPCLASSIFY)\ + && !defined(BOOST_INTEL) # define BOOST_MATH_USE_STD_FPCLASSIFY #endif diff --git a/3rdParty/Boost/src/boost/math/special_functions/detail/round_fwd.hpp b/3rdParty/Boost/src/boost/math/special_functions/detail/round_fwd.hpp index 952259a..8c45a7d 100644 --- a/3rdParty/Boost/src/boost/math/special_functions/detail/round_fwd.hpp +++ b/3rdParty/Boost/src/boost/math/special_functions/detail/round_fwd.hpp @@ -9,6 +9,7 @@ #define BOOST_MATH_SPECIAL_ROUND_FWD_HPP #include <boost/config.hpp> +#include <boost/math/tools/promotion.hpp> #ifdef _MSC_VER #pragma once @@ -20,9 +21,9 @@ namespace boost { template <class T, class Policy> - T trunc(const T& v, const Policy& pol); + typename tools::promote_args<T>::type trunc(const T& v, const Policy& pol); template <class T> - T trunc(const T& v); + typename tools::promote_args<T>::type trunc(const T& v); template <class T, class Policy> int itrunc(const T& v, const Policy& pol); template <class T> @@ -38,9 +39,9 @@ namespace boost boost::long_long_type lltrunc(const T& v); #endif template <class T, class Policy> - T round(const T& v, const Policy& pol); + typename tools::promote_args<T>::type round(const T& v, const Policy& pol); template <class T> - T round(const T& v); + typename tools::promote_args<T>::type round(const T& v); template <class T, class Policy> int iround(const T& v, const Policy& pol); template <class T> @@ -76,5 +77,17 @@ namespace boost } } + +#undef BOOST_MATH_STD_USING +#define BOOST_MATH_STD_USING BOOST_MATH_STD_USING_CORE\ + using boost::math::round;\ + using boost::math::iround;\ + using boost::math::lround;\ + using boost::math::trunc;\ + using boost::math::itrunc;\ + using boost::math::ltrunc;\ + using boost::math::modf; + + #endif // BOOST_MATH_SPECIAL_ROUND_FWD_HPP diff --git a/3rdParty/Boost/src/boost/math/special_functions/fpclassify.hpp b/3rdParty/Boost/src/boost/math/special_functions/fpclassify.hpp index 6f92d18..40f6e14 100644 --- a/3rdParty/Boost/src/boost/math/special_functions/fpclassify.hpp +++ b/3rdParty/Boost/src/boost/math/special_functions/fpclassify.hpp @@ -37,13 +37,13 @@ the template is never instantiated. a floating point type (float, double or long double) can be determined at compile time, then the following algorithm is used: - If all exponent bits, the flag bit (if there is one), + If all exponent bits, the flag bit (if there is one), and all significand bits are 0, then the number is zero. - If all exponent bits and the flag bit (if there is one) are 0, + If all exponent bits and the flag bit (if there is one) are 0, and at least one significand bit is 1, then the number is subnormal. - If all exponent bits are 1 and all significand bits are 0, + If all exponent bits are 1 and all significand bits are 0, then the number is infinity. If all exponent bits are 1 and at least one significand bit is 1, @@ -56,7 +56,7 @@ at compile time, then the following algorithm is used: Most formats have the structure sign bit + exponent bits + significand bits. - + A few have the structure sign bit + exponent bits + flag bit + significand bits. The flag bit is 0 for zero and subnormal numbers, @@ -85,7 +85,7 @@ is used. namespace std{ using ::abs; using ::fabs; } #endif -namespace boost{ +namespace boost{ // // This must not be located in any namespace under boost::math @@ -94,18 +94,28 @@ namespace boost{ // namespace math_detail{ +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4800) +#endif + template <class T> inline bool is_nan_helper(T t, const boost::true_type&) { #ifdef isnan return isnan(t); #elif defined(BOOST_MATH_DISABLE_STD_FPCLASSIFY) || !defined(BOOST_HAS_FPCLASSIFY) + (void)t; return false; #else // BOOST_HAS_FPCLASSIFY return (BOOST_FPCLASSIFY_PREFIX fpclassify(t) == (int)FP_NAN); #endif } +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + template <class T> inline bool is_nan_helper(T, const boost::false_type&) { @@ -169,7 +179,7 @@ inline int fpclassify_imp BOOST_NO_MACRO_EXPAND(T t, const generic_tag<false>&) if(std::numeric_limits<T>::is_specialized) return fpclassify_imp(t, generic_tag<true>()); #endif - // + // // An unknown type with no numeric_limits support, // so what are we supposed to do we do here? // @@ -178,7 +188,7 @@ inline int fpclassify_imp BOOST_NO_MACRO_EXPAND(T t, const generic_tag<false>&) return t == 0 ? FP_ZERO : FP_NORMAL; } -template<class T> +template<class T> int fpclassify_imp BOOST_NO_MACRO_EXPAND(T x, ieee_copy_all_bits_tag) { typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits; @@ -207,7 +217,7 @@ int fpclassify_imp BOOST_NO_MACRO_EXPAND(T x, ieee_copy_all_bits_tag) return FP_NAN; } -template<class T> +template<class T> int fpclassify_imp BOOST_NO_MACRO_EXPAND(T x, ieee_copy_leading_bits_tag) { typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits; @@ -215,7 +225,7 @@ int fpclassify_imp BOOST_NO_MACRO_EXPAND(T x, ieee_copy_leading_bits_tag) BOOST_MATH_INSTRUMENT_VARIABLE(x); BOOST_DEDUCED_TYPENAME traits::bits a; - traits::get_bits(x,a); + traits::get_bits(x,a); a &= traits::exponent | traits::flag | traits::significand; if(a <= traits::significand) { @@ -234,9 +244,8 @@ int fpclassify_imp BOOST_NO_MACRO_EXPAND(T x, ieee_copy_leading_bits_tag) return FP_NAN; } -#if defined(BOOST_MATH_USE_STD_FPCLASSIFY) && defined(BOOST_MATH_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY) -template <> -inline int fpclassify_imp<long double> BOOST_NO_MACRO_EXPAND(long double t, const native_tag&) +#if defined(BOOST_MATH_USE_STD_FPCLASSIFY) && (defined(BOOST_MATH_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY) || defined(BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS)) +inline int fpclassify_imp BOOST_NO_MACRO_EXPAND(long double t, const native_tag&) { return boost::math::detail::fpclassify_imp(t, generic_tag<true>()); } @@ -249,7 +258,7 @@ inline int fpclassify BOOST_NO_MACRO_EXPAND(T t) { typedef typename detail::fp_traits<T>::type traits; typedef typename traits::method method; - typedef typename tools::promote_args<T>::type value_type; + typedef typename tools::promote_args_permissive<T>::type value_type; #ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS if(std::numeric_limits<T>::is_specialized && detail::is_generic_tag_false(static_cast<method*>(0))) return detail::fpclassify_imp(static_cast<value_type>(t), detail::generic_tag<true>()); @@ -259,24 +268,41 @@ inline int fpclassify BOOST_NO_MACRO_EXPAND(T t) #endif } +#ifdef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS +template <> +inline int fpclassify<long double> BOOST_NO_MACRO_EXPAND(long double t) +{ + typedef detail::fp_traits<long double>::type traits; + typedef traits::method method; + typedef long double value_type; +#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS + if(std::numeric_limits<long double>::is_specialized && detail::is_generic_tag_false(static_cast<method*>(0))) + return detail::fpclassify_imp(static_cast<value_type>(t), detail::generic_tag<true>()); + return detail::fpclassify_imp(static_cast<value_type>(t), method()); +#else + return detail::fpclassify_imp(static_cast<value_type>(t), method()); +#endif +} +#endif + namespace detail { #ifdef BOOST_MATH_USE_STD_FPCLASSIFY - template<class T> + template<class T> inline bool isfinite_impl(T x, native_tag const&) { return (std::isfinite)(x); } #endif - template<class T> + template<class T> inline bool isfinite_impl(T x, generic_tag<true> const&) { return x >= -(std::numeric_limits<T>::max)() && x <= (std::numeric_limits<T>::max)(); } - template<class T> + template<class T> inline bool isfinite_impl(T x, generic_tag<false> const&) { #ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS @@ -287,7 +313,7 @@ namespace detail { return true; } - template<class T> + template<class T> inline bool isfinite_impl(T x, ieee_tag const&) { typedef BOOST_DEDUCED_TYPENAME detail::fp_traits<T>::type traits; @@ -298,8 +324,7 @@ namespace detail { } #if defined(BOOST_MATH_USE_STD_FPCLASSIFY) && defined(BOOST_MATH_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY) -template <> -inline bool isfinite_impl<long double> BOOST_NO_MACRO_EXPAND(long double t, const native_tag&) +inline bool isfinite_impl BOOST_NO_MACRO_EXPAND(long double t, const native_tag&) { return boost::math::detail::isfinite_impl(t, generic_tag<true>()); } @@ -307,29 +332,41 @@ inline bool isfinite_impl<long double> BOOST_NO_MACRO_EXPAND(long double t, cons } -template<class T> +template<class T> inline bool (isfinite)(T x) { //!< \brief return true if floating-point type t is finite. typedef typename detail::fp_traits<T>::type traits; typedef typename traits::method method; - typedef typename boost::is_floating_point<T>::type fp_tag; - typedef typename tools::promote_args<T>::type value_type; + // typedef typename boost::is_floating_point<T>::type fp_tag; + typedef typename tools::promote_args_permissive<T>::type value_type; return detail::isfinite_impl(static_cast<value_type>(x), method()); } +#ifdef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS +template<> +inline bool (isfinite)(long double x) +{ //!< \brief return true if floating-point type t is finite. + typedef detail::fp_traits<long double>::type traits; + typedef traits::method method; + //typedef boost::is_floating_point<long double>::type fp_tag; + typedef long double value_type; + return detail::isfinite_impl(static_cast<value_type>(x), method()); +} +#endif + //------------------------------------------------------------------------------ namespace detail { #ifdef BOOST_MATH_USE_STD_FPCLASSIFY - template<class T> + template<class T> inline bool isnormal_impl(T x, native_tag const&) { return (std::isnormal)(x); } #endif - template<class T> + template<class T> inline bool isnormal_impl(T x, generic_tag<true> const&) { if(x < 0) x = -x; @@ -337,7 +374,7 @@ namespace detail { && x <= (std::numeric_limits<T>::max)(); } - template<class T> + template<class T> inline bool isnormal_impl(T x, generic_tag<false> const&) { #ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS @@ -347,7 +384,7 @@ namespace detail { return !(x == 0); } - template<class T> + template<class T> inline bool isnormal_impl(T x, ieee_tag const&) { typedef BOOST_DEDUCED_TYPENAME detail::fp_traits<T>::type traits; @@ -358,8 +395,7 @@ namespace detail { } #if defined(BOOST_MATH_USE_STD_FPCLASSIFY) && defined(BOOST_MATH_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY) -template <> -inline bool isnormal_impl<long double> BOOST_NO_MACRO_EXPAND(long double t, const native_tag&) +inline bool isnormal_impl BOOST_NO_MACRO_EXPAND(long double t, const native_tag&) { return boost::math::detail::isnormal_impl(t, generic_tag<true>()); } @@ -367,38 +403,50 @@ inline bool isnormal_impl<long double> BOOST_NO_MACRO_EXPAND(long double t, cons } -template<class T> +template<class T> inline bool (isnormal)(T x) { typedef typename detail::fp_traits<T>::type traits; typedef typename traits::method method; - typedef typename boost::is_floating_point<T>::type fp_tag; - typedef typename tools::promote_args<T>::type value_type; + //typedef typename boost::is_floating_point<T>::type fp_tag; + typedef typename tools::promote_args_permissive<T>::type value_type; return detail::isnormal_impl(static_cast<value_type>(x), method()); } +#ifdef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS +template<> +inline bool (isnormal)(long double x) +{ + typedef detail::fp_traits<long double>::type traits; + typedef traits::method method; + //typedef boost::is_floating_point<long double>::type fp_tag; + typedef long double value_type; + return detail::isnormal_impl(static_cast<value_type>(x), method()); +} +#endif + //------------------------------------------------------------------------------ namespace detail { #ifdef BOOST_MATH_USE_STD_FPCLASSIFY - template<class T> + template<class T> inline bool isinf_impl(T x, native_tag const&) { return (std::isinf)(x); } #endif - template<class T> + template<class T> inline bool isinf_impl(T x, generic_tag<true> const&) { (void)x; // in case the compiler thinks that x is unused because std::numeric_limits<T>::has_infinity is false - return std::numeric_limits<T>::has_infinity + return std::numeric_limits<T>::has_infinity && ( x == std::numeric_limits<T>::infinity() || x == -std::numeric_limits<T>::infinity()); } - template<class T> + template<class T> inline bool isinf_impl(T x, generic_tag<false> const&) { #ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS @@ -409,7 +457,7 @@ namespace detail { return false; } - template<class T> + template<class T> inline bool isinf_impl(T x, ieee_copy_all_bits_tag const&) { typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits; @@ -420,7 +468,7 @@ namespace detail { return a == traits::exponent; } - template<class T> + template<class T> inline bool isinf_impl(T x, ieee_copy_leading_bits_tag const&) { typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits; @@ -436,8 +484,7 @@ namespace detail { } #if defined(BOOST_MATH_USE_STD_FPCLASSIFY) && defined(BOOST_MATH_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY) -template <> -inline bool isinf_impl<long double> BOOST_NO_MACRO_EXPAND(long double t, const native_tag&) +inline bool isinf_impl BOOST_NO_MACRO_EXPAND(long double t, const native_tag&) { return boost::math::detail::isinf_impl(t, generic_tag<true>()); } @@ -445,29 +492,41 @@ inline bool isinf_impl<long double> BOOST_NO_MACRO_EXPAND(long double t, const n } // namespace detail -template<class T> +template<class T> inline bool (isinf)(T x) { typedef typename detail::fp_traits<T>::type traits; typedef typename traits::method method; - typedef typename boost::is_floating_point<T>::type fp_tag; - typedef typename tools::promote_args<T>::type value_type; + // typedef typename boost::is_floating_point<T>::type fp_tag; + typedef typename tools::promote_args_permissive<T>::type value_type; + return detail::isinf_impl(static_cast<value_type>(x), method()); +} + +#ifdef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS +template<> +inline bool (isinf)(long double x) +{ + typedef detail::fp_traits<long double>::type traits; + typedef traits::method method; + //typedef boost::is_floating_point<long double>::type fp_tag; + typedef long double value_type; return detail::isinf_impl(static_cast<value_type>(x), method()); } +#endif //------------------------------------------------------------------------------ namespace detail { #ifdef BOOST_MATH_USE_STD_FPCLASSIFY - template<class T> + template<class T> inline bool isnan_impl(T x, native_tag const&) { return (std::isnan)(x); } #endif - template<class T> + template<class T> inline bool isnan_impl(T x, generic_tag<true> const&) { return std::numeric_limits<T>::has_infinity @@ -475,7 +534,7 @@ namespace detail { : x != x; } - template<class T> + template<class T> inline bool isnan_impl(T x, generic_tag<false> const&) { #ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS @@ -486,7 +545,7 @@ namespace detail { return false; } - template<class T> + template<class T> inline bool isnan_impl(T x, ieee_copy_all_bits_tag const&) { typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits; @@ -497,7 +556,7 @@ namespace detail { return a > traits::exponent; } - template<class T> + template<class T> inline bool isnan_impl(T x, ieee_copy_leading_bits_tag const&) { typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits; @@ -516,11 +575,12 @@ namespace detail { } // namespace detail -template<class T> bool (isnan)(T x) +template<class T> +inline bool (isnan)(T x) { //!< \brief return true if floating-point type t is NaN (Not A Number). typedef typename detail::fp_traits<T>::type traits; typedef typename traits::method method; - typedef typename boost::is_floating_point<T>::type fp_tag; + // typedef typename boost::is_floating_point<T>::type fp_tag; return detail::isnan_impl(x, method()); } @@ -528,6 +588,15 @@ template<class T> bool (isnan)(T x) template <> inline bool isnan BOOST_NO_MACRO_EXPAND<float>(float t){ return ::boost::math_detail::is_nan_helper(t, boost::true_type()); } template <> inline bool isnan BOOST_NO_MACRO_EXPAND<double>(double t){ return ::boost::math_detail::is_nan_helper(t, boost::true_type()); } template <> inline bool isnan BOOST_NO_MACRO_EXPAND<long double>(long double t){ return ::boost::math_detail::is_nan_helper(t, boost::true_type()); } +#elif defined(BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS) +template<> +inline bool (isnan)(long double x) +{ //!< \brief return true if floating-point type t is NaN (Not A Number). + typedef detail::fp_traits<long double>::type traits; + typedef traits::method method; + //typedef boost::is_floating_point<long double>::type fp_tag; + return detail::isnan_impl(x, method()); +} #endif } // namespace math diff --git a/3rdParty/Boost/src/boost/math/special_functions/math_fwd.hpp b/3rdParty/Boost/src/boost/math/special_functions/math_fwd.hpp index 6669e3f..e952dcd 100644 --- a/3rdParty/Boost/src/boost/math/special_functions/math_fwd.hpp +++ b/3rdParty/Boost/src/boost/math/special_functions/math_fwd.hpp @@ -14,7 +14,7 @@ // IT = Integer type. // RT = Real type (built-in floating-point types, float, double, long double) & User Defined Types -// AT = Integer or Real type +// AT = Integer or Real type #ifndef BOOST_MATH_SPECIAL_MATH_FWD_HPP #define BOOST_MATH_SPECIAL_MATH_FWD_HPP @@ -38,111 +38,111 @@ namespace boost // Beta functions. template <class RT1, class RT2> - typename tools::promote_args<RT1, RT2>::type + typename tools::promote_args<RT1, RT2>::type beta(RT1 a, RT2 b); // Beta function (2 arguments). template <class RT1, class RT2, class A> - typename tools::promote_args<RT1, RT2, A>::type + typename tools::promote_args<RT1, RT2, A>::type beta(RT1 a, RT2 b, A x); // Beta function (3 arguments). template <class RT1, class RT2, class RT3, class Policy> - typename tools::promote_args<RT1, RT2, RT3>::type + typename tools::promote_args<RT1, RT2, RT3>::type beta(RT1 a, RT2 b, RT3 x, const Policy& pol); // Beta function (3 arguments). template <class RT1, class RT2, class RT3> - typename tools::promote_args<RT1, RT2, RT3>::type + typename tools::promote_args<RT1, RT2, RT3>::type betac(RT1 a, RT2 b, RT3 x); template <class RT1, class RT2, class RT3, class Policy> - typename tools::promote_args<RT1, RT2, RT3>::type + typename tools::promote_args<RT1, RT2, RT3>::type betac(RT1 a, RT2 b, RT3 x, const Policy& pol); template <class RT1, class RT2, class RT3> - typename tools::promote_args<RT1, RT2, RT3>::type + typename tools::promote_args<RT1, RT2, RT3>::type ibeta(RT1 a, RT2 b, RT3 x); // Incomplete beta function. template <class RT1, class RT2, class RT3, class Policy> - typename tools::promote_args<RT1, RT2, RT3>::type + typename tools::promote_args<RT1, RT2, RT3>::type ibeta(RT1 a, RT2 b, RT3 x, const Policy& pol); // Incomplete beta function. template <class RT1, class RT2, class RT3> - typename tools::promote_args<RT1, RT2, RT3>::type + typename tools::promote_args<RT1, RT2, RT3>::type ibetac(RT1 a, RT2 b, RT3 x); // Incomplete beta complement function. template <class RT1, class RT2, class RT3, class Policy> - typename tools::promote_args<RT1, RT2, RT3>::type + typename tools::promote_args<RT1, RT2, RT3>::type ibetac(RT1 a, RT2 b, RT3 x, const Policy& pol); // Incomplete beta complement function. template <class T1, class T2, class T3, class T4> - typename tools::promote_args<T1, T2, T3, T4>::type + typename tools::promote_args<T1, T2, T3, T4>::type ibeta_inv(T1 a, T2 b, T3 p, T4* py); template <class T1, class T2, class T3, class T4, class Policy> - typename tools::promote_args<T1, T2, T3, T4>::type + typename tools::promote_args<T1, T2, T3, T4>::type ibeta_inv(T1 a, T2 b, T3 p, T4* py, const Policy& pol); template <class RT1, class RT2, class RT3> - typename tools::promote_args<RT1, RT2, RT3>::type + typename tools::promote_args<RT1, RT2, RT3>::type ibeta_inv(RT1 a, RT2 b, RT3 p); // Incomplete beta inverse function. template <class RT1, class RT2, class RT3, class Policy> - typename tools::promote_args<RT1, RT2, RT3>::type + typename tools::promote_args<RT1, RT2, RT3>::type ibeta_inv(RT1 a, RT2 b, RT3 p, const Policy&); // Incomplete beta inverse function. template <class RT1, class RT2, class RT3> - typename tools::promote_args<RT1, RT2, RT3>::type + typename tools::promote_args<RT1, RT2, RT3>::type ibeta_inva(RT1 a, RT2 b, RT3 p); // Incomplete beta inverse function. template <class RT1, class RT2, class RT3, class Policy> - typename tools::promote_args<RT1, RT2, RT3>::type + typename tools::promote_args<RT1, RT2, RT3>::type ibeta_inva(RT1 a, RT2 b, RT3 p, const Policy&); // Incomplete beta inverse function. template <class RT1, class RT2, class RT3> - typename tools::promote_args<RT1, RT2, RT3>::type + typename tools::promote_args<RT1, RT2, RT3>::type ibeta_invb(RT1 a, RT2 b, RT3 p); // Incomplete beta inverse function. template <class RT1, class RT2, class RT3, class Policy> - typename tools::promote_args<RT1, RT2, RT3>::type + typename tools::promote_args<RT1, RT2, RT3>::type ibeta_invb(RT1 a, RT2 b, RT3 p, const Policy&); // Incomplete beta inverse function. template <class T1, class T2, class T3, class T4> - typename tools::promote_args<T1, T2, T3, T4>::type + typename tools::promote_args<T1, T2, T3, T4>::type ibetac_inv(T1 a, T2 b, T3 q, T4* py); template <class T1, class T2, class T3, class T4, class Policy> - typename tools::promote_args<T1, T2, T3, T4>::type + typename tools::promote_args<T1, T2, T3, T4>::type ibetac_inv(T1 a, T2 b, T3 q, T4* py, const Policy& pol); template <class RT1, class RT2, class RT3> - typename tools::promote_args<RT1, RT2, RT3>::type + typename tools::promote_args<RT1, RT2, RT3>::type ibetac_inv(RT1 a, RT2 b, RT3 q); // Incomplete beta complement inverse function. template <class RT1, class RT2, class RT3, class Policy> - typename tools::promote_args<RT1, RT2, RT3>::type + typename tools::promote_args<RT1, RT2, RT3>::type ibetac_inv(RT1 a, RT2 b, RT3 q, const Policy&); // Incomplete beta complement inverse function. template <class RT1, class RT2, class RT3> - typename tools::promote_args<RT1, RT2, RT3>::type + typename tools::promote_args<RT1, RT2, RT3>::type ibetac_inva(RT1 a, RT2 b, RT3 q); // Incomplete beta complement inverse function. template <class RT1, class RT2, class RT3, class Policy> - typename tools::promote_args<RT1, RT2, RT3>::type + typename tools::promote_args<RT1, RT2, RT3>::type ibetac_inva(RT1 a, RT2 b, RT3 q, const Policy&); // Incomplete beta complement inverse function. template <class RT1, class RT2, class RT3> - typename tools::promote_args<RT1, RT2, RT3>::type + typename tools::promote_args<RT1, RT2, RT3>::type ibetac_invb(RT1 a, RT2 b, RT3 q); // Incomplete beta complement inverse function. template <class RT1, class RT2, class RT3, class Policy> - typename tools::promote_args<RT1, RT2, RT3>::type + typename tools::promote_args<RT1, RT2, RT3>::type ibetac_invb(RT1 a, RT2 b, RT3 q, const Policy&); // Incomplete beta complement inverse function. template <class RT1, class RT2, class RT3> - typename tools::promote_args<RT1, RT2, RT3>::type + typename tools::promote_args<RT1, RT2, RT3>::type ibeta_derivative(RT1 a, RT2 b, RT3 x); // derivative of incomplete beta template <class RT1, class RT2, class RT3, class Policy> - typename tools::promote_args<RT1, RT2, RT3>::type + typename tools::promote_args<RT1, RT2, RT3>::type ibeta_derivative(RT1 a, RT2 b, RT3 x, const Policy& pol); // derivative of incomplete beta // erf & erfc error functions. @@ -168,51 +168,51 @@ namespace boost // Polynomials: template <class T1, class T2, class T3> - typename tools::promote_args<T1, T2, T3>::type + typename tools::promote_args<T1, T2, T3>::type legendre_next(unsigned l, T1 x, T2 Pl, T3 Plm1); template <class T> - typename tools::promote_args<T>::type + typename tools::promote_args<T>::type legendre_p(int l, T x); template <class T, class Policy> - typename tools::promote_args<T>::type + typename tools::promote_args<T>::type legendre_p(int l, T x, const Policy& pol); template <class T> - typename tools::promote_args<T>::type + typename tools::promote_args<T>::type legendre_q(unsigned l, T x); template <class T, class Policy> - typename tools::promote_args<T>::type + typename tools::promote_args<T>::type legendre_q(unsigned l, T x, const Policy& pol); template <class T1, class T2, class T3> - typename tools::promote_args<T1, T2, T3>::type + typename tools::promote_args<T1, T2, T3>::type legendre_next(unsigned l, unsigned m, T1 x, T2 Pl, T3 Plm1); template <class T> - typename tools::promote_args<T>::type + typename tools::promote_args<T>::type legendre_p(int l, int m, T x); template <class T, class Policy> - typename tools::promote_args<T>::type + typename tools::promote_args<T>::type legendre_p(int l, int m, T x, const Policy& pol); template <class T1, class T2, class T3> - typename tools::promote_args<T1, T2, T3>::type + typename tools::promote_args<T1, T2, T3>::type laguerre_next(unsigned n, T1 x, T2 Ln, T3 Lnm1); template <class T1, class T2, class T3> - typename tools::promote_args<T1, T2, T3>::type + typename tools::promote_args<T1, T2, T3>::type laguerre_next(unsigned n, unsigned l, T1 x, T2 Pl, T3 Plm1); template <class T> - typename tools::promote_args<T>::type + typename tools::promote_args<T>::type laguerre(unsigned n, T x); template <class T, class Policy> - typename tools::promote_args<T>::type + typename tools::promote_args<T>::type laguerre(unsigned n, unsigned m, T x, const Policy& pol); template <class T1, class T2> @@ -226,76 +226,76 @@ namespace boost }; template <class T1, class T2> - typename laguerre_result<T1, T2>::type + typename laguerre_result<T1, T2>::type laguerre(unsigned n, T1 m, T2 x); template <class T> - typename tools::promote_args<T>::type + typename tools::promote_args<T>::type hermite(unsigned n, T x); template <class T, class Policy> - typename tools::promote_args<T>::type + typename tools::promote_args<T>::type hermite(unsigned n, T x, const Policy& pol); template <class T1, class T2, class T3> - typename tools::promote_args<T1, T2, T3>::type + typename tools::promote_args<T1, T2, T3>::type hermite_next(unsigned n, T1 x, T2 Hn, T3 Hnm1); template <class T1, class T2> - std::complex<typename tools::promote_args<T1, T2>::type> + std::complex<typename tools::promote_args<T1, T2>::type> spherical_harmonic(unsigned n, int m, T1 theta, T2 phi); template <class T1, class T2, class Policy> - std::complex<typename tools::promote_args<T1, T2>::type> + std::complex<typename tools::promote_args<T1, T2>::type> spherical_harmonic(unsigned n, int m, T1 theta, T2 phi, const Policy& pol); template <class T1, class T2> - typename tools::promote_args<T1, T2>::type + typename tools::promote_args<T1, T2>::type spherical_harmonic_r(unsigned n, int m, T1 theta, T2 phi); template <class T1, class T2, class Policy> - typename tools::promote_args<T1, T2>::type + typename tools::promote_args<T1, T2>::type spherical_harmonic_r(unsigned n, int m, T1 theta, T2 phi, const Policy& pol); template <class T1, class T2> - typename tools::promote_args<T1, T2>::type + typename tools::promote_args<T1, T2>::type spherical_harmonic_i(unsigned n, int m, T1 theta, T2 phi); template <class T1, class T2, class Policy> - typename tools::promote_args<T1, T2>::type + typename tools::promote_args<T1, T2>::type spherical_harmonic_i(unsigned n, int m, T1 theta, T2 phi, const Policy& pol); // Elliptic integrals: template <class T1, class T2, class T3> - typename tools::promote_args<T1, T2, T3>::type + typename tools::promote_args<T1, T2, T3>::type ellint_rf(T1 x, T2 y, T3 z); template <class T1, class T2, class T3, class Policy> - typename tools::promote_args<T1, T2, T3>::type + typename tools::promote_args<T1, T2, T3>::type ellint_rf(T1 x, T2 y, T3 z, const Policy& pol); template <class T1, class T2, class T3> - typename tools::promote_args<T1, T2, T3>::type + typename tools::promote_args<T1, T2, T3>::type ellint_rd(T1 x, T2 y, T3 z); template <class T1, class T2, class T3, class Policy> - typename tools::promote_args<T1, T2, T3>::type + typename tools::promote_args<T1, T2, T3>::type ellint_rd(T1 x, T2 y, T3 z, const Policy& pol); template <class T1, class T2> - typename tools::promote_args<T1, T2>::type + typename tools::promote_args<T1, T2>::type ellint_rc(T1 x, T2 y); template <class T1, class T2, class Policy> - typename tools::promote_args<T1, T2>::type + typename tools::promote_args<T1, T2>::type ellint_rc(T1 x, T2 y, const Policy& pol); template <class T1, class T2, class T3, class T4> - typename tools::promote_args<T1, T2, T3, T4>::type + typename tools::promote_args<T1, T2, T3, T4>::type ellint_rj(T1 x, T2 y, T3 z, T4 p); template <class T1, class T2, class T3, class T4, class Policy> - typename tools::promote_args<T1, T2, T3, T4>::type + typename tools::promote_args<T1, T2, T3, T4>::type ellint_rj(T1 x, T2 y, T3 z, T4 p, const Policy& pol); template <typename T> @@ -349,7 +349,7 @@ namespace boost template <class RT, class Policy> RT factorial(unsigned int, const Policy& pol); template <class RT> - RT unchecked_factorial(unsigned int BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(RT)); + RT unchecked_factorial(unsigned int BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(RT)); template <class RT> RT double_factorial(unsigned i); template <class RT, class Policy> @@ -465,11 +465,11 @@ namespace boost // Hypotenuse function sqrt(x ^ 2 + y ^ 2). template <class T1, class T2> - typename tools::promote_args<T1, T2>::type + typename tools::promote_args<T1, T2>::type hypot(T1 x, T2 y); template <class T1, class T2, class Policy> - typename tools::promote_args<T1, T2>::type + typename tools::promote_args<T1, T2>::type hypot(T1 x, T2 y, const Policy&); // cbrt - cube root. @@ -502,11 +502,11 @@ namespace boost // Power - 1 template <class T1, class T2> - typename tools::promote_args<T1, T2>::type + typename tools::promote_args<T1, T2>::type powm1(const T1 a, const T2 z); template <class T1, class T2, class Policy> - typename tools::promote_args<T1, T2>::type + typename tools::promote_args<T1, T2>::type powm1(const T1 a, const T2 z, const Policy&); // sqrt(1+x) - 1 @@ -580,47 +580,109 @@ namespace boost // Bessel functions: template <class T1, class T2, class Policy> typename detail::bessel_traits<T1, T2, Policy>::result_type cyl_bessel_j(T1 v, T2 x, const Policy& pol); + template <class T1, class T2, class Policy> + typename detail::bessel_traits<T1, T2, Policy>::result_type cyl_bessel_j_prime(T1 v, T2 x, const Policy& pol); template <class T1, class T2> typename detail::bessel_traits<T1, T2, policies::policy<> >::result_type cyl_bessel_j(T1 v, T2 x); + template <class T1, class T2> + typename detail::bessel_traits<T1, T2, policies::policy<> >::result_type cyl_bessel_j_prime(T1 v, T2 x); template <class T, class Policy> typename detail::bessel_traits<T, T, Policy>::result_type sph_bessel(unsigned v, T x, const Policy& pol); + template <class T, class Policy> + typename detail::bessel_traits<T, T, Policy>::result_type sph_bessel_prime(unsigned v, T x, const Policy& pol); template <class T> typename detail::bessel_traits<T, T, policies::policy<> >::result_type sph_bessel(unsigned v, T x); + template <class T> + typename detail::bessel_traits<T, T, policies::policy<> >::result_type sph_bessel_prime(unsigned v, T x); template <class T1, class T2, class Policy> typename detail::bessel_traits<T1, T2, Policy>::result_type cyl_bessel_i(T1 v, T2 x, const Policy& pol); + template <class T1, class T2, class Policy> + typename detail::bessel_traits<T1, T2, Policy>::result_type cyl_bessel_i_prime(T1 v, T2 x, const Policy& pol); template <class T1, class T2> typename detail::bessel_traits<T1, T2, policies::policy<> >::result_type cyl_bessel_i(T1 v, T2 x); + template <class T1, class T2> + typename detail::bessel_traits<T1, T2, policies::policy<> >::result_type cyl_bessel_i_prime(T1 v, T2 x); template <class T1, class T2, class Policy> typename detail::bessel_traits<T1, T2, Policy>::result_type cyl_bessel_k(T1 v, T2 x, const Policy& pol); + template <class T1, class T2, class Policy> + typename detail::bessel_traits<T1, T2, Policy>::result_type cyl_bessel_k_prime(T1 v, T2 x, const Policy& pol); template <class T1, class T2> typename detail::bessel_traits<T1, T2, policies::policy<> >::result_type cyl_bessel_k(T1 v, T2 x); + template <class T1, class T2> + typename detail::bessel_traits<T1, T2, policies::policy<> >::result_type cyl_bessel_k_prime(T1 v, T2 x); template <class T1, class T2, class Policy> typename detail::bessel_traits<T1, T2, Policy>::result_type cyl_neumann(T1 v, T2 x, const Policy& pol); + template <class T1, class T2, class Policy> + typename detail::bessel_traits<T1, T2, Policy>::result_type cyl_neumann_prime(T1 v, T2 x, const Policy& pol); template <class T1, class T2> typename detail::bessel_traits<T1, T2, policies::policy<> >::result_type cyl_neumann(T1 v, T2 x); + template <class T1, class T2> + typename detail::bessel_traits<T1, T2, policies::policy<> >::result_type cyl_neumann_prime(T1 v, T2 x); template <class T, class Policy> typename detail::bessel_traits<T, T, Policy>::result_type sph_neumann(unsigned v, T x, const Policy& pol); + template <class T, class Policy> + typename detail::bessel_traits<T, T, Policy>::result_type sph_neumann_prime(unsigned v, T x, const Policy& pol); template <class T> typename detail::bessel_traits<T, T, policies::policy<> >::result_type sph_neumann(unsigned v, T x); + template <class T> + typename detail::bessel_traits<T, T, policies::policy<> >::result_type sph_neumann_prime(unsigned v, T 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 T, class Policy> + typename detail::bessel_traits<T, T, Policy>::result_type cyl_bessel_j_zero(T v, int m, const Policy& pol); + + template <class T> + typename detail::bessel_traits<T, T, policies::policy<> >::result_type cyl_bessel_j_zero(T v, int m); + + template <class T, class OutputIterator> + OutputIterator cyl_bessel_j_zero(T v, + int start_index, + unsigned number_of_zeros, + OutputIterator out_it); + + template <class T, class OutputIterator, class Policy> + OutputIterator cyl_bessel_j_zero(T v, + int start_index, + unsigned number_of_zeros, + OutputIterator out_it, + const Policy&); + + template <class T, class Policy> + typename detail::bessel_traits<T, T, Policy>::result_type cyl_neumann_zero(T v, int m, const Policy& pol); + + template <class T> + typename detail::bessel_traits<T, T, policies::policy<> >::result_type cyl_neumann_zero(T v, int m); + + template <class T, class OutputIterator> + OutputIterator cyl_neumann_zero(T v, + int start_index, + unsigned number_of_zeros, + OutputIterator out_it); + + template <class T, class OutputIterator, class Policy> + OutputIterator cyl_neumann_zero(T v, + int start_index, + unsigned number_of_zeros, + OutputIterator out_it, + 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> @@ -662,6 +724,40 @@ namespace boost template <class T> typename tools::promote_args<T>::type airy_bi_prime(T x); + template <class T> + T airy_ai_zero(int m); + template <class T, class Policy> + T airy_ai_zero(int m, const Policy&); + + template <class OutputIterator> + OutputIterator airy_ai_zero( + int start_index, + unsigned number_of_zeros, + OutputIterator out_it); + template <class OutputIterator, class Policy> + OutputIterator airy_ai_zero( + int start_index, + unsigned number_of_zeros, + OutputIterator out_it, + const Policy&); + + template <class T> + T airy_bi_zero(int m); + template <class T, class Policy> + T airy_bi_zero(int m, const Policy&); + + template <class OutputIterator> + OutputIterator airy_bi_zero( + int start_index, + unsigned number_of_zeros, + OutputIterator out_it); + template <class OutputIterator, class Policy> + OutputIterator airy_bi_zero( + int start_index, + unsigned number_of_zeros, + OutputIterator out_it, + const Policy&); + template <class T, class Policy> typename tools::promote_args<T>::type sin_pi(T x, const Policy&); @@ -689,17 +785,17 @@ namespace boost template <class T> bool isnormal BOOST_NO_MACRO_EXPAND(T t); - template<class T> + template<class T> int signbit BOOST_NO_MACRO_EXPAND(T x); template <class T> int sign BOOST_NO_MACRO_EXPAND(const T& z); - template <class T> - T copysign BOOST_NO_MACRO_EXPAND(const T& x, const T& y); + template <class T, class U> + typename tools::promote_args_permissive<T, U>::type copysign BOOST_NO_MACRO_EXPAND(const T& x, const U& y); template <class T> - T changesign BOOST_NO_MACRO_EXPAND(const T& z); + typename tools::promote_args_permissive<T>::type changesign BOOST_NO_MACRO_EXPAND(const T& z); // Exponential integrals: namespace detail{ @@ -737,11 +833,11 @@ namespace boost typename tools::promote_args<T1, T2>::type owens_t(T1 h, T2 a); // Jacobi Functions: - template <class T, class Policy> - typename tools::promote_args<T>::type jacobi_elliptic(T k, T theta, T* pcn, T* pdn, const Policy&); + template <class T, class U, class V, class Policy> + typename tools::promote_args<T, U, V>::type jacobi_elliptic(T k, U theta, V* pcn, V* pdn, const Policy&); - template <class T> - typename tools::promote_args<T>::type jacobi_elliptic(T k, T theta, T* pcn = 0, T* pdn = 0); + template <class T, class U, class V> + typename tools::promote_args<T, U, V>::type jacobi_elliptic(T k, U theta, V* pcn = 0, V* pdn = 0); template <class U, class T, class Policy> typename tools::promote_args<T, U>::type jacobi_sn(U k, T theta, const Policy& pol); @@ -827,22 +923,55 @@ namespace boost typename tools::promote_args<T>::type pow(T base); // next: + template <class T, class U, class Policy> + typename tools::promote_args<T, U>::type nextafter(const T&, const U&, const Policy&); + template <class T, class U> + typename tools::promote_args<T, U>::type nextafter(const T&, const U&); + template <class T, class Policy> + typename tools::promote_args<T>::type float_next(const T&, const Policy&); + template <class T> + typename tools::promote_args<T>::type float_next(const T&); template <class T, class Policy> - T nextafter(const T&, const T&, const Policy&); + typename tools::promote_args<T>::type float_prior(const T&, const Policy&); template <class T> - T nextafter(const T&, const T&); + typename tools::promote_args<T>::type float_prior(const T&); + template <class T, class U, class Policy> + typename tools::promote_args<T, U>::type float_distance(const T&, const U&, const Policy&); + template <class T, class U> + typename tools::promote_args<T, U>::type float_distance(const T&, const U&); template <class T, class Policy> - T float_next(const T&, const Policy&); + typename tools::promote_args<T>::type float_advance(T val, int distance, const Policy& pol); template <class T> - T float_next(const T&); + typename tools::promote_args<T>::type float_advance(const T& val, int distance); + + template<class T> + T unchecked_bernoulli_b2n(const std::size_t n); template <class T, class Policy> - T float_prior(const T&, const Policy&); + T bernoulli_b2n(const int i, const Policy &pol); template <class T> - T float_prior(const T&); + T bernoulli_b2n(const int i); + template <class T, class OutputIterator, class Policy> + OutputIterator bernoulli_b2n(const int start_index, + const unsigned number_of_bernoullis_b2n, + OutputIterator out_it, + const Policy& pol); + template <class T, class OutputIterator> + OutputIterator bernoulli_b2n(const int start_index, + const unsigned number_of_bernoullis_b2n, + OutputIterator out_it); template <class T, class Policy> - T float_distance(const T&, const T&, const Policy&); + T tangent_t2n(const int i, const Policy &pol); template <class T> - T float_distance(const T&, const T&); + T tangent_t2n(const int i); + template <class T, class OutputIterator, class Policy> + OutputIterator tangent_t2n(const int start_index, + const unsigned number_of_bernoullis_b2n, + OutputIterator out_it, + const Policy& pol); + template <class T, class OutputIterator> + OutputIterator tangent_t2n(const int start_index, + const unsigned number_of_bernoullis_b2n, + OutputIterator out_it); } // namespace math } // namespace boost @@ -1118,27 +1247,73 @@ namespace boost inline typename boost::math::detail::bessel_traits<T1, T2, Policy >::result_type cyl_bessel_j(T1 v, T2 x)\ { return boost::math::cyl_bessel_j(v, x, Policy()); }\ \ + template <class T1, class T2>\ + inline typename boost::math::detail::bessel_traits<T1, T2, Policy >::result_type cyl_bessel_j_prime(T1 v, T2 x)\ + { return boost::math::cyl_bessel_j_prime(v, x, Policy()); }\ +\ template <class T>\ inline typename boost::math::detail::bessel_traits<T, T, Policy >::result_type sph_bessel(unsigned v, T x)\ { return boost::math::sph_bessel(v, x, Policy()); }\ \ + template <class T>\ + inline typename boost::math::detail::bessel_traits<T, T, Policy >::result_type sph_bessel_prime(unsigned v, T x)\ + { return boost::math::sph_bessel_prime(v, x, Policy()); }\ +\ template <class T1, class T2>\ inline typename boost::math::detail::bessel_traits<T1, T2, Policy >::result_type \ cyl_bessel_i(T1 v, T2 x) { return boost::math::cyl_bessel_i(v, x, Policy()); }\ \ template <class T1, class T2>\ inline typename boost::math::detail::bessel_traits<T1, T2, Policy >::result_type \ + cyl_bessel_i_prime(T1 v, T2 x) { return boost::math::cyl_bessel_i_prime(v, x, Policy()); }\ +\ + template <class T1, class T2>\ + inline typename boost::math::detail::bessel_traits<T1, T2, Policy >::result_type \ cyl_bessel_k(T1 v, T2 x) { return boost::math::cyl_bessel_k(v, x, Policy()); }\ \ template <class T1, class T2>\ inline typename boost::math::detail::bessel_traits<T1, T2, Policy >::result_type \ + cyl_bessel_k_prime(T1 v, T2 x) { return boost::math::cyl_bessel_k_prime(v, x, Policy()); }\ +\ + template <class T1, class T2>\ + inline typename boost::math::detail::bessel_traits<T1, T2, Policy >::result_type \ cyl_neumann(T1 v, T2 x){ return boost::math::cyl_neumann(v, x, Policy()); }\ \ + template <class T1, class T2>\ + inline typename boost::math::detail::bessel_traits<T1, T2, Policy >::result_type \ + cyl_neumann_prime(T1 v, T2 x){ return boost::math::cyl_neumann_prime(v, x, Policy()); }\ +\ template <class T>\ inline typename boost::math::detail::bessel_traits<T, T, Policy >::result_type \ sph_neumann(unsigned v, T x){ return boost::math::sph_neumann(v, x, Policy()); }\ \ template <class T>\ + inline typename boost::math::detail::bessel_traits<T, T, Policy >::result_type \ + sph_neumann_prime(unsigned v, T x){ return boost::math::sph_neumann_prime(v, x, Policy()); }\ +\ + template <class T>\ + inline typename boost::math::detail::bessel_traits<T, T, Policy >::result_type cyl_bessel_j_zero(T v, int m)\ + { return boost::math::cyl_bessel_j_zero(v, m, Policy()); }\ +\ +template <class OutputIterator, class T>\ + inline void cyl_bessel_j_zero(T v,\ + int start_index,\ + unsigned number_of_zeros,\ + OutputIterator out_it)\ + { boost::math::cyl_bessel_j_zero(v, start_index, number_of_zeros, out_it, Policy()); }\ +\ + template <class T>\ + inline typename boost::math::detail::bessel_traits<T, T, Policy >::result_type cyl_neumann_zero(T v, int m)\ + { return boost::math::cyl_neumann_zero(v, m, Policy()); }\ +\ +template <class OutputIterator, class T>\ + inline void cyl_neumann_zero(T v,\ + int start_index,\ + unsigned number_of_zeros,\ + OutputIterator out_it)\ + { boost::math::cyl_neumann_zero(v, start_index, number_of_zeros, out_it, Policy()); }\ +\ + template <class T>\ inline typename boost::math::tools::promote_args<T>::type sin_pi(T x){ return boost::math::sin_pi(x); }\ \ template <class T>\ @@ -1286,6 +1461,34 @@ namespace boost inline typename boost::math::tools::promote_args<T>::type airy_bi_prime(T x)\ { return boost::math::airy_bi_prime(x, Policy()); }\ \ + template <class T>\ + inline T airy_ai_zero(int m)\ + { return boost::math::airy_ai_zero<T>(m, Policy()); }\ + template <class T, class OutputIterator>\ + OutputIterator airy_ai_zero(int start_index, unsigned number_of_zeros, OutputIterator out_it)\ + { return boost::math::airy_ai_zero<T>(start_index, number_of_zeros, out_it, Policy()); }\ + \ + template <class T>\ + inline T airy_bi_zero(int m)\ + { return boost::math::airy_bi_zero<T>(m, Policy()); }\ + template <class T, class OutputIterator>\ + OutputIterator airy_bi_zero(int start_index, unsigned number_of_zeros, OutputIterator out_it)\ + { return boost::math::airy_bi_zero<T>(start_index, number_of_zeros, out_it, Policy()); }\ + \ + template <class T>\ + T bernoulli_b2n(const int i)\ + { return boost::math::bernoulli_b2n<T>(i, Policy()); }\ + template <class T, class OutputIterator>\ + OutputIterator bernoulli_b2n(int start_index, unsigned number_of_bernoullis_b2n, OutputIterator out_it)\ + { return boost::math::bernoulli_b2n<T>(start_index, number_of_bernoullis_b2n, out_it, Policy()); }\ + \ + template <class T>\ + T tangent_t2n(const int i)\ + { return boost::math::tangent_t2n<T>(i, Policy()); }\ + template <class T, class OutputIterator>\ + OutputIterator tangent_t2n(int start_index, unsigned number_of_bernoullis_b2n, OutputIterator out_it)\ + { return boost::math::tangent_t2n<T>(start_index, number_of_bernoullis_b2n, out_it, Policy()); }\ + \ diff --git a/3rdParty/Boost/src/boost/math/special_functions/sign.hpp b/3rdParty/Boost/src/boost/math/special_functions/sign.hpp index 6de88b2..f5c562d 100644 --- a/3rdParty/Boost/src/boost/math/special_functions/sign.hpp +++ b/3rdParty/Boost/src/boost/math/special_functions/sign.hpp @@ -31,7 +31,10 @@ namespace detail { } #endif - template<class T> + // Generic versions first, note that these do not handle + // signed zero or NaN. + + template<class T> inline int signbit_impl(T x, generic_tag<true> const&) { return x < 0; @@ -43,7 +46,25 @@ namespace detail { return x < 0; } - template<class T> +#if defined(__GNUC__) && (LDBL_MANT_DIG == 106) + // + // Special handling for GCC's "double double" type, + // in this case the sign is the same as the sign we + // get by casting to double, no overflow/underflow + // can occur since the exponents are the same magnitude + // for the two types: + // + inline int signbit_impl(long double x, generic_tag<true> const&) + { + return boost::math::signbit(static_cast<double>(x)); + } + inline int signbit_impl(long double x, generic_tag<false> const&) + { + return boost::math::signbit(static_cast<double>(x)); + } +#endif + + template<class T> inline int signbit_impl(T x, ieee_copy_all_bits_tag const&) { typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits; @@ -65,6 +86,9 @@ namespace detail { } // Changesign + + // Generic versions first, note that these do not handle + // signed zero or NaN. template<class T> inline T (changesign_impl)(T x, generic_tag<true> const&) @@ -77,7 +101,27 @@ namespace detail { { return -x; } - +#if defined(__GNUC__) && (LDBL_MANT_DIG == 106) + // + // Special handling for GCC's "double double" type, + // in this case we need to change the sign of both + // components of the "double double": + // + inline long double (changesign_impl)(long double x, generic_tag<true> const&) + { + double* pd = reinterpret_cast<double*>(&x); + pd[0] = boost::math::changesign(pd[0]); + pd[1] = boost::math::changesign(pd[1]); + return x; + } + inline long double (changesign_impl)(long double x, generic_tag<false> const&) + { + double* pd = reinterpret_cast<double*>(&x); + pd[0] = boost::math::changesign(pd[0]); + pd[1] = boost::math::changesign(pd[1]); + return x; + } +#endif template<class T> inline T changesign_impl(T x, ieee_copy_all_bits_tag const&) @@ -110,8 +154,9 @@ template<class T> int (signbit)(T x) { typedef typename detail::fp_traits<T>::type traits; typedef typename traits::method method; - typedef typename boost::is_floating_point<T>::type fp_tag; - return detail::signbit_impl(x, method()); + // typedef typename boost::is_floating_point<T>::type fp_tag; + typedef typename tools::promote_args_permissive<T>::type result_type; + return detail::signbit_impl(static_cast<result_type>(x), method()); } template <class T> @@ -120,20 +165,24 @@ inline int sign BOOST_NO_MACRO_EXPAND(const T& z) return (z == 0) ? 0 : (boost::math::signbit)(z) ? -1 : 1; } -template<class T> T (changesign)(const T& x) +template <class T> typename tools::promote_args_permissive<T>::type (changesign)(const T& x) { //!< \brief return unchanged binary pattern of x, except for change of sign bit. typedef typename detail::fp_traits<T>::sign_change_type traits; typedef typename traits::method method; - typedef typename boost::is_floating_point<T>::type fp_tag; + // typedef typename boost::is_floating_point<T>::type fp_tag; + typedef typename tools::promote_args_permissive<T>::type result_type; - return detail::changesign_impl(x, method()); + return detail::changesign_impl(static_cast<result_type>(x), method()); } -template <class T> -inline T copysign BOOST_NO_MACRO_EXPAND(const T& x, const T& y) +template <class T, class U> +inline typename tools::promote_args_permissive<T, U>::type + copysign BOOST_NO_MACRO_EXPAND(const T& x, const U& y) { BOOST_MATH_STD_USING - return (boost::math::signbit)(x) != (boost::math::signbit)(y) ? (boost::math::changesign)(x) : x; + typedef typename tools::promote_args_permissive<T, U>::type result_type; + return (boost::math::signbit)(static_cast<result_type>(x)) != (boost::math::signbit)(static_cast<result_type>(y)) + ? (boost::math::changesign)(static_cast<result_type>(x)) : static_cast<result_type>(x); } } // namespace math diff --git a/3rdParty/Boost/src/boost/math/tools/config.hpp b/3rdParty/Boost/src/boost/math/tools/config.hpp index b1fcd13..4ec5768 100644 --- a/3rdParty/Boost/src/boost/math/tools/config.hpp +++ b/3rdParty/Boost/src/boost/math/tools/config.hpp @@ -13,6 +13,7 @@ #include <boost/config.hpp> #include <boost/cstdint.hpp> // for boost::uintmax_t #include <boost/detail/workaround.hpp> +#include <boost/type_traits/is_integral.hpp> #include <algorithm> // for min and max #include <boost/config/no_tr1/cmath.hpp> #include <climits> @@ -20,9 +21,11 @@ #if (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)) # include <math.h> #endif +#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS +# include <limits> +#endif #include <boost/math/tools/user.hpp> -#include <boost/math/special_functions/detail/round_fwd.hpp> #if (defined(__CYGWIN__) || defined(__FreeBSD__) || defined(__NetBSD__) \ || (defined(__hppa) && !defined(__OpenBSD__)) || (defined(__NO_LONG_DOUBLE_MATH) && (DBL_MANT_DIG != LDBL_MANT_DIG))) \ @@ -99,13 +102,18 @@ # define BOOST_MATH_USE_C99 #endif +#if defined(_LIBCPP_VERSION) && !defined(_MSC_VER) +# define BOOST_MATH_USE_C99 +#endif + #if defined(__CYGWIN__) || defined(__HP_aCC) || defined(BOOST_INTEL) \ || defined(BOOST_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY) \ - || (defined(__GNUC__) && !defined(BOOST_MATH_USE_C99)) + || (defined(__GNUC__) && !defined(BOOST_MATH_USE_C99))\ + || defined(BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS) # define BOOST_MATH_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY #endif -#if defined(BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS) || BOOST_WORKAROUND(__SUNPRO_CC, <= 0x590) +#if BOOST_WORKAROUND(__SUNPRO_CC, <= 0x590) # include "boost/type.hpp" # include "boost/non_type.hpp" @@ -139,12 +147,12 @@ # define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) -#endif // defined BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS +#endif // __SUNPRO_CC #if (defined(__SUNPRO_CC) || defined(__hppa) || defined(__GNUC__)) && !defined(BOOST_MATH_SMALL_CONSTANT) // Sun's compiler emits a hard error if a constant underflows, // as does aCC on PA-RISC, while gcc issues a large number of warnings: -# define BOOST_MATH_SMALL_CONSTANT(x) 0 +# define BOOST_MATH_SMALL_CONSTANT(x) 0.0 #else # define BOOST_MATH_SMALL_CONSTANT(x) x #endif @@ -203,6 +211,37 @@ #ifndef BOOST_MATH_INT_VALUE_SUFFIX # define BOOST_MATH_INT_VALUE_SUFFIX(RV, SUF) RV##SUF #endif +// +// Test whether to support __float128: +// +#if defined(_GLIBCXX_USE_FLOAT128) && defined(BOOST_GCC) && !defined(__STRICT_ANSI__) \ + && !defined(BOOST_MATH_DISABLE_FLOAT128) || defined(BOOST_MATH_USE_FLOAT128) +// +// Only enable this when the compiler really is GCC as clang and probably +// intel too don't support __float128 yet :-( +// +#ifndef BOOST_MATH_USE_FLOAT128 +# define BOOST_MATH_USE_FLOAT128 +#endif + +# if defined(BOOST_INTEL) && defined(BOOST_INTEL_CXX_VERSION) && (BOOST_INTEL_CXX_VERSION >= 1310) && defined(__GNUC__) +# if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) +# define BOOST_MATH_FLOAT128_TYPE __float128 +# endif +# elif defined(__GNUC__) +# define BOOST_MATH_FLOAT128_TYPE __float128 +# endif + +# ifndef BOOST_MATH_FLOAT128_TYPE +# define BOOST_MATH_FLOAT128_TYPE _Quad +# endif +#endif +// +// Check for WinCE with no iostream support: +// +#if defined(_WIN32_WCE) && !defined(__SGI_STL_PORT) +# define BOOST_MATH_NO_LEXICAL_CAST +#endif // // Helper macro for controlling the FP behaviour: @@ -213,7 +252,7 @@ // // Helper macro for using statements: // -#define BOOST_MATH_STD_USING \ +#define BOOST_MATH_STD_USING_CORE \ using std::abs;\ using std::acos;\ using std::cos;\ @@ -236,15 +275,9 @@ using std::ceil;\ using std::floor;\ using std::log10;\ - using std::sqrt;\ - using boost::math::round;\ - using boost::math::iround;\ - using boost::math::lround;\ - using boost::math::trunc;\ - using boost::math::itrunc;\ - using boost::math::ltrunc;\ - using boost::math::modf; + using std::sqrt; +#define BOOST_MATH_STD_USING BOOST_MATH_STD_USING_CORE namespace boost{ namespace math{ namespace tools @@ -269,9 +302,35 @@ void suppress_unused_variable_warning(const T&) { } +namespace detail{ + +template <class T> +struct is_integer_for_rounding +{ + static const bool value = boost::is_integral<T>::value +#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS + || (std::numeric_limits<T>::is_specialized && std::numeric_limits<T>::is_integer) +#endif + ; +}; + +} + }} // namespace boost namespace math -#if ((defined(__linux__) && !defined(__UCLIBC__)) || defined(__QNX__) || defined(__IBMCPP__)) && !defined(BOOST_NO_FENV_H) +#ifdef __GLIBC_PREREQ +# if __GLIBC_PREREQ(2,14) +# define BOOST_MATH_HAVE_FIXED_GLIBC +# endif +#endif + +#if ((defined(__linux__) && !defined(__UCLIBC__) && !defined(BOOST_MATH_HAVE_FIXED_GLIBC)) || defined(__QNX__) || defined(__IBMCPP__)) && !defined(BOOST_NO_FENV_H) +// +// This code was introduced in response to this glibc bug: http://sourceware.org/bugzilla/show_bug.cgi?id=2445 +// Basically powl and expl can return garbage when the result is small and certain exception flags are set +// on entrance to these functions. This appears to have been fixed in Glibc 2.14 (May 2011). +// Much more information in this message thread: https://groups.google.com/forum/#!topic/boost-list/ZT99wtIFlb4 +// #include <boost/detail/fenv.hpp> @@ -314,12 +373,20 @@ namespace boost{ namespace math{ #endif #ifdef BOOST_MATH_INSTRUMENT -#define BOOST_MATH_INSTRUMENT_CODE(x) \ - std::cout << std::setprecision(35) << __FILE__ << ":" << __LINE__ << " " << x << std::endl; -#define BOOST_MATH_INSTRUMENT_VARIABLE(name) BOOST_MATH_INSTRUMENT_CODE(BOOST_STRINGIZE(name) << " = " << name) + +# include <iostream> +# include <iomanip> +# include <typeinfo> + +# define BOOST_MATH_INSTRUMENT_CODE(x) \ + std::cout << std::setprecision(35) << __FILE__ << ":" << __LINE__ << " " << x << std::endl; +# define BOOST_MATH_INSTRUMENT_VARIABLE(name) BOOST_MATH_INSTRUMENT_CODE(BOOST_STRINGIZE(name) << " = " << name) + #else -#define BOOST_MATH_INSTRUMENT_CODE(x) -#define BOOST_MATH_INSTRUMENT_VARIABLE(name) + +# define BOOST_MATH_INSTRUMENT_CODE(x) +# define BOOST_MATH_INSTRUMENT_VARIABLE(name) + #endif #endif // BOOST_MATH_TOOLS_CONFIG_HPP diff --git a/3rdParty/Boost/src/boost/math/tools/promotion.hpp b/3rdParty/Boost/src/boost/math/tools/promotion.hpp index 728aaf1..b3ad204 100644 --- a/3rdParty/Boost/src/boost/math/tools/promotion.hpp +++ b/3rdParty/Boost/src/boost/math/tools/promotion.hpp @@ -138,10 +138,35 @@ namespace boost // // Guard against use of long double if it's not supported: // - BOOST_STATIC_ASSERT((0 == ::boost::is_same<type, long double>::value)); + BOOST_STATIC_ASSERT_MSG((0 == ::boost::is_same<type, long double>::value), "Sorry, but this platform does not have sufficient long double support for the special functions to be reliably implemented."); #endif }; + // + // This struct is the same as above, but has no static assert on long double usage, + // it should be used only on functions that can be implemented for long double + // even when std lib support is missing or broken for that type. + // + template <class T1, class T2=float, class T3=float, class T4=float, class T5=float, class T6=float> + struct promote_args_permissive + { + typedef typename promote_args_2< + typename remove_cv<T1>::type, + typename promote_args_2< + typename remove_cv<T2>::type, + typename promote_args_2< + typename remove_cv<T3>::type, + typename promote_args_2< + typename remove_cv<T4>::type, + typename promote_args_2< + typename remove_cv<T5>::type, typename remove_cv<T6>::type + >::type + >::type + >::type + >::type + >::type type; + }; + } // namespace tools } // namespace math } // namespace boost diff --git a/3rdParty/Boost/src/boost/math/tools/user.hpp b/3rdParty/Boost/src/boost/math/tools/user.hpp index c1bdaf7..08a7e53 100644 --- a/3rdParty/Boost/src/boost/math/tools/user.hpp +++ b/3rdParty/Boost/src/boost/math/tools/user.hpp @@ -91,6 +91,14 @@ // Maximum root finding steps permitted: // // define BOOST_MATH_MAX_ROOT_ITERATION_POLICY 200 +// +// Enable use of __float128 in numeric constants: +// +// #define BOOST_MATH_USE_FLOAT128 +// +// Disable use of __float128 in numeric_constants even if the compiler looks to support it: +// +// #define BOOST_MATH_DISABLE_FLOAT128 #endif // BOOST_MATH_TOOLS_USER_HPP |