From f6724185c556b27f4aebc99cc618c10e14def14f Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Wed, 17 Jul 2024 17:11:07 -0400 Subject: [PATCH 01/64] Update name of library in CML --- CMakeLists.txt | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7e7790271..b21ab95ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,13 +5,13 @@ cmake_minimum_required(VERSION 3.5...3.16) -project(boost_math VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX) +project(boost_cuda_math VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX) -add_library(boost_math INTERFACE) +add_library(boost_cuda_math INTERFACE) -add_library(Boost::math ALIAS boost_math) +add_library(Boost::cuda_math ALIAS boost_cuda_math) -target_include_directories(boost_math INTERFACE include) +target_include_directories(boost_cuda_math INTERFACE include) include(CMakeDependentOption) @@ -21,11 +21,11 @@ message(STATUS "Boost.Math: standalone mode ${BOOST_MATH_STANDALONE}") if(BOOST_MATH_STANDALONE) - target_compile_definitions(boost_math INTERFACE BOOST_MATH_STANDALONE=1) + target_compile_definitions(boost_cuda_math INTERFACE BOOST_MATH_STANDALONE=1) else() - target_link_libraries(boost_math + target_link_libraries(boost_cuda_math INTERFACE Boost::assert Boost::concept_check @@ -41,6 +41,12 @@ else() endif() +if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt") + + add_subdirectory(test) + +endif() + # Only enable tests when we're the root project if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) @@ -49,4 +55,5 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) include(GNUInstallDirs) install(DIRECTORY "include/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") + endif() From 953bb3cc494dbae052a4bbc05975d5c07e15d363 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Wed, 17 Jul 2024 17:11:34 -0400 Subject: [PATCH 02/64] Update testing CML to use boost_test_jamfile --- test/CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index e63471c89..7875cda4c 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -2,4 +2,10 @@ # Distributed under the Boost Software License, Version 1.0. # https://www.boost.org/LICENSE_1_0.txt -add_subdirectory(compile_test) +include(BoostTestJamfile OPTIONAL RESULT_VARIABLE HAVE_BOOST_TEST) + +if(HAVE_BOOST_TEST) + + boost_test_jamfile(FILE cmake_jamfile LINK_LIBRARIES Boost::cuda_math Boost::assert Boost::concept_check Boost::config Boost::core Boost::integer Boost::lexical_cast Boost::multiprecision Boost::predef Boost::random Boost::static_assert Boost::throw_exception ) + +endif() From b8cc19aa2b9b967ce451fd15113e5e766a76f819 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Wed, 17 Jul 2024 17:11:45 -0400 Subject: [PATCH 03/64] Create new, trivial jamfile --- test/cmake_jamfile | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 test/cmake_jamfile diff --git a/test/cmake_jamfile b/test/cmake_jamfile new file mode 100644 index 000000000..2878e8c2a --- /dev/null +++ b/test/cmake_jamfile @@ -0,0 +1,13 @@ +# Copyright 2024 Matt Borland +# Distributed under the Boost Software License, Version 1.0. +# https://www.boost.org/LICENSE_1_0.txt + +import testing ; +import ../../config/checks/config : requires ; + +project : requirements + [ requires cxx14_decltype_auto cxx14_generic_lambdas cxx14_return_type_deduction cxx14_variable_templates cxx14_constexpr ] + ; + +run ccmath_abs_test.cpp ; +run ccmath_ceil_test.cpp ; From ed317e0af872b9a95defe6655ffe837c3a13f969 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Thu, 18 Jul 2024 09:17:17 -0400 Subject: [PATCH 04/64] Replace BOOST_MATH_CHECK_THROW with boost.test --- test/test_binomial.cpp | 23 +++++----- test/test_out_of_range.hpp | 88 +++++++++++++++++++------------------- 2 files changed, 55 insertions(+), 56 deletions(-) diff --git a/test/test_binomial.cpp b/test/test_binomial.cpp index 8aec49e4f..ef7f17172 100644 --- a/test/test_binomial.cpp +++ b/test/test_binomial.cpp @@ -27,7 +27,6 @@ // Enable C++ Exceptions Yes With SEH Exceptions (/EHa) prevents warning 4535. #endif -#include #include // for real_concept using ::boost::math::concepts::real_concept; @@ -522,57 +521,57 @@ void test_spots(RealType T) binomial_distribution(static_cast(0), static_cast(0.25)), static_cast(0)), static_cast(1) ); - BOOST_MATH_CHECK_THROW( + BOOST_CHECK_THROW( pdf( binomial_distribution(static_cast(-1), static_cast(0.25)), static_cast(0)), std::domain_error ); - BOOST_MATH_CHECK_THROW( + BOOST_CHECK_THROW( pdf( binomial_distribution(static_cast(8), static_cast(-0.25)), static_cast(0)), std::domain_error ); - BOOST_MATH_CHECK_THROW( + BOOST_CHECK_THROW( pdf( binomial_distribution(static_cast(8), static_cast(1.25)), static_cast(0)), std::domain_error ); - BOOST_MATH_CHECK_THROW( + BOOST_CHECK_THROW( pdf( binomial_distribution(static_cast(8), static_cast(0.25)), static_cast(-1)), std::domain_error ); - BOOST_MATH_CHECK_THROW( + BOOST_CHECK_THROW( pdf( binomial_distribution(static_cast(8), static_cast(0.25)), static_cast(9)), std::domain_error ); - BOOST_MATH_CHECK_THROW( + BOOST_CHECK_THROW( cdf( binomial_distribution(static_cast(8), static_cast(0.25)), static_cast(-1)), std::domain_error ); - BOOST_MATH_CHECK_THROW( + BOOST_CHECK_THROW( cdf( binomial_distribution(static_cast(8), static_cast(0.25)), static_cast(9)), std::domain_error ); - BOOST_MATH_CHECK_THROW( + BOOST_CHECK_THROW( cdf( binomial_distribution(static_cast(8), static_cast(-0.25)), static_cast(0)), std::domain_error ); - BOOST_MATH_CHECK_THROW( + BOOST_CHECK_THROW( cdf( binomial_distribution(static_cast(8), static_cast(1.25)), static_cast(0)), std::domain_error ); - BOOST_MATH_CHECK_THROW( + BOOST_CHECK_THROW( quantile( binomial_distribution(static_cast(8), static_cast(-0.25)), static_cast(0)), std::domain_error ); - BOOST_MATH_CHECK_THROW( + BOOST_CHECK_THROW( quantile( binomial_distribution(static_cast(8), static_cast(1.25)), static_cast(0)), std::domain_error diff --git a/test/test_out_of_range.hpp b/test/test_out_of_range.hpp index a8c93576f..bed4e48a0 100644 --- a/test/test_out_of_range.hpp +++ b/test/test_out_of_range.hpp @@ -9,7 +9,7 @@ #define BOOST_MATH_TEST_OUT_OF_RANGE_HPP #include -#include +#include /*` check_out_of_range functions check that bad parameters passed to constructors and functions throw domain_error exceptions. @@ -48,60 +48,60 @@ void check_support(const Distro& d, bool Infinite = false) value_type m = (range(d).first == 0) ? -boost::math::tools::min_value() : boost::math::float_prior(range(d).first); BOOST_MATH_ASSERT(m != range(d).first); BOOST_MATH_ASSERT(m < range(d).first); - BOOST_MATH_CHECK_THROW(pdf(d, m), std::domain_error); - BOOST_MATH_CHECK_THROW(cdf(d, m), std::domain_error); - BOOST_MATH_CHECK_THROW(cdf(complement(d, m)), std::domain_error); + BOOST_CHECK_THROW(pdf(d, m), std::domain_error); + BOOST_CHECK_THROW(cdf(d, m), std::domain_error); + BOOST_CHECK_THROW(cdf(complement(d, m)), std::domain_error); } if ((boost::math::isfinite)(range(d).second) && (range(d).second != boost::math::tools::max_value())) { // If possible, check that a random variable value just more than the top of the supported range throws domain errors. value_type m = (range(d).second == 0) ? boost::math::tools::min_value() : boost::math::float_next(range(d).second); BOOST_MATH_ASSERT(m != range(d).first); BOOST_MATH_ASSERT(m > range(d).first); - BOOST_MATH_CHECK_THROW(pdf(d, m), std::domain_error); - BOOST_MATH_CHECK_THROW(cdf(d, m), std::domain_error); - BOOST_MATH_CHECK_THROW(cdf(complement(d, m)), std::domain_error); + BOOST_CHECK_THROW(pdf(d, m), std::domain_error); + BOOST_CHECK_THROW(cdf(d, m), std::domain_error); + BOOST_CHECK_THROW(cdf(complement(d, m)), std::domain_error); } if (std::numeric_limits::has_infinity) { // Infinity is available, if ((boost::math::isfinite)(range(d).second)) { // and top of range doesn't include infinity, // check that using infinity throws domain errors. - BOOST_MATH_CHECK_THROW(pdf(d, std::numeric_limits::infinity()), std::domain_error); - BOOST_MATH_CHECK_THROW(cdf(d, std::numeric_limits::infinity()), std::domain_error); - BOOST_MATH_CHECK_THROW(cdf(complement(d, std::numeric_limits::infinity())), std::domain_error); + BOOST_CHECK_THROW(pdf(d, std::numeric_limits::infinity()), std::domain_error); + BOOST_CHECK_THROW(cdf(d, std::numeric_limits::infinity()), std::domain_error); + BOOST_CHECK_THROW(cdf(complement(d, std::numeric_limits::infinity())), std::domain_error); } if ((boost::math::isfinite)(range(d).first)) { // and bottom of range doesn't include infinity, // check that using infinity throws domain_error exception. - BOOST_MATH_CHECK_THROW(pdf(d, -std::numeric_limits::infinity()), std::domain_error); - BOOST_MATH_CHECK_THROW(cdf(d, -std::numeric_limits::infinity()), std::domain_error); - BOOST_MATH_CHECK_THROW(cdf(complement(d, -std::numeric_limits::infinity())), std::domain_error); + BOOST_CHECK_THROW(pdf(d, -std::numeric_limits::infinity()), std::domain_error); + BOOST_CHECK_THROW(cdf(d, -std::numeric_limits::infinity()), std::domain_error); + BOOST_CHECK_THROW(cdf(complement(d, -std::numeric_limits::infinity())), std::domain_error); } // Check that using infinity with quantiles always throws domain_error exception. - BOOST_MATH_CHECK_THROW(quantile(d, std::numeric_limits::infinity()), std::domain_error); - BOOST_MATH_CHECK_THROW(quantile(d, -std::numeric_limits::infinity()), std::domain_error); - BOOST_MATH_CHECK_THROW(quantile(complement(d, std::numeric_limits::infinity())), std::domain_error); - BOOST_MATH_CHECK_THROW(quantile(complement(d, -std::numeric_limits::infinity())), std::domain_error); + BOOST_CHECK_THROW(quantile(d, std::numeric_limits::infinity()), std::domain_error); + BOOST_CHECK_THROW(quantile(d, -std::numeric_limits::infinity()), std::domain_error); + BOOST_CHECK_THROW(quantile(complement(d, std::numeric_limits::infinity())), std::domain_error); + BOOST_CHECK_THROW(quantile(complement(d, -std::numeric_limits::infinity())), std::domain_error); } } if(std::numeric_limits::has_quiet_NaN) { // NaN is available. - BOOST_MATH_CHECK_THROW(pdf(d, std::numeric_limits::quiet_NaN()), std::domain_error); - BOOST_MATH_CHECK_THROW(cdf(d, std::numeric_limits::quiet_NaN()), std::domain_error); - BOOST_MATH_CHECK_THROW(cdf(complement(d, std::numeric_limits::quiet_NaN())), std::domain_error); - BOOST_MATH_CHECK_THROW(pdf(d, -std::numeric_limits::quiet_NaN()), std::domain_error); - BOOST_MATH_CHECK_THROW(cdf(d, -std::numeric_limits::quiet_NaN()), std::domain_error); - BOOST_MATH_CHECK_THROW(cdf(complement(d, -std::numeric_limits::quiet_NaN())), std::domain_error); - BOOST_MATH_CHECK_THROW(quantile(d, std::numeric_limits::quiet_NaN()), std::domain_error); - BOOST_MATH_CHECK_THROW(quantile(d, -std::numeric_limits::quiet_NaN()), std::domain_error); - BOOST_MATH_CHECK_THROW(quantile(complement(d, std::numeric_limits::quiet_NaN())), std::domain_error); - BOOST_MATH_CHECK_THROW(quantile(complement(d, -std::numeric_limits::quiet_NaN())), std::domain_error); + BOOST_CHECK_THROW(pdf(d, std::numeric_limits::quiet_NaN()), std::domain_error); + BOOST_CHECK_THROW(cdf(d, std::numeric_limits::quiet_NaN()), std::domain_error); + BOOST_CHECK_THROW(cdf(complement(d, std::numeric_limits::quiet_NaN())), std::domain_error); + BOOST_CHECK_THROW(pdf(d, -std::numeric_limits::quiet_NaN()), std::domain_error); + BOOST_CHECK_THROW(cdf(d, -std::numeric_limits::quiet_NaN()), std::domain_error); + BOOST_CHECK_THROW(cdf(complement(d, -std::numeric_limits::quiet_NaN())), std::domain_error); + BOOST_CHECK_THROW(quantile(d, std::numeric_limits::quiet_NaN()), std::domain_error); + BOOST_CHECK_THROW(quantile(d, -std::numeric_limits::quiet_NaN()), std::domain_error); + BOOST_CHECK_THROW(quantile(complement(d, std::numeric_limits::quiet_NaN())), std::domain_error); + BOOST_CHECK_THROW(quantile(complement(d, -std::numeric_limits::quiet_NaN())), std::domain_error); } // Check that using probability outside [0,1] with quantiles always throws domain_error exception. - BOOST_MATH_CHECK_THROW(quantile(d, -1), std::domain_error); - BOOST_MATH_CHECK_THROW(quantile(d, 2), std::domain_error); - BOOST_MATH_CHECK_THROW(quantile(complement(d, -1)), std::domain_error); - BOOST_MATH_CHECK_THROW(quantile(complement(d, 2)), std::domain_error); + BOOST_CHECK_THROW(quantile(d, -1), std::domain_error); + BOOST_CHECK_THROW(quantile(d, 2), std::domain_error); + BOOST_CHECK_THROW(quantile(complement(d, -1)), std::domain_error); + BOOST_CHECK_THROW(quantile(complement(d, 2)), std::domain_error); } // Four check_out_of_range versions for distributions with zero to 3 constructor parameters. @@ -121,12 +121,12 @@ void check_out_of_range(typename Distro::value_type p1) check_support(d); if(std::numeric_limits::has_infinity) { - BOOST_MATH_CHECK_THROW(pdf(Distro(std::numeric_limits::infinity()), range(d).first), std::domain_error); - // BOOST_MATH_CHECK_THROW(pdf(Distro(std::numeric_limits::infinity()), range(d).second), std::domain_error); + BOOST_CHECK_THROW(pdf(Distro(std::numeric_limits::infinity()), range(d).first), std::domain_error); + // BOOST_CHECK_THROW(pdf(Distro(std::numeric_limits::infinity()), range(d).second), std::domain_error); } if(std::numeric_limits::has_quiet_NaN) { - BOOST_MATH_CHECK_THROW(pdf(Distro(std::numeric_limits::quiet_NaN()), range(d).first), std::domain_error); + BOOST_CHECK_THROW(pdf(Distro(std::numeric_limits::quiet_NaN()), range(d).first), std::domain_error); } } @@ -138,13 +138,13 @@ void check_out_of_range(typename Distro::value_type p1, typename Distro::value_t check_support(d); if(std::numeric_limits::has_infinity) { - BOOST_MATH_CHECK_THROW(pdf(Distro(std::numeric_limits::infinity(), p2), range(d).first), std::domain_error); - BOOST_MATH_CHECK_THROW(pdf(Distro(p1, std::numeric_limits::infinity()), range(d).first), std::domain_error); + BOOST_CHECK_THROW(pdf(Distro(std::numeric_limits::infinity(), p2), range(d).first), std::domain_error); + BOOST_CHECK_THROW(pdf(Distro(p1, std::numeric_limits::infinity()), range(d).first), std::domain_error); } if(std::numeric_limits::has_quiet_NaN) { - BOOST_MATH_CHECK_THROW(pdf(Distro(std::numeric_limits::quiet_NaN(), p2), range(d).first), std::domain_error); - BOOST_MATH_CHECK_THROW(pdf(Distro(p1, std::numeric_limits::quiet_NaN()), range(d).first), std::domain_error); + BOOST_CHECK_THROW(pdf(Distro(std::numeric_limits::quiet_NaN(), p2), range(d).first), std::domain_error); + BOOST_CHECK_THROW(pdf(Distro(p1, std::numeric_limits::quiet_NaN()), range(d).first), std::domain_error); } } @@ -156,15 +156,15 @@ void check_out_of_range(typename Distro::value_type p1, typename Distro::value_t check_support(d); if(std::numeric_limits::has_infinity) { - BOOST_MATH_CHECK_THROW(pdf(Distro(std::numeric_limits::infinity(), p2, p3), range(d).first), std::domain_error); - BOOST_MATH_CHECK_THROW(pdf(Distro(p1, std::numeric_limits::infinity(), p3), range(d).first), std::domain_error); - BOOST_MATH_CHECK_THROW(pdf(Distro(p1, p2, std::numeric_limits::infinity()), range(d).first), std::domain_error); + BOOST_CHECK_THROW(pdf(Distro(std::numeric_limits::infinity(), p2, p3), range(d).first), std::domain_error); + BOOST_CHECK_THROW(pdf(Distro(p1, std::numeric_limits::infinity(), p3), range(d).first), std::domain_error); + BOOST_CHECK_THROW(pdf(Distro(p1, p2, std::numeric_limits::infinity()), range(d).first), std::domain_error); } if(std::numeric_limits::has_quiet_NaN) { - BOOST_MATH_CHECK_THROW(pdf(Distro(std::numeric_limits::quiet_NaN(), p2, p3), range(d).first), std::domain_error); - BOOST_MATH_CHECK_THROW(pdf(Distro(p1, std::numeric_limits::quiet_NaN(), p3), range(d).first), std::domain_error); - BOOST_MATH_CHECK_THROW(pdf(Distro(p1, p2, std::numeric_limits::quiet_NaN()), range(d).first), std::domain_error); + BOOST_CHECK_THROW(pdf(Distro(std::numeric_limits::quiet_NaN(), p2, p3), range(d).first), std::domain_error); + BOOST_CHECK_THROW(pdf(Distro(p1, std::numeric_limits::quiet_NaN(), p3), range(d).first), std::domain_error); + BOOST_CHECK_THROW(pdf(Distro(p1, p2, std::numeric_limits::quiet_NaN()), range(d).first), std::domain_error); } } From adb9f79cc3f52e931d19c1059fc2404b921ceb58 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Thu, 18 Jul 2024 09:17:31 -0400 Subject: [PATCH 05/64] Add boost.test to dependencies --- test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 7875cda4c..689ea7a83 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -6,6 +6,6 @@ include(BoostTestJamfile OPTIONAL RESULT_VARIABLE HAVE_BOOST_TEST) if(HAVE_BOOST_TEST) - boost_test_jamfile(FILE cmake_jamfile LINK_LIBRARIES Boost::cuda_math Boost::assert Boost::concept_check Boost::config Boost::core Boost::integer Boost::lexical_cast Boost::multiprecision Boost::predef Boost::random Boost::static_assert Boost::throw_exception ) + boost_test_jamfile(FILE cmake_jamfile LINK_LIBRARIES Boost::cuda_math Boost::assert Boost::concept_check Boost::config Boost::core Boost::integer Boost::lexical_cast Boost::multiprecision Boost::predef Boost::random Boost::static_assert Boost::throw_exception Boost::unit_test_framework ) endif() From cf245fc7f97c3f3aafa751bdebe331a0cf82e13c Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Thu, 18 Jul 2024 09:17:50 -0400 Subject: [PATCH 06/64] Add working variety of tests --- test/cmake_jamfile | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/cmake_jamfile b/test/cmake_jamfile index 2878e8c2a..b9cd7c524 100644 --- a/test/cmake_jamfile +++ b/test/cmake_jamfile @@ -9,5 +9,11 @@ project : requirements [ requires cxx14_decltype_auto cxx14_generic_lambdas cxx14_return_type_deduction cxx14_variable_templates cxx14_constexpr ] ; -run ccmath_abs_test.cpp ; -run ccmath_ceil_test.cpp ; +# Autodiff Tests +run test_autodiff_1.cpp ; + +# Tools Tests +run test_polynomial.cpp ; + +# Distributions +run test_binomial.cpp ; From 889a2a4725be0b7fb2b5b1a60372cb60558e4f96 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Thu, 18 Jul 2024 10:07:39 -0400 Subject: [PATCH 07/64] Add additional configuration macros --- include/boost/math/tools/config.hpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/include/boost/math/tools/config.hpp b/include/boost/math/tools/config.hpp index 6d962a08a..29b928215 100644 --- a/include/boost/math/tools/config.hpp +++ b/include/boost/math/tools/config.hpp @@ -660,6 +660,31 @@ namespace boost{ namespace math{ #define BOOST_MATH_CONSTEXPR_TABLE_FUNCTION #endif +// +// CUDA support: +// + +#ifdef __NVCC__ +# define BOOST_MATH_HOST_DEVICE __host__ __device__ +# ifndef BOOST_MATH_ENABLE_CUDA +# define BOOST_MATH_ENABLE_CUDA +# endif +#else +# define BOOST_MATH_HOST_DEVICE +#endif + +// Static variables are not allowed with CUDA or C++20 modules +// See if we can inline them instead + +#if defined(__cpp_inline_variables) && __cpp_inline_variables >= 201606L +# define BOOST_MATH_STATIC_CONSTEXPR inline constexpr +#else +# ifndef BOOST_MATH_ENABLE_CUDA +# define BOOST_MATH_STATIC_CONSTEXPR static constexpr +# else +# define BOOST_MATH_STATIC_CONSTEXPR constexpr +# endif +#endif #endif // BOOST_MATH_TOOLS_CONFIG_HPP From 803133afbcfe5c64801e8c36b23f4c772b2ea4f6 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Thu, 18 Jul 2024 10:18:46 -0400 Subject: [PATCH 08/64] Add additional macro for local static variables --- include/boost/math/tools/config.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/boost/math/tools/config.hpp b/include/boost/math/tools/config.hpp index 29b928215..4810d73e5 100644 --- a/include/boost/math/tools/config.hpp +++ b/include/boost/math/tools/config.hpp @@ -678,11 +678,14 @@ namespace boost{ namespace math{ #if defined(__cpp_inline_variables) && __cpp_inline_variables >= 201606L # define BOOST_MATH_STATIC_CONSTEXPR inline constexpr +# define BOOST_MATH_STATIC static #else # ifndef BOOST_MATH_ENABLE_CUDA # define BOOST_MATH_STATIC_CONSTEXPR static constexpr +# define BOOST_MATH_STATIC static # else # define BOOST_MATH_STATIC_CONSTEXPR constexpr +# define BOOST_MATH_STATIC constexpr # endif #endif From f374bde4f2eecd2f916580f949d25c79d2724763 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Thu, 18 Jul 2024 10:20:39 -0400 Subject: [PATCH 09/64] Add CUDA markers to binomial dist --- include/boost/math/distributions/binomial.hpp | 63 ++++++++++--------- 1 file changed, 32 insertions(+), 31 deletions(-) diff --git a/include/boost/math/distributions/binomial.hpp b/include/boost/math/distributions/binomial.hpp index cf7451104..9a2bc73b1 100644 --- a/include/boost/math/distributions/binomial.hpp +++ b/include/boost/math/distributions/binomial.hpp @@ -79,6 +79,7 @@ #ifndef BOOST_MATH_SPECIAL_BINOMIAL_HPP #define BOOST_MATH_SPECIAL_BINOMIAL_HPP +#include #include #include // for incomplete beta. #include // complements @@ -100,7 +101,7 @@ namespace boost namespace binomial_detail{ // common error checking routines for binomial distribution functions: template - inline bool check_N(const char* function, const RealType& N, RealType* result, const Policy& pol) + BOOST_MATH_HOST_DEVICE inline bool check_N(const char* function, const RealType& N, RealType* result, const Policy& pol) { if((N < 0) || !(boost::math::isfinite)(N)) { @@ -112,7 +113,7 @@ namespace boost return true; } template - inline bool check_success_fraction(const char* function, const RealType& p, RealType* result, const Policy& pol) + BOOST_MATH_HOST_DEVICE inline bool check_success_fraction(const char* function, const RealType& p, RealType* result, const Policy& pol) { if((p < 0) || (p > 1) || !(boost::math::isfinite)(p)) { @@ -124,7 +125,7 @@ namespace boost return true; } template - inline bool check_dist(const char* function, const RealType& N, const RealType& p, RealType* result, const Policy& pol) + BOOST_MATH_HOST_DEVICE inline bool check_dist(const char* function, const RealType& N, const RealType& p, RealType* result, const Policy& pol) { return check_success_fraction( function, p, result, pol) @@ -132,7 +133,7 @@ namespace boost function, N, result, pol); } template - inline bool check_dist_and_k(const char* function, const RealType& N, const RealType& p, RealType k, RealType* result, const Policy& pol) + BOOST_MATH_HOST_DEVICE inline bool check_dist_and_k(const char* function, const RealType& N, const RealType& p, RealType k, RealType* result, const Policy& pol) { if(check_dist(function, N, p, result, pol) == false) return false; @@ -153,7 +154,7 @@ namespace boost return true; } template - inline bool check_dist_and_prob(const char* function, const RealType& N, RealType p, RealType prob, RealType* result, const Policy& pol) + BOOST_MATH_HOST_DEVICE inline bool check_dist_and_prob(const char* function, const RealType& N, RealType p, RealType prob, RealType* result, const Policy& pol) { if((check_dist(function, N, p, result, pol) && detail::check_probability(function, prob, result, pol)) == false) return false; @@ -161,7 +162,7 @@ namespace boost } template - T inverse_binomial_cornish_fisher(T n, T sf, T p, T q, const Policy& pol) + BOOST_MATH_HOST_DEVICE T inverse_binomial_cornish_fisher(T n, T sf, T p, T q, const Policy& pol) { BOOST_MATH_STD_USING // mean: @@ -196,7 +197,7 @@ namespace boost } template - RealType quantile_imp(const binomial_distribution& dist, const RealType& p, const RealType& q, bool comp) + BOOST_MATH_HOST_DEVICE RealType quantile_imp(const binomial_distribution& dist, const RealType& p, const RealType& q, bool comp) { // Quantile or Percent Point Binomial function. // Return the number of expected successes k, // for a given probability p. @@ -290,11 +291,11 @@ namespace boost &r, Policy()); } // binomial_distribution constructor. - RealType success_fraction() const + BOOST_MATH_HOST_DEVICE RealType success_fraction() const { // Probability. return m_p; } - RealType trials() const + BOOST_MATH_HOST_DEVICE RealType trials() const { // Total number of trials. return m_n; } @@ -310,13 +311,13 @@ namespace boost // these functions are used // to obtain confidence intervals for the success fraction. // - static RealType find_lower_bound_on_p( + BOOST_MATH_HOST_DEVICE static RealType find_lower_bound_on_p( RealType trials, RealType successes, RealType probability, interval_type t = clopper_pearson_exact_interval) { - static const char* function = "boost::math::binomial_distribution<%1%>::find_lower_bound_on_p"; + BOOST_MATH_STATIC const char* function = "boost::math::binomial_distribution<%1%>::find_lower_bound_on_p"; // Error checks: RealType result = 0; if(false == binomial_detail::check_dist_and_k( @@ -335,13 +336,13 @@ namespace boost return (t == clopper_pearson_exact_interval) ? ibeta_inv(successes, trials - successes + 1, probability, static_cast(nullptr), Policy()) : ibeta_inv(successes + 0.5f, trials - successes + 0.5f, probability, static_cast(nullptr), Policy()); } - static RealType find_upper_bound_on_p( + BOOST_MATH_HOST_DEVICE static RealType find_upper_bound_on_p( RealType trials, RealType successes, RealType probability, interval_type t = clopper_pearson_exact_interval) { - static const char* function = "boost::math::binomial_distribution<%1%>::find_upper_bound_on_p"; + BOOST_MATH_STATIC const char* function = "boost::math::binomial_distribution<%1%>::find_upper_bound_on_p"; // Error checks: RealType result = 0; if(false == binomial_detail::check_dist_and_k( @@ -363,12 +364,12 @@ namespace boost // or // "How many trials can I have to be P% sure of seeing fewer than k events?" // - static RealType find_minimum_number_of_trials( + BOOST_MATH_HOST_DEVICE static RealType find_minimum_number_of_trials( RealType k, // number of events RealType p, // success fraction RealType alpha) // risk level { - static const char* function = "boost::math::binomial_distribution<%1%>::find_minimum_number_of_trials"; + BOOST_MATH_STATIC const char* function = "boost::math::binomial_distribution<%1%>::find_minimum_number_of_trials"; // Error checks: RealType result = 0; if(false == binomial_detail::check_dist_and_k( @@ -382,12 +383,12 @@ namespace boost return result + k; } - static RealType find_maximum_number_of_trials( + BOOST_MATH_HOST_DEVICE static RealType find_maximum_number_of_trials( RealType k, // number of events RealType p, // success fraction RealType alpha) // risk level { - static const char* function = "boost::math::binomial_distribution<%1%>::find_maximum_number_of_trials"; + BOOST_MATH_STATIC const char* function = "boost::math::binomial_distribution<%1%>::find_maximum_number_of_trials"; // Error checks: RealType result = 0; if(false == binomial_detail::check_dist_and_k( @@ -419,33 +420,33 @@ namespace boost #endif template - const std::pair range(const binomial_distribution& dist) + BOOST_MATH_HOST_DEVICE const std::pair range(const binomial_distribution& dist) { // Range of permissible values for random variable k. using boost::math::tools::max_value; return std::pair(static_cast(0), dist.trials()); } template - const std::pair support(const binomial_distribution& dist) + BOOST_MATH_HOST_DEVICE const std::pair support(const binomial_distribution& dist) { // Range of supported values for random variable k. // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero. return std::pair(static_cast(0), dist.trials()); } template - inline RealType mean(const binomial_distribution& dist) + BOOST_MATH_HOST_DEVICE inline RealType mean(const binomial_distribution& dist) { // Mean of Binomial distribution = np. return dist.trials() * dist.success_fraction(); } // mean template - inline RealType variance(const binomial_distribution& dist) + BOOST_MATH_HOST_DEVICE inline RealType variance(const binomial_distribution& dist) { // Variance of Binomial distribution = np(1-p). return dist.trials() * dist.success_fraction() * (1 - dist.success_fraction()); } // variance template - RealType pdf(const binomial_distribution& dist, const RealType& k) + BOOST_MATH_HOST_DEVICE RealType pdf(const binomial_distribution& dist, const RealType& k) { // Probability Density/Mass Function. BOOST_FPU_EXCEPTION_GUARD @@ -501,7 +502,7 @@ namespace boost } // pdf template - inline RealType cdf(const binomial_distribution& dist, const RealType& k) + BOOST_MATH_HOST_DEVICE inline RealType cdf(const binomial_distribution& dist, const RealType& k) { // Cumulative Distribution Function Binomial. // The random variate k is the number of successes in n trials. // k argument may be integral, signed, or unsigned, or floating point. @@ -573,7 +574,7 @@ namespace boost } // binomial cdf template - inline RealType cdf(const complemented2_type, RealType>& c) + BOOST_MATH_HOST_DEVICE inline RealType cdf(const complemented2_type, RealType>& c) { // Complemented Cumulative Distribution Function Binomial. // The random variate k is the number of successes in n trials. // k argument may be integral, signed, or unsigned, or floating point. @@ -650,19 +651,19 @@ namespace boost } // binomial cdf template - inline RealType quantile(const binomial_distribution& dist, const RealType& p) + BOOST_MATH_HOST_DEVICE inline RealType quantile(const binomial_distribution& dist, const RealType& p) { return binomial_detail::quantile_imp(dist, p, RealType(1-p), false); } // quantile template - RealType quantile(const complemented2_type, RealType>& c) + BOOST_MATH_HOST_DEVICE RealType quantile(const complemented2_type, RealType>& c) { return binomial_detail::quantile_imp(c.dist, RealType(1-c.param), c.param, true); } // quantile template - inline RealType mode(const binomial_distribution& dist) + BOOST_MATH_HOST_DEVICE inline RealType mode(const binomial_distribution& dist) { BOOST_MATH_STD_USING // ADL of std functions. RealType p = dist.success_fraction(); @@ -671,7 +672,7 @@ namespace boost } template - inline RealType median(const binomial_distribution& dist) + BOOST_MATH_HOST_DEVICE inline RealType median(const binomial_distribution& dist) { // Bounds for the median of the negative binomial distribution // VAN DE VEN R. ; WEBER N. C. ; // Univ. Sydney, school mathematics statistics, Sydney N.S.W. 2006, AUSTRALIE @@ -689,7 +690,7 @@ namespace boost } template - inline RealType skewness(const binomial_distribution& dist) + BOOST_MATH_HOST_DEVICE inline RealType skewness(const binomial_distribution& dist) { BOOST_MATH_STD_USING // ADL of std functions. RealType p = dist.success_fraction(); @@ -698,7 +699,7 @@ namespace boost } template - inline RealType kurtosis(const binomial_distribution& dist) + BOOST_MATH_HOST_DEVICE inline RealType kurtosis(const binomial_distribution& dist) { RealType p = dist.success_fraction(); RealType n = dist.trials(); @@ -706,7 +707,7 @@ namespace boost } template - inline RealType kurtosis_excess(const binomial_distribution& dist) + BOOST_MATH_HOST_DEVICE inline RealType kurtosis_excess(const binomial_distribution& dist) { RealType p = dist.success_fraction(); RealType q = 1 - p; From 2674307bfd4ac8f65a08455dc00893657a1a858b Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Thu, 18 Jul 2024 10:38:52 -0400 Subject: [PATCH 10/64] Add CUDA markers to polynomial class --- include/boost/math/tools/polynomial.hpp | 182 ++++++++++++------------ 1 file changed, 91 insertions(+), 91 deletions(-) diff --git a/include/boost/math/tools/polynomial.hpp b/include/boost/math/tools/polynomial.hpp index 6f9b9039f..8d87fbf68 100644 --- a/include/boost/math/tools/polynomial.hpp +++ b/include/boost/math/tools/polynomial.hpp @@ -32,7 +32,7 @@ namespace boost{ namespace math{ namespace tools{ template -T chebyshev_coefficient(unsigned n, unsigned m) +BOOST_MATH_HOST_DEVICE T chebyshev_coefficient(unsigned n, unsigned m) { BOOST_MATH_STD_USING if(m > n) @@ -56,7 +56,7 @@ T chebyshev_coefficient(unsigned n, unsigned m) } template -Seq polynomial_to_chebyshev(const Seq& s) +BOOST_MATH_HOST_DEVICE Seq polynomial_to_chebyshev(const Seq& s) { // Converts a Polynomial into Chebyshev form: typedef typename Seq::value_type value_type; @@ -92,7 +92,7 @@ Seq polynomial_to_chebyshev(const Seq& s) } template -T evaluate_chebyshev(const Seq& a, const T& x) +BOOST_MATH_HOST_DEVICE T evaluate_chebyshev(const Seq& a, const T& x) { // Clenshaw's formula: typedef typename Seq::difference_type difference_type; @@ -124,7 +124,7 @@ namespace detail { * subtlety of distinction. */ template -typename std::enable_if::is_integer, void >::type +BOOST_MATH_HOST_DEVICE typename std::enable_if::is_integer, void >::type division_impl(polynomial &q, polynomial &u, const polynomial& v, N n, N k) { q[k] = u[n + k] / v[n]; @@ -136,7 +136,7 @@ division_impl(polynomial &q, polynomial &u, const polynomial& v, N n, N } template -T integer_power(T t, N n) +BOOST_MATH_HOST_DEVICE T integer_power(T t, N n) { switch(n) { @@ -167,7 +167,7 @@ T integer_power(T t, N n) * don't currently have that subtlety of distinction. */ template -typename std::enable_if::is_integer, void >::type +BOOST_MATH_HOST_DEVICE typename std::enable_if::is_integer, void >::type division_impl(polynomial &q, polynomial &u, const polynomial& v, N n, N k) { q[k] = u[n + k] * integer_power(v[n], k); @@ -187,7 +187,7 @@ division_impl(polynomial &q, polynomial &u, const polynomial& v, N n, N * @param v Divisor. */ template -std::pair< polynomial, polynomial > +BOOST_MATH_HOST_DEVICE std::pair< polynomial, polynomial > division(polynomial u, const polynomial& v) { BOOST_MATH_ASSERT(v.size() <= u.size()); @@ -218,7 +218,7 @@ division(polynomial u, const polynomial& v) struct negate { template - T operator()(T const &x) const + BOOST_MATH_HOST_DEVICE T operator()(T const &x) const { return -x; } @@ -227,7 +227,7 @@ struct negate struct plus { template - T operator()(T const &x, U const& y) const + BOOST_MATH_HOST_DEVICE T operator()(T const &x, U const& y) const { return x + y; } @@ -236,7 +236,7 @@ struct plus struct minus { template - T operator()(T const &x, U const& y) const + BOOST_MATH_HOST_DEVICE T operator()(T const &x, U const& y) const { return x - y; } @@ -248,13 +248,13 @@ struct minus * Returns the zero element for multiplication of polynomials. */ template -polynomial zero_element(std::multiplies< polynomial >) +BOOST_MATH_HOST_DEVICE polynomial zero_element(std::multiplies< polynomial >) { return polynomial(); } template -polynomial identity_element(std::multiplies< polynomial >) +BOOST_MATH_HOST_DEVICE polynomial identity_element(std::multiplies< polynomial >) { return polynomial(T(1)); } @@ -264,7 +264,7 @@ polynomial identity_element(std::multiplies< polynomial >) * This function is not defined for division by zero: user beware. */ template -std::pair< polynomial, polynomial > +BOOST_MATH_HOST_DEVICE std::pair< polynomial, polynomial > quotient_remainder(const polynomial& dividend, const polynomial& divisor) { BOOST_MATH_ASSERT(divisor); @@ -283,51 +283,51 @@ class polynomial typedef typename std::vector::size_type size_type; // construct: - polynomial()= default; + BOOST_MATH_HOST_DEVICE polynomial()= default; template - polynomial(const U* data, unsigned order) + BOOST_MATH_HOST_DEVICE polynomial(const U* data, unsigned order) : m_data(data, data + order + 1) { normalize(); } template - polynomial(Iterator first, Iterator last) + BOOST_MATH_HOST_DEVICE polynomial(Iterator first, Iterator last) : m_data(first, last) { normalize(); } template - polynomial(Iterator first, unsigned length) + BOOST_MATH_HOST_DEVICE polynomial(Iterator first, unsigned length) : m_data(first, std::next(first, length + 1)) { normalize(); } - polynomial(std::vector&& p) : m_data(std::move(p)) + BOOST_MATH_HOST_DEVICE polynomial(std::vector&& p) : m_data(std::move(p)) { normalize(); } template ::value, bool>::type = true> - explicit polynomial(const U& point) + BOOST_MATH_HOST_DEVICE explicit polynomial(const U& point) { if (point != U(0)) m_data.push_back(point); } // move: - polynomial(polynomial&& p) noexcept + BOOST_MATH_HOST_DEVICE polynomial(polynomial&& p) noexcept : m_data(std::move(p.m_data)) { } // copy: - polynomial(const polynomial& p) + BOOST_MATH_HOST_DEVICE polynomial(const polynomial& p) : m_data(p.m_data) { } template - polynomial(const polynomial& p) + BOOST_MATH_HOST_DEVICE polynomial(const polynomial& p) { m_data.resize(p.size()); for(unsigned i = 0; i < p.size(); ++i) @@ -337,17 +337,17 @@ class polynomial } #ifdef BOOST_MATH_HAS_IS_CONST_ITERABLE template ::value, bool>::type = true> - explicit polynomial(const Range& r) + BOOST_MATH_HOST_DEVICE explicit polynomial(const Range& r) : polynomial(r.begin(), r.end()) { } #endif - polynomial(std::initializer_list l) : polynomial(std::begin(l), std::end(l)) + BOOST_MATH_HOST_DEVICE polynomial(std::initializer_list l) : polynomial(std::begin(l), std::end(l)) { } polynomial& - operator=(std::initializer_list l) + BOOST_MATH_HOST_DEVICE operator=(std::initializer_list l) { m_data.assign(std::begin(l), std::end(l)); normalize(); @@ -356,47 +356,47 @@ class polynomial // access: - size_type size() const { return m_data.size(); } - size_type degree() const + BOOST_MATH_HOST_DEVICE size_type size() const { return m_data.size(); } + BOOST_MATH_HOST_DEVICE size_type degree() const { if (size() == 0) BOOST_MATH_THROW_EXCEPTION(std::logic_error("degree() is undefined for the zero polynomial.")); return m_data.size() - 1; } - value_type& operator[](size_type i) + BOOST_MATH_HOST_DEVICE value_type& operator[](size_type i) { return m_data[i]; } - const value_type& operator[](size_type i) const + BOOST_MATH_HOST_DEVICE const value_type& operator[](size_type i) const { return m_data[i]; } - T evaluate(T z) const + BOOST_MATH_HOST_DEVICE T evaluate(T z) const { return this->operator()(z); } - T operator()(T z) const + BOOST_MATH_HOST_DEVICE T operator()(T z) const { return m_data.size() > 0 ? boost::math::tools::evaluate_polynomial((m_data).data(), z, m_data.size()) : T(0); } - std::vector chebyshev() const + BOOST_MATH_HOST_DEVICE std::vector chebyshev() const { return polynomial_to_chebyshev(m_data); } - std::vector const& data() const + BOOST_MATH_HOST_DEVICE std::vector const& data() const { return m_data; } - std::vector & data() + BOOST_MATH_HOST_DEVICE std::vector & data() { return m_data; } - polynomial prime() const + BOOST_MATH_HOST_DEVICE polynomial prime() const { #ifdef _MSC_VER // Disable int->float conversion warning: @@ -418,7 +418,7 @@ class polynomial #endif } - polynomial integrate() const + BOOST_MATH_HOST_DEVICE polynomial integrate() const { std::vector i_data(m_data.size() + 1); // Choose integration constant such that P(0) = 0. @@ -431,20 +431,20 @@ class polynomial } // operators: - polynomial& operator =(polynomial&& p) noexcept + BOOST_MATH_HOST_DEVICE polynomial& operator =(polynomial&& p) noexcept { m_data = std::move(p.m_data); return *this; } - polynomial& operator =(const polynomial& p) + BOOST_MATH_HOST_DEVICE polynomial& operator =(const polynomial& p) { m_data = p.m_data; return *this; } template - typename std::enable_if::value, polynomial&>::type operator +=(const U& value) + BOOST_MATH_HOST_DEVICE typename std::enable_if::value, polynomial&>::type operator +=(const U& value) { addition(value); normalize(); @@ -452,7 +452,7 @@ class polynomial } template - typename std::enable_if::value, polynomial&>::type operator -=(const U& value) + BOOST_MATH_HOST_DEVICE typename std::enable_if::value, polynomial&>::type operator -=(const U& value) { subtraction(value); normalize(); @@ -460,7 +460,7 @@ class polynomial } template - typename std::enable_if::value, polynomial&>::type operator *=(const U& value) + BOOST_MATH_HOST_DEVICE typename std::enable_if::value, polynomial&>::type operator *=(const U& value) { multiplication(value); normalize(); @@ -468,7 +468,7 @@ class polynomial } template - typename std::enable_if::value, polynomial&>::type operator /=(const U& value) + BOOST_MATH_HOST_DEVICE typename std::enable_if::value, polynomial&>::type operator /=(const U& value) { division(value); normalize(); @@ -476,7 +476,7 @@ class polynomial } template - typename std::enable_if::value, polynomial&>::type operator %=(const U& /*value*/) + BOOST_MATH_HOST_DEVICE typename std::enable_if::value, polynomial&>::type operator %=(const U& /*value*/) { // We can always divide by a scalar, so there is no remainder: this->set_zero(); @@ -484,7 +484,7 @@ class polynomial } template - polynomial& operator +=(const polynomial& value) + BOOST_MATH_HOST_DEVICE polynomial& operator +=(const polynomial& value) { addition(value); normalize(); @@ -492,7 +492,7 @@ class polynomial } template - polynomial& operator -=(const polynomial& value) + BOOST_MATH_HOST_DEVICE polynomial& operator -=(const polynomial& value) { subtraction(value); normalize(); @@ -500,7 +500,7 @@ class polynomial } template - void multiply(const polynomial& a, const polynomial& b) { + BOOST_MATH_HOST_DEVICE void multiply(const polynomial& a, const polynomial& b) { if (!a || !b) { this->set_zero(); @@ -514,28 +514,28 @@ class polynomial } template - polynomial& operator *=(const polynomial& value) + BOOST_MATH_HOST_DEVICE polynomial& operator *=(const polynomial& value) { this->multiply(*this, value); return *this; } template - polynomial& operator /=(const polynomial& value) + BOOST_MATH_HOST_DEVICE polynomial& operator /=(const polynomial& value) { *this = quotient_remainder(*this, value).first; return *this; } template - polynomial& operator %=(const polynomial& value) + BOOST_MATH_HOST_DEVICE polynomial& operator %=(const polynomial& value) { *this = quotient_remainder(*this, value).second; return *this; } template - polynomial& operator >>=(U const &n) + BOOST_MATH_HOST_DEVICE polynomial& operator >>=(U const &n) { BOOST_MATH_ASSERT(n <= m_data.size()); m_data.erase(m_data.begin(), m_data.begin() + n); @@ -543,7 +543,7 @@ class polynomial } template - polynomial& operator <<=(U const &n) + BOOST_MATH_HOST_DEVICE polynomial& operator <<=(U const &n) { m_data.insert(m_data.begin(), n, static_cast(0)); normalize(); @@ -551,33 +551,33 @@ class polynomial } // Convenient and efficient query for zero. - bool is_zero() const + BOOST_MATH_HOST_DEVICE bool is_zero() const { return m_data.empty(); } // Conversion to bool. - inline explicit operator bool() const + BOOST_MATH_HOST_DEVICE inline explicit operator bool() const { return !m_data.empty(); } // Fast way to set a polynomial to zero. - void set_zero() + BOOST_MATH_HOST_DEVICE void set_zero() { m_data.clear(); } /** Remove zero coefficients 'from the top', that is for which there are no * non-zero coefficients of higher degree. */ - void normalize() + BOOST_MATH_HOST_DEVICE void normalize() { m_data.erase(std::find_if(m_data.rbegin(), m_data.rend(), [](const T& x)->bool { return x != T(0); }).base(), m_data.end()); } private: template - polynomial& addition(const U& value, R op) + BOOST_MATH_HOST_DEVICE polynomial& addition(const U& value, R op) { if(m_data.size() == 0) m_data.resize(1, 0); @@ -586,19 +586,19 @@ class polynomial } template - polynomial& addition(const U& value) + BOOST_MATH_HOST_DEVICE polynomial& addition(const U& value) { return addition(value, detail::plus()); } template - polynomial& subtraction(const U& value) + BOOST_MATH_HOST_DEVICE polynomial& subtraction(const U& value) { return addition(value, detail::minus()); } template - polynomial& addition(const polynomial& value, R op) + BOOST_MATH_HOST_DEVICE polynomial& addition(const polynomial& value, R op) { if (m_data.size() < value.size()) m_data.resize(value.size(), 0); @@ -608,26 +608,26 @@ class polynomial } template - polynomial& addition(const polynomial& value) + BOOST_MATH_HOST_DEVICE polynomial& addition(const polynomial& value) { return addition(value, detail::plus()); } template - polynomial& subtraction(const polynomial& value) + BOOST_MATH_HOST_DEVICE polynomial& subtraction(const polynomial& value) { return addition(value, detail::minus()); } template - polynomial& multiplication(const U& value) + BOOST_MATH_HOST_DEVICE polynomial& multiplication(const U& value) { std::transform(m_data.begin(), m_data.end(), m_data.begin(), [&](const T& x)->T { return x * value; }); return *this; } template - polynomial& division(const U& value) + BOOST_MATH_HOST_DEVICE polynomial& division(const U& value) { std::transform(m_data.begin(), m_data.end(), m_data.begin(), [&](const T& x)->T { return x / value; }); return *this; @@ -638,7 +638,7 @@ class polynomial template -inline polynomial operator + (const polynomial& a, const polynomial& b) +BOOST_MATH_HOST_DEVICE inline polynomial operator + (const polynomial& a, const polynomial& b) { polynomial result(a); result += b; @@ -646,26 +646,26 @@ inline polynomial operator + (const polynomial& a, const polynomial& b) } template -inline polynomial operator + (polynomial&& a, const polynomial& b) +BOOST_MATH_HOST_DEVICE inline polynomial operator + (polynomial&& a, const polynomial& b) { a += b; return std::move(a); } template -inline polynomial operator + (const polynomial& a, polynomial&& b) +BOOST_MATH_HOST_DEVICE inline polynomial operator + (const polynomial& a, polynomial&& b) { b += a; return b; } template -inline polynomial operator + (polynomial&& a, polynomial&& b) +BOOST_MATH_HOST_DEVICE inline polynomial operator + (polynomial&& a, polynomial&& b) { a += b; return a; } template -inline polynomial operator - (const polynomial& a, const polynomial& b) +BOOST_MATH_HOST_DEVICE inline polynomial operator - (const polynomial& a, const polynomial& b) { polynomial result(a); result -= b; @@ -673,26 +673,26 @@ inline polynomial operator - (const polynomial& a, const polynomial& b) } template -inline polynomial operator - (polynomial&& a, const polynomial& b) +BOOST_MATH_HOST_DEVICE inline polynomial operator - (polynomial&& a, const polynomial& b) { a -= b; return a; } template -inline polynomial operator - (const polynomial& a, polynomial&& b) +BOOST_MATH_HOST_DEVICE inline polynomial operator - (const polynomial& a, polynomial&& b) { b -= a; return -b; } template -inline polynomial operator - (polynomial&& a, polynomial&& b) +BOOST_MATH_HOST_DEVICE inline polynomial operator - (polynomial&& a, polynomial&& b) { a -= b; return a; } template -inline polynomial operator * (const polynomial& a, const polynomial& b) +BOOST_MATH_HOST_DEVICE inline polynomial operator * (const polynomial& a, const polynomial& b) { polynomial result; result.multiply(a, b); @@ -700,94 +700,94 @@ inline polynomial operator * (const polynomial& a, const polynomial& b) } template -inline polynomial operator / (const polynomial& a, const polynomial& b) +BOOST_MATH_HOST_DEVICE inline polynomial operator / (const polynomial& a, const polynomial& b) { return quotient_remainder(a, b).first; } template -inline polynomial operator % (const polynomial& a, const polynomial& b) +BOOST_MATH_HOST_DEVICE inline polynomial operator % (const polynomial& a, const polynomial& b) { return quotient_remainder(a, b).second; } template -inline typename std::enable_if::value, polynomial >::type operator + (polynomial a, const U& b) +BOOST_MATH_HOST_DEVICE inline typename std::enable_if::value, polynomial >::type operator + (polynomial a, const U& b) { a += b; return a; } template -inline typename std::enable_if::value, polynomial >::type operator - (polynomial a, const U& b) +BOOST_MATH_HOST_DEVICE inline typename std::enable_if::value, polynomial >::type operator - (polynomial a, const U& b) { a -= b; return a; } template -inline typename std::enable_if::value, polynomial >::type operator * (polynomial a, const U& b) +BOOST_MATH_HOST_DEVICE inline typename std::enable_if::value, polynomial >::type operator * (polynomial a, const U& b) { a *= b; return a; } template -inline typename std::enable_if::value, polynomial >::type operator / (polynomial a, const U& b) +BOOST_MATH_HOST_DEVICE inline typename std::enable_if::value, polynomial >::type operator / (polynomial a, const U& b) { a /= b; return a; } template -inline typename std::enable_if::value, polynomial >::type operator % (const polynomial&, const U&) +BOOST_MATH_HOST_DEVICE inline typename std::enable_if::value, polynomial >::type operator % (const polynomial&, const U&) { // Since we can always divide by a scalar, result is always an empty polynomial: return polynomial(); } template -inline typename std::enable_if::value, polynomial >::type operator + (const U& a, polynomial b) +BOOST_MATH_HOST_DEVICE inline typename std::enable_if::value, polynomial >::type operator + (const U& a, polynomial b) { b += a; return b; } template -inline typename std::enable_if::value, polynomial >::type operator - (const U& a, polynomial b) +BOOST_MATH_HOST_DEVICE inline typename std::enable_if::value, polynomial >::type operator - (const U& a, polynomial b) { b -= a; return -b; } template -inline typename std::enable_if::value, polynomial >::type operator * (const U& a, polynomial b) +BOOST_MATH_HOST_DEVICE inline typename std::enable_if::value, polynomial >::type operator * (const U& a, polynomial b) { b *= a; return b; } template -bool operator == (const polynomial &a, const polynomial &b) +BOOST_MATH_HOST_DEVICE bool operator == (const polynomial &a, const polynomial &b) { return a.data() == b.data(); } template -bool operator != (const polynomial &a, const polynomial &b) +BOOST_MATH_HOST_DEVICE bool operator != (const polynomial &a, const polynomial &b) { return a.data() != b.data(); } template -polynomial operator >> (polynomial a, const U& b) +BOOST_MATH_HOST_DEVICE polynomial operator >> (polynomial a, const U& b) { a >>= b; return a; } template -polynomial operator << (polynomial a, const U& b) +BOOST_MATH_HOST_DEVICE polynomial operator << (polynomial a, const U& b) { a <<= b; return a; @@ -795,26 +795,26 @@ polynomial operator << (polynomial a, const U& b) // Unary minus (negate). template -polynomial operator - (polynomial a) +BOOST_MATH_HOST_DEVICE polynomial operator - (polynomial a) { std::transform(a.data().begin(), a.data().end(), a.data().begin(), detail::negate()); return a; } template -bool odd(polynomial const &a) +BOOST_MATH_HOST_DEVICE bool odd(polynomial const &a) { return a.size() > 0 && a[0] != static_cast(0); } template -bool even(polynomial const &a) +BOOST_MATH_HOST_DEVICE bool even(polynomial const &a) { return !odd(a); } template -polynomial pow(polynomial base, int exp) +BOOST_MATH_HOST_DEVICE polynomial pow(polynomial base, int exp) { if (exp < 0) return policies::raise_domain_error( @@ -838,7 +838,7 @@ polynomial pow(polynomial base, int exp) } template -inline std::basic_ostream& operator << (std::basic_ostream& os, const polynomial& poly) +BOOST_MATH_HOST_DEVICE inline std::basic_ostream& operator << (std::basic_ostream& os, const polynomial& poly) { os << "{ "; for(unsigned i = 0; i < poly.size(); ++i) From fff04decd5db83095668e687f3c1f860b6c691d3 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Thu, 18 Jul 2024 10:56:43 -0400 Subject: [PATCH 11/64] REVERT: Delete old CI runners --- .circleci/config.yml | 62 ---- .drone.star | 72 ----- .github/workflows/ci.yml | 548 ---------------------------------- .github/workflows/codecov.yml | 209 ------------- 4 files changed, 891 deletions(-) delete mode 100644 .circleci/config.yml delete mode 100644 .drone.star delete mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/codecov.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index d77b8b620..000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,62 +0,0 @@ -version: 2 - -jobs: - inspect: - environment: - - BOOST_LIBRARY=math - - CXX_STANDARD=gnu++11 - docker: - - image: gcc:9 - steps: - - checkout - - run: - name: Setting up Environment - command: | - echo 'export BOOST="$HOME/boost-local"' >> $BASH_ENV - if [ $CIRCLE_BRANCH = "master" ]; then - echo 'export BOOST_BRANCH="master"' >> $BASH_ENV; - else - echo 'export BOOST_BRANCH="develop"' >> $BASH_ENV; - fi - echo 'export BOOST_REMOVE="$BOOST/boost/libs/$BOOST_LIBRARY"' >> $BASH_ENV - HOME_SED_=$(echo $HOME | sed -e 's/\//\\\//g') - echo 'export HOME_SED=$HOME_SED_' >> $BASH_ENV - - run: - name: install pre dependencies - command: | - apt-get update -yqq - apt-get install git xsltproc docbook-xsl docbook-xml -y - - run: - name: Initializing git repo for boost - command: | - echo BOOST=$BOOST BOOST_REMOVE=$BOOST_REMOVE BOOST_LIBRARY=$BOOST_LIBRARY BOOST_BRANCH=$BOOST_BRANCH PWD=$PWD - mkdir $BOOST - cd $BOOST - git clone --single-branch --branch $BOOST_BRANCH https://github.com/boostorg/boost.git - cd boost - git submodule update --init --merge - rm -rf $BOOST_REMOVE - mv $HOME/project $BOOST_REMOVE - - run: - name: Bootstrapping boost-build - command: | - cd $BOOST/boost && ./bootstrap.sh && ./b2 headers - echo "using xsltproc ;" | tee $HOME/user-config.jam - echo "using boostbook : /usr/share/xml/docbook/stylesheet/docbook-xsl : /usr/share/sgml/docbook/dtd/xml/4.2 ;" | tee -a $HOME/user-config.jam - - run: - name: Building inspect - command: | - cd $BOOST/boost/tools/inspect/build && ../../../b2 -j2 address-model=64 architecture=x86 toolset=gcc cxxflags="-std=gnu++14" release dist-bin - - run: - name: Building docs - command: | - cd $BOOST_REMOVE/doc && rm -rf html/boost_math && ../../../b2 -j2 address-model=64 architecture=x86 toolset=gcc cxxflags="-std=gnu++14" release - - run: - name: Running Inspect - command: | - cd $BOOST_REMOVE && ../../dist/bin/inspect -text -workflows: - version: 2 - build_and_test: - jobs: - - inspect diff --git a/.drone.star b/.drone.star deleted file mode 100644 index 2202c6017..000000000 --- a/.drone.star +++ /dev/null @@ -1,72 +0,0 @@ -# Use, modification, and distribution are -# subject to the Boost Software License, Version 1.0. (See accompanying -# file LICENSE.txt) -# -# Copyright Rene Rivera 2020. -# Copyright John Maddock 2021. - -# For Drone CI we use the Starlark scripting language to reduce duplication. -# As the yaml syntax for Drone CI is rather limited. -# -# -globalenv={} -linuxglobalimage="cppalliance/droneubuntu1604:1" -windowsglobalimage="cppalliance/dronevs2019" - -def main(ctx): - - things_to_test = [ "special_fun", "distribution_tests", "mp", "misc", "interpolators", "quadrature", "autodiff", "long-running-tests", "float128_tests", "concepts" ] - gcc13_things_to_test = [ "special_fun", "distribution_tests", "mp", "misc", "interpolators", "quadrature", "autodiff", "long-running-tests", "float128_tests", "concepts", "new_floats" ] - sanitizer_test = [ "special_fun", "distribution_tests", "misc", "interpolators", "quadrature", "float128_tests" ] - gnu_5_stds = [ "gnu++14", "c++14" ] - gnu_6_stds = [ "gnu++14", "c++14", "gnu++17", "c++17" ] - clang_6_stds = [ "c++14", "c++17" ] - gnu_9_stds = [ "gnu++14", "c++14", "gnu++17", "c++17", "gnu++2a", "c++2a" ] - clang_10_stds = [ "c++14", "c++17", "c++2a" ] - gnu_non_native = [ "gnu++17" ] - gcc13_stds = [ "c++23" ] - - result = [] - - for suite in sanitizer_test: - # - # Sanitizers: - # - result.append(linux_cxx("Ubuntu Clang-18 C++20 ASAN" + " " + suite, "clang++-18", packages="clang-18", privileged=True, buildtype="boost", image="cppalliance/droneubuntu2404:1", environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-18', 'CXXSTD': 'gnu++20', 'TEST_SUITE': suite, 'OPTIONS': '-fsanitize=address -fsanitize=address -DBOOST_CI_SANITIZER_BUILD' }, globalenv=globalenv)) - result.append(linux_cxx("Ubuntu Clang-18 C++20 USAN" + " " + suite, "clang++-18", packages="clang-18", privileged=True, buildtype="boost", image="cppalliance/droneubuntu2404:1", environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-18', 'CXXSTD': 'gnu++20', 'TEST_SUITE': suite, 'OPTIONS': '-fsanitize=undefined -fsanitize=undefined -DBOOST_CI_SANITIZER_BUILD' }, globalenv=globalenv)) - result.append(linux_cxx("Ubuntu Clang-18 C++20 TSAN" + " " + suite, "clang++-18", packages="clang-18", privileged=True, buildtype="boost", image="cppalliance/droneubuntu2404:1", environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-18', 'CXXSTD': 'gnu++20', 'TEST_SUITE': suite, 'OPTIONS': '-fsanitize=thread -fsanitize=thread -DBOOST_CI_SANITIZER_BUILD' }, globalenv=globalenv)) - result.append(linux_cxx("Ubuntu Clang-18 C++20 ISAN" + " " + suite, "clang++-18", packages="clang-18", privileged=True, buildtype="boost", image="cppalliance/droneubuntu2404:1", environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-18', 'CXXSTD': 'gnu++20', 'TEST_SUITE': suite, 'OPTIONS': '-fsanitize=integer -fsanitize=integer' }, globalenv=globalenv)) - - for suite in things_to_test: - for cxx in gnu_5_stds: - result.append(linux_cxx("Ubuntu g++-5 " + cxx + " " + suite, "g++-5", packages="g++-5", buildtype="boost", image="cppalliance/droneubuntu1804:1", environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-5', 'CXXSTD': cxx, 'TEST_SUITE': suite, }, globalenv=globalenv)) - for cxx in gnu_6_stds: - result.append(linux_cxx("Ubuntu g++-6 " + cxx + " " + suite, "g++-6", packages="g++-6", buildtype="boost", image="cppalliance/droneubuntu1804:1", environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-6', 'CXXSTD': cxx, 'TEST_SUITE': suite, }, globalenv=globalenv)) - result.append(linux_cxx("Ubuntu g++-7 " + cxx + " " + suite, "g++-7", packages="g++-7", buildtype="boost", image="cppalliance/droneubuntu1804:1", environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-7', 'CXXSTD': cxx, 'TEST_SUITE': suite, }, globalenv=globalenv)) - result.append(linux_cxx("Ubuntu g++-8 " + cxx + " " + suite, "g++-8", packages="g++-8", buildtype="boost", image="cppalliance/droneubuntu2004:1", environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-8', 'CXXSTD': cxx, 'TEST_SUITE': suite, }, globalenv=globalenv)) - result.append(linux_cxx("Ubuntu g++-9 " + cxx + " " + suite, "g++-9", packages="g++-9", buildtype="boost", image="cppalliance/droneubuntu2004:1", environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-9', 'CXXSTD': cxx, 'TEST_SUITE': suite, }, globalenv=globalenv)) - for cxx in clang_6_stds: - result.append(linux_cxx("Ubuntu clang++-6 " + cxx + " " + suite, "clang++-6.0", packages="clang-6.0", llvm_os="xenial", llvm_ver="6.0", buildtype="boost", image="cppalliance/droneubuntu1804:1", environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-6.0', 'CXXSTD': cxx, 'TEST_SUITE': suite, }, globalenv=globalenv)) - result.append(linux_cxx("Ubuntu clang++-7 " + cxx + " " + suite, "clang++-7", packages="clang-7", llvm_os="xenial", llvm_ver="7", buildtype="boost", image="cppalliance/droneubuntu1804:1", environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-7', 'CXXSTD': cxx, 'TEST_SUITE': suite, }, globalenv=globalenv)) - result.append(linux_cxx("Ubuntu clang++-8 " + cxx + " " + suite, "clang++-8", packages="clang-8", llvm_os="xenial", llvm_ver="8", buildtype="boost", image="cppalliance/droneubuntu1804:1", environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-8', 'CXXSTD': cxx, 'TEST_SUITE': suite, }, globalenv=globalenv)) - result.append(linux_cxx("Ubuntu clang++-9 " + cxx + " " + suite, "clang++-9", packages="clang-9", llvm_os="xenial", llvm_ver="9", buildtype="boost", image="cppalliance/droneubuntu1804:1", environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-9', 'CXXSTD': cxx, 'TEST_SUITE': suite, }, globalenv=globalenv)) - for cxx in gnu_9_stds: - result.append(linux_cxx("Ubuntu g++-10 " + cxx + " " + suite, "g++-10", packages="g++-10", buildtype="boost", image="cppalliance/droneubuntu2004:1", environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-10', 'CXXSTD': cxx, 'TEST_SUITE': suite, }, globalenv=globalenv)) - result.append(linux_cxx("Ubuntu g++-11 " + cxx + " " + suite, "g++-11", packages="g++-11", buildtype="boost", image="cppalliance/droneubuntu2004:1", environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-11', 'CXXSTD': cxx, 'TEST_SUITE': suite, }, globalenv=globalenv)) - for cxx in clang_10_stds: - result.append(linux_cxx("Ubuntu clang++-10 " + cxx + " " + suite, "clang++-10", packages="clang-10", llvm_os="xenial", llvm_ver="10", buildtype="boost", image="cppalliance/droneubuntu1804:1", environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-10', 'CXXSTD': cxx, 'TEST_SUITE': suite, }, globalenv=globalenv)) - for cxx in gnu_non_native: - result.append(linux_cxx("Ubuntu g++ s390s " + cxx + " " + suite, "g++", packages="g++", buildtype="boost", image="cppalliance/droneubuntu2204:multiarch", arch="s390x", environment={'TOOLSET': 'gcc', 'COMPILER': 'g++', 'CXXSTD': cxx, 'TEST_SUITE': suite, }, globalenv=globalenv)) - for cxx in gnu_non_native: - result.append(linux_cxx("Ubuntu g++ ARM64" + cxx + " " + suite, "g++", packages="g++", buildtype="boost", image="cppalliance/droneubuntu2204:multiarch", arch="arm64", environment={'TOOLSET': 'gcc', 'COMPILER': 'g++', 'CXXSTD': cxx, 'TEST_SUITE': suite, }, globalenv=globalenv)) - for cxx in gnu_non_native: - result.append(osx_cxx("M1 Clang " + cxx + " " + suite, "clang++", buildscript="drone", buildtype="boost", xcode_version="14.1", environment={'TOOLSET': 'clang', 'CXXSTD': cxx, 'TEST_SUITE': suite, 'DEFINE': 'BOOST_MATH_NO_REAL_CONCEPT_TESTS,BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS,BOOST_MATH_MULTI_ARCH_CI_RUN', }, globalenv=globalenv)) - for suite in gcc13_things_to_test: - for cxx in gcc13_stds: - result.append(linux_cxx("Ubuntu g++-13 " + cxx + " " + suite, "g++-13", packages="g++-13", buildtype="boost", image="cppalliance/droneubuntu2404:1", environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-13', 'CXXSTD': cxx, 'TEST_SUITE': suite, }, globalenv=globalenv)) - result.append(linux_cxx("Ubuntu g++-14 " + cxx + " " + suite, "g++-14", packages="g++-14", buildtype="boost", image="cppalliance/droneubuntu2404:1", environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-14', 'CXXSTD': cxx, 'TEST_SUITE': suite, }, globalenv=globalenv)) - - return result - -# from https://github.com/boostorg/boost-ci -load("@boost_ci//ci/drone/:functions.star", "linux_cxx","windows_cxx","osx_cxx","freebsd_cxx") diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index cdd5404fc..000000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,548 +0,0 @@ -# Copyright 2020 Evan Miller -# Copyright 2020 Matt Borland -# Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) - -name: CI -on: - push: - branches: - - master - - develop - - feature/** - pull_request: - release: - types: [published, created, edited] - -concurrency: - group: ${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -jobs: - ubuntu-noble: - runs-on: ubuntu-24.04 - strategy: - fail-fast: false - matrix: - compiler: [ g++-14, clang++-16, clang++-17, clang++-18 ] - standard: [ c++20 ] - suite: [ github_ci_block_1, github_ci_block_2 ] - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: '0' - - name: Set TOOLSET - run: echo ${{ matrix.compiler }} | awk '/^g/ { print "TOOLSET=gcc" } /^clang/ { print "TOOLSET=clang" }' >> $GITHUB_ENV - - name: Add repository - continue-on-error: true - id: addrepo - run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test" - - name: Retry Add Repo - continue-on-error: true - id: retry1 - if: steps.addrepo.outcome=='failure' - run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test" - - name: Retry Add Repo 2 - continue-on-error: true - id: retry2 - if: steps.retry1.outcome=='failure' - run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test" - - name: Install packages - run: sudo apt-get install -y g++-13 g++-14 clang-16 clang-17 clang-18 libgmp-dev libmpfr-dev libfftw3-dev - - name: Checkout main boost - run: git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root - - name: Update tools/boostdep - run: git submodule update --init tools/boostdep - working-directory: ../boost-root - - name: Copy files - run: cp -r $GITHUB_WORKSPACE/* libs/math - working-directory: ../boost-root - - name: Install deps - run: python tools/boostdep/depinst/depinst.py math -I example -I tools - working-directory: ../boost-root - - name: Bootstrap - run: ./bootstrap.sh - working-directory: ../boost-root - - name: Generate headers - run: ./b2 headers - working-directory: ../boost-root - - name: Generate user config - run: 'echo "using $TOOLSET : : ${{ matrix.compiler }} : -std=${{ matrix.standard }} ;" > ~/user-config.jam' - working-directory: ../boost-root - - name: Config info install - run: ../../../b2 config_info_travis_install toolset=$TOOLSET - working-directory: ../boost-root/libs/config/test - - name: Config info - run: ./config_info_travis - working-directory: ../boost-root/libs/config/test - - name: Test - run: ../../../b2 toolset=$TOOLSET ${{ matrix.suite }} define=CI_SUPPRESS_KNOWN_ISSUES define=SLOW_COMPILER define=BOOST_MATH_RUN_MP_TESTS - working-directory: ../boost-root/libs/math/test - - ubuntu-jammy: - runs-on: ubuntu-22.04 - strategy: - fail-fast: false - matrix: - compiler: [ g++-12, clang++-14, clang++-15 ] - standard: [ c++14, c++17 ] - suite: [ github_ci_block_1, github_ci_block_2 ] - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: '0' - - name: Set TOOLSET - run: echo ${{ matrix.compiler }} | awk '/^g/ { print "TOOLSET=gcc" } /^clang/ { print "TOOLSET=clang" }' >> $GITHUB_ENV - - name: Add repository - continue-on-error: true - id: addrepo - run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test" - - name: Retry Add Repo - continue-on-error: true - id: retry1 - if: steps.addrepo.outcome=='failure' - run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test" - - name: Retry Add Repo 2 - continue-on-error: true - id: retry2 - if: steps.retry1.outcome=='failure' - run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test" - - name: Install packages - run: sudo apt-get install -y g++-12 clang-14 clang-15 libgmp-dev libmpfr-dev libfftw3-dev - - name: Checkout main boost - run: git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root - - name: Update tools/boostdep - run: git submodule update --init tools/boostdep - working-directory: ../boost-root - - name: Copy files - run: cp -r $GITHUB_WORKSPACE/* libs/math - working-directory: ../boost-root - - name: Install deps - run: python tools/boostdep/depinst/depinst.py math -I example -I tools - working-directory: ../boost-root - - name: Bootstrap - run: ./bootstrap.sh - working-directory: ../boost-root - - name: Generate headers - run: ./b2 headers - working-directory: ../boost-root - - name: Generate user config - run: 'echo "using $TOOLSET : : ${{ matrix.compiler }} : -std=${{ matrix.standard }} ;" > ~/user-config.jam' - working-directory: ../boost-root - - name: Config info install - run: ../../../b2 config_info_travis_install toolset=$TOOLSET - working-directory: ../boost-root/libs/config/test - - name: Config info - run: ./config_info_travis - working-directory: ../boost-root/libs/config/test - - name: Test - run: ../../../b2 toolset=$TOOLSET ${{ matrix.suite }} define=CI_SUPPRESS_KNOWN_ISSUES define=SLOW_COMPILER define=BOOST_MATH_RUN_MP_TESTS - working-directory: ../boost-root/libs/math/test - ubuntu-focal-no-eh: - runs-on: ubuntu-20.04 - strategy: - fail-fast: false - matrix: - compiler: [ g++-9, g++-11, clang++-10 ] - standard: [ c++14, c++17, c++2a ] - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: '0' - - name: Set TOOLSET - run: echo ${{ matrix.compiler }} | awk '/^g/ { print "TOOLSET=gcc" } /^clang/ { print "TOOLSET=clang" }' >> $GITHUB_ENV - - name: Add repository - continue-on-error: true - id: addrepo - run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test" - - name: Retry Add Repo - continue-on-error: true - id: retry1 - if: steps.addrepo.outcome=='failure' - run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test" - - name: Retry Add Repo 2 - continue-on-error: true - id: retry2 - if: steps.retry1.outcome=='failure' - run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test" - - name: Install packages - run: sudo apt-get install -y g++-9 g++-11 clang-9 clang-10 libgmp-dev libmpfr-dev libfftw3-dev - - name: Checkout main boost - run: git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root - - name: Update tools/boostdep - run: git submodule update --init tools/boostdep - working-directory: ../boost-root - - name: Copy files - run: cp -r $GITHUB_WORKSPACE/* libs/math - working-directory: ../boost-root - - name: Install deps - run: python tools/boostdep/depinst/depinst.py math -I example -I tools - working-directory: ../boost-root - - name: Bootstrap - run: ./bootstrap.sh - working-directory: ../boost-root - - name: Generate headers - run: ./b2 headers - working-directory: ../boost-root - - name: Generate user config - run: 'echo "using $TOOLSET : : ${{ matrix.compiler }} : -std=${{ matrix.standard }} ;" > ~/user-config.jam' - working-directory: ../boost-root - - name: Config info install - run: ../../../b2 config_info_travis_install toolset=$TOOLSET - working-directory: ../boost-root/libs/config/test - - name: Config info - run: ./config_info_travis - working-directory: ../boost-root/libs/config/test - - name: Test - run: ../../../b2 toolset=$TOOLSET no_eh_tests exception-handling=off rtti=off define=CI_SUPPRESS_KNOWN_ISSUES define=SLOW_COMPILER - working-directory: ../boost-root/libs/math/test - macos: - runs-on: macos-latest - strategy: - fail-fast: false - matrix: - toolset: [ clang ] - standard: [ 14, 17, 20 ] - suite: [ github_ci_block_1, github_ci_block_2 ] - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: '0' - - name: Checkout main boost - run: git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root - - name: Update tools/boostdep - run: git submodule update --init tools/boostdep - working-directory: ../boost-root - - name: Copy files - run: cp -r $GITHUB_WORKSPACE/* libs/math - working-directory: ../boost-root - - name: Install deps - run: python tools/boostdep/depinst/depinst.py math -I example -I tools - working-directory: ../boost-root - - name: Bootstrap - run: ./bootstrap.sh - working-directory: ../boost-root - - name: Generate headers - run: ./b2 headers - working-directory: ../boost-root - - name: Config info install - run: ../../../b2 config_info_travis_install toolset=${{ matrix.toolset }} cxxstd=${{ matrix.standard }} - working-directory: ../boost-root/libs/config/test - - name: Config info - run: ./config_info_travis - working-directory: ../boost-root/libs/config/test - - name: Test - run: ../../../b2 toolset=${{ matrix.toolset }} cxxstd=${{ matrix.standard }} ${{ matrix.suite }} define=CI_SUPPRESS_KNOWN_ISSUES define=SLOW_COMPILER - working-directory: ../boost-root/libs/math/test - windows: - runs-on: windows-2019 - defaults: - run: - shell: cmd - env: - ARGS: toolset=${{ matrix.toolset }} address-model=64 cxxstd=${{ matrix.standard }} - ARGSLATEST: toolset=${{ matrix.toolset }} address-model=64 cxxstd=latest - strategy: - fail-fast: false - matrix: - toolset: [ msvc-14.2 ] - standard: [ 14, 17 ] - suite: [ github_ci_block_1, github_ci_block_2 ] - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: '0' - - name: Checkout main boost - run: git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root - - name: Update tools/boostdep - run: git submodule update --init tools/boostdep - working-directory: ../boost-root - - name: Copy files - run: xcopy /s /e /q %GITHUB_WORKSPACE% libs\math - working-directory: ../boost-root - - name: Install deps - run: python tools/boostdep/depinst/depinst.py math -I example -I tools - working-directory: ../boost-root - - name: Bootstrap - run: bootstrap - working-directory: ../boost-root - - name: Generate headers - run: b2 headers - working-directory: ../boost-root - - name: Config info install - run: ..\..\..\b2 config_info_travis_install %ARGS% - working-directory: ../boost-root/libs/config/test - - name: Config info - run: config_info_travis - working-directory: ../boost-root/libs/config/test - - name: Test std-14 vc140 and std-14-17 vc142 - if: ${{ matrix.toolset != 'msvc-14.0' || matrix.standard != '17' }} - run: ..\..\..\b2 --hash %ARGS% define=CI_SUPPRESS_KNOWN_ISSUES debug-symbols=off ${{ matrix.suite }} pch=off - working-directory: ../boost-root/libs/math/test - - name: Test std-latest vc140 - if: ${{ matrix.toolset == 'msvc-14.0' && matrix.standard == '17' }} - run: ..\..\..\b2 --hash %ARGSLATEST% define=CI_SUPPRESS_KNOWN_ISSUES debug-symbols=off ${{ matrix.suite }} pch=off - working-directory: ../boost-root/libs/math/test - windows_gcc: - runs-on: windows-2019 - defaults: - run: - shell: cmd - env: - ARGS: toolset=${{ matrix.toolset }} address-model=64 cxxstd=${{ matrix.standard }} - strategy: - fail-fast: false - matrix: - toolset: [ gcc ] - standard: [ 14, 17 ] - suite: [ github_ci_block_1, github_ci_block_2 ] - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: '0' - - name: Checkout main boost - run: git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root - - name: Update tools/boostdep - run: git submodule update --init tools/boostdep - working-directory: ../boost-root - - name: Copy files - run: xcopy /s /e /q %GITHUB_WORKSPACE% libs\math - working-directory: ../boost-root - - name: Install deps - run: python tools/boostdep/depinst/depinst.py math -I example -I tools - working-directory: ../boost-root - - name: Bootstrap - run: bootstrap - working-directory: ../boost-root - - name: Generate headers - run: b2 headers - working-directory: ../boost-root - - name: Config info install - run: ..\..\..\b2 config_info_travis_install %ARGS% - working-directory: ../boost-root/libs/config/test - - name: Config info - run: config_info_travis - working-directory: ../boost-root/libs/config/test - - name: Test - run: ..\..\..\b2 --hash %ARGS% define=CI_SUPPRESS_KNOWN_ISSUES ${{ matrix.suite }} - working-directory: ../boost-root/libs/math/test - MSVC2022: - runs-on: windows-2022 - defaults: - run: - shell: cmd - env: - ARGS: address-model=64 cxxstd=${{ matrix.standard }} - strategy: - fail-fast: false - matrix: - toolset: [ msvc-14.3, clang-win ] - standard: [ 14, 17, latest ] - suite: [ github_ci_block_1, github_ci_block_2 ] - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: '0' - - name: Checkout main boost - run: git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root - - name: Update tools/boostdep - run: git submodule update --init tools/boostdep - working-directory: ../boost-root - - name: Copy files - run: xcopy /s /e /q %GITHUB_WORKSPACE% libs\math - working-directory: ../boost-root - - name: Install deps - run: python tools/boostdep/depinst/depinst.py math -I example -I tools - working-directory: ../boost-root - - name: Bootstrap - run: bootstrap - working-directory: ../boost-root - - name: Generate headers - run: b2 headers - working-directory: ../boost-root - - name: Config info install - run: ..\..\..\b2 config_info_travis_install %ARGS% - working-directory: ../boost-root/libs/config/test - - name: Config info - run: config_info_travis - working-directory: ../boost-root/libs/config/test - - name: Test - run: ..\..\..\b2 --hash %ARGS% define=CI_SUPPRESS_KNOWN_ISSUES ${{ matrix.suite }} pch=off - working-directory: ../boost-root/libs/math/test - cygwin: - runs-on: windows-latest - strategy: - fail-fast: false - matrix: - compiler: [ g++-11 ] - standard: [ c++17 ] - suite: [ github_ci_block_1, github_ci_block_2 ] - env: - TOOLSET: gcc - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: '0' - - name: Install Cygwin - run: choco install -y cygwin - - name: Install Package Manager - run: choco install -y cyg-get - - name: Install Packages - run: cyg-get git gcc-core gcc-g++ python39 libgmp-devel libmpfr-devel libfftw3-devel - - name: Checkout main boost - run: C:\\tools\\cygwin\\bin\\bash -l -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root' - - name: Update tools/boostdep - run: C:\\tools\\cygwin\\bin\\bash -l -c 'cd $(cygpath -u "$GITHUB_WORKSPACE")/../boost-root && git submodule update --init tools/boostdep' - - name: Copy files - run: C:\\tools\\cygwin\\bin\\bash -l -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && cp -r * ../boost-root/libs/math' - - name: Install deps - run: C:\\tools\\cygwin\\bin\\bash -l -c 'cd $(cygpath -u "$GITHUB_WORKSPACE")/../boost-root && python tools/boostdep/depinst/depinst.py math -I example -I tools' - - name: Bootstrap - run: C:\\tools\\cygwin\\bin\\bash -l -c 'cd $(cygpath -u "$GITHUB_WORKSPACE")/../boost-root && ./bootstrap.sh' - - name: Generate headers - run: C:\\tools\\cygwin\\bin\\bash -l -c 'cd $(cygpath -u "$GITHUB_WORKSPACE")/../boost-root && ./b2 headers' - - name: Config info install - run: C:\\tools\\cygwin\\bin\\bash -l -c 'cd $(cygpath -u "$GITHUB_WORKSPACE")/../boost-root/libs/config/test && ../../../b2 config_info_travis_install toolset=$TOOLSET' - - name: Config info - run: C:\\tools\\cygwin\\bin\\bash -l -c 'cd $(cygpath -u "$GITHUB_WORKSPACE")/../boost-root/libs/config/test && ./config_info_travis' - - name: Test - run: C:\\tools\\cygwin\\bin\\bash -l -c 'cd $(cygpath -u "$GITHUB_WORKSPACE")/../boost-root/libs/math/test && ../../../b2 toolset=$TOOLSET ${{ matrix.suite }} define=CI_SUPPRESS_KNOWN_ISSUES define=SLOW_COMPILER' - standalone-compile-tests-gcc: - runs-on: ubuntu-20.04 - strategy: - fail-fast: false - matrix: - compiler: [ g++-10 ] - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: '0' - - name: Add repository - continue-on-error: true - id: addrepo - run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test" - - name: Retry Add Repo - continue-on-error: true - id: retry1 - if: steps.addrepo.outcome=='failure' - run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test" - - name: Retry Add Repo 2 - continue-on-error: true - id: retry2 - if: steps.retry1.outcome=='failure' - run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test" - - name: Install packages - run: sudo apt-get install -y g++-10 libgmp-dev libmpfr-dev libfftw3-dev - - name: Checkout main boost - run: git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root - - name: Update tools/boostdep - run: git submodule update --init tools/boostdep - working-directory: ../boost-root - - name: Copy files - run: cp -r $GITHUB_WORKSPACE/* libs/math - working-directory: ../boost-root - - name: Run CMake - run: cmake -DBUILD_TESTING=1 -DCMAKE_CXX_COMPILER=g++-10 . - working-directory: ../boost-root/libs/math - - name: Run Compile Tests - run: make -j$((`nproc`+1)) - working-directory: ../boost-root/libs/math - standalone-compile-tests-clang: - runs-on: ubuntu-20.04 - strategy: - fail-fast: false - matrix: - compiler: [ clang++-10 ] - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: '0' - - name: Add repository - continue-on-error: true - id: addrepo - run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test" - - name: Retry Add Repo - continue-on-error: true - id: retry1 - if: steps.addrepo.outcome=='failure' - run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test" - - name: Retry Add Repo 2 - continue-on-error: true - id: retry2 - if: steps.retry1.outcome=='failure' - run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test" - - name: Install packages - run: sudo apt-get install -y clang-10 libgmp-dev libmpfr-dev libfftw3-dev libtbb-dev - - name: Checkout main boost - run: git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root - - name: Update tools/boostdep - run: git submodule update --init tools/boostdep - working-directory: ../boost-root - - name: Copy files - run: cp -r $GITHUB_WORKSPACE/* libs/math - working-directory: ../boost-root - - name: Run CMake - run: cmake -DBUILD_TESTING=1 -DCMAKE_CXX_COMPILER=clang++-10 . - working-directory: ../boost-root/libs/math - - name: Run Compile Tests - run: make -j$((`nproc`+1)) - working-directory: ../boost-root/libs/math - standalone-gcc: - runs-on: ubuntu-20.04 - strategy: - fail-fast: false - matrix: - compiler: [ g++-10 ] - standard: [ c++14, c++17, c++20 ] - suite: [ github_ci_block_1, github_ci_block_2 ] - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: '0' - - name: Set TOOLSET - run: echo ${{ matrix.compiler }} | awk '/^g/ { print "TOOLSET=gcc" } /^clang/ { print "TOOLSET=clang" }' >> $GITHUB_ENV - - name: Add repository - continue-on-error: true - id: addrepo - run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test" - - name: Retry Add Repo - continue-on-error: true - id: retry1 - if: steps.addrepo.outcome=='failure' - run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test" - - name: Retry Add Repo 2 - continue-on-error: true - id: retry2 - if: steps.retry1.outcome=='failure' - run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test" - - name: Install packages - run: sudo apt-get install -y g++-10 libgmp-dev libmpfr-dev libfftw3-dev - - name: Checkout main boost - run: git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root - - name: Update tools/boostdep - run: git submodule update --init tools/boostdep - working-directory: ../boost-root - - name: Copy files - run: cp -r $GITHUB_WORKSPACE/* libs/math - working-directory: ../boost-root - - name: Install deps - run: python tools/boostdep/depinst/depinst.py math -I example -I tools - working-directory: ../boost-root - - name: Bootstrap - run: ./bootstrap.sh - working-directory: ../boost-root - - name: Generate headers - run: ./b2 headers - working-directory: ../boost-root - - name: Generate user config - run: 'echo "using $TOOLSET : : ${{ matrix.compiler }} : -std=${{ matrix.standard }} ;" > ~/user-config.jam' - working-directory: ../boost-root - - name: Config info install - run: ../../../b2 config_info_travis_install toolset=$TOOLSET - working-directory: ../boost-root/libs/config/test - - name: Config info - run: ./config_info_travis - working-directory: ../boost-root/libs/config/test - - name: Test - run: ../../../b2 toolset=$TOOLSET ${{ matrix.suite }} define=CI_SUPPRESS_KNOWN_ISSUES define=SLOW_COMPILER define=BOOST_MATH_STANDALONE define=BOOST_MP_STANDALONE - working-directory: ../boost-root/libs/math/test diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml deleted file mode 100644 index 763b5e1d3..000000000 --- a/.github/workflows/codecov.yml +++ /dev/null @@ -1,209 +0,0 @@ -# Copyright 2020-2021 Peter Dimov -# Copyright 2021 Andrey Semashev -# Copyright 2021 Alexander Grund -# Copyright 2022 James E. King III -# Copyright 2023 Matt Borland -# -# Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) ---- -name: codecov - -on: - pull_request: - push: - branches: - - master - - develop - - bugfix/** - - feature/** - - fix/** - - pr/** - -env: - GIT_FETCH_JOBS: 8 - NET_RETRY_COUNT: 5 - B2_CI_VERSION: 1 - B2_VARIANT: release - B2_LINK: shared - LCOV_BRANCH_COVERAGE: 0 - CODECOV_NAME: Github Actions - -jobs: - posix: - defaults: - run: - shell: bash - - strategy: - fail-fast: false - matrix: - include: - - { name: Collect coverage special_fun, coverage: yes, - compiler: gcc-12, cxxstd: '20', os: ubuntu-22.04, install: 'g++-12-multilib', address-model: '64', suite: 'special_fun' } - - { name: Collect coverage distribution_tests, coverage: yes, - compiler: gcc-12, cxxstd: '20', os: ubuntu-22.04, install: 'g++-12-multilib', address-model: '64', suite: 'distribution_tests' } - - { name: Collect coverage mp, coverage: yes, - compiler: gcc-12, cxxstd: '20', os: ubuntu-22.04, install: 'g++-12-multilib', address-model: '64', suite: 'mp' } - - { name: Collect coverage misc, coverage: yes, - compiler: gcc-12, cxxstd: '20', os: ubuntu-22.04, install: 'g++-12-multilib', address-model: '64', suite: 'misc' } - - { name: Collect coverage quadrature, coverage: yes, - compiler: gcc-12, cxxstd: '20', os: ubuntu-22.04, install: 'g++-12-multilib', address-model: '64', suite: 'quadrature' } - - { name: Collect coverage interpolators, coverage: yes, - compiler: gcc-12, cxxstd: '20', os: ubuntu-22.04, install: 'g++-12-multilib', address-model: '64', suite: 'interpolators' } - - { name: Collect coverage autodiff, coverage: yes, - compiler: gcc-12, cxxstd: '20', os: ubuntu-22.04, install: 'g++-12-multilib', address-model: '64', suite: 'autodiff' } - timeout-minutes: 360 - runs-on: ${{matrix.os}} - container: ${{matrix.container}} - env: {B2_USE_CCACHE: 1} - - steps: - - name: Setup environment - run: | - if [ -f "/etc/debian_version" ]; then - echo "DEBIAN_FRONTEND=noninteractive" >> $GITHUB_ENV - export DEBIAN_FRONTEND=noninteractive - fi - if [ -n "${{matrix.container}}" ] && [ -f "/etc/debian_version" ]; then - apt-get -o Acquire::Retries=$NET_RETRY_COUNT update - apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y sudo software-properties-common curl - # Need (newer) git, and the older Ubuntu container may require requesting the key manually using port 80 - curl -sSL --retry ${NET_RETRY_COUNT:-5} 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xE1DD270288B4E6030699E45FA1715D88E1DF1F24' | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/git-core_ubuntu_ppa.gpg - for i in {1..${NET_RETRY_COUNT:-3}}; do sudo -E add-apt-repository -y ppa:git-core/ppa && break || sleep 10; done - apt-get -o Acquire::Retries=$NET_RETRY_COUNT update - osver=$(lsb_release -sr | cut -f1 -d.) - pkgs="g++ git" - # Ubuntu 22+ has only Python 3 in the repos - if [ -n "$osver" ] && [ "$osver" -ge "22" ]; then - pkgs+=" python-is-python3 libpython3-dev" - else - pkgs+=" python libpython-dev" - fi - apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y $pkgs - fi - # For jobs not compatible with ccache, use "ccache: no" in the matrix - if [[ "${{ matrix.ccache }}" == "no" ]]; then - echo "B2_USE_CCACHE=0" >> $GITHUB_ENV - fi - git config --global pack.threads 0 - - - uses: actions/checkout@v4 - with: - # For coverage builds fetch the whole history, else only 1 commit using a 'fake ternary' - fetch-depth: ${{ matrix.coverage && '0' || '1' }} - - - name: Cache ccache - uses: actions/cache@v4 - if: env.B2_USE_CCACHE - with: - path: ~/.ccache - key: ${{matrix.os}}-${{matrix.container}}-${{matrix.compiler}}-${{github.sha}} - restore-keys: ${{matrix.os}}-${{matrix.container}}-${{matrix.compiler}}- - - - name: Fetch Boost.CI - uses: actions/checkout@v4 - with: - repository: boostorg/boost-ci - ref: master - path: boost-ci-cloned - - - name: Get CI scripts folder - run: | - # Copy ci folder if not testing Boost.CI - [[ "$GITHUB_REPOSITORY" =~ "boost-ci" ]] || cp -r boost-ci-cloned/ci . - rm -rf boost-ci-cloned - - - name: Install packages - if: startsWith(matrix.os, 'ubuntu') - run: | - SOURCE_KEYS=(${{join(matrix.source_keys, ' ')}}) - SOURCES=(${{join(matrix.sources, ' ')}}) - # Add this by default - SOURCES+=(ppa:ubuntu-toolchain-r/test) - for key in "${SOURCE_KEYS[@]}"; do - for i in {1..$NET_RETRY_COUNT}; do - keyfilename=$(basename -s .key $key) - curl -sSL --retry ${NET_RETRY_COUNT:-5} "$key" | sudo gpg --dearmor > /etc/apt/trusted.gpg.d/${keyfilename} && break || sleep 10 - done - done - for source in "${SOURCES[@]}"; do - for i in {1..$NET_RETRY_COUNT}; do - sudo add-apt-repository $source && break || sleep 10 - done - done - sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT update - if [[ -z "${{matrix.install}}" ]]; then - pkgs="${{matrix.compiler}}" - pkgs="${pkgs/gcc-/g++-}" - else - pkgs="${{matrix.install}}" - fi - sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y $pkgs - - - name: Setup GCC Toolchain - if: matrix.gcc_toolchain - run: | - GCC_TOOLCHAIN_ROOT="$HOME/gcc-toolchain" - echo "GCC_TOOLCHAIN_ROOT=$GCC_TOOLCHAIN_ROOT" >> $GITHUB_ENV - if ! command -v dpkg-architecture; then - apt-get install -y dpkg-dev - fi - MULTIARCH_TRIPLET="$(dpkg-architecture -qDEB_HOST_MULTIARCH)" - mkdir -p "$GCC_TOOLCHAIN_ROOT" - ln -s /usr/include "$GCC_TOOLCHAIN_ROOT/include" - ln -s /usr/bin "$GCC_TOOLCHAIN_ROOT/bin" - mkdir -p "$GCC_TOOLCHAIN_ROOT/lib/gcc/$MULTIARCH_TRIPLET" - ln -s "/usr/lib/gcc/$MULTIARCH_TRIPLET/${{matrix.gcc_toolchain}}" "$GCC_TOOLCHAIN_ROOT/lib/gcc/$MULTIARCH_TRIPLET/${{matrix.gcc_toolchain}}" - - - name: Setup multiarch - if: matrix.multiarch - run: | - sudo apt-get install --no-install-recommends -y binfmt-support qemu-user-static - sudo docker run --rm --privileged multiarch/qemu-user-static --reset -p yes - git clone https://github.com/jeking3/bdde.git - echo "$(pwd)/bdde/bin/linux" >> ${GITHUB_PATH} - echo "BDDE_DISTRO=${{ matrix.distro }}" >> ${GITHUB_ENV} - echo "BDDE_EDITION=${{ matrix.edition }}" >> ${GITHUB_ENV} - echo "BDDE_ARCH=${{ matrix.arch }}" >> ${GITHUB_ENV} - echo "B2_WRAPPER=bdde" >> ${GITHUB_ENV} - - - name: Setup Boost - env: - B2_ADDRESS_MODEL: ${{matrix.address-model}} - B2_COMPILER: ${{matrix.compiler}} - B2_CXXSTD: ${{matrix.cxxstd}} - B2_SANITIZE: ${{matrix.sanitize}} - B2_STDLIB: ${{matrix.stdlib}} - # More entries can be added in the same way, see the B2_ARGS assignment in ci/enforce.sh for the possible keys. - B2_DEFINES: CI_SUPPRESS_KNOWN_ISSUES=1 SLOW_COMPILER=1 BOOST_MATH_NO_REAL_CONCEPT_TESTS=1 - # Variables set here (to non-empty) will override the top-level environment variables, e.g. - # B2_VARIANT: ${{matrix.variant}} - # Set the (B2) target(s) to build, defaults to the test folder of the current library - # Can alternatively be done like this in the build step or in the build command of the build step, e.g. `run: B2_TARGETS=libs/$SELF/doc ci/build.sh` - B2_TARGETS: libs/math/test//${{ matrix.suite }} - run: source ci/github/install.sh - - - name: Setup coverage collection - if: matrix.coverage - run: ci/github/codecov.sh "setup" - - - name: Run tests - if: '!matrix.coverity' - run: ci/build.sh - - - name: Upload coverage - if: matrix.coverage - run: ci/codecov.sh "upload" - env: - BOOST_CI_CODECOV_IO_UPLOAD: skip - - - name: Upload coverage - if: matrix.coverage - uses: codecov/codecov-action@v4 - with: - disable_search: true - file: coverage.info - name: Github Actions - token: ${{secrets.CODECOV_TOKEN}} - verbose: true From c1c7e9789ca988b0e9b0fa6dbe762bfef3657934 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Thu, 18 Jul 2024 10:57:45 -0400 Subject: [PATCH 12/64] Add CUDA cmake workflow --- .github/workflows/cuda.yml | 77 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 .github/workflows/cuda.yml diff --git a/.github/workflows/cuda.yml b/.github/workflows/cuda.yml new file mode 100644 index 000000000..a6d10844c --- /dev/null +++ b/.github/workflows/cuda.yml @@ -0,0 +1,77 @@ +# Copyright 2024 Matt Borland +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) + +name: CUDA +on: + push: + branches: + - master + - develop + - feature/** + pull_request: + release: + types: [published, created, edited] + +concurrency: + group: ${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + posix-cmake-test: + strategy: + fail-fast: false + + runs-on: gpu-runner-1 + + steps: + - uses: Jimver/cuda-toolkit@v0.2.16 + id: cuda-toolkit + with: + cuda: '12.5.0' + method: 'network' + sub-packages: '["nvcc"]' + + - name: Output CUDA information + run: | + echo "Installed cuda version is: ${{steps.cuda-toolkit.outputs.cuda}}"+ + echo "Cuda install location: ${{steps.cuda-toolkit.outputs.CUDA_PATH}}" + nvcc -V + - uses: actions/checkout@v4 + + - name: Install Packages + run: | + sudo apt-get install -y cmake make + - name: Setup Boost + run: | + echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY + LIBRARY=${GITHUB_REPOSITORY#*/} + echo LIBRARY: $LIBRARY + echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV + echo GITHUB_BASE_REF: $GITHUB_BASE_REF + echo GITHUB_REF: $GITHUB_REF + REF=${GITHUB_BASE_REF:-$GITHUB_REF} + REF=${REF#refs/heads/} + echo REF: $REF + BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true + echo BOOST_BRANCH: $BOOST_BRANCH + cd .. + git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root + cd boost-root + mkdir -p libs/$LIBRARY + cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY + git submodule update --init tools/boostdep + python3 tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY + - name: Configure + run: | + cd ../boost-root + mkdir __build__ && cd __build__ + cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DBUILD_TESTING=ON -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc -DENABLE_CUDA=1 -DCMAKE_CUDA_ARCHITECTURES=70 .. + - name: Build tests + run: | + cd ../boost-root/__build__ + cmake --build . --target tests + - name: Run tests + run: | + cd ../boost-root/__build__ + ctest --output-on-failure --no-tests=error \ No newline at end of file From d10faa870ed5b783b8d7b83a74b93650c00f8f8d Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Thu, 18 Jul 2024 13:44:23 -0400 Subject: [PATCH 13/64] Add cuda markers to arcsine distribution --- include/boost/math/distributions/arcsine.hpp | 51 ++++++++++---------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/include/boost/math/distributions/arcsine.hpp b/include/boost/math/distributions/arcsine.hpp index a8fcbbc05..fd160da6e 100644 --- a/include/boost/math/distributions/arcsine.hpp +++ b/include/boost/math/distributions/arcsine.hpp @@ -30,6 +30,7 @@ #define BOOST_MATH_DIST_ARCSINE_HPP #include +#include #include #include // complements. #include // error checks. @@ -55,7 +56,7 @@ namespace boost // Common error checking routines for arcsine distribution functions: // Duplicating for x_min and x_max provides specific error messages. template - inline bool check_x_min(const char* function, const RealType& x, RealType* result, const Policy& pol) + BOOST_MATH_HOST_DEVICE inline bool check_x_min(const char* function, const RealType& x, RealType* result, const Policy& pol) { if (!(boost::math::isfinite)(x)) { @@ -68,7 +69,7 @@ namespace boost } // bool check_x_min template - inline bool check_x_max(const char* function, const RealType& x, RealType* result, const Policy& pol) + BOOST_MATH_HOST_DEVICE inline bool check_x_max(const char* function, const RealType& x, RealType* result, const Policy& pol) { if (!(boost::math::isfinite)(x)) { @@ -82,7 +83,7 @@ namespace boost template - inline bool check_x_minmax(const char* function, const RealType& x_min, const RealType& x_max, RealType* result, const Policy& pol) + BOOST_MATH_HOST_DEVICE inline bool check_x_minmax(const char* function, const RealType& x_min, const RealType& x_max, RealType* result, const Policy& pol) { // Check x_min < x_max if (x_min >= x_max) { @@ -100,7 +101,7 @@ namespace boost } // bool check_x_minmax template - inline bool check_prob(const char* function, const RealType& p, RealType* result, const Policy& pol) + BOOST_MATH_HOST_DEVICE inline bool check_prob(const char* function, const RealType& p, RealType* result, const Policy& pol) { if ((p < 0) || (p > 1) || !(boost::math::isfinite)(p)) { @@ -113,7 +114,7 @@ namespace boost } // bool check_prob template - inline bool check_x(const char* function, const RealType& x_min, const RealType& x_max, const RealType& x, RealType* result, const Policy& pol) + BOOST_MATH_HOST_DEVICE inline bool check_x(const char* function, const RealType& x_min, const RealType& x_max, const RealType& x, RealType* result, const Policy& pol) { // Check x finite and x_min < x < x_max. if (!(boost::math::isfinite)(x)) { @@ -137,7 +138,7 @@ namespace boost } // bool check_x template - inline bool check_dist(const char* function, const RealType& x_min, const RealType& x_max, RealType* result, const Policy& pol) + BOOST_MATH_HOST_DEVICE inline bool check_dist(const char* function, const RealType& x_min, const RealType& x_max, RealType* result, const Policy& pol) { // Check both x_min and x_max finite, and x_min < x_max. return check_x_min(function, x_min, result, pol) && check_x_max(function, x_max, result, pol) @@ -145,14 +146,14 @@ namespace boost } // bool check_dist template - inline bool check_dist_and_x(const char* function, const RealType& x_min, const RealType& x_max, RealType x, RealType* result, const Policy& pol) + BOOST_MATH_HOST_DEVICE inline bool check_dist_and_x(const char* function, const RealType& x_min, const RealType& x_max, RealType x, RealType* result, const Policy& pol) { return check_dist(function, x_min, x_max, result, pol) && arcsine_detail::check_x(function, x_min, x_max, x, result, pol); } // bool check_dist_and_x template - inline bool check_dist_and_prob(const char* function, const RealType& x_min, const RealType& x_max, RealType p, RealType* result, const Policy& pol) + BOOST_MATH_HOST_DEVICE inline bool check_dist_and_prob(const char* function, const RealType& x_min, const RealType& x_max, RealType p, RealType* result, const Policy& pol) { return check_dist(function, x_min, x_max, result, pol) && check_prob(function, p, result, pol); @@ -167,7 +168,7 @@ namespace boost typedef RealType value_type; typedef Policy policy_type; - arcsine_distribution(RealType x_min = 0, RealType x_max = 1) : m_x_min(x_min), m_x_max(x_max) + BOOST_MATH_HOST_DEVICE arcsine_distribution(RealType x_min = 0, RealType x_max = 1) : m_x_min(x_min), m_x_max(x_max) { // Default beta (alpha = beta = 0.5) is standard arcsine with x_min = 0, x_max = 1. // Generalized to allow x_min and x_max to be specified. RealType result; @@ -178,11 +179,11 @@ namespace boost &result, Policy()); } // arcsine_distribution constructor. // Accessor functions: - RealType x_min() const + BOOST_MATH_HOST_DEVICE RealType x_min() const { return m_x_min; } - RealType x_max() const + BOOST_MATH_HOST_DEVICE RealType x_max() const { return m_x_max; } @@ -203,21 +204,21 @@ namespace boost #endif template - inline const std::pair range(const arcsine_distribution& dist) + BOOST_MATH_HOST_DEVICE inline const std::pair range(const arcsine_distribution& dist) { // Range of permissible values for random variable x. using boost::math::tools::max_value; return std::pair(static_cast(dist.x_min()), static_cast(dist.x_max())); } template - inline const std::pair support(const arcsine_distribution& dist) + BOOST_MATH_HOST_DEVICE inline const std::pair support(const arcsine_distribution& dist) { // Range of supported values for random variable x. // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero. return std::pair(static_cast(dist.x_min()), static_cast(dist.x_max())); } template - inline RealType mean(const arcsine_distribution& dist) + BOOST_MATH_HOST_DEVICE inline RealType mean(const arcsine_distribution& dist) { // Mean of arcsine distribution . RealType result; RealType x_min = dist.x_min(); @@ -236,7 +237,7 @@ namespace boost } // mean template - inline RealType variance(const arcsine_distribution& dist) + BOOST_MATH_HOST_DEVICE inline RealType variance(const arcsine_distribution& dist) { // Variance of standard arcsine distribution = (1-0)/8 = 0.125. RealType result; RealType x_min = dist.x_min(); @@ -254,7 +255,7 @@ namespace boost } // variance template - inline RealType mode(const arcsine_distribution& /* dist */) + BOOST_MATH_HOST_DEVICE inline RealType mode(const arcsine_distribution& /* dist */) { //There are always [*two] values for the mode, at ['x_min] and at ['x_max], default 0 and 1, // so instead we raise the exception domain_error. return policies::raise_domain_error( @@ -265,7 +266,7 @@ namespace boost } // mode template - inline RealType median(const arcsine_distribution& dist) + BOOST_MATH_HOST_DEVICE inline RealType median(const arcsine_distribution& dist) { // Median of arcsine distribution (a + b) / 2 == mean. RealType x_min = dist.x_min(); RealType x_max = dist.x_max(); @@ -283,7 +284,7 @@ namespace boost } template - inline RealType skewness(const arcsine_distribution& dist) + BOOST_MATH_HOST_DEVICE inline RealType skewness(const arcsine_distribution& dist) { RealType result; RealType x_min = dist.x_min(); @@ -302,7 +303,7 @@ namespace boost } // skewness template - inline RealType kurtosis_excess(const arcsine_distribution& dist) + BOOST_MATH_HOST_DEVICE inline RealType kurtosis_excess(const arcsine_distribution& dist) { RealType result; RealType x_min = dist.x_min(); @@ -322,7 +323,7 @@ namespace boost } // kurtosis_excess template - inline RealType kurtosis(const arcsine_distribution& dist) + BOOST_MATH_HOST_DEVICE inline RealType kurtosis(const arcsine_distribution& dist) { RealType result; RealType x_min = dist.x_min(); @@ -342,7 +343,7 @@ namespace boost } // kurtosis template - inline RealType pdf(const arcsine_distribution& dist, const RealType& xx) + BOOST_MATH_HOST_DEVICE inline RealType pdf(const arcsine_distribution& dist, const RealType& xx) { // Probability Density/Mass Function arcsine. BOOST_FPU_EXCEPTION_GUARD BOOST_MATH_STD_USING // For ADL of std functions. @@ -368,7 +369,7 @@ namespace boost } // pdf template - inline RealType cdf(const arcsine_distribution& dist, const RealType& x) + BOOST_MATH_HOST_DEVICE inline RealType cdf(const arcsine_distribution& dist, const RealType& x) { // Cumulative Distribution Function arcsine. BOOST_MATH_STD_USING // For ADL of std functions. @@ -401,7 +402,7 @@ namespace boost } // arcsine cdf template - inline RealType cdf(const complemented2_type, RealType>& c) + BOOST_MATH_HOST_DEVICE inline RealType cdf(const complemented2_type, RealType>& c) { // Complemented Cumulative Distribution Function arcsine. BOOST_MATH_STD_USING // For ADL of std functions. static const char* function = "boost::math::cdf(arcsine_distribution<%1%> const&, %1%)"; @@ -437,7 +438,7 @@ namespace boost } // arcsine ccdf template - inline RealType quantile(const arcsine_distribution& dist, const RealType& p) + BOOST_MATH_HOST_DEVICE inline RealType quantile(const arcsine_distribution& dist, const RealType& p) { // Quantile or Percent Point arcsine function or // Inverse Cumulative probability distribution function CDF. @@ -481,7 +482,7 @@ namespace boost } // quantile template - inline RealType quantile(const complemented2_type, RealType>& c) + BOOST_MATH_HOST_DEVICE inline RealType quantile(const complemented2_type, RealType>& c) { // Complement Quantile or Percent Point arcsine function. // Return the number of expected x for a given From b51f61b8e4787a9c28b4c5079e0bf528f65b8277 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Thu, 18 Jul 2024 13:44:35 -0400 Subject: [PATCH 14/64] Add arcsine dist testing --- test/cmake_jamfile | 1 + test/test_arcsine.cpp | 113 +++++++++++++++++++++--------------------- 2 files changed, 57 insertions(+), 57 deletions(-) diff --git a/test/cmake_jamfile b/test/cmake_jamfile index b9cd7c524..19f7e9978 100644 --- a/test/cmake_jamfile +++ b/test/cmake_jamfile @@ -16,4 +16,5 @@ run test_autodiff_1.cpp ; run test_polynomial.cpp ; # Distributions +run test_arcsine.cpp ; run test_binomial.cpp ; diff --git a/test/test_arcsine.cpp b/test/test_arcsine.cpp index 0c2d847a9..3b579e42d 100644 --- a/test/test_arcsine.cpp +++ b/test/test_arcsine.cpp @@ -10,7 +10,7 @@ // Tests for the arcsine Distribution. -#include // Must be 1st include, and include_directory /libs/math/src/tr1/ is needed. +// #include // Must be 1st include, and include_directory /libs/math/src/tr1/ is needed. #ifdef _MSC_VER # pragma warning(disable: 4127) // Conditional expression is constant. @@ -20,7 +20,6 @@ #include // for real_concept. using ::boost::math::concepts::real_concept; -#include // for real_concept. #include // for arcsine_distribution. using boost::math::arcsine_distribution; @@ -272,7 +271,7 @@ void test_spots(RealType) BOOST_CHECK_EQUAL(kurtosis_excess(arcsine_01), -1.5); // 3/2 BOOST_CHECK_EQUAL(support(arcsine_01).first, 0); // BOOST_CHECK_EQUAL(range(arcsine_01).first, 0); // - BOOST_MATH_CHECK_THROW(mode(arcsine_01), std::domain_error); // Two modes at x_min and x_max, so throw instead. + BOOST_CHECK_THROW(mode(arcsine_01), std::domain_error); // Two modes at x_min and x_max, so throw instead. // PDF // pdf of x = 1/4 is same as reflected value at x = 3/4. @@ -439,56 +438,56 @@ void test_spots(RealType) BOOST_CHECK_CLOSE_FRACTION(quantile(complement(as_m2m1, static_cast(0.85643370687129372924905811522494428117838480010259L))), -static_cast(1.95L), 4 * tolerance); // Tests that should throw: - BOOST_MATH_CHECK_THROW(mode(arcsine_distribution(static_cast(0), static_cast(1))), std::domain_error); + BOOST_CHECK_THROW(mode(arcsine_distribution(static_cast(0), static_cast(1))), std::domain_error); // mode is undefined, and must throw domain_error! - BOOST_MATH_CHECK_THROW( // For various bad arguments. + BOOST_CHECK_THROW( // For various bad arguments. pdf( arcsine_distribution(static_cast(+1), static_cast(-1)), // min_x > max_x static_cast(1)), std::domain_error); - BOOST_MATH_CHECK_THROW( + BOOST_CHECK_THROW( pdf( arcsine_distribution(static_cast(1), static_cast(0)), // bad constructor parameters. static_cast(1)), std::domain_error); - BOOST_MATH_CHECK_THROW( + BOOST_CHECK_THROW( pdf( arcsine_distribution(static_cast(1), static_cast(-1)), // bad constructor parameters. static_cast(1)), std::domain_error); - BOOST_MATH_CHECK_THROW( + BOOST_CHECK_THROW( pdf( arcsine_distribution(static_cast(1), static_cast(1)), // equal constructor parameters. static_cast(-1)), std::domain_error); - BOOST_MATH_CHECK_THROW( + BOOST_CHECK_THROW( pdf( arcsine_distribution(static_cast(0), static_cast(1)), // bad x > 1. static_cast(999)), std::domain_error); - BOOST_MATH_CHECK_THROW( // For various bad arguments. + BOOST_CHECK_THROW( // For various bad arguments. logpdf( arcsine_distribution(static_cast(+1), static_cast(-1)), // min_x > max_x static_cast(1)), std::domain_error); - BOOST_MATH_CHECK_THROW( + BOOST_CHECK_THROW( logpdf( arcsine_distribution(static_cast(1), static_cast(0)), // bad constructor parameters. static_cast(1)), std::domain_error); - BOOST_MATH_CHECK_THROW( + BOOST_CHECK_THROW( logpdf( arcsine_distribution(static_cast(1), static_cast(-1)), // bad constructor parameters. static_cast(1)), std::domain_error); - BOOST_MATH_CHECK_THROW( + BOOST_CHECK_THROW( logpdf( arcsine_distribution(static_cast(1), static_cast(1)), // equal constructor parameters. static_cast(-1)), std::domain_error); - BOOST_MATH_CHECK_THROW( + BOOST_CHECK_THROW( logpdf( arcsine_distribution(static_cast(0), static_cast(1)), // bad x > 1. static_cast(999)), std::domain_error); @@ -496,26 +495,26 @@ void test_spots(RealType) // Checks on things that are errors. // Construction with 'bad' parameters. - BOOST_MATH_CHECK_THROW(arcsine_distribution(+1, -1), std::domain_error); // max < min. - BOOST_MATH_CHECK_THROW(arcsine_distribution(+1, 0), std::domain_error); // max < min. + BOOST_CHECK_THROW(arcsine_distribution(+1, -1), std::domain_error); // max < min. + BOOST_CHECK_THROW(arcsine_distribution(+1, 0), std::domain_error); // max < min. arcsine_distribution<> dist; - BOOST_MATH_CHECK_THROW(pdf(dist, -1), std::domain_error); - BOOST_MATH_CHECK_THROW(logpdf(dist, -1), std::domain_error); - BOOST_MATH_CHECK_THROW(cdf(dist, -1), std::domain_error); - BOOST_MATH_CHECK_THROW(cdf(complement(dist, -1)), std::domain_error); - BOOST_MATH_CHECK_THROW(quantile(dist, -1), std::domain_error); - BOOST_MATH_CHECK_THROW(quantile(complement(dist, -1)), std::domain_error); - BOOST_MATH_CHECK_THROW(quantile(dist, -1), std::domain_error); - BOOST_MATH_CHECK_THROW(quantile(complement(dist, -1)), std::domain_error); + BOOST_CHECK_THROW(pdf(dist, -1), std::domain_error); + BOOST_CHECK_THROW(logpdf(dist, -1), std::domain_error); + BOOST_CHECK_THROW(cdf(dist, -1), std::domain_error); + BOOST_CHECK_THROW(cdf(complement(dist, -1)), std::domain_error); + BOOST_CHECK_THROW(quantile(dist, -1), std::domain_error); + BOOST_CHECK_THROW(quantile(complement(dist, -1)), std::domain_error); + BOOST_CHECK_THROW(quantile(dist, -1), std::domain_error); + BOOST_CHECK_THROW(quantile(complement(dist, -1)), std::domain_error); // Various combinations of bad constructor and member function parameters. - BOOST_MATH_CHECK_THROW(pdf(boost::math::arcsine_distribution(0, 1), -1), std::domain_error); - BOOST_MATH_CHECK_THROW(pdf(boost::math::arcsine_distribution(-1, 1), +2), std::domain_error); - BOOST_MATH_CHECK_THROW(logpdf(boost::math::arcsine_distribution(0, 1), -1), std::domain_error); - BOOST_MATH_CHECK_THROW(logpdf(boost::math::arcsine_distribution(-1, 1), +2), std::domain_error); - BOOST_MATH_CHECK_THROW(quantile(boost::math::arcsine_distribution(1, 1), -1), std::domain_error); - BOOST_MATH_CHECK_THROW(quantile(boost::math::arcsine_distribution(1, 1), 2), std::domain_error); + BOOST_CHECK_THROW(pdf(boost::math::arcsine_distribution(0, 1), -1), std::domain_error); + BOOST_CHECK_THROW(pdf(boost::math::arcsine_distribution(-1, 1), +2), std::domain_error); + BOOST_CHECK_THROW(logpdf(boost::math::arcsine_distribution(0, 1), -1), std::domain_error); + BOOST_CHECK_THROW(logpdf(boost::math::arcsine_distribution(-1, 1), +2), std::domain_error); + BOOST_CHECK_THROW(quantile(boost::math::arcsine_distribution(1, 1), -1), std::domain_error); + BOOST_CHECK_THROW(quantile(boost::math::arcsine_distribution(1, 1), 2), std::domain_error); // No longer allow any parameter to be NaN or inf, so all these tests should throw. if (std::numeric_limits::has_quiet_NaN) @@ -523,23 +522,23 @@ void test_spots(RealType) // Attempt to construct from non-finite parameters should throw. RealType nan = std::numeric_limits::quiet_NaN(); #ifndef BOOST_NO_EXCEPTIONS - BOOST_MATH_CHECK_THROW(arcsine_distribution w(nan), std::domain_error); - BOOST_MATH_CHECK_THROW(arcsine_distribution w(1, nan), std::domain_error); - BOOST_MATH_CHECK_THROW(arcsine_distribution w(nan, 1), std::domain_error); + BOOST_CHECK_THROW(arcsine_distribution w(nan), std::domain_error); + BOOST_CHECK_THROW(arcsine_distribution w(1, nan), std::domain_error); + BOOST_CHECK_THROW(arcsine_distribution w(nan, 1), std::domain_error); #else - BOOST_MATH_CHECK_THROW(arcsine_distribution(nan), std::domain_error); - BOOST_MATH_CHECK_THROW(arcsine_distribution(1, nan), std::domain_error); - BOOST_MATH_CHECK_THROW(arcsine_distribution(nan, 1), std::domain_error); + BOOST_CHECK_THROW(arcsine_distribution(nan), std::domain_error); + BOOST_CHECK_THROW(arcsine_distribution(1, nan), std::domain_error); + BOOST_CHECK_THROW(arcsine_distribution(nan, 1), std::domain_error); #endif arcsine_distribution w(RealType(-1), RealType(+1)); // NaN parameters to member functions should throw. - BOOST_MATH_CHECK_THROW(pdf(w, +nan), std::domain_error); // x = NaN - BOOST_MATH_CHECK_THROW(logpdf(w, +nan), std::domain_error); // x = NaN - BOOST_MATH_CHECK_THROW(cdf(w, +nan), std::domain_error); // x = NaN - BOOST_MATH_CHECK_THROW(cdf(complement(w, +nan)), std::domain_error); // x = + nan - BOOST_MATH_CHECK_THROW(quantile(w, +nan), std::domain_error); // p = + nan - BOOST_MATH_CHECK_THROW(quantile(complement(w, +nan)), std::domain_error); // p = + nan + BOOST_CHECK_THROW(pdf(w, +nan), std::domain_error); // x = NaN + BOOST_CHECK_THROW(logpdf(w, +nan), std::domain_error); // x = NaN + BOOST_CHECK_THROW(cdf(w, +nan), std::domain_error); // x = NaN + BOOST_CHECK_THROW(cdf(complement(w, +nan)), std::domain_error); // x = + nan + BOOST_CHECK_THROW(quantile(w, +nan), std::domain_error); // p = + nan + BOOST_CHECK_THROW(quantile(complement(w, +nan)), std::domain_error); // p = + nan } // has_quiet_NaN if (std::numeric_limits::has_infinity) @@ -547,27 +546,27 @@ void test_spots(RealType) // Attempt to construct from non-finite should throw. RealType inf = std::numeric_limits::infinity(); #ifndef BOOST_NO_EXCEPTIONS - BOOST_MATH_CHECK_THROW(arcsine_distribution w(inf), std::domain_error); - BOOST_MATH_CHECK_THROW(arcsine_distribution w(1, inf), std::domain_error); + BOOST_CHECK_THROW(arcsine_distribution w(inf), std::domain_error); + BOOST_CHECK_THROW(arcsine_distribution w(1, inf), std::domain_error); #else - BOOST_MATH_CHECK_THROW(arcsine_distribution(inf), std::domain_error); - BOOST_MATH_CHECK_THROW(arcsine_distribution(1, inf), std::domain_error); + BOOST_CHECK_THROW(arcsine_distribution(inf), std::domain_error); + BOOST_CHECK_THROW(arcsine_distribution(1, inf), std::domain_error); #endif // Infinite parameters to member functions should throw. arcsine_distribution w(RealType(0), RealType(1)); #ifndef BOOST_NO_EXCEPTIONS - BOOST_MATH_CHECK_THROW(arcsine_distribution w(inf), std::domain_error); - BOOST_MATH_CHECK_THROW(arcsine_distribution w(1, inf), std::domain_error); + BOOST_CHECK_THROW(arcsine_distribution w(inf), std::domain_error); + BOOST_CHECK_THROW(arcsine_distribution w(1, inf), std::domain_error); #else - BOOST_MATH_CHECK_THROW(arcsine_distribution(inf), std::domain_error); - BOOST_MATH_CHECK_THROW(arcsine_distribution(1, inf), std::domain_error); + BOOST_CHECK_THROW(arcsine_distribution(inf), std::domain_error); + BOOST_CHECK_THROW(arcsine_distribution(1, inf), std::domain_error); #endif - BOOST_MATH_CHECK_THROW(pdf(w, +inf), std::domain_error); // x = inf - BOOST_MATH_CHECK_THROW(logpdf(w, +inf), std::domain_error); // x = inf - BOOST_MATH_CHECK_THROW(cdf(w, +inf), std::domain_error); // x = inf - BOOST_MATH_CHECK_THROW(cdf(complement(w, +inf)), std::domain_error); // x = + inf - BOOST_MATH_CHECK_THROW(quantile(w, +inf), std::domain_error); // p = + inf - BOOST_MATH_CHECK_THROW(quantile(complement(w, +inf)), std::domain_error); // p = + inf + BOOST_CHECK_THROW(pdf(w, +inf), std::domain_error); // x = inf + BOOST_CHECK_THROW(logpdf(w, +inf), std::domain_error); // x = inf + BOOST_CHECK_THROW(cdf(w, +inf), std::domain_error); // x = inf + BOOST_CHECK_THROW(cdf(complement(w, +inf)), std::domain_error); // x = + inf + BOOST_CHECK_THROW(quantile(w, +inf), std::domain_error); // p = + inf + BOOST_CHECK_THROW(quantile(complement(w, +inf)), std::domain_error); // p = + inf } // has_infinity // Error handling checks: @@ -601,7 +600,7 @@ void test_spots(RealType) BOOST_CHECK_EQUAL(kurtosis_excess(as), -1.5); // 3/2 BOOST_CHECK_EQUAL(support(as).first, 0); // BOOST_CHECK_EQUAL(range(as).first, 0); // - BOOST_MATH_CHECK_THROW(mode(as), std::domain_error); // Two modes at x_min and x_max, so throw instead. + BOOST_CHECK_THROW(mode(as), std::domain_error); // Two modes at x_min and x_max, so throw instead. // (Parameter value, arbitrarily zero, only communicates the floating point type). test_spots(0.0F); // Test float. From 372dd855ac55c249917d18576fd025ea26e19e2b Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Thu, 18 Jul 2024 14:57:11 -0400 Subject: [PATCH 15/64] Enable use of language and test CUDA compiler --- test/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 689ea7a83..f8eae528c 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -6,6 +6,9 @@ include(BoostTestJamfile OPTIONAL RESULT_VARIABLE HAVE_BOOST_TEST) if(HAVE_BOOST_TEST) + enable_language(CUDA) + set(CMAKE_CUDA_EXTENSIONS OFF) + boost_test_jamfile(FILE cmake_jamfile LINK_LIBRARIES Boost::cuda_math Boost::assert Boost::concept_check Boost::config Boost::core Boost::integer Boost::lexical_cast Boost::multiprecision Boost::predef Boost::random Boost::static_assert Boost::throw_exception Boost::unit_test_framework ) endif() From 59369848cf6b73aa02786fb0ec942b100ab03d8a Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Thu, 18 Jul 2024 15:07:34 -0400 Subject: [PATCH 16/64] Add John's existing arcsine cdf test --- test/cmake_jamfile | 1 + test/cuda_managed_ptr.hpp | 139 ++++++++++++++++++++++++++++++++ test/stopwatch.hpp | 39 +++++++++ test/test_arcsine_cdf_double.cu | 109 +++++++++++++++++++++++++ 4 files changed, 288 insertions(+) create mode 100644 test/cuda_managed_ptr.hpp create mode 100644 test/stopwatch.hpp create mode 100644 test/test_arcsine_cdf_double.cu diff --git a/test/cmake_jamfile b/test/cmake_jamfile index 19f7e9978..d6163ed1e 100644 --- a/test/cmake_jamfile +++ b/test/cmake_jamfile @@ -17,4 +17,5 @@ run test_polynomial.cpp ; # Distributions run test_arcsine.cpp ; +run test_arcsine_cdf_double.cu ; run test_binomial.cpp ; diff --git a/test/cuda_managed_ptr.hpp b/test/cuda_managed_ptr.hpp new file mode 100644 index 000000000..59cabd3f7 --- /dev/null +++ b/test/cuda_managed_ptr.hpp @@ -0,0 +1,139 @@ + +// Copyright John Maddock 2016. +// 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_CUDA_MANAGED_PTR_HPP +#define BOOST_MATH_CUDA_MANAGED_PTR_HPP + +#ifdef _MSC_VER +#pragma once +#endif + +#include + +class managed_holder_base +{ +protected: + static int count; + managed_holder_base() { ++count; } + ~managed_holder_base() + { + if(0 == --count) + cudaDeviceSynchronize(); + } +}; + +int managed_holder_base::count = 0; + +// +// Reset the device and exit: +// cudaDeviceReset causes the driver to clean up all state. While +// not mandatory in normal operation, it is good practice. It is also +// needed to ensure correct operation when the application is being +// profiled. Calling cudaDeviceReset causes all profile data to be +// flushed before the application exits. +// +// We have a global instance of this class, plus instances for each +// managed pointer. Last one out the door switches the lights off. +// +class cudaResetter +{ + static int count; +public: + cudaResetter() { ++count; } + ~cudaResetter() + { + if(--count == 0) + { + cudaError_t err = cudaDeviceReset(); + if(err != cudaSuccess) + { + std::cerr << "Failed to deinitialize the device! error=" << cudaGetErrorString(err) << std::endl; + } + } + } +}; + +int cudaResetter::count = 0; + +cudaResetter global_resetter; + +template +class cuda_managed_ptr +{ + T* data; + static const cudaResetter resetter; + cuda_managed_ptr(const cuda_managed_ptr&) = delete; + cuda_managed_ptr& operator=(cuda_managed_ptr const&) = delete; + void free() + { + if(data) + { + cudaDeviceSynchronize(); + cudaError_t err = cudaFree(data); + if(err != cudaSuccess) + { + std::cerr << "Failed to deinitialize the device! error=" << cudaGetErrorString(err) << std::endl; + } + } + } +public: + cuda_managed_ptr() : data(0) {} + cuda_managed_ptr(std::size_t n) + { + cudaError_t err = cudaSuccess; + void *ptr; + err = cudaMallocManaged(&ptr, n * sizeof(T)); + if(err != cudaSuccess) + throw std::runtime_error(cudaGetErrorString(err)); + cudaDeviceSynchronize(); + data = static_cast(ptr); + } + cuda_managed_ptr(cuda_managed_ptr&& o) + { + data = o.data; + o.data = 0; + } + cuda_managed_ptr& operator=(cuda_managed_ptr&& o) + { + free(); + data = o.data; + o.data = 0; + return *this; + } + ~cuda_managed_ptr() + { + free(); + } + + class managed_holder : managed_holder_base + { + T* pdata; + public: + managed_holder(T* p) : managed_holder_base(), pdata(p) {} + managed_holder(const managed_holder& o) : managed_holder_base(), pdata(o.pdata) {} + operator T* () { return pdata; } + T& operator[] (std::size_t n) { return pdata[n]; } + }; + class const_managed_holder : managed_holder_base + { + const T* pdata; + public: + const_managed_holder(T* p) : managed_holder_base(), pdata(p) {} + const_managed_holder(const managed_holder& o) : managed_holder_base(), pdata(o.pdata) {} + operator const T* () { return pdata; } + const T& operator[] (std::size_t n) { return pdata[n]; } + }; + + managed_holder get() { return managed_holder(data); } + const_managed_holder get()const { return data; } + T& operator[](std::size_t n) { return data[n]; } + const T& operator[](std::size_t n)const { return data[n]; } +}; + +template +cudaResetter const cuda_managed_ptr::resetter; + +#endif \ No newline at end of file diff --git a/test/stopwatch.hpp b/test/stopwatch.hpp new file mode 100644 index 000000000..5fe84c3c3 --- /dev/null +++ b/test/stopwatch.hpp @@ -0,0 +1,39 @@ +// Copyright John Maddock 2016. +// 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_CUDA_STOPWATCH_HPP +#define BOOST_MATH_CUDA_STOPWATCH_HPP + +#ifdef _MSC_VER +#pragma once +#endif + +#include + +template +struct stopwatch +{ + typedef typename Clock::duration duration; + stopwatch() + { + m_start = Clock::now(); + } + double elapsed() + { + duration t = Clock::now() - m_start; + return std::chrono::duration_cast>(t).count(); + } + void reset() + { + m_start = Clock::now(); + } + +private: + typename Clock::time_point m_start; +}; + +typedef stopwatch watch; + +#endif \ No newline at end of file diff --git a/test/test_arcsine_cdf_double.cu b/test/test_arcsine_cdf_double.cu new file mode 100644 index 000000000..d6f6f7b35 --- /dev/null +++ b/test/test_arcsine_cdf_double.cu @@ -0,0 +1,109 @@ +// Copyright John Maddock 2016. +// 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) + +#define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error + +#include +#include +#include +#include +#include +#include +#include +#include "cuda_managed_ptr.hpp" +#include "stopwatch.hpp" + +// For the CUDA runtime routines (prefixed with "cuda_") +#include + +typedef double float_type; + +/** + * CUDA Kernel Device code + * + */ +__global__ void cuda_test(const float_type *in1, float_type *out, int numElements) +{ + using std::cos; + int i = blockDim.x * blockIdx.x + threadIdx.x; + + if (i < numElements) + { + out[i] = cdf(boost::math::arcsine_distribution(), in1[i]); + } +} + +/** + * Host main routine + */ +int main(void) +{ + try{ + + // Error code to check return values for CUDA calls + cudaError_t err = cudaSuccess; + + // Print the vector length to be used, and compute its size + int numElements = 50000; + std::cout << "[Vector operation on " << numElements << " elements]" << std::endl; + + // Allocate the managed input vector A + cuda_managed_ptr input_vector1(numElements); + + // Allocate the managed output vector C + cuda_managed_ptr output_vector(numElements); + + boost::random::mt19937 gen; + boost::random::uniform_real_distribution dist; + // Initialize the input vectors + for (int i = 0; i < numElements; ++i) + { + input_vector1[i] = dist(gen); + } + + // Launch the Vector Add CUDA Kernel + int threadsPerBlock = 512; + int blocksPerGrid =(numElements + threadsPerBlock - 1) / threadsPerBlock; + std::cout << "CUDA kernel launch with " << blocksPerGrid << " blocks of " << threadsPerBlock << " threads" << std::endl; + + watch w; + cuda_test<<>>(input_vector1.get(), output_vector.get(), numElements); + cudaDeviceSynchronize(); + std::cout << "CUDA kernal done in " << w.elapsed() << "s" << std::endl; + + err = cudaGetLastError(); + if (err != cudaSuccess) + { + std::cerr << "Failed to launch vectorAdd kernel (error code " << cudaGetErrorString(err) << ")!" << std::endl; + return EXIT_FAILURE; + } + + // Verify that the result vector is correct + std::vector results; + results.reserve(numElements); + w.reset(); + for(int i = 0; i < numElements; ++i) + results.push_back(cdf(boost::math::arcsine_distribution(), input_vector1[i])); + double t = w.elapsed(); + // check the results + for(int i = 0; i < numElements; ++i) + { + if (boost::math::epsilon_difference(output_vector[i], results[i]) > 100.0) + { + std::cerr << "Result verification failed at element " << i << "!" << std::endl; + std::cerr << "Error rate was: " << boost::math::epsilon_difference(output_vector[i], results[i]) << "eps" << std::endl; + return EXIT_FAILURE; + } + } + + std::cout << "Test PASSED with calculation time: " << t << "s" << std::endl; + std::cout << "Done\n"; + } + catch(const std::exception& e) + { + std::cerr << "Stopped with exception: " << e.what() << std::endl; + } + return 0; +} \ No newline at end of file From 02b2602492e63679cbe26e55011cde1b7cca1dfe Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Thu, 18 Jul 2024 15:45:46 -0400 Subject: [PATCH 17/64] Add CUDA definition of force inline ignoring that of the host compiler --- include/boost/math/tools/config.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/boost/math/tools/config.hpp b/include/boost/math/tools/config.hpp index 4810d73e5..2d70eaf81 100644 --- a/include/boost/math/tools/config.hpp +++ b/include/boost/math/tools/config.hpp @@ -664,11 +664,15 @@ namespace boost{ namespace math{ // CUDA support: // -#ifdef __NVCC__ +#ifdef __CUDACC__ # define BOOST_MATH_HOST_DEVICE __host__ __device__ # ifndef BOOST_MATH_ENABLE_CUDA # define BOOST_MATH_ENABLE_CUDA # endif + +// We want to use force inline from CUDA instead of the host compiler +# undef BOOST_MATH_FORCEINLINE +# define BOOST_MATH_FORCEINLINE __forceinline__ #else # define BOOST_MATH_HOST_DEVICE #endif From c0b2921278fb731d3d9fae1b0fa3185177326c89 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Thu, 18 Jul 2024 16:21:18 -0400 Subject: [PATCH 18/64] Add config option to return NANs --- include/boost/math/tools/config.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/boost/math/tools/config.hpp b/include/boost/math/tools/config.hpp index 2d70eaf81..3bc48d3e9 100644 --- a/include/boost/math/tools/config.hpp +++ b/include/boost/math/tools/config.hpp @@ -673,8 +673,13 @@ namespace boost{ namespace math{ // We want to use force inline from CUDA instead of the host compiler # undef BOOST_MATH_FORCEINLINE # define BOOST_MATH_FORCEINLINE __forceinline__ + +// We can't use return std::numeric_limits::quiet_NaN() +# define BOOST_MATH_QUIET_NAN(T) static_cast(NAN); + #else # define BOOST_MATH_HOST_DEVICE +# define BOOST_MATH_QUIET_NAN(T) std::numeric_limits::quiet_NaN(); #endif // Static variables are not allowed with CUDA or C++20 modules From 5d30480a8ff868af7e0f7d1cab8cc62df04cc459 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Thu, 18 Jul 2024 16:21:41 -0400 Subject: [PATCH 19/64] First cut at CUDA allowed policies --- .../boost/math/policies/error_handling.hpp | 128 +++++++++--------- include/boost/math/policies/policy.hpp | 54 ++++---- 2 files changed, 91 insertions(+), 91 deletions(-) diff --git a/include/boost/math/policies/error_handling.hpp b/include/boost/math/policies/error_handling.hpp index 070266c7f..cd604aad3 100644 --- a/include/boost/math/policies/error_handling.hpp +++ b/include/boost/math/policies/error_handling.hpp @@ -199,7 +199,7 @@ void raise_error(const char* pfunction, const char* pmessage, const T& val) #endif template -inline T raise_domain_error( +BOOST_MATH_HOST_DEVICE inline T raise_domain_error( const char* function, const char* message, const T& val, @@ -210,12 +210,12 @@ inline T raise_domain_error( #else raise_error(function, message, val); // we never get here: - return std::numeric_limits::quiet_NaN(); + return BOOST_MATH_QUIET_NAN(T); #endif } template -inline constexpr T raise_domain_error( +BOOST_MATH_HOST_DEVICE constexpr T raise_domain_error( const char* , const char* , const T& , @@ -223,11 +223,11 @@ inline constexpr T raise_domain_error( { // This may or may not do the right thing, but the user asked for the error // to be ignored so here we go anyway: - return std::numeric_limits::quiet_NaN(); + return BOOST_MATH_QUIET_NAN(T); } template -inline T raise_domain_error( +BOOST_MATH_HOST_DEVICE inline T raise_domain_error( const char* , const char* , const T& , @@ -236,11 +236,11 @@ inline T raise_domain_error( errno = EDOM; // This may or may not do the right thing, but the user asked for the error // to be silent so here we go anyway: - return std::numeric_limits::quiet_NaN(); + return BOOST_MATH_QUIET_NAN(T); } template -inline T raise_domain_error( +BOOST_MATH_HOST_DEVICE inline T raise_domain_error( const char* function, const char* message, const T& val, @@ -250,7 +250,7 @@ inline T raise_domain_error( } template -inline T raise_pole_error( +BOOST_MATH_HOST_DEVICE inline T raise_pole_error( const char* function, const char* message, const T& val, @@ -264,7 +264,7 @@ inline T raise_pole_error( } template -inline constexpr T raise_pole_error( +BOOST_MATH_HOST_DEVICE constexpr T raise_pole_error( const char* function, const char* message, const T& val, @@ -274,7 +274,7 @@ inline constexpr T raise_pole_error( } template -inline constexpr T raise_pole_error( +BOOST_MATH_HOST_DEVICE constexpr T raise_pole_error( const char* function, const char* message, const T& val, @@ -284,7 +284,7 @@ inline constexpr T raise_pole_error( } template -inline T raise_pole_error( +BOOST_MATH_HOST_DEVICE inline T raise_pole_error( const char* function, const char* message, const T& val, @@ -294,7 +294,7 @@ inline T raise_pole_error( } template -inline T raise_overflow_error( +BOOST_MATH_HOST_DEVICE inline T raise_overflow_error( const char* function, const char* message, const ::boost::math::policies::overflow_error< ::boost::math::policies::throw_on_error>&) @@ -309,7 +309,7 @@ inline T raise_overflow_error( } template -inline T raise_overflow_error( +BOOST_MATH_HOST_DEVICE inline T raise_overflow_error( const char* function, const char* message, const T& val, @@ -325,7 +325,7 @@ inline T raise_overflow_error( } template -inline constexpr T raise_overflow_error( +BOOST_MATH_HOST_DEVICE constexpr T raise_overflow_error( const char* , const char* , const ::boost::math::policies::overflow_error< ::boost::math::policies::ignore_error>&) BOOST_MATH_NOEXCEPT(T) @@ -336,7 +336,7 @@ inline constexpr T raise_overflow_error( } template -inline constexpr T raise_overflow_error( +BOOST_MATH_HOST_DEVICE constexpr T raise_overflow_error( const char* , const char* , const T&, @@ -348,7 +348,7 @@ inline constexpr T raise_overflow_error( } template -inline T raise_overflow_error( +BOOST_MATH_HOST_DEVICE inline T raise_overflow_error( const char* , const char* , const ::boost::math::policies::overflow_error< ::boost::math::policies::errno_on_error>&) BOOST_MATH_NOEXCEPT(T) @@ -360,7 +360,7 @@ inline T raise_overflow_error( } template -inline T raise_overflow_error( +BOOST_MATH_HOST_DEVICE inline T raise_overflow_error( const char* , const char* , const T&, @@ -373,7 +373,7 @@ inline T raise_overflow_error( } template -inline T raise_overflow_error( +BOOST_MATH_HOST_DEVICE inline T raise_overflow_error( const char* function, const char* message, const ::boost::math::policies::overflow_error< ::boost::math::policies::user_error>&) @@ -382,7 +382,7 @@ inline T raise_overflow_error( } template -inline T raise_overflow_error( +BOOST_MATH_HOST_DEVICE inline T raise_overflow_error( const char* function, const char* message, const T& val, @@ -396,7 +396,7 @@ inline T raise_overflow_error( } template -inline T raise_underflow_error( +BOOST_MATH_HOST_DEVICE inline T raise_underflow_error( const char* function, const char* message, const ::boost::math::policies::underflow_error< ::boost::math::policies::throw_on_error>&) @@ -411,7 +411,7 @@ inline T raise_underflow_error( } template -inline constexpr T raise_underflow_error( +BOOST_MATH_HOST_DEVICE constexpr T raise_underflow_error( const char* , const char* , const ::boost::math::policies::underflow_error< ::boost::math::policies::ignore_error>&) BOOST_MATH_NOEXCEPT(T) @@ -422,7 +422,7 @@ inline constexpr T raise_underflow_error( } template -inline T raise_underflow_error( +BOOST_MATH_HOST_DEVICE inline T raise_underflow_error( const char* /* function */, const char* /* message */, const ::boost::math::policies::underflow_error< ::boost::math::policies::errno_on_error>&) BOOST_MATH_NOEXCEPT(T) @@ -434,7 +434,7 @@ inline T raise_underflow_error( } template -inline T raise_underflow_error( +BOOST_MATH_HOST_DEVICE inline T raise_underflow_error( const char* function, const char* message, const ::boost::math::policies::underflow_error< ::boost::math::policies::user_error>&) @@ -443,7 +443,7 @@ inline T raise_underflow_error( } template -inline T raise_denorm_error( +BOOST_MATH_HOST_DEVICE inline T raise_denorm_error( const char* function, const char* message, const T& /* val */, @@ -459,7 +459,7 @@ inline T raise_denorm_error( } template -inline constexpr T raise_denorm_error( +BOOST_MATH_HOST_DEVICE inline constexpr T raise_denorm_error( const char* , const char* , const T& val, @@ -471,7 +471,7 @@ inline constexpr T raise_denorm_error( } template -inline T raise_denorm_error( +BOOST_MATH_HOST_DEVICE inline T raise_denorm_error( const char* , const char* , const T& val, @@ -484,7 +484,7 @@ inline T raise_denorm_error( } template -inline T raise_denorm_error( +BOOST_MATH_HOST_DEVICE inline T raise_denorm_error( const char* function, const char* message, const T& val, @@ -494,7 +494,7 @@ inline T raise_denorm_error( } template -inline T raise_evaluation_error( +BOOST_MATH_HOST_DEVICE inline T raise_evaluation_error( const char* function, const char* message, const T& val, @@ -510,7 +510,7 @@ inline T raise_evaluation_error( } template -inline constexpr T raise_evaluation_error( +BOOST_MATH_HOST_DEVICE constexpr T raise_evaluation_error( const char* , const char* , const T& val, @@ -522,7 +522,7 @@ inline constexpr T raise_evaluation_error( } template -inline T raise_evaluation_error( +BOOST_MATH_HOST_DEVICE inline T raise_evaluation_error( const char* , const char* , const T& val, @@ -535,7 +535,7 @@ inline T raise_evaluation_error( } template -inline T raise_evaluation_error( +BOOST_MATH_HOST_DEVICE inline T raise_evaluation_error( const char* function, const char* message, const T& val, @@ -545,7 +545,7 @@ inline T raise_evaluation_error( } template -inline TargetType raise_rounding_error( +BOOST_MATH_HOST_DEVICE inline TargetType raise_rounding_error( const char* function, const char* message, const T& val, @@ -562,7 +562,7 @@ inline TargetType raise_rounding_error( } template -inline constexpr TargetType raise_rounding_error( +BOOST_MATH_HOST_DEVICE constexpr TargetType raise_rounding_error( const char* , const char* , const T& val, @@ -576,7 +576,7 @@ inline constexpr TargetType raise_rounding_error( } template -inline TargetType raise_rounding_error( +BOOST_MATH_HOST_DEVICE inline TargetType raise_rounding_error( const char* , const char* , const T& val, @@ -590,7 +590,7 @@ inline TargetType raise_rounding_error( return val > 0 ? (std::numeric_limits::max)() : (std::numeric_limits::is_integer ? (std::numeric_limits::min)() : -(std::numeric_limits::max)()); } template -inline TargetType raise_rounding_error( +BOOST_MATH_HOST_DEVICE inline TargetType raise_rounding_error( const char* function, const char* message, const T& val, @@ -601,7 +601,7 @@ inline TargetType raise_rounding_error( } template -inline T raise_indeterminate_result_error( +BOOST_MATH_HOST_DEVICE inline T raise_indeterminate_result_error( const char* function, const char* message, const T& val, @@ -618,7 +618,7 @@ inline T raise_indeterminate_result_error( } template -inline constexpr T raise_indeterminate_result_error( +BOOST_MATH_HOST_DEVICE inline constexpr T raise_indeterminate_result_error( const char* , const char* , const T& , @@ -631,7 +631,7 @@ inline constexpr T raise_indeterminate_result_error( } template -inline T raise_indeterminate_result_error( +BOOST_MATH_HOST_DEVICE inline T raise_indeterminate_result_error( const char* , const char* , const T& , @@ -645,7 +645,7 @@ inline T raise_indeterminate_result_error( } template -inline T raise_indeterminate_result_error( +BOOST_MATH_HOST_DEVICE inline T raise_indeterminate_result_error( const char* function, const char* message, const T& val, @@ -658,7 +658,7 @@ inline T raise_indeterminate_result_error( } // namespace detail template -inline constexpr T raise_domain_error(const char* function, const char* message, const T& val, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) +BOOST_MATH_HOST_DEVICE constexpr T raise_domain_error(const char* function, const char* message, const T& val, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) { typedef typename Policy::domain_error_type policy_type; return detail::raise_domain_error( @@ -667,7 +667,7 @@ inline constexpr T raise_domain_error(const char* function, const char* message, } template -inline constexpr T raise_pole_error(const char* function, const char* message, const T& val, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) +BOOST_MATH_HOST_DEVICE constexpr T raise_pole_error(const char* function, const char* message, const T& val, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) { typedef typename Policy::pole_error_type policy_type; return detail::raise_pole_error( @@ -676,7 +676,7 @@ inline constexpr T raise_pole_error(const char* function, const char* message, c } template -inline constexpr T raise_overflow_error(const char* function, const char* message, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) +BOOST_MATH_HOST_DEVICE constexpr T raise_overflow_error(const char* function, const char* message, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) { typedef typename Policy::overflow_error_type policy_type; return detail::raise_overflow_error( @@ -685,7 +685,7 @@ inline constexpr T raise_overflow_error(const char* function, const char* messag } template -inline constexpr T raise_overflow_error(const char* function, const char* message, const T& val, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) +BOOST_MATH_HOST_DEVICE constexpr T raise_overflow_error(const char* function, const char* message, const T& val, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) { typedef typename Policy::overflow_error_type policy_type; return detail::raise_overflow_error( @@ -694,7 +694,7 @@ inline constexpr T raise_overflow_error(const char* function, const char* messag } template -inline constexpr T raise_underflow_error(const char* function, const char* message, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) +BOOST_MATH_HOST_DEVICE constexpr T raise_underflow_error(const char* function, const char* message, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) { typedef typename Policy::underflow_error_type policy_type; return detail::raise_underflow_error( @@ -703,7 +703,7 @@ inline constexpr T raise_underflow_error(const char* function, const char* messa } template -inline constexpr T raise_denorm_error(const char* function, const char* message, const T& val, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) +BOOST_MATH_HOST_DEVICE constexpr T raise_denorm_error(const char* function, const char* message, const T& val, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) { typedef typename Policy::denorm_error_type policy_type; return detail::raise_denorm_error( @@ -713,7 +713,7 @@ inline constexpr T raise_denorm_error(const char* function, const char* message, } template -inline constexpr T raise_evaluation_error(const char* function, const char* message, const T& val, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) +BOOST_MATH_HOST_DEVICE constexpr T raise_evaluation_error(const char* function, const char* message, const T& val, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) { typedef typename Policy::evaluation_error_type policy_type; return detail::raise_evaluation_error( @@ -722,7 +722,7 @@ inline constexpr T raise_evaluation_error(const char* function, const char* mess } template -inline constexpr TargetType raise_rounding_error(const char* function, const char* message, const T& val, const TargetType& t, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) +BOOST_MATH_HOST_DEVICE constexpr TargetType raise_rounding_error(const char* function, const char* message, const T& val, const TargetType& t, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) { typedef typename Policy::rounding_error_type policy_type; return detail::raise_rounding_error( @@ -731,7 +731,7 @@ inline constexpr TargetType raise_rounding_error(const char* function, const cha } template -inline constexpr T raise_indeterminate_result_error(const char* function, const char* message, const T& val, const R& result, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) +BOOST_MATH_HOST_DEVICE constexpr T raise_indeterminate_result_error(const char* function, const char* message, const T& val, const R& result, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) { typedef typename Policy::indeterminate_result_error_type policy_type; return detail::raise_indeterminate_result_error( @@ -746,7 +746,7 @@ namespace detail { template -BOOST_MATH_FORCEINLINE bool check_overflow(T val, R* result, const char* function, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T) && (Policy::value != throw_on_error) && (Policy::value != user_error)) +BOOST_MATH_HOST_DEVICE BOOST_MATH_FORCEINLINE bool check_overflow(T val, R* result, const char* function, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T) && (Policy::value != throw_on_error) && (Policy::value != user_error)) { BOOST_MATH_STD_USING if(fabs(val) > tools::max_value()) @@ -758,7 +758,7 @@ BOOST_MATH_FORCEINLINE bool check_overflow(T val, R* result, const char* functio return false; } template -BOOST_MATH_FORCEINLINE bool check_overflow(std::complex val, R* result, const char* function, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T) && (Policy::value != throw_on_error) && (Policy::value != user_error)) +BOOST_MATH_HOST_DEVICE BOOST_MATH_FORCEINLINE bool check_overflow(std::complex val, R* result, const char* function, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T) && (Policy::value != throw_on_error) && (Policy::value != user_error)) { typedef typename R::value_type r_type; r_type re, im; @@ -768,7 +768,7 @@ BOOST_MATH_FORCEINLINE bool check_overflow(std::complex val, R* result, const return r; } template -BOOST_MATH_FORCEINLINE bool check_underflow(T val, R* result, const char* function, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T) && (Policy::value != throw_on_error) && (Policy::value != user_error)) +BOOST_MATH_HOST_DEVICE BOOST_MATH_FORCEINLINE bool check_underflow(T val, R* result, const char* function, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T) && (Policy::value != throw_on_error) && (Policy::value != user_error)) { if((val != 0) && (static_cast(val) == 0)) { @@ -778,7 +778,7 @@ BOOST_MATH_FORCEINLINE bool check_underflow(T val, R* result, const char* functi return false; } template -BOOST_MATH_FORCEINLINE bool check_underflow(std::complex val, R* result, const char* function, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T) && (Policy::value != throw_on_error) && (Policy::value != user_error)) +BOOST_MATH_HOST_DEVICE BOOST_MATH_FORCEINLINE bool check_underflow(std::complex val, R* result, const char* function, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T) && (Policy::value != throw_on_error) && (Policy::value != user_error)) { typedef typename R::value_type r_type; r_type re, im; @@ -788,7 +788,7 @@ BOOST_MATH_FORCEINLINE bool check_underflow(std::complex val, R* result, cons return r; } template -BOOST_MATH_FORCEINLINE bool check_denorm(T val, R* result, const char* function, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T) && (Policy::value != throw_on_error) && (Policy::value != user_error)) +BOOST_MATH_HOST_DEVICE BOOST_MATH_FORCEINLINE bool check_denorm(T val, R* result, const char* function, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T) && (Policy::value != throw_on_error) && (Policy::value != user_error)) { BOOST_MATH_STD_USING if((fabs(val) < static_cast(tools::min_value())) && (static_cast(val) != 0)) @@ -799,7 +799,7 @@ BOOST_MATH_FORCEINLINE bool check_denorm(T val, R* result, const char* function, return false; } template -BOOST_MATH_FORCEINLINE bool check_denorm(std::complex val, R* result, const char* function, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T) && (Policy::value != throw_on_error) && (Policy::value != user_error)) +BOOST_MATH_HOST_DEVICE BOOST_MATH_FORCEINLINE bool check_denorm(std::complex val, R* result, const char* function, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T) && (Policy::value != throw_on_error) && (Policy::value != user_error)) { typedef typename R::value_type r_type; r_type re, im; @@ -811,28 +811,28 @@ BOOST_MATH_FORCEINLINE bool check_denorm(std::complex val, R* result, const c // Default instantiations with ignore_error policy. template -BOOST_MATH_FORCEINLINE constexpr bool check_overflow(T /* val */, R* /* result */, const char* /* function */, const overflow_error&) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T)) +BOOST_MATH_HOST_DEVICE BOOST_MATH_FORCEINLINE constexpr bool check_overflow(T /* val */, R* /* result */, const char* /* function */, const overflow_error&) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T)) { return false; } template -BOOST_MATH_FORCEINLINE constexpr bool check_overflow(std::complex /* val */, R* /* result */, const char* /* function */, const overflow_error&) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T)) +BOOST_MATH_HOST_DEVICE BOOST_MATH_FORCEINLINE constexpr bool check_overflow(std::complex /* val */, R* /* result */, const char* /* function */, const overflow_error&) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T)) { return false; } template -BOOST_MATH_FORCEINLINE constexpr bool check_underflow(T /* val */, R* /* result */, const char* /* function */, const underflow_error&) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T)) +BOOST_MATH_HOST_DEVICE BOOST_MATH_FORCEINLINE constexpr bool check_underflow(T /* val */, R* /* result */, const char* /* function */, const underflow_error&) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T)) { return false; } template -BOOST_MATH_FORCEINLINE constexpr bool check_underflow(std::complex /* val */, R* /* result */, const char* /* function */, const underflow_error&) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T)) +BOOST_MATH_HOST_DEVICE BOOST_MATH_FORCEINLINE constexpr bool check_underflow(std::complex /* val */, R* /* result */, const char* /* function */, const underflow_error&) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T)) { return false; } template -BOOST_MATH_FORCEINLINE constexpr bool check_denorm(T /* val */, R* /* result*/, const char* /* function */, const denorm_error&) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T)) +BOOST_MATH_HOST_DEVICE BOOST_MATH_FORCEINLINE constexpr bool check_denorm(T /* val */, R* /* result*/, const char* /* function */, const denorm_error&) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T)) { return false; } template -BOOST_MATH_FORCEINLINE constexpr bool check_denorm(std::complex /* val */, R* /* result*/, const char* /* function */, const denorm_error&) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T)) +BOOST_MATH_HOST_DEVICE BOOST_MATH_FORCEINLINE constexpr bool check_denorm(std::complex /* val */, R* /* result*/, const char* /* function */, const denorm_error&) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T)) { return false; } } // namespace detail template -BOOST_MATH_FORCEINLINE R checked_narrowing_cast(T val, const char* function) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T) && is_noexcept_error_policy::value) +BOOST_MATH_HOST_DEVICE BOOST_MATH_FORCEINLINE R checked_narrowing_cast(T val, const char* function) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T) && is_noexcept_error_policy::value) { typedef typename Policy::overflow_error_type overflow_type; typedef typename Policy::underflow_error_type underflow_type; @@ -852,7 +852,7 @@ BOOST_MATH_FORCEINLINE R checked_narrowing_cast(T val, const char* function) noe } template -inline void check_series_iterations(const char* function, std::uintmax_t max_iter, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(T) && is_noexcept_error_policy::value) +BOOST_MATH_HOST_DEVICE inline void check_series_iterations(const char* function, std::uintmax_t max_iter, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(T) && is_noexcept_error_policy::value) { if(max_iter >= policies::get_max_series_iterations()) raise_evaluation_error( @@ -861,7 +861,7 @@ inline void check_series_iterations(const char* function, std::uintmax_t max_ite } template -inline void check_root_iterations(const char* function, std::uintmax_t max_iter, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(T) && is_noexcept_error_policy::value) +BOOST_MATH_HOST_DEVICE inline void check_root_iterations(const char* function, std::uintmax_t max_iter, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(T) && is_noexcept_error_policy::value) { if(max_iter >= policies::get_max_root_iterations()) raise_evaluation_error( @@ -878,7 +878,7 @@ namespace detail{ // that value usually comes from one of the error handlers above: // template -std::pair pair_from_single(const T& val) BOOST_MATH_NOEXCEPT(T) +BOOST_MATH_HOST_DEVICE std::pair pair_from_single(const T& val) BOOST_MATH_NOEXCEPT(T) { return std::make_pair(val, val); } diff --git a/include/boost/math/policies/policy.hpp b/include/boost/math/policies/policy.hpp index eb09682e3..25a43f41e 100644 --- a/include/boost/math/policies/policy.hpp +++ b/include/boost/math/policies/policy.hpp @@ -22,9 +22,9 @@ namespace mp = tools::meta_programming; namespace tools{ template -constexpr int digits(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept; +BOOST_MATH_HOST_DEVICE constexpr int digits(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept; template -constexpr T epsilon(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(std::is_floating_point::value); +BOOST_MATH_HOST_DEVICE constexpr T epsilon(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(std::is_floating_point::value); } @@ -640,81 +640,81 @@ struct normalise, using type = policy; }; -inline constexpr policy<> make_policy() noexcept +BOOST_MATH_HOST_DEVICE constexpr policy<> make_policy() noexcept { return {}; } template -inline constexpr typename normalise, A1>::type make_policy(const A1&) noexcept +BOOST_MATH_HOST_DEVICE constexpr typename normalise, A1>::type make_policy(const A1&) noexcept { typedef typename normalise, A1>::type result_type; return result_type(); } template -inline constexpr typename normalise, A1, A2>::type make_policy(const A1&, const A2&) noexcept +BOOST_MATH_HOST_DEVICE constexpr typename normalise, A1, A2>::type make_policy(const A1&, const A2&) noexcept { typedef typename normalise, A1, A2>::type result_type; return result_type(); } template -inline constexpr typename normalise, A1, A2, A3>::type make_policy(const A1&, const A2&, const A3&) noexcept +BOOST_MATH_HOST_DEVICE constexpr typename normalise, A1, A2, A3>::type make_policy(const A1&, const A2&, const A3&) noexcept { typedef typename normalise, A1, A2, A3>::type result_type; return result_type(); } template -inline constexpr typename normalise, A1, A2, A3, A4>::type make_policy(const A1&, const A2&, const A3&, const A4&) noexcept +BOOST_MATH_HOST_DEVICE constexpr typename normalise, A1, A2, A3, A4>::type make_policy(const A1&, const A2&, const A3&, const A4&) noexcept { typedef typename normalise, A1, A2, A3, A4>::type result_type; return result_type(); } template -inline constexpr typename normalise, A1, A2, A3, A4, A5>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&) noexcept +BOOST_MATH_HOST_DEVICE constexpr typename normalise, A1, A2, A3, A4, A5>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&) noexcept { typedef typename normalise, A1, A2, A3, A4, A5>::type result_type; return result_type(); } template -inline constexpr typename normalise, A1, A2, A3, A4, A5, A6>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&) noexcept +BOOST_MATH_HOST_DEVICE constexpr typename normalise, A1, A2, A3, A4, A5, A6>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&) noexcept { typedef typename normalise, A1, A2, A3, A4, A5, A6>::type result_type; return result_type(); } template -inline constexpr typename normalise, A1, A2, A3, A4, A5, A6, A7>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&) noexcept +BOOST_MATH_HOST_DEVICE constexpr typename normalise, A1, A2, A3, A4, A5, A6, A7>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&) noexcept { typedef typename normalise, A1, A2, A3, A4, A5, A6, A7>::type result_type; return result_type(); } template -inline constexpr typename normalise, A1, A2, A3, A4, A5, A6, A7, A8>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&, const A8&) noexcept +BOOST_MATH_HOST_DEVICE constexpr typename normalise, A1, A2, A3, A4, A5, A6, A7, A8>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&, const A8&) noexcept { typedef typename normalise, A1, A2, A3, A4, A5, A6, A7, A8>::type result_type; return result_type(); } template -inline constexpr typename normalise, A1, A2, A3, A4, A5, A6, A7, A8, A9>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&, const A8&, const A9&) noexcept +BOOST_MATH_HOST_DEVICE constexpr typename normalise, A1, A2, A3, A4, A5, A6, A7, A8, A9>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&, const A8&, const A9&) noexcept { typedef typename normalise, A1, A2, A3, A4, A5, A6, A7, A8, A9>::type result_type; return result_type(); } template -inline constexpr typename normalise, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&, const A8&, const A9&, const A10&) noexcept +BOOST_MATH_HOST_DEVICE constexpr typename normalise, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&, const A8&, const A9&, const A10&) noexcept { typedef typename normalise, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>::type result_type; return result_type(); } template -inline constexpr typename normalise, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&, const A8&, const A9&, const A10&, const A11&) noexcept +BOOST_MATH_HOST_DEVICE constexpr typename normalise, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&, const A8&, const A9&, const A10&, const A11&) noexcept { typedef typename normalise, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11>::type result_type; return result_type(); @@ -793,7 +793,7 @@ struct precision namespace detail{ template -inline constexpr int digits_imp(std::true_type const&) noexcept +BOOST_MATH_HOST_DEVICE constexpr int digits_imp(std::true_type const&) noexcept { static_assert( std::numeric_limits::is_specialized, "std::numeric_limits::is_specialized"); typedef typename boost::math::policies::precision::type p_t; @@ -801,7 +801,7 @@ inline constexpr int digits_imp(std::true_type const&) noexcept } template -inline constexpr int digits_imp(std::false_type const&) noexcept +BOOST_MATH_HOST_DEVICE constexpr int digits_imp(std::false_type const&) noexcept { return tools::digits(); } @@ -809,26 +809,26 @@ inline constexpr int digits_imp(std::false_type const&) noexcept } // namespace detail template -inline constexpr int digits(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept +BOOST_MATH_HOST_DEVICE constexpr int digits(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept { typedef std::integral_constant::is_specialized > tag_type; return detail::digits_imp(tag_type()); } template -inline constexpr int digits_base10(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept +BOOST_MATH_HOST_DEVICE constexpr int digits_base10(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept { return boost::math::policies::digits() * 301 / 1000L; } template -inline constexpr unsigned long get_max_series_iterations() noexcept +BOOST_MATH_HOST_DEVICE constexpr unsigned long get_max_series_iterations() noexcept { typedef typename Policy::max_series_iterations_type iter_type; return iter_type::value; } template -inline constexpr unsigned long get_max_root_iterations() noexcept +BOOST_MATH_HOST_DEVICE constexpr unsigned long get_max_root_iterations() noexcept { typedef typename Policy::max_root_iterations_type iter_type; return iter_type::value; @@ -839,7 +839,7 @@ namespace detail{ template struct series_factor_calc { - static T get() noexcept(std::is_floating_point::value) + BOOST_MATH_HOST_DEVICE static T get() noexcept(std::is_floating_point::value) { return ldexp(T(1.0), 1 - Digits::value); } @@ -848,7 +848,7 @@ struct series_factor_calc template struct series_factor_calc { - static constexpr T get() noexcept(std::is_floating_point::value) + BOOST_MATH_HOST_DEVICE static constexpr T get() noexcept(std::is_floating_point::value) { return boost::math::tools::epsilon(); } @@ -856,7 +856,7 @@ struct series_factor_calc template struct series_factor_calc { - static constexpr T get() noexcept(std::is_floating_point::value) + BOOST_MATH_HOST_DEVICE static constexpr T get() noexcept(std::is_floating_point::value) { return 1 / static_cast(static_cast(1u) << (Digits::value - 1)); } @@ -864,14 +864,14 @@ struct series_factor_calc template struct series_factor_calc { - static constexpr T get() noexcept(std::is_floating_point::value) + BOOST_MATH_HOST_DEVICE static constexpr T get() noexcept(std::is_floating_point::value) { return boost::math::tools::epsilon(); } }; template -inline constexpr T get_epsilon_imp(std::true_type const&) noexcept(std::is_floating_point::value) +BOOST_MATH_HOST_DEVICE constexpr T get_epsilon_imp(std::true_type const&) noexcept(std::is_floating_point::value) { static_assert(std::numeric_limits::is_specialized, "std::numeric_limits::is_specialized"); static_assert(std::numeric_limits::radix == 2, "std::numeric_limits::radix == 2"); @@ -883,7 +883,7 @@ inline constexpr T get_epsilon_imp(std::true_type const&) noexcept(std::is_float } template -inline constexpr T get_epsilon_imp(std::false_type const&) noexcept(std::is_floating_point::value) +BOOST_MATH_HOST_DEVICE constexpr T get_epsilon_imp(std::false_type const&) noexcept(std::is_floating_point::value) { return tools::epsilon(); } @@ -891,7 +891,7 @@ inline constexpr T get_epsilon_imp(std::false_type const&) noexcept(std::is_floa } // namespace detail template -inline constexpr T get_epsilon(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(std::is_floating_point::value) +BOOST_MATH_HOST_DEVICE constexpr T get_epsilon(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(std::is_floating_point::value) { typedef std::integral_constant::is_specialized && (std::numeric_limits::radix == 2)) > tag_type; return detail::get_epsilon_imp(tag_type()); From 6032100d2a53d97a0a2386d2d7ad426a8eef7398 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Fri, 19 Jul 2024 09:21:12 -0400 Subject: [PATCH 20/64] Add new definitions of classification functions --- .../math/special_functions/fpclassify.hpp | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/include/boost/math/special_functions/fpclassify.hpp b/include/boost/math/special_functions/fpclassify.hpp index 2c504d7ac..617d81848 100644 --- a/include/boost/math/special_functions/fpclassify.hpp +++ b/include/boost/math/special_functions/fpclassify.hpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -76,6 +77,80 @@ is used. */ +#ifdef BOOST_MATH_ENABLE_CUDA + +namespace boost { namespace math { + +template<> inline BOOST_MATH_HOST_DEVICE bool (isnan)(float x) { return x != x; } +template<> inline BOOST_MATH_HOST_DEVICE bool (isnan)(double x) { return x != x; } + +template<> inline BOOST_MATH_HOST_DEVICE bool (isinf)(float x) { return x > FLT_MAX || x < -FLT_MAX; } +template<> inline BOOST_MATH_HOST_DEVICE bool (isinf)(double x) { return x > DBL_MAX || x < -DBL_MAX; } + +template<> inline BOOST_MATH_HOST_DEVICE bool (isfinite)(float x) { return !isnan(x) && !isinf(x); } +template<> inline BOOST_MATH_HOST_DEVICE bool (isfinite)(double x) { return !isnan(x) && !isinf(x); } + +template<> inline BOOST_MATH_HOST_DEVICE bool (isnormal)(float x) +{ + if(x < 0) x = -x; + return (x >= FLT_MIN) && (x <= FLT_MAX); +} +template<> inline BOOST_MATH_HOST_DEVICE bool (isnormal)(double x) +{ + if(x < 0) x = -x; + return (x >= DBL_MIN) && (x <= DBL_MAX); +} + +template<> inline BOOST_MATH_HOST_DEVICE int (fpclassify)(float t) +{ + if((boost::math::isnan)(t)) + return FP_NAN; + // std::fabs broken on a few systems especially for long long!!!! + float at = (t < 0.0f) ? -t : t; + + // Use a process of exclusion to figure out + // what kind of type we have, this relies on + // IEEE conforming reals that will treat + // Nan's as unordered. Some compilers + // don't do this once optimisations are + // turned on, hence the check for nan's above. + if(at <= FLT_MAX) + { + if(at >= FLT_MIN) + return FP_NORMAL; + return (at != 0) ? FP_SUBNORMAL : FP_ZERO; + } + else if(at > FLT_MAX) + return FP_INFINITE; + return FP_NAN; +} + +template<> inline BOOST_MATH_HOST_DEVICE int (fpclassify)(double t) +{ + if((boost::math::isnan)(t)) + return FP_NAN; + // std::fabs broken on a few systems especially for long long!!!! + double at = (t < 0.0) ? -t : t; + + // Use a process of exclusion to figure out + // what kind of type we have, this relies on + // IEEE conforming reals that will treat + // Nan's as unordered. Some compilers + // don't do this once optimisations are + // turned on, hence the check for nan's above. + if(at <= DBL_MAX) + { + if(at >= DBL_MIN) + return FP_NORMAL; + return (at != 0) ? FP_SUBNORMAL : FP_ZERO; + } + else if(at > DBL_MAX) + return FP_INFINITE; + return FP_NAN; +} + +#else + #if defined(_MSC_VER) || defined(BOOST_BORLANDC) #include #endif @@ -632,6 +707,8 @@ inline bool (isnan)(__float128 x) } #endif +#endif + } // namespace math } // namespace boost #endif // BOOST_MATH_FPCLASSIFY_HPP From 2c36d8e11a5cc91d193acfd569d608af3b26cb61 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Fri, 19 Jul 2024 09:22:53 -0400 Subject: [PATCH 21/64] Replace use of std::string with char* --- include/boost/math/distributions/arcsine.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/math/distributions/arcsine.hpp b/include/boost/math/distributions/arcsine.hpp index fd160da6e..aa824e507 100644 --- a/include/boost/math/distributions/arcsine.hpp +++ b/include/boost/math/distributions/arcsine.hpp @@ -87,10 +87,10 @@ namespace boost { // Check x_min < x_max if (x_min >= x_max) { - std::string msg = "x_max argument is %1%, but must be > x_min"; + constexpr auto msg = "x_max argument is %1%, but must be > x_min"; *result = policies::raise_domain_error( function, - msg.c_str(), x_max, pol); + msg, x_max, pol); // "x_max argument is %1%, but must be > x_min !", x_max, pol); // "x_max argument is %1%, but must be > x_min %2!", x_max, x_min, pol); would be better. // But would require replication of all helpers functions in /policies/error_handling.hpp for two values, From 276a12ba2c37bf518c8dd05f0e5666bbdf60e3ad Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Fri, 19 Jul 2024 09:38:24 -0400 Subject: [PATCH 22/64] Mark constants as CUDA --- include/boost/math/constants/constants.hpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/boost/math/constants/constants.hpp b/include/boost/math/constants/constants.hpp index 4bf81c61d..2ebd81688 100644 --- a/include/boost/math/constants/constants.hpp +++ b/include/boost/math/constants/constants.hpp @@ -209,11 +209,11 @@ namespace boost{ namespace math constant_initializer::get_from_string >::force_instantiate();\ return get_from_string();\ }\ - static inline constexpr T get(const std::integral_constant) noexcept\ + BOOST_MATH_HOST_DEVICE static inline constexpr T get(const std::integral_constant) noexcept\ { return BOOST_MATH_JOIN(x, F); }\ - static inline constexpr T get(const std::integral_constant&) noexcept\ + BOOST_MATH_HOST_DEVICE static inline constexpr T get(const std::integral_constant&) noexcept\ { return x; }\ - static inline constexpr T get(const std::integral_constant&) noexcept\ + BOOST_MATH_HOST_DEVICE static inline constexpr T get(const std::integral_constant&) noexcept\ { return BOOST_MATH_JOIN(x, L); }\ BOOST_MATH_FLOAT128_CONSTANT_OVERLOAD(x) \ template static inline const T& get(const std::integral_constant&)\ @@ -231,9 +231,9 @@ namespace boost{ namespace math \ \ /* The actual forwarding function: */ \ - template inline constexpr typename detail::constant_return::type name(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T) BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(Policy)) BOOST_MATH_NOEXCEPT(T)\ + template BOOST_MATH_HOST_DEVICE inline constexpr typename detail::constant_return::type name(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T) BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(Policy)) BOOST_MATH_NOEXCEPT(T)\ { return detail:: BOOST_MATH_JOIN(constant_, name)::get(typename construction_traits::type()); }\ - template inline constexpr typename detail::constant_return::type name(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T)) BOOST_MATH_NOEXCEPT(T)\ + template BOOST_MATH_HOST_DEVICE inline constexpr typename detail::constant_return::type name(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T)) BOOST_MATH_NOEXCEPT(T)\ { return name >(); }\ \ \ @@ -328,7 +328,7 @@ namespace boost{ namespace math #endif template -inline constexpr T tau() { return two_pi(); } +BOOST_MATH_HOST_DEVICE inline constexpr T tau() { return two_pi(); } } // namespace constants } // namespace math From cc9788bb937ba1eec44fda00ade032518c0d6ed8 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Fri, 19 Jul 2024 09:50:16 -0400 Subject: [PATCH 23/64] Disable exceptions for device code --- include/boost/math/tools/config.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/boost/math/tools/config.hpp b/include/boost/math/tools/config.hpp index 3bc48d3e9..7983eb296 100644 --- a/include/boost/math/tools/config.hpp +++ b/include/boost/math/tools/config.hpp @@ -670,6 +670,11 @@ namespace boost{ namespace math{ # define BOOST_MATH_ENABLE_CUDA # endif +// Device code can not handle exceptions +# ifndef BOOST_MATH_NO_EXCEPTIONS +# define BOOST_MATH_NO_EXCEPTIONS +# endif + // We want to use force inline from CUDA instead of the host compiler # undef BOOST_MATH_FORCEINLINE # define BOOST_MATH_FORCEINLINE __forceinline__ From 64702ab422ab69d35682b51afa81385f6bcb52d3 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Fri, 19 Jul 2024 11:03:12 -0400 Subject: [PATCH 24/64] Specialize epsilon functions --- include/boost/math/tools/precision.hpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/include/boost/math/tools/precision.hpp b/include/boost/math/tools/precision.hpp index a7a807ea2..8a2c2367a 100644 --- a/include/boost/math/tools/precision.hpp +++ b/include/boost/math/tools/precision.hpp @@ -138,11 +138,27 @@ inline T log_min_value(const std::integral_constant& BOOST_MATH_APPEND_E } template -inline constexpr T epsilon(const std::true_type& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(std::is_floating_point::value) +constexpr T epsilon(const std::true_type& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(std::is_floating_point::value) { return std::numeric_limits::epsilon(); } +#ifdef BOOST_MATH_ENABLE_CUDA + +template <> +BOOST_MATH_HOST_DEVICE constexpr float epsilon(const std::true_type& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(float)) noexcept(true) +{ + return FLT_EPSILON; +} + +template <> +BOOST_MATH_HOST_DEVICE constexpr double epsilon(const std::true_type& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(double)) noexcept(true) +{ + return DBL_EPSILON; +} + +#endif + #if defined(__GNUC__) && ((LDBL_MANT_DIG == 106) || (__LDBL_MANT_DIG__ == 106)) template <> inline constexpr long double epsilon(const std::true_type& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(long double)) noexcept @@ -230,7 +246,7 @@ inline constexpr T log_min_value(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept( #endif template -inline constexpr T epsilon(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T)) noexcept(std::is_floating_point::value) +BOOST_MATH_HOST_DEVICE constexpr T epsilon(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T)) noexcept(std::is_floating_point::value) { #ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS return detail::epsilon(std::integral_constant::is_specialized>()); From b861a190d2429116cb72ccd369bb801e03a98f8d Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Fri, 19 Jul 2024 11:13:53 -0400 Subject: [PATCH 25/64] Small change to cmake invocation command --- .github/workflows/cuda.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cuda.yml b/.github/workflows/cuda.yml index a6d10844c..eb6b8fb37 100644 --- a/.github/workflows/cuda.yml +++ b/.github/workflows/cuda.yml @@ -66,7 +66,7 @@ jobs: run: | cd ../boost-root mkdir __build__ && cd __build__ - cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DBUILD_TESTING=ON -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc -DENABLE_CUDA=1 -DCMAKE_CUDA_ARCHITECTURES=70 .. + cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DBUILD_TESTING=ON -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc -DBOOST_MATH_ENABLE_CUDA=1 -DCMAKE_CUDA_ARCHITECTURES=70 -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-12.5 .. - name: Build tests run: | cd ../boost-root/__build__ From b4525892a45ef3fa3f66c79041bfb767d6e2d88a Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Fri, 19 Jul 2024 11:57:26 -0400 Subject: [PATCH 26/64] Reconfigure jamfiles for GPU programming --- test/{cmake_jamfile => cuda_jamfile} | 0 test/sycl_jamfile | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+) rename test/{cmake_jamfile => cuda_jamfile} (100%) create mode 100644 test/sycl_jamfile diff --git a/test/cmake_jamfile b/test/cuda_jamfile similarity index 100% rename from test/cmake_jamfile rename to test/cuda_jamfile diff --git a/test/sycl_jamfile b/test/sycl_jamfile new file mode 100644 index 000000000..19f7e9978 --- /dev/null +++ b/test/sycl_jamfile @@ -0,0 +1,20 @@ +# Copyright 2024 Matt Borland +# Distributed under the Boost Software License, Version 1.0. +# https://www.boost.org/LICENSE_1_0.txt + +import testing ; +import ../../config/checks/config : requires ; + +project : requirements + [ requires cxx14_decltype_auto cxx14_generic_lambdas cxx14_return_type_deduction cxx14_variable_templates cxx14_constexpr ] + ; + +# Autodiff Tests +run test_autodiff_1.cpp ; + +# Tools Tests +run test_polynomial.cpp ; + +# Distributions +run test_arcsine.cpp ; +run test_binomial.cpp ; From 8aacae77d4c01231dabb8d8ecc29e27662df7aeb Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Fri, 19 Jul 2024 11:57:49 -0400 Subject: [PATCH 27/64] Add branch on CML to allow for either SYCL or CUDA --- test/CMakeLists.txt | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index f8eae528c..6ea71210a 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -6,9 +6,26 @@ include(BoostTestJamfile OPTIONAL RESULT_VARIABLE HAVE_BOOST_TEST) if(HAVE_BOOST_TEST) - enable_language(CUDA) - set(CMAKE_CUDA_EXTENSIONS OFF) + if (BOOST_MATH_ENABLE_CUDA) - boost_test_jamfile(FILE cmake_jamfile LINK_LIBRARIES Boost::cuda_math Boost::assert Boost::concept_check Boost::config Boost::core Boost::integer Boost::lexical_cast Boost::multiprecision Boost::predef Boost::random Boost::static_assert Boost::throw_exception Boost::unit_test_framework ) + message(STATUS "Building boost.cuda_math with CUDA") + + enable_language(CUDA) + set(CMAKE_CUDA_EXTENSIONS OFF) + + enable_testing() + + boost_test_jamfile(FILE cuda_jamfile LINK_LIBRARIES Boost::cuda_math Boost::assert Boost::concept_check Boost::config Boost::core Boost::integer Boost::lexical_cast Boost::multiprecision Boost::predef Boost::random Boost::static_assert Boost::throw_exception Boost::unit_test_framework ) + elseif (BOOST_MATH_ENABLE_SYCL) + + message(STATUS "Building boost.cuda_math with SYCL") + + set(CMAKE_CXX_COMPILER "icpx") + set(CMAKE_C_COMPILER "icx") + + enable_testing() + + boost_test_jamfile(FILE sycl_jamfile LINK_LIBRARIES Boost::cuda_math Boost::assert Boost::concept_check Boost::config Boost::core Boost::integer Boost::lexical_cast Boost::multiprecision Boost::predef Boost::random Boost::static_assert Boost::throw_exception Boost::unit_test_framework sycl COMPILE_OPTIONS -fsycl ) + endif() endif() From e8d9caac7572562601606115582f93f9076b2aaf Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Fri, 19 Jul 2024 11:58:06 -0400 Subject: [PATCH 28/64] Add SYCL configuration to CI --- .github/workflows/cuda.yml | 70 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 68 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cuda.yml b/.github/workflows/cuda.yml index eb6b8fb37..53c551ee1 100644 --- a/.github/workflows/cuda.yml +++ b/.github/workflows/cuda.yml @@ -2,7 +2,7 @@ # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) -name: CUDA +name: GPUs on: push: branches: @@ -18,7 +18,7 @@ concurrency: cancel-in-progress: true jobs: - posix-cmake-test: + cuda-cmake-test: strategy: fail-fast: false @@ -71,6 +71,72 @@ jobs: run: | cd ../boost-root/__build__ cmake --build . --target tests + - name: Run tests + run: | + cd ../boost-root/__build__ + ctest --output-on-failure --no-tests=error + + sycl-cmake-test: + strategy: + fail-fast: false + + runs-on: ubuntu-latest + + steps: + - name: Intel Apt repository + timeout-minutes: 1 + run: | + wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB + sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB + rm GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB + echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list + sudo apt-get update + + - name: Install Intel oneAPI compilers + timeout-minutes: 5 + run: sudo apt-get install intel-oneapi-compiler-fortran intel-oneapi-compiler-dpcpp-cpp + + - name: Setup Intel oneAPI environment + run: | + source /opt/intel/oneapi/setvars.sh + printenv >> $GITHUB_ENV + + - name: checkout project code + uses: actions/checkout@v4 + + - name: Install Packages + run: | + sudo apt-get install -y cmake make + + - name: Setup Boost + run: | + echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY + LIBRARY=${GITHUB_REPOSITORY#*/} + echo LIBRARY: $LIBRARY + echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV + echo GITHUB_BASE_REF: $GITHUB_BASE_REF + echo GITHUB_REF: $GITHUB_REF + REF=${GITHUB_BASE_REF:-$GITHUB_REF} + REF=${REF#refs/heads/} + echo REF: $REF + BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true + echo BOOST_BRANCH: $BOOST_BRANCH + cd .. + git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root + cd boost-root + mkdir -p libs/$LIBRARY + cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY + git submodule update --init tools/boostdep + python3 tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY + - name: Configure + run: | + cd ../boost-root + mkdir __build__ && cd __build__ + cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DBUILD_TESTING=ON -DBOOST_MATH_ENABLE_SYCL=ON .. + - name: Build tests + run: | + cd ../boost-root/__build__ + cmake --build . --target tests - name: Run tests run: | cd ../boost-root/__build__ From 912c849111ff83a5126a9719988a06c09000801d Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Fri, 19 Jul 2024 13:54:27 -0400 Subject: [PATCH 29/64] Add sycl configuration options --- include/boost/math/tools/config.hpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/include/boost/math/tools/config.hpp b/include/boost/math/tools/config.hpp index 7983eb296..3e5ab3098 100644 --- a/include/boost/math/tools/config.hpp +++ b/include/boost/math/tools/config.hpp @@ -665,7 +665,8 @@ namespace boost{ namespace math{ // #ifdef __CUDACC__ -# define BOOST_MATH_HOST_DEVICE __host__ __device__ +# define BOOST_MATH_GPU_ENABLED __host__ __device__ +# define BOOST_MATH_HAS_GPU_SUPPORT # ifndef BOOST_MATH_ENABLE_CUDA # define BOOST_MATH_ENABLE_CUDA # endif @@ -682,9 +683,25 @@ namespace boost{ namespace math{ // We can't use return std::numeric_limits::quiet_NaN() # define BOOST_MATH_QUIET_NAN(T) static_cast(NAN); +#elif defined(SYCL_LANGUAGE_VERSION) + +# define BOOST_MATH_GPU_ENABLED SYCL_EXTERNAL +# define BOOST_MATH_HAS_GPU_SUPPORT + +# ifndef BOOST_MATH_NO_EXCEPTIONS +# define BOOST_MATH_NO_EXCEPTIONS +# endif + +# undef BOOST_MATH_FORCEINLINE +# define BOOST_MATH_FORCEINLINE inline + +# define BOOST_MATH_QUIET_NAN(T) static_cast(NAN); + #else -# define BOOST_MATH_HOST_DEVICE + +# define BOOST_MATH_GPU_ENABLED # define BOOST_MATH_QUIET_NAN(T) std::numeric_limits::quiet_NaN(); + #endif // Static variables are not allowed with CUDA or C++20 modules From afe50fd3969c8945fa9a7441d82f47e423a76d13 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Fri, 19 Jul 2024 13:54:39 -0400 Subject: [PATCH 30/64] Rename GPU macros --- include/boost/math/constants/constants.hpp | 12 +- include/boost/math/distributions/arcsine.hpp | 50 ++--- include/boost/math/distributions/binomial.hpp | 54 +++--- .../boost/math/policies/error_handling.hpp | 122 ++++++------ include/boost/math/policies/policy.hpp | 54 +++--- .../math/special_functions/fpclassify.hpp | 22 +-- include/boost/math/tools/polynomial.hpp | 182 +++++++++--------- include/boost/math/tools/precision.hpp | 8 +- 8 files changed, 252 insertions(+), 252 deletions(-) diff --git a/include/boost/math/constants/constants.hpp b/include/boost/math/constants/constants.hpp index 2ebd81688..bd2afd714 100644 --- a/include/boost/math/constants/constants.hpp +++ b/include/boost/math/constants/constants.hpp @@ -209,11 +209,11 @@ namespace boost{ namespace math constant_initializer::get_from_string >::force_instantiate();\ return get_from_string();\ }\ - BOOST_MATH_HOST_DEVICE static inline constexpr T get(const std::integral_constant) noexcept\ + BOOST_MATH_GPU_ENABLED static inline constexpr T get(const std::integral_constant) noexcept\ { return BOOST_MATH_JOIN(x, F); }\ - BOOST_MATH_HOST_DEVICE static inline constexpr T get(const std::integral_constant&) noexcept\ + BOOST_MATH_GPU_ENABLED static inline constexpr T get(const std::integral_constant&) noexcept\ { return x; }\ - BOOST_MATH_HOST_DEVICE static inline constexpr T get(const std::integral_constant&) noexcept\ + BOOST_MATH_GPU_ENABLED static inline constexpr T get(const std::integral_constant&) noexcept\ { return BOOST_MATH_JOIN(x, L); }\ BOOST_MATH_FLOAT128_CONSTANT_OVERLOAD(x) \ template static inline const T& get(const std::integral_constant&)\ @@ -231,9 +231,9 @@ namespace boost{ namespace math \ \ /* The actual forwarding function: */ \ - template BOOST_MATH_HOST_DEVICE inline constexpr typename detail::constant_return::type name(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T) BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(Policy)) BOOST_MATH_NOEXCEPT(T)\ + template BOOST_MATH_GPU_ENABLED inline constexpr typename detail::constant_return::type name(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T) BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(Policy)) BOOST_MATH_NOEXCEPT(T)\ { return detail:: BOOST_MATH_JOIN(constant_, name)::get(typename construction_traits::type()); }\ - template BOOST_MATH_HOST_DEVICE inline constexpr typename detail::constant_return::type name(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T)) BOOST_MATH_NOEXCEPT(T)\ + template BOOST_MATH_GPU_ENABLED inline constexpr typename detail::constant_return::type name(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T)) BOOST_MATH_NOEXCEPT(T)\ { return name >(); }\ \ \ @@ -328,7 +328,7 @@ namespace boost{ namespace math #endif template -BOOST_MATH_HOST_DEVICE inline constexpr T tau() { return two_pi(); } +BOOST_MATH_GPU_ENABLED inline constexpr T tau() { return two_pi(); } } // namespace constants } // namespace math diff --git a/include/boost/math/distributions/arcsine.hpp b/include/boost/math/distributions/arcsine.hpp index aa824e507..a1d06b7db 100644 --- a/include/boost/math/distributions/arcsine.hpp +++ b/include/boost/math/distributions/arcsine.hpp @@ -56,7 +56,7 @@ namespace boost // Common error checking routines for arcsine distribution functions: // Duplicating for x_min and x_max provides specific error messages. template - BOOST_MATH_HOST_DEVICE inline bool check_x_min(const char* function, const RealType& x, RealType* result, const Policy& pol) + BOOST_MATH_GPU_ENABLED inline bool check_x_min(const char* function, const RealType& x, RealType* result, const Policy& pol) { if (!(boost::math::isfinite)(x)) { @@ -69,7 +69,7 @@ namespace boost } // bool check_x_min template - BOOST_MATH_HOST_DEVICE inline bool check_x_max(const char* function, const RealType& x, RealType* result, const Policy& pol) + BOOST_MATH_GPU_ENABLED inline bool check_x_max(const char* function, const RealType& x, RealType* result, const Policy& pol) { if (!(boost::math::isfinite)(x)) { @@ -83,7 +83,7 @@ namespace boost template - BOOST_MATH_HOST_DEVICE inline bool check_x_minmax(const char* function, const RealType& x_min, const RealType& x_max, RealType* result, const Policy& pol) + BOOST_MATH_GPU_ENABLED inline bool check_x_minmax(const char* function, const RealType& x_min, const RealType& x_max, RealType* result, const Policy& pol) { // Check x_min < x_max if (x_min >= x_max) { @@ -101,7 +101,7 @@ namespace boost } // bool check_x_minmax template - BOOST_MATH_HOST_DEVICE inline bool check_prob(const char* function, const RealType& p, RealType* result, const Policy& pol) + BOOST_MATH_GPU_ENABLED inline bool check_prob(const char* function, const RealType& p, RealType* result, const Policy& pol) { if ((p < 0) || (p > 1) || !(boost::math::isfinite)(p)) { @@ -114,7 +114,7 @@ namespace boost } // bool check_prob template - BOOST_MATH_HOST_DEVICE inline bool check_x(const char* function, const RealType& x_min, const RealType& x_max, const RealType& x, RealType* result, const Policy& pol) + BOOST_MATH_GPU_ENABLED inline bool check_x(const char* function, const RealType& x_min, const RealType& x_max, const RealType& x, RealType* result, const Policy& pol) { // Check x finite and x_min < x < x_max. if (!(boost::math::isfinite)(x)) { @@ -138,7 +138,7 @@ namespace boost } // bool check_x template - BOOST_MATH_HOST_DEVICE inline bool check_dist(const char* function, const RealType& x_min, const RealType& x_max, RealType* result, const Policy& pol) + BOOST_MATH_GPU_ENABLED inline bool check_dist(const char* function, const RealType& x_min, const RealType& x_max, RealType* result, const Policy& pol) { // Check both x_min and x_max finite, and x_min < x_max. return check_x_min(function, x_min, result, pol) && check_x_max(function, x_max, result, pol) @@ -146,14 +146,14 @@ namespace boost } // bool check_dist template - BOOST_MATH_HOST_DEVICE inline bool check_dist_and_x(const char* function, const RealType& x_min, const RealType& x_max, RealType x, RealType* result, const Policy& pol) + BOOST_MATH_GPU_ENABLED inline bool check_dist_and_x(const char* function, const RealType& x_min, const RealType& x_max, RealType x, RealType* result, const Policy& pol) { return check_dist(function, x_min, x_max, result, pol) && arcsine_detail::check_x(function, x_min, x_max, x, result, pol); } // bool check_dist_and_x template - BOOST_MATH_HOST_DEVICE inline bool check_dist_and_prob(const char* function, const RealType& x_min, const RealType& x_max, RealType p, RealType* result, const Policy& pol) + BOOST_MATH_GPU_ENABLED inline bool check_dist_and_prob(const char* function, const RealType& x_min, const RealType& x_max, RealType p, RealType* result, const Policy& pol) { return check_dist(function, x_min, x_max, result, pol) && check_prob(function, p, result, pol); @@ -168,7 +168,7 @@ namespace boost typedef RealType value_type; typedef Policy policy_type; - BOOST_MATH_HOST_DEVICE arcsine_distribution(RealType x_min = 0, RealType x_max = 1) : m_x_min(x_min), m_x_max(x_max) + BOOST_MATH_GPU_ENABLED arcsine_distribution(RealType x_min = 0, RealType x_max = 1) : m_x_min(x_min), m_x_max(x_max) { // Default beta (alpha = beta = 0.5) is standard arcsine with x_min = 0, x_max = 1. // Generalized to allow x_min and x_max to be specified. RealType result; @@ -179,11 +179,11 @@ namespace boost &result, Policy()); } // arcsine_distribution constructor. // Accessor functions: - BOOST_MATH_HOST_DEVICE RealType x_min() const + BOOST_MATH_GPU_ENABLED RealType x_min() const { return m_x_min; } - BOOST_MATH_HOST_DEVICE RealType x_max() const + BOOST_MATH_GPU_ENABLED RealType x_max() const { return m_x_max; } @@ -204,21 +204,21 @@ namespace boost #endif template - BOOST_MATH_HOST_DEVICE inline const std::pair range(const arcsine_distribution& dist) + BOOST_MATH_GPU_ENABLED inline const std::pair range(const arcsine_distribution& dist) { // Range of permissible values for random variable x. using boost::math::tools::max_value; return std::pair(static_cast(dist.x_min()), static_cast(dist.x_max())); } template - BOOST_MATH_HOST_DEVICE inline const std::pair support(const arcsine_distribution& dist) + BOOST_MATH_GPU_ENABLED inline const std::pair support(const arcsine_distribution& dist) { // Range of supported values for random variable x. // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero. return std::pair(static_cast(dist.x_min()), static_cast(dist.x_max())); } template - BOOST_MATH_HOST_DEVICE inline RealType mean(const arcsine_distribution& dist) + BOOST_MATH_GPU_ENABLED inline RealType mean(const arcsine_distribution& dist) { // Mean of arcsine distribution . RealType result; RealType x_min = dist.x_min(); @@ -237,7 +237,7 @@ namespace boost } // mean template - BOOST_MATH_HOST_DEVICE inline RealType variance(const arcsine_distribution& dist) + BOOST_MATH_GPU_ENABLED inline RealType variance(const arcsine_distribution& dist) { // Variance of standard arcsine distribution = (1-0)/8 = 0.125. RealType result; RealType x_min = dist.x_min(); @@ -255,7 +255,7 @@ namespace boost } // variance template - BOOST_MATH_HOST_DEVICE inline RealType mode(const arcsine_distribution& /* dist */) + BOOST_MATH_GPU_ENABLED inline RealType mode(const arcsine_distribution& /* dist */) { //There are always [*two] values for the mode, at ['x_min] and at ['x_max], default 0 and 1, // so instead we raise the exception domain_error. return policies::raise_domain_error( @@ -266,7 +266,7 @@ namespace boost } // mode template - BOOST_MATH_HOST_DEVICE inline RealType median(const arcsine_distribution& dist) + BOOST_MATH_GPU_ENABLED inline RealType median(const arcsine_distribution& dist) { // Median of arcsine distribution (a + b) / 2 == mean. RealType x_min = dist.x_min(); RealType x_max = dist.x_max(); @@ -284,7 +284,7 @@ namespace boost } template - BOOST_MATH_HOST_DEVICE inline RealType skewness(const arcsine_distribution& dist) + BOOST_MATH_GPU_ENABLED inline RealType skewness(const arcsine_distribution& dist) { RealType result; RealType x_min = dist.x_min(); @@ -303,7 +303,7 @@ namespace boost } // skewness template - BOOST_MATH_HOST_DEVICE inline RealType kurtosis_excess(const arcsine_distribution& dist) + BOOST_MATH_GPU_ENABLED inline RealType kurtosis_excess(const arcsine_distribution& dist) { RealType result; RealType x_min = dist.x_min(); @@ -323,7 +323,7 @@ namespace boost } // kurtosis_excess template - BOOST_MATH_HOST_DEVICE inline RealType kurtosis(const arcsine_distribution& dist) + BOOST_MATH_GPU_ENABLED inline RealType kurtosis(const arcsine_distribution& dist) { RealType result; RealType x_min = dist.x_min(); @@ -343,7 +343,7 @@ namespace boost } // kurtosis template - BOOST_MATH_HOST_DEVICE inline RealType pdf(const arcsine_distribution& dist, const RealType& xx) + BOOST_MATH_GPU_ENABLED inline RealType pdf(const arcsine_distribution& dist, const RealType& xx) { // Probability Density/Mass Function arcsine. BOOST_FPU_EXCEPTION_GUARD BOOST_MATH_STD_USING // For ADL of std functions. @@ -369,7 +369,7 @@ namespace boost } // pdf template - BOOST_MATH_HOST_DEVICE inline RealType cdf(const arcsine_distribution& dist, const RealType& x) + BOOST_MATH_GPU_ENABLED inline RealType cdf(const arcsine_distribution& dist, const RealType& x) { // Cumulative Distribution Function arcsine. BOOST_MATH_STD_USING // For ADL of std functions. @@ -402,7 +402,7 @@ namespace boost } // arcsine cdf template - BOOST_MATH_HOST_DEVICE inline RealType cdf(const complemented2_type, RealType>& c) + BOOST_MATH_GPU_ENABLED inline RealType cdf(const complemented2_type, RealType>& c) { // Complemented Cumulative Distribution Function arcsine. BOOST_MATH_STD_USING // For ADL of std functions. static const char* function = "boost::math::cdf(arcsine_distribution<%1%> const&, %1%)"; @@ -438,7 +438,7 @@ namespace boost } // arcsine ccdf template - BOOST_MATH_HOST_DEVICE inline RealType quantile(const arcsine_distribution& dist, const RealType& p) + BOOST_MATH_GPU_ENABLED inline RealType quantile(const arcsine_distribution& dist, const RealType& p) { // Quantile or Percent Point arcsine function or // Inverse Cumulative probability distribution function CDF. @@ -482,7 +482,7 @@ namespace boost } // quantile template - BOOST_MATH_HOST_DEVICE inline RealType quantile(const complemented2_type, RealType>& c) + BOOST_MATH_GPU_ENABLED inline RealType quantile(const complemented2_type, RealType>& c) { // Complement Quantile or Percent Point arcsine function. // Return the number of expected x for a given diff --git a/include/boost/math/distributions/binomial.hpp b/include/boost/math/distributions/binomial.hpp index 9a2bc73b1..d17f8636b 100644 --- a/include/boost/math/distributions/binomial.hpp +++ b/include/boost/math/distributions/binomial.hpp @@ -101,7 +101,7 @@ namespace boost namespace binomial_detail{ // common error checking routines for binomial distribution functions: template - BOOST_MATH_HOST_DEVICE inline bool check_N(const char* function, const RealType& N, RealType* result, const Policy& pol) + BOOST_MATH_GPU_ENABLED inline bool check_N(const char* function, const RealType& N, RealType* result, const Policy& pol) { if((N < 0) || !(boost::math::isfinite)(N)) { @@ -113,7 +113,7 @@ namespace boost return true; } template - BOOST_MATH_HOST_DEVICE inline bool check_success_fraction(const char* function, const RealType& p, RealType* result, const Policy& pol) + BOOST_MATH_GPU_ENABLED inline bool check_success_fraction(const char* function, const RealType& p, RealType* result, const Policy& pol) { if((p < 0) || (p > 1) || !(boost::math::isfinite)(p)) { @@ -125,7 +125,7 @@ namespace boost return true; } template - BOOST_MATH_HOST_DEVICE inline bool check_dist(const char* function, const RealType& N, const RealType& p, RealType* result, const Policy& pol) + BOOST_MATH_GPU_ENABLED inline bool check_dist(const char* function, const RealType& N, const RealType& p, RealType* result, const Policy& pol) { return check_success_fraction( function, p, result, pol) @@ -133,7 +133,7 @@ namespace boost function, N, result, pol); } template - BOOST_MATH_HOST_DEVICE inline bool check_dist_and_k(const char* function, const RealType& N, const RealType& p, RealType k, RealType* result, const Policy& pol) + BOOST_MATH_GPU_ENABLED inline bool check_dist_and_k(const char* function, const RealType& N, const RealType& p, RealType k, RealType* result, const Policy& pol) { if(check_dist(function, N, p, result, pol) == false) return false; @@ -154,7 +154,7 @@ namespace boost return true; } template - BOOST_MATH_HOST_DEVICE inline bool check_dist_and_prob(const char* function, const RealType& N, RealType p, RealType prob, RealType* result, const Policy& pol) + BOOST_MATH_GPU_ENABLED inline bool check_dist_and_prob(const char* function, const RealType& N, RealType p, RealType prob, RealType* result, const Policy& pol) { if((check_dist(function, N, p, result, pol) && detail::check_probability(function, prob, result, pol)) == false) return false; @@ -162,7 +162,7 @@ namespace boost } template - BOOST_MATH_HOST_DEVICE T inverse_binomial_cornish_fisher(T n, T sf, T p, T q, const Policy& pol) + BOOST_MATH_GPU_ENABLED T inverse_binomial_cornish_fisher(T n, T sf, T p, T q, const Policy& pol) { BOOST_MATH_STD_USING // mean: @@ -197,7 +197,7 @@ namespace boost } template - BOOST_MATH_HOST_DEVICE RealType quantile_imp(const binomial_distribution& dist, const RealType& p, const RealType& q, bool comp) + BOOST_MATH_GPU_ENABLED RealType quantile_imp(const binomial_distribution& dist, const RealType& p, const RealType& q, bool comp) { // Quantile or Percent Point Binomial function. // Return the number of expected successes k, // for a given probability p. @@ -291,11 +291,11 @@ namespace boost &r, Policy()); } // binomial_distribution constructor. - BOOST_MATH_HOST_DEVICE RealType success_fraction() const + BOOST_MATH_GPU_ENABLED RealType success_fraction() const { // Probability. return m_p; } - BOOST_MATH_HOST_DEVICE RealType trials() const + BOOST_MATH_GPU_ENABLED RealType trials() const { // Total number of trials. return m_n; } @@ -311,7 +311,7 @@ namespace boost // these functions are used // to obtain confidence intervals for the success fraction. // - BOOST_MATH_HOST_DEVICE static RealType find_lower_bound_on_p( + BOOST_MATH_GPU_ENABLED static RealType find_lower_bound_on_p( RealType trials, RealType successes, RealType probability, @@ -336,7 +336,7 @@ namespace boost return (t == clopper_pearson_exact_interval) ? ibeta_inv(successes, trials - successes + 1, probability, static_cast(nullptr), Policy()) : ibeta_inv(successes + 0.5f, trials - successes + 0.5f, probability, static_cast(nullptr), Policy()); } - BOOST_MATH_HOST_DEVICE static RealType find_upper_bound_on_p( + BOOST_MATH_GPU_ENABLED static RealType find_upper_bound_on_p( RealType trials, RealType successes, RealType probability, @@ -364,7 +364,7 @@ namespace boost // or // "How many trials can I have to be P% sure of seeing fewer than k events?" // - BOOST_MATH_HOST_DEVICE static RealType find_minimum_number_of_trials( + BOOST_MATH_GPU_ENABLED static RealType find_minimum_number_of_trials( RealType k, // number of events RealType p, // success fraction RealType alpha) // risk level @@ -383,7 +383,7 @@ namespace boost return result + k; } - BOOST_MATH_HOST_DEVICE static RealType find_maximum_number_of_trials( + BOOST_MATH_GPU_ENABLED static RealType find_maximum_number_of_trials( RealType k, // number of events RealType p, // success fraction RealType alpha) // risk level @@ -420,33 +420,33 @@ namespace boost #endif template - BOOST_MATH_HOST_DEVICE const std::pair range(const binomial_distribution& dist) + BOOST_MATH_GPU_ENABLED const std::pair range(const binomial_distribution& dist) { // Range of permissible values for random variable k. using boost::math::tools::max_value; return std::pair(static_cast(0), dist.trials()); } template - BOOST_MATH_HOST_DEVICE const std::pair support(const binomial_distribution& dist) + BOOST_MATH_GPU_ENABLED const std::pair support(const binomial_distribution& dist) { // Range of supported values for random variable k. // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero. return std::pair(static_cast(0), dist.trials()); } template - BOOST_MATH_HOST_DEVICE inline RealType mean(const binomial_distribution& dist) + BOOST_MATH_GPU_ENABLED inline RealType mean(const binomial_distribution& dist) { // Mean of Binomial distribution = np. return dist.trials() * dist.success_fraction(); } // mean template - BOOST_MATH_HOST_DEVICE inline RealType variance(const binomial_distribution& dist) + BOOST_MATH_GPU_ENABLED inline RealType variance(const binomial_distribution& dist) { // Variance of Binomial distribution = np(1-p). return dist.trials() * dist.success_fraction() * (1 - dist.success_fraction()); } // variance template - BOOST_MATH_HOST_DEVICE RealType pdf(const binomial_distribution& dist, const RealType& k) + BOOST_MATH_GPU_ENABLED RealType pdf(const binomial_distribution& dist, const RealType& k) { // Probability Density/Mass Function. BOOST_FPU_EXCEPTION_GUARD @@ -502,7 +502,7 @@ namespace boost } // pdf template - BOOST_MATH_HOST_DEVICE inline RealType cdf(const binomial_distribution& dist, const RealType& k) + BOOST_MATH_GPU_ENABLED inline RealType cdf(const binomial_distribution& dist, const RealType& k) { // Cumulative Distribution Function Binomial. // The random variate k is the number of successes in n trials. // k argument may be integral, signed, or unsigned, or floating point. @@ -574,7 +574,7 @@ namespace boost } // binomial cdf template - BOOST_MATH_HOST_DEVICE inline RealType cdf(const complemented2_type, RealType>& c) + BOOST_MATH_GPU_ENABLED inline RealType cdf(const complemented2_type, RealType>& c) { // Complemented Cumulative Distribution Function Binomial. // The random variate k is the number of successes in n trials. // k argument may be integral, signed, or unsigned, or floating point. @@ -651,19 +651,19 @@ namespace boost } // binomial cdf template - BOOST_MATH_HOST_DEVICE inline RealType quantile(const binomial_distribution& dist, const RealType& p) + BOOST_MATH_GPU_ENABLED inline RealType quantile(const binomial_distribution& dist, const RealType& p) { return binomial_detail::quantile_imp(dist, p, RealType(1-p), false); } // quantile template - BOOST_MATH_HOST_DEVICE RealType quantile(const complemented2_type, RealType>& c) + BOOST_MATH_GPU_ENABLED RealType quantile(const complemented2_type, RealType>& c) { return binomial_detail::quantile_imp(c.dist, RealType(1-c.param), c.param, true); } // quantile template - BOOST_MATH_HOST_DEVICE inline RealType mode(const binomial_distribution& dist) + BOOST_MATH_GPU_ENABLED inline RealType mode(const binomial_distribution& dist) { BOOST_MATH_STD_USING // ADL of std functions. RealType p = dist.success_fraction(); @@ -672,7 +672,7 @@ namespace boost } template - BOOST_MATH_HOST_DEVICE inline RealType median(const binomial_distribution& dist) + BOOST_MATH_GPU_ENABLED inline RealType median(const binomial_distribution& dist) { // Bounds for the median of the negative binomial distribution // VAN DE VEN R. ; WEBER N. C. ; // Univ. Sydney, school mathematics statistics, Sydney N.S.W. 2006, AUSTRALIE @@ -690,7 +690,7 @@ namespace boost } template - BOOST_MATH_HOST_DEVICE inline RealType skewness(const binomial_distribution& dist) + BOOST_MATH_GPU_ENABLED inline RealType skewness(const binomial_distribution& dist) { BOOST_MATH_STD_USING // ADL of std functions. RealType p = dist.success_fraction(); @@ -699,7 +699,7 @@ namespace boost } template - BOOST_MATH_HOST_DEVICE inline RealType kurtosis(const binomial_distribution& dist) + BOOST_MATH_GPU_ENABLED inline RealType kurtosis(const binomial_distribution& dist) { RealType p = dist.success_fraction(); RealType n = dist.trials(); @@ -707,7 +707,7 @@ namespace boost } template - BOOST_MATH_HOST_DEVICE inline RealType kurtosis_excess(const binomial_distribution& dist) + BOOST_MATH_GPU_ENABLED inline RealType kurtosis_excess(const binomial_distribution& dist) { RealType p = dist.success_fraction(); RealType q = 1 - p; diff --git a/include/boost/math/policies/error_handling.hpp b/include/boost/math/policies/error_handling.hpp index cd604aad3..e742eaf3d 100644 --- a/include/boost/math/policies/error_handling.hpp +++ b/include/boost/math/policies/error_handling.hpp @@ -199,7 +199,7 @@ void raise_error(const char* pfunction, const char* pmessage, const T& val) #endif template -BOOST_MATH_HOST_DEVICE inline T raise_domain_error( +BOOST_MATH_GPU_ENABLED inline T raise_domain_error( const char* function, const char* message, const T& val, @@ -215,7 +215,7 @@ BOOST_MATH_HOST_DEVICE inline T raise_domain_error( } template -BOOST_MATH_HOST_DEVICE constexpr T raise_domain_error( +BOOST_MATH_GPU_ENABLED constexpr T raise_domain_error( const char* , const char* , const T& , @@ -227,7 +227,7 @@ BOOST_MATH_HOST_DEVICE constexpr T raise_domain_error( } template -BOOST_MATH_HOST_DEVICE inline T raise_domain_error( +BOOST_MATH_GPU_ENABLED inline T raise_domain_error( const char* , const char* , const T& , @@ -240,7 +240,7 @@ BOOST_MATH_HOST_DEVICE inline T raise_domain_error( } template -BOOST_MATH_HOST_DEVICE inline T raise_domain_error( +BOOST_MATH_GPU_ENABLED inline T raise_domain_error( const char* function, const char* message, const T& val, @@ -250,7 +250,7 @@ BOOST_MATH_HOST_DEVICE inline T raise_domain_error( } template -BOOST_MATH_HOST_DEVICE inline T raise_pole_error( +BOOST_MATH_GPU_ENABLED inline T raise_pole_error( const char* function, const char* message, const T& val, @@ -264,7 +264,7 @@ BOOST_MATH_HOST_DEVICE inline T raise_pole_error( } template -BOOST_MATH_HOST_DEVICE constexpr T raise_pole_error( +BOOST_MATH_GPU_ENABLED constexpr T raise_pole_error( const char* function, const char* message, const T& val, @@ -274,7 +274,7 @@ BOOST_MATH_HOST_DEVICE constexpr T raise_pole_error( } template -BOOST_MATH_HOST_DEVICE constexpr T raise_pole_error( +BOOST_MATH_GPU_ENABLED constexpr T raise_pole_error( const char* function, const char* message, const T& val, @@ -284,7 +284,7 @@ BOOST_MATH_HOST_DEVICE constexpr T raise_pole_error( } template -BOOST_MATH_HOST_DEVICE inline T raise_pole_error( +BOOST_MATH_GPU_ENABLED inline T raise_pole_error( const char* function, const char* message, const T& val, @@ -294,7 +294,7 @@ BOOST_MATH_HOST_DEVICE inline T raise_pole_error( } template -BOOST_MATH_HOST_DEVICE inline T raise_overflow_error( +BOOST_MATH_GPU_ENABLED inline T raise_overflow_error( const char* function, const char* message, const ::boost::math::policies::overflow_error< ::boost::math::policies::throw_on_error>&) @@ -309,7 +309,7 @@ BOOST_MATH_HOST_DEVICE inline T raise_overflow_error( } template -BOOST_MATH_HOST_DEVICE inline T raise_overflow_error( +BOOST_MATH_GPU_ENABLED inline T raise_overflow_error( const char* function, const char* message, const T& val, @@ -325,7 +325,7 @@ BOOST_MATH_HOST_DEVICE inline T raise_overflow_error( } template -BOOST_MATH_HOST_DEVICE constexpr T raise_overflow_error( +BOOST_MATH_GPU_ENABLED constexpr T raise_overflow_error( const char* , const char* , const ::boost::math::policies::overflow_error< ::boost::math::policies::ignore_error>&) BOOST_MATH_NOEXCEPT(T) @@ -336,7 +336,7 @@ BOOST_MATH_HOST_DEVICE constexpr T raise_overflow_error( } template -BOOST_MATH_HOST_DEVICE constexpr T raise_overflow_error( +BOOST_MATH_GPU_ENABLED constexpr T raise_overflow_error( const char* , const char* , const T&, @@ -348,7 +348,7 @@ BOOST_MATH_HOST_DEVICE constexpr T raise_overflow_error( } template -BOOST_MATH_HOST_DEVICE inline T raise_overflow_error( +BOOST_MATH_GPU_ENABLED inline T raise_overflow_error( const char* , const char* , const ::boost::math::policies::overflow_error< ::boost::math::policies::errno_on_error>&) BOOST_MATH_NOEXCEPT(T) @@ -360,7 +360,7 @@ BOOST_MATH_HOST_DEVICE inline T raise_overflow_error( } template -BOOST_MATH_HOST_DEVICE inline T raise_overflow_error( +BOOST_MATH_GPU_ENABLED inline T raise_overflow_error( const char* , const char* , const T&, @@ -373,7 +373,7 @@ BOOST_MATH_HOST_DEVICE inline T raise_overflow_error( } template -BOOST_MATH_HOST_DEVICE inline T raise_overflow_error( +BOOST_MATH_GPU_ENABLED inline T raise_overflow_error( const char* function, const char* message, const ::boost::math::policies::overflow_error< ::boost::math::policies::user_error>&) @@ -382,7 +382,7 @@ BOOST_MATH_HOST_DEVICE inline T raise_overflow_error( } template -BOOST_MATH_HOST_DEVICE inline T raise_overflow_error( +BOOST_MATH_GPU_ENABLED inline T raise_overflow_error( const char* function, const char* message, const T& val, @@ -396,7 +396,7 @@ BOOST_MATH_HOST_DEVICE inline T raise_overflow_error( } template -BOOST_MATH_HOST_DEVICE inline T raise_underflow_error( +BOOST_MATH_GPU_ENABLED inline T raise_underflow_error( const char* function, const char* message, const ::boost::math::policies::underflow_error< ::boost::math::policies::throw_on_error>&) @@ -411,7 +411,7 @@ BOOST_MATH_HOST_DEVICE inline T raise_underflow_error( } template -BOOST_MATH_HOST_DEVICE constexpr T raise_underflow_error( +BOOST_MATH_GPU_ENABLED constexpr T raise_underflow_error( const char* , const char* , const ::boost::math::policies::underflow_error< ::boost::math::policies::ignore_error>&) BOOST_MATH_NOEXCEPT(T) @@ -422,7 +422,7 @@ BOOST_MATH_HOST_DEVICE constexpr T raise_underflow_error( } template -BOOST_MATH_HOST_DEVICE inline T raise_underflow_error( +BOOST_MATH_GPU_ENABLED inline T raise_underflow_error( const char* /* function */, const char* /* message */, const ::boost::math::policies::underflow_error< ::boost::math::policies::errno_on_error>&) BOOST_MATH_NOEXCEPT(T) @@ -434,7 +434,7 @@ BOOST_MATH_HOST_DEVICE inline T raise_underflow_error( } template -BOOST_MATH_HOST_DEVICE inline T raise_underflow_error( +BOOST_MATH_GPU_ENABLED inline T raise_underflow_error( const char* function, const char* message, const ::boost::math::policies::underflow_error< ::boost::math::policies::user_error>&) @@ -443,7 +443,7 @@ BOOST_MATH_HOST_DEVICE inline T raise_underflow_error( } template -BOOST_MATH_HOST_DEVICE inline T raise_denorm_error( +BOOST_MATH_GPU_ENABLED inline T raise_denorm_error( const char* function, const char* message, const T& /* val */, @@ -459,7 +459,7 @@ BOOST_MATH_HOST_DEVICE inline T raise_denorm_error( } template -BOOST_MATH_HOST_DEVICE inline constexpr T raise_denorm_error( +BOOST_MATH_GPU_ENABLED inline constexpr T raise_denorm_error( const char* , const char* , const T& val, @@ -471,7 +471,7 @@ BOOST_MATH_HOST_DEVICE inline constexpr T raise_denorm_error( } template -BOOST_MATH_HOST_DEVICE inline T raise_denorm_error( +BOOST_MATH_GPU_ENABLED inline T raise_denorm_error( const char* , const char* , const T& val, @@ -484,7 +484,7 @@ BOOST_MATH_HOST_DEVICE inline T raise_denorm_error( } template -BOOST_MATH_HOST_DEVICE inline T raise_denorm_error( +BOOST_MATH_GPU_ENABLED inline T raise_denorm_error( const char* function, const char* message, const T& val, @@ -494,7 +494,7 @@ BOOST_MATH_HOST_DEVICE inline T raise_denorm_error( } template -BOOST_MATH_HOST_DEVICE inline T raise_evaluation_error( +BOOST_MATH_GPU_ENABLED inline T raise_evaluation_error( const char* function, const char* message, const T& val, @@ -510,7 +510,7 @@ BOOST_MATH_HOST_DEVICE inline T raise_evaluation_error( } template -BOOST_MATH_HOST_DEVICE constexpr T raise_evaluation_error( +BOOST_MATH_GPU_ENABLED constexpr T raise_evaluation_error( const char* , const char* , const T& val, @@ -522,7 +522,7 @@ BOOST_MATH_HOST_DEVICE constexpr T raise_evaluation_error( } template -BOOST_MATH_HOST_DEVICE inline T raise_evaluation_error( +BOOST_MATH_GPU_ENABLED inline T raise_evaluation_error( const char* , const char* , const T& val, @@ -535,7 +535,7 @@ BOOST_MATH_HOST_DEVICE inline T raise_evaluation_error( } template -BOOST_MATH_HOST_DEVICE inline T raise_evaluation_error( +BOOST_MATH_GPU_ENABLED inline T raise_evaluation_error( const char* function, const char* message, const T& val, @@ -545,7 +545,7 @@ BOOST_MATH_HOST_DEVICE inline T raise_evaluation_error( } template -BOOST_MATH_HOST_DEVICE inline TargetType raise_rounding_error( +BOOST_MATH_GPU_ENABLED inline TargetType raise_rounding_error( const char* function, const char* message, const T& val, @@ -562,7 +562,7 @@ BOOST_MATH_HOST_DEVICE inline TargetType raise_rounding_error( } template -BOOST_MATH_HOST_DEVICE constexpr TargetType raise_rounding_error( +BOOST_MATH_GPU_ENABLED constexpr TargetType raise_rounding_error( const char* , const char* , const T& val, @@ -576,7 +576,7 @@ BOOST_MATH_HOST_DEVICE constexpr TargetType raise_rounding_error( } template -BOOST_MATH_HOST_DEVICE inline TargetType raise_rounding_error( +BOOST_MATH_GPU_ENABLED inline TargetType raise_rounding_error( const char* , const char* , const T& val, @@ -590,7 +590,7 @@ BOOST_MATH_HOST_DEVICE inline TargetType raise_rounding_error( return val > 0 ? (std::numeric_limits::max)() : (std::numeric_limits::is_integer ? (std::numeric_limits::min)() : -(std::numeric_limits::max)()); } template -BOOST_MATH_HOST_DEVICE inline TargetType raise_rounding_error( +BOOST_MATH_GPU_ENABLED inline TargetType raise_rounding_error( const char* function, const char* message, const T& val, @@ -601,7 +601,7 @@ BOOST_MATH_HOST_DEVICE inline TargetType raise_rounding_error( } template -BOOST_MATH_HOST_DEVICE inline T raise_indeterminate_result_error( +BOOST_MATH_GPU_ENABLED inline T raise_indeterminate_result_error( const char* function, const char* message, const T& val, @@ -618,7 +618,7 @@ BOOST_MATH_HOST_DEVICE inline T raise_indeterminate_result_error( } template -BOOST_MATH_HOST_DEVICE inline constexpr T raise_indeterminate_result_error( +BOOST_MATH_GPU_ENABLED inline constexpr T raise_indeterminate_result_error( const char* , const char* , const T& , @@ -631,7 +631,7 @@ BOOST_MATH_HOST_DEVICE inline constexpr T raise_indeterminate_result_error( } template -BOOST_MATH_HOST_DEVICE inline T raise_indeterminate_result_error( +BOOST_MATH_GPU_ENABLED inline T raise_indeterminate_result_error( const char* , const char* , const T& , @@ -645,7 +645,7 @@ BOOST_MATH_HOST_DEVICE inline T raise_indeterminate_result_error( } template -BOOST_MATH_HOST_DEVICE inline T raise_indeterminate_result_error( +BOOST_MATH_GPU_ENABLED inline T raise_indeterminate_result_error( const char* function, const char* message, const T& val, @@ -658,7 +658,7 @@ BOOST_MATH_HOST_DEVICE inline T raise_indeterminate_result_error( } // namespace detail template -BOOST_MATH_HOST_DEVICE constexpr T raise_domain_error(const char* function, const char* message, const T& val, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) +BOOST_MATH_GPU_ENABLED constexpr T raise_domain_error(const char* function, const char* message, const T& val, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) { typedef typename Policy::domain_error_type policy_type; return detail::raise_domain_error( @@ -667,7 +667,7 @@ BOOST_MATH_HOST_DEVICE constexpr T raise_domain_error(const char* function, cons } template -BOOST_MATH_HOST_DEVICE constexpr T raise_pole_error(const char* function, const char* message, const T& val, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) +BOOST_MATH_GPU_ENABLED constexpr T raise_pole_error(const char* function, const char* message, const T& val, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) { typedef typename Policy::pole_error_type policy_type; return detail::raise_pole_error( @@ -676,7 +676,7 @@ BOOST_MATH_HOST_DEVICE constexpr T raise_pole_error(const char* function, const } template -BOOST_MATH_HOST_DEVICE constexpr T raise_overflow_error(const char* function, const char* message, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) +BOOST_MATH_GPU_ENABLED constexpr T raise_overflow_error(const char* function, const char* message, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) { typedef typename Policy::overflow_error_type policy_type; return detail::raise_overflow_error( @@ -685,7 +685,7 @@ BOOST_MATH_HOST_DEVICE constexpr T raise_overflow_error(const char* function, co } template -BOOST_MATH_HOST_DEVICE constexpr T raise_overflow_error(const char* function, const char* message, const T& val, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) +BOOST_MATH_GPU_ENABLED constexpr T raise_overflow_error(const char* function, const char* message, const T& val, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) { typedef typename Policy::overflow_error_type policy_type; return detail::raise_overflow_error( @@ -694,7 +694,7 @@ BOOST_MATH_HOST_DEVICE constexpr T raise_overflow_error(const char* function, co } template -BOOST_MATH_HOST_DEVICE constexpr T raise_underflow_error(const char* function, const char* message, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) +BOOST_MATH_GPU_ENABLED constexpr T raise_underflow_error(const char* function, const char* message, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) { typedef typename Policy::underflow_error_type policy_type; return detail::raise_underflow_error( @@ -703,7 +703,7 @@ BOOST_MATH_HOST_DEVICE constexpr T raise_underflow_error(const char* function, c } template -BOOST_MATH_HOST_DEVICE constexpr T raise_denorm_error(const char* function, const char* message, const T& val, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) +BOOST_MATH_GPU_ENABLED constexpr T raise_denorm_error(const char* function, const char* message, const T& val, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) { typedef typename Policy::denorm_error_type policy_type; return detail::raise_denorm_error( @@ -713,7 +713,7 @@ BOOST_MATH_HOST_DEVICE constexpr T raise_denorm_error(const char* function, cons } template -BOOST_MATH_HOST_DEVICE constexpr T raise_evaluation_error(const char* function, const char* message, const T& val, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) +BOOST_MATH_GPU_ENABLED constexpr T raise_evaluation_error(const char* function, const char* message, const T& val, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) { typedef typename Policy::evaluation_error_type policy_type; return detail::raise_evaluation_error( @@ -722,7 +722,7 @@ BOOST_MATH_HOST_DEVICE constexpr T raise_evaluation_error(const char* function, } template -BOOST_MATH_HOST_DEVICE constexpr TargetType raise_rounding_error(const char* function, const char* message, const T& val, const TargetType& t, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) +BOOST_MATH_GPU_ENABLED constexpr TargetType raise_rounding_error(const char* function, const char* message, const T& val, const TargetType& t, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) { typedef typename Policy::rounding_error_type policy_type; return detail::raise_rounding_error( @@ -731,7 +731,7 @@ BOOST_MATH_HOST_DEVICE constexpr TargetType raise_rounding_error(const char* fun } template -BOOST_MATH_HOST_DEVICE constexpr T raise_indeterminate_result_error(const char* function, const char* message, const T& val, const R& result, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) +BOOST_MATH_GPU_ENABLED constexpr T raise_indeterminate_result_error(const char* function, const char* message, const T& val, const R& result, const Policy&) noexcept(is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T)) { typedef typename Policy::indeterminate_result_error_type policy_type; return detail::raise_indeterminate_result_error( @@ -746,7 +746,7 @@ namespace detail { template -BOOST_MATH_HOST_DEVICE BOOST_MATH_FORCEINLINE bool check_overflow(T val, R* result, const char* function, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T) && (Policy::value != throw_on_error) && (Policy::value != user_error)) +BOOST_MATH_GPU_ENABLED BOOST_MATH_FORCEINLINE bool check_overflow(T val, R* result, const char* function, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T) && (Policy::value != throw_on_error) && (Policy::value != user_error)) { BOOST_MATH_STD_USING if(fabs(val) > tools::max_value()) @@ -758,7 +758,7 @@ BOOST_MATH_HOST_DEVICE BOOST_MATH_FORCEINLINE bool check_overflow(T val, R* resu return false; } template -BOOST_MATH_HOST_DEVICE BOOST_MATH_FORCEINLINE bool check_overflow(std::complex val, R* result, const char* function, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T) && (Policy::value != throw_on_error) && (Policy::value != user_error)) +BOOST_MATH_GPU_ENABLED BOOST_MATH_FORCEINLINE bool check_overflow(std::complex val, R* result, const char* function, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T) && (Policy::value != throw_on_error) && (Policy::value != user_error)) { typedef typename R::value_type r_type; r_type re, im; @@ -768,7 +768,7 @@ BOOST_MATH_HOST_DEVICE BOOST_MATH_FORCEINLINE bool check_overflow(std::complex -BOOST_MATH_HOST_DEVICE BOOST_MATH_FORCEINLINE bool check_underflow(T val, R* result, const char* function, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T) && (Policy::value != throw_on_error) && (Policy::value != user_error)) +BOOST_MATH_GPU_ENABLED BOOST_MATH_FORCEINLINE bool check_underflow(T val, R* result, const char* function, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T) && (Policy::value != throw_on_error) && (Policy::value != user_error)) { if((val != 0) && (static_cast(val) == 0)) { @@ -778,7 +778,7 @@ BOOST_MATH_HOST_DEVICE BOOST_MATH_FORCEINLINE bool check_underflow(T val, R* res return false; } template -BOOST_MATH_HOST_DEVICE BOOST_MATH_FORCEINLINE bool check_underflow(std::complex val, R* result, const char* function, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T) && (Policy::value != throw_on_error) && (Policy::value != user_error)) +BOOST_MATH_GPU_ENABLED BOOST_MATH_FORCEINLINE bool check_underflow(std::complex val, R* result, const char* function, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T) && (Policy::value != throw_on_error) && (Policy::value != user_error)) { typedef typename R::value_type r_type; r_type re, im; @@ -788,7 +788,7 @@ BOOST_MATH_HOST_DEVICE BOOST_MATH_FORCEINLINE bool check_underflow(std::complex< return r; } template -BOOST_MATH_HOST_DEVICE BOOST_MATH_FORCEINLINE bool check_denorm(T val, R* result, const char* function, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T) && (Policy::value != throw_on_error) && (Policy::value != user_error)) +BOOST_MATH_GPU_ENABLED BOOST_MATH_FORCEINLINE bool check_denorm(T val, R* result, const char* function, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T) && (Policy::value != throw_on_error) && (Policy::value != user_error)) { BOOST_MATH_STD_USING if((fabs(val) < static_cast(tools::min_value())) && (static_cast(val) != 0)) @@ -799,7 +799,7 @@ BOOST_MATH_HOST_DEVICE BOOST_MATH_FORCEINLINE bool check_denorm(T val, R* result return false; } template -BOOST_MATH_HOST_DEVICE BOOST_MATH_FORCEINLINE bool check_denorm(std::complex val, R* result, const char* function, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T) && (Policy::value != throw_on_error) && (Policy::value != user_error)) +BOOST_MATH_GPU_ENABLED BOOST_MATH_FORCEINLINE bool check_denorm(std::complex val, R* result, const char* function, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T) && (Policy::value != throw_on_error) && (Policy::value != user_error)) { typedef typename R::value_type r_type; r_type re, im; @@ -811,28 +811,28 @@ BOOST_MATH_HOST_DEVICE BOOST_MATH_FORCEINLINE bool check_denorm(std::complex // Default instantiations with ignore_error policy. template -BOOST_MATH_HOST_DEVICE BOOST_MATH_FORCEINLINE constexpr bool check_overflow(T /* val */, R* /* result */, const char* /* function */, const overflow_error&) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T)) +BOOST_MATH_GPU_ENABLED BOOST_MATH_FORCEINLINE constexpr bool check_overflow(T /* val */, R* /* result */, const char* /* function */, const overflow_error&) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T)) { return false; } template -BOOST_MATH_HOST_DEVICE BOOST_MATH_FORCEINLINE constexpr bool check_overflow(std::complex /* val */, R* /* result */, const char* /* function */, const overflow_error&) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T)) +BOOST_MATH_GPU_ENABLED BOOST_MATH_FORCEINLINE constexpr bool check_overflow(std::complex /* val */, R* /* result */, const char* /* function */, const overflow_error&) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T)) { return false; } template -BOOST_MATH_HOST_DEVICE BOOST_MATH_FORCEINLINE constexpr bool check_underflow(T /* val */, R* /* result */, const char* /* function */, const underflow_error&) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T)) +BOOST_MATH_GPU_ENABLED BOOST_MATH_FORCEINLINE constexpr bool check_underflow(T /* val */, R* /* result */, const char* /* function */, const underflow_error&) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T)) { return false; } template -BOOST_MATH_HOST_DEVICE BOOST_MATH_FORCEINLINE constexpr bool check_underflow(std::complex /* val */, R* /* result */, const char* /* function */, const underflow_error&) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T)) +BOOST_MATH_GPU_ENABLED BOOST_MATH_FORCEINLINE constexpr bool check_underflow(std::complex /* val */, R* /* result */, const char* /* function */, const underflow_error&) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T)) { return false; } template -BOOST_MATH_HOST_DEVICE BOOST_MATH_FORCEINLINE constexpr bool check_denorm(T /* val */, R* /* result*/, const char* /* function */, const denorm_error&) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T)) +BOOST_MATH_GPU_ENABLED BOOST_MATH_FORCEINLINE constexpr bool check_denorm(T /* val */, R* /* result*/, const char* /* function */, const denorm_error&) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T)) { return false; } template -BOOST_MATH_HOST_DEVICE BOOST_MATH_FORCEINLINE constexpr bool check_denorm(std::complex /* val */, R* /* result*/, const char* /* function */, const denorm_error&) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T)) +BOOST_MATH_GPU_ENABLED BOOST_MATH_FORCEINLINE constexpr bool check_denorm(std::complex /* val */, R* /* result*/, const char* /* function */, const denorm_error&) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T)) { return false; } } // namespace detail template -BOOST_MATH_HOST_DEVICE BOOST_MATH_FORCEINLINE R checked_narrowing_cast(T val, const char* function) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T) && is_noexcept_error_policy::value) +BOOST_MATH_GPU_ENABLED BOOST_MATH_FORCEINLINE R checked_narrowing_cast(T val, const char* function) noexcept(BOOST_MATH_IS_FLOAT(R) && BOOST_MATH_IS_FLOAT(T) && is_noexcept_error_policy::value) { typedef typename Policy::overflow_error_type overflow_type; typedef typename Policy::underflow_error_type underflow_type; @@ -852,7 +852,7 @@ BOOST_MATH_HOST_DEVICE BOOST_MATH_FORCEINLINE R checked_narrowing_cast(T val, co } template -BOOST_MATH_HOST_DEVICE inline void check_series_iterations(const char* function, std::uintmax_t max_iter, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(T) && is_noexcept_error_policy::value) +BOOST_MATH_GPU_ENABLED inline void check_series_iterations(const char* function, std::uintmax_t max_iter, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(T) && is_noexcept_error_policy::value) { if(max_iter >= policies::get_max_series_iterations()) raise_evaluation_error( @@ -861,7 +861,7 @@ BOOST_MATH_HOST_DEVICE inline void check_series_iterations(const char* function, } template -BOOST_MATH_HOST_DEVICE inline void check_root_iterations(const char* function, std::uintmax_t max_iter, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(T) && is_noexcept_error_policy::value) +BOOST_MATH_GPU_ENABLED inline void check_root_iterations(const char* function, std::uintmax_t max_iter, const Policy& pol) noexcept(BOOST_MATH_IS_FLOAT(T) && is_noexcept_error_policy::value) { if(max_iter >= policies::get_max_root_iterations()) raise_evaluation_error( @@ -878,7 +878,7 @@ namespace detail{ // that value usually comes from one of the error handlers above: // template -BOOST_MATH_HOST_DEVICE std::pair pair_from_single(const T& val) BOOST_MATH_NOEXCEPT(T) +BOOST_MATH_GPU_ENABLED std::pair pair_from_single(const T& val) BOOST_MATH_NOEXCEPT(T) { return std::make_pair(val, val); } diff --git a/include/boost/math/policies/policy.hpp b/include/boost/math/policies/policy.hpp index 25a43f41e..5f3dfa7b5 100644 --- a/include/boost/math/policies/policy.hpp +++ b/include/boost/math/policies/policy.hpp @@ -22,9 +22,9 @@ namespace mp = tools::meta_programming; namespace tools{ template -BOOST_MATH_HOST_DEVICE constexpr int digits(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept; +BOOST_MATH_GPU_ENABLED constexpr int digits(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept; template -BOOST_MATH_HOST_DEVICE constexpr T epsilon(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(std::is_floating_point::value); +BOOST_MATH_GPU_ENABLED constexpr T epsilon(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(std::is_floating_point::value); } @@ -640,81 +640,81 @@ struct normalise, using type = policy; }; -BOOST_MATH_HOST_DEVICE constexpr policy<> make_policy() noexcept +BOOST_MATH_GPU_ENABLED constexpr policy<> make_policy() noexcept { return {}; } template -BOOST_MATH_HOST_DEVICE constexpr typename normalise, A1>::type make_policy(const A1&) noexcept +BOOST_MATH_GPU_ENABLED constexpr typename normalise, A1>::type make_policy(const A1&) noexcept { typedef typename normalise, A1>::type result_type; return result_type(); } template -BOOST_MATH_HOST_DEVICE constexpr typename normalise, A1, A2>::type make_policy(const A1&, const A2&) noexcept +BOOST_MATH_GPU_ENABLED constexpr typename normalise, A1, A2>::type make_policy(const A1&, const A2&) noexcept { typedef typename normalise, A1, A2>::type result_type; return result_type(); } template -BOOST_MATH_HOST_DEVICE constexpr typename normalise, A1, A2, A3>::type make_policy(const A1&, const A2&, const A3&) noexcept +BOOST_MATH_GPU_ENABLED constexpr typename normalise, A1, A2, A3>::type make_policy(const A1&, const A2&, const A3&) noexcept { typedef typename normalise, A1, A2, A3>::type result_type; return result_type(); } template -BOOST_MATH_HOST_DEVICE constexpr typename normalise, A1, A2, A3, A4>::type make_policy(const A1&, const A2&, const A3&, const A4&) noexcept +BOOST_MATH_GPU_ENABLED constexpr typename normalise, A1, A2, A3, A4>::type make_policy(const A1&, const A2&, const A3&, const A4&) noexcept { typedef typename normalise, A1, A2, A3, A4>::type result_type; return result_type(); } template -BOOST_MATH_HOST_DEVICE constexpr typename normalise, A1, A2, A3, A4, A5>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&) noexcept +BOOST_MATH_GPU_ENABLED constexpr typename normalise, A1, A2, A3, A4, A5>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&) noexcept { typedef typename normalise, A1, A2, A3, A4, A5>::type result_type; return result_type(); } template -BOOST_MATH_HOST_DEVICE constexpr typename normalise, A1, A2, A3, A4, A5, A6>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&) noexcept +BOOST_MATH_GPU_ENABLED constexpr typename normalise, A1, A2, A3, A4, A5, A6>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&) noexcept { typedef typename normalise, A1, A2, A3, A4, A5, A6>::type result_type; return result_type(); } template -BOOST_MATH_HOST_DEVICE constexpr typename normalise, A1, A2, A3, A4, A5, A6, A7>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&) noexcept +BOOST_MATH_GPU_ENABLED constexpr typename normalise, A1, A2, A3, A4, A5, A6, A7>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&) noexcept { typedef typename normalise, A1, A2, A3, A4, A5, A6, A7>::type result_type; return result_type(); } template -BOOST_MATH_HOST_DEVICE constexpr typename normalise, A1, A2, A3, A4, A5, A6, A7, A8>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&, const A8&) noexcept +BOOST_MATH_GPU_ENABLED constexpr typename normalise, A1, A2, A3, A4, A5, A6, A7, A8>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&, const A8&) noexcept { typedef typename normalise, A1, A2, A3, A4, A5, A6, A7, A8>::type result_type; return result_type(); } template -BOOST_MATH_HOST_DEVICE constexpr typename normalise, A1, A2, A3, A4, A5, A6, A7, A8, A9>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&, const A8&, const A9&) noexcept +BOOST_MATH_GPU_ENABLED constexpr typename normalise, A1, A2, A3, A4, A5, A6, A7, A8, A9>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&, const A8&, const A9&) noexcept { typedef typename normalise, A1, A2, A3, A4, A5, A6, A7, A8, A9>::type result_type; return result_type(); } template -BOOST_MATH_HOST_DEVICE constexpr typename normalise, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&, const A8&, const A9&, const A10&) noexcept +BOOST_MATH_GPU_ENABLED constexpr typename normalise, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&, const A8&, const A9&, const A10&) noexcept { typedef typename normalise, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>::type result_type; return result_type(); } template -BOOST_MATH_HOST_DEVICE constexpr typename normalise, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&, const A8&, const A9&, const A10&, const A11&) noexcept +BOOST_MATH_GPU_ENABLED constexpr typename normalise, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&, const A8&, const A9&, const A10&, const A11&) noexcept { typedef typename normalise, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11>::type result_type; return result_type(); @@ -793,7 +793,7 @@ struct precision namespace detail{ template -BOOST_MATH_HOST_DEVICE constexpr int digits_imp(std::true_type const&) noexcept +BOOST_MATH_GPU_ENABLED constexpr int digits_imp(std::true_type const&) noexcept { static_assert( std::numeric_limits::is_specialized, "std::numeric_limits::is_specialized"); typedef typename boost::math::policies::precision::type p_t; @@ -801,7 +801,7 @@ BOOST_MATH_HOST_DEVICE constexpr int digits_imp(std::true_type const&) noexcept } template -BOOST_MATH_HOST_DEVICE constexpr int digits_imp(std::false_type const&) noexcept +BOOST_MATH_GPU_ENABLED constexpr int digits_imp(std::false_type const&) noexcept { return tools::digits(); } @@ -809,26 +809,26 @@ BOOST_MATH_HOST_DEVICE constexpr int digits_imp(std::false_type const&) noexcept } // namespace detail template -BOOST_MATH_HOST_DEVICE constexpr int digits(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept +BOOST_MATH_GPU_ENABLED constexpr int digits(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept { typedef std::integral_constant::is_specialized > tag_type; return detail::digits_imp(tag_type()); } template -BOOST_MATH_HOST_DEVICE constexpr int digits_base10(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept +BOOST_MATH_GPU_ENABLED constexpr int digits_base10(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept { return boost::math::policies::digits() * 301 / 1000L; } template -BOOST_MATH_HOST_DEVICE constexpr unsigned long get_max_series_iterations() noexcept +BOOST_MATH_GPU_ENABLED constexpr unsigned long get_max_series_iterations() noexcept { typedef typename Policy::max_series_iterations_type iter_type; return iter_type::value; } template -BOOST_MATH_HOST_DEVICE constexpr unsigned long get_max_root_iterations() noexcept +BOOST_MATH_GPU_ENABLED constexpr unsigned long get_max_root_iterations() noexcept { typedef typename Policy::max_root_iterations_type iter_type; return iter_type::value; @@ -839,7 +839,7 @@ namespace detail{ template struct series_factor_calc { - BOOST_MATH_HOST_DEVICE static T get() noexcept(std::is_floating_point::value) + BOOST_MATH_GPU_ENABLED static T get() noexcept(std::is_floating_point::value) { return ldexp(T(1.0), 1 - Digits::value); } @@ -848,7 +848,7 @@ struct series_factor_calc template struct series_factor_calc { - BOOST_MATH_HOST_DEVICE static constexpr T get() noexcept(std::is_floating_point::value) + BOOST_MATH_GPU_ENABLED static constexpr T get() noexcept(std::is_floating_point::value) { return boost::math::tools::epsilon(); } @@ -856,7 +856,7 @@ struct series_factor_calc template struct series_factor_calc { - BOOST_MATH_HOST_DEVICE static constexpr T get() noexcept(std::is_floating_point::value) + BOOST_MATH_GPU_ENABLED static constexpr T get() noexcept(std::is_floating_point::value) { return 1 / static_cast(static_cast(1u) << (Digits::value - 1)); } @@ -864,14 +864,14 @@ struct series_factor_calc template struct series_factor_calc { - BOOST_MATH_HOST_DEVICE static constexpr T get() noexcept(std::is_floating_point::value) + BOOST_MATH_GPU_ENABLED static constexpr T get() noexcept(std::is_floating_point::value) { return boost::math::tools::epsilon(); } }; template -BOOST_MATH_HOST_DEVICE constexpr T get_epsilon_imp(std::true_type const&) noexcept(std::is_floating_point::value) +BOOST_MATH_GPU_ENABLED constexpr T get_epsilon_imp(std::true_type const&) noexcept(std::is_floating_point::value) { static_assert(std::numeric_limits::is_specialized, "std::numeric_limits::is_specialized"); static_assert(std::numeric_limits::radix == 2, "std::numeric_limits::radix == 2"); @@ -883,7 +883,7 @@ BOOST_MATH_HOST_DEVICE constexpr T get_epsilon_imp(std::true_type const&) noexce } template -BOOST_MATH_HOST_DEVICE constexpr T get_epsilon_imp(std::false_type const&) noexcept(std::is_floating_point::value) +BOOST_MATH_GPU_ENABLED constexpr T get_epsilon_imp(std::false_type const&) noexcept(std::is_floating_point::value) { return tools::epsilon(); } @@ -891,7 +891,7 @@ BOOST_MATH_HOST_DEVICE constexpr T get_epsilon_imp(std::false_type const&) noexc } // namespace detail template -BOOST_MATH_HOST_DEVICE constexpr T get_epsilon(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(std::is_floating_point::value) +BOOST_MATH_GPU_ENABLED constexpr T get_epsilon(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(std::is_floating_point::value) { typedef std::integral_constant::is_specialized && (std::numeric_limits::radix == 2)) > tag_type; return detail::get_epsilon_imp(tag_type()); diff --git a/include/boost/math/special_functions/fpclassify.hpp b/include/boost/math/special_functions/fpclassify.hpp index 617d81848..ed75fa35d 100644 --- a/include/boost/math/special_functions/fpclassify.hpp +++ b/include/boost/math/special_functions/fpclassify.hpp @@ -77,31 +77,31 @@ is used. */ -#ifdef BOOST_MATH_ENABLE_CUDA +#ifdef BOOST_MATH_HAS_GPU_SUPPORT namespace boost { namespace math { -template<> inline BOOST_MATH_HOST_DEVICE bool (isnan)(float x) { return x != x; } -template<> inline BOOST_MATH_HOST_DEVICE bool (isnan)(double x) { return x != x; } +template<> inline BOOST_MATH_GPU_ENABLED bool (isnan)(float x) { return x != x; } +template<> inline BOOST_MATH_GPU_ENABLED bool (isnan)(double x) { return x != x; } -template<> inline BOOST_MATH_HOST_DEVICE bool (isinf)(float x) { return x > FLT_MAX || x < -FLT_MAX; } -template<> inline BOOST_MATH_HOST_DEVICE bool (isinf)(double x) { return x > DBL_MAX || x < -DBL_MAX; } +template<> inline BOOST_MATH_GPU_ENABLED bool (isinf)(float x) { return x > FLT_MAX || x < -FLT_MAX; } +template<> inline BOOST_MATH_GPU_ENABLED bool (isinf)(double x) { return x > DBL_MAX || x < -DBL_MAX; } -template<> inline BOOST_MATH_HOST_DEVICE bool (isfinite)(float x) { return !isnan(x) && !isinf(x); } -template<> inline BOOST_MATH_HOST_DEVICE bool (isfinite)(double x) { return !isnan(x) && !isinf(x); } +template<> inline BOOST_MATH_GPU_ENABLED bool (isfinite)(float x) { return !isnan(x) && !isinf(x); } +template<> inline BOOST_MATH_GPU_ENABLED bool (isfinite)(double x) { return !isnan(x) && !isinf(x); } -template<> inline BOOST_MATH_HOST_DEVICE bool (isnormal)(float x) +template<> inline BOOST_MATH_GPU_ENABLED bool (isnormal)(float x) { if(x < 0) x = -x; return (x >= FLT_MIN) && (x <= FLT_MAX); } -template<> inline BOOST_MATH_HOST_DEVICE bool (isnormal)(double x) +template<> inline BOOST_MATH_GPU_ENABLED bool (isnormal)(double x) { if(x < 0) x = -x; return (x >= DBL_MIN) && (x <= DBL_MAX); } -template<> inline BOOST_MATH_HOST_DEVICE int (fpclassify)(float t) +template<> inline BOOST_MATH_GPU_ENABLED int (fpclassify)(float t) { if((boost::math::isnan)(t)) return FP_NAN; @@ -125,7 +125,7 @@ template<> inline BOOST_MATH_HOST_DEVICE int (fpclassify)(float t) return FP_NAN; } -template<> inline BOOST_MATH_HOST_DEVICE int (fpclassify)(double t) +template<> inline BOOST_MATH_GPU_ENABLED int (fpclassify)(double t) { if((boost::math::isnan)(t)) return FP_NAN; diff --git a/include/boost/math/tools/polynomial.hpp b/include/boost/math/tools/polynomial.hpp index 8d87fbf68..5d395cdbe 100644 --- a/include/boost/math/tools/polynomial.hpp +++ b/include/boost/math/tools/polynomial.hpp @@ -32,7 +32,7 @@ namespace boost{ namespace math{ namespace tools{ template -BOOST_MATH_HOST_DEVICE T chebyshev_coefficient(unsigned n, unsigned m) +BOOST_MATH_GPU_ENABLED T chebyshev_coefficient(unsigned n, unsigned m) { BOOST_MATH_STD_USING if(m > n) @@ -56,7 +56,7 @@ BOOST_MATH_HOST_DEVICE T chebyshev_coefficient(unsigned n, unsigned m) } template -BOOST_MATH_HOST_DEVICE Seq polynomial_to_chebyshev(const Seq& s) +BOOST_MATH_GPU_ENABLED Seq polynomial_to_chebyshev(const Seq& s) { // Converts a Polynomial into Chebyshev form: typedef typename Seq::value_type value_type; @@ -92,7 +92,7 @@ BOOST_MATH_HOST_DEVICE Seq polynomial_to_chebyshev(const Seq& s) } template -BOOST_MATH_HOST_DEVICE T evaluate_chebyshev(const Seq& a, const T& x) +BOOST_MATH_GPU_ENABLED T evaluate_chebyshev(const Seq& a, const T& x) { // Clenshaw's formula: typedef typename Seq::difference_type difference_type; @@ -124,7 +124,7 @@ namespace detail { * subtlety of distinction. */ template -BOOST_MATH_HOST_DEVICE typename std::enable_if::is_integer, void >::type +BOOST_MATH_GPU_ENABLED typename std::enable_if::is_integer, void >::type division_impl(polynomial &q, polynomial &u, const polynomial& v, N n, N k) { q[k] = u[n + k] / v[n]; @@ -136,7 +136,7 @@ division_impl(polynomial &q, polynomial &u, const polynomial& v, N n, N } template -BOOST_MATH_HOST_DEVICE T integer_power(T t, N n) +BOOST_MATH_GPU_ENABLED T integer_power(T t, N n) { switch(n) { @@ -167,7 +167,7 @@ BOOST_MATH_HOST_DEVICE T integer_power(T t, N n) * don't currently have that subtlety of distinction. */ template -BOOST_MATH_HOST_DEVICE typename std::enable_if::is_integer, void >::type +BOOST_MATH_GPU_ENABLED typename std::enable_if::is_integer, void >::type division_impl(polynomial &q, polynomial &u, const polynomial& v, N n, N k) { q[k] = u[n + k] * integer_power(v[n], k); @@ -187,7 +187,7 @@ division_impl(polynomial &q, polynomial &u, const polynomial& v, N n, N * @param v Divisor. */ template -BOOST_MATH_HOST_DEVICE std::pair< polynomial, polynomial > +BOOST_MATH_GPU_ENABLED std::pair< polynomial, polynomial > division(polynomial u, const polynomial& v) { BOOST_MATH_ASSERT(v.size() <= u.size()); @@ -218,7 +218,7 @@ division(polynomial u, const polynomial& v) struct negate { template - BOOST_MATH_HOST_DEVICE T operator()(T const &x) const + BOOST_MATH_GPU_ENABLED T operator()(T const &x) const { return -x; } @@ -227,7 +227,7 @@ struct negate struct plus { template - BOOST_MATH_HOST_DEVICE T operator()(T const &x, U const& y) const + BOOST_MATH_GPU_ENABLED T operator()(T const &x, U const& y) const { return x + y; } @@ -236,7 +236,7 @@ struct plus struct minus { template - BOOST_MATH_HOST_DEVICE T operator()(T const &x, U const& y) const + BOOST_MATH_GPU_ENABLED T operator()(T const &x, U const& y) const { return x - y; } @@ -248,13 +248,13 @@ struct minus * Returns the zero element for multiplication of polynomials. */ template -BOOST_MATH_HOST_DEVICE polynomial zero_element(std::multiplies< polynomial >) +BOOST_MATH_GPU_ENABLED polynomial zero_element(std::multiplies< polynomial >) { return polynomial(); } template -BOOST_MATH_HOST_DEVICE polynomial identity_element(std::multiplies< polynomial >) +BOOST_MATH_GPU_ENABLED polynomial identity_element(std::multiplies< polynomial >) { return polynomial(T(1)); } @@ -264,7 +264,7 @@ BOOST_MATH_HOST_DEVICE polynomial identity_element(std::multiplies< polynomia * This function is not defined for division by zero: user beware. */ template -BOOST_MATH_HOST_DEVICE std::pair< polynomial, polynomial > +BOOST_MATH_GPU_ENABLED std::pair< polynomial, polynomial > quotient_remainder(const polynomial& dividend, const polynomial& divisor) { BOOST_MATH_ASSERT(divisor); @@ -283,51 +283,51 @@ class polynomial typedef typename std::vector::size_type size_type; // construct: - BOOST_MATH_HOST_DEVICE polynomial()= default; + BOOST_MATH_GPU_ENABLED polynomial()= default; template - BOOST_MATH_HOST_DEVICE polynomial(const U* data, unsigned order) + BOOST_MATH_GPU_ENABLED polynomial(const U* data, unsigned order) : m_data(data, data + order + 1) { normalize(); } template - BOOST_MATH_HOST_DEVICE polynomial(Iterator first, Iterator last) + BOOST_MATH_GPU_ENABLED polynomial(Iterator first, Iterator last) : m_data(first, last) { normalize(); } template - BOOST_MATH_HOST_DEVICE polynomial(Iterator first, unsigned length) + BOOST_MATH_GPU_ENABLED polynomial(Iterator first, unsigned length) : m_data(first, std::next(first, length + 1)) { normalize(); } - BOOST_MATH_HOST_DEVICE polynomial(std::vector&& p) : m_data(std::move(p)) + BOOST_MATH_GPU_ENABLED polynomial(std::vector&& p) : m_data(std::move(p)) { normalize(); } template ::value, bool>::type = true> - BOOST_MATH_HOST_DEVICE explicit polynomial(const U& point) + BOOST_MATH_GPU_ENABLED explicit polynomial(const U& point) { if (point != U(0)) m_data.push_back(point); } // move: - BOOST_MATH_HOST_DEVICE polynomial(polynomial&& p) noexcept + BOOST_MATH_GPU_ENABLED polynomial(polynomial&& p) noexcept : m_data(std::move(p.m_data)) { } // copy: - BOOST_MATH_HOST_DEVICE polynomial(const polynomial& p) + BOOST_MATH_GPU_ENABLED polynomial(const polynomial& p) : m_data(p.m_data) { } template - BOOST_MATH_HOST_DEVICE polynomial(const polynomial& p) + BOOST_MATH_GPU_ENABLED polynomial(const polynomial& p) { m_data.resize(p.size()); for(unsigned i = 0; i < p.size(); ++i) @@ -337,17 +337,17 @@ class polynomial } #ifdef BOOST_MATH_HAS_IS_CONST_ITERABLE template ::value, bool>::type = true> - BOOST_MATH_HOST_DEVICE explicit polynomial(const Range& r) + BOOST_MATH_GPU_ENABLED explicit polynomial(const Range& r) : polynomial(r.begin(), r.end()) { } #endif - BOOST_MATH_HOST_DEVICE polynomial(std::initializer_list l) : polynomial(std::begin(l), std::end(l)) + BOOST_MATH_GPU_ENABLED polynomial(std::initializer_list l) : polynomial(std::begin(l), std::end(l)) { } polynomial& - BOOST_MATH_HOST_DEVICE operator=(std::initializer_list l) + BOOST_MATH_GPU_ENABLED operator=(std::initializer_list l) { m_data.assign(std::begin(l), std::end(l)); normalize(); @@ -356,47 +356,47 @@ class polynomial // access: - BOOST_MATH_HOST_DEVICE size_type size() const { return m_data.size(); } - BOOST_MATH_HOST_DEVICE size_type degree() const + BOOST_MATH_GPU_ENABLED size_type size() const { return m_data.size(); } + BOOST_MATH_GPU_ENABLED size_type degree() const { if (size() == 0) BOOST_MATH_THROW_EXCEPTION(std::logic_error("degree() is undefined for the zero polynomial.")); return m_data.size() - 1; } - BOOST_MATH_HOST_DEVICE value_type& operator[](size_type i) + BOOST_MATH_GPU_ENABLED value_type& operator[](size_type i) { return m_data[i]; } - BOOST_MATH_HOST_DEVICE const value_type& operator[](size_type i) const + BOOST_MATH_GPU_ENABLED const value_type& operator[](size_type i) const { return m_data[i]; } - BOOST_MATH_HOST_DEVICE T evaluate(T z) const + BOOST_MATH_GPU_ENABLED T evaluate(T z) const { return this->operator()(z); } - BOOST_MATH_HOST_DEVICE T operator()(T z) const + BOOST_MATH_GPU_ENABLED T operator()(T z) const { return m_data.size() > 0 ? boost::math::tools::evaluate_polynomial((m_data).data(), z, m_data.size()) : T(0); } - BOOST_MATH_HOST_DEVICE std::vector chebyshev() const + BOOST_MATH_GPU_ENABLED std::vector chebyshev() const { return polynomial_to_chebyshev(m_data); } - BOOST_MATH_HOST_DEVICE std::vector const& data() const + BOOST_MATH_GPU_ENABLED std::vector const& data() const { return m_data; } - BOOST_MATH_HOST_DEVICE std::vector & data() + BOOST_MATH_GPU_ENABLED std::vector & data() { return m_data; } - BOOST_MATH_HOST_DEVICE polynomial prime() const + BOOST_MATH_GPU_ENABLED polynomial prime() const { #ifdef _MSC_VER // Disable int->float conversion warning: @@ -418,7 +418,7 @@ class polynomial #endif } - BOOST_MATH_HOST_DEVICE polynomial integrate() const + BOOST_MATH_GPU_ENABLED polynomial integrate() const { std::vector i_data(m_data.size() + 1); // Choose integration constant such that P(0) = 0. @@ -431,20 +431,20 @@ class polynomial } // operators: - BOOST_MATH_HOST_DEVICE polynomial& operator =(polynomial&& p) noexcept + BOOST_MATH_GPU_ENABLED polynomial& operator =(polynomial&& p) noexcept { m_data = std::move(p.m_data); return *this; } - BOOST_MATH_HOST_DEVICE polynomial& operator =(const polynomial& p) + BOOST_MATH_GPU_ENABLED polynomial& operator =(const polynomial& p) { m_data = p.m_data; return *this; } template - BOOST_MATH_HOST_DEVICE typename std::enable_if::value, polynomial&>::type operator +=(const U& value) + BOOST_MATH_GPU_ENABLED typename std::enable_if::value, polynomial&>::type operator +=(const U& value) { addition(value); normalize(); @@ -452,7 +452,7 @@ class polynomial } template - BOOST_MATH_HOST_DEVICE typename std::enable_if::value, polynomial&>::type operator -=(const U& value) + BOOST_MATH_GPU_ENABLED typename std::enable_if::value, polynomial&>::type operator -=(const U& value) { subtraction(value); normalize(); @@ -460,7 +460,7 @@ class polynomial } template - BOOST_MATH_HOST_DEVICE typename std::enable_if::value, polynomial&>::type operator *=(const U& value) + BOOST_MATH_GPU_ENABLED typename std::enable_if::value, polynomial&>::type operator *=(const U& value) { multiplication(value); normalize(); @@ -468,7 +468,7 @@ class polynomial } template - BOOST_MATH_HOST_DEVICE typename std::enable_if::value, polynomial&>::type operator /=(const U& value) + BOOST_MATH_GPU_ENABLED typename std::enable_if::value, polynomial&>::type operator /=(const U& value) { division(value); normalize(); @@ -476,7 +476,7 @@ class polynomial } template - BOOST_MATH_HOST_DEVICE typename std::enable_if::value, polynomial&>::type operator %=(const U& /*value*/) + BOOST_MATH_GPU_ENABLED typename std::enable_if::value, polynomial&>::type operator %=(const U& /*value*/) { // We can always divide by a scalar, so there is no remainder: this->set_zero(); @@ -484,7 +484,7 @@ class polynomial } template - BOOST_MATH_HOST_DEVICE polynomial& operator +=(const polynomial& value) + BOOST_MATH_GPU_ENABLED polynomial& operator +=(const polynomial& value) { addition(value); normalize(); @@ -492,7 +492,7 @@ class polynomial } template - BOOST_MATH_HOST_DEVICE polynomial& operator -=(const polynomial& value) + BOOST_MATH_GPU_ENABLED polynomial& operator -=(const polynomial& value) { subtraction(value); normalize(); @@ -500,7 +500,7 @@ class polynomial } template - BOOST_MATH_HOST_DEVICE void multiply(const polynomial& a, const polynomial& b) { + BOOST_MATH_GPU_ENABLED void multiply(const polynomial& a, const polynomial& b) { if (!a || !b) { this->set_zero(); @@ -514,28 +514,28 @@ class polynomial } template - BOOST_MATH_HOST_DEVICE polynomial& operator *=(const polynomial& value) + BOOST_MATH_GPU_ENABLED polynomial& operator *=(const polynomial& value) { this->multiply(*this, value); return *this; } template - BOOST_MATH_HOST_DEVICE polynomial& operator /=(const polynomial& value) + BOOST_MATH_GPU_ENABLED polynomial& operator /=(const polynomial& value) { *this = quotient_remainder(*this, value).first; return *this; } template - BOOST_MATH_HOST_DEVICE polynomial& operator %=(const polynomial& value) + BOOST_MATH_GPU_ENABLED polynomial& operator %=(const polynomial& value) { *this = quotient_remainder(*this, value).second; return *this; } template - BOOST_MATH_HOST_DEVICE polynomial& operator >>=(U const &n) + BOOST_MATH_GPU_ENABLED polynomial& operator >>=(U const &n) { BOOST_MATH_ASSERT(n <= m_data.size()); m_data.erase(m_data.begin(), m_data.begin() + n); @@ -543,7 +543,7 @@ class polynomial } template - BOOST_MATH_HOST_DEVICE polynomial& operator <<=(U const &n) + BOOST_MATH_GPU_ENABLED polynomial& operator <<=(U const &n) { m_data.insert(m_data.begin(), n, static_cast(0)); normalize(); @@ -551,33 +551,33 @@ class polynomial } // Convenient and efficient query for zero. - BOOST_MATH_HOST_DEVICE bool is_zero() const + BOOST_MATH_GPU_ENABLED bool is_zero() const { return m_data.empty(); } // Conversion to bool. - BOOST_MATH_HOST_DEVICE inline explicit operator bool() const + BOOST_MATH_GPU_ENABLED inline explicit operator bool() const { return !m_data.empty(); } // Fast way to set a polynomial to zero. - BOOST_MATH_HOST_DEVICE void set_zero() + BOOST_MATH_GPU_ENABLED void set_zero() { m_data.clear(); } /** Remove zero coefficients 'from the top', that is for which there are no * non-zero coefficients of higher degree. */ - BOOST_MATH_HOST_DEVICE void normalize() + BOOST_MATH_GPU_ENABLED void normalize() { m_data.erase(std::find_if(m_data.rbegin(), m_data.rend(), [](const T& x)->bool { return x != T(0); }).base(), m_data.end()); } private: template - BOOST_MATH_HOST_DEVICE polynomial& addition(const U& value, R op) + BOOST_MATH_GPU_ENABLED polynomial& addition(const U& value, R op) { if(m_data.size() == 0) m_data.resize(1, 0); @@ -586,19 +586,19 @@ class polynomial } template - BOOST_MATH_HOST_DEVICE polynomial& addition(const U& value) + BOOST_MATH_GPU_ENABLED polynomial& addition(const U& value) { return addition(value, detail::plus()); } template - BOOST_MATH_HOST_DEVICE polynomial& subtraction(const U& value) + BOOST_MATH_GPU_ENABLED polynomial& subtraction(const U& value) { return addition(value, detail::minus()); } template - BOOST_MATH_HOST_DEVICE polynomial& addition(const polynomial& value, R op) + BOOST_MATH_GPU_ENABLED polynomial& addition(const polynomial& value, R op) { if (m_data.size() < value.size()) m_data.resize(value.size(), 0); @@ -608,26 +608,26 @@ class polynomial } template - BOOST_MATH_HOST_DEVICE polynomial& addition(const polynomial& value) + BOOST_MATH_GPU_ENABLED polynomial& addition(const polynomial& value) { return addition(value, detail::plus()); } template - BOOST_MATH_HOST_DEVICE polynomial& subtraction(const polynomial& value) + BOOST_MATH_GPU_ENABLED polynomial& subtraction(const polynomial& value) { return addition(value, detail::minus()); } template - BOOST_MATH_HOST_DEVICE polynomial& multiplication(const U& value) + BOOST_MATH_GPU_ENABLED polynomial& multiplication(const U& value) { std::transform(m_data.begin(), m_data.end(), m_data.begin(), [&](const T& x)->T { return x * value; }); return *this; } template - BOOST_MATH_HOST_DEVICE polynomial& division(const U& value) + BOOST_MATH_GPU_ENABLED polynomial& division(const U& value) { std::transform(m_data.begin(), m_data.end(), m_data.begin(), [&](const T& x)->T { return x / value; }); return *this; @@ -638,7 +638,7 @@ class polynomial template -BOOST_MATH_HOST_DEVICE inline polynomial operator + (const polynomial& a, const polynomial& b) +BOOST_MATH_GPU_ENABLED inline polynomial operator + (const polynomial& a, const polynomial& b) { polynomial result(a); result += b; @@ -646,26 +646,26 @@ BOOST_MATH_HOST_DEVICE inline polynomial operator + (const polynomial& a, } template -BOOST_MATH_HOST_DEVICE inline polynomial operator + (polynomial&& a, const polynomial& b) +BOOST_MATH_GPU_ENABLED inline polynomial operator + (polynomial&& a, const polynomial& b) { a += b; return std::move(a); } template -BOOST_MATH_HOST_DEVICE inline polynomial operator + (const polynomial& a, polynomial&& b) +BOOST_MATH_GPU_ENABLED inline polynomial operator + (const polynomial& a, polynomial&& b) { b += a; return b; } template -BOOST_MATH_HOST_DEVICE inline polynomial operator + (polynomial&& a, polynomial&& b) +BOOST_MATH_GPU_ENABLED inline polynomial operator + (polynomial&& a, polynomial&& b) { a += b; return a; } template -BOOST_MATH_HOST_DEVICE inline polynomial operator - (const polynomial& a, const polynomial& b) +BOOST_MATH_GPU_ENABLED inline polynomial operator - (const polynomial& a, const polynomial& b) { polynomial result(a); result -= b; @@ -673,26 +673,26 @@ BOOST_MATH_HOST_DEVICE inline polynomial operator - (const polynomial& a, } template -BOOST_MATH_HOST_DEVICE inline polynomial operator - (polynomial&& a, const polynomial& b) +BOOST_MATH_GPU_ENABLED inline polynomial operator - (polynomial&& a, const polynomial& b) { a -= b; return a; } template -BOOST_MATH_HOST_DEVICE inline polynomial operator - (const polynomial& a, polynomial&& b) +BOOST_MATH_GPU_ENABLED inline polynomial operator - (const polynomial& a, polynomial&& b) { b -= a; return -b; } template -BOOST_MATH_HOST_DEVICE inline polynomial operator - (polynomial&& a, polynomial&& b) +BOOST_MATH_GPU_ENABLED inline polynomial operator - (polynomial&& a, polynomial&& b) { a -= b; return a; } template -BOOST_MATH_HOST_DEVICE inline polynomial operator * (const polynomial& a, const polynomial& b) +BOOST_MATH_GPU_ENABLED inline polynomial operator * (const polynomial& a, const polynomial& b) { polynomial result; result.multiply(a, b); @@ -700,94 +700,94 @@ BOOST_MATH_HOST_DEVICE inline polynomial operator * (const polynomial& a, } template -BOOST_MATH_HOST_DEVICE inline polynomial operator / (const polynomial& a, const polynomial& b) +BOOST_MATH_GPU_ENABLED inline polynomial operator / (const polynomial& a, const polynomial& b) { return quotient_remainder(a, b).first; } template -BOOST_MATH_HOST_DEVICE inline polynomial operator % (const polynomial& a, const polynomial& b) +BOOST_MATH_GPU_ENABLED inline polynomial operator % (const polynomial& a, const polynomial& b) { return quotient_remainder(a, b).second; } template -BOOST_MATH_HOST_DEVICE inline typename std::enable_if::value, polynomial >::type operator + (polynomial a, const U& b) +BOOST_MATH_GPU_ENABLED inline typename std::enable_if::value, polynomial >::type operator + (polynomial a, const U& b) { a += b; return a; } template -BOOST_MATH_HOST_DEVICE inline typename std::enable_if::value, polynomial >::type operator - (polynomial a, const U& b) +BOOST_MATH_GPU_ENABLED inline typename std::enable_if::value, polynomial >::type operator - (polynomial a, const U& b) { a -= b; return a; } template -BOOST_MATH_HOST_DEVICE inline typename std::enable_if::value, polynomial >::type operator * (polynomial a, const U& b) +BOOST_MATH_GPU_ENABLED inline typename std::enable_if::value, polynomial >::type operator * (polynomial a, const U& b) { a *= b; return a; } template -BOOST_MATH_HOST_DEVICE inline typename std::enable_if::value, polynomial >::type operator / (polynomial a, const U& b) +BOOST_MATH_GPU_ENABLED inline typename std::enable_if::value, polynomial >::type operator / (polynomial a, const U& b) { a /= b; return a; } template -BOOST_MATH_HOST_DEVICE inline typename std::enable_if::value, polynomial >::type operator % (const polynomial&, const U&) +BOOST_MATH_GPU_ENABLED inline typename std::enable_if::value, polynomial >::type operator % (const polynomial&, const U&) { // Since we can always divide by a scalar, result is always an empty polynomial: return polynomial(); } template -BOOST_MATH_HOST_DEVICE inline typename std::enable_if::value, polynomial >::type operator + (const U& a, polynomial b) +BOOST_MATH_GPU_ENABLED inline typename std::enable_if::value, polynomial >::type operator + (const U& a, polynomial b) { b += a; return b; } template -BOOST_MATH_HOST_DEVICE inline typename std::enable_if::value, polynomial >::type operator - (const U& a, polynomial b) +BOOST_MATH_GPU_ENABLED inline typename std::enable_if::value, polynomial >::type operator - (const U& a, polynomial b) { b -= a; return -b; } template -BOOST_MATH_HOST_DEVICE inline typename std::enable_if::value, polynomial >::type operator * (const U& a, polynomial b) +BOOST_MATH_GPU_ENABLED inline typename std::enable_if::value, polynomial >::type operator * (const U& a, polynomial b) { b *= a; return b; } template -BOOST_MATH_HOST_DEVICE bool operator == (const polynomial &a, const polynomial &b) +BOOST_MATH_GPU_ENABLED bool operator == (const polynomial &a, const polynomial &b) { return a.data() == b.data(); } template -BOOST_MATH_HOST_DEVICE bool operator != (const polynomial &a, const polynomial &b) +BOOST_MATH_GPU_ENABLED bool operator != (const polynomial &a, const polynomial &b) { return a.data() != b.data(); } template -BOOST_MATH_HOST_DEVICE polynomial operator >> (polynomial a, const U& b) +BOOST_MATH_GPU_ENABLED polynomial operator >> (polynomial a, const U& b) { a >>= b; return a; } template -BOOST_MATH_HOST_DEVICE polynomial operator << (polynomial a, const U& b) +BOOST_MATH_GPU_ENABLED polynomial operator << (polynomial a, const U& b) { a <<= b; return a; @@ -795,26 +795,26 @@ BOOST_MATH_HOST_DEVICE polynomial operator << (polynomial a, const U& b) // Unary minus (negate). template -BOOST_MATH_HOST_DEVICE polynomial operator - (polynomial a) +BOOST_MATH_GPU_ENABLED polynomial operator - (polynomial a) { std::transform(a.data().begin(), a.data().end(), a.data().begin(), detail::negate()); return a; } template -BOOST_MATH_HOST_DEVICE bool odd(polynomial const &a) +BOOST_MATH_GPU_ENABLED bool odd(polynomial const &a) { return a.size() > 0 && a[0] != static_cast(0); } template -BOOST_MATH_HOST_DEVICE bool even(polynomial const &a) +BOOST_MATH_GPU_ENABLED bool even(polynomial const &a) { return !odd(a); } template -BOOST_MATH_HOST_DEVICE polynomial pow(polynomial base, int exp) +BOOST_MATH_GPU_ENABLED polynomial pow(polynomial base, int exp) { if (exp < 0) return policies::raise_domain_error( @@ -838,7 +838,7 @@ BOOST_MATH_HOST_DEVICE polynomial pow(polynomial base, int exp) } template -BOOST_MATH_HOST_DEVICE inline std::basic_ostream& operator << (std::basic_ostream& os, const polynomial& poly) +BOOST_MATH_GPU_ENABLED inline std::basic_ostream& operator << (std::basic_ostream& os, const polynomial& poly) { os << "{ "; for(unsigned i = 0; i < poly.size(); ++i) diff --git a/include/boost/math/tools/precision.hpp b/include/boost/math/tools/precision.hpp index 8a2c2367a..86b8e9982 100644 --- a/include/boost/math/tools/precision.hpp +++ b/include/boost/math/tools/precision.hpp @@ -143,16 +143,16 @@ constexpr T epsilon(const std::true_type& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TY return std::numeric_limits::epsilon(); } -#ifdef BOOST_MATH_ENABLE_CUDA +#ifdef BOOST_MATH_HAS_GPU_SUPPORT template <> -BOOST_MATH_HOST_DEVICE constexpr float epsilon(const std::true_type& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(float)) noexcept(true) +BOOST_MATH_GPU_ENABLED constexpr float epsilon(const std::true_type& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(float)) noexcept(true) { return FLT_EPSILON; } template <> -BOOST_MATH_HOST_DEVICE constexpr double epsilon(const std::true_type& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(double)) noexcept(true) +BOOST_MATH_GPU_ENABLED constexpr double epsilon(const std::true_type& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(double)) noexcept(true) { return DBL_EPSILON; } @@ -246,7 +246,7 @@ inline constexpr T log_min_value(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept( #endif template -BOOST_MATH_HOST_DEVICE constexpr T epsilon(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T)) noexcept(std::is_floating_point::value) +BOOST_MATH_GPU_ENABLED constexpr T epsilon(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T)) noexcept(std::is_floating_point::value) { #ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS return detail::epsilon(std::integral_constant::is_specialized>()); From 71f604eb4dc60fb020307b6e9eb38a7c9fb37168 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Fri, 19 Jul 2024 16:32:57 -0400 Subject: [PATCH 31/64] Refactor macros for SYCL limited support --- include/boost/math/tools/config.hpp | 30 +++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/include/boost/math/tools/config.hpp b/include/boost/math/tools/config.hpp index 3e5ab3098..f63ad665b 100644 --- a/include/boost/math/tools/config.hpp +++ b/include/boost/math/tools/config.hpp @@ -665,8 +665,9 @@ namespace boost{ namespace math{ // #ifdef __CUDACC__ -# define BOOST_MATH_GPU_ENABLED __host__ __device__ +# define BOOST_MATH_CUDA_ENABLED __host__ __device__ # define BOOST_MATH_HAS_GPU_SUPPORT + # ifndef BOOST_MATH_ENABLE_CUDA # define BOOST_MATH_ENABLE_CUDA # endif @@ -685,25 +686,42 @@ namespace boost{ namespace math{ #elif defined(SYCL_LANGUAGE_VERSION) -# define BOOST_MATH_GPU_ENABLED SYCL_EXTERNAL +# define BOOST_MATH_SYCL_ENABLED SYCL_EXTERNAL # define BOOST_MATH_HAS_GPU_SUPPORT +# ifndef BOOST_MATH_ENABLE_SYCL +# define BOOST_MATH_ENABLE_SYCL +# endif + # ifndef BOOST_MATH_NO_EXCEPTIONS # define BOOST_MATH_NO_EXCEPTIONS # endif +// spir64 does not support long double +# define BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS + # undef BOOST_MATH_FORCEINLINE -# define BOOST_MATH_FORCEINLINE inline +# define BOOST_MATH_FORCEINLINE inline # define BOOST_MATH_QUIET_NAN(T) static_cast(NAN); -#else +#endif -# define BOOST_MATH_GPU_ENABLED -# define BOOST_MATH_QUIET_NAN(T) std::numeric_limits::quiet_NaN(); +#ifndef BOOST_MATH_CUDA_ENABLED +# define BOOST_MATH_CUDA_ENABLED +#endif + +#ifndef BOOST_MATH_SYCL_ENABLED +# define BOOST_MATH_SYCL_ENABLED +#endif +#ifndef BOOST_MATH_QUIET_NAN +# define BOOST_MATH_QUIET_NAN(T) std::numeric_limits::quiet_NaN(); #endif +// Not all functions that allow CUDA allow SYCL (e.g. Recursion is disallowed by SYCL) +# define BOOST_MATH_GPU_ENABLED BOOST_MATH_CUDA_ENABLED BOOST_MATH_SYCL_ENABLED + // Static variables are not allowed with CUDA or C++20 modules // See if we can inline them instead From ef541f2dd0a2ceb496c8dec226bc14d6ea132276 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Fri, 19 Jul 2024 16:38:51 -0400 Subject: [PATCH 32/64] Limit binomial distribution to CUDA --- include/boost/math/distributions/binomial.hpp | 54 +++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/include/boost/math/distributions/binomial.hpp b/include/boost/math/distributions/binomial.hpp index d17f8636b..4c1f8bfa0 100644 --- a/include/boost/math/distributions/binomial.hpp +++ b/include/boost/math/distributions/binomial.hpp @@ -101,7 +101,7 @@ namespace boost namespace binomial_detail{ // common error checking routines for binomial distribution functions: template - BOOST_MATH_GPU_ENABLED inline bool check_N(const char* function, const RealType& N, RealType* result, const Policy& pol) + BOOST_MATH_CUDA_ENABLED inline bool check_N(const char* function, const RealType& N, RealType* result, const Policy& pol) { if((N < 0) || !(boost::math::isfinite)(N)) { @@ -113,7 +113,7 @@ namespace boost return true; } template - BOOST_MATH_GPU_ENABLED inline bool check_success_fraction(const char* function, const RealType& p, RealType* result, const Policy& pol) + BOOST_MATH_CUDA_ENABLED inline bool check_success_fraction(const char* function, const RealType& p, RealType* result, const Policy& pol) { if((p < 0) || (p > 1) || !(boost::math::isfinite)(p)) { @@ -125,7 +125,7 @@ namespace boost return true; } template - BOOST_MATH_GPU_ENABLED inline bool check_dist(const char* function, const RealType& N, const RealType& p, RealType* result, const Policy& pol) + BOOST_MATH_CUDA_ENABLED inline bool check_dist(const char* function, const RealType& N, const RealType& p, RealType* result, const Policy& pol) { return check_success_fraction( function, p, result, pol) @@ -133,7 +133,7 @@ namespace boost function, N, result, pol); } template - BOOST_MATH_GPU_ENABLED inline bool check_dist_and_k(const char* function, const RealType& N, const RealType& p, RealType k, RealType* result, const Policy& pol) + BOOST_MATH_CUDA_ENABLED inline bool check_dist_and_k(const char* function, const RealType& N, const RealType& p, RealType k, RealType* result, const Policy& pol) { if(check_dist(function, N, p, result, pol) == false) return false; @@ -154,7 +154,7 @@ namespace boost return true; } template - BOOST_MATH_GPU_ENABLED inline bool check_dist_and_prob(const char* function, const RealType& N, RealType p, RealType prob, RealType* result, const Policy& pol) + BOOST_MATH_CUDA_ENABLED inline bool check_dist_and_prob(const char* function, const RealType& N, RealType p, RealType prob, RealType* result, const Policy& pol) { if((check_dist(function, N, p, result, pol) && detail::check_probability(function, prob, result, pol)) == false) return false; @@ -162,7 +162,7 @@ namespace boost } template - BOOST_MATH_GPU_ENABLED T inverse_binomial_cornish_fisher(T n, T sf, T p, T q, const Policy& pol) + BOOST_MATH_CUDA_ENABLED T inverse_binomial_cornish_fisher(T n, T sf, T p, T q, const Policy& pol) { BOOST_MATH_STD_USING // mean: @@ -197,7 +197,7 @@ namespace boost } template - BOOST_MATH_GPU_ENABLED RealType quantile_imp(const binomial_distribution& dist, const RealType& p, const RealType& q, bool comp) + BOOST_MATH_CUDA_ENABLED RealType quantile_imp(const binomial_distribution& dist, const RealType& p, const RealType& q, bool comp) { // Quantile or Percent Point Binomial function. // Return the number of expected successes k, // for a given probability p. @@ -291,11 +291,11 @@ namespace boost &r, Policy()); } // binomial_distribution constructor. - BOOST_MATH_GPU_ENABLED RealType success_fraction() const + BOOST_MATH_CUDA_ENABLED RealType success_fraction() const { // Probability. return m_p; } - BOOST_MATH_GPU_ENABLED RealType trials() const + BOOST_MATH_CUDA_ENABLED RealType trials() const { // Total number of trials. return m_n; } @@ -311,7 +311,7 @@ namespace boost // these functions are used // to obtain confidence intervals for the success fraction. // - BOOST_MATH_GPU_ENABLED static RealType find_lower_bound_on_p( + BOOST_MATH_CUDA_ENABLED static RealType find_lower_bound_on_p( RealType trials, RealType successes, RealType probability, @@ -336,7 +336,7 @@ namespace boost return (t == clopper_pearson_exact_interval) ? ibeta_inv(successes, trials - successes + 1, probability, static_cast(nullptr), Policy()) : ibeta_inv(successes + 0.5f, trials - successes + 0.5f, probability, static_cast(nullptr), Policy()); } - BOOST_MATH_GPU_ENABLED static RealType find_upper_bound_on_p( + BOOST_MATH_CUDA_ENABLED static RealType find_upper_bound_on_p( RealType trials, RealType successes, RealType probability, @@ -364,7 +364,7 @@ namespace boost // or // "How many trials can I have to be P% sure of seeing fewer than k events?" // - BOOST_MATH_GPU_ENABLED static RealType find_minimum_number_of_trials( + BOOST_MATH_CUDA_ENABLED static RealType find_minimum_number_of_trials( RealType k, // number of events RealType p, // success fraction RealType alpha) // risk level @@ -383,7 +383,7 @@ namespace boost return result + k; } - BOOST_MATH_GPU_ENABLED static RealType find_maximum_number_of_trials( + BOOST_MATH_CUDA_ENABLED static RealType find_maximum_number_of_trials( RealType k, // number of events RealType p, // success fraction RealType alpha) // risk level @@ -420,33 +420,33 @@ namespace boost #endif template - BOOST_MATH_GPU_ENABLED const std::pair range(const binomial_distribution& dist) + BOOST_MATH_CUDA_ENABLED const std::pair range(const binomial_distribution& dist) { // Range of permissible values for random variable k. using boost::math::tools::max_value; return std::pair(static_cast(0), dist.trials()); } template - BOOST_MATH_GPU_ENABLED const std::pair support(const binomial_distribution& dist) + BOOST_MATH_CUDA_ENABLED const std::pair support(const binomial_distribution& dist) { // Range of supported values for random variable k. // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero. return std::pair(static_cast(0), dist.trials()); } template - BOOST_MATH_GPU_ENABLED inline RealType mean(const binomial_distribution& dist) + BOOST_MATH_CUDA_ENABLED inline RealType mean(const binomial_distribution& dist) { // Mean of Binomial distribution = np. return dist.trials() * dist.success_fraction(); } // mean template - BOOST_MATH_GPU_ENABLED inline RealType variance(const binomial_distribution& dist) + BOOST_MATH_CUDA_ENABLED inline RealType variance(const binomial_distribution& dist) { // Variance of Binomial distribution = np(1-p). return dist.trials() * dist.success_fraction() * (1 - dist.success_fraction()); } // variance template - BOOST_MATH_GPU_ENABLED RealType pdf(const binomial_distribution& dist, const RealType& k) + BOOST_MATH_CUDA_ENABLED RealType pdf(const binomial_distribution& dist, const RealType& k) { // Probability Density/Mass Function. BOOST_FPU_EXCEPTION_GUARD @@ -502,7 +502,7 @@ namespace boost } // pdf template - BOOST_MATH_GPU_ENABLED inline RealType cdf(const binomial_distribution& dist, const RealType& k) + BOOST_MATH_CUDA_ENABLED inline RealType cdf(const binomial_distribution& dist, const RealType& k) { // Cumulative Distribution Function Binomial. // The random variate k is the number of successes in n trials. // k argument may be integral, signed, or unsigned, or floating point. @@ -574,7 +574,7 @@ namespace boost } // binomial cdf template - BOOST_MATH_GPU_ENABLED inline RealType cdf(const complemented2_type, RealType>& c) + BOOST_MATH_CUDA_ENABLED inline RealType cdf(const complemented2_type, RealType>& c) { // Complemented Cumulative Distribution Function Binomial. // The random variate k is the number of successes in n trials. // k argument may be integral, signed, or unsigned, or floating point. @@ -651,19 +651,19 @@ namespace boost } // binomial cdf template - BOOST_MATH_GPU_ENABLED inline RealType quantile(const binomial_distribution& dist, const RealType& p) + BOOST_MATH_CUDA_ENABLED inline RealType quantile(const binomial_distribution& dist, const RealType& p) { return binomial_detail::quantile_imp(dist, p, RealType(1-p), false); } // quantile template - BOOST_MATH_GPU_ENABLED RealType quantile(const complemented2_type, RealType>& c) + BOOST_MATH_CUDA_ENABLED RealType quantile(const complemented2_type, RealType>& c) { return binomial_detail::quantile_imp(c.dist, RealType(1-c.param), c.param, true); } // quantile template - BOOST_MATH_GPU_ENABLED inline RealType mode(const binomial_distribution& dist) + BOOST_MATH_CUDA_ENABLED inline RealType mode(const binomial_distribution& dist) { BOOST_MATH_STD_USING // ADL of std functions. RealType p = dist.success_fraction(); @@ -672,7 +672,7 @@ namespace boost } template - BOOST_MATH_GPU_ENABLED inline RealType median(const binomial_distribution& dist) + BOOST_MATH_CUDA_ENABLED inline RealType median(const binomial_distribution& dist) { // Bounds for the median of the negative binomial distribution // VAN DE VEN R. ; WEBER N. C. ; // Univ. Sydney, school mathematics statistics, Sydney N.S.W. 2006, AUSTRALIE @@ -690,7 +690,7 @@ namespace boost } template - BOOST_MATH_GPU_ENABLED inline RealType skewness(const binomial_distribution& dist) + BOOST_MATH_CUDA_ENABLED inline RealType skewness(const binomial_distribution& dist) { BOOST_MATH_STD_USING // ADL of std functions. RealType p = dist.success_fraction(); @@ -699,7 +699,7 @@ namespace boost } template - BOOST_MATH_GPU_ENABLED inline RealType kurtosis(const binomial_distribution& dist) + BOOST_MATH_CUDA_ENABLED inline RealType kurtosis(const binomial_distribution& dist) { RealType p = dist.success_fraction(); RealType n = dist.trials(); @@ -707,7 +707,7 @@ namespace boost } template - BOOST_MATH_GPU_ENABLED inline RealType kurtosis_excess(const binomial_distribution& dist) + BOOST_MATH_CUDA_ENABLED inline RealType kurtosis_excess(const binomial_distribution& dist) { RealType p = dist.success_fraction(); RealType q = 1 - p; From 0a7694fc649c9d6bb73dd95e01ca425ddc7fa106 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Fri, 19 Jul 2024 16:39:04 -0400 Subject: [PATCH 33/64] Disable calls to errno with SYCL --- include/boost/math/policies/error_handling.hpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/boost/math/policies/error_handling.hpp b/include/boost/math/policies/error_handling.hpp index e742eaf3d..2c67f251c 100644 --- a/include/boost/math/policies/error_handling.hpp +++ b/include/boost/math/policies/error_handling.hpp @@ -233,7 +233,9 @@ BOOST_MATH_GPU_ENABLED inline T raise_domain_error( const T& , const ::boost::math::policies::domain_error< ::boost::math::policies::errno_on_error>&) BOOST_MATH_NOEXCEPT(T) { + #ifndef BOOST_MATH_SYCL_ENABLED errno = EDOM; + #endif // This may or may not do the right thing, but the user asked for the error // to be silent so here we go anyway: return BOOST_MATH_QUIET_NAN(T); @@ -353,7 +355,9 @@ BOOST_MATH_GPU_ENABLED inline T raise_overflow_error( const char* , const ::boost::math::policies::overflow_error< ::boost::math::policies::errno_on_error>&) BOOST_MATH_NOEXCEPT(T) { + #ifndef BOOST_MATH_SYCL_ENABLED errno = ERANGE; + #endif // This may or may not do the right thing, but the user asked for the error // to be silent so here we go anyway: return std::numeric_limits::has_infinity ? std::numeric_limits::infinity() : boost::math::tools::max_value(); @@ -366,7 +370,9 @@ BOOST_MATH_GPU_ENABLED inline T raise_overflow_error( const T&, const ::boost::math::policies::overflow_error< ::boost::math::policies::errno_on_error>&) BOOST_MATH_NOEXCEPT(T) { + #ifndef BOOST_MATH_SYCL_ENABLED errno = ERANGE; + #endif // This may or may not do the right thing, but the user asked for the error // to be silent so here we go anyway: return std::numeric_limits::has_infinity ? std::numeric_limits::infinity() : boost::math::tools::max_value(); @@ -427,7 +433,9 @@ BOOST_MATH_GPU_ENABLED inline T raise_underflow_error( const char* /* message */, const ::boost::math::policies::underflow_error< ::boost::math::policies::errno_on_error>&) BOOST_MATH_NOEXCEPT(T) { + #ifndef BOOST_MATH_SYCL_ENABLED errno = ERANGE; + #endif // This may or may not do the right thing, but the user asked for the error // to be silent so here we go anyway: return T(0); @@ -477,7 +485,9 @@ BOOST_MATH_GPU_ENABLED inline T raise_denorm_error( const T& val, const ::boost::math::policies::denorm_error< ::boost::math::policies::errno_on_error>&) BOOST_MATH_NOEXCEPT(T) { + #ifndef BOOST_MATH_SYCL_ENABLED errno = ERANGE; + #endif // This may or may not do the right thing, but the user asked for the error // to be silent so here we go anyway: return val; @@ -528,7 +538,9 @@ BOOST_MATH_GPU_ENABLED inline T raise_evaluation_error( const T& val, const ::boost::math::policies::evaluation_error< ::boost::math::policies::errno_on_error>&) BOOST_MATH_NOEXCEPT(T) { + #ifndef BOOST_MATH_SYCL_ENABLED errno = EDOM; + #endif // This may or may not do the right thing, but the user asked for the error // to be silent so here we go anyway: return val; @@ -583,7 +595,9 @@ BOOST_MATH_GPU_ENABLED inline TargetType raise_rounding_error( const TargetType&, const ::boost::math::policies::rounding_error< ::boost::math::policies::errno_on_error>&) BOOST_MATH_NOEXCEPT(T) { + #ifndef BOOST_MATH_SYCL_ENABLED errno = ERANGE; + #endif // This may or may not do the right thing, but the user asked for the error // to be silent so here we go anyway: static_assert(std::numeric_limits::is_specialized, "The target type must have std::numeric_limits specialized."); @@ -638,7 +652,9 @@ BOOST_MATH_GPU_ENABLED inline T raise_indeterminate_result_error( const R& result, const ::boost::math::policies::indeterminate_result_error< ::boost::math::policies::errno_on_error>&) { + #ifndef BOOST_MATH_SYCL_ENABLED errno = EDOM; + #endif // This may or may not do the right thing, but the user asked for the error // to be silent so here we go anyway: return result; From 349c84f13155cd75bd55e7e28bdcfd11e5803f5c Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Fri, 19 Jul 2024 16:51:51 -0400 Subject: [PATCH 34/64] Reduce sycl jamfile to just the distributions with annotations --- test/sycl_jamfile | 6 ------ 1 file changed, 6 deletions(-) diff --git a/test/sycl_jamfile b/test/sycl_jamfile index 19f7e9978..d9ca2d8a6 100644 --- a/test/sycl_jamfile +++ b/test/sycl_jamfile @@ -9,12 +9,6 @@ project : requirements [ requires cxx14_decltype_auto cxx14_generic_lambdas cxx14_return_type_deduction cxx14_variable_templates cxx14_constexpr ] ; -# Autodiff Tests -run test_autodiff_1.cpp ; - -# Tools Tests -run test_polynomial.cpp ; - # Distributions run test_arcsine.cpp ; run test_binomial.cpp ; From 8fd6f23d5180d690a3e2ef71195dfe39e13ba160 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Fri, 19 Jul 2024 16:52:15 -0400 Subject: [PATCH 35/64] Replace static const char* with constexpr auto --- include/boost/math/distributions/arcsine.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/boost/math/distributions/arcsine.hpp b/include/boost/math/distributions/arcsine.hpp index a1d06b7db..59bf666b9 100644 --- a/include/boost/math/distributions/arcsine.hpp +++ b/include/boost/math/distributions/arcsine.hpp @@ -348,7 +348,7 @@ namespace boost BOOST_FPU_EXCEPTION_GUARD BOOST_MATH_STD_USING // For ADL of std functions. - static const char* function = "boost::math::pdf(arcsine_distribution<%1%> const&, %1%)"; + constexpr auto function = "boost::math::pdf(arcsine_distribution<%1%> const&, %1%)"; RealType lo = dist.x_min(); RealType hi = dist.x_max(); @@ -373,7 +373,7 @@ namespace boost { // Cumulative Distribution Function arcsine. BOOST_MATH_STD_USING // For ADL of std functions. - static const char* function = "boost::math::cdf(arcsine_distribution<%1%> const&, %1%)"; + constexpr auto function = "boost::math::cdf(arcsine_distribution<%1%> const&, %1%)"; RealType x_min = dist.x_min(); RealType x_max = dist.x_max(); @@ -405,7 +405,7 @@ namespace boost BOOST_MATH_GPU_ENABLED inline RealType cdf(const complemented2_type, RealType>& c) { // Complemented Cumulative Distribution Function arcsine. BOOST_MATH_STD_USING // For ADL of std functions. - static const char* function = "boost::math::cdf(arcsine_distribution<%1%> const&, %1%)"; + constexpr auto function = "boost::math::cdf(arcsine_distribution<%1%> const&, %1%)"; RealType x = c.param; arcsine_distribution const& dist = c.dist; @@ -452,7 +452,7 @@ namespace boost using boost::math::constants::half_pi; - static const char* function = "boost::math::quantile(arcsine_distribution<%1%> const&, %1%)"; + constexpr auto function = "boost::math::quantile(arcsine_distribution<%1%> const&, %1%)"; RealType result = 0; // of argument checks: RealType x_min = dist.x_min(); @@ -490,7 +490,7 @@ namespace boost BOOST_MATH_STD_USING // For ADL of std functions. using boost::math::constants::half_pi; - static const char* function = "boost::math::quantile(arcsine_distribution<%1%> const&, %1%)"; + constexpr auto function = "boost::math::quantile(arcsine_distribution<%1%> const&, %1%)"; // Error checks: RealType q = c.param; From 159f5408c96a97d1c000e5d2191418cca40fd18d Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Fri, 19 Jul 2024 16:52:43 -0400 Subject: [PATCH 36/64] Dont check throws on GPUs --- test/test_arcsine.cpp | 6 ++++++ test/test_out_of_range.hpp | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/test/test_arcsine.cpp b/test/test_arcsine.cpp index 3b579e42d..efe22cde3 100644 --- a/test/test_arcsine.cpp +++ b/test/test_arcsine.cpp @@ -41,6 +41,10 @@ using std::endl; #include using std::numeric_limits; +#if defined(BOOST_CHECK_THROW) && defined(BOOST_MATH_NO_EXCEPTIONS) +# undef BOOST_CHECK_THROW +# define BOOST_CHECK_THROW(x, y) +#endif template void test_ignore_policy(RealType) @@ -289,11 +293,13 @@ void test_spots(RealType) BOOST_CHECK_CLOSE_FRACTION(pdf(arcsine_01, 0.999999), static_cast(318.31004533885312973989414360099118178698415543136L), 100000 * tolerance);// Even less accurate. // Extreme x. + #ifndef BOOST_MATH_ENABLE_SYCL if (std::numeric_limits::has_infinity) { // BOOST_CHECK_EQUAL(pdf(arcsine_01, 0), informax()); // BOOST_CHECK_EQUAL(pdf(arcsine_01, 1), informax()); // } + #endif BOOST_CHECK_CLOSE_FRACTION(pdf(arcsine_01, tolerance), 1 /(sqrt(tolerance) * boost::math::constants::pi()), 2 * tolerance); // diff --git a/test/test_out_of_range.hpp b/test/test_out_of_range.hpp index bed4e48a0..8b7e723c0 100644 --- a/test/test_out_of_range.hpp +++ b/test/test_out_of_range.hpp @@ -8,6 +8,7 @@ #ifndef BOOST_MATH_TEST_OUT_OF_RANGE_HPP #define BOOST_MATH_TEST_OUT_OF_RANGE_HPP +#include #include #include @@ -30,6 +31,11 @@ but does *not* check finite but out-of-range parameters to the constructor because these are specific to each distribution. */ +#if defined(BOOST_CHECK_THROW) && defined(BOOST_MATH_NO_EXCEPTIONS) +# undef BOOST_CHECK_THROW +# define BOOST_CHECK_THROW(x, y) +#endif + #ifdef _MSC_VER #pragma warning(push) #pragma warning(disable:4127) From 0f876d5346c7c8d7de8ac633ed3c4309b6f2b654 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Mon, 22 Jul 2024 09:59:57 -0400 Subject: [PATCH 37/64] Add John's arcsine cdf float test --- test/cuda_jamfile | 1 + test/test_arcsine_cdf_float.cu | 109 +++++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 test/test_arcsine_cdf_float.cu diff --git a/test/cuda_jamfile b/test/cuda_jamfile index d6163ed1e..608c4a5e1 100644 --- a/test/cuda_jamfile +++ b/test/cuda_jamfile @@ -18,4 +18,5 @@ run test_polynomial.cpp ; # Distributions run test_arcsine.cpp ; run test_arcsine_cdf_double.cu ; +run test_arcsine_cdf_float.cu ; run test_binomial.cpp ; diff --git a/test/test_arcsine_cdf_float.cu b/test/test_arcsine_cdf_float.cu new file mode 100644 index 000000000..148b1dffb --- /dev/null +++ b/test/test_arcsine_cdf_float.cu @@ -0,0 +1,109 @@ +// Copyright John Maddock 2016. +// 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) + +#define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error + +#include +#include +#include +#include +#include +#include +#include +#include "cuda_managed_ptr.hpp" +#include "stopwatch.hpp" + +// For the CUDA runtime routines (prefixed with "cuda_") +#include + +typedef float float_type; + +/** + * CUDA Kernel Device code + * + */ +__global__ void cuda_test(const float_type *in1, float_type *out, int numElements) +{ + using std::cos; + int i = blockDim.x * blockIdx.x + threadIdx.x; + + if (i < numElements) + { + out[i] = cdf(boost::math::arcsine_distribution(), in1[i]); + } +} + +/** + * Host main routine + */ +int main(void) +{ + try{ + + // Error code to check return values for CUDA calls + cudaError_t err = cudaSuccess; + + // Print the vector length to be used, and compute its size + int numElements = 50000; + std::cout << "[Vector operation on " << numElements << " elements]" << std::endl; + + // Allocate the managed input vector A + cuda_managed_ptr input_vector1(numElements); + + // Allocate the managed output vector C + cuda_managed_ptr output_vector(numElements); + + boost::random::mt19937 gen; + boost::random::uniform_real_distribution dist; + // Initialize the input vectors + for (int i = 0; i < numElements; ++i) + { + input_vector1[i] = dist(gen); + } + + // Launch the Vector Add CUDA Kernel + int threadsPerBlock = 512; + int blocksPerGrid =(numElements + threadsPerBlock - 1) / threadsPerBlock; + std::cout << "CUDA kernel launch with " << blocksPerGrid << " blocks of " << threadsPerBlock << " threads" << std::endl; + + watch w; + cuda_test<<>>(input_vector1.get(), output_vector.get(), numElements); + cudaDeviceSynchronize(); + std::cout << "CUDA kernal done in " << w.elapsed() << "s" << std::endl; + + err = cudaGetLastError(); + if (err != cudaSuccess) + { + std::cerr << "Failed to launch vectorAdd kernel (error code " << cudaGetErrorString(err) << ")!" << std::endl; + return EXIT_FAILURE; + } + + // Verify that the result vector is correct + std::vector results; + results.reserve(numElements); + w.reset(); + for(int i = 0; i < numElements; ++i) + results.push_back(cdf(boost::math::arcsine_distribution(), input_vector1[i])); + double t = w.elapsed(); + // check the results + for(int i = 0; i < numElements; ++i) + { + if (boost::math::epsilon_difference(output_vector[i], results[i]) > 100.0) + { + std::cerr << "Result verification failed at element " << i << "!" << std::endl; + std::cerr << "Error rate was: " << boost::math::epsilon_difference(output_vector[i], results[i]) << "eps" << std::endl; + return EXIT_FAILURE; + } + } + + std::cout << "Test PASSED with calculation time: " << t << "s" << std::endl; + std::cout << "Done\n"; + } + catch(const std::exception& e) + { + std::cerr << "Stopped with exception: " << e.what() << std::endl; + } + return 0; +} From d458951703da83d692c4085b72e73d799300b69f Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Mon, 22 Jul 2024 10:02:19 -0400 Subject: [PATCH 38/64] Add arcsine pdf double test --- test/cuda_jamfile | 1 + test/test_arcsine_pdf_double.cu | 109 ++++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 test/test_arcsine_pdf_double.cu diff --git a/test/cuda_jamfile b/test/cuda_jamfile index 608c4a5e1..4fd357d88 100644 --- a/test/cuda_jamfile +++ b/test/cuda_jamfile @@ -19,4 +19,5 @@ run test_polynomial.cpp ; run test_arcsine.cpp ; run test_arcsine_cdf_double.cu ; run test_arcsine_cdf_float.cu ; +run test_arcsine_pdf_double.cu ; run test_binomial.cpp ; diff --git a/test/test_arcsine_pdf_double.cu b/test/test_arcsine_pdf_double.cu new file mode 100644 index 000000000..7a73bb34e --- /dev/null +++ b/test/test_arcsine_pdf_double.cu @@ -0,0 +1,109 @@ +// Copyright John Maddock 2016. +// 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) + +#define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error + +#include +#include +#include +#include +#include +#include +#include +#include "cuda_managed_ptr.hpp" +#include "stopwatch.hpp" + +// For the CUDA runtime routines (prefixed with "cuda_") +#include + +typedef double float_type; + +/** + * CUDA Kernel Device code + * + */ +__global__ void cuda_test(const float_type *in1, float_type *out, int numElements) +{ + using std::cos; + int i = blockDim.x * blockIdx.x + threadIdx.x; + + if (i < numElements) + { + out[i] = pdf(boost::math::arcsine_distribution(), in1[i]); + } +} + +/** + * Host main routine + */ +int main(void) +{ + try{ + + // Error code to check return values for CUDA calls + cudaError_t err = cudaSuccess; + + // Print the vector length to be used, and compute its size + int numElements = 50000; + std::cout << "[Vector operation on " << numElements << " elements]" << std::endl; + + // Allocate the managed input vector A + cuda_managed_ptr input_vector1(numElements); + + // Allocate the managed output vector C + cuda_managed_ptr output_vector(numElements); + + boost::random::mt19937 gen; + boost::random::uniform_real_distribution dist; + // Initialize the input vectors + for (int i = 0; i < numElements; ++i) + { + input_vector1[i] = dist(gen); + } + + // Launch the Vector Add CUDA Kernel + int threadsPerBlock = 512; + int blocksPerGrid =(numElements + threadsPerBlock - 1) / threadsPerBlock; + std::cout << "CUDA kernel launch with " << blocksPerGrid << " blocks of " << threadsPerBlock << " threads" << std::endl; + + watch w; + cuda_test<<>>(input_vector1.get(), output_vector.get(), numElements); + cudaDeviceSynchronize(); + std::cout << "CUDA kernal done in " << w.elapsed() << "s" << std::endl; + + err = cudaGetLastError(); + if (err != cudaSuccess) + { + std::cerr << "Failed to launch vectorAdd kernel (error code " << cudaGetErrorString(err) << ")!" << std::endl; + return EXIT_FAILURE; + } + + // Verify that the result vector is correct + std::vector results; + results.reserve(numElements); + w.reset(); + for(int i = 0; i < numElements; ++i) + results.push_back(pdf(boost::math::arcsine_distribution(), input_vector1[i])); + double t = w.elapsed(); + // check the results + for(int i = 0; i < numElements; ++i) + { + if (boost::math::epsilon_difference(output_vector[i], results[i]) > 100.0) + { + std::cerr << "Result verification failed at element " << i << "!" << std::endl; + std::cerr << "Error rate was: " << boost::math::epsilon_difference(output_vector[i], results[i]) << "eps" << std::endl; + return EXIT_FAILURE; + } + } + + std::cout << "Test PASSED with calculation time: " << t << "s" << std::endl; + std::cout << "Done\n"; + } + catch(const std::exception& e) + { + std::cerr << "Stopped with exception: " << e.what() << std::endl; + } + return 0; +} From 583600800cb3efc46a6751da0ce55f78c5497ee6 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Mon, 22 Jul 2024 10:04:44 -0400 Subject: [PATCH 39/64] Add arcsine pdf float test --- test/cuda_jamfile | 1 + test/test_arcsine_pdf_float.cu | 109 +++++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 test/test_arcsine_pdf_float.cu diff --git a/test/cuda_jamfile b/test/cuda_jamfile index 4fd357d88..d56f27f48 100644 --- a/test/cuda_jamfile +++ b/test/cuda_jamfile @@ -20,4 +20,5 @@ run test_arcsine.cpp ; run test_arcsine_cdf_double.cu ; run test_arcsine_cdf_float.cu ; run test_arcsine_pdf_double.cu ; +run test_arcsine_pdf_float.cu ; run test_binomial.cpp ; diff --git a/test/test_arcsine_pdf_float.cu b/test/test_arcsine_pdf_float.cu new file mode 100644 index 000000000..54a11253c --- /dev/null +++ b/test/test_arcsine_pdf_float.cu @@ -0,0 +1,109 @@ +// Copyright John Maddock 2016. +// 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) + +#define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error + +#include +#include +#include +#include +#include +#include +#include +#include "cuda_managed_ptr.hpp" +#include "stopwatch.hpp" + +// For the CUDA runtime routines (prefixed with "cuda_") +#include + +typedef float float_type; + +/** + * CUDA Kernel Device code + * + */ +__global__ void cuda_test(const float_type *in1, float_type *out, int numElements) +{ + using std::cos; + int i = blockDim.x * blockIdx.x + threadIdx.x; + + if (i < numElements) + { + out[i] = pdf(boost::math::arcsine_distribution(), in1[i]); + } +} + +/** + * Host main routine + */ +int main(void) +{ + try{ + + // Error code to check return values for CUDA calls + cudaError_t err = cudaSuccess; + + // Print the vector length to be used, and compute its size + int numElements = 50000; + std::cout << "[Vector operation on " << numElements << " elements]" << std::endl; + + // Allocate the managed input vector A + cuda_managed_ptr input_vector1(numElements); + + // Allocate the managed output vector C + cuda_managed_ptr output_vector(numElements); + + boost::random::mt19937 gen; + boost::random::uniform_real_distribution dist; + // Initialize the input vectors + for (int i = 0; i < numElements; ++i) + { + input_vector1[i] = dist(gen); + } + + // Launch the Vector Add CUDA Kernel + int threadsPerBlock = 512; + int blocksPerGrid =(numElements + threadsPerBlock - 1) / threadsPerBlock; + std::cout << "CUDA kernel launch with " << blocksPerGrid << " blocks of " << threadsPerBlock << " threads" << std::endl; + + watch w; + cuda_test<<>>(input_vector1.get(), output_vector.get(), numElements); + cudaDeviceSynchronize(); + std::cout << "CUDA kernal done in " << w.elapsed() << "s" << std::endl; + + err = cudaGetLastError(); + if (err != cudaSuccess) + { + std::cerr << "Failed to launch vectorAdd kernel (error code " << cudaGetErrorString(err) << ")!" << std::endl; + return EXIT_FAILURE; + } + + // Verify that the result vector is correct + std::vector results; + results.reserve(numElements); + w.reset(); + for(int i = 0; i < numElements; ++i) + results.push_back(pdf(boost::math::arcsine_distribution(), input_vector1[i])); + double t = w.elapsed(); + // check the results + for(int i = 0; i < numElements; ++i) + { + if (boost::math::epsilon_difference(output_vector[i], results[i]) > 100.0) + { + std::cerr << "Result verification failed at element " << i << "!" << std::endl; + std::cerr << "Error rate was: " << boost::math::epsilon_difference(output_vector[i], results[i]) << "eps" << std::endl; + return EXIT_FAILURE; + } + } + + std::cout << "Test PASSED with calculation time: " << t << "s" << std::endl; + std::cout << "Done\n"; + } + catch(const std::exception& e) + { + std::cerr << "Stopped with exception: " << e.what() << std::endl; + } + return 0; +} From a309713631d869592eb4e9be1c51322a71f86392 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Mon, 22 Jul 2024 10:06:38 -0400 Subject: [PATCH 40/64] Add arcsine quantile double test --- test/cuda_jamfile | 1 + test/test_arcsine_quan_double.cu | 109 +++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 test/test_arcsine_quan_double.cu diff --git a/test/cuda_jamfile b/test/cuda_jamfile index d56f27f48..0e2a65a02 100644 --- a/test/cuda_jamfile +++ b/test/cuda_jamfile @@ -21,4 +21,5 @@ run test_arcsine_cdf_double.cu ; run test_arcsine_cdf_float.cu ; run test_arcsine_pdf_double.cu ; run test_arcsine_pdf_float.cu ; +run test_arcsine_quan_double.cu ; run test_binomial.cpp ; diff --git a/test/test_arcsine_quan_double.cu b/test/test_arcsine_quan_double.cu new file mode 100644 index 000000000..31f6eac8a --- /dev/null +++ b/test/test_arcsine_quan_double.cu @@ -0,0 +1,109 @@ +// Copyright John Maddock 2016. +// 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) + +#define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error + +#include +#include +#include +#include +#include +#include +#include +#include "cuda_managed_ptr.hpp" +#include "stopwatch.hpp" + +// For the CUDA runtime routines (prefixed with "cuda_") +#include + +typedef double float_type; + +/** + * CUDA Kernel Device code + * + */ +__global__ void cuda_test(const float_type *in1, float_type *out, int numElements) +{ + using std::cos; + int i = blockDim.x * blockIdx.x + threadIdx.x; + + if (i < numElements) + { + out[i] = quantile(boost::math::arcsine_distribution(), in1[i]); + } +} + +/** + * Host main routine + */ +int main(void) +{ + try{ + + // Error code to check return values for CUDA calls + cudaError_t err = cudaSuccess; + + // Print the vector length to be used, and compute its size + int numElements = 50000; + std::cout << "[Vector operation on " << numElements << " elements]" << std::endl; + + // Allocate the managed input vector A + cuda_managed_ptr input_vector1(numElements); + + // Allocate the managed output vector C + cuda_managed_ptr output_vector(numElements); + + boost::random::mt19937 gen; + boost::random::uniform_real_distribution dist; + // Initialize the input vectors + for (int i = 0; i < numElements; ++i) + { + input_vector1[i] = dist(gen); + } + + // Launch the Vector Add CUDA Kernel + int threadsPerBlock = 512; + int blocksPerGrid =(numElements + threadsPerBlock - 1) / threadsPerBlock; + std::cout << "CUDA kernel launch with " << blocksPerGrid << " blocks of " << threadsPerBlock << " threads" << std::endl; + + watch w; + cuda_test<<>>(input_vector1.get(), output_vector.get(), numElements); + cudaDeviceSynchronize(); + std::cout << "CUDA kernal done in " << w.elapsed() << "s" << std::endl; + + err = cudaGetLastError(); + if (err != cudaSuccess) + { + std::cerr << "Failed to launch vectorAdd kernel (error code " << cudaGetErrorString(err) << ")!" << std::endl; + return EXIT_FAILURE; + } + + // Verify that the result vector is correct + std::vector results; + results.reserve(numElements); + w.reset(); + for(int i = 0; i < numElements; ++i) + results.push_back(quantile(boost::math::arcsine_distribution(), input_vector1[i])); + double t = w.elapsed(); + // check the results + for(int i = 0; i < numElements; ++i) + { + if (boost::math::epsilon_difference(output_vector[i], results[i]) > 100.0) + { + std::cerr << "Result verification failed at element " << i << "!" << std::endl; + std::cerr << "Error rate was: " << boost::math::epsilon_difference(output_vector[i], results[i]) << "eps" << std::endl; + return EXIT_FAILURE; + } + } + + std::cout << "Test PASSED with calculation time: " << t << "s" << std::endl; + std::cout << "Done\n"; + } + catch(const std::exception& e) + { + std::cerr << "Stopped with exception: " << e.what() << std::endl; + } + return 0; +} From a48756f1f5291e8bdc7d005e7d18362e65dc6a8c Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Mon, 22 Jul 2024 10:25:52 -0400 Subject: [PATCH 41/64] Add arcsine quantile float test --- test/cuda_jamfile | 1 + test/test_arcsine_quan_float.cu | 109 ++++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 test/test_arcsine_quan_float.cu diff --git a/test/cuda_jamfile b/test/cuda_jamfile index 0e2a65a02..7a78d7f38 100644 --- a/test/cuda_jamfile +++ b/test/cuda_jamfile @@ -22,4 +22,5 @@ run test_arcsine_cdf_float.cu ; run test_arcsine_pdf_double.cu ; run test_arcsine_pdf_float.cu ; run test_arcsine_quan_double.cu ; +run test_arcsine_quan_float.cu ; run test_binomial.cpp ; diff --git a/test/test_arcsine_quan_float.cu b/test/test_arcsine_quan_float.cu new file mode 100644 index 000000000..6decb347b --- /dev/null +++ b/test/test_arcsine_quan_float.cu @@ -0,0 +1,109 @@ +// Copyright John Maddock 2016. +// 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) + +#define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error + +#include +#include +#include +#include +#include +#include +#include +#include "cuda_managed_ptr.hpp" +#include "stopwatch.hpp" + +// For the CUDA runtime routines (prefixed with "cuda_") +#include + +typedef float float_type; + +/** + * CUDA Kernel Device code + * + */ +__global__ void cuda_test(const float_type *in1, float_type *out, int numElements) +{ + using std::cos; + int i = blockDim.x * blockIdx.x + threadIdx.x; + + if (i < numElements) + { + out[i] = quantile(boost::math::arcsine_distribution(), in1[i]); + } +} + +/** + * Host main routine + */ +int main(void) +{ + try{ + + // Error code to check return values for CUDA calls + cudaError_t err = cudaSuccess; + + // Print the vector length to be used, and compute its size + int numElements = 50000; + std::cout << "[Vector operation on " << numElements << " elements]" << std::endl; + + // Allocate the managed input vector A + cuda_managed_ptr input_vector1(numElements); + + // Allocate the managed output vector C + cuda_managed_ptr output_vector(numElements); + + boost::random::mt19937 gen; + boost::random::uniform_real_distribution dist; + // Initialize the input vectors + for (int i = 0; i < numElements; ++i) + { + input_vector1[i] = dist(gen); + } + + // Launch the Vector Add CUDA Kernel + int threadsPerBlock = 512; + int blocksPerGrid =(numElements + threadsPerBlock - 1) / threadsPerBlock; + std::cout << "CUDA kernel launch with " << blocksPerGrid << " blocks of " << threadsPerBlock << " threads" << std::endl; + + watch w; + cuda_test<<>>(input_vector1.get(), output_vector.get(), numElements); + cudaDeviceSynchronize(); + std::cout << "CUDA kernal done in " << w.elapsed() << "s" << std::endl; + + err = cudaGetLastError(); + if (err != cudaSuccess) + { + std::cerr << "Failed to launch vectorAdd kernel (error code " << cudaGetErrorString(err) << ")!" << std::endl; + return EXIT_FAILURE; + } + + // Verify that the result vector is correct + std::vector results; + results.reserve(numElements); + w.reset(); + for(int i = 0; i < numElements; ++i) + results.push_back(quantile(boost::math::arcsine_distribution(), input_vector1[i])); + double t = w.elapsed(); + // check the results + for(int i = 0; i < numElements; ++i) + { + if (boost::math::epsilon_difference(output_vector[i], results[i]) > 100.0) + { + std::cerr << "Result verification failed at element " << i << "!" << std::endl; + std::cerr << "Error rate was: " << boost::math::epsilon_difference(output_vector[i], results[i]) << "eps" << std::endl; + return EXIT_FAILURE; + } + } + + std::cout << "Test PASSED with calculation time: " << t << "s" << std::endl; + std::cout << "Done\n"; + } + catch(const std::exception& e) + { + std::cerr << "Stopped with exception: " << e.what() << std::endl; + } + return 0; +} From 6f36d81eabc6aecc7433f9a160b0da0022158595 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Mon, 22 Jul 2024 10:50:04 -0400 Subject: [PATCH 42/64] Add simplified testing of beta function --- test/cuda_jamfile | 3 +++ test/sycl_jamfile | 3 +++ test/test_beta_simple.cpp | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 test/test_beta_simple.cpp diff --git a/test/cuda_jamfile b/test/cuda_jamfile index 7a78d7f38..9d7cde086 100644 --- a/test/cuda_jamfile +++ b/test/cuda_jamfile @@ -24,3 +24,6 @@ run test_arcsine_pdf_float.cu ; run test_arcsine_quan_double.cu ; run test_arcsine_quan_float.cu ; run test_binomial.cpp ; + +# Special Functions +run test_beta_simple ; diff --git a/test/sycl_jamfile b/test/sycl_jamfile index d9ca2d8a6..707772049 100644 --- a/test/sycl_jamfile +++ b/test/sycl_jamfile @@ -12,3 +12,6 @@ project : requirements # Distributions run test_arcsine.cpp ; run test_binomial.cpp ; + +# Special Functions +run test_beta_simple.cpp ; diff --git a/test/test_beta_simple.cpp b/test/test_beta_simple.cpp new file mode 100644 index 000000000..d96af34d9 --- /dev/null +++ b/test/test_beta_simple.cpp @@ -0,0 +1,35 @@ +// Copyright John Maddock 2006. +// Copyright Paul A. Bristow 2007, 2009 +// Copyright Matt Borland 2024 +// 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) + +#include +#include +#include "math_unit_test.hpp" + +template +void test_spots(T) +{ + // + // Basic sanity checks, tolerance is 20 epsilon expressed as a percentage: + // + T tolerance = 20; + T small = boost::math::tools::epsilon() / 1024; + CHECK_ULP_CLOSE(::boost::math::beta(static_cast(1), static_cast(1)), static_cast(1), tolerance); + CHECK_ULP_CLOSE(::boost::math::beta(static_cast(1), static_cast(4)), static_cast(0.25), tolerance); + CHECK_ULP_CLOSE(::boost::math::beta(static_cast(4), static_cast(1)), static_cast(0.25), tolerance); + CHECK_ULP_CLOSE(::boost::math::beta(small, static_cast(4)), 1/small, tolerance); + CHECK_ULP_CLOSE(::boost::math::beta(static_cast(4), small), 1/small, tolerance); + CHECK_ULP_CLOSE(::boost::math::beta(small, static_cast(4)), 1/small, tolerance); + CHECK_ULP_CLOSE(::boost::math::beta(static_cast(4), static_cast(20)), static_cast(0.00002823263692828910220214568040654997176736L), tolerance); +} + +int main() +{ + test_spots(0.0F); + test_spots(0.0); + + return boost::math::test::report_errors(); +} From f323cc804e3825fbb8abfd2829eb0d060ae069bc Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Mon, 22 Jul 2024 10:54:53 -0400 Subject: [PATCH 43/64] Add beta function cuda testing --- test/cuda_jamfile | 3 +- test/test_beta_double.cu | 131 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 133 insertions(+), 1 deletion(-) create mode 100644 test/test_beta_double.cu diff --git a/test/cuda_jamfile b/test/cuda_jamfile index 9d7cde086..2798d5f40 100644 --- a/test/cuda_jamfile +++ b/test/cuda_jamfile @@ -26,4 +26,5 @@ run test_arcsine_quan_float.cu ; run test_binomial.cpp ; # Special Functions -run test_beta_simple ; +run test_beta_simple.cpp ; +run test_beta_double.cu ; diff --git a/test/test_beta_double.cu b/test/test_beta_double.cu new file mode 100644 index 000000000..58ccaf9ef --- /dev/null +++ b/test/test_beta_double.cu @@ -0,0 +1,131 @@ +// Copyright John Maddock 2016. +// 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) + +#define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error + +#include +#include +#include +#include +#include +#include +#include "cuda_managed_ptr.hpp" +#include "stopwatch.hpp" + +// For the CUDA runtime routines (prefixed with "cuda_") +#include + +typedef double float_type; + +/** + * CUDA Kernel Device code + * + */ +__global__ void cuda_test(const float_type *in1, const float_type * in2, float_type *out, int numElements) +{ + using std::cos; + int i = blockDim.x * blockIdx.x + threadIdx.x; + + if (i < numElements) + { + out[i] = boost::math::beta(in1[i], in2[i]); + } +} + +template struct table_type { typedef T type; }; +typedef float_type T; +#define SC_(x) static_cast(x) + +#include "beta_med_data.ipp" +#include "beta_small_data.ipp" + +/** + * Host main routine + */ +int main(void) +{ + try{ + // Consolidate the test data: + std::vector v1, v2; + + for(unsigned i = 0; i < beta_med_data.size(); ++i) + { + v1.push_back(beta_med_data[i][0]); + v2.push_back(beta_med_data[i][1]); + } + for(unsigned i = 0; i < beta_small_data.size(); ++i) + { + v1.push_back(beta_small_data[i][0]); + v2.push_back(beta_small_data[i][1]); + } + + // Error code to check return values for CUDA calls + cudaError_t err = cudaSuccess; + + // Print the vector length to be used, and compute its size + int numElements = 50000; + std::cout << "[Vector operation on " << numElements << " elements]" << std::endl; + + // Allocate the managed input vector A + cuda_managed_ptr input_vector1(numElements); + cuda_managed_ptr input_vector2(numElements); + + // Allocate the managed output vector C + cuda_managed_ptr output_vector(numElements); + + // Initialize the input vectors + for (int i = 0; i < numElements; ++i) + { + int table_id = i % v1.size(); + input_vector1[i] = v1[table_id]; + input_vector2[i] = v2[table_id]; + } + + // Launch the Vector Add CUDA Kernel + int threadsPerBlock = 1024; + int blocksPerGrid =(numElements + threadsPerBlock - 1) / threadsPerBlock; + std::cout << "CUDA kernel launch with " << blocksPerGrid << " blocks of " << threadsPerBlock << " threads" << std::endl; + + watch w; + cuda_test<<>>(input_vector1.get(), input_vector2.get(), output_vector.get(), numElements); + cudaDeviceSynchronize(); + std::cout << "CUDA kernal done in " << w.elapsed() << "s" << std::endl; + + err = cudaGetLastError(); + if (err != cudaSuccess) + { + std::cerr << "Failed to launch vectorAdd kernel (error code " << cudaGetErrorString(err) << ")!" << std::endl; + return EXIT_FAILURE; + } + + // Verify that the result vector is correct + std::vector results; + results.reserve(numElements); + w.reset(); + for(int i = 0; i < numElements; ++i) + results.push_back(boost::math::beta(input_vector1[i], input_vector2[i])); + double t = w.elapsed(); + // check the results + for(int i = 0; i < numElements; ++i) + { + if (boost::math::epsilon_difference(output_vector[i], results[i]) > 300) + { + std::cerr << "Result verification failed at element " << i << "!" << std::endl; + std::cerr << "Error rate was: " << boost::math::epsilon_difference(output_vector[i], results[i]) << "eps" << std::endl; + return EXIT_FAILURE; + } + } + + std::cout << "Test PASSED with calculation time: " << t << "s" << std::endl; + std::cout << "Done\n"; + } + catch(const std::exception& e) + { + std::cerr << "Stopped with exception: " << e.what() << std::endl; + } + return 0; +} + + From c957b1d6d4dfe7377b0b7fa381d183bc5f9d6a4b Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Mon, 22 Jul 2024 14:34:17 -0400 Subject: [PATCH 44/64] Update polynomial and rationals --- .../tools/detail/polynomial_horner1_10.hpp | 22 +++---- .../tools/detail/polynomial_horner1_11.hpp | 24 ++++---- .../tools/detail/polynomial_horner1_12.hpp | 26 ++++---- .../tools/detail/polynomial_horner1_13.hpp | 28 ++++----- .../tools/detail/polynomial_horner1_14.hpp | 30 +++++----- .../tools/detail/polynomial_horner1_15.hpp | 32 +++++----- .../tools/detail/polynomial_horner1_16.hpp | 34 +++++------ .../tools/detail/polynomial_horner1_17.hpp | 36 +++++------ .../tools/detail/polynomial_horner1_18.hpp | 38 ++++++------ .../tools/detail/polynomial_horner1_19.hpp | 40 ++++++------- .../tools/detail/polynomial_horner1_2.hpp | 6 +- .../tools/detail/polynomial_horner1_20.hpp | 42 ++++++------- .../tools/detail/polynomial_horner1_3.hpp | 8 +-- .../tools/detail/polynomial_horner1_4.hpp | 10 ++-- .../tools/detail/polynomial_horner1_5.hpp | 12 ++-- .../tools/detail/polynomial_horner1_6.hpp | 14 ++--- .../tools/detail/polynomial_horner1_7.hpp | 16 ++--- .../tools/detail/polynomial_horner1_8.hpp | 18 +++--- .../tools/detail/polynomial_horner1_9.hpp | 20 +++---- .../tools/detail/polynomial_horner2_10.hpp | 22 +++---- .../tools/detail/polynomial_horner2_11.hpp | 24 ++++---- .../tools/detail/polynomial_horner2_12.hpp | 26 ++++---- .../tools/detail/polynomial_horner2_13.hpp | 28 ++++----- .../tools/detail/polynomial_horner2_14.hpp | 30 +++++----- .../tools/detail/polynomial_horner2_15.hpp | 32 +++++----- .../tools/detail/polynomial_horner2_16.hpp | 34 +++++------ .../tools/detail/polynomial_horner2_17.hpp | 36 +++++------ .../tools/detail/polynomial_horner2_18.hpp | 38 ++++++------ .../tools/detail/polynomial_horner2_19.hpp | 40 ++++++------- .../tools/detail/polynomial_horner2_2.hpp | 10 ++-- .../tools/detail/polynomial_horner2_20.hpp | 42 ++++++------- .../tools/detail/polynomial_horner2_3.hpp | 10 ++-- .../tools/detail/polynomial_horner2_4.hpp | 10 ++-- .../tools/detail/polynomial_horner2_5.hpp | 12 ++-- .../tools/detail/polynomial_horner2_6.hpp | 14 ++--- .../tools/detail/polynomial_horner2_7.hpp | 16 ++--- .../tools/detail/polynomial_horner2_8.hpp | 18 +++--- .../tools/detail/polynomial_horner2_9.hpp | 20 +++---- .../tools/detail/polynomial_horner3_10.hpp | 22 +++---- .../tools/detail/polynomial_horner3_11.hpp | 24 ++++---- .../tools/detail/polynomial_horner3_12.hpp | 26 ++++---- .../tools/detail/polynomial_horner3_13.hpp | 28 ++++----- .../tools/detail/polynomial_horner3_14.hpp | 30 +++++----- .../tools/detail/polynomial_horner3_15.hpp | 32 +++++----- .../tools/detail/polynomial_horner3_16.hpp | 34 +++++------ .../tools/detail/polynomial_horner3_17.hpp | 36 +++++------ .../tools/detail/polynomial_horner3_18.hpp | 38 ++++++------ .../tools/detail/polynomial_horner3_19.hpp | 40 ++++++------- .../tools/detail/polynomial_horner3_2.hpp | 10 ++-- .../tools/detail/polynomial_horner3_20.hpp | 42 ++++++------- .../tools/detail/polynomial_horner3_3.hpp | 10 ++-- .../tools/detail/polynomial_horner3_4.hpp | 10 ++-- .../tools/detail/polynomial_horner3_5.hpp | 12 ++-- .../tools/detail/polynomial_horner3_6.hpp | 14 ++--- .../tools/detail/polynomial_horner3_7.hpp | 16 ++--- .../tools/detail/polynomial_horner3_8.hpp | 18 +++--- .../tools/detail/polynomial_horner3_9.hpp | 20 +++---- .../math/tools/detail/rational_horner1_10.hpp | 22 +++---- .../math/tools/detail/rational_horner1_11.hpp | 24 ++++---- .../math/tools/detail/rational_horner1_12.hpp | 26 ++++---- .../math/tools/detail/rational_horner1_13.hpp | 28 ++++----- .../math/tools/detail/rational_horner1_14.hpp | 30 +++++----- .../math/tools/detail/rational_horner1_15.hpp | 32 +++++----- .../math/tools/detail/rational_horner1_16.hpp | 34 +++++------ .../math/tools/detail/rational_horner1_17.hpp | 36 +++++------ .../math/tools/detail/rational_horner1_18.hpp | 38 ++++++------ .../math/tools/detail/rational_horner1_19.hpp | 40 ++++++------- .../math/tools/detail/rational_horner1_2.hpp | 6 +- .../math/tools/detail/rational_horner1_20.hpp | 42 ++++++------- .../math/tools/detail/rational_horner1_3.hpp | 8 +-- .../math/tools/detail/rational_horner1_4.hpp | 10 ++-- .../math/tools/detail/rational_horner1_5.hpp | 12 ++-- .../math/tools/detail/rational_horner1_6.hpp | 14 ++--- .../math/tools/detail/rational_horner1_7.hpp | 16 ++--- .../math/tools/detail/rational_horner1_8.hpp | 18 +++--- .../math/tools/detail/rational_horner1_9.hpp | 20 +++---- .../math/tools/detail/rational_horner2_10.hpp | 22 +++---- .../math/tools/detail/rational_horner2_11.hpp | 24 ++++---- .../math/tools/detail/rational_horner2_12.hpp | 26 ++++---- .../math/tools/detail/rational_horner2_13.hpp | 28 ++++----- .../math/tools/detail/rational_horner2_14.hpp | 30 +++++----- .../math/tools/detail/rational_horner2_15.hpp | 32 +++++----- .../math/tools/detail/rational_horner2_16.hpp | 34 +++++------ .../math/tools/detail/rational_horner2_17.hpp | 36 +++++------ .../math/tools/detail/rational_horner2_18.hpp | 38 ++++++------ .../math/tools/detail/rational_horner2_19.hpp | 40 ++++++------- .../math/tools/detail/rational_horner2_2.hpp | 10 ++-- .../math/tools/detail/rational_horner2_20.hpp | 42 ++++++------- .../math/tools/detail/rational_horner2_3.hpp | 10 ++-- .../math/tools/detail/rational_horner2_4.hpp | 10 ++-- .../math/tools/detail/rational_horner2_5.hpp | 12 ++-- .../math/tools/detail/rational_horner2_6.hpp | 14 ++--- .../math/tools/detail/rational_horner2_7.hpp | 16 ++--- .../math/tools/detail/rational_horner2_8.hpp | 18 +++--- .../math/tools/detail/rational_horner2_9.hpp | 20 +++---- .../math/tools/detail/rational_horner3_10.hpp | 22 +++---- .../math/tools/detail/rational_horner3_11.hpp | 24 ++++---- .../math/tools/detail/rational_horner3_12.hpp | 26 ++++---- .../math/tools/detail/rational_horner3_13.hpp | 28 ++++----- .../math/tools/detail/rational_horner3_14.hpp | 30 +++++----- .../math/tools/detail/rational_horner3_15.hpp | 32 +++++----- .../math/tools/detail/rational_horner3_16.hpp | 34 +++++------ .../math/tools/detail/rational_horner3_17.hpp | 36 +++++------ .../math/tools/detail/rational_horner3_18.hpp | 38 ++++++------ .../math/tools/detail/rational_horner3_19.hpp | 40 ++++++------- .../math/tools/detail/rational_horner3_2.hpp | 10 ++-- .../math/tools/detail/rational_horner3_20.hpp | 42 ++++++------- .../math/tools/detail/rational_horner3_3.hpp | 10 ++-- .../math/tools/detail/rational_horner3_4.hpp | 10 ++-- .../math/tools/detail/rational_horner3_5.hpp | 12 ++-- .../math/tools/detail/rational_horner3_6.hpp | 14 ++--- .../math/tools/detail/rational_horner3_7.hpp | 16 ++--- .../math/tools/detail/rational_horner3_8.hpp | 18 +++--- .../math/tools/detail/rational_horner3_9.hpp | 20 +++---- tools/generate_rational_code.cpp | 60 +++++++++---------- 115 files changed, 1410 insertions(+), 1410 deletions(-) diff --git a/include/boost/math/tools/detail/polynomial_horner1_10.hpp b/include/boost/math/tools/detail/polynomial_horner1_10.hpp index 6876af2d2..37e4cba01 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_10.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_10.hpp @@ -12,67 +12,67 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner1_11.hpp b/include/boost/math/tools/detail/polynomial_horner1_11.hpp index a5154c7a6..885490f22 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_11.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_11.hpp @@ -12,73 +12,73 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner1_12.hpp b/include/boost/math/tools/detail/polynomial_horner1_12.hpp index 82bf88c28..f54034592 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_12.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_12.hpp @@ -12,79 +12,79 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner1_13.hpp b/include/boost/math/tools/detail/polynomial_horner1_13.hpp index f61c553dd..e9e13bd52 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_13.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_13.hpp @@ -12,85 +12,85 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner1_14.hpp b/include/boost/math/tools/detail/polynomial_horner1_14.hpp index 76e9f07b2..eaa18bdc5 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_14.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_14.hpp @@ -12,91 +12,91 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner1_15.hpp b/include/boost/math/tools/detail/polynomial_horner1_15.hpp index bca8cf724..c4a880449 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_15.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_15.hpp @@ -12,97 +12,97 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner1_16.hpp b/include/boost/math/tools/detail/polynomial_horner1_16.hpp index 16ddb081d..5c262cc63 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_16.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_16.hpp @@ -12,103 +12,103 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner1_17.hpp b/include/boost/math/tools/detail/polynomial_horner1_17.hpp index 5828621fb..90d49a0bd 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_17.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_17.hpp @@ -12,109 +12,109 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((((((((a[16] * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner1_18.hpp b/include/boost/math/tools/detail/polynomial_horner1_18.hpp index a2a1c12f4..58fb83fd3 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_18.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_18.hpp @@ -12,115 +12,115 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((((((((a[16] * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((((((((a[17] * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner1_19.hpp b/include/boost/math/tools/detail/polynomial_horner1_19.hpp index 83ede26b5..18a6af2d3 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_19.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_19.hpp @@ -12,121 +12,121 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((((((((a[16] * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((((((((a[17] * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((((((((((a[18] * x + a[17]) * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner1_2.hpp b/include/boost/math/tools/detail/polynomial_horner1_2.hpp index 93d0f7c9c..645e3f878 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_2.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_2.hpp @@ -12,19 +12,19 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner1_20.hpp b/include/boost/math/tools/detail/polynomial_horner1_20.hpp index d77020911..47584e787 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_20.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_20.hpp @@ -12,127 +12,127 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((((((((a[16] * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((((((((a[17] * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((((((((((((a[18] * x + a[17]) * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((((((((((((((a[19] * x + a[18]) * x + a[17]) * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner1_3.hpp b/include/boost/math/tools/detail/polynomial_horner1_3.hpp index 0fde1a743..420bbcc28 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_3.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_3.hpp @@ -12,25 +12,25 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner1_4.hpp b/include/boost/math/tools/detail/polynomial_horner1_4.hpp index 9e589791c..930798e74 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_4.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_4.hpp @@ -12,31 +12,31 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner1_5.hpp b/include/boost/math/tools/detail/polynomial_horner1_5.hpp index 64dc00251..b97a8f9eb 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_5.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_5.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner1_6.hpp b/include/boost/math/tools/detail/polynomial_horner1_6.hpp index dbc06347f..6a699f517 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_6.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_6.hpp @@ -12,43 +12,43 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner1_7.hpp b/include/boost/math/tools/detail/polynomial_horner1_7.hpp index 1472b2ede..2aceeeca1 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_7.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_7.hpp @@ -12,49 +12,49 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner1_8.hpp b/include/boost/math/tools/detail/polynomial_horner1_8.hpp index 95edfa0c6..0486d642f 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_8.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_8.hpp @@ -12,55 +12,55 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner1_9.hpp b/include/boost/math/tools/detail/polynomial_horner1_9.hpp index f434a26c4..b0838014b 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_9.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_9.hpp @@ -12,61 +12,61 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner2_10.hpp b/include/boost/math/tools/detail/polynomial_horner2_10.hpp index 1fce239a4..2a680d756 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_10.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_10.hpp @@ -12,72 +12,72 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); diff --git a/include/boost/math/tools/detail/polynomial_horner2_11.hpp b/include/boost/math/tools/detail/polynomial_horner2_11.hpp index 3cf086c3b..7036eec3f 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_11.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_11.hpp @@ -12,79 +12,79 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); diff --git a/include/boost/math/tools/detail/polynomial_horner2_12.hpp b/include/boost/math/tools/detail/polynomial_horner2_12.hpp index e9f8eae7c..fbbf2a3fa 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_12.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_12.hpp @@ -12,86 +12,86 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); diff --git a/include/boost/math/tools/detail/polynomial_horner2_13.hpp b/include/boost/math/tools/detail/polynomial_horner2_13.hpp index d9d2a5e24..46fb3859d 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_13.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_13.hpp @@ -12,93 +12,93 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); diff --git a/include/boost/math/tools/detail/polynomial_horner2_14.hpp b/include/boost/math/tools/detail/polynomial_horner2_14.hpp index b4280597a..d1c326e0f 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_14.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_14.hpp @@ -12,100 +12,100 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); diff --git a/include/boost/math/tools/detail/polynomial_horner2_15.hpp b/include/boost/math/tools/detail/polynomial_horner2_15.hpp index 89a7a46f5..d679cfeaf 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_15.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_15.hpp @@ -12,107 +12,107 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); diff --git a/include/boost/math/tools/detail/polynomial_horner2_16.hpp b/include/boost/math/tools/detail/polynomial_horner2_16.hpp index d2379d2bc..0f3ed8f6c 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_16.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_16.hpp @@ -12,114 +12,114 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); diff --git a/include/boost/math/tools/detail/polynomial_horner2_17.hpp b/include/boost/math/tools/detail/polynomial_horner2_17.hpp index d1921efc4..7783c4c81 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_17.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_17.hpp @@ -12,121 +12,121 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); diff --git a/include/boost/math/tools/detail/polynomial_horner2_18.hpp b/include/boost/math/tools/detail/polynomial_horner2_18.hpp index 945c4e403..4e3b57f98 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_18.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_18.hpp @@ -12,128 +12,128 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((((((a[17] * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); diff --git a/include/boost/math/tools/detail/polynomial_horner2_19.hpp b/include/boost/math/tools/detail/polynomial_horner2_19.hpp index a3049354c..9eca8ef11 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_19.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_19.hpp @@ -12,135 +12,135 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((((((a[17] * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((((((a[18] * x2 + a[16]) * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((((a[17] * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); diff --git a/include/boost/math/tools/detail/polynomial_horner2_2.hpp b/include/boost/math/tools/detail/polynomial_horner2_2.hpp index 8b3a7dcd8..857d43fdb 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_2.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_2.hpp @@ -12,31 +12,31 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner2_20.hpp b/include/boost/math/tools/detail/polynomial_horner2_20.hpp index a4ccc93b3..2a8359025 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_20.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_20.hpp @@ -12,142 +12,142 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((((((a[17] * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((((((((a[18] * x2 + a[16]) * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((((a[17] * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((((((((a[19] * x2 + a[17]) * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((((a[18] * x2 + a[16]) * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); diff --git a/include/boost/math/tools/detail/polynomial_horner2_3.hpp b/include/boost/math/tools/detail/polynomial_horner2_3.hpp index d0b988cf8..b5956cdaf 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_3.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_3.hpp @@ -12,31 +12,31 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner2_4.hpp b/include/boost/math/tools/detail/polynomial_horner2_4.hpp index 7f0708680..9194a1868 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_4.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_4.hpp @@ -12,31 +12,31 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner2_5.hpp b/include/boost/math/tools/detail/polynomial_horner2_5.hpp index f4e7b809b..4e20c214a 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_5.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_5.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); diff --git a/include/boost/math/tools/detail/polynomial_horner2_6.hpp b/include/boost/math/tools/detail/polynomial_horner2_6.hpp index 764e52250..a33168d5e 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_6.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_6.hpp @@ -12,44 +12,44 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); diff --git a/include/boost/math/tools/detail/polynomial_horner2_7.hpp b/include/boost/math/tools/detail/polynomial_horner2_7.hpp index 50fb3333c..2f135756c 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_7.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_7.hpp @@ -12,51 +12,51 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); diff --git a/include/boost/math/tools/detail/polynomial_horner2_8.hpp b/include/boost/math/tools/detail/polynomial_horner2_8.hpp index c74b19d43..4c59602f9 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_8.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_8.hpp @@ -12,58 +12,58 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); diff --git a/include/boost/math/tools/detail/polynomial_horner2_9.hpp b/include/boost/math/tools/detail/polynomial_horner2_9.hpp index 7d6e7e421..0b60c3c04 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_9.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_9.hpp @@ -12,65 +12,65 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); diff --git a/include/boost/math/tools/detail/polynomial_horner3_10.hpp b/include/boost/math/tools/detail/polynomial_horner3_10.hpp index b980b1b3d..3386fcae4 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_10.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_10.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -55,7 +55,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -70,7 +70,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -87,7 +87,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -106,7 +106,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -127,7 +127,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; diff --git a/include/boost/math/tools/detail/polynomial_horner3_11.hpp b/include/boost/math/tools/detail/polynomial_horner3_11.hpp index 2ab4b2ac3..f24ebb024 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_11.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_11.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -55,7 +55,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -70,7 +70,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -87,7 +87,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -106,7 +106,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -127,7 +127,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -150,7 +150,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; diff --git a/include/boost/math/tools/detail/polynomial_horner3_12.hpp b/include/boost/math/tools/detail/polynomial_horner3_12.hpp index 460642727..73916940d 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_12.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_12.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -55,7 +55,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -70,7 +70,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -87,7 +87,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -106,7 +106,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -127,7 +127,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -150,7 +150,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -175,7 +175,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; diff --git a/include/boost/math/tools/detail/polynomial_horner3_13.hpp b/include/boost/math/tools/detail/polynomial_horner3_13.hpp index d35fa904f..44ec9a84c 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_13.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_13.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -55,7 +55,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -70,7 +70,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -87,7 +87,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -106,7 +106,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -127,7 +127,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -150,7 +150,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -175,7 +175,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -202,7 +202,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; diff --git a/include/boost/math/tools/detail/polynomial_horner3_14.hpp b/include/boost/math/tools/detail/polynomial_horner3_14.hpp index 346b9dc28..4d4e9e21c 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_14.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_14.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -55,7 +55,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -70,7 +70,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -87,7 +87,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -106,7 +106,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -127,7 +127,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -150,7 +150,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -175,7 +175,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -202,7 +202,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -231,7 +231,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; diff --git a/include/boost/math/tools/detail/polynomial_horner3_15.hpp b/include/boost/math/tools/detail/polynomial_horner3_15.hpp index 500bc3231..b7cf83dd1 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_15.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_15.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -55,7 +55,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -70,7 +70,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -87,7 +87,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -106,7 +106,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -127,7 +127,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -150,7 +150,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -175,7 +175,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -202,7 +202,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -231,7 +231,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -262,7 +262,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; diff --git a/include/boost/math/tools/detail/polynomial_horner3_16.hpp b/include/boost/math/tools/detail/polynomial_horner3_16.hpp index 269f36739..fbf504f3f 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_16.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_16.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -55,7 +55,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -70,7 +70,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -87,7 +87,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -106,7 +106,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -127,7 +127,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -150,7 +150,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -175,7 +175,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -202,7 +202,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -231,7 +231,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -262,7 +262,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -295,7 +295,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; diff --git a/include/boost/math/tools/detail/polynomial_horner3_17.hpp b/include/boost/math/tools/detail/polynomial_horner3_17.hpp index 1d97a6f15..c7af11b65 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_17.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_17.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -55,7 +55,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -70,7 +70,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -87,7 +87,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -106,7 +106,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -127,7 +127,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -150,7 +150,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -175,7 +175,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -202,7 +202,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -231,7 +231,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -262,7 +262,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -295,7 +295,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -330,7 +330,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; diff --git a/include/boost/math/tools/detail/polynomial_horner3_18.hpp b/include/boost/math/tools/detail/polynomial_horner3_18.hpp index 80e49cbb1..feceac694 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_18.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_18.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -55,7 +55,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -70,7 +70,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -87,7 +87,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -106,7 +106,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -127,7 +127,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -150,7 +150,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -175,7 +175,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -202,7 +202,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -231,7 +231,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -262,7 +262,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -295,7 +295,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -330,7 +330,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -367,7 +367,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; diff --git a/include/boost/math/tools/detail/polynomial_horner3_19.hpp b/include/boost/math/tools/detail/polynomial_horner3_19.hpp index eae3775e0..6a9a4ea6f 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_19.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_19.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -55,7 +55,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -70,7 +70,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -87,7 +87,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -106,7 +106,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -127,7 +127,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -150,7 +150,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -175,7 +175,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -202,7 +202,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -231,7 +231,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -262,7 +262,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -295,7 +295,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -330,7 +330,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -367,7 +367,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -406,7 +406,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; diff --git a/include/boost/math/tools/detail/polynomial_horner3_2.hpp b/include/boost/math/tools/detail/polynomial_horner3_2.hpp index 628167420..69925be1c 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_2.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_2.hpp @@ -12,31 +12,31 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner3_20.hpp b/include/boost/math/tools/detail/polynomial_horner3_20.hpp index 00f8caae2..8dda51139 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_20.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_20.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -55,7 +55,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -70,7 +70,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -87,7 +87,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -106,7 +106,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -127,7 +127,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -150,7 +150,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -175,7 +175,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -202,7 +202,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -231,7 +231,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -262,7 +262,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -295,7 +295,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -330,7 +330,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -367,7 +367,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -406,7 +406,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -447,7 +447,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; diff --git a/include/boost/math/tools/detail/polynomial_horner3_3.hpp b/include/boost/math/tools/detail/polynomial_horner3_3.hpp index 8f69c2bfe..30e68ac2a 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_3.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_3.hpp @@ -12,31 +12,31 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner3_4.hpp b/include/boost/math/tools/detail/polynomial_horner3_4.hpp index 34db81234..e3c9b16f3 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_4.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_4.hpp @@ -12,31 +12,31 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } diff --git a/include/boost/math/tools/detail/polynomial_horner3_5.hpp b/include/boost/math/tools/detail/polynomial_horner3_5.hpp index ed955e4a7..c02467da0 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_5.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_5.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; diff --git a/include/boost/math/tools/detail/polynomial_horner3_6.hpp b/include/boost/math/tools/detail/polynomial_horner3_6.hpp index 96d9a6dda..ad71255bf 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_6.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_6.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -55,7 +55,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; diff --git a/include/boost/math/tools/detail/polynomial_horner3_7.hpp b/include/boost/math/tools/detail/polynomial_horner3_7.hpp index 80a9f3af4..31e0afa66 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_7.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_7.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -55,7 +55,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -70,7 +70,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; diff --git a/include/boost/math/tools/detail/polynomial_horner3_8.hpp b/include/boost/math/tools/detail/polynomial_horner3_8.hpp index ee526ad73..33121b204 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_8.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_8.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -55,7 +55,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -70,7 +70,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -87,7 +87,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; diff --git a/include/boost/math/tools/detail/polynomial_horner3_9.hpp b/include/boost/math/tools/detail/polynomial_horner3_9.hpp index a17ce909c..c9f717133 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_9.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_9.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[1] * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[2] * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -55,7 +55,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -70,7 +70,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -87,7 +87,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; @@ -106,7 +106,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_c } template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { V x2 = x * x; V t[2]; diff --git a/include/boost/math/tools/detail/rational_horner1_10.hpp b/include/boost/math/tools/detail/rational_horner1_10.hpp index 6a04128ca..346ac34ec 100644 --- a/include/boost/math/tools/detail/rational_horner1_10.hpp +++ b/include/boost/math/tools/detail/rational_horner1_10.hpp @@ -12,19 +12,19 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); @@ -36,7 +36,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); @@ -48,7 +48,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); @@ -60,7 +60,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -72,7 +72,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -84,7 +84,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -96,7 +96,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -108,7 +108,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -120,7 +120,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); diff --git a/include/boost/math/tools/detail/rational_horner1_11.hpp b/include/boost/math/tools/detail/rational_horner1_11.hpp index d43e53433..74ed24a74 100644 --- a/include/boost/math/tools/detail/rational_horner1_11.hpp +++ b/include/boost/math/tools/detail/rational_horner1_11.hpp @@ -12,19 +12,19 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); @@ -36,7 +36,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); @@ -48,7 +48,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); @@ -60,7 +60,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -72,7 +72,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -84,7 +84,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -96,7 +96,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -108,7 +108,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -120,7 +120,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -132,7 +132,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); diff --git a/include/boost/math/tools/detail/rational_horner1_12.hpp b/include/boost/math/tools/detail/rational_horner1_12.hpp index 33d19eb38..9072d1698 100644 --- a/include/boost/math/tools/detail/rational_horner1_12.hpp +++ b/include/boost/math/tools/detail/rational_horner1_12.hpp @@ -12,19 +12,19 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); @@ -36,7 +36,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); @@ -48,7 +48,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); @@ -60,7 +60,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -72,7 +72,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -84,7 +84,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -96,7 +96,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -108,7 +108,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -120,7 +120,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -132,7 +132,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -144,7 +144,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); diff --git a/include/boost/math/tools/detail/rational_horner1_13.hpp b/include/boost/math/tools/detail/rational_horner1_13.hpp index 2069aa515..1e5c75092 100644 --- a/include/boost/math/tools/detail/rational_horner1_13.hpp +++ b/include/boost/math/tools/detail/rational_horner1_13.hpp @@ -12,19 +12,19 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); @@ -36,7 +36,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); @@ -48,7 +48,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); @@ -60,7 +60,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -72,7 +72,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -84,7 +84,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -96,7 +96,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -108,7 +108,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -120,7 +120,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -132,7 +132,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -144,7 +144,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -156,7 +156,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((b[12] * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); diff --git a/include/boost/math/tools/detail/rational_horner1_14.hpp b/include/boost/math/tools/detail/rational_horner1_14.hpp index 5ebcde626..75b9bde42 100644 --- a/include/boost/math/tools/detail/rational_horner1_14.hpp +++ b/include/boost/math/tools/detail/rational_horner1_14.hpp @@ -12,19 +12,19 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); @@ -36,7 +36,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); @@ -48,7 +48,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); @@ -60,7 +60,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -72,7 +72,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -84,7 +84,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -96,7 +96,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -108,7 +108,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -120,7 +120,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -132,7 +132,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -144,7 +144,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -156,7 +156,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((b[12] * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -168,7 +168,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((b[13] * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); diff --git a/include/boost/math/tools/detail/rational_horner1_15.hpp b/include/boost/math/tools/detail/rational_horner1_15.hpp index 9da8e1b71..47f18a3c4 100644 --- a/include/boost/math/tools/detail/rational_horner1_15.hpp +++ b/include/boost/math/tools/detail/rational_horner1_15.hpp @@ -12,19 +12,19 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); @@ -36,7 +36,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); @@ -48,7 +48,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); @@ -60,7 +60,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -72,7 +72,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -84,7 +84,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -96,7 +96,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -108,7 +108,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -120,7 +120,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -132,7 +132,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -144,7 +144,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -156,7 +156,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((b[12] * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -168,7 +168,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((b[13] * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -180,7 +180,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((b[14] * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); diff --git a/include/boost/math/tools/detail/rational_horner1_16.hpp b/include/boost/math/tools/detail/rational_horner1_16.hpp index 203ba7819..fec9a51a2 100644 --- a/include/boost/math/tools/detail/rational_horner1_16.hpp +++ b/include/boost/math/tools/detail/rational_horner1_16.hpp @@ -12,19 +12,19 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); @@ -36,7 +36,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); @@ -48,7 +48,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); @@ -60,7 +60,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -72,7 +72,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -84,7 +84,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -96,7 +96,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -108,7 +108,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -120,7 +120,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -132,7 +132,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -144,7 +144,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -156,7 +156,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((b[12] * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -168,7 +168,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((b[13] * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -180,7 +180,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((b[14] * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -192,7 +192,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((b[15] * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); diff --git a/include/boost/math/tools/detail/rational_horner1_17.hpp b/include/boost/math/tools/detail/rational_horner1_17.hpp index e382d2931..b26dac95c 100644 --- a/include/boost/math/tools/detail/rational_horner1_17.hpp +++ b/include/boost/math/tools/detail/rational_horner1_17.hpp @@ -12,19 +12,19 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); @@ -36,7 +36,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); @@ -48,7 +48,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); @@ -60,7 +60,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -72,7 +72,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -84,7 +84,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -96,7 +96,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -108,7 +108,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -120,7 +120,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -132,7 +132,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -144,7 +144,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -156,7 +156,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((b[12] * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -168,7 +168,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((b[13] * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -180,7 +180,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((b[14] * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -192,7 +192,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((b[15] * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -204,7 +204,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((((((((((((a[16] * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((((b[16] * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); diff --git a/include/boost/math/tools/detail/rational_horner1_18.hpp b/include/boost/math/tools/detail/rational_horner1_18.hpp index 66f668ee3..074a6359b 100644 --- a/include/boost/math/tools/detail/rational_horner1_18.hpp +++ b/include/boost/math/tools/detail/rational_horner1_18.hpp @@ -12,19 +12,19 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); @@ -36,7 +36,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); @@ -48,7 +48,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); @@ -60,7 +60,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -72,7 +72,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -84,7 +84,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -96,7 +96,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -108,7 +108,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -120,7 +120,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -132,7 +132,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -144,7 +144,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -156,7 +156,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((b[12] * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -168,7 +168,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((b[13] * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -180,7 +180,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((b[14] * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -192,7 +192,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((b[15] * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -204,7 +204,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((((((((((((a[16] * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((((b[16] * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -216,7 +216,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((((((((((((a[17] * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((((b[17] * x + b[16]) * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); diff --git a/include/boost/math/tools/detail/rational_horner1_19.hpp b/include/boost/math/tools/detail/rational_horner1_19.hpp index 9cd139143..a1cceaeab 100644 --- a/include/boost/math/tools/detail/rational_horner1_19.hpp +++ b/include/boost/math/tools/detail/rational_horner1_19.hpp @@ -12,19 +12,19 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); @@ -36,7 +36,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); @@ -48,7 +48,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); @@ -60,7 +60,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -72,7 +72,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -84,7 +84,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -96,7 +96,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -108,7 +108,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -120,7 +120,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -132,7 +132,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -144,7 +144,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -156,7 +156,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((b[12] * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -168,7 +168,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((b[13] * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -180,7 +180,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((b[14] * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -192,7 +192,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((b[15] * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -204,7 +204,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((((((((((((a[16] * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((((b[16] * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -216,7 +216,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((((((((((((a[17] * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((((b[17] * x + b[16]) * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -228,7 +228,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((((((((((((((a[18] * x + a[17]) * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((((((b[18] * x + b[17]) * x + b[16]) * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); diff --git a/include/boost/math/tools/detail/rational_horner1_2.hpp b/include/boost/math/tools/detail/rational_horner1_2.hpp index f42cbfc64..81250ba10 100644 --- a/include/boost/math/tools/detail/rational_horner1_2.hpp +++ b/include/boost/math/tools/detail/rational_horner1_2.hpp @@ -12,19 +12,19 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); diff --git a/include/boost/math/tools/detail/rational_horner1_20.hpp b/include/boost/math/tools/detail/rational_horner1_20.hpp index 0a6c2a0f2..63763fd8c 100644 --- a/include/boost/math/tools/detail/rational_horner1_20.hpp +++ b/include/boost/math/tools/detail/rational_horner1_20.hpp @@ -12,19 +12,19 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); @@ -36,7 +36,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); @@ -48,7 +48,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); @@ -60,7 +60,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -72,7 +72,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -84,7 +84,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -96,7 +96,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -108,7 +108,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -120,7 +120,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -132,7 +132,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -144,7 +144,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -156,7 +156,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((b[12] * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -168,7 +168,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((b[13] * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -180,7 +180,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((b[14] * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -192,7 +192,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((b[15] * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -204,7 +204,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((((((((((((a[16] * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((((b[16] * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -216,7 +216,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((((((((((((a[17] * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((((b[17] * x + b[16]) * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -228,7 +228,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((((((((((((((a[18] * x + a[17]) * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((((((b[18] * x + b[17]) * x + b[16]) * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -240,7 +240,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((((((((((((((a[19] * x + a[18]) * x + a[17]) * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((((((b[19] * x + b[18]) * x + b[17]) * x + b[16]) * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); diff --git a/include/boost/math/tools/detail/rational_horner1_3.hpp b/include/boost/math/tools/detail/rational_horner1_3.hpp index d0ab213b3..1aebe20d3 100644 --- a/include/boost/math/tools/detail/rational_horner1_3.hpp +++ b/include/boost/math/tools/detail/rational_horner1_3.hpp @@ -12,19 +12,19 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); @@ -36,7 +36,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); diff --git a/include/boost/math/tools/detail/rational_horner1_4.hpp b/include/boost/math/tools/detail/rational_horner1_4.hpp index 44f40114a..8175f348c 100644 --- a/include/boost/math/tools/detail/rational_horner1_4.hpp +++ b/include/boost/math/tools/detail/rational_horner1_4.hpp @@ -12,19 +12,19 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); @@ -36,7 +36,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); @@ -48,7 +48,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); diff --git a/include/boost/math/tools/detail/rational_horner1_5.hpp b/include/boost/math/tools/detail/rational_horner1_5.hpp index db032f15e..93c11c1ef 100644 --- a/include/boost/math/tools/detail/rational_horner1_5.hpp +++ b/include/boost/math/tools/detail/rational_horner1_5.hpp @@ -12,19 +12,19 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); @@ -36,7 +36,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); @@ -48,7 +48,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); @@ -60,7 +60,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); diff --git a/include/boost/math/tools/detail/rational_horner1_6.hpp b/include/boost/math/tools/detail/rational_horner1_6.hpp index 4de5143ca..a59cceb24 100644 --- a/include/boost/math/tools/detail/rational_horner1_6.hpp +++ b/include/boost/math/tools/detail/rational_horner1_6.hpp @@ -12,19 +12,19 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); @@ -36,7 +36,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); @@ -48,7 +48,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); @@ -60,7 +60,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -72,7 +72,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); diff --git a/include/boost/math/tools/detail/rational_horner1_7.hpp b/include/boost/math/tools/detail/rational_horner1_7.hpp index 7d4ef69e9..eaa023a50 100644 --- a/include/boost/math/tools/detail/rational_horner1_7.hpp +++ b/include/boost/math/tools/detail/rational_horner1_7.hpp @@ -12,19 +12,19 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); @@ -36,7 +36,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); @@ -48,7 +48,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); @@ -60,7 +60,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -72,7 +72,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -84,7 +84,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); diff --git a/include/boost/math/tools/detail/rational_horner1_8.hpp b/include/boost/math/tools/detail/rational_horner1_8.hpp index bf4d7f57e..5624c814f 100644 --- a/include/boost/math/tools/detail/rational_horner1_8.hpp +++ b/include/boost/math/tools/detail/rational_horner1_8.hpp @@ -12,19 +12,19 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); @@ -36,7 +36,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); @@ -48,7 +48,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); @@ -60,7 +60,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -72,7 +72,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -84,7 +84,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -96,7 +96,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); diff --git a/include/boost/math/tools/detail/rational_horner1_9.hpp b/include/boost/math/tools/detail/rational_horner1_9.hpp index cf3be7f82..c94e7ed42 100644 --- a/include/boost/math/tools/detail/rational_horner1_9.hpp +++ b/include/boost/math/tools/detail/rational_horner1_9.hpp @@ -12,19 +12,19 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); @@ -36,7 +36,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); @@ -48,7 +48,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); @@ -60,7 +60,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -72,7 +72,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -84,7 +84,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -96,7 +96,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); @@ -108,7 +108,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); diff --git a/include/boost/math/tools/detail/rational_horner2_10.hpp b/include/boost/math/tools/detail/rational_horner2_10.hpp index 1a59aa334..0e4fd54ea 100644 --- a/include/boost/math/tools/detail/rational_horner2_10.hpp +++ b/include/boost/math/tools/detail/rational_horner2_10.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -58,7 +58,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -74,7 +74,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -90,7 +90,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -106,7 +106,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -122,7 +122,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { diff --git a/include/boost/math/tools/detail/rational_horner2_11.hpp b/include/boost/math/tools/detail/rational_horner2_11.hpp index 1333a40bc..841c8bd49 100644 --- a/include/boost/math/tools/detail/rational_horner2_11.hpp +++ b/include/boost/math/tools/detail/rational_horner2_11.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -58,7 +58,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -74,7 +74,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -90,7 +90,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -106,7 +106,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -122,7 +122,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -138,7 +138,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { diff --git a/include/boost/math/tools/detail/rational_horner2_12.hpp b/include/boost/math/tools/detail/rational_horner2_12.hpp index a37cf5a05..3e783c577 100644 --- a/include/boost/math/tools/detail/rational_horner2_12.hpp +++ b/include/boost/math/tools/detail/rational_horner2_12.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -58,7 +58,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -74,7 +74,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -90,7 +90,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -106,7 +106,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -122,7 +122,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -138,7 +138,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -154,7 +154,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { diff --git a/include/boost/math/tools/detail/rational_horner2_13.hpp b/include/boost/math/tools/detail/rational_horner2_13.hpp index 648f3079c..a3afa653d 100644 --- a/include/boost/math/tools/detail/rational_horner2_13.hpp +++ b/include/boost/math/tools/detail/rational_horner2_13.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -58,7 +58,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -74,7 +74,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -90,7 +90,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -106,7 +106,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -122,7 +122,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -138,7 +138,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -154,7 +154,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -170,7 +170,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { diff --git a/include/boost/math/tools/detail/rational_horner2_14.hpp b/include/boost/math/tools/detail/rational_horner2_14.hpp index 7771c3da9..377c1ad42 100644 --- a/include/boost/math/tools/detail/rational_horner2_14.hpp +++ b/include/boost/math/tools/detail/rational_horner2_14.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -58,7 +58,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -74,7 +74,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -90,7 +90,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -106,7 +106,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -122,7 +122,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -138,7 +138,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -154,7 +154,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -170,7 +170,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -186,7 +186,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { diff --git a/include/boost/math/tools/detail/rational_horner2_15.hpp b/include/boost/math/tools/detail/rational_horner2_15.hpp index 03fae0d94..9082d03f8 100644 --- a/include/boost/math/tools/detail/rational_horner2_15.hpp +++ b/include/boost/math/tools/detail/rational_horner2_15.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -58,7 +58,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -74,7 +74,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -90,7 +90,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -106,7 +106,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -122,7 +122,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -138,7 +138,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -154,7 +154,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -170,7 +170,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -186,7 +186,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -202,7 +202,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { diff --git a/include/boost/math/tools/detail/rational_horner2_16.hpp b/include/boost/math/tools/detail/rational_horner2_16.hpp index d8565e104..64173bffe 100644 --- a/include/boost/math/tools/detail/rational_horner2_16.hpp +++ b/include/boost/math/tools/detail/rational_horner2_16.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -58,7 +58,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -74,7 +74,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -90,7 +90,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -106,7 +106,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -122,7 +122,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -138,7 +138,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -154,7 +154,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -170,7 +170,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -186,7 +186,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -202,7 +202,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -218,7 +218,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { diff --git a/include/boost/math/tools/detail/rational_horner2_17.hpp b/include/boost/math/tools/detail/rational_horner2_17.hpp index bd8990e0c..5ae8cb428 100644 --- a/include/boost/math/tools/detail/rational_horner2_17.hpp +++ b/include/boost/math/tools/detail/rational_horner2_17.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -58,7 +58,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -74,7 +74,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -90,7 +90,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -106,7 +106,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -122,7 +122,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -138,7 +138,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -154,7 +154,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -170,7 +170,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -186,7 +186,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -202,7 +202,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -218,7 +218,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -234,7 +234,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { diff --git a/include/boost/math/tools/detail/rational_horner2_18.hpp b/include/boost/math/tools/detail/rational_horner2_18.hpp index 38b99ecf1..ebe440e62 100644 --- a/include/boost/math/tools/detail/rational_horner2_18.hpp +++ b/include/boost/math/tools/detail/rational_horner2_18.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -58,7 +58,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -74,7 +74,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -90,7 +90,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -106,7 +106,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -122,7 +122,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -138,7 +138,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -154,7 +154,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -170,7 +170,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -186,7 +186,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -202,7 +202,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -218,7 +218,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -234,7 +234,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -250,7 +250,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { diff --git a/include/boost/math/tools/detail/rational_horner2_19.hpp b/include/boost/math/tools/detail/rational_horner2_19.hpp index b77d2eb0b..c1a2d4383 100644 --- a/include/boost/math/tools/detail/rational_horner2_19.hpp +++ b/include/boost/math/tools/detail/rational_horner2_19.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -58,7 +58,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -74,7 +74,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -90,7 +90,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -106,7 +106,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -122,7 +122,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -138,7 +138,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -154,7 +154,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -170,7 +170,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -186,7 +186,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -202,7 +202,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -218,7 +218,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -234,7 +234,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -250,7 +250,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -266,7 +266,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { diff --git a/include/boost/math/tools/detail/rational_horner2_2.hpp b/include/boost/math/tools/detail/rational_horner2_2.hpp index 9c4fe47a7..e1dd400ae 100644 --- a/include/boost/math/tools/detail/rational_horner2_2.hpp +++ b/include/boost/math/tools/detail/rational_horner2_2.hpp @@ -12,31 +12,31 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } diff --git a/include/boost/math/tools/detail/rational_horner2_20.hpp b/include/boost/math/tools/detail/rational_horner2_20.hpp index 485639dce..50a63c128 100644 --- a/include/boost/math/tools/detail/rational_horner2_20.hpp +++ b/include/boost/math/tools/detail/rational_horner2_20.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -58,7 +58,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -74,7 +74,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -90,7 +90,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -106,7 +106,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -122,7 +122,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -138,7 +138,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -154,7 +154,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -170,7 +170,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -186,7 +186,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -202,7 +202,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -218,7 +218,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -234,7 +234,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -250,7 +250,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -266,7 +266,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -282,7 +282,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { diff --git a/include/boost/math/tools/detail/rational_horner2_3.hpp b/include/boost/math/tools/detail/rational_horner2_3.hpp index d19993cce..ab0d029aa 100644 --- a/include/boost/math/tools/detail/rational_horner2_3.hpp +++ b/include/boost/math/tools/detail/rational_horner2_3.hpp @@ -12,31 +12,31 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } diff --git a/include/boost/math/tools/detail/rational_horner2_4.hpp b/include/boost/math/tools/detail/rational_horner2_4.hpp index 847f26dc4..147f5d1da 100644 --- a/include/boost/math/tools/detail/rational_horner2_4.hpp +++ b/include/boost/math/tools/detail/rational_horner2_4.hpp @@ -12,31 +12,31 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } diff --git a/include/boost/math/tools/detail/rational_horner2_5.hpp b/include/boost/math/tools/detail/rational_horner2_5.hpp index 8633d5dc1..db5907b6f 100644 --- a/include/boost/math/tools/detail/rational_horner2_5.hpp +++ b/include/boost/math/tools/detail/rational_horner2_5.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { diff --git a/include/boost/math/tools/detail/rational_horner2_6.hpp b/include/boost/math/tools/detail/rational_horner2_6.hpp index 455542633..b71bc150a 100644 --- a/include/boost/math/tools/detail/rational_horner2_6.hpp +++ b/include/boost/math/tools/detail/rational_horner2_6.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -58,7 +58,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { diff --git a/include/boost/math/tools/detail/rational_horner2_7.hpp b/include/boost/math/tools/detail/rational_horner2_7.hpp index 6a5c704d1..da5b1476a 100644 --- a/include/boost/math/tools/detail/rational_horner2_7.hpp +++ b/include/boost/math/tools/detail/rational_horner2_7.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -58,7 +58,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -74,7 +74,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { diff --git a/include/boost/math/tools/detail/rational_horner2_8.hpp b/include/boost/math/tools/detail/rational_horner2_8.hpp index 9ec861fc5..b047ad948 100644 --- a/include/boost/math/tools/detail/rational_horner2_8.hpp +++ b/include/boost/math/tools/detail/rational_horner2_8.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -58,7 +58,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -74,7 +74,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -90,7 +90,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { diff --git a/include/boost/math/tools/detail/rational_horner2_9.hpp b/include/boost/math/tools/detail/rational_horner2_9.hpp index c76755cb2..4eed1c430 100644 --- a/include/boost/math/tools/detail/rational_horner2_9.hpp +++ b/include/boost/math/tools/detail/rational_horner2_9.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -58,7 +58,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -74,7 +74,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -90,7 +90,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -106,7 +106,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { diff --git a/include/boost/math/tools/detail/rational_horner3_10.hpp b/include/boost/math/tools/detail/rational_horner3_10.hpp index 773532cd5..1fe94f8e3 100644 --- a/include/boost/math/tools/detail/rational_horner3_10.hpp +++ b/include/boost/math/tools/detail/rational_horner3_10.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -80,7 +80,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -126,7 +126,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -180,7 +180,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -242,7 +242,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -312,7 +312,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { diff --git a/include/boost/math/tools/detail/rational_horner3_11.hpp b/include/boost/math/tools/detail/rational_horner3_11.hpp index a712fff09..1a4277a82 100644 --- a/include/boost/math/tools/detail/rational_horner3_11.hpp +++ b/include/boost/math/tools/detail/rational_horner3_11.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -80,7 +80,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -126,7 +126,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -180,7 +180,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -242,7 +242,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -312,7 +312,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -390,7 +390,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { diff --git a/include/boost/math/tools/detail/rational_horner3_12.hpp b/include/boost/math/tools/detail/rational_horner3_12.hpp index 5b87374ab..5deb0f374 100644 --- a/include/boost/math/tools/detail/rational_horner3_12.hpp +++ b/include/boost/math/tools/detail/rational_horner3_12.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -80,7 +80,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -126,7 +126,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -180,7 +180,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -242,7 +242,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -312,7 +312,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -390,7 +390,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -476,7 +476,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { diff --git a/include/boost/math/tools/detail/rational_horner3_13.hpp b/include/boost/math/tools/detail/rational_horner3_13.hpp index 11591668b..6c6857f31 100644 --- a/include/boost/math/tools/detail/rational_horner3_13.hpp +++ b/include/boost/math/tools/detail/rational_horner3_13.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -80,7 +80,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -126,7 +126,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -180,7 +180,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -242,7 +242,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -312,7 +312,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -390,7 +390,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -476,7 +476,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -570,7 +570,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { diff --git a/include/boost/math/tools/detail/rational_horner3_14.hpp b/include/boost/math/tools/detail/rational_horner3_14.hpp index 04f31249d..1aadb35de 100644 --- a/include/boost/math/tools/detail/rational_horner3_14.hpp +++ b/include/boost/math/tools/detail/rational_horner3_14.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -80,7 +80,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -126,7 +126,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -180,7 +180,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -242,7 +242,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -312,7 +312,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -390,7 +390,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -476,7 +476,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -570,7 +570,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -672,7 +672,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { diff --git a/include/boost/math/tools/detail/rational_horner3_15.hpp b/include/boost/math/tools/detail/rational_horner3_15.hpp index 4b9cffd48..0f79e5b0d 100644 --- a/include/boost/math/tools/detail/rational_horner3_15.hpp +++ b/include/boost/math/tools/detail/rational_horner3_15.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -80,7 +80,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -126,7 +126,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -180,7 +180,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -242,7 +242,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -312,7 +312,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -390,7 +390,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -476,7 +476,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -570,7 +570,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -672,7 +672,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -782,7 +782,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { diff --git a/include/boost/math/tools/detail/rational_horner3_16.hpp b/include/boost/math/tools/detail/rational_horner3_16.hpp index 3a384dcc5..b7c6e96c1 100644 --- a/include/boost/math/tools/detail/rational_horner3_16.hpp +++ b/include/boost/math/tools/detail/rational_horner3_16.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -80,7 +80,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -126,7 +126,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -180,7 +180,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -242,7 +242,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -312,7 +312,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -390,7 +390,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -476,7 +476,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -570,7 +570,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -672,7 +672,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -782,7 +782,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -900,7 +900,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { diff --git a/include/boost/math/tools/detail/rational_horner3_17.hpp b/include/boost/math/tools/detail/rational_horner3_17.hpp index 1c9435e74..25328e7ff 100644 --- a/include/boost/math/tools/detail/rational_horner3_17.hpp +++ b/include/boost/math/tools/detail/rational_horner3_17.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -80,7 +80,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -126,7 +126,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -180,7 +180,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -242,7 +242,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -312,7 +312,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -390,7 +390,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -476,7 +476,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -570,7 +570,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -672,7 +672,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -782,7 +782,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -900,7 +900,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -1026,7 +1026,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { diff --git a/include/boost/math/tools/detail/rational_horner3_18.hpp b/include/boost/math/tools/detail/rational_horner3_18.hpp index b133e2baf..335b895c4 100644 --- a/include/boost/math/tools/detail/rational_horner3_18.hpp +++ b/include/boost/math/tools/detail/rational_horner3_18.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -80,7 +80,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -126,7 +126,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -180,7 +180,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -242,7 +242,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -312,7 +312,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -390,7 +390,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -476,7 +476,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -570,7 +570,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -672,7 +672,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -782,7 +782,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -900,7 +900,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -1026,7 +1026,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -1160,7 +1160,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { diff --git a/include/boost/math/tools/detail/rational_horner3_19.hpp b/include/boost/math/tools/detail/rational_horner3_19.hpp index ca35d3b68..22d24403e 100644 --- a/include/boost/math/tools/detail/rational_horner3_19.hpp +++ b/include/boost/math/tools/detail/rational_horner3_19.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -80,7 +80,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -126,7 +126,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -180,7 +180,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -242,7 +242,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -312,7 +312,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -390,7 +390,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -476,7 +476,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -570,7 +570,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -672,7 +672,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -782,7 +782,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -900,7 +900,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -1026,7 +1026,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -1160,7 +1160,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -1302,7 +1302,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { diff --git a/include/boost/math/tools/detail/rational_horner3_2.hpp b/include/boost/math/tools/detail/rational_horner3_2.hpp index 9c4fe47a7..e1dd400ae 100644 --- a/include/boost/math/tools/detail/rational_horner3_2.hpp +++ b/include/boost/math/tools/detail/rational_horner3_2.hpp @@ -12,31 +12,31 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } diff --git a/include/boost/math/tools/detail/rational_horner3_20.hpp b/include/boost/math/tools/detail/rational_horner3_20.hpp index 58109ac30..f97124afb 100644 --- a/include/boost/math/tools/detail/rational_horner3_20.hpp +++ b/include/boost/math/tools/detail/rational_horner3_20.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -80,7 +80,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -126,7 +126,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -180,7 +180,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -242,7 +242,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -312,7 +312,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -390,7 +390,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -476,7 +476,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -570,7 +570,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -672,7 +672,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -782,7 +782,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -900,7 +900,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -1026,7 +1026,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -1160,7 +1160,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -1302,7 +1302,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -1452,7 +1452,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { diff --git a/include/boost/math/tools/detail/rational_horner3_3.hpp b/include/boost/math/tools/detail/rational_horner3_3.hpp index d19993cce..ab0d029aa 100644 --- a/include/boost/math/tools/detail/rational_horner3_3.hpp +++ b/include/boost/math/tools/detail/rational_horner3_3.hpp @@ -12,31 +12,31 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } diff --git a/include/boost/math/tools/detail/rational_horner3_4.hpp b/include/boost/math/tools/detail/rational_horner3_4.hpp index 847f26dc4..147f5d1da 100644 --- a/include/boost/math/tools/detail/rational_horner3_4.hpp +++ b/include/boost/math/tools/detail/rational_horner3_4.hpp @@ -12,31 +12,31 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } diff --git a/include/boost/math/tools/detail/rational_horner3_5.hpp b/include/boost/math/tools/detail/rational_horner3_5.hpp index cc77fd560..af1c76f1c 100644 --- a/include/boost/math/tools/detail/rational_horner3_5.hpp +++ b/include/boost/math/tools/detail/rational_horner3_5.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { diff --git a/include/boost/math/tools/detail/rational_horner3_6.hpp b/include/boost/math/tools/detail/rational_horner3_6.hpp index 73920ad01..05d626ac8 100644 --- a/include/boost/math/tools/detail/rational_horner3_6.hpp +++ b/include/boost/math/tools/detail/rational_horner3_6.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -80,7 +80,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { diff --git a/include/boost/math/tools/detail/rational_horner3_7.hpp b/include/boost/math/tools/detail/rational_horner3_7.hpp index 8e30ecf31..2d91a5c50 100644 --- a/include/boost/math/tools/detail/rational_horner3_7.hpp +++ b/include/boost/math/tools/detail/rational_horner3_7.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -80,7 +80,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -126,7 +126,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { diff --git a/include/boost/math/tools/detail/rational_horner3_8.hpp b/include/boost/math/tools/detail/rational_horner3_8.hpp index a8f93f3a3..3a6ea4ff0 100644 --- a/include/boost/math/tools/detail/rational_horner3_8.hpp +++ b/include/boost/math/tools/detail/rational_horner3_8.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -80,7 +80,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -126,7 +126,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -180,7 +180,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { diff --git a/include/boost/math/tools/detail/rational_horner3_9.hpp b/include/boost/math/tools/detail/rational_horner3_9.hpp index 064d984d3..d20149b22 100644 --- a/include/boost/math/tools/detail/rational_horner3_9.hpp +++ b/include/boost/math/tools/detail/rational_horner3_9.hpp @@ -12,37 +12,37 @@ namespace boost{ namespace math{ namespace tools{ namespace detail{ template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(0); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(a[0]) / static_cast(b[0]); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -80,7 +80,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -126,7 +126,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -180,7 +180,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { @@ -242,7 +242,7 @@ inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std:: } template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*) BOOST_MATH_NOEXCEPT(V) { if((-1 <= x) && (x <= 1)) { diff --git a/tools/generate_rational_code.cpp b/tools/generate_rational_code.cpp index 2da7e000e..92b7da9a1 100644 --- a/tools/generate_rational_code.cpp +++ b/tools/generate_rational_code.cpp @@ -40,13 +40,13 @@ void print_polynomials(int max_order) "#define BOOST_MATH_TOOLS_POLY_EVAL_" << i << "_HPP\n\n" "namespace boost{ namespace math{ namespace tools{ namespace detail{\n\n" "template \n" - "inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*)\n" + "BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*)\n" "{\n" " return static_cast(0);\n" "}\n" "\n" "template \n" - "inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*)\n" + "BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*)\n" "{\n" " return static_cast(a[0]);\n" "}\n\n"; @@ -55,7 +55,7 @@ void print_polynomials(int max_order) { ofs << "template \n" - "inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*)\n" + "BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*)\n" "{\n" " return static_cast("; @@ -90,28 +90,28 @@ void print_polynomials(int max_order) "#define BOOST_MATH_TOOLS_POLY_EVAL_" << i << "_HPP\n\n" "namespace boost{ namespace math{ namespace tools{ namespace detail{\n\n" "template \n" - "inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*)\n" + "BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*)\n" "{\n" " return static_cast(0);\n" "}\n" "\n" "template \n" - "inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*)\n" + "BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*)\n" "{\n" " return static_cast(a[0]);\n" "}\n\n" "template \n" - "inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*)\n" + "BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*)\n" "{\n" " return static_cast(a[1] * x + a[0]);\n" "}\n\n" "template \n" - "inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*)\n" + "BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*)\n" "{\n" " return static_cast((a[2] * x + a[1]) * x + a[0]);\n" "}\n\n" "template \n" - "inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*)\n" + "BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*)\n" "{\n" " return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);\n" "}\n\n"; @@ -120,7 +120,7 @@ void print_polynomials(int max_order) { ofs << "template \n" - "inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*)\n" + "BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*)\n" "{\n" " V x2 = x * x;\n" " return static_cast("; @@ -186,28 +186,28 @@ void print_polynomials(int max_order) "#define BOOST_MATH_TOOLS_POLY_EVAL_" << i << "_HPP\n\n" "namespace boost{ namespace math{ namespace tools{ namespace detail{\n\n" "template \n" - "inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*)\n" + "BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T*, const V&, const std::integral_constant*)\n" "{\n" " return static_cast(0);\n" "}\n" "\n" "template \n" - "inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*)\n" + "BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V&, const std::integral_constant*)\n" "{\n" " return static_cast(a[0]);\n" "}\n\n" "template \n" - "inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*)\n" + "BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*)\n" "{\n" " return static_cast(a[1] * x + a[0]);\n" "}\n\n" "template \n" - "inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*)\n" + "BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*)\n" "{\n" " return static_cast((a[2] * x + a[1]) * x + a[0]);\n" "}\n\n" "template \n" - "inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*)\n" + "BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*)\n" "{\n" " return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);\n" "}\n\n"; @@ -216,7 +216,7 @@ void print_polynomials(int max_order) { ofs << "template \n" - "inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*)\n" + "BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& x, const std::integral_constant*)\n" "{\n" " V x2 = x * x;\n" " V t[2];\n"; @@ -281,13 +281,13 @@ void print_rationals(int max_order) "#define BOOST_MATH_TOOLS_POLY_RAT_" << i << "_HPP\n\n" "namespace boost{ namespace math{ namespace tools{ namespace detail{\n\n" "template \n" - "inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*)\n" + "BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*)\n" "{\n" " return static_cast(0);\n" "}\n" "\n" "template \n" - "inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*)\n" + "BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*)\n" "{\n" " return static_cast(a[0]) / static_cast(b[0]);\n" "}\n\n"; @@ -296,7 +296,7 @@ void print_rationals(int max_order) { ofs << "template \n" - "inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*)\n" + "BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*)\n" "{\n" " if((-1 <= x) && (x <= 1))\n" " return static_cast(("; @@ -361,28 +361,28 @@ void print_rationals(int max_order) "#define BOOST_MATH_TOOLS_RAT_EVAL_" << i << "_HPP\n\n" "namespace boost{ namespace math{ namespace tools{ namespace detail{\n\n" "template \n" - "inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*)\n" + "BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*)\n" "{\n" " return static_cast(0);\n" "}\n" "\n" "template \n" - "inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*)\n" + "BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*)\n" "{\n" " return static_cast(a[0]) / static_cast(b[0]);\n" "}\n\n" "template \n" - "inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*)\n" + "BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*)\n" "{\n" " return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0]));\n" "}\n\n" "template \n" - "inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*)\n" + "BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*)\n" "{\n" " return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));\n" "}\n\n" "template \n" - "inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*)\n" + "BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*)\n" "{\n" " return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0]));\n" "}\n\n"; @@ -391,7 +391,7 @@ void print_rationals(int max_order) { ofs << "template \n" - "inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*)\n" + "BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*)\n" "{\n" " if((-1 <= x) && (x <= 1))\n {\n" " V x2 = x * x;\n" @@ -577,28 +577,28 @@ void print_rationals(int max_order) "#define BOOST_MATH_TOOLS_RAT_EVAL_" << i << "_HPP\n\n" "namespace boost{ namespace math{ namespace tools{ namespace detail{\n\n" "template \n" - "inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*)\n" + "BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant*)\n" "{\n" " return static_cast(0);\n" "}\n" "\n" "template \n" - "inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*)\n" + "BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant*)\n" "{\n" " return static_cast(a[0]) / static_cast(b[0]);\n" "}\n\n" "template \n" - "inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*)\n" + "BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*)\n" "{\n" " return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0]));\n" "}\n\n" "template \n" - "inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*)\n" + "BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*)\n" "{\n" " return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));\n" "}\n\n" "template \n" - "inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*)\n" + "BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*)\n" "{\n" " return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0]));\n" "}\n\n"; @@ -607,7 +607,7 @@ void print_rationals(int max_order) { ofs << "template \n" - "inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*)\n" + "BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant*)\n" "{\n" " if((-1 <= x) && (x <= 1))\n {\n" " V x2 = x * x;\n" From fcea5cc2f721189d0eb2e366059e4c3bb113f08e Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Mon, 22 Jul 2024 15:00:18 -0400 Subject: [PATCH 45/64] Add additional overflow error overloads --- .../boost/math/policies/error_handling.hpp | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/include/boost/math/policies/error_handling.hpp b/include/boost/math/policies/error_handling.hpp index 2c67f251c..6509b47c3 100644 --- a/include/boost/math/policies/error_handling.hpp +++ b/include/boost/math/policies/error_handling.hpp @@ -337,6 +337,32 @@ BOOST_MATH_GPU_ENABLED constexpr T raise_overflow_error( return std::numeric_limits::has_infinity ? std::numeric_limits::infinity() : boost::math::tools::max_value(); } +#ifdef BOOST_MATH_HAS_GPU_SUPPORT + +template <> +BOOST_MATH_GPU_ENABLED constexpr float raise_overflow_error( + const char* , + const char* , + const ::boost::math::policies::overflow_error< ::boost::math::policies::ignore_error>&) BOOST_MATH_NOEXCEPT(float) +{ + // This may or may not do the right thing, but the user asked for the error + // to be ignored so here we go anyway: + return static_cast(INFINITY); +} + +template <> +BOOST_MATH_GPU_ENABLED constexpr double raise_overflow_error( + const char* , + const char* , + const ::boost::math::policies::overflow_error< ::boost::math::policies::ignore_error>&) BOOST_MATH_NOEXCEPT(double) +{ + // This may or may not do the right thing, but the user asked for the error + // to be ignored so here we go anyway: + return INFINITY; +} + +#endif + template BOOST_MATH_GPU_ENABLED constexpr T raise_overflow_error( const char* , From 3cbf2ab2ac3fbb570133743396ec0e73db2d7923 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Mon, 22 Jul 2024 15:00:38 -0400 Subject: [PATCH 46/64] Add no promote policy --- test/cuda_jamfile | 2 +- test/test_beta_double.cu | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/test/cuda_jamfile b/test/cuda_jamfile index 2798d5f40..c6ce3d002 100644 --- a/test/cuda_jamfile +++ b/test/cuda_jamfile @@ -26,5 +26,5 @@ run test_arcsine_quan_float.cu ; run test_binomial.cpp ; # Special Functions -run test_beta_simple.cpp ; +# run test_beta_simple.cpp ; run test_beta_double.cu ; diff --git a/test/test_beta_double.cu b/test/test_beta_double.cu index 58ccaf9ef..cd5860158 100644 --- a/test/test_beta_double.cu +++ b/test/test_beta_double.cu @@ -4,6 +4,7 @@ // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error +#define BOOST_MATH_PROMOTE_DOUBLE_POLICY false #include #include From 79769e63d28afb7f5dbc348f79b7f8679d787a54 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Mon, 22 Jul 2024 15:00:55 -0400 Subject: [PATCH 47/64] Add backup testing --- test/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 6ea71210a..23ad88d44 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -26,6 +26,11 @@ if(HAVE_BOOST_TEST) enable_testing() boost_test_jamfile(FILE sycl_jamfile LINK_LIBRARIES Boost::cuda_math Boost::assert Boost::concept_check Boost::config Boost::core Boost::integer Boost::lexical_cast Boost::multiprecision Boost::predef Boost::random Boost::static_assert Boost::throw_exception Boost::unit_test_framework sycl COMPILE_OPTIONS -fsycl ) + else() + + enable_testing() + boost_test_jamfile(FILE cuda_jamfile LINK_LIBRARIES Boost::cuda_math Boost::assert Boost::concept_check Boost::config Boost::core Boost::integer Boost::lexical_cast Boost::multiprecision Boost::predef Boost::random Boost::static_assert Boost::throw_exception Boost::unit_test_framework ) + endif() endif() From 7779b4e08137d08f1145d5a44bfb4f4cec5af5fc Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Mon, 22 Jul 2024 15:01:17 -0400 Subject: [PATCH 48/64] Add GPU safe max, min, and swap function macros --- include/boost/math/tools/config.hpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/include/boost/math/tools/config.hpp b/include/boost/math/tools/config.hpp index f63ad665b..e5b339483 100644 --- a/include/boost/math/tools/config.hpp +++ b/include/boost/math/tools/config.hpp @@ -722,6 +722,27 @@ namespace boost{ namespace math{ // Not all functions that allow CUDA allow SYCL (e.g. Recursion is disallowed by SYCL) # define BOOST_MATH_GPU_ENABLED BOOST_MATH_CUDA_ENABLED BOOST_MATH_SYCL_ENABLED +// Additional functions that need replaced/marked up +#ifdef BOOST_MATH_HAS_GPU_SUPPORT +template +BOOST_MATH_GPU_ENABLED constexpr void gpu_safe_swap(T& a, T& b) { T t(a); a = b; b = t; } +template +BOOST_MATH_GPU_ENABLED constexpr T gpu_safe_min(const T& a, const T& b) { return a < b ? a : b; } +template +BOOST_MATH_GPU_ENABLED constexpr T cuda_safe_max(const T& a, const T& b) { return a > b ? a : b; } + +#define BOOST_MATH_GPU_SAFE_SWAP(a, b) gpu_safe_swap(a, b); +#define BOOST_MATH_GPU_SAFE_MIN(a, b) gpu_safe_min(a, b); +#define BOOST_MATH_GPU_SAFE_MAX(a, b) gpu_safe_max(a, b); + +#else + +#define BOOST_MATH_GPU_SAFE_SWAP(a, b) std::swap(a, b); +#define BOOST_MATH_GPU_SAFE_MIN(a, b) (std::min)(a, b); +#define BOOST_MATH_GPU_SAFE_MAX(a, b) (std::max)(a, b); + +#endif + // Static variables are not allowed with CUDA or C++20 modules // See if we can inline them instead @@ -729,7 +750,7 @@ namespace boost{ namespace math{ # define BOOST_MATH_STATIC_CONSTEXPR inline constexpr # define BOOST_MATH_STATIC static #else -# ifndef BOOST_MATH_ENABLE_CUDA +# ifndef BOOST_MATH_HAS_GPU_SUPPORT # define BOOST_MATH_STATIC_CONSTEXPR static constexpr # define BOOST_MATH_STATIC static # else From 33605b853541c9909e8385de93b9b5efc95db28c Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Mon, 22 Jul 2024 15:01:52 -0400 Subject: [PATCH 49/64] Add log1p GPU support --- .../boost/math/special_functions/log1p.hpp | 52 +++++++++---------- .../boost/math/special_functions/math_fwd.hpp | 4 +- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/include/boost/math/special_functions/log1p.hpp b/include/boost/math/special_functions/log1p.hpp index 9b8a8e0eb..fc7308eb6 100644 --- a/include/boost/math/special_functions/log1p.hpp +++ b/include/boost/math/special_functions/log1p.hpp @@ -47,16 +47,16 @@ namespace detail { typedef T result_type; - log1p_series(T x) + BOOST_MATH_GPU_ENABLED log1p_series(T x) : k(0), m_mult(-x), m_prod(-1){} - T operator()() + BOOST_MATH_GPU_ENABLED T operator()() { m_prod *= m_mult; return m_prod / ++k; } - int count()const + BOOST_MATH_GPU_ENABLED int count()const { return k; } @@ -79,12 +79,12 @@ namespace detail // it performs no better than log(1+x): which is to say not very well at all. // template -T log1p_imp(T const & x, const Policy& pol, const std::integral_constant&) +BOOST_MATH_GPU_ENABLED T log1p_imp(T const & x, const Policy& pol, const std::integral_constant&) { // The function returns the natural logarithm of 1 + x. typedef typename tools::promote_args::type result_type; BOOST_MATH_STD_USING - static const char* function = "boost::math::log1p<%1%>(%1%)"; + constexpr auto function = "boost::math::log1p<%1%>(%1%)"; if((x < -1) || (boost::math::isnan)(x)) return policies::raise_domain_error( @@ -110,7 +110,7 @@ T log1p_imp(T const & x, const Policy& pol, const std::integral_constant } template -T log1p_imp(T const& x, const Policy& pol, const std::integral_constant&) +BOOST_MATH_GPU_ENABLED T log1p_imp(T const& x, const Policy& pol, const std::integral_constant&) { // The function returns the natural logarithm of 1 + x. BOOST_MATH_STD_USING @@ -135,7 +135,7 @@ T log1p_imp(T const& x, const Policy& pol, const std::integral_constant // Expected Error Term: 1.843e-017 // Maximum Relative Change in Control Points: 8.138e-004 // Max Error found at double precision = 3.250766e-016 - static const T P[] = { + BOOST_MATH_STATIC const T P[] = { static_cast(0.15141069795941984e-16L), static_cast(0.35495104378055055e-15L), static_cast(0.33333333333332835L), @@ -145,7 +145,7 @@ T log1p_imp(T const& x, const Policy& pol, const std::integral_constant static_cast(0.13703234928513215L), static_cast(0.011294864812099712L) }; - static const T Q[] = { + BOOST_MATH_STATIC const T Q[] = { static_cast(1L), static_cast(3.7274719063011499L), static_cast(5.5387948649720334L), @@ -163,11 +163,11 @@ T log1p_imp(T const& x, const Policy& pol, const std::integral_constant } template -T log1p_imp(T const& x, const Policy& pol, const std::integral_constant&) +BOOST_MATH_GPU_ENABLED T log1p_imp(T const& x, const Policy& pol, const std::integral_constant&) { // The function returns the natural logarithm of 1 + x. BOOST_MATH_STD_USING - static const char* function = "boost::math::log1p<%1%>(%1%)"; + constexpr auto function = "boost::math::log1p<%1%>(%1%)"; if(x < -1) return policies::raise_domain_error( @@ -188,7 +188,7 @@ T log1p_imp(T const& x, const Policy& pol, const std::integral_constant // Expected Error Term: 8.088e-20 // Maximum Relative Change in Control Points: 9.648e-05 // Max Error found at long double precision = 2.242324e-19 - static const T P[] = { + BOOST_MATH_STATIC const T P[] = { BOOST_MATH_BIG_CONSTANT(T, 64, -0.807533446680736736712e-19), BOOST_MATH_BIG_CONSTANT(T, 64, -0.490881544804798926426e-18), BOOST_MATH_BIG_CONSTANT(T, 64, 0.333333333333333373941), @@ -199,7 +199,7 @@ T log1p_imp(T const& x, const Policy& pol, const std::integral_constant BOOST_MATH_BIG_CONSTANT(T, 64, 0.0706537026422828914622), BOOST_MATH_BIG_CONSTANT(T, 64, 0.00441709903782239229447) }; - static const T Q[] = { + BOOST_MATH_STATIC const T Q[] = { BOOST_MATH_BIG_CONSTANT(T, 64, 1.0), BOOST_MATH_BIG_CONSTANT(T, 64, 4.26423872346263928361), BOOST_MATH_BIG_CONSTANT(T, 64, 7.48189472704477708962), @@ -218,7 +218,7 @@ T log1p_imp(T const& x, const Policy& pol, const std::integral_constant } template -T log1p_imp(T const& x, const Policy& pol, const std::integral_constant&) +BOOST_MATH_GPU_ENABLED T log1p_imp(T const& x, const Policy& pol, const std::integral_constant&) { // The function returns the natural logarithm of 1 + x. BOOST_MATH_STD_USING @@ -244,13 +244,13 @@ T log1p_imp(T const& x, const Policy& pol, const std::integral_constant // Maximum Relative Change in Control Points: 2.509e-04 // Max Error found at double precision = 6.910422e-08 // Max Error found at float precision = 8.357242e-08 - static const T P[] = { + BOOST_MATH_STATIC const T P[] = { -0.671192866803148236519e-7L, 0.119670999140731844725e-6L, 0.333339469182083148598L, 0.237827183019664122066L }; - static const T Q[] = { + BOOST_MATH_STATIC const T Q[] = { 1L, 1.46348272586988539733L, 0.497859871350117338894L, @@ -268,20 +268,20 @@ struct log1p_initializer { struct init { - init() + BOOST_MATH_GPU_ENABLED init() { do_init(tag()); } template - static void do_init(const std::integral_constant&){} - static void do_init(const std::integral_constant&) + BOOST_MATH_GPU_ENABLED static void do_init(const std::integral_constant&){} + BOOST_MATH_GPU_ENABLED static void do_init(const std::integral_constant&) { boost::math::log1p(static_cast(0.25), Policy()); } - void force_instantiate()const{} + BOOST_MATH_GPU_ENABLED void force_instantiate()const{} }; - static const init initializer; - static void force_instantiate() + BOOST_MATH_STATIC const init initializer; + BOOST_MATH_GPU_ENABLED static void force_instantiate() { initializer.force_instantiate(); } @@ -294,7 +294,7 @@ const typename log1p_initializer::init log1p_initializer -inline typename tools::promote_args::type log1p(T x, const Policy&) +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type log1p(T x, const Policy&) { typedef typename tools::promote_args::type result_type; typedef typename policies::evaluation::type value_type; @@ -328,7 +328,7 @@ inline typename tools::promote_args::type log1p(T x, const Policy&) #if defined(BOOST_HAS_LOG1P) && !(defined(__osf__) && defined(__DECCXX_VER)) # ifdef BOOST_MATH_USE_C99 template -inline float log1p(float x, const Policy& pol) +BOOST_MATH_GPU_ENABLED inline float log1p(float x, const Policy& pol) { if(x < -1) return policies::raise_domain_error( @@ -340,7 +340,7 @@ inline float log1p(float x, const Policy& pol) } #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS template -inline long double log1p(long double x, const Policy& pol) +BOOST_MATH_GPU_ENABLED inline long double log1p(long double x, const Policy& pol) { if(x < -1) return policies::raise_domain_error( @@ -365,7 +365,7 @@ inline float log1p(float x, const Policy& pol) } #endif template -inline double log1p(double x, const Policy& pol) +BOOST_MATH_GPU_ENABLED inline double log1p(double x, const Policy& pol) { if(x < -1) return policies::raise_domain_error( @@ -425,7 +425,7 @@ inline long double log1p(long double x, const Policy& pol) #endif template -inline typename tools::promote_args::type log1p(T x) +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type log1p(T x) { return boost::math::log1p(x, policies::policy<>()); } diff --git a/include/boost/math/special_functions/math_fwd.hpp b/include/boost/math/special_functions/math_fwd.hpp index 3e5d6a762..ee43684ce 100644 --- a/include/boost/math/special_functions/math_fwd.hpp +++ b/include/boost/math/special_functions/math_fwd.hpp @@ -568,10 +568,10 @@ namespace boost // log1p is log(x + 1) template - tools::promote_args_t log1p(T); + BOOST_MATH_GPU_ENABLED tools::promote_args_t log1p(T); template - tools::promote_args_t log1p(T, const Policy&); + BOOST_MATH_GPU_ENABLED tools::promote_args_t log1p(T, const Policy&); // log1pmx is log(x + 1) - x template From 71cfc8ead958d870631f2fecce77f3928f0004df Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Mon, 22 Jul 2024 15:02:13 -0400 Subject: [PATCH 50/64] Add precision helper functions --- include/boost/math/tools/precision.hpp | 64 ++++++++++++++++++++++++-- 1 file changed, 60 insertions(+), 4 deletions(-) diff --git a/include/boost/math/tools/precision.hpp b/include/boost/math/tools/precision.hpp index 86b8e9982..d82144466 100644 --- a/include/boost/math/tools/precision.hpp +++ b/include/boost/math/tools/precision.hpp @@ -10,6 +10,7 @@ #pragma once #endif +#include #include #include #include @@ -54,6 +55,22 @@ inline constexpr T max_value(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(std } // Also used as a finite 'infinite' value for - and +infinity, for example: // -max_value = -1.79769e+308, max_value = 1.79769e+308. +#ifdef BOOST_MATH_HAS_GPU_SUPPORT + +template <> +BOOST_MATH_GPU_ENABLED constexpr float max_value() noexcept +{ + return FLT_MAX; +} + +template <> +BOOST_MATH_GPU_ENABLED constexpr double max_value() noexcept +{ + return DBL_MAX; +} + +#endif + template inline constexpr T min_value(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(std::is_floating_point::value) { @@ -62,6 +79,22 @@ inline constexpr T min_value(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(std: return (std::numeric_limits::min)(); } +#ifdef BOOST_MATH_HAS_GPU_SUPPORT + +template <> +BOOST_MATH_GPU_ENABLED constexpr float min_value() noexcept +{ + return FLT_MIN; +} + +template <> +BOOST_MATH_GPU_ENABLED constexpr double min_value() noexcept +{ + return DBL_MIN; +} + +#endif + namespace detail{ // // Logarithmic limits come next, note that although @@ -72,13 +105,13 @@ namespace detail{ // For type float first: // template -inline constexpr T log_max_value(const std::integral_constant& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(std::is_floating_point::value) +BOOST_MATH_GPU_ENABLED constexpr T log_max_value(const std::integral_constant& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(std::is_floating_point::value) { return 88.0f; } template -inline constexpr T log_min_value(const std::integral_constant& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(std::is_floating_point::value) +BOOST_MATH_GPU_ENABLED constexpr T log_min_value(const std::integral_constant& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(std::is_floating_point::value) { return -87.0f; } @@ -86,13 +119,13 @@ inline constexpr T log_min_value(const std::integral_constant& BOOST_M // Now double: // template -inline constexpr T log_max_value(const std::integral_constant& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(std::is_floating_point::value) +BOOST_MATH_GPU_ENABLED constexpr T log_max_value(const std::integral_constant& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(std::is_floating_point::value) { return 709.0; } template -inline constexpr T log_min_value(const std::integral_constant& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(std::is_floating_point::value) +BOOST_MATH_GPU_ENABLED constexpr T log_min_value(const std::integral_constant& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(std::is_floating_point::value) { return -708.0; } @@ -257,6 +290,29 @@ BOOST_MATH_GPU_ENABLED constexpr T epsilon(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPE #endif } +#ifdef BOOST_MATH_HAS_GPU_SUPPORT + +template <> +BOOST_MATH_GPU_ENABLED constexpr float epsilon(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(float)) noexcept(true) +{ + return FLT_EPSILON; +} + +template <> +BOOST_MATH_GPU_ENABLED constexpr double epsilon(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(double)) noexcept(true) +{ + return DBL_EPSILON; +} + +template <> +BOOST_MATH_GPU_ENABLED constexpr long double epsilon(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(long double)) noexcept(true) +{ + return LDBL_EPSILON; +} + + +#endif + namespace detail{ template From 3753def874464e4393c24fe320917e947fa4d801 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Mon, 22 Jul 2024 15:02:25 -0400 Subject: [PATCH 51/64] Markup big_constant --- include/boost/math/tools/big_constant.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/math/tools/big_constant.hpp b/include/boost/math/tools/big_constant.hpp index eaa34dd23..2fdfec782 100644 --- a/include/boost/math/tools/big_constant.hpp +++ b/include/boost/math/tools/big_constant.hpp @@ -43,12 +43,12 @@ typedef double largest_float; #endif template -inline constexpr T make_big_value(largest_float v, const char*, std::true_type const&, std::false_type const&) BOOST_MATH_NOEXCEPT(T) +BOOST_MATH_GPU_ENABLED constexpr T make_big_value(largest_float v, const char*, std::true_type const&, std::false_type const&) BOOST_MATH_NOEXCEPT(T) { return static_cast(v); } template -inline constexpr T make_big_value(largest_float v, const char*, std::true_type const&, std::true_type const&) BOOST_MATH_NOEXCEPT(T) +BOOST_MATH_GPU_ENABLED constexpr T make_big_value(largest_float v, const char*, std::true_type const&, std::true_type const&) BOOST_MATH_NOEXCEPT(T) { return static_cast(v); } From 2b372d6d2760c947cc1326bf29c59fa071246b88 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Mon, 22 Jul 2024 15:02:45 -0400 Subject: [PATCH 52/64] Add support for lanczos and change storage duration --- .../boost/math/special_functions/lanczos.hpp | 208 +++++++++--------- 1 file changed, 104 insertions(+), 104 deletions(-) diff --git a/include/boost/math/special_functions/lanczos.hpp b/include/boost/math/special_functions/lanczos.hpp index d75a968cd..7a1934c80 100644 --- a/include/boost/math/special_functions/lanczos.hpp +++ b/include/boost/math/special_functions/lanczos.hpp @@ -48,7 +48,7 @@ namespace boost{ namespace math{ namespace lanczos{ // Default version assumes all g() values are the same. // template -inline double lanczos_g_near_1_and_2(const L&) +BOOST_MATH_GPU_ENABLED inline double lanczos_g_near_1_and_2(const L&) { return L::g(); } @@ -66,10 +66,10 @@ struct lanczos6 : public std::integral_constant // double precision: // template - static T lanczos_sum(const T& z) + BOOST_MATH_GPU_ENABLED static T lanczos_sum(const T& z) { // LCOV_EXCL_START - static const T num[6] = { + BOOST_MATH_STATIC const T num[6] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 35, 8706.349592549009182288174442774377925882)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 35, 8523.650341121874633477483696775067709735)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 35, 3338.029219476423550899999750161289306564)), @@ -77,7 +77,7 @@ struct lanczos6 : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 35, 63.99951844938187085666201263218840287667)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 35, 2.506628274631006311133031631822390264407)) }; - static const BOOST_MATH_INT_TABLE_TYPE(T, std::uint16_t) denom[6] = { + BOOST_MATH_STATIC const BOOST_MATH_INT_TABLE_TYPE(T, std::uint16_t) denom[6] = { static_cast(0u), static_cast(24u), static_cast(50u), @@ -90,10 +90,10 @@ struct lanczos6 : public std::integral_constant } template - static T lanczos_sum_expG_scaled(const T& z) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_expG_scaled(const T& z) { // LCOV_EXCL_START - static const T num[6] = { + BOOST_MATH_STATIC const T num[6] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 35, 32.81244541029783471623665933780748627823)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 35, 32.12388941444332003446077108933558534361)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 35, 12.58034729455216106950851080138931470954)), @@ -101,7 +101,7 @@ struct lanczos6 : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 35, 0.2412010548258800231126240760264822486599)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 35, 0.009446967704539249494420221613134244048319)) }; - static const BOOST_MATH_INT_TABLE_TYPE(T, std::uint16_t) denom[6] = { + BOOST_MATH_STATIC const BOOST_MATH_INT_TABLE_TYPE(T, std::uint16_t) denom[6] = { static_cast(0u), static_cast(24u), static_cast(50u), @@ -115,10 +115,10 @@ struct lanczos6 : public std::integral_constant template - static T lanczos_sum_near_1(const T& dz) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_near_1(const T& dz) { // LCOV_EXCL_START - static const T d[5] = { + BOOST_MATH_STATIC const T d[5] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 35, 2.044879010930422922760429926121241330235)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 35, -2.751366405578505366591317846728753993668)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 35, 1.02282965224225004296750609604264824677)), @@ -135,10 +135,10 @@ struct lanczos6 : public std::integral_constant } template - static T lanczos_sum_near_2(const T& dz) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_near_2(const T& dz) { // LCOV_EXCL_START - static const T d[5] = { + BOOST_MATH_STATIC const T d[5] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 35, 5.748142489536043490764289256167080091892)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 35, -7.734074268282457156081021756682138251825)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 35, 2.875167944990511006997713242805893543947)), @@ -155,7 +155,7 @@ struct lanczos6 : public std::integral_constant return result; } - static double g(){ return 5.581000000000000405009359383257105946541; } + BOOST_MATH_GPU_ENABLED static double g(){ return 5.581000000000000405009359383257105946541; } }; // @@ -170,10 +170,10 @@ struct lanczos11 : public std::integral_constant // extended-double precision: // template - static T lanczos_sum(const T& z) + BOOST_MATH_GPU_ENABLED static T lanczos_sum(const T& z) { // LCOV_EXCL_START - static const T num[11] = { + BOOST_MATH_STATIC const T num[11] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 60, 38474670393.31776828316099004518914832218)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 60, 36857665043.51950660081971227404959150474)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 60, 15889202453.72942008945006665994637853242)), @@ -186,7 +186,7 @@ struct lanczos11 : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 60, 261.6140441641668190791708576058805625502)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 60, 2.506628274631000502415573855452633787834)) }; - static const BOOST_MATH_INT_TABLE_TYPE(T, std::uint32_t) denom[11] = { + BOOST_MATH_STATIC const BOOST_MATH_INT_TABLE_TYPE(T, std::uint32_t) denom[11] = { static_cast(0u), static_cast(362880u), static_cast(1026576u), @@ -204,10 +204,10 @@ struct lanczos11 : public std::integral_constant } template - static T lanczos_sum_expG_scaled(const T& z) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_expG_scaled(const T& z) { // LCOV_EXCL_START - static const T num[11] = { + BOOST_MATH_STATIC const T num[11] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 60, 709811.662581657956893540610814842699825)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 60, 679979.847415722640161734319823103390728)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 60, 293136.785721159725251629480984140341656)), @@ -220,7 +220,7 @@ struct lanczos11 : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 60, 0.004826466289237661857584712046231435101741)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 60, 0.4624429436045378766270459638520555557321e-4)) }; - static const BOOST_MATH_INT_TABLE_TYPE(T, std::uint32_t) denom[11] = { + BOOST_MATH_STATIC const BOOST_MATH_INT_TABLE_TYPE(T, std::uint32_t) denom[11] = { static_cast(0u), static_cast(362880u), static_cast(1026576u), @@ -239,10 +239,10 @@ struct lanczos11 : public std::integral_constant template - static T lanczos_sum_near_1(const T& dz) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_near_1(const T& dz) { // LCOV_EXCL_START - static const T d[10] = { + BOOST_MATH_STATIC const T d[10] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 60, 4.005853070677940377969080796551266387954)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 60, -13.17044315127646469834125159673527183164)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 60, 17.19146865350790353683895137079288129318)), @@ -264,10 +264,10 @@ struct lanczos11 : public std::integral_constant } template - static T lanczos_sum_near_2(const T& dz) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_near_2(const T& dz) { // LCOV_EXCL_START - static const T d[10] = { + BOOST_MATH_STATIC const T d[10] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 60, 19.05889633808148715159575716844556056056)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 60, -62.66183664701721716960978577959655644762)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 60, 81.7929198065004751699057192860287512027)), @@ -289,7 +289,7 @@ struct lanczos11 : public std::integral_constant return result; } - static double g(){ return 10.90051099999999983936049829935654997826; } + BOOST_MATH_GPU_ENABLED static double g(){ return 10.90051099999999983936049829935654997826; } }; // @@ -304,10 +304,10 @@ struct lanczos13 : public std::integral_constant // higher precision: // template - static T lanczos_sum(const T& z) + BOOST_MATH_GPU_ENABLED static T lanczos_sum(const T& z) { // LCOV_EXCL_START - static const T num[13] = { + BOOST_MATH_STATIC const T num[13] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 72, 44012138428004.60895436261759919070125699)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 72, 41590453358593.20051581730723108131357995)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 72, 18013842787117.99677796276038389462742949)), @@ -322,7 +322,7 @@ struct lanczos13 : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 72, 381.8801248632926870394389468349331394196)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 72, 2.506628274631000502415763426076722427007)) }; - static const BOOST_MATH_INT_TABLE_TYPE(T, std::uint32_t) denom[13] = { + BOOST_MATH_STATIC const BOOST_MATH_INT_TABLE_TYPE(T, std::uint32_t) denom[13] = { static_cast(0u), static_cast(39916800u), static_cast(120543840u), @@ -342,10 +342,10 @@ struct lanczos13 : public std::integral_constant } template - static T lanczos_sum_expG_scaled(const T& z) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_expG_scaled(const T& z) { // LCOV_EXCL_START - static const T num[13] = { + BOOST_MATH_STATIC const T num[13] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 72, 86091529.53418537217994842267760536134841)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 72, 81354505.17858011242874285785316135398567)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 72, 35236626.38815461910817650960734605416521)), @@ -360,7 +360,7 @@ struct lanczos13 : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 72, 0.0007469903808915448316510079585999893674101)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 72, 0.4903180573459871862552197089738373164184e-5)) }; - static const BOOST_MATH_INT_TABLE_TYPE(T, std::uint32_t) denom[13] = { + BOOST_MATH_STATIC const BOOST_MATH_INT_TABLE_TYPE(T, std::uint32_t) denom[13] = { static_cast(0u), static_cast(39916800u), static_cast(120543840u), @@ -381,10 +381,10 @@ struct lanczos13 : public std::integral_constant template - static T lanczos_sum_near_1(const T& dz) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_near_1(const T& dz) { // LCOV_EXCL_START - static const T d[12] = { + BOOST_MATH_STATIC const T d[12] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 72, 4.832115561461656947793029596285626840312)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 72, -19.86441536140337740383120735104359034688)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 72, 33.9927422807443239927197864963170585331)), @@ -408,10 +408,10 @@ struct lanczos13 : public std::integral_constant } template - static T lanczos_sum_near_2(const T& dz) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_near_2(const T& dz) { // LCOV_EXCL_START - static const T d[12] = { + BOOST_MATH_STATIC const T d[12] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 72, 26.96979819614830698367887026728396466395)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 72, -110.8705424709385114023884328797900204863)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 72, 189.7258846119231466417015694690434770085)), @@ -435,7 +435,7 @@ struct lanczos13 : public std::integral_constant return result; } - static double g(){ return 13.1445650000000000545696821063756942749; } + BOOST_MATH_GPU_ENABLED static double g(){ return 13.1445650000000000545696821063756942749; } }; // @@ -449,10 +449,10 @@ struct lanczos6m24 : public std::integral_constant // Use for float precision, when evaluated as a float: // template - static T lanczos_sum(const T& z) + BOOST_MATH_GPU_ENABLED static T lanczos_sum(const T& z) { // LCOV_EXCL_START - static const T num[6] = { + BOOST_MATH_STATIC const T num[6] = { static_cast(58.52061591769095910314047740215847630266L), static_cast(182.5248962595894264831189414768236280862L), static_cast(211.0971093028510041839168287718170827259L), @@ -460,7 +460,7 @@ struct lanczos6m24 : public std::integral_constant static_cast(27.5192015197455403062503721613097825345L), static_cast(2.50662858515256974113978724717473206342L) }; - static const BOOST_MATH_INT_TABLE_TYPE(T, std::uint16_t) denom[6] = { + BOOST_MATH_STATIC const BOOST_MATH_INT_TABLE_TYPE(T, std::uint16_t) denom[6] = { static_cast(0u), static_cast(24u), static_cast(50u), @@ -473,10 +473,10 @@ struct lanczos6m24 : public std::integral_constant } template - static T lanczos_sum_expG_scaled(const T& z) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_expG_scaled(const T& z) { // LCOV_EXCL_START - static const T num[6] = { + BOOST_MATH_STATIC const T num[6] = { static_cast(14.0261432874996476619570577285003839357L), static_cast(43.74732405540314316089531289293124360129L), static_cast(50.59547402616588964511581430025589038612L), @@ -484,7 +484,7 @@ struct lanczos6m24 : public std::integral_constant static_cast(6.595765571169314946316366571954421695196L), static_cast(0.6007854010515290065101128585795542383721L) }; - static const BOOST_MATH_INT_TABLE_TYPE(T, std::uint16_t) denom[6] = { + BOOST_MATH_STATIC const BOOST_MATH_INT_TABLE_TYPE(T, std::uint16_t) denom[6] = { static_cast(0u), static_cast(24u), static_cast(50u), @@ -498,10 +498,10 @@ struct lanczos6m24 : public std::integral_constant template - static T lanczos_sum_near_1(const T& dz) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_near_1(const T& dz) { // LCOV_EXCL_START - static const T d[5] = { + BOOST_MATH_STATIC const T d[5] = { static_cast(0.4922488055204602807654354732674868442106L), static_cast(0.004954497451132152436631238060933905650346L), static_cast(-0.003374784572167105840686977985330859371848L), @@ -518,10 +518,10 @@ struct lanczos6m24 : public std::integral_constant } template - static T lanczos_sum_near_2(const T& dz) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_near_2(const T& dz) { // LCOV_EXCL_START - static const T d[5] = { + BOOST_MATH_STATIC const T d[5] = { static_cast(0.6534966888520080645505805298901130485464L), static_cast(0.006577461728560758362509168026049182707101L), static_cast(-0.004480276069269967207178373559014835978161L), @@ -538,7 +538,7 @@ struct lanczos6m24 : public std::integral_constant return result; } - static double g(){ return 1.428456135094165802001953125; } + BOOST_MATH_GPU_ENABLED static double g(){ return 1.428456135094165802001953125; } }; // @@ -552,10 +552,10 @@ struct lanczos13m53 : public std::integral_constant // Use for double precision, when evaluated as a double: // template - static T lanczos_sum(const T& z) + BOOST_MATH_GPU_ENABLED static T lanczos_sum(const T& z) { // LCOV_EXCL_START - static const T num[13] = { + BOOST_MATH_STATIC const T num[13] = { static_cast(23531376880.41075968857200767445163675473L), static_cast(42919803642.64909876895789904700198885093L), static_cast(35711959237.35566804944018545154716670596L), @@ -570,7 +570,7 @@ struct lanczos13m53 : public std::integral_constant static_cast(210.8242777515793458725097339207133627117L), static_cast(2.506628274631000270164908177133837338626L) }; - static const BOOST_MATH_INT_TABLE_TYPE(T, std::uint32_t) denom[13] = { + BOOST_MATH_STATIC const BOOST_MATH_INT_TABLE_TYPE(T, std::uint32_t) denom[13] = { static_cast(0u), static_cast(39916800u), static_cast(120543840u), @@ -590,10 +590,10 @@ struct lanczos13m53 : public std::integral_constant } template - static T lanczos_sum_expG_scaled(const T& z) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_expG_scaled(const T& z) { // LCOV_EXCL_START - static const T num[13] = { + BOOST_MATH_STATIC const T num[13] = { static_cast(56906521.91347156388090791033559122686859L), static_cast(103794043.1163445451906271053616070238554L), static_cast(86363131.28813859145546927288977868422342L), @@ -608,7 +608,7 @@ struct lanczos13m53 : public std::integral_constant static_cast(0.5098416655656676188125178644804694509993L), static_cast(0.006061842346248906525783753964555936883222L) }; - static const BOOST_MATH_INT_TABLE_TYPE(T, std::uint32_t) denom[13] = { + BOOST_MATH_STATIC const BOOST_MATH_INT_TABLE_TYPE(T, std::uint32_t) denom[13] = { static_cast(0u), static_cast(39916800u), static_cast(120543840u), @@ -629,10 +629,10 @@ struct lanczos13m53 : public std::integral_constant template - static T lanczos_sum_near_1(const T& dz) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_near_1(const T& dz) { // LCOV_EXCL_START - static const T d[12] = { + BOOST_MATH_STATIC const T d[12] = { static_cast(2.208709979316623790862569924861841433016L), static_cast(-3.327150580651624233553677113928873034916L), static_cast(1.483082862367253753040442933770164111678L), @@ -656,10 +656,10 @@ struct lanczos13m53 : public std::integral_constant } template - static T lanczos_sum_near_2(const T& dz) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_near_2(const T& dz) { // LCOV_EXCL_START - static const T d[12] = { + BOOST_MATH_STATIC const T d[12] = { static_cast(6.565936202082889535528455955485877361223L), static_cast(-9.8907772644920670589288081640128194231L), static_cast(4.408830289125943377923077727900630927902L), @@ -683,7 +683,7 @@ struct lanczos13m53 : public std::integral_constant return result; } - static double g(){ return 6.024680040776729583740234375; } + BOOST_MATH_GPU_ENABLED static double g(){ return 6.024680040776729583740234375; } }; // @@ -697,10 +697,10 @@ struct lanczos17m64 : public std::integral_constant // Use for extended-double precision, when evaluated as an extended-double: // template - static T lanczos_sum(const T& z) + BOOST_MATH_GPU_ENABLED static T lanczos_sum(const T& z) { // LCOV_EXCL_START - static const T num[17] = { + BOOST_MATH_STATIC const T num[17] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 553681095419291969.2230556393350368550504)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 731918863887667017.2511276782146694632234)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 453393234285807339.4627124634539085143364)), @@ -719,7 +719,7 @@ struct lanczos17m64 : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 488.0063567520005730476791712814838113252)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 2.50662827463100050241576877135758834683)) }; - static const BOOST_MATH_INT_TABLE_TYPE(T, std::uint64_t) denom[17] = { + BOOST_MATH_STATIC const BOOST_MATH_INT_TABLE_TYPE(T, std::uint64_t) denom[17] = { BOOST_MATH_INT_VALUE_SUFFIX(0, uLL), BOOST_MATH_INT_VALUE_SUFFIX(1307674368000, uLL), BOOST_MATH_INT_VALUE_SUFFIX(4339163001600, uLL), @@ -743,10 +743,10 @@ struct lanczos17m64 : public std::integral_constant } template - static T lanczos_sum_expG_scaled(const T& z) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_expG_scaled(const T& z) { // LCOV_EXCL_START - static const T num[17] = { + BOOST_MATH_STATIC const T num[17] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 2715894658327.717377557655133124376674911)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 3590179526097.912105038525528721129550434)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 2223966599737.814969312127353235818710172)), @@ -765,7 +765,7 @@ struct lanczos17m64 : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 0.002393749522058449186690627996063983095463)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 0.1229541408909435212800785616808830746135e-4)) }; - static const BOOST_MATH_INT_TABLE_TYPE(T, std::uint64_t) denom[17] = { + BOOST_MATH_STATIC const BOOST_MATH_INT_TABLE_TYPE(T, std::uint64_t) denom[17] = { BOOST_MATH_INT_VALUE_SUFFIX(0, uLL), BOOST_MATH_INT_VALUE_SUFFIX(1307674368000, uLL), BOOST_MATH_INT_VALUE_SUFFIX(4339163001600, uLL), @@ -790,10 +790,10 @@ struct lanczos17m64 : public std::integral_constant template - static T lanczos_sum_near_1(const T& dz) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_near_1(const T& dz) { // LCOV_EXCL_START - static const T d[16] = { + BOOST_MATH_STATIC const T d[16] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 4.493645054286536365763334986866616581265)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, -16.95716370392468543800733966378143997694)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 26.19196892983737527836811770970479846644)), @@ -821,10 +821,10 @@ struct lanczos17m64 : public std::integral_constant } template - static T lanczos_sum_near_2(const T& dz) + BOOST_MATH_GPU_ENABLED static T lanczos_sum_near_2(const T& dz) { // LCOV_EXCL_START - static const T d[16] = { + BOOST_MATH_STATIC const T d[16] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 23.56409085052261327114594781581930373708)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, -88.92116338946308797946237246006238652361)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 137.3472822086847596961177383569603988797)), @@ -852,7 +852,7 @@ struct lanczos17m64 : public std::integral_constant return result; } - static double g(){ return 12.2252227365970611572265625; } + BOOST_MATH_GPU_ENABLED static double g(){ return 12.2252227365970611572265625; } }; // @@ -869,7 +869,7 @@ struct lanczos24m113 : public std::integral_constant static T lanczos_sum(const T& z) { // LCOV_EXCL_START - static const T num[24] = { + BOOST_MATH_STATIC const T num[24] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, 2029889364934367661624137213253.22102954656825019111612712252027267955023987678816620961507)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, 2338599599286656537526273232565.2727349714338768161421882478417543004440597874814359063158)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, 1288527989493833400335117708406.3953711906175960449186720680201425446299360322830739180195)), @@ -895,7 +895,7 @@ struct lanczos24m113 : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, 1151.61895453463992438325318456328526085882924197763140514450975619271382783957699017875304)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, 2.50662827463100050241576528481104515966515623051532908941425544355490413900497467936202516)) }; - static const T denom[24] = { + BOOST_MATH_STATIC const T denom[24] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, 0.0)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, 0.112400072777760768e22)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, 0.414847677933545472e22)), @@ -929,7 +929,7 @@ struct lanczos24m113 : public std::integral_constant static T lanczos_sum_expG_scaled(const T& z) { // LCOV_EXCL_START - static const T num[24] = { + BOOST_MATH_STATIC const T num[24] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, 3035162425359883494754.02878223286972654682199012688209026810841953293372712802258398358538)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, 3496756894406430103600.16057175075063458536101374170860226963245118484234495645518505519827)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, 1926652656689320888654.01954015145958293168365236755537645929361841917596501251362171653478)), @@ -955,7 +955,7 @@ struct lanczos24m113 : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, 0.172194142179211139195966608011235161516824700287310869949928393345257114743230967204370963e-5)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, 0.374799931707148855771381263542708435935402853962736029347951399323367765509988401336565436e-8)) }; - static const T denom[24] = { + BOOST_MATH_STATIC const T denom[24] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, 0.0)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, 0.112400072777760768e22)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, 0.414847677933545472e22)), @@ -990,7 +990,7 @@ struct lanczos24m113 : public std::integral_constant static T lanczos_sum_near_1(const T& dz) { // LCOV_EXCL_START - static const T d[23] = { + BOOST_MATH_STATIC const T d[23] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, 7.4734083002469026177867421609938203388868806387315406134072298925733950040583068760685908)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, -50.4225805042247530267317342133388132970816607563062253708655085754357843064134941138154171)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, 152.288200621747008570784082624444625293884063492396162110698238568311211546361189979357019)), @@ -1028,7 +1028,7 @@ struct lanczos24m113 : public std::integral_constant static T lanczos_sum_near_2(const T& dz) { // LCOV_EXCL_START - static const T d[23] = { + BOOST_MATH_STATIC const T d[23] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, 61.4165001061101455341808888883960361969557848005400286332291451422461117307237198559485365)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, -414.372973678657049667308134761613915623353625332248315105320470271523320700386200587519147)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 113, 1251.50505818554680171298972755376376836161706773644771875668053742215217922228357204561873)), @@ -1078,7 +1078,7 @@ struct lanczos27MP : public std::integral_constant static T lanczos_sum(const T& z) { // LCOV_EXCL_START - static const T num[27] = { + BOOST_MATH_STATIC const T num[27] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, 2.532923291341302819860952064783714673718970e+36)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, 2.715272050979243637524956158081893927075092e+36)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, 1.399396313336459710065708403038293278484916e+36)), @@ -1107,7 +1107,7 @@ struct lanczos27MP : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, 1.580741273679785112052701460119954412080073e+03)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, 2.506628274631000502415765284811045253005320e+00)) }; - static const T denom[27] = { + BOOST_MATH_STATIC const T denom[27] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, 0.000000000000000000000000000000000000000000e+00)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, 1.551121004333098598400000000000000000000000e+25)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, 5.919012881170120359936000000000000000000000e+25)), @@ -1144,7 +1144,7 @@ struct lanczos27MP : public std::integral_constant static T lanczos_sum_expG_scaled(const T& z) { // LCOV_EXCL_START - static const T num[27] = { + BOOST_MATH_STATIC const T num[27] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, 4.630539114451826442425094380936505531231478e+25)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, 4.963898228350662244301785145431331232866294e+25)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, 2.558292778812387748738731408569861630189290e+25)), @@ -1173,7 +1173,7 @@ struct lanczos27MP : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, 2.889816806780013044430000551700375309307825e-08)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, 4.582468135039046226997146555551548992616343e-11)) }; - static const T denom[27] = { + BOOST_MATH_STATIC const T denom[27] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, 0.000000000000000000000000000000000000000000e+00)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, 1.551121004333098598400000000000000000000000e+25)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, 5.919012881170120359936000000000000000000000e+25)), @@ -1211,7 +1211,7 @@ struct lanczos27MP : public std::integral_constant static T lanczos_sum_near_1(const T& dz) { // LCOV_EXCL_START - static const T d[34] = { + BOOST_MATH_STATIC const T d[34] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, 6.264579889722939745225908247624593169040293e+00)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, -3.470545597111704235784909052092266897169254e+01)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, 8.398164226943527197542310295220360303173237e+01)), @@ -1260,7 +1260,7 @@ struct lanczos27MP : public std::integral_constant static T lanczos_sum_near_2(const T& dz) { // LCOV_EXCL_START - static const T d[34] = { + BOOST_MATH_STATIC const T d[34] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, 4.391991857844535020743473289228849738381662e+01)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, -2.433141291692735004291785549611375831426138e+02)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 134, 5.887812040849956173864447000497922705559488e+02)), @@ -1326,7 +1326,7 @@ struct lanczos35MP : public std::integral_constant static T lanczos_sum(const T& z) { // LCOV_EXCL_START - static const T num[35] = { + BOOST_MATH_STATIC const T num[35] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, 2.17215050716253100021302249837728942659410271586236104e+50)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, 2.51055117651708470336913962553466820524801246971658127e+50)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, 1.40813458996718289733677017073036013655624930344397267e+50)), @@ -1363,7 +1363,7 @@ struct lanczos35MP : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, 2.50897418653428667959996348205296461689142907811767371e+03)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, 2.50662827463100050241576528481104525300698674060984055e+00)) }; - static const T denom[35] = { + BOOST_MATH_STATIC const T denom[35] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, 0.00000000000000000000000000000000000000000000000000000e+00)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, 8.68331761881188649551819440128000000000000000000000000e+36)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, 3.55043336733310191803732770947072000000000000000000000e+37)), @@ -1408,7 +1408,7 @@ struct lanczos35MP : public std::integral_constant static T lanczos_sum_expG_scaled(const T& z) { // LCOV_EXCL_START - static const T num[35] = { + BOOST_MATH_STATIC const T num[35] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, 2.84421398435712762388902267099927585742388886580864424e+37)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, 3.28731583799033736725852757551292030085556435695468295e+37)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, 1.84381150359300352571680869181416248982215282642834936e+37)), @@ -1445,7 +1445,7 @@ struct lanczos35MP : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, 3.28525092722679899458094768960179796663588010298597603e-10)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, 3.28217919006153582429216342066702743329957749672852350e-13)) }; - static const T denom[35] = { + BOOST_MATH_STATIC const T denom[35] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, 0.00000000000000000000000000000000000000000000000000000e+00)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, 8.68331761881188649551819440128000000000000000000000000e+36)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, 3.55043336733310191803732770947072000000000000000000000e+37)), @@ -1491,7 +1491,7 @@ struct lanczos35MP : public std::integral_constant static T lanczos_sum_near_1(const T& dz) { // LCOV_EXCL_START - static const T d[42] = { + BOOST_MATH_STATIC const T d[42] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, 8.2258008829795701933757823508857131818190413131511363e+00)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, -6.1680809698202901664719598422224259984110345848176138e+01)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, 2.0937956909159916126016144892534179459545368045658870e+02)), @@ -1548,7 +1548,7 @@ struct lanczos35MP : public std::integral_constant static T lanczos_sum_near_2(const T& dz) { // LCOV_EXCL_START - static const T d[42] = { + BOOST_MATH_STATIC const T d[42] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, 7.3782193657165970743894979068466124765194827248379940e+01)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, -5.5325256602067816772285455933211570612342576586214891e+02)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 168, 1.8780522570799869937961476290263461833002660531646012e+03)), @@ -1621,7 +1621,7 @@ struct lanczos48MP : public std::integral_constant static T lanczos_sum(const T& z) { // LCOV_EXCL_START - static const T num[48] = { + BOOST_MATH_STATIC const T num[48] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, 5.761757987425932419978923296640371540367427757167447418730589877e+70)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, 8.723233313564421930629677035555276136256253817229396631458438691e+70)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, 6.460052620548943146316510839385235752729444155384745952604400014e+70)), @@ -1671,7 +1671,7 @@ struct lanczos48MP : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, 3.749690888961891063146468955091435916957208840312184463551812828e+03)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, 2.506628274631000502415765284811045253006986740609938316629929233e+00)) }; - static const T denom[48] = { + BOOST_MATH_STATIC const T denom[48] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, 0.000000000000000000000000000000000000000000000000000000000000000e+00)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, 5.502622159812088949850305428800254892961651752960000000000000000e+57)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, 2.430336111272256671478593169569751383305061494947840000000000000e+58)), @@ -1729,7 +1729,7 @@ struct lanczos48MP : public std::integral_constant static T lanczos_sum_expG_scaled(const T& z) { // LCOV_EXCL_START - static const T num[48] = { + BOOST_MATH_STATIC const T num[48] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, 1.775732062655417998910881298714821053061055705608286949609421120e+58)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, 2.688437299644448784121592662352787426980194425446481703306505899e+58)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, 1.990941408817264621124181941423397180231807676408175000011574647e+58)), @@ -1779,7 +1779,7 @@ struct lanczos48MP : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, 1.155627562127299657410444702080985966726894475302009989071093439e-09)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, 7.725246714864934496649491688787278190129598018071339049048385845e-13)) }; - static const T denom[48] = { + BOOST_MATH_STATIC const T denom[48] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, 0.000000000000000000000000000000000000000000000000000000000000000e+00)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, 5.502622159812088949850305428800254892961651752960000000000000000e+57)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, 2.430336111272256671478593169569751383305061494947840000000000000e+58)), @@ -1838,7 +1838,7 @@ struct lanczos48MP : public std::integral_constant static T lanczos_sum_near_1(const T& dz) { // LCOV_EXCL_START - static const T d[47] = { + BOOST_MATH_STATIC const T d[47] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, 1.059629332377126683204423480567078764834299559082175332563440691e+01)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, -1.045539783916612448318159279915745234781500064405838259582295756e+02)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, 4.784116147862702971548198855631720823614071322755242269800139953e+02)), @@ -1900,7 +1900,7 @@ struct lanczos48MP : public std::integral_constant static T lanczos_sum_near_2(const T& dz) { // LCOV_EXCL_START - static const T d[47] = { + BOOST_MATH_STATIC const T d[47] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, 1.201442621036266842137537764128372139686555918574926377003612763e+02)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, -1.185467427150643969519910927764836582205108528009141221591420898e+03)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 201, 5.424388386017623557963301151646679462091516489317860889362683594e+03)), @@ -1973,7 +1973,7 @@ struct lanczos49MP : public std::integral_constant static T lanczos_sum(const T& z) { // LCOV_EXCL_START - static const T num[49] = { + BOOST_MATH_STATIC const T num[49] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, 2.019754080776483553135944314398390557182640085494778723336498544843678485e+75)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, 2.676059842235360762770131859925648183945167646928679564649946220888559950e+75)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, 1.735650057396761011129552305882284776566019938011364428733911563803428382e+75)), @@ -2024,7 +2024,7 @@ struct lanczos49MP : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, 4.390800780998954208500039666019609185743083611214630479125238184115750385e+03)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, 2.506628274631000502415765284811045253006986740609938316629923576327386304e+00)) }; - static const T denom[49] = { + BOOST_MATH_STATIC const T denom[49] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, 0.000000000000000000000000000000000000000000000000000000000000000000000000e+00)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, 2.586232415111681806429643551536119799691976323891200000000000000000000000e+59)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, 1.147760594457772724544789095126583405046340554378444800000000000000000000e+60)), @@ -2083,7 +2083,7 @@ struct lanczos49MP : public std::integral_constant static T lanczos_sum_expG_scaled(const T& z) { // LCOV_EXCL_START - static const T num[49] = { + BOOST_MATH_STATIC const T num[49] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, 9.256115936295239128792053510340342045264892843178101822334871337037830072e+59)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, 1.226382973449509462464247401218271019985727521806127065773488938845990367e+60)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, 7.954125855720840120393676022050001333138789037332565663424594891457273557e+59)), @@ -2134,7 +2134,7 @@ struct lanczos49MP : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, 2.012213341659767638341287600182102653785253052492980766472349845276996656e-12)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, 1.148735984247176123115370642724455566337349193609892794757225210307646070e-15)) }; - static const T denom[49] = { + BOOST_MATH_STATIC const T denom[49] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, 0.000000000000000000000000000000000000000000000000000000000000000000000000e+00)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, 2.586232415111681806429643551536119799691976323891200000000000000000000000e+59)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, 1.147760594457772724544789095126583405046340554378444800000000000000000000e+60)), @@ -2194,7 +2194,7 @@ struct lanczos49MP : public std::integral_constant static T lanczos_sum_near_1(const T& dz) { // LCOV_EXCL_START - static const T d[48] = { + BOOST_MATH_STATIC const T d[48] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, 1.233965513689195496302526816415068018137532804347903252026160914018410959e+01)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, -1.432567696701419045483804034990696504881298696037704685583731202573594084e+02)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, 7.800990151010204780591569831451389602736047219596430673280355834870101274e+02)), @@ -2257,7 +2257,7 @@ struct lanczos49MP : public std::integral_constant static T lanczos_sum_near_2(const T& dz) { // LCOV_EXCL_START - static const T d[48] = { + BOOST_MATH_STATIC const T d[48] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, 1.614127734928823683399031924928203896697519780457812139739363243361356121e+02)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, -1.873915620620241270111954934939697069495813017577862172724257417200307532e+03)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 234, 1.020433263568799913803105156119729477192007677199414299858195073560627451e+04)), @@ -2337,7 +2337,7 @@ struct lanczos52MP : public std::integral_constant static T lanczos_sum(const T& z) { // LCOV_EXCL_START - static const T num[52] = { + BOOST_MATH_STATIC const T num[52] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, 6.2155666558597192337239536765115831322604714024167432764126799013946738944179064162e+86)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, 6.4127424062560995063147129656553600039438028633959646865531341376543275935920940510e+86)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, 3.2432219642804430367752303997394644425738553439619047355470691880100895245432999409e+86)), @@ -2391,7 +2391,7 @@ struct lanczos52MP : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, 6.3192906485096381210566149918556620595525679738152760526187454875638091923687554946e+03)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, 2.5066282746310005024157652848110452530069867406099383166299235763422936546004304390e+00)) }; - static const T denom[52] = { + BOOST_MATH_STATIC const T denom[52] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, 0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000e+00)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, 3.0414093201713378043612608166064768844377641568960512000000000000000000000000000000e+64)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, 1.3683925049359750564345782687270252191318781054337155072000000000000000000000000000e+65)), @@ -2453,7 +2453,7 @@ struct lanczos52MP : public std::integral_constant static T lanczos_sum_expG_scaled(const T& z) { // LCOV_EXCL_START - static const T num[52] = { + BOOST_MATH_STATIC const T num[52] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, 1.2968364952374867351881152115042817894191583875220489481700563388077315440993668645e+65)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, 1.3379758994539627857606593702434364057385206718035611620158459666404856221820703129e+65)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, 6.7667661507089657936560642518188013126674666141084536651063996312630940638352438169e+64)), @@ -2507,7 +2507,7 @@ struct lanczos52MP : public std::integral_constant static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, 1.3184778139696006596104645792244972612333458493576785210966728195969324996631733257e-18)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, 5.2299125832253333486600023635817464870204660970908989075481425992405717273229096642e-22)) }; - static const T denom[52] = { + BOOST_MATH_STATIC const T denom[52] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, 0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000e+00)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, 3.0414093201713378043612608166064768844377641568960512000000000000000000000000000000e+64)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, 1.3683925049359750564345782687270252191318781054337155072000000000000000000000000000e+65)), @@ -2570,7 +2570,7 @@ struct lanczos52MP : public std::integral_constant static T lanczos_sum_near_1(const T& dz) { // LCOV_EXCL_START - static const T d[56] = { + BOOST_MATH_STATIC const T d[56] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, 1.4249481633301349696310814410227012806541100102720500928500445853537331413655453290e+01)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, -1.9263209672927829270913652941762375058727326960303110137656951784697992824730035351e+02)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, 1.2326134462101140657073655882621393643823409472993225649429843685598155061860815843e+03)), @@ -2641,7 +2641,7 @@ struct lanczos52MP : public std::integral_constant static T lanczos_sum_near_2(const T& dz) { // LCOV_EXCL_START - static const T d[56] = { + BOOST_MATH_STATIC const T d[56] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, 2.1359871474796665853092357455924330354587340093067807143261699873815704783987359772e+02)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, -2.8875414095359657817766255009397774415784763914903057809977502598124862632510767554e+03)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 267, 1.8476787764422274017528261804071971508619123082396685980448133660376964287516316704e+04)), @@ -2726,7 +2726,7 @@ struct undefined_lanczos : public std::integral_constant struct lanczos { - static constexpr auto target_precision = policies::precision::type::value <= 0 ? (std::numeric_limits::max)()-2 : + BOOST_MATH_STATIC constexpr auto target_precision = policies::precision::type::value <= 0 ? (std::numeric_limits::max)()-2 : policies::precision::type::value; using type = typename std::conditional<(target_precision <= lanczos6m24::value), lanczos6m24, From 95b54a6cd9373885ecd01c349415ced7c9861e44 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Mon, 22 Jul 2024 15:03:00 -0400 Subject: [PATCH 53/64] Apply GPU to rationals and series evaluations --- include/boost/math/tools/rational.hpp | 32 +++++++++++++-------------- include/boost/math/tools/series.hpp | 18 +++++++-------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/include/boost/math/tools/rational.hpp b/include/boost/math/tools/rational.hpp index 69b725153..b65700f62 100644 --- a/include/boost/math/tools/rational.hpp +++ b/include/boost/math/tools/rational.hpp @@ -168,12 +168,12 @@ namespace boost{ namespace math{ namespace tools{ // Forward declaration to keep two phase lookup happy: // template -U evaluate_polynomial(const T* poly, U const& z, std::size_t count) BOOST_MATH_NOEXCEPT(U); +BOOST_MATH_GPU_ENABLED U evaluate_polynomial(const T* poly, U const& z, std::size_t count) BOOST_MATH_NOEXCEPT(U); namespace detail{ template -inline V evaluate_polynomial_c_imp(const T* a, const V& val, const Tag*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& val, const Tag*) BOOST_MATH_NOEXCEPT(V) { return evaluate_polynomial(a, val, Tag::value); } @@ -186,7 +186,7 @@ inline V evaluate_polynomial_c_imp(const T* a, const V& val, const Tag*) BOOST_M // the loop expanded versions above: // template -inline U evaluate_polynomial(const T* poly, U const& z, std::size_t count) BOOST_MATH_NOEXCEPT(U) +BOOST_MATH_GPU_ENABLED inline U evaluate_polynomial(const T* poly, U const& z, std::size_t count) BOOST_MATH_NOEXCEPT(U) { BOOST_MATH_ASSERT(count > 0); U sum = static_cast(poly[count - 1]); @@ -202,14 +202,14 @@ inline U evaluate_polynomial(const T* poly, U const& z, std::size_t count) BOOST // implementations above: // template -inline V evaluate_polynomial(const T(&a)[N], const V& val) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial(const T(&a)[N], const V& val) BOOST_MATH_NOEXCEPT(V) { typedef std::integral_constant tag_type; return detail::evaluate_polynomial_c_imp(static_cast(a), val, static_cast(nullptr)); } template -inline V evaluate_polynomial(const std::array& a, const V& val) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial(const std::array& a, const V& val) BOOST_MATH_NOEXCEPT(V) { typedef std::integral_constant tag_type; return detail::evaluate_polynomial_c_imp(static_cast(a.data()), val, static_cast(nullptr)); @@ -218,19 +218,19 @@ inline V evaluate_polynomial(const std::array& a, const V& val) BOOST_MATH_ // Even polynomials are trivial: just square the argument! // template -inline U evaluate_even_polynomial(const T* poly, U z, std::size_t count) BOOST_MATH_NOEXCEPT(U) +BOOST_MATH_GPU_ENABLED inline U evaluate_even_polynomial(const T* poly, U z, std::size_t count) BOOST_MATH_NOEXCEPT(U) { return evaluate_polynomial(poly, U(z*z), count); } template -inline V evaluate_even_polynomial(const T(&a)[N], const V& z) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED BOOST_MATH_GPU_ENABLED inline V evaluate_even_polynomial(const T(&a)[N], const V& z) BOOST_MATH_NOEXCEPT(V) { return evaluate_polynomial(a, V(z*z)); } template -inline V evaluate_even_polynomial(const std::array& a, const V& z) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED BOOST_MATH_GPU_ENABLED inline V evaluate_even_polynomial(const std::array& a, const V& z) BOOST_MATH_NOEXCEPT(V) { return evaluate_polynomial(a, V(z*z)); } @@ -238,32 +238,32 @@ inline V evaluate_even_polynomial(const std::array& a, const V& z) BOOST_MA // Odd polynomials come next: // template -inline U evaluate_odd_polynomial(const T* poly, U z, std::size_t count) BOOST_MATH_NOEXCEPT(U) +BOOST_MATH_GPU_ENABLED inline U evaluate_odd_polynomial(const T* poly, U z, std::size_t count) BOOST_MATH_NOEXCEPT(U) { return poly[0] + z * evaluate_polynomial(poly+1, U(z*z), count-1); } template -inline V evaluate_odd_polynomial(const T(&a)[N], const V& z) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED BOOST_MATH_GPU_ENABLED inline V evaluate_odd_polynomial(const T(&a)[N], const V& z) BOOST_MATH_NOEXCEPT(V) { typedef std::integral_constant tag_type; return a[0] + z * detail::evaluate_polynomial_c_imp(static_cast(a) + 1, V(z*z), static_cast(nullptr)); } template -inline V evaluate_odd_polynomial(const std::array& a, const V& z) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED BOOST_MATH_GPU_ENABLED inline V evaluate_odd_polynomial(const std::array& a, const V& z) BOOST_MATH_NOEXCEPT(V) { typedef std::integral_constant tag_type; return a[0] + z * detail::evaluate_polynomial_c_imp(static_cast(a.data()) + 1, V(z*z), static_cast(nullptr)); } template -V evaluate_rational(const T* num, const U* denom, const V& z_, std::size_t count) BOOST_MATH_NOEXCEPT(V); +BOOST_MATH_GPU_ENABLED V evaluate_rational(const T* num, const U* denom, const V& z_, std::size_t count) BOOST_MATH_NOEXCEPT(V); namespace detail{ template -inline V evaluate_rational_c_imp(const T* num, const U* denom, const V& z, const Tag*) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* num, const U* denom, const V& z, const Tag*) BOOST_MATH_NOEXCEPT(V) { return boost::math::tools::evaluate_rational(num, denom, z, Tag::value); } @@ -278,7 +278,7 @@ inline V evaluate_rational_c_imp(const T* num, const U* denom, const V& z, const // in our Lanczos code for example. // template -V evaluate_rational(const T* num, const U* denom, const V& z_, std::size_t count) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED V evaluate_rational(const T* num, const U* denom, const V& z_, std::size_t count) BOOST_MATH_NOEXCEPT(V) { V z(z_); V s1, s2; @@ -311,13 +311,13 @@ V evaluate_rational(const T* num, const U* denom, const V& z_, std::size_t count } template -inline V evaluate_rational(const T(&a)[N], const U(&b)[N], const V& z) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED BOOST_MATH_GPU_ENABLED inline V evaluate_rational(const T(&a)[N], const U(&b)[N], const V& z) BOOST_MATH_NOEXCEPT(V) { return detail::evaluate_rational_c_imp(a, b, z, static_cast*>(nullptr)); } template -inline V evaluate_rational(const std::array& a, const std::array& b, const V& z) BOOST_MATH_NOEXCEPT(V) +BOOST_MATH_GPU_ENABLED BOOST_MATH_GPU_ENABLED inline V evaluate_rational(const std::array& a, const std::array& b, const V& z) BOOST_MATH_NOEXCEPT(V) { return detail::evaluate_rational_c_imp(a.data(), b.data(), z, static_cast*>(nullptr)); } diff --git a/include/boost/math/tools/series.hpp b/include/boost/math/tools/series.hpp index a4822fea4..a4b5cc626 100644 --- a/include/boost/math/tools/series.hpp +++ b/include/boost/math/tools/series.hpp @@ -21,7 +21,7 @@ namespace boost{ namespace math{ namespace tools{ // Simple series summation come first: // template -inline typename Functor::result_type sum_series(Functor& func, const U& factor, std::uintmax_t& max_terms, const V& init_value) noexcept(BOOST_MATH_IS_FLOAT(typename Functor::result_type) && noexcept(std::declval()())) +BOOST_MATH_GPU_ENABLED inline typename Functor::result_type sum_series(Functor& func, const U& factor, std::uintmax_t& max_terms, const V& init_value) noexcept(BOOST_MATH_IS_FLOAT(typename Functor::result_type) && noexcept(std::declval()())) { BOOST_MATH_STD_USING @@ -44,14 +44,14 @@ inline typename Functor::result_type sum_series(Functor& func, const U& factor, } template -inline typename Functor::result_type sum_series(Functor& func, const U& factor, std::uintmax_t& max_terms) noexcept(BOOST_MATH_IS_FLOAT(typename Functor::result_type) && noexcept(std::declval()())) +BOOST_MATH_GPU_ENABLED inline typename Functor::result_type sum_series(Functor& func, const U& factor, std::uintmax_t& max_terms) noexcept(BOOST_MATH_IS_FLOAT(typename Functor::result_type) && noexcept(std::declval()())) { typename Functor::result_type init_value = 0; return sum_series(func, factor, max_terms, init_value); } template -inline typename Functor::result_type sum_series(Functor& func, int bits, std::uintmax_t& max_terms, const U& init_value) noexcept(BOOST_MATH_IS_FLOAT(typename Functor::result_type) && noexcept(std::declval()())) +BOOST_MATH_GPU_ENABLED inline typename Functor::result_type sum_series(Functor& func, int bits, std::uintmax_t& max_terms, const U& init_value) noexcept(BOOST_MATH_IS_FLOAT(typename Functor::result_type) && noexcept(std::declval()())) { BOOST_MATH_STD_USING typedef typename Functor::result_type result_type; @@ -60,7 +60,7 @@ inline typename Functor::result_type sum_series(Functor& func, int bits, std::ui } template -inline typename Functor::result_type sum_series(Functor& func, int bits) noexcept(BOOST_MATH_IS_FLOAT(typename Functor::result_type) && noexcept(std::declval()())) +BOOST_MATH_GPU_ENABLED inline typename Functor::result_type sum_series(Functor& func, int bits) noexcept(BOOST_MATH_IS_FLOAT(typename Functor::result_type) && noexcept(std::declval()())) { BOOST_MATH_STD_USING typedef typename Functor::result_type result_type; @@ -70,7 +70,7 @@ inline typename Functor::result_type sum_series(Functor& func, int bits) noexcep } template -inline typename Functor::result_type sum_series(Functor& func, int bits, std::uintmax_t& max_terms) noexcept(BOOST_MATH_IS_FLOAT(typename Functor::result_type) && noexcept(std::declval()())) +BOOST_MATH_GPU_ENABLED inline typename Functor::result_type sum_series(Functor& func, int bits, std::uintmax_t& max_terms) noexcept(BOOST_MATH_IS_FLOAT(typename Functor::result_type) && noexcept(std::declval()())) { BOOST_MATH_STD_USING typedef typename Functor::result_type result_type; @@ -79,7 +79,7 @@ inline typename Functor::result_type sum_series(Functor& func, int bits, std::ui } template -inline typename Functor::result_type sum_series(Functor& func, int bits, const U& init_value) noexcept(BOOST_MATH_IS_FLOAT(typename Functor::result_type) && noexcept(std::declval()())) +BOOST_MATH_GPU_ENABLED inline typename Functor::result_type sum_series(Functor& func, int bits, const U& init_value) noexcept(BOOST_MATH_IS_FLOAT(typename Functor::result_type) && noexcept(std::declval()())) { BOOST_MATH_STD_USING std::uintmax_t iters = (std::numeric_limits::max)(); @@ -89,7 +89,7 @@ inline typename Functor::result_type sum_series(Functor& func, int bits, const U // Checked summation: // template -inline typename Functor::result_type checked_sum_series(Functor& func, const U& factor, std::uintmax_t& max_terms, const V& init_value, V& norm) noexcept(BOOST_MATH_IS_FLOAT(typename Functor::result_type) && noexcept(std::declval()())) +BOOST_MATH_GPU_ENABLED inline typename Functor::result_type checked_sum_series(Functor& func, const U& factor, std::uintmax_t& max_terms, const V& init_value, V& norm) noexcept(BOOST_MATH_IS_FLOAT(typename Functor::result_type) && noexcept(std::declval()())) { BOOST_MATH_STD_USING @@ -125,7 +125,7 @@ inline typename Functor::result_type checked_sum_series(Functor& func, const U& // in any case the result is still much better than a naive summation. // template -inline typename Functor::result_type kahan_sum_series(Functor& func, int bits) noexcept(BOOST_MATH_IS_FLOAT(typename Functor::result_type) && noexcept(std::declval()())) +BOOST_MATH_GPU_ENABLED inline typename Functor::result_type kahan_sum_series(Functor& func, int bits) noexcept(BOOST_MATH_IS_FLOAT(typename Functor::result_type) && noexcept(std::declval()())) { BOOST_MATH_STD_USING @@ -148,7 +148,7 @@ inline typename Functor::result_type kahan_sum_series(Functor& func, int bits) n } template -inline typename Functor::result_type kahan_sum_series(Functor& func, int bits, std::uintmax_t& max_terms) noexcept(BOOST_MATH_IS_FLOAT(typename Functor::result_type) && noexcept(std::declval()())) +BOOST_MATH_GPU_ENABLED inline typename Functor::result_type kahan_sum_series(Functor& func, int bits, std::uintmax_t& max_terms) noexcept(BOOST_MATH_IS_FLOAT(typename Functor::result_type) && noexcept(std::declval()())) { BOOST_MATH_STD_USING From 59d12eea92dd24bfec5d8884c29323de2c4f13da Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Mon, 22 Jul 2024 15:03:14 -0400 Subject: [PATCH 54/64] Allow beta to be used on GPU --- include/boost/math/special_functions/beta.hpp | 95 ++++++++++--------- .../boost/math/special_functions/math_fwd.hpp | 54 +++++------ 2 files changed, 79 insertions(+), 70 deletions(-) diff --git a/include/boost/math/special_functions/beta.hpp b/include/boost/math/special_functions/beta.hpp index c36e1f0d0..c9b4eec2f 100644 --- a/include/boost/math/special_functions/beta.hpp +++ b/include/boost/math/special_functions/beta.hpp @@ -1,4 +1,5 @@ // (C) Copyright John Maddock 2006. +// (C) Copyright Matt Borland 2024. // 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) @@ -31,14 +32,16 @@ namespace detail{ // Implementation of Beta(a,b) using the Lanczos approximation: // template -T beta_imp(T a, T b, const Lanczos&, const Policy& pol) +BOOST_MATH_GPU_ENABLED T beta_imp(T a, T b, const Lanczos&, const Policy& pol) { BOOST_MATH_STD_USING // for ADL of std names + #ifndef BOOST_MATH_NO_EXCEPTIONS if(a <= 0) return policies::raise_domain_error("boost::math::beta<%1%>(%1%,%1%)", "The arguments to the beta function must be greater than zero (got a=%1%).", a, pol); if(b <= 0) return policies::raise_domain_error("boost::math::beta<%1%>(%1%,%1%)", "The arguments to the beta function must be greater than zero (got b=%1%).", b, pol); + #endif T result; // LCOV_EXCL_LINE @@ -85,7 +88,9 @@ T beta_imp(T a, T b, const Lanczos&, const Policy& pol) */ if(a < b) - std::swap(a, b); + { + BOOST_MATH_GPU_SAFE_SWAP(a, b); + } // Lanczos calculation: T agh = static_cast(a + Lanczos::g() - 0.5f); @@ -121,7 +126,7 @@ T beta_imp(T a, T b, const Lanczos&, const Policy& pol) // (Caution this is slow!!!): // template -T beta_imp(T a, T b, const lanczos::undefined_lanczos& l, const Policy& pol) +BOOST_MATH_GPU_ENABLED T beta_imp(T a, T b, const lanczos::undefined_lanczos& l, const Policy& pol) { BOOST_MATH_STD_USING @@ -204,7 +209,7 @@ T beta_imp(T a, T b, const lanczos::undefined_lanczos& l, const Policy& pol) // horrendous cancellation errors. // template -T ibeta_power_terms(T a, +BOOST_MATH_GPU_ENABLED T ibeta_power_terms(T a, T b, T x, T y, @@ -445,7 +450,7 @@ T ibeta_power_terms(T a, // This version is generic, slow, and does not use the Lanczos approximation. // template -T ibeta_power_terms(T a, +BOOST_MATH_GPU_ENABLED T ibeta_power_terms(T a, T b, T x, T y, @@ -554,7 +559,7 @@ T ibeta_power_terms(T a, // exp(a * log1p((xb - ya) / a + p + p(xb - ya) / a)) // // Analogously, when a > b we can just swap all the terms around. - // + // // Finally, there are a few cases (x or y is unity) when the above logic can't be used // or where there is no logarithmic cancellation and accuracy is better just using // the regular formula: @@ -628,8 +633,8 @@ template struct ibeta_series_t { typedef T result_type; - ibeta_series_t(T a_, T b_, T x_, T mult) : result(mult), x(x_), apn(a_), poch(1-b_), n(1) {} - T operator()() + BOOST_MATH_GPU_ENABLED ibeta_series_t(T a_, T b_, T x_, T mult) : result(mult), x(x_), apn(a_), poch(1-b_), n(1) {} + BOOST_MATH_GPU_ENABLED T operator()() { T r = result / apn; apn += 1; @@ -644,7 +649,7 @@ struct ibeta_series_t }; template -T ibeta_series(T a, T b, T x, T s0, const Lanczos&, bool normalised, T* p_derivative, T y, const Policy& pol) +BOOST_MATH_GPU_ENABLED T ibeta_series(T a, T b, T x, T s0, const Lanczos&, bool normalised, T* p_derivative, T y, const Policy& pol) { BOOST_MATH_STD_USING @@ -722,7 +727,7 @@ T ibeta_series(T a, T b, T x, T s0, const Lanczos&, bool normalised, T* p_deriva // Incomplete Beta series again, this time without Lanczos support: // template -T ibeta_series(T a, T b, T x, T s0, const boost::math::lanczos::undefined_lanczos& l, bool normalised, T* p_derivative, T y, const Policy& pol) +BOOST_MATH_GPU_ENABLED T ibeta_series(T a, T b, T x, T s0, const boost::math::lanczos::undefined_lanczos& l, bool normalised, T* p_derivative, T y, const Policy& pol) { BOOST_MATH_STD_USING @@ -788,9 +793,9 @@ struct ibeta_fraction2_t { typedef std::pair result_type; - ibeta_fraction2_t(T a_, T b_, T x_, T y_) : a(a_), b(b_), x(x_), y(y_), m(0) {} + BOOST_MATH_GPU_ENABLED ibeta_fraction2_t(T a_, T b_, T x_, T y_) : a(a_), b(b_), x(x_), y(y_), m(0) {} - result_type operator()() + BOOST_MATH_GPU_ENABLED result_type operator()() { T aN = (a + m - 1) * (a + b + m - 1) * m * (b - m) * x * x; T denom = (a + 2 * m - 1); @@ -813,7 +818,7 @@ struct ibeta_fraction2_t // Evaluate the incomplete beta via the continued fraction representation: // template -inline T ibeta_fraction2(T a, T b, T x, T y, const Policy& pol, bool normalised, T* p_derivative) +BOOST_MATH_GPU_ENABLED inline T ibeta_fraction2(T a, T b, T x, T y, const Policy& pol, bool normalised, T* p_derivative) { typedef typename lanczos::lanczos::type lanczos_type; BOOST_MATH_STD_USING @@ -836,7 +841,7 @@ inline T ibeta_fraction2(T a, T b, T x, T y, const Policy& pol, bool normalised, // Computes the difference between ibeta(a,b,x) and ibeta(a+k,b,x): // template -T ibeta_a_step(T a, T b, T x, T y, int k, const Policy& pol, bool normalised, T* p_derivative) +BOOST_MATH_GPU_ENABLED T ibeta_a_step(T a, T b, T x, T y, int k, const Policy& pol, bool normalised, T* p_derivative) { typedef typename lanczos::lanczos::type lanczos_type; @@ -870,7 +875,7 @@ T ibeta_a_step(T a, T b, T x, T y, int k, const Policy& pol, bool normalised, T* // it is currently only called for small k. // template -inline T rising_factorial_ratio(T a, T b, int k) +BOOST_MATH_GPU_ENABLED inline T rising_factorial_ratio(T a, T b, int k) { // calculate: // (a)(a+1)(a+2)...(a+k-1) @@ -911,13 +916,17 @@ template <> struct Pn_size { static constexpr unsigned value = 15; // ~8-15 digit accuracy +#ifndef BOOST_MATH_HAS_GPU_SUPPORT static_assert(::boost::math::max_factorial::value >= 30, "Type does not provide for 8-15 digits of accuracy."); +#endif }; template <> struct Pn_size { static constexpr unsigned value = 30; // 16-20 digit accuracy +#ifndef BOOST_MATH_HAS_GPU_SUPPORT static_assert(::boost::math::max_factorial::value >= 60, "Type does not provide for 16-20 digits of accuracy."); +#endif }; template <> struct Pn_size @@ -927,7 +936,7 @@ struct Pn_size }; template -T beta_small_b_large_a_series(T a, T b, T x, T y, T s0, T mult, const Policy& pol, bool normalised) +BOOST_MATH_GPU_ENABLED T beta_small_b_large_a_series(T a, T b, T x, T y, T s0, T mult, const Policy& pol, bool normalised) { typedef typename lanczos::lanczos::type lanczos_type; BOOST_MATH_STD_USING @@ -1033,7 +1042,7 @@ T beta_small_b_large_a_series(T a, T b, T x, T y, T s0, T mult, const Policy& po // complement of the binomial distribution cdf and use this finite sum. // template -T binomial_ccdf(T n, T k, T x, T y, const Policy& pol) +BOOST_MATH_GPU_ENABLED T binomial_ccdf(T n, T k, T x, T y, const Policy& pol) { BOOST_MATH_STD_USING // ADL of std names @@ -1098,7 +1107,7 @@ T binomial_ccdf(T n, T k, T x, T y, const Policy& pol) // each domain: // template -T ibeta_imp(T a, T b, T x, const Policy& pol, bool inv, bool normalised, T* p_derivative) +BOOST_MATH_GPU_ENABLED T ibeta_imp(T a, T b, T x, const Policy& pol, bool inv, bool normalised, T* p_derivative) { static const char* function = "boost::math::ibeta<%1%>(%1%, %1%, %1%)"; typedef typename lanczos::lanczos::type lanczos_type; @@ -1184,8 +1193,8 @@ T ibeta_imp(T a, T b, T x, const Policy& pol, bool inv, bool normalised, T* p_de } if(a == 1) { - std::swap(a, b); - std::swap(x, y); + BOOST_MATH_GPU_SAFE_SWAP(a, b); + BOOST_MATH_GPU_SAFE_SWAP(x, y); invert = !invert; } if(b == 1) @@ -1218,8 +1227,8 @@ T ibeta_imp(T a, T b, T x, const Policy& pol, bool inv, bool normalised, T* p_de { if(x > 0.5) { - std::swap(a, b); - std::swap(x, y); + BOOST_MATH_GPU_SAFE_SWAP(a, b); + BOOST_MATH_GPU_SAFE_SWAP(x, y); invert = !invert; BOOST_MATH_INSTRUMENT_VARIABLE(invert); } @@ -1243,8 +1252,8 @@ T ibeta_imp(T a, T b, T x, const Policy& pol, bool inv, bool normalised, T* p_de } else { - std::swap(a, b); - std::swap(x, y); + BOOST_MATH_GPU_SAFE_SWAP(a, b); + BOOST_MATH_GPU_SAFE_SWAP(x, y); invert = !invert; if(y >= 0.3) { @@ -1309,8 +1318,8 @@ T ibeta_imp(T a, T b, T x, const Policy& pol, bool inv, bool normalised, T* p_de } else { - std::swap(a, b); - std::swap(x, y); + BOOST_MATH_GPU_SAFE_SWAP(a, b); + BOOST_MATH_GPU_SAFE_SWAP(x, y); invert = !invert; if(y >= 0.3) @@ -1387,8 +1396,8 @@ T ibeta_imp(T a, T b, T x, const Policy& pol, bool inv, bool normalised, T* p_de } if(lambda < 0) { - std::swap(a, b); - std::swap(x, y); + BOOST_MATH_GPU_SAFE_SWAP(a, b); + BOOST_MATH_GPU_SAFE_SWAP(x, y); invert = !invert; BOOST_MATH_INSTRUMENT_VARIABLE(invert); } @@ -1502,13 +1511,13 @@ T ibeta_imp(T a, T b, T x, const Policy& pol, bool inv, bool normalised, T* p_de } // template T ibeta_imp(T a, T b, T x, const Lanczos& l, bool inv, bool normalised) template -inline T ibeta_imp(T a, T b, T x, const Policy& pol, bool inv, bool normalised) +BOOST_MATH_GPU_ENABLED inline T ibeta_imp(T a, T b, T x, const Policy& pol, bool inv, bool normalised) { return ibeta_imp(a, b, x, pol, inv, normalised, static_cast(nullptr)); } template -T ibeta_derivative_imp(T a, T b, T x, const Policy& pol) +BOOST_MATH_GPU_ENABLED T ibeta_derivative_imp(T a, T b, T x, const Policy& pol) { static const char* function = "ibeta_derivative<%1%>(%1%,%1%,%1%)"; // @@ -1559,7 +1568,7 @@ T ibeta_derivative_imp(T a, T b, T x, const Policy& pol) // Some forwarding functions that disambiguate the third argument type: // template -inline typename tools::promote_args::type +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type beta(RT1 a, RT2 b, const Policy&, const std::true_type*) { BOOST_FPU_EXCEPTION_GUARD @@ -1576,7 +1585,7 @@ inline typename tools::promote_args::type return policies::checked_narrowing_cast(detail::beta_imp(static_cast(a), static_cast(b), evaluation_type(), forwarding_policy()), "boost::math::beta<%1%>(%1%,%1%)"); } template -inline typename tools::promote_args::type +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type beta(RT1 a, RT2 b, RT3 x, const std::false_type*) { return boost::math::beta(a, b, x, policies::policy<>()); @@ -1589,7 +1598,7 @@ inline typename tools::promote_args::type // and forward to the implementation functions: // template -inline typename tools::promote_args::type +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type beta(RT1 a, RT2 b, A arg) { using tag = typename policies::is_policy::type; @@ -1598,14 +1607,14 @@ inline typename tools::promote_args::type } template -inline typename tools::promote_args::type +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type beta(RT1 a, RT2 b) { return boost::math::beta(a, b, policies::policy<>()); } template -inline typename tools::promote_args::type +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type beta(RT1 a, RT2 b, RT3 x, const Policy&) { BOOST_FPU_EXCEPTION_GUARD @@ -1622,7 +1631,7 @@ inline typename tools::promote_args::type } template -inline typename tools::promote_args::type +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type betac(RT1 a, RT2 b, RT3 x, const Policy&) { BOOST_FPU_EXCEPTION_GUARD @@ -1638,14 +1647,14 @@ inline typename tools::promote_args::type return policies::checked_narrowing_cast(detail::ibeta_imp(static_cast(a), static_cast(b), static_cast(x), forwarding_policy(), true, false), "boost::math::betac<%1%>(%1%,%1%,%1%)"); } template -inline typename tools::promote_args::type +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type betac(RT1 a, RT2 b, RT3 x) { return boost::math::betac(a, b, x, policies::policy<>()); } template -inline typename tools::promote_args::type +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type ibeta(RT1 a, RT2 b, RT3 x, const Policy&) { BOOST_FPU_EXCEPTION_GUARD @@ -1661,14 +1670,14 @@ inline typename tools::promote_args::type return policies::checked_narrowing_cast(detail::ibeta_imp(static_cast(a), static_cast(b), static_cast(x), forwarding_policy(), false, true), "boost::math::ibeta<%1%>(%1%,%1%,%1%)"); } template -inline typename tools::promote_args::type +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type ibeta(RT1 a, RT2 b, RT3 x) { return boost::math::ibeta(a, b, x, policies::policy<>()); } template -inline typename tools::promote_args::type +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type ibetac(RT1 a, RT2 b, RT3 x, const Policy&) { BOOST_FPU_EXCEPTION_GUARD @@ -1684,14 +1693,14 @@ inline typename tools::promote_args::type return policies::checked_narrowing_cast(detail::ibeta_imp(static_cast(a), static_cast(b), static_cast(x), forwarding_policy(), true, true), "boost::math::ibetac<%1%>(%1%,%1%,%1%)"); } template -inline typename tools::promote_args::type +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type ibetac(RT1 a, RT2 b, RT3 x) { return boost::math::ibetac(a, b, x, policies::policy<>()); } template -inline typename tools::promote_args::type +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type ibeta_derivative(RT1 a, RT2 b, RT3 x, const Policy&) { BOOST_FPU_EXCEPTION_GUARD @@ -1707,7 +1716,7 @@ inline typename tools::promote_args::type return policies::checked_narrowing_cast(detail::ibeta_derivative_imp(static_cast(a), static_cast(b), static_cast(x), forwarding_policy()), "boost::math::ibeta_derivative<%1%>(%1%,%1%,%1%)"); } template -inline typename tools::promote_args::type +BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type ibeta_derivative(RT1 a, RT2 b, RT3 x) { return boost::math::ibeta_derivative(a, b, x, policies::policy<>()); diff --git a/include/boost/math/special_functions/math_fwd.hpp b/include/boost/math/special_functions/math_fwd.hpp index ee43684ce..6119c8e86 100644 --- a/include/boost/math/special_functions/math_fwd.hpp +++ b/include/boost/math/special_functions/math_fwd.hpp @@ -39,111 +39,111 @@ namespace boost // Beta functions. template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t beta(RT1 a, RT2 b); // Beta function (2 arguments). template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t beta(RT1 a, RT2 b, A x); // Beta function (3 arguments). template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t beta(RT1 a, RT2 b, RT3 x, const Policy& pol); // Beta function (3 arguments). template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t betac(RT1 a, RT2 b, RT3 x); template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t betac(RT1 a, RT2 b, RT3 x, const Policy& pol); template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ibeta(RT1 a, RT2 b, RT3 x); // Incomplete beta function. template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ibeta(RT1 a, RT2 b, RT3 x, const Policy& pol); // Incomplete beta function. template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ibetac(RT1 a, RT2 b, RT3 x); // Incomplete beta complement function. template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ibetac(RT1 a, RT2 b, RT3 x, const Policy& pol); // Incomplete beta complement function. template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ibeta_inv(T1 a, T2 b, T3 p, T4* py); template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ibeta_inv(T1 a, T2 b, T3 p, T4* py, const Policy& pol); template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ibeta_inv(RT1 a, RT2 b, RT3 p); // Incomplete beta inverse function. template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ibeta_inv(RT1 a, RT2 b, RT3 p, const Policy&); // Incomplete beta inverse function. template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ibeta_inva(RT1 a, RT2 b, RT3 p); // Incomplete beta inverse function. template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ibeta_inva(RT1 a, RT2 b, RT3 p, const Policy&); // Incomplete beta inverse function. template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ibeta_invb(RT1 a, RT2 b, RT3 p); // Incomplete beta inverse function. template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ibeta_invb(RT1 a, RT2 b, RT3 p, const Policy&); // Incomplete beta inverse function. template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ibetac_inv(T1 a, T2 b, T3 q, T4* py); template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ibetac_inv(T1 a, T2 b, T3 q, T4* py, const Policy& pol); template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ibetac_inv(RT1 a, RT2 b, RT3 q); // Incomplete beta complement inverse function. template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ibetac_inv(RT1 a, RT2 b, RT3 q, const Policy&); // Incomplete beta complement inverse function. template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ibetac_inva(RT1 a, RT2 b, RT3 q); // Incomplete beta complement inverse function. template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ibetac_inva(RT1 a, RT2 b, RT3 q, const Policy&); // Incomplete beta complement inverse function. template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ibetac_invb(RT1 a, RT2 b, RT3 q); // Incomplete beta complement inverse function. template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ibetac_invb(RT1 a, RT2 b, RT3 q, const Policy&); // Incomplete beta complement inverse function. template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ibeta_derivative(RT1 a, RT2 b, RT3 x); // derivative of incomplete beta template - tools::promote_args_t + BOOST_MATH_GPU_ENABLED tools::promote_args_t ibeta_derivative(RT1 a, RT2 b, RT3 x, const Policy& pol); // derivative of incomplete beta // Binomial: From 4924b1834d439601eac96db8b36e7e4e155379ad Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Mon, 22 Jul 2024 15:24:48 -0400 Subject: [PATCH 55/64] Add float beta testing --- test/cuda_jamfile | 1 + test/test_beta_float.cu | 130 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 131 insertions(+) create mode 100644 test/test_beta_float.cu diff --git a/test/cuda_jamfile b/test/cuda_jamfile index c6ce3d002..f4740a210 100644 --- a/test/cuda_jamfile +++ b/test/cuda_jamfile @@ -28,3 +28,4 @@ run test_binomial.cpp ; # Special Functions # run test_beta_simple.cpp ; run test_beta_double.cu ; +run test_beta_float.cu ; \ No newline at end of file diff --git a/test/test_beta_float.cu b/test/test_beta_float.cu new file mode 100644 index 000000000..c4c078f37 --- /dev/null +++ b/test/test_beta_float.cu @@ -0,0 +1,130 @@ +// Copyright John Maddock 2016. +// 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) + +#define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error + +#include +#include +#include +#include +#include +#include +#include "cuda_managed_ptr.hpp" +#include "stopwatch.hpp" + +// For the CUDA runtime routines (prefixed with "cuda_") +#include + +typedef float float_type; + +/** + * CUDA Kernel Device code + * + */ +__global__ void cuda_test(const float_type *in1, const float_type * in2, float_type *out, int numElements) +{ + using std::cos; + int i = blockDim.x * blockIdx.x + threadIdx.x; + + if (i < numElements) + { + out[i] = boost::math::beta(in1[i], in2[i]); + } +} + +template struct table_type { typedef T type; }; +typedef float_type T; +#define SC_(x) static_cast(x) + +#include "beta_med_data.ipp" +#include "beta_small_data.ipp" + +/** + * Host main routine + */ +int main(void) +{ + try{ + // Consolidate the test data: + std::vector v1, v2; + + for(unsigned i = 0; i < beta_med_data.size(); ++i) + { + v1.push_back(beta_med_data[i][0]); + v2.push_back(beta_med_data[i][1]); + } + for(unsigned i = 0; i < beta_small_data.size(); ++i) + { + v1.push_back(beta_small_data[i][0]); + v2.push_back(beta_small_data[i][1]); + } + + // Error code to check return values for CUDA calls + cudaError_t err = cudaSuccess; + + // Print the vector length to be used, and compute its size + int numElements = 50000; + std::cout << "[Vector operation on " << numElements << " elements]" << std::endl; + + // Allocate the managed input vector A + cuda_managed_ptr input_vector1(numElements); + cuda_managed_ptr input_vector2(numElements); + + // Allocate the managed output vector C + cuda_managed_ptr output_vector(numElements); + + // Initialize the input vectors + for (int i = 0; i < numElements; ++i) + { + int table_id = i % v1.size(); + input_vector1[i] = v1[table_id]; + input_vector2[i] = v2[table_id]; + } + + // Launch the Vector Add CUDA Kernel + int threadsPerBlock = 1024; + int blocksPerGrid =(numElements + threadsPerBlock - 1) / threadsPerBlock; + std::cout << "CUDA kernel launch with " << blocksPerGrid << " blocks of " << threadsPerBlock << " threads" << std::endl; + + watch w; + cuda_test<<>>(input_vector1.get(), input_vector2.get(), output_vector.get(), numElements); + cudaDeviceSynchronize(); + std::cout << "CUDA kernal done in " << w.elapsed() << "s" << std::endl; + + err = cudaGetLastError(); + if (err != cudaSuccess) + { + std::cerr << "Failed to launch vectorAdd kernel (error code " << cudaGetErrorString(err) << ")!" << std::endl; + return EXIT_FAILURE; + } + + // Verify that the result vector is correct + std::vector results; + results.reserve(numElements); + w.reset(); + for(int i = 0; i < numElements; ++i) + results.push_back(boost::math::beta(input_vector1[i], input_vector2[i])); + double t = w.elapsed(); + // check the results + for(int i = 0; i < numElements; ++i) + { + if (boost::math::epsilon_difference(output_vector[i], results[i]) > 300) + { + std::cerr << "Result verification failed at element " << i << "!" << std::endl; + std::cerr << "Error rate was: " << boost::math::epsilon_difference(output_vector[i], results[i]) << "eps" << std::endl; + return EXIT_FAILURE; + } + } + + std::cout << "Test PASSED with calculation time: " << t << "s" << std::endl; + std::cout << "Done\n"; + } + catch(const std::exception& e) + { + std::cerr << "Stopped with exception: " << e.what() << std::endl; + } + return 0; +} + From cf58316b60850701a2b4d821ba545398c5b5a445 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Mon, 22 Jul 2024 15:29:36 -0400 Subject: [PATCH 56/64] Disable SSE2 lanczos on GPU --- include/boost/math/special_functions/lanczos.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/math/special_functions/lanczos.hpp b/include/boost/math/special_functions/lanczos.hpp index 7a1934c80..b804bf829 100644 --- a/include/boost/math/special_functions/lanczos.hpp +++ b/include/boost/math/special_functions/lanczos.hpp @@ -2748,7 +2748,7 @@ struct lanczos } // namespace boost #if !defined(_CRAYC) && !defined(__CUDACC__) && (!defined(__GNUC__) || (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ > 3))) -#if ((defined(_M_IX86_FP) && (_M_IX86_FP >= 2)) || defined(__SSE2__) || defined(_M_AMD64) || defined(_M_X64)) && !defined(_MANAGED) +#if ((defined(_M_IX86_FP) && (_M_IX86_FP >= 2)) || defined(__SSE2__) || defined(_M_AMD64) || defined(_M_X64)) && !defined(_MANAGED) && !defined(BOOST_MATH_HAS_GPU_SUPPORT) #include #endif #endif From 42e2f3da7e5d00758d0ee4c0a9f02e3511f8a012 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Mon, 22 Jul 2024 15:29:49 -0400 Subject: [PATCH 57/64] Define policies for trivial testing --- test/test_beta_simple.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/test_beta_simple.cpp b/test/test_beta_simple.cpp index d96af34d9..436b14ab4 100644 --- a/test/test_beta_simple.cpp +++ b/test/test_beta_simple.cpp @@ -5,6 +5,9 @@ // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +#define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error +#define BOOST_MATH_PROMOTE_DOUBLE_POLICY false + #include #include #include "math_unit_test.hpp" From 304a87bc7a38e989a7f1d7ee5f2101f2299a77ba Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Mon, 22 Jul 2024 15:39:59 -0400 Subject: [PATCH 58/64] Changes to allow beta on SYCL --- include/boost/math/special_functions/beta.hpp | 4 +- .../special_functions/detail/ibeta_inv_ab.hpp | 52 +++++++++---------- .../detail/ibeta_inverse.hpp | 4 +- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/include/boost/math/special_functions/beta.hpp b/include/boost/math/special_functions/beta.hpp index c9b4eec2f..769c4589a 100644 --- a/include/boost/math/special_functions/beta.hpp +++ b/include/boost/math/special_functions/beta.hpp @@ -1109,7 +1109,7 @@ BOOST_MATH_GPU_ENABLED T binomial_ccdf(T n, T k, T x, T y, const Policy& pol) template BOOST_MATH_GPU_ENABLED T ibeta_imp(T a, T b, T x, const Policy& pol, bool inv, bool normalised, T* p_derivative) { - static const char* function = "boost::math::ibeta<%1%>(%1%, %1%, %1%)"; + constexpr auto function = "boost::math::ibeta<%1%>(%1%, %1%, %1%)"; typedef typename lanczos::lanczos::type lanczos_type; BOOST_MATH_STD_USING // for ADL of std math functions. @@ -1519,7 +1519,7 @@ BOOST_MATH_GPU_ENABLED inline T ibeta_imp(T a, T b, T x, const Policy& pol, bool template BOOST_MATH_GPU_ENABLED T ibeta_derivative_imp(T a, T b, T x, const Policy& pol) { - static const char* function = "ibeta_derivative<%1%>(%1%,%1%,%1%)"; + constexpr auto function = "ibeta_derivative<%1%>(%1%,%1%,%1%)"; // // start with the usual error checks: // diff --git a/include/boost/math/special_functions/detail/ibeta_inv_ab.hpp b/include/boost/math/special_functions/detail/ibeta_inv_ab.hpp index 0ce0d7560..9e30db2a3 100644 --- a/include/boost/math/special_functions/detail/ibeta_inv_ab.hpp +++ b/include/boost/math/special_functions/detail/ibeta_inv_ab.hpp @@ -173,7 +173,7 @@ typename tools::promote_args::type policies::discrete_quantile<>, policies::assert_undefined<> >::type forwarding_policy; - static const char* function = "boost::math::ibeta_inva<%1%>(%1%,%1%,%1%)"; + constexpr auto function = "boost::math::ibeta_inva<%1%>(%1%,%1%,%1%)"; if(p == 0) { return policies::raise_overflow_error(function, 0, Policy()); @@ -185,28 +185,28 @@ typename tools::promote_args::type return policies::checked_narrowing_cast( detail::ibeta_inv_ab_imp( - static_cast(b), - static_cast(x), - static_cast(p), - static_cast(1 - static_cast(p)), - false, pol), + static_cast(b), + static_cast(x), + static_cast(p), + static_cast(1 - static_cast(p)), + false, pol), function); } template -typename tools::promote_args::type +typename tools::promote_args::type ibetac_inva(RT1 b, RT2 x, RT3 q, const Policy& pol) { typedef typename tools::promote_args::type result_type; typedef typename policies::evaluation::type value_type; typedef typename policies::normalise< - Policy, - policies::promote_float, - policies::promote_double, + Policy, + policies::promote_float, + policies::promote_double, policies::discrete_quantile<>, policies::assert_undefined<> >::type forwarding_policy; - static const char* function = "boost::math::ibetac_inva<%1%>(%1%,%1%,%1%)"; + constexpr auto function = "boost::math::ibetac_inva<%1%>(%1%,%1%,%1%)"; if(q == 1) { return policies::raise_overflow_error(function, 0, Policy()); @@ -218,28 +218,28 @@ typename tools::promote_args::type return policies::checked_narrowing_cast( detail::ibeta_inv_ab_imp( - static_cast(b), - static_cast(x), - static_cast(1 - static_cast(q)), - static_cast(q), + static_cast(b), + static_cast(x), + static_cast(1 - static_cast(q)), + static_cast(q), false, pol), function); } template -typename tools::promote_args::type +typename tools::promote_args::type ibeta_invb(RT1 a, RT2 x, RT3 p, const Policy& pol) { typedef typename tools::promote_args::type result_type; typedef typename policies::evaluation::type value_type; typedef typename policies::normalise< - Policy, - policies::promote_float, - policies::promote_double, + Policy, + policies::promote_float, + policies::promote_double, policies::discrete_quantile<>, policies::assert_undefined<> >::type forwarding_policy; - static const char* function = "boost::math::ibeta_invb<%1%>(%1%,%1%,%1%)"; + constexpr auto function = "boost::math::ibeta_invb<%1%>(%1%,%1%,%1%)"; if(p == 0) { return tools::min_value(); @@ -251,19 +251,19 @@ typename tools::promote_args::type return policies::checked_narrowing_cast( detail::ibeta_inv_ab_imp( - static_cast(a), - static_cast(x), - static_cast(p), - static_cast(1 - static_cast(p)), + static_cast(a), + static_cast(x), + static_cast(p), + static_cast(1 - static_cast(p)), true, pol), function); } template -typename tools::promote_args::type +typename tools::promote_args::type ibetac_invb(RT1 a, RT2 x, RT3 q, const Policy& pol) { - static const char* function = "boost::math::ibeta_invb<%1%>(%1%, %1%, %1%)"; + constexpr auto function = "boost::math::ibeta_invb<%1%>(%1%, %1%, %1%)"; typedef typename tools::promote_args::type result_type; typedef typename policies::evaluation::type value_type; typedef typename policies::normalise< diff --git a/include/boost/math/special_functions/detail/ibeta_inverse.hpp b/include/boost/math/special_functions/detail/ibeta_inverse.hpp index 70f17a0b1..9e4fb08d4 100644 --- a/include/boost/math/special_functions/detail/ibeta_inverse.hpp +++ b/include/boost/math/special_functions/detail/ibeta_inverse.hpp @@ -971,7 +971,7 @@ template inline typename tools::promote_args::type ibeta_inv(T1 a, T2 b, T3 p, T4* py, const Policy& pol) { - static const char* function = "boost::math::ibeta_inv<%1%>(%1%,%1%,%1%)"; + constexpr auto function = "boost::math::ibeta_inv<%1%>(%1%,%1%,%1%)"; BOOST_FPU_EXCEPTION_GUARD typedef typename tools::promote_args::type result_type; typedef typename policies::evaluation::type value_type; @@ -1029,7 +1029,7 @@ template inline typename tools::promote_args::type ibetac_inv(T1 a, T2 b, T3 q, T4* py, const Policy& pol) { - static const char* function = "boost::math::ibetac_inv<%1%>(%1%,%1%,%1%)"; + constexpr auto function = "boost::math::ibetac_inv<%1%>(%1%,%1%,%1%)"; BOOST_FPU_EXCEPTION_GUARD typedef typename tools::promote_args::type result_type; typedef typename policies::evaluation::type value_type; From ee000a1cf5c2003bee0e6c388905d15d73c64d7d Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Mon, 22 Jul 2024 15:40:49 -0400 Subject: [PATCH 59/64] Remove test that we know wont pass from SYCL jamfile --- test/sycl_jamfile | 1 - 1 file changed, 1 deletion(-) diff --git a/test/sycl_jamfile b/test/sycl_jamfile index 707772049..679bae0dc 100644 --- a/test/sycl_jamfile +++ b/test/sycl_jamfile @@ -11,7 +11,6 @@ project : requirements # Distributions run test_arcsine.cpp ; -run test_binomial.cpp ; # Special Functions run test_beta_simple.cpp ; From ef892fcb6c5396837a11adf86accf9b3acda1b7e Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Tue, 23 Jul 2024 11:47:07 -0400 Subject: [PATCH 60/64] Reactivate domain error for beta --- include/boost/math/special_functions/beta.hpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/boost/math/special_functions/beta.hpp b/include/boost/math/special_functions/beta.hpp index 769c4589a..25e524d0b 100644 --- a/include/boost/math/special_functions/beta.hpp +++ b/include/boost/math/special_functions/beta.hpp @@ -36,12 +36,10 @@ BOOST_MATH_GPU_ENABLED T beta_imp(T a, T b, const Lanczos&, const Policy& pol) { BOOST_MATH_STD_USING // for ADL of std names - #ifndef BOOST_MATH_NO_EXCEPTIONS if(a <= 0) return policies::raise_domain_error("boost::math::beta<%1%>(%1%,%1%)", "The arguments to the beta function must be greater than zero (got a=%1%).", a, pol); if(b <= 0) return policies::raise_domain_error("boost::math::beta<%1%>(%1%,%1%)", "The arguments to the beta function must be greater than zero (got b=%1%).", b, pol); - #endif T result; // LCOV_EXCL_LINE From d29e9320a7b332be6f7e65fe976fbeb6c28de8b1 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Tue, 23 Jul 2024 11:30:03 -0400 Subject: [PATCH 61/64] Ignore float too small errors --- test/beta_med_data.ipp | 4 ++++ test/test_beta.hpp | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/test/beta_med_data.ipp b/test/beta_med_data.ipp index b1f35d98e..eb3e884b8 100644 --- a/test/beta_med_data.ipp +++ b/test/beta_med_data.ipp @@ -3,6 +3,10 @@ // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +#ifdef __CUDACC__ +#pragma nv_diag_suppress 221 +#endif + static const std::array::type, 3>, 1830> beta_med_data = { { {{ SC_(0.4883005917072296142578125), SC_(0.4883005917072296142578125), SC_(3.245912809500479157065104747353807392371) }}, {{ SC_(3.5808107852935791015625), SC_(0.4883005917072296142578125), SC_(1.007653173802923954909901438393379243537) }}, diff --git a/test/test_beta.hpp b/test/test_beta.hpp index 63a07d18f..e633935a3 100644 --- a/test/test_beta.hpp +++ b/test/test_beta.hpp @@ -10,6 +10,10 @@ # pragma warning (disable : 4180) // qualifier applied to function type has no meaning; ignored #endif +#ifdef __CUDACC__ +#pragma nv_diag_suppress 221 +#endif + #include #define BOOST_TEST_MAIN #include From 03610bec3a49cf62e0262e37b0b2c9e13949bbc6 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Tue, 23 Jul 2024 13:05:48 -0400 Subject: [PATCH 62/64] Remove SYCL macros from errno calls --- include/boost/math/policies/error_handling.hpp | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/include/boost/math/policies/error_handling.hpp b/include/boost/math/policies/error_handling.hpp index 6509b47c3..1329dba10 100644 --- a/include/boost/math/policies/error_handling.hpp +++ b/include/boost/math/policies/error_handling.hpp @@ -233,9 +233,7 @@ BOOST_MATH_GPU_ENABLED inline T raise_domain_error( const T& , const ::boost::math::policies::domain_error< ::boost::math::policies::errno_on_error>&) BOOST_MATH_NOEXCEPT(T) { - #ifndef BOOST_MATH_SYCL_ENABLED errno = EDOM; - #endif // This may or may not do the right thing, but the user asked for the error // to be silent so here we go anyway: return BOOST_MATH_QUIET_NAN(T); @@ -381,9 +379,7 @@ BOOST_MATH_GPU_ENABLED inline T raise_overflow_error( const char* , const ::boost::math::policies::overflow_error< ::boost::math::policies::errno_on_error>&) BOOST_MATH_NOEXCEPT(T) { - #ifndef BOOST_MATH_SYCL_ENABLED errno = ERANGE; - #endif // This may or may not do the right thing, but the user asked for the error // to be silent so here we go anyway: return std::numeric_limits::has_infinity ? std::numeric_limits::infinity() : boost::math::tools::max_value(); @@ -396,9 +392,7 @@ BOOST_MATH_GPU_ENABLED inline T raise_overflow_error( const T&, const ::boost::math::policies::overflow_error< ::boost::math::policies::errno_on_error>&) BOOST_MATH_NOEXCEPT(T) { - #ifndef BOOST_MATH_SYCL_ENABLED errno = ERANGE; - #endif // This may or may not do the right thing, but the user asked for the error // to be silent so here we go anyway: return std::numeric_limits::has_infinity ? std::numeric_limits::infinity() : boost::math::tools::max_value(); @@ -459,9 +453,7 @@ BOOST_MATH_GPU_ENABLED inline T raise_underflow_error( const char* /* message */, const ::boost::math::policies::underflow_error< ::boost::math::policies::errno_on_error>&) BOOST_MATH_NOEXCEPT(T) { - #ifndef BOOST_MATH_SYCL_ENABLED errno = ERANGE; - #endif // This may or may not do the right thing, but the user asked for the error // to be silent so here we go anyway: return T(0); @@ -511,9 +503,7 @@ BOOST_MATH_GPU_ENABLED inline T raise_denorm_error( const T& val, const ::boost::math::policies::denorm_error< ::boost::math::policies::errno_on_error>&) BOOST_MATH_NOEXCEPT(T) { - #ifndef BOOST_MATH_SYCL_ENABLED errno = ERANGE; - #endif // This may or may not do the right thing, but the user asked for the error // to be silent so here we go anyway: return val; @@ -564,9 +554,7 @@ BOOST_MATH_GPU_ENABLED inline T raise_evaluation_error( const T& val, const ::boost::math::policies::evaluation_error< ::boost::math::policies::errno_on_error>&) BOOST_MATH_NOEXCEPT(T) { - #ifndef BOOST_MATH_SYCL_ENABLED errno = EDOM; - #endif // This may or may not do the right thing, but the user asked for the error // to be silent so here we go anyway: return val; @@ -621,9 +609,7 @@ BOOST_MATH_GPU_ENABLED inline TargetType raise_rounding_error( const TargetType&, const ::boost::math::policies::rounding_error< ::boost::math::policies::errno_on_error>&) BOOST_MATH_NOEXCEPT(T) { - #ifndef BOOST_MATH_SYCL_ENABLED errno = ERANGE; - #endif // This may or may not do the right thing, but the user asked for the error // to be silent so here we go anyway: static_assert(std::numeric_limits::is_specialized, "The target type must have std::numeric_limits specialized."); @@ -678,9 +664,7 @@ BOOST_MATH_GPU_ENABLED inline T raise_indeterminate_result_error( const R& result, const ::boost::math::policies::indeterminate_result_error< ::boost::math::policies::errno_on_error>&) { - #ifndef BOOST_MATH_SYCL_ENABLED errno = EDOM; - #endif // This may or may not do the right thing, but the user asked for the error // to be silent so here we go anyway: return result; From 22ae58982b6edbba4422d474698cfd1b08ce7549 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Tue, 23 Jul 2024 13:22:33 -0400 Subject: [PATCH 63/64] Adjust default policy for GPU cases --- include/boost/math/policies/policy.hpp | 34 ++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/include/boost/math/policies/policy.hpp b/include/boost/math/policies/policy.hpp index 5f3dfa7b5..a819a4cb6 100644 --- a/include/boost/math/policies/policy.hpp +++ b/include/boost/math/policies/policy.hpp @@ -33,6 +33,40 @@ namespace policies{ // // Define macros for our default policies, if they're not defined already: // + + +// +// Generic support for GPUs +// +#ifdef BOOST_MATH_HAS_GPU_SUPPORT +# ifndef BOOST_MATH_OVERFLOW_ERROR_POLICY +# define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error +# endif +# ifndef BOOST_MATH_PROMOTE_DOUBLE_POLICY +# define BOOST_MATH_PROMOTE_DOUBLE_POLICY false +# endif +#endif + +// +// Refined support for sycl since it does not support errno +// + +#ifdef BOOST_MATH_ENABLE_SYCL +# ifndef BOOST_MATH_DOMAIN_ERROR_POLICY +# define BOOST_MATH_DOMAIN_ERROR_POLICY ignore_error +# endif +# ifndef BOOST_MATH_POLE_ERROR_POLICY +# define BOOST_MATH_POLE_ERROR_POLICY ignore_error +# endif +# ifndef BOOST_MATH_EVALUATION_ERROR_POLICY +# define BOOST_MATH_EVALUATION_ERROR_POLICY ignore_error +# endif +# ifndef BOOST_MATH_ROUNDING_ERROR_POLICY +# define BOOST_MATH_ROUNDING_ERROR_POLICY ignore_error +# endif +#endif + +// // Special cases for exceptions disabled first: // #ifdef BOOST_MATH_NO_EXCEPTIONS From 3fdc29475cf09ee63760830ccb83c817c4699722 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Tue, 23 Jul 2024 14:08:40 -0400 Subject: [PATCH 64/64] Add boost math alias to CML --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index b21ab95ed..505e847fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,6 +11,10 @@ add_library(boost_cuda_math INTERFACE) add_library(Boost::cuda_math ALIAS boost_cuda_math) +if(NOT TARGET Boost::math) + add_library(Boost::math ALIAS boost_cuda_math) +endif() + target_include_directories(boost_cuda_math INTERFACE include) include(CMakeDependentOption)