From 348a583965484d20cae85fc9bbe60bcec85f59a4 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Wed, 15 Jul 2026 10:27:48 -0400 Subject: [PATCH 01/27] Add C++20 module infrastructure and foundation components Adds gated C++20 named module support (module boost.math), inert unless BOOST_MATH_BUILD_MODULE is defined: * BOOST_MATH_EXPORT / BOOST_MATH_TEST_EXPORT macro block in tools/config.hpp * module/math.cxx interface unit covering constants and policies * module/CMakeLists.txt test harness requiring import std * module/quick_test.cpp smoke test and module/Jamfile for b2 * test/CMakeLists.txt branch for -DBOOST_MATH_BUILD_MODULE=ON * cmake-module-test CI job (clang-20 + libc++ + CMake 4.4.0) * Export annotations for constants, policies, error handling, and the tools support headers they pull in * std includes in those headers guarded for module builds * Namespace scope static constexpr variables converted to BOOST_MATH_INLINE_CONSTEXPR (float_constants and friends, max_string_digits) for module linkage --- .github/workflows/ci.yml | 67 +++ .../math/constants/calculate_constants.hpp | 2 + include/boost/math/constants/constants.hpp | 22 +- .../boost/math/policies/error_handling.hpp | 148 ++--- include/boost/math/policies/policy.hpp | 72 +-- include/boost/math/tools/config.hpp | 30 + .../boost/math/tools/convert_from_string.hpp | 4 +- include/boost/math/tools/cstdint.hpp | 130 ++--- include/boost/math/tools/numeric_limits.hpp | 4 +- include/boost/math/tools/precision.hpp | 20 +- include/boost/math/tools/tuple.hpp | 34 +- include/boost/math/tools/type_traits.hpp | 540 +++++++++--------- module/CMakeLists.txt | 78 +++ module/Jamfile | 28 + module/math.cxx | 130 +++++ module/quick_test.cpp | 40 ++ test/CMakeLists.txt | 8 + 17 files changed, 881 insertions(+), 476 deletions(-) create mode 100644 module/CMakeLists.txt create mode 100644 module/Jamfile create mode 100644 module/math.cxx create mode 100644 module/quick_test.cpp diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8a6bbcf460..07c000147a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -830,3 +830,70 @@ jobs: # run: | # cd ../boost-root/__build__ # ctest --output-on-failure --no-tests=error + + cmake-module-test: + strategy: + fail-fast: false + + runs-on: ubuntu-24.04 + + env: + # clang/libc++ version used to build the module. Needs a libc++ new enough to + # mix `import std` with textual libc++ includes (18 and 19 have std-module bugs). + LLVM_VERSION: "20" + # Pinned so the experimental `import std` feature UUID below stays valid. + CMAKE_VERSION: 4.4.0 + # CMake gates `import std` behind this UUID; it is specific to the CMake version. + IMPORT_STD_UUID: f35a9ac6-8463-4d38-8eec-5d6008153e7d + + steps: + - uses: actions/checkout@v6 + + - name: Install toolchain + run: | + # A recent clang + libc++ (for `import std`), clang-scan-deps (module + # dependency scanning), Ninja (required for C++ modules) and a pinned CMake. + wget https://apt.llvm.org/llvm.sh + chmod +x llvm.sh + sudo ./llvm.sh $LLVM_VERSION + sudo apt-get install -y clang-tools-$LLVM_VERSION libc++-$LLVM_VERSION-dev libc++abi-$LLVM_VERSION-dev ninja-build + wget -q https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-linux-x86_64.tar.gz + sudo tar -xzf cmake-$CMAKE_VERSION-linux-x86_64.tar.gz -C /opt + echo "/opt/cmake-$CMAKE_VERSION-linux-x86_64/bin" >> "$GITHUB_PATH" + + - 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: Build with the standard library module and boost.math module, then test + run: | + cd ../boost-root + mkdir __build__ && cd __build__ + cmake -G Ninja \ + -DBOOST_INCLUDE_LIBRARIES=$LIBRARY \ + -DBUILD_TESTING=ON \ + -DBOOST_MATH_BUILD_MODULE=ON \ + -DCMAKE_CXX_COMPILER=clang++-$LLVM_VERSION \ + -DCMAKE_CXX_FLAGS="-stdlib=libc++" \ + -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=$IMPORT_STD_UUID \ + -DCMAKE_CXX_STDLIB_MODULES_JSON=/usr/lib/llvm-$LLVM_VERSION/lib/libc++.modules.json \ + .. + cmake --build . --target tests + ctest --output-on-failure --no-tests=error diff --git a/include/boost/math/constants/calculate_constants.hpp b/include/boost/math/constants/calculate_constants.hpp index 95f53d9e16..1d551a6711 100644 --- a/include/boost/math/constants/calculate_constants.hpp +++ b/include/boost/math/constants/calculate_constants.hpp @@ -7,7 +7,9 @@ #ifndef BOOST_MATH_CALCULATE_CONSTANTS_CONSTANTS_INCLUDED #define BOOST_MATH_CALCULATE_CONSTANTS_CONSTANTS_INCLUDED +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif namespace boost{ namespace math{ namespace constants{ namespace detail{ diff --git a/include/boost/math/constants/constants.hpp b/include/boost/math/constants/constants.hpp index 3daf2d266e..f2e443fee6 100644 --- a/include/boost/math/constants/constants.hpp +++ b/include/boost/math/constants/constants.hpp @@ -23,8 +23,10 @@ #ifdef _MSC_VER #pragma warning(pop) #endif +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#endif #if defined(__GNUC__) && defined(BOOST_MATH_USE_FLOAT128) // @@ -54,7 +56,7 @@ namespace boost{ namespace math // (This is necessary because you can't use a numeric constant // since even a long double might not have enough digits). - enum construction_method + BOOST_MATH_EXPORT enum construction_method { construct_from_float = 1, construct_from_double = 2, @@ -69,15 +71,15 @@ namespace boost{ namespace math // Traits class determines how to convert from string based on whether T has a constructor // from const char* or not: // - template + BOOST_MATH_EXPORT template struct dummy_size{}; // // Max number of binary digits in the string representations of our constants: // - static constexpr int max_string_digits = (101 * 1000L) / 301L; + BOOST_MATH_EXPORT BOOST_MATH_INLINE_CONSTEXPR int max_string_digits = (101 * 1000L) / 301L; - template + BOOST_MATH_EXPORT template struct construction_traits { private: @@ -235,16 +237,16 @@ namespace boost{ namespace math \ \ /* The actual forwarding function: */ \ - 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)\ + BOOST_MATH_EXPORT 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_GPU_ENABLED inline constexpr typename detail::constant_return::type name(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T)) BOOST_MATH_NOEXCEPT(T)\ + BOOST_MATH_EXPORT 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 >(); }\ \ \ /* Now the namespace specific versions: */ \ - } namespace float_constants{ static constexpr float name = BOOST_MATH_JOIN(x, F); }\ - namespace double_constants{ static constexpr double name = x; } \ - namespace long_double_constants{ static constexpr long double name = BOOST_MATH_JOIN(x, L); }\ + } namespace float_constants{ BOOST_MATH_EXPORT BOOST_MATH_INLINE_CONSTEXPR float name = BOOST_MATH_JOIN(x, F); }\ + namespace double_constants{ BOOST_MATH_EXPORT BOOST_MATH_INLINE_CONSTEXPR double name = x; } \ + namespace long_double_constants{ BOOST_MATH_EXPORT BOOST_MATH_INLINE_CONSTEXPR long double name = BOOST_MATH_JOIN(x, L); }\ namespace constants{ #else // NVRTC simplified macro definition @@ -340,7 +342,7 @@ namespace constants { BOOST_DEFINE_MATH_CONSTANT(reciprocal_fibonacci, 3.35988566624317755317201130291892717968890513, "3.35988566624317755317201130291892717968890513373196848649555381532513031899668338361541621645679008729704") BOOST_DEFINE_MATH_CONSTANT(laplace_limit, 0.662743419349181580974742097109252907056233549115022417, "0.66274341934918158097474209710925290705623354911502241752039253499097185308651127724965480259895818168") -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline constexpr T tau() { return two_pi(); } } // namespace constants diff --git a/include/boost/math/policies/error_handling.hpp b/include/boost/math/policies/error_handling.hpp index adcb56f3e5..b2523456f9 100644 --- a/include/boost/math/policies/error_handling.hpp +++ b/include/boost/math/policies/error_handling.hpp @@ -21,20 +21,28 @@ #include #endif +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include #include #include +#endif #ifndef BOOST_MATH_NO_EXCEPTIONS +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include #endif +#endif +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif #ifndef BOOST_MATH_NO_RTTI +#ifndef BOOST_MATH_BUILD_MODULE #include #endif +#endif #ifdef _MSC_VER # pragma warning(push) // Quiet warnings in boost/format.hpp @@ -51,13 +59,13 @@ namespace boost{ namespace math{ #ifndef BOOST_MATH_NO_EXCEPTIONS -class evaluation_error : public std::runtime_error +BOOST_MATH_EXPORT class evaluation_error : public std::runtime_error { public: explicit evaluation_error(const std::string& s) : std::runtime_error(s){} }; -class rounding_error : public std::runtime_error +BOOST_MATH_EXPORT class rounding_error : public std::runtime_error { public: explicit rounding_error(const std::string& s) : std::runtime_error(s){} @@ -65,8 +73,8 @@ class rounding_error : public std::runtime_error #else -class evaluation_error {}; -class rounding_error {}; +BOOST_MATH_EXPORT class evaluation_error {}; +BOOST_MATH_EXPORT class rounding_error {}; #endif @@ -221,7 +229,7 @@ void raise_error(const char* pfunction, const char* pmessage, const T& val) } #endif -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline T raise_domain_error( const char* function, const char* message, @@ -237,7 +245,7 @@ BOOST_MATH_GPU_ENABLED inline T raise_domain_error( #endif } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED constexpr T raise_domain_error( const char* , const char* , @@ -249,7 +257,7 @@ BOOST_MATH_GPU_ENABLED constexpr T raise_domain_error( return boost::math::numeric_limits::quiet_NaN(); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline T raise_domain_error( const char* , const char* , @@ -262,7 +270,7 @@ BOOST_MATH_GPU_ENABLED inline T raise_domain_error( return boost::math::numeric_limits::quiet_NaN(); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline T raise_domain_error( const char* function, const char* message, @@ -272,7 +280,7 @@ BOOST_MATH_GPU_ENABLED inline T raise_domain_error( return user_domain_error(function, message, val); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline T raise_pole_error( const char* function, const char* message, @@ -286,7 +294,7 @@ BOOST_MATH_GPU_ENABLED inline T raise_pole_error( #endif } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED constexpr T raise_pole_error( const char* function, const char* message, @@ -296,7 +304,7 @@ BOOST_MATH_GPU_ENABLED constexpr T raise_pole_error( return ::boost::math::policies::detail::raise_domain_error(function, message, val, ::boost::math::policies::domain_error< ::boost::math::policies::ignore_error>()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED constexpr T raise_pole_error( const char* function, const char* message, @@ -306,7 +314,7 @@ BOOST_MATH_GPU_ENABLED constexpr T raise_pole_error( return ::boost::math::policies::detail::raise_domain_error(function, message, val, ::boost::math::policies::domain_error< ::boost::math::policies::errno_on_error>()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline T raise_pole_error( const char* function, const char* message, @@ -316,7 +324,7 @@ BOOST_MATH_GPU_ENABLED inline T raise_pole_error( return user_pole_error(function, message, val); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline T raise_overflow_error( const char* function, const char* message, @@ -331,7 +339,7 @@ BOOST_MATH_GPU_ENABLED inline T raise_overflow_error( #endif } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline T raise_overflow_error( const char* function, const char* message, @@ -347,7 +355,7 @@ BOOST_MATH_GPU_ENABLED inline T raise_overflow_error( #endif } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED constexpr T raise_overflow_error( const char* , const char* , @@ -358,7 +366,7 @@ BOOST_MATH_GPU_ENABLED constexpr T raise_overflow_error( return boost::math::numeric_limits::has_infinity ? boost::math::numeric_limits::infinity() : boost::math::tools::max_value(); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED constexpr T raise_overflow_error( const char* , const char* , @@ -370,7 +378,7 @@ BOOST_MATH_GPU_ENABLED constexpr T raise_overflow_error( return boost::math::numeric_limits::has_infinity ? boost::math::numeric_limits::infinity() : boost::math::tools::max_value(); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline T raise_overflow_error( const char* , const char* , @@ -382,7 +390,7 @@ BOOST_MATH_GPU_ENABLED inline T raise_overflow_error( return boost::math::numeric_limits::has_infinity ? boost::math::numeric_limits::infinity() : boost::math::tools::max_value(); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline T raise_overflow_error( const char* , const char* , @@ -395,7 +403,7 @@ BOOST_MATH_GPU_ENABLED inline T raise_overflow_error( return boost::math::numeric_limits::has_infinity ? boost::math::numeric_limits::infinity() : boost::math::tools::max_value(); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline T raise_overflow_error( const char* function, const char* message, @@ -404,7 +412,7 @@ BOOST_MATH_GPU_ENABLED inline T raise_overflow_error( return user_overflow_error(function, message, boost::math::numeric_limits::infinity()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline T raise_overflow_error( const char* function, const char* message, @@ -418,7 +426,7 @@ BOOST_MATH_GPU_ENABLED inline T raise_overflow_error( return user_overflow_error(function, m.c_str(), boost::math::numeric_limits::infinity()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline T raise_underflow_error( const char* function, const char* message, @@ -433,7 +441,7 @@ BOOST_MATH_GPU_ENABLED inline T raise_underflow_error( #endif } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED constexpr T raise_underflow_error( const char* , const char* , @@ -444,7 +452,7 @@ BOOST_MATH_GPU_ENABLED constexpr T raise_underflow_error( return T(0); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline T raise_underflow_error( const char* /* function */, const char* /* message */, @@ -456,7 +464,7 @@ BOOST_MATH_GPU_ENABLED inline T raise_underflow_error( return T(0); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline T raise_underflow_error( const char* function, const char* message, @@ -465,7 +473,7 @@ BOOST_MATH_GPU_ENABLED inline T raise_underflow_error( return user_underflow_error(function, message, T(0)); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline T raise_denorm_error( const char* function, const char* message, @@ -481,7 +489,7 @@ BOOST_MATH_GPU_ENABLED inline T raise_denorm_error( #endif } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline constexpr T raise_denorm_error( const char* , const char* , @@ -493,7 +501,7 @@ BOOST_MATH_GPU_ENABLED inline constexpr T raise_denorm_error( return val; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline T raise_denorm_error( const char* , const char* , @@ -506,7 +514,7 @@ BOOST_MATH_GPU_ENABLED inline T raise_denorm_error( return val; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline T raise_denorm_error( const char* function, const char* message, @@ -516,7 +524,7 @@ BOOST_MATH_GPU_ENABLED inline T raise_denorm_error( return user_denorm_error(function, message, val); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline T raise_evaluation_error( const char* function, const char* message, @@ -532,7 +540,7 @@ BOOST_MATH_GPU_ENABLED inline T raise_evaluation_error( #endif } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED constexpr T raise_evaluation_error( const char* , const char* , @@ -544,7 +552,7 @@ BOOST_MATH_GPU_ENABLED constexpr T raise_evaluation_error( return val; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline T raise_evaluation_error( const char* , const char* , @@ -557,7 +565,7 @@ BOOST_MATH_GPU_ENABLED inline T raise_evaluation_error( return val; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline T raise_evaluation_error( const char* function, const char* message, @@ -567,7 +575,7 @@ BOOST_MATH_GPU_ENABLED inline T raise_evaluation_error( return user_evaluation_error(function, message, val); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline TargetType raise_rounding_error( const char* function, const char* message, @@ -584,7 +592,7 @@ BOOST_MATH_GPU_ENABLED inline TargetType raise_rounding_error( #endif } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED constexpr TargetType raise_rounding_error( const char* , const char* , @@ -598,7 +606,7 @@ BOOST_MATH_GPU_ENABLED constexpr TargetType raise_rounding_error( return val > 0 ? (boost::math::numeric_limits::max)() : (boost::math::numeric_limits::is_integer ? (boost::math::numeric_limits::min)() : -(boost::math::numeric_limits::max)()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline TargetType raise_rounding_error( const char* , const char* , @@ -612,7 +620,7 @@ BOOST_MATH_GPU_ENABLED inline TargetType raise_rounding_error( static_assert(boost::math::numeric_limits::is_specialized, "The target type must have std::numeric_limits specialized."); return val > 0 ? (boost::math::numeric_limits::max)() : (boost::math::numeric_limits::is_integer ? (boost::math::numeric_limits::min)() : -(boost::math::numeric_limits::max)()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline TargetType raise_rounding_error( const char* function, const char* message, @@ -623,7 +631,7 @@ BOOST_MATH_GPU_ENABLED inline TargetType raise_rounding_error( return user_rounding_error(function, message, val, t); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline T raise_indeterminate_result_error( const char* function, const char* message, @@ -640,7 +648,7 @@ BOOST_MATH_GPU_ENABLED inline T raise_indeterminate_result_error( #endif } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline constexpr T raise_indeterminate_result_error( const char* , const char* , @@ -653,7 +661,7 @@ BOOST_MATH_GPU_ENABLED inline constexpr T raise_indeterminate_result_error( return result; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline T raise_indeterminate_result_error( const char* , const char* , @@ -667,7 +675,7 @@ BOOST_MATH_GPU_ENABLED inline T raise_indeterminate_result_error( return result; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline T raise_indeterminate_result_error( const char* function, const char* message, @@ -680,7 +688,7 @@ BOOST_MATH_GPU_ENABLED inline T raise_indeterminate_result_error( } // namespace detail -template +BOOST_MATH_EXPORT template 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; @@ -689,7 +697,7 @@ BOOST_MATH_GPU_ENABLED constexpr T raise_domain_error(const char* function, cons val, policy_type()); } -template +BOOST_MATH_EXPORT template 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; @@ -698,7 +706,7 @@ BOOST_MATH_GPU_ENABLED constexpr T raise_pole_error(const char* function, const val, policy_type()); } -template +BOOST_MATH_EXPORT template 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; @@ -707,7 +715,7 @@ BOOST_MATH_GPU_ENABLED constexpr T raise_overflow_error(const char* function, co policy_type()); } -template +BOOST_MATH_EXPORT template 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; @@ -716,7 +724,7 @@ BOOST_MATH_GPU_ENABLED constexpr T raise_overflow_error(const char* function, co val, policy_type()); } -template +BOOST_MATH_EXPORT template 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; @@ -725,7 +733,7 @@ BOOST_MATH_GPU_ENABLED constexpr T raise_underflow_error(const char* function, c policy_type()); } -template +BOOST_MATH_EXPORT template 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; @@ -735,7 +743,7 @@ BOOST_MATH_GPU_ENABLED constexpr T raise_denorm_error(const char* function, cons policy_type()); } -template +BOOST_MATH_EXPORT template 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; @@ -744,7 +752,7 @@ BOOST_MATH_GPU_ENABLED constexpr T raise_evaluation_error(const char* function, val, policy_type()); } -template +BOOST_MATH_EXPORT template 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; @@ -753,7 +761,7 @@ BOOST_MATH_GPU_ENABLED constexpr TargetType raise_rounding_error(const char* fun val, t, policy_type()); } -template +BOOST_MATH_EXPORT template 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; @@ -768,7 +776,7 @@ BOOST_MATH_GPU_ENABLED constexpr T raise_indeterminate_result_error(const char* namespace detail { -template +BOOST_MATH_EXPORT template 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 @@ -780,7 +788,7 @@ BOOST_MATH_GPU_ENABLED BOOST_MATH_FORCEINLINE bool check_overflow(T val, R* resu } return false; } -template +BOOST_MATH_EXPORT template 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; @@ -790,7 +798,7 @@ BOOST_MATH_GPU_ENABLED BOOST_MATH_FORCEINLINE bool check_overflow(std::complex +BOOST_MATH_EXPORT template 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)) @@ -800,7 +808,7 @@ BOOST_MATH_GPU_ENABLED BOOST_MATH_FORCEINLINE bool check_underflow(T val, R* res } return false; } -template +BOOST_MATH_EXPORT template 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; @@ -810,7 +818,7 @@ BOOST_MATH_GPU_ENABLED BOOST_MATH_FORCEINLINE bool check_underflow(std::complex< *result = R(re, im); return r; } -template +BOOST_MATH_EXPORT template 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 @@ -821,7 +829,7 @@ BOOST_MATH_GPU_ENABLED BOOST_MATH_FORCEINLINE bool check_denorm(T val, R* result } return false; } -template +BOOST_MATH_EXPORT template 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; @@ -854,7 +862,7 @@ BOOST_MATH_GPU_ENABLED BOOST_MATH_FORCEINLINE constexpr bool check_denorm(std::c } // namespace detail -template +BOOST_MATH_EXPORT template 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; @@ -874,7 +882,7 @@ BOOST_MATH_GPU_ENABLED BOOST_MATH_FORCEINLINE R checked_narrowing_cast(T val, co return static_cast(val); } -template +BOOST_MATH_EXPORT template 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()) @@ -883,7 +891,7 @@ BOOST_MATH_GPU_ENABLED inline void check_series_iterations(const char* function, "Series evaluation exceeded %1% iterations, giving up now.", static_cast(static_cast(max_iter)), pol); } -template +BOOST_MATH_EXPORT template 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()) @@ -906,7 +914,7 @@ namespace boost { namespace math { namespace policies { -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED constexpr T raise_domain_error( const char* , const char* , @@ -918,7 +926,7 @@ BOOST_MATH_GPU_ENABLED constexpr T raise_domain_error( return boost::math::numeric_limits::quiet_NaN(); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED constexpr T raise_pole_error( const char* function, const char* message, @@ -928,7 +936,7 @@ BOOST_MATH_GPU_ENABLED constexpr T raise_pole_error( return boost::math::numeric_limits::quiet_NaN(); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED constexpr T raise_overflow_error( const char* , const char* , @@ -939,7 +947,7 @@ BOOST_MATH_GPU_ENABLED constexpr T raise_overflow_error( return boost::math::numeric_limits::has_infinity ? boost::math::numeric_limits::infinity() : (boost::math::numeric_limits::max)(); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED constexpr T raise_overflow_error( const char* , const char* , @@ -951,7 +959,7 @@ BOOST_MATH_GPU_ENABLED constexpr T raise_overflow_error( return boost::math::numeric_limits::has_infinity ? boost::math::numeric_limits::infinity() : (boost::math::numeric_limits::max)(); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED constexpr T raise_underflow_error( const char* , const char* , @@ -962,7 +970,7 @@ BOOST_MATH_GPU_ENABLED constexpr T raise_underflow_error( return static_cast(0); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline constexpr T raise_denorm_error( const char* , const char* , @@ -974,7 +982,7 @@ BOOST_MATH_GPU_ENABLED inline constexpr T raise_denorm_error( return val; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED constexpr T raise_evaluation_error( const char* , const char* , @@ -986,7 +994,7 @@ BOOST_MATH_GPU_ENABLED constexpr T raise_evaluation_error( return val; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED constexpr TargetType raise_rounding_error( const char* , const char* , @@ -1000,7 +1008,7 @@ BOOST_MATH_GPU_ENABLED constexpr TargetType raise_rounding_error( return val > 0 ? (boost::math::numeric_limits::max)() : (boost::math::numeric_limits::is_integer ? (boost::math::numeric_limits::min)() : -(boost::math::numeric_limits::max)()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline constexpr T raise_indeterminate_result_error( const char* , const char* , @@ -1013,14 +1021,14 @@ BOOST_MATH_GPU_ENABLED inline constexpr T raise_indeterminate_result_error( return result; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED BOOST_MATH_FORCEINLINE R checked_narrowing_cast(T val, const char* function) noexcept(boost::math::is_floating_point_v && boost::math::is_floating_point_v) { // We only have ignore error policy so no reason to check return static_cast(val); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline void check_series_iterations(const char* function, boost::math::uintmax_t max_iter, const Policy& pol) noexcept(boost::math::is_floating_point_v) { if(max_iter >= policies::get_max_series_iterations()) @@ -1029,7 +1037,7 @@ BOOST_MATH_GPU_ENABLED inline void check_series_iterations(const char* function, "Series evaluation exceeded %1% iterations, giving up now.", static_cast(static_cast(max_iter)), pol); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline void check_root_iterations(const char* function, boost::math::uintmax_t max_iter, const Policy& pol) noexcept(boost::math::is_floating_point_v) { if(max_iter >= policies::get_max_root_iterations()) diff --git a/include/boost/math/policies/policy.hpp b/include/boost/math/policies/policy.hpp index 6d80b2b292..498e1d1e42 100644 --- a/include/boost/math/policies/policy.hpp +++ b/include/boost/math/policies/policy.hpp @@ -19,9 +19,9 @@ namespace mp = tools::meta_programming; namespace tools{ -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED constexpr int digits(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept; -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED constexpr T epsilon(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(boost::math::is_floating_point::value); } @@ -131,7 +131,7 @@ namespace policies{ #endif #define BOOST_MATH_META_INT(Type, name, Default) \ - template \ + BOOST_MATH_EXPORT template \ class name : public boost::math::integral_constant { }; \ \ namespace detail{ \ @@ -151,7 +151,7 @@ namespace policies{ }; \ } \ \ - template \ + BOOST_MATH_EXPORT template \ class is_##name \ { \ public: \ @@ -160,7 +160,7 @@ namespace policies{ }; #define BOOST_MATH_META_BOOL(name, Default) \ - template \ + BOOST_MATH_EXPORT template \ class name : public boost::math::integral_constant{}; \ \ namespace detail{ \ @@ -180,7 +180,7 @@ namespace policies{ }; \ } \ \ - template \ + BOOST_MATH_EXPORT template \ class is_##name \ { \ public: \ @@ -191,7 +191,7 @@ namespace policies{ // // Begin by defining policy types for error handling: // -enum error_policy_type +BOOST_MATH_EXPORT enum error_policy_type { throw_on_error = 0, errno_on_error = 1, @@ -217,7 +217,7 @@ BOOST_MATH_META_BOOL(assert_undefined, BOOST_MATH_ASSERT_UNDEFINED_POLICY) // // Policy types for discrete quantiles: // -enum discrete_quantile_policy_type +BOOST_MATH_EXPORT enum discrete_quantile_policy_type { real, integer_round_outwards, @@ -245,7 +245,7 @@ BOOST_MATH_META_INT(unsigned long, max_root_iterations, BOOST_MATH_MAX_ROOT_ITER BOOST_PARAMETER_TEMPLATE_KEYWORD(name##_name)\ BOOST_PARAMETER_NAME(name##_name) -struct default_policy{}; +BOOST_MATH_EXPORT struct default_policy{}; namespace detail{ // @@ -367,7 +367,7 @@ typedef default_args; }; -template , using type = policy; }; -BOOST_MATH_GPU_ENABLED constexpr policy<> make_policy() noexcept +BOOST_MATH_EXPORT BOOST_MATH_GPU_ENABLED constexpr policy<> make_policy() noexcept { return {}; } -template +BOOST_MATH_EXPORT template 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_EXPORT template 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_EXPORT template 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_EXPORT template 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_EXPORT template 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_EXPORT template 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_EXPORT template 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_EXPORT template 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_EXPORT template 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_EXPORT template 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_EXPORT template 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; @@ -748,7 +748,7 @@ BOOST_MATH_GPU_ENABLED constexpr typename normalise, A1, A2, A3, A4, A5 // // Traits class to handle internal promotion: // -template +BOOST_MATH_EXPORT template struct evaluation { typedef Real type; @@ -766,10 +766,10 @@ struct evaluation using type = typename boost::math::conditional::type; }; -template +BOOST_MATH_EXPORT template using evaluation_t = typename evaluation::type; -template +BOOST_MATH_EXPORT template struct precision { static_assert((boost::math::numeric_limits::radix == 2) || ((boost::math::numeric_limits::is_specialized == 0) || (boost::math::numeric_limits::digits == 0)), @@ -836,26 +836,26 @@ BOOST_MATH_GPU_ENABLED constexpr int digits_imp(boost::math::false_type const&) } // namespace detail -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED constexpr int digits(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept { typedef boost::math::integral_constant::is_specialized > tag_type; return detail::digits_imp(tag_type()); } -template +BOOST_MATH_EXPORT template 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_EXPORT template 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_EXPORT template BOOST_MATH_GPU_ENABLED constexpr unsigned long get_max_root_iterations() noexcept { typedef typename Policy::max_root_iterations_type iter_type; @@ -918,7 +918,7 @@ BOOST_MATH_GPU_ENABLED constexpr T get_epsilon_imp(boost::math::false_type const } // namespace detail -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED constexpr T get_epsilon(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(boost::math::is_floating_point::value) { typedef boost::math::integral_constant::is_specialized && (boost::math::numeric_limits::radix == 2)) > tag_type; @@ -950,7 +950,7 @@ class is_policy_imp } -template +BOOST_MATH_EXPORT template class is_policy { public: @@ -958,13 +958,13 @@ class is_policy using type = boost::math::integral_constant; }; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_policy_v = is_policy::value; // // Helper traits class for distribution error handling: // -template +BOOST_MATH_EXPORT template struct constructor_error_check { using domain_error_type = typename Policy::domain_error_type; @@ -974,7 +974,7 @@ struct constructor_error_check boost::math::false_type>::type; }; -template +BOOST_MATH_EXPORT template struct method_error_check { using domain_error_type = typename Policy::domain_error_type; @@ -986,7 +986,7 @@ struct method_error_check // // Does the Policy ever throw on error? // -template +BOOST_MATH_EXPORT template struct is_noexcept_error_policy { typedef typename Policy::domain_error_type t1; diff --git a/include/boost/math/tools/config.hpp b/include/boost/math/tools/config.hpp index 40346c9b0f..d5c751c460 100644 --- a/include/boost/math/tools/config.hpp +++ b/include/boost/math/tools/config.hpp @@ -11,6 +11,36 @@ #pragma once #endif +// C++20 named module support. +// BOOST_MATH_BUILD_MODULE is defined when building or consuming the boost.math +// module (module/math.cxx and the module test harness). BOOST_MATH_EXPORT marks +// every public entity and expands to nothing in ordinary header builds. +// BOOST_MATH_TEST_EXPORT additionally exports detail entities exercised by the +// module test suite, and only when the module is built with +// BOOST_MATH_EXPORT_TESTING. BOOST_MATH_INTERFACE_UNIT is defined only by +// module/math.cxx itself and guards entities that a module consumer must +// receive from the import rather than redeclare. +#ifdef BOOST_MATH_BUILD_MODULE + +#if !defined(__cpp_inline_variables) || (__cpp_inline_variables < 201606L) +# error "Building the boost.math module requires inline variable support (C++17 or later)" +#endif + +#define BOOST_MATH_EXPORT export + +#ifdef BOOST_MATH_EXPORT_TESTING +# define BOOST_MATH_TEST_EXPORT export +#else +# define BOOST_MATH_TEST_EXPORT +#endif + +#else + +#define BOOST_MATH_EXPORT +#define BOOST_MATH_TEST_EXPORT + +#endif + #if !(defined(__CUDACC_RTC__) && defined(BOOST_MATH_ENABLE_NVRTC)) #include diff --git a/include/boost/math/tools/convert_from_string.hpp b/include/boost/math/tools/convert_from_string.hpp index 3b7895cdf6..d528a17590 100644 --- a/include/boost/math/tools/convert_from_string.hpp +++ b/include/boost/math/tools/convert_from_string.hpp @@ -12,7 +12,9 @@ #endif #include +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif #ifndef BOOST_MATH_STANDALONE #if defined(_MSC_VER) || defined(__GNUC__) @@ -71,7 +73,7 @@ namespace boost{ namespace math{ namespace tools{ { return p; } - template + BOOST_MATH_EXPORT template constexpr typename convert_from_string_result::type convert_from_string(const char* p) noexcept((std::is_constructible::value)) { return convert_from_string(p, std::is_constructible()); diff --git a/include/boost/math/tools/cstdint.hpp b/include/boost/math/tools/cstdint.hpp index ce2c913b5c..d859c942b8 100644 --- a/include/boost/math/tools/cstdint.hpp +++ b/include/boost/math/tools/cstdint.hpp @@ -16,88 +16,90 @@ namespace boost { namespace math { -using cuda::std::int8_t; -using cuda::std::int16_t; -using cuda::std::int32_t; -using cuda::std::int64_t; - -using cuda::std::int_fast8_t; -using cuda::std::int_fast16_t; -using cuda::std::int_fast32_t; -using cuda::std::int_fast64_t; - -using cuda::std::int_least8_t; -using cuda::std::int_least16_t; -using cuda::std::int_least32_t; -using cuda::std::int_least64_t; - -using cuda::std::intmax_t; -using cuda::std::intptr_t; - -using cuda::std::uint8_t; -using cuda::std::uint16_t; -using cuda::std::uint32_t; -using cuda::std::uint64_t; - -using cuda::std::uint_fast8_t; -using cuda::std::uint_fast16_t; -using cuda::std::uint_fast32_t; -using cuda::std::uint_fast64_t; - -using cuda::std::uint_least8_t; -using cuda::std::uint_least16_t; -using cuda::std::uint_least32_t; -using cuda::std::uint_least64_t; - -using cuda::std::uintmax_t; -using cuda::std::uintptr_t; +BOOST_MATH_EXPORT using cuda::std::int8_t; +BOOST_MATH_EXPORT using cuda::std::int16_t; +BOOST_MATH_EXPORT using cuda::std::int32_t; +BOOST_MATH_EXPORT using cuda::std::int64_t; + +BOOST_MATH_EXPORT using cuda::std::int_fast8_t; +BOOST_MATH_EXPORT using cuda::std::int_fast16_t; +BOOST_MATH_EXPORT using cuda::std::int_fast32_t; +BOOST_MATH_EXPORT using cuda::std::int_fast64_t; + +BOOST_MATH_EXPORT using cuda::std::int_least8_t; +BOOST_MATH_EXPORT using cuda::std::int_least16_t; +BOOST_MATH_EXPORT using cuda::std::int_least32_t; +BOOST_MATH_EXPORT using cuda::std::int_least64_t; + +BOOST_MATH_EXPORT using cuda::std::intmax_t; +BOOST_MATH_EXPORT using cuda::std::intptr_t; + +BOOST_MATH_EXPORT using cuda::std::uint8_t; +BOOST_MATH_EXPORT using cuda::std::uint16_t; +BOOST_MATH_EXPORT using cuda::std::uint32_t; +BOOST_MATH_EXPORT using cuda::std::uint64_t; + +BOOST_MATH_EXPORT using cuda::std::uint_fast8_t; +BOOST_MATH_EXPORT using cuda::std::uint_fast16_t; +BOOST_MATH_EXPORT using cuda::std::uint_fast32_t; +BOOST_MATH_EXPORT using cuda::std::uint_fast64_t; + +BOOST_MATH_EXPORT using cuda::std::uint_least8_t; +BOOST_MATH_EXPORT using cuda::std::uint_least16_t; +BOOST_MATH_EXPORT using cuda::std::uint_least32_t; +BOOST_MATH_EXPORT using cuda::std::uint_least64_t; + +BOOST_MATH_EXPORT using cuda::std::uintmax_t; +BOOST_MATH_EXPORT using cuda::std::uintptr_t; using size_t = unsigned long; #else +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif namespace boost { namespace math { -using std::int8_t; -using std::int16_t; -using std::int32_t; -using std::int64_t; +BOOST_MATH_EXPORT using std::int8_t; +BOOST_MATH_EXPORT using std::int16_t; +BOOST_MATH_EXPORT using std::int32_t; +BOOST_MATH_EXPORT using std::int64_t; -using std::int_fast8_t; -using std::int_fast16_t; -using std::int_fast32_t; -using std::int_fast64_t; +BOOST_MATH_EXPORT using std::int_fast8_t; +BOOST_MATH_EXPORT using std::int_fast16_t; +BOOST_MATH_EXPORT using std::int_fast32_t; +BOOST_MATH_EXPORT using std::int_fast64_t; -using std::int_least8_t; -using std::int_least16_t; -using std::int_least32_t; -using std::int_least64_t; +BOOST_MATH_EXPORT using std::int_least8_t; +BOOST_MATH_EXPORT using std::int_least16_t; +BOOST_MATH_EXPORT using std::int_least32_t; +BOOST_MATH_EXPORT using std::int_least64_t; -using std::intmax_t; -using std::intptr_t; +BOOST_MATH_EXPORT using std::intmax_t; +BOOST_MATH_EXPORT using std::intptr_t; -using std::uint8_t; -using std::uint16_t; -using std::uint32_t; -using std::uint64_t; +BOOST_MATH_EXPORT using std::uint8_t; +BOOST_MATH_EXPORT using std::uint16_t; +BOOST_MATH_EXPORT using std::uint32_t; +BOOST_MATH_EXPORT using std::uint64_t; -using std::uint_fast8_t; -using std::uint_fast16_t; -using std::uint_fast32_t; -using std::uint_fast64_t; +BOOST_MATH_EXPORT using std::uint_fast8_t; +BOOST_MATH_EXPORT using std::uint_fast16_t; +BOOST_MATH_EXPORT using std::uint_fast32_t; +BOOST_MATH_EXPORT using std::uint_fast64_t; -using std::uint_least8_t; -using std::uint_least16_t; -using std::uint_least32_t; -using std::uint_least64_t; +BOOST_MATH_EXPORT using std::uint_least8_t; +BOOST_MATH_EXPORT using std::uint_least16_t; +BOOST_MATH_EXPORT using std::uint_least32_t; +BOOST_MATH_EXPORT using std::uint_least64_t; -using std::uintmax_t; -using std::uintptr_t; +BOOST_MATH_EXPORT using std::uintmax_t; +BOOST_MATH_EXPORT using std::uintptr_t; -using std::size_t; +BOOST_MATH_EXPORT using std::size_t; #endif diff --git a/include/boost/math/tools/numeric_limits.hpp b/include/boost/math/tools/numeric_limits.hpp index 87a7802363..e24214ed6c 100644 --- a/include/boost/math/tools/numeric_limits.hpp +++ b/include/boost/math/tools/numeric_limits.hpp @@ -19,17 +19,19 @@ #ifndef BOOST_MATH_HAS_NVRTC +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include #include +#endif #endif namespace boost { namespace math { -template +BOOST_MATH_EXPORT template struct numeric_limits #ifndef BOOST_MATH_HAS_NVRTC : public std::numeric_limits {}; diff --git a/include/boost/math/tools/precision.hpp b/include/boost/math/tools/precision.hpp index 6e863401d9..37824eeea7 100644 --- a/include/boost/math/tools/precision.hpp +++ b/include/boost/math/tools/precision.hpp @@ -17,6 +17,7 @@ #include #ifndef BOOST_MATH_HAS_NVRTC +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include @@ -24,6 +25,7 @@ #include #include // LDBL_MANT_DIG #endif +#endif namespace boost{ namespace math { @@ -41,7 +43,7 @@ namespace tools // template <> NTL::RR max_value ... // See Conceptual Requirements for Real Number Types. -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline constexpr int digits(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T)) noexcept { static_assert( ::boost::math::numeric_limits::is_specialized, "Type T must be specialized"); @@ -52,7 +54,7 @@ BOOST_MATH_GPU_ENABLED inline constexpr int digits(BOOST_MATH_EXPLICIT_TEMPLATE_ : ((boost::math::numeric_limits::digits + 1) * 1000L) / 301L; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline constexpr T max_value(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(boost::math::is_floating_point::value) { static_assert( ::boost::math::numeric_limits::is_specialized, "Type T must be specialized"); @@ -60,7 +62,7 @@ BOOST_MATH_GPU_ENABLED inline constexpr T max_value(BOOST_MATH_EXPLICIT_TEMPLATE } // Also used as a finite 'infinite' value for - and +infinity, for example: // -max_value = -1.79769e+308, max_value = 1.79769e+308. -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline constexpr T min_value(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(boost::math::is_floating_point::value) { static_assert( ::boost::math::numeric_limits::is_specialized, "Type T must be specialized"); @@ -209,7 +211,7 @@ struct log_limit_noexcept_traits : public log_limit_noexcept_traits_imp +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline T log_max_value(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(detail::log_limit_noexcept_traits::value) { #ifndef BOOST_MATH_HAS_NVRTC @@ -226,7 +228,7 @@ BOOST_MATH_GPU_ENABLED inline T log_max_value(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE( #endif } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline T log_min_value(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(detail::log_limit_noexcept_traits::value) { #ifndef BOOST_MATH_HAS_NVRTC @@ -247,7 +249,7 @@ BOOST_MATH_GPU_ENABLED inline T log_min_value(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE( #pragma warning(pop) #endif -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED constexpr T epsilon(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T)) noexcept(boost::math::is_floating_point::value) { // NVRTC does not like this dispatching method so we just skip to where we want to go @@ -392,19 +394,19 @@ struct root_epsilon_traits } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline constexpr T root_epsilon() noexcept(boost::math::is_floating_point::value && detail::root_epsilon_traits::has_noexcept) { return detail::root_epsilon_imp(static_cast(nullptr), typename detail::root_epsilon_traits::tag_type()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline constexpr T cbrt_epsilon() noexcept(boost::math::is_floating_point::value && detail::root_epsilon_traits::has_noexcept) { return detail::cbrt_epsilon_imp(static_cast(nullptr), typename detail::root_epsilon_traits::tag_type()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline constexpr T forth_root_epsilon() noexcept(boost::math::is_floating_point::value && detail::root_epsilon_traits::has_noexcept) { return detail::forth_root_epsilon_imp(static_cast(nullptr), typename detail::root_epsilon_traits::tag_type()); diff --git a/include/boost/math/tools/tuple.hpp b/include/boost/math/tools/tuple.hpp index dcc763e37a..332b1bf0b6 100644 --- a/include/boost/math/tools/tuple.hpp +++ b/include/boost/math/tools/tuple.hpp @@ -18,16 +18,16 @@ namespace boost { namespace math { -using cuda::std::pair; -using cuda::std::tuple; +BOOST_MATH_EXPORT using cuda::std::pair; +BOOST_MATH_EXPORT using cuda::std::tuple; -using cuda::std::make_pair; +BOOST_MATH_EXPORT using cuda::std::make_pair; -using cuda::std::tie; -using cuda::std::get; +BOOST_MATH_EXPORT using cuda::std::tie; +BOOST_MATH_EXPORT using cuda::std::get; -using cuda::std::tuple_size; -using cuda::std::tuple_element; +BOOST_MATH_EXPORT using cuda::std::tuple_size; +BOOST_MATH_EXPORT using cuda::std::tuple_element; namespace detail { @@ -59,26 +59,28 @@ BOOST_MATH_GPU_ENABLED auto make_tuple(T&& t, Ts&&... ts) #else +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif namespace boost { namespace math { -using ::std::tuple; -using ::std::pair; +BOOST_MATH_EXPORT using ::std::tuple; +BOOST_MATH_EXPORT using ::std::pair; // [6.1.3.2] Tuple creation functions -using ::std::ignore; -using ::std::make_tuple; -using ::std::tie; -using ::std::get; +BOOST_MATH_EXPORT using ::std::ignore; +BOOST_MATH_EXPORT using ::std::make_tuple; +BOOST_MATH_EXPORT using ::std::tie; +BOOST_MATH_EXPORT using ::std::get; // [6.1.3.3] Tuple helper classes -using ::std::tuple_size; -using ::std::tuple_element; +BOOST_MATH_EXPORT using ::std::tuple_size; +BOOST_MATH_EXPORT using ::std::tuple_element; // Pair helpers -using ::std::make_pair; +BOOST_MATH_EXPORT using ::std::make_pair; } // namespace math } // namespace boost diff --git a/include/boost/math/tools/type_traits.hpp b/include/boost/math/tools/type_traits.hpp index 951f3a1bf8..00720e4c51 100644 --- a/include/boost/math/tools/type_traits.hpp +++ b/include/boost/math/tools/type_traits.hpp @@ -20,467 +20,469 @@ namespace boost { namespace math { // Helper classes -using cuda::std::integral_constant; -using cuda::std::true_type; -using cuda::std::false_type; +BOOST_MATH_EXPORT using cuda::std::integral_constant; +BOOST_MATH_EXPORT using cuda::std::true_type; +BOOST_MATH_EXPORT using cuda::std::false_type; // Primary type categories -using cuda::std::is_void; -using cuda::std::is_null_pointer; -using cuda::std::is_integral; -using cuda::std::is_floating_point; -using cuda::std::is_array; -using cuda::std::is_enum; -using cuda::std::is_union; -using cuda::std::is_class; -using cuda::std::is_function; -using cuda::std::is_pointer; -using cuda::std::is_lvalue_reference; -using cuda::std::is_rvalue_reference; -using cuda::std::is_member_object_pointer; -using cuda::std::is_member_function_pointer; +BOOST_MATH_EXPORT using cuda::std::is_void; +BOOST_MATH_EXPORT using cuda::std::is_null_pointer; +BOOST_MATH_EXPORT using cuda::std::is_integral; +BOOST_MATH_EXPORT using cuda::std::is_floating_point; +BOOST_MATH_EXPORT using cuda::std::is_array; +BOOST_MATH_EXPORT using cuda::std::is_enum; +BOOST_MATH_EXPORT using cuda::std::is_union; +BOOST_MATH_EXPORT using cuda::std::is_class; +BOOST_MATH_EXPORT using cuda::std::is_function; +BOOST_MATH_EXPORT using cuda::std::is_pointer; +BOOST_MATH_EXPORT using cuda::std::is_lvalue_reference; +BOOST_MATH_EXPORT using cuda::std::is_rvalue_reference; +BOOST_MATH_EXPORT using cuda::std::is_member_object_pointer; +BOOST_MATH_EXPORT using cuda::std::is_member_function_pointer; // Composite Type Categories -using cuda::std::is_fundamental; -using cuda::std::is_arithmetic; -using cuda::std::is_scalar; -using cuda::std::is_object; -using cuda::std::is_compound; -using cuda::std::is_reference; -using cuda::std::is_member_pointer; +BOOST_MATH_EXPORT using cuda::std::is_fundamental; +BOOST_MATH_EXPORT using cuda::std::is_arithmetic; +BOOST_MATH_EXPORT using cuda::std::is_scalar; +BOOST_MATH_EXPORT using cuda::std::is_object; +BOOST_MATH_EXPORT using cuda::std::is_compound; +BOOST_MATH_EXPORT using cuda::std::is_reference; +BOOST_MATH_EXPORT using cuda::std::is_member_pointer; // Type properties -using cuda::std::is_const; -using cuda::std::is_volatile; -using cuda::std::is_trivially_copyable; -using cuda::std::is_standard_layout; -using cuda::std::is_empty; -using cuda::std::is_polymorphic; -using cuda::std::is_abstract; -using cuda::std::is_final; -using cuda::std::is_signed; -using cuda::std::is_unsigned; +BOOST_MATH_EXPORT using cuda::std::is_const; +BOOST_MATH_EXPORT using cuda::std::is_volatile; +BOOST_MATH_EXPORT using cuda::std::is_trivially_copyable; +BOOST_MATH_EXPORT using cuda::std::is_standard_layout; +BOOST_MATH_EXPORT using cuda::std::is_empty; +BOOST_MATH_EXPORT using cuda::std::is_polymorphic; +BOOST_MATH_EXPORT using cuda::std::is_abstract; +BOOST_MATH_EXPORT using cuda::std::is_final; +BOOST_MATH_EXPORT using cuda::std::is_signed; +BOOST_MATH_EXPORT using cuda::std::is_unsigned; // Supported Operations -using cuda::std::is_constructible; -using cuda::std::is_trivially_constructible; -using cuda::std::is_nothrow_constructible; +BOOST_MATH_EXPORT using cuda::std::is_constructible; +BOOST_MATH_EXPORT using cuda::std::is_trivially_constructible; +BOOST_MATH_EXPORT using cuda::std::is_nothrow_constructible; -using cuda::std::is_default_constructible; -using cuda::std::is_trivially_default_constructible; -using cuda::std::is_nothrow_default_constructible; +BOOST_MATH_EXPORT using cuda::std::is_default_constructible; +BOOST_MATH_EXPORT using cuda::std::is_trivially_default_constructible; +BOOST_MATH_EXPORT using cuda::std::is_nothrow_default_constructible; -using cuda::std::is_copy_constructible; -using cuda::std::is_trivially_copy_constructible; -using cuda::std::is_nothrow_copy_constructible; +BOOST_MATH_EXPORT using cuda::std::is_copy_constructible; +BOOST_MATH_EXPORT using cuda::std::is_trivially_copy_constructible; +BOOST_MATH_EXPORT using cuda::std::is_nothrow_copy_constructible; -using cuda::std::is_move_constructible; -using cuda::std::is_trivially_move_constructible; -using cuda::std::is_nothrow_move_constructible; +BOOST_MATH_EXPORT using cuda::std::is_move_constructible; +BOOST_MATH_EXPORT using cuda::std::is_trivially_move_constructible; +BOOST_MATH_EXPORT using cuda::std::is_nothrow_move_constructible; -using cuda::std::is_assignable; -using cuda::std::is_trivially_assignable; -using cuda::std::is_nothrow_assignable; +BOOST_MATH_EXPORT using cuda::std::is_assignable; +BOOST_MATH_EXPORT using cuda::std::is_trivially_assignable; +BOOST_MATH_EXPORT using cuda::std::is_nothrow_assignable; -using cuda::std::is_copy_assignable; -using cuda::std::is_trivially_copy_assignable; -using cuda::std::is_nothrow_copy_assignable; +BOOST_MATH_EXPORT using cuda::std::is_copy_assignable; +BOOST_MATH_EXPORT using cuda::std::is_trivially_copy_assignable; +BOOST_MATH_EXPORT using cuda::std::is_nothrow_copy_assignable; -using cuda::std::is_move_assignable; -using cuda::std::is_trivially_move_assignable; -using cuda::std::is_nothrow_move_assignable; +BOOST_MATH_EXPORT using cuda::std::is_move_assignable; +BOOST_MATH_EXPORT using cuda::std::is_trivially_move_assignable; +BOOST_MATH_EXPORT using cuda::std::is_nothrow_move_assignable; -using cuda::std::is_destructible; -using cuda::std::is_trivially_destructible; -using cuda::std::is_nothrow_destructible; +BOOST_MATH_EXPORT using cuda::std::is_destructible; +BOOST_MATH_EXPORT using cuda::std::is_trivially_destructible; +BOOST_MATH_EXPORT using cuda::std::is_nothrow_destructible; -using cuda::std::has_virtual_destructor; +BOOST_MATH_EXPORT using cuda::std::has_virtual_destructor; // Property Queries -using cuda::std::alignment_of; -using cuda::std::rank; -using cuda::std::extent; +BOOST_MATH_EXPORT using cuda::std::alignment_of; +BOOST_MATH_EXPORT using cuda::std::rank; +BOOST_MATH_EXPORT using cuda::std::extent; // Type Relationships -using cuda::std::is_same; -using cuda::std::is_base_of; -using cuda::std::is_convertible; +BOOST_MATH_EXPORT using cuda::std::is_same; +BOOST_MATH_EXPORT using cuda::std::is_base_of; +BOOST_MATH_EXPORT using cuda::std::is_convertible; // Const-volatility specifiers -using cuda::std::remove_cv; -using cuda::std::remove_cv_t; -using cuda::std::remove_const; -using cuda::std::remove_const_t; -using cuda::std::remove_volatile; -using cuda::std::remove_volatile_t; -using cuda::std::add_cv; -using cuda::std::add_cv_t; -using cuda::std::add_const; -using cuda::std::add_const_t; -using cuda::std::add_volatile; -using cuda::std::add_volatile_t; +BOOST_MATH_EXPORT using cuda::std::remove_cv; +BOOST_MATH_EXPORT using cuda::std::remove_cv_t; +BOOST_MATH_EXPORT using cuda::std::remove_const; +BOOST_MATH_EXPORT using cuda::std::remove_const_t; +BOOST_MATH_EXPORT using cuda::std::remove_volatile; +BOOST_MATH_EXPORT using cuda::std::remove_volatile_t; +BOOST_MATH_EXPORT using cuda::std::add_cv; +BOOST_MATH_EXPORT using cuda::std::add_cv_t; +BOOST_MATH_EXPORT using cuda::std::add_const; +BOOST_MATH_EXPORT using cuda::std::add_const_t; +BOOST_MATH_EXPORT using cuda::std::add_volatile; +BOOST_MATH_EXPORT using cuda::std::add_volatile_t; // References -using cuda::std::remove_reference; -using cuda::std::remove_reference_t; -using cuda::std::add_lvalue_reference; -using cuda::std::add_lvalue_reference_t; -using cuda::std::add_rvalue_reference; -using cuda::std::add_rvalue_reference_t; +BOOST_MATH_EXPORT using cuda::std::remove_reference; +BOOST_MATH_EXPORT using cuda::std::remove_reference_t; +BOOST_MATH_EXPORT using cuda::std::add_lvalue_reference; +BOOST_MATH_EXPORT using cuda::std::add_lvalue_reference_t; +BOOST_MATH_EXPORT using cuda::std::add_rvalue_reference; +BOOST_MATH_EXPORT using cuda::std::add_rvalue_reference_t; // Pointers -using cuda::std::remove_pointer; -using cuda::std::remove_pointer_t; -using cuda::std::add_pointer; -using cuda::std::add_pointer_t; +BOOST_MATH_EXPORT using cuda::std::remove_pointer; +BOOST_MATH_EXPORT using cuda::std::remove_pointer_t; +BOOST_MATH_EXPORT using cuda::std::add_pointer; +BOOST_MATH_EXPORT using cuda::std::add_pointer_t; // Sign Modifiers -using cuda::std::make_signed; -using cuda::std::make_signed_t; -using cuda::std::make_unsigned; -using cuda::std::make_unsigned_t; +BOOST_MATH_EXPORT using cuda::std::make_signed; +BOOST_MATH_EXPORT using cuda::std::make_signed_t; +BOOST_MATH_EXPORT using cuda::std::make_unsigned; +BOOST_MATH_EXPORT using cuda::std::make_unsigned_t; // Arrays -using cuda::std::remove_extent; -using cuda::std::remove_extent_t; -using cuda::std::remove_all_extents; -using cuda::std::remove_all_extents_t; +BOOST_MATH_EXPORT using cuda::std::remove_extent; +BOOST_MATH_EXPORT using cuda::std::remove_extent_t; +BOOST_MATH_EXPORT using cuda::std::remove_all_extents; +BOOST_MATH_EXPORT using cuda::std::remove_all_extents_t; // Misc transformations -using cuda::std::decay; -using cuda::std::decay_t; -using cuda::std::enable_if; -using cuda::std::enable_if_t; -using cuda::std::conditional; -using cuda::std::conditional_t; -using cuda::std::common_type; -using cuda::std::common_type_t; -using cuda::std::underlying_type; -using cuda::std::underlying_type_t; +BOOST_MATH_EXPORT using cuda::std::decay; +BOOST_MATH_EXPORT using cuda::std::decay_t; +BOOST_MATH_EXPORT using cuda::std::enable_if; +BOOST_MATH_EXPORT using cuda::std::enable_if_t; +BOOST_MATH_EXPORT using cuda::std::conditional; +BOOST_MATH_EXPORT using cuda::std::conditional_t; +BOOST_MATH_EXPORT using cuda::std::common_type; +BOOST_MATH_EXPORT using cuda::std::common_type_t; +BOOST_MATH_EXPORT using cuda::std::underlying_type; +BOOST_MATH_EXPORT using cuda::std::underlying_type_t; #else // STD versions +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif namespace boost { namespace math { // Helper classes -using std::integral_constant; -using std::true_type; -using std::false_type; +BOOST_MATH_EXPORT using std::integral_constant; +BOOST_MATH_EXPORT using std::true_type; +BOOST_MATH_EXPORT using std::false_type; // Primary type categories -using std::is_void; -using std::is_null_pointer; -using std::is_integral; -using std::is_floating_point; -using std::is_array; -using std::is_enum; -using std::is_union; -using std::is_class; -using std::is_function; -using std::is_pointer; -using std::is_lvalue_reference; -using std::is_rvalue_reference; -using std::is_member_object_pointer; -using std::is_member_function_pointer; +BOOST_MATH_EXPORT using std::is_void; +BOOST_MATH_EXPORT using std::is_null_pointer; +BOOST_MATH_EXPORT using std::is_integral; +BOOST_MATH_EXPORT using std::is_floating_point; +BOOST_MATH_EXPORT using std::is_array; +BOOST_MATH_EXPORT using std::is_enum; +BOOST_MATH_EXPORT using std::is_union; +BOOST_MATH_EXPORT using std::is_class; +BOOST_MATH_EXPORT using std::is_function; +BOOST_MATH_EXPORT using std::is_pointer; +BOOST_MATH_EXPORT using std::is_lvalue_reference; +BOOST_MATH_EXPORT using std::is_rvalue_reference; +BOOST_MATH_EXPORT using std::is_member_object_pointer; +BOOST_MATH_EXPORT using std::is_member_function_pointer; // Composite Type Categories -using std::is_fundamental; -using std::is_arithmetic; -using std::is_scalar; -using std::is_object; -using std::is_compound; -using std::is_reference; -using std::is_member_pointer; +BOOST_MATH_EXPORT using std::is_fundamental; +BOOST_MATH_EXPORT using std::is_arithmetic; +BOOST_MATH_EXPORT using std::is_scalar; +BOOST_MATH_EXPORT using std::is_object; +BOOST_MATH_EXPORT using std::is_compound; +BOOST_MATH_EXPORT using std::is_reference; +BOOST_MATH_EXPORT using std::is_member_pointer; // Type properties -using std::is_const; -using std::is_volatile; -using std::is_trivially_copyable; -using std::is_standard_layout; -using std::is_empty; -using std::is_polymorphic; -using std::is_abstract; -using std::is_final; -using std::is_signed; -using std::is_unsigned; +BOOST_MATH_EXPORT using std::is_const; +BOOST_MATH_EXPORT using std::is_volatile; +BOOST_MATH_EXPORT using std::is_trivially_copyable; +BOOST_MATH_EXPORT using std::is_standard_layout; +BOOST_MATH_EXPORT using std::is_empty; +BOOST_MATH_EXPORT using std::is_polymorphic; +BOOST_MATH_EXPORT using std::is_abstract; +BOOST_MATH_EXPORT using std::is_final; +BOOST_MATH_EXPORT using std::is_signed; +BOOST_MATH_EXPORT using std::is_unsigned; // Supported Operations -using std::is_constructible; -using std::is_trivially_constructible; -using std::is_nothrow_constructible; +BOOST_MATH_EXPORT using std::is_constructible; +BOOST_MATH_EXPORT using std::is_trivially_constructible; +BOOST_MATH_EXPORT using std::is_nothrow_constructible; -using std::is_default_constructible; -using std::is_trivially_default_constructible; -using std::is_nothrow_default_constructible; +BOOST_MATH_EXPORT using std::is_default_constructible; +BOOST_MATH_EXPORT using std::is_trivially_default_constructible; +BOOST_MATH_EXPORT using std::is_nothrow_default_constructible; -using std::is_copy_constructible; -using std::is_trivially_copy_constructible; -using std::is_nothrow_copy_constructible; +BOOST_MATH_EXPORT using std::is_copy_constructible; +BOOST_MATH_EXPORT using std::is_trivially_copy_constructible; +BOOST_MATH_EXPORT using std::is_nothrow_copy_constructible; -using std::is_move_constructible; -using std::is_trivially_move_constructible; -using std::is_nothrow_move_constructible; +BOOST_MATH_EXPORT using std::is_move_constructible; +BOOST_MATH_EXPORT using std::is_trivially_move_constructible; +BOOST_MATH_EXPORT using std::is_nothrow_move_constructible; -using std::is_assignable; -using std::is_trivially_assignable; -using std::is_nothrow_assignable; +BOOST_MATH_EXPORT using std::is_assignable; +BOOST_MATH_EXPORT using std::is_trivially_assignable; +BOOST_MATH_EXPORT using std::is_nothrow_assignable; -using std::is_copy_assignable; -using std::is_trivially_copy_assignable; -using std::is_nothrow_copy_assignable; +BOOST_MATH_EXPORT using std::is_copy_assignable; +BOOST_MATH_EXPORT using std::is_trivially_copy_assignable; +BOOST_MATH_EXPORT using std::is_nothrow_copy_assignable; -using std::is_move_assignable; -using std::is_trivially_move_assignable; -using std::is_nothrow_move_assignable; +BOOST_MATH_EXPORT using std::is_move_assignable; +BOOST_MATH_EXPORT using std::is_trivially_move_assignable; +BOOST_MATH_EXPORT using std::is_nothrow_move_assignable; -using std::is_destructible; -using std::is_trivially_destructible; -using std::is_nothrow_destructible; +BOOST_MATH_EXPORT using std::is_destructible; +BOOST_MATH_EXPORT using std::is_trivially_destructible; +BOOST_MATH_EXPORT using std::is_nothrow_destructible; -using std::has_virtual_destructor; +BOOST_MATH_EXPORT using std::has_virtual_destructor; // Property Queries -using std::alignment_of; -using std::rank; -using std::extent; +BOOST_MATH_EXPORT using std::alignment_of; +BOOST_MATH_EXPORT using std::rank; +BOOST_MATH_EXPORT using std::extent; // Type Relationships -using std::is_same; -using std::is_base_of; -using std::is_convertible; +BOOST_MATH_EXPORT using std::is_same; +BOOST_MATH_EXPORT using std::is_base_of; +BOOST_MATH_EXPORT using std::is_convertible; // Const-volatility specifiers -using std::remove_cv; -using std::remove_cv_t; -using std::remove_const; -using std::remove_const_t; -using std::remove_volatile; -using std::remove_volatile_t; -using std::add_cv; -using std::add_cv_t; -using std::add_const; -using std::add_const_t; -using std::add_volatile; -using std::add_volatile_t; +BOOST_MATH_EXPORT using std::remove_cv; +BOOST_MATH_EXPORT using std::remove_cv_t; +BOOST_MATH_EXPORT using std::remove_const; +BOOST_MATH_EXPORT using std::remove_const_t; +BOOST_MATH_EXPORT using std::remove_volatile; +BOOST_MATH_EXPORT using std::remove_volatile_t; +BOOST_MATH_EXPORT using std::add_cv; +BOOST_MATH_EXPORT using std::add_cv_t; +BOOST_MATH_EXPORT using std::add_const; +BOOST_MATH_EXPORT using std::add_const_t; +BOOST_MATH_EXPORT using std::add_volatile; +BOOST_MATH_EXPORT using std::add_volatile_t; // References -using std::remove_reference; -using std::remove_reference_t; -using std::add_lvalue_reference; -using std::add_lvalue_reference_t; -using std::add_rvalue_reference; -using std::add_rvalue_reference_t; +BOOST_MATH_EXPORT using std::remove_reference; +BOOST_MATH_EXPORT using std::remove_reference_t; +BOOST_MATH_EXPORT using std::add_lvalue_reference; +BOOST_MATH_EXPORT using std::add_lvalue_reference_t; +BOOST_MATH_EXPORT using std::add_rvalue_reference; +BOOST_MATH_EXPORT using std::add_rvalue_reference_t; // Pointers -using std::remove_pointer; -using std::remove_pointer_t; -using std::add_pointer; -using std::add_pointer_t; +BOOST_MATH_EXPORT using std::remove_pointer; +BOOST_MATH_EXPORT using std::remove_pointer_t; +BOOST_MATH_EXPORT using std::add_pointer; +BOOST_MATH_EXPORT using std::add_pointer_t; // Sign Modifiers -using std::make_signed; -using std::make_signed_t; -using std::make_unsigned; -using std::make_unsigned_t; +BOOST_MATH_EXPORT using std::make_signed; +BOOST_MATH_EXPORT using std::make_signed_t; +BOOST_MATH_EXPORT using std::make_unsigned; +BOOST_MATH_EXPORT using std::make_unsigned_t; // Arrays -using std::remove_extent; -using std::remove_extent_t; -using std::remove_all_extents; -using std::remove_all_extents_t; +BOOST_MATH_EXPORT using std::remove_extent; +BOOST_MATH_EXPORT using std::remove_extent_t; +BOOST_MATH_EXPORT using std::remove_all_extents; +BOOST_MATH_EXPORT using std::remove_all_extents_t; // Misc transformations -using std::decay; -using std::decay_t; -using std::enable_if; -using std::enable_if_t; -using std::conditional; -using std::conditional_t; -using std::common_type; -using std::common_type_t; -using std::underlying_type; -using std::underlying_type_t; +BOOST_MATH_EXPORT using std::decay; +BOOST_MATH_EXPORT using std::decay_t; +BOOST_MATH_EXPORT using std::enable_if; +BOOST_MATH_EXPORT using std::enable_if_t; +BOOST_MATH_EXPORT using std::conditional; +BOOST_MATH_EXPORT using std::conditional_t; +BOOST_MATH_EXPORT using std::common_type; +BOOST_MATH_EXPORT using std::common_type_t; +BOOST_MATH_EXPORT using std::underlying_type; +BOOST_MATH_EXPORT using std::underlying_type_t; #endif -template +BOOST_MATH_EXPORT template using bool_constant = boost::math::integral_constant; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_void_v = boost::math::is_void::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_null_pointer_v = boost::math::is_null_pointer::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_integral_v = boost::math::is_integral::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_floating_point_v = boost::math::is_floating_point::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_array_v = boost::math::is_array::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_enum_v = boost::math::is_enum::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_union_v = boost::math::is_union::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_class_v = boost::math::is_class::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_function_v = boost::math::is_function::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_pointer_v = boost::math::is_pointer::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_lvalue_reference_v = boost::math::is_lvalue_reference::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_rvalue_reference_v = boost::math::is_rvalue_reference::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_member_object_pointer_v = boost::math::is_member_object_pointer::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_member_function_pointer_v = boost::math::is_member_function_pointer::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_fundamental_v = boost::math::is_fundamental::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_arithmetic_v = boost::math::is_arithmetic::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_scalar_v = boost::math::is_scalar::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_object_v = boost::math::is_object::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_compound_v = boost::math::is_compound::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_reference_v = boost::math::is_reference::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_member_pointer_v = boost::math::is_member_pointer::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_const_v = boost::math::is_const::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_volatile_v = boost::math::is_volatile::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_trivially_copyable_v = boost::math::is_trivially_copyable::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_standard_layout_v = boost::math::is_standard_layout::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_empty_v = boost::math::is_empty::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_polymorphic_v = boost::math::is_polymorphic::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_abstract_v = boost::math::is_abstract::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_final_v = boost::math::is_final::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_signed_v = boost::math::is_signed::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_unsigned_v = boost::math::is_unsigned::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_constructible_v = boost::math::is_constructible::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_trivially_constructible_v = boost::math::is_trivially_constructible::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_nothrow_constructible_v = boost::math::is_nothrow_constructible::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_default_constructible_v = boost::math::is_default_constructible::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_trivially_default_constructible_v = boost::math::is_trivially_default_constructible::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_nothrow_default_constructible_v = boost::math::is_nothrow_default_constructible::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_copy_constructible_v = boost::math::is_copy_constructible::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_trivially_copy_constructible_v = boost::math::is_trivially_copy_constructible::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_nothrow_copy_constructible_v = boost::math::is_nothrow_copy_constructible::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_move_constructible_v = boost::math::is_move_constructible::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_trivially_move_constructible_v = boost::math::is_trivially_move_constructible::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_nothrow_move_constructible_v = boost::math::is_nothrow_move_constructible::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_assignable_v = boost::math::is_assignable::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_trivially_assignable_v = boost::math::is_trivially_assignable::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_nothrow_assignable_v = boost::math::is_nothrow_assignable::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_copy_assignable_v = boost::math::is_copy_assignable::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_trivially_copy_assignable_v = boost::math::is_trivially_copy_assignable::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_nothrow_copy_assignable_v = boost::math::is_nothrow_copy_assignable::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_move_assignable_v = boost::math::is_move_assignable::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_trivially_move_assignable_v = boost::math::is_trivially_move_assignable::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_nothrow_move_assignable_v = boost::math::is_nothrow_move_assignable::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_destructible_v = boost::math::is_destructible::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_trivially_destructible_v = boost::math::is_trivially_destructible::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_nothrow_destructible_v = boost::math::is_nothrow_destructible::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool has_virtual_destructor_v = boost::math::has_virtual_destructor::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_same_v = boost::math::is_same::value; -template +BOOST_MATH_EXPORT template BOOST_MATH_INLINE_CONSTEXPR bool is_base_of_v = boost::math::is_base_of::value; } // namespace math diff --git a/module/CMakeLists.txt b/module/CMakeLists.txt new file mode 100644 index 0000000000..12ab1d5fa3 --- /dev/null +++ b/module/CMakeLists.txt @@ -0,0 +1,78 @@ +# Copyright 2026 Matt Borland +# Distributed under the Boost Software License, Version 1.0. +# https://www.boost.org/LICENSE_1_0.txt +# +# Builds Boost.Math as a C++ module (boost.math) and runs the module-aware +# tests in ../test against it, consuming the standard library module +# (import std). This file is included from ../test/CMakeLists.txt when the +# CMake option BOOST_MATH_BUILD_MODULE is set and expects the Boost +# superproject (for the Boost:: dependency targets). import std is required +# (see the check below). + +if(NOT TARGET tests) + add_custom_target(tests) +endif() + +# The module interface unit. +add_library(boost_math_module) +target_sources(boost_math_module + PUBLIC + FILE_SET math_module TYPE CXX_MODULES FILES math.cxx +) +target_link_libraries(boost_math_module PUBLIC Boost::math) +target_compile_features(boost_math_module PUBLIC cxx_std_23) + +# math.cxx defines BOOST_MATH_BUILD_MODULE and BOOST_MATH_STANDALONE itself, +# but the tests link this target and need both macros too: BOOST_MATH_BUILD_MODULE +# so they import the module instead of including the headers directly, and +# BOOST_MATH_STANDALONE so any textually included support header (for example +# test/math_unit_test.hpp -> tools/config.hpp) follows the same configuration +# branch the module was built with. +target_compile_definitions(boost_math_module PUBLIC BOOST_MATH_BUILD_MODULE BOOST_MATH_STANDALONE=1) + +# Export the detail-namespace entities that the tests exercise directly. +# Only the interface unit needs this, so keep it private to the module target. +target_compile_definitions(boost_math_module PRIVATE BOOST_MATH_EXPORT_TESTING) + +# Mixing textual standard library includes in consumers with a module built from +# header units trips include-translation bugs, so the standard library module is +# required for the test build. CMAKE_CXX_COMPILER_IMPORT_STD lists the standards +# it is available for; it is only populated when CMAKE_EXPERIMENTAL_CXX_IMPORT_STD +# is set before the project() call. +if(NOT "23" IN_LIST CMAKE_CXX_COMPILER_IMPORT_STD) + message(FATAL_ERROR + "Building the Boost.Math module tests requires 'import std' (the C++23 " + "standard library module). Use a toolchain that supports it and pass " + "-DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD= before the project() call. " + "CMAKE_CXX_COMPILER_IMPORT_STD='${CMAKE_CXX_COMPILER_IMPORT_STD}'") +endif() + +set_target_properties(boost_math_module PROPERTIES CXX_MODULE_STD ON) +target_compile_definitions(boost_math_module PRIVATE BOOST_MATH_USE_STD_MODULE) +message(STATUS "Boost.Math module: using 'import std;'") + +# Tests that switch to `import boost.math;` when BOOST_MATH_BUILD_MODULE is set. +# The list grows as components are added to the module interface unit. +set(BOOST_MATH_MODULE_TESTS +) + +add_executable(module_quick_test "${CMAKE_CURRENT_SOURCE_DIR}/quick_test.cpp") +target_link_libraries(module_quick_test PRIVATE boost_math_module Boost::core) +# The superproject pins an older policy version (CMP0155), so C++ sources are not +# scanned for module imports by default. Force scanning so `import boost.math;` +# is resolved to the module built above. +set_target_properties(module_quick_test PROPERTIES CXX_SCAN_FOR_MODULES ON CXX_MODULE_STD ON) +add_test(NAME module_quick_test COMMAND module_quick_test) +add_dependencies(tests module_quick_test) + +foreach(test ${BOOST_MATH_MODULE_TESTS}) + add_executable(module_${test} "${CMAKE_CURRENT_SOURCE_DIR}/../test/${test}.cpp") + target_link_libraries(module_${test} + PRIVATE + boost_math_module + Boost::core + ) + set_target_properties(module_${test} PROPERTIES CXX_SCAN_FOR_MODULES ON CXX_MODULE_STD ON) + add_test(NAME module_${test} COMMAND module_${test}) + add_dependencies(tests module_${test}) +endforeach() diff --git a/module/Jamfile b/module/Jamfile new file mode 100644 index 0000000000..70772268d5 --- /dev/null +++ b/module/Jamfile @@ -0,0 +1,28 @@ +# Copyright 2026 Matt Borland +# Distributed under the Boost Software License, Version 1.0. +# https://www.boost.org/LICENSE_1_0.txt + +# bring in the rules for testing +require-b2 5.0.1 ; +import-search /boost/config/checks ; +import config : requires ; +import modules ; +import testing ; +import path ; +import pch ; + +project + : requirements + msvc:all + msvc:on + msvc:latest + + gcc:-fmodules-ts + gcc:23 + + clang:23 + ; + +obj math : math.cxx : BOOST_MATH_EXPORT_TESTING msvc:-interface ; + +run quick_test.cpp math : : : math ; diff --git a/module/math.cxx b/module/math.cxx new file mode 100644 index 0000000000..582f6c8fcf --- /dev/null +++ b/module/math.cxx @@ -0,0 +1,130 @@ +// Copyright 2026 Matt Borland +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +module; + +// The module is always built in standalone mode so that no entity from another +// Boost library can attach itself to the boost.math module. +#ifndef BOOST_MATH_STANDALONE +# define BOOST_MATH_STANDALONE +#endif + +#ifndef BOOST_MATH_BUILD_MODULE +# define BOOST_MATH_BUILD_MODULE +#endif + +// Marks this translation unit as the module interface unit (as opposed to a +// consumer that imports the module). Some headers key off this to declare +// entities here that consumers instead receive through the import. +#define BOOST_MATH_INTERFACE_UNIT + +// Platform intrinsic headers are not part of the standard library module, so +// they are always brought in here. The conditions mirror the include sites in +// special_functions/next.hpp and special_functions/detail/lanczos_sse2.hpp. +#if !defined(_CRAYC) && (!defined(__GNUC__) || (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ > 3))) +# if (defined(_M_IX86_FP) && (_M_IX86_FP >= 2)) || defined(__SSE2__) +# include +# include +# endif +#endif + +// import std exports declarations but not macros. The headers below provide the +// feature-test macros and the object-like macros the library uses (assert, +// errno, FP_ classification, HUGE_VAL, FLT_/DBL_ limits, INT64_C, ...) so they +// are included regardless of whether import std is used. +#include +#include +#include +#include +#include +#include +#include +#include + +// The macro hub and its helper entities are deliberately kept in the global +// module so that consumer translation units may also include them textually +// (for example through test/math_unit_test.hpp). +#include +#include + +// When the standard library module is available these are provided by import +// std, otherwise they are supplied here in the global module fragment. +#ifndef BOOST_MATH_USE_STD_MODULE + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef BOOST_MATH_NO_CXX17_HDR_EXECUTION +# include +#endif + +#endif // BOOST_MATH_USE_STD_MODULE + +export module boost.math; + +#ifdef BOOST_MATH_USE_STD_MODULE +import std; +#endif + +#ifdef _MSC_VER +# pragma warning( push ) +# pragma warning( disable : 5244 ) +#elif defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Winclude-angled-in-module-purview" +#endif + +// Foundation components +#include +#include +#include + +#ifdef _MSC_VER +# pragma warning( pop ) +#elif defined(__clang__) +# pragma clang diagnostic pop +#endif diff --git a/module/quick_test.cpp b/module/quick_test.cpp new file mode 100644 index 0000000000..84e543c48e --- /dev/null +++ b/module/quick_test.cpp @@ -0,0 +1,40 @@ +// Copyright 2026 Matt Borland +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt +// +// Smoke test for the boost.math module: exercises at least one entity from +// every component exported by module/math.cxx. + +#include + +// Import the STL if we can +#if defined(__cpp_lib_modules) && __cpp_lib_modules >= 202207L +import std; +#else +#include +#include +#endif + +import boost.math; + +int main() +{ + // constants + BOOST_TEST_GT(boost::math::constants::pi(), 3.14); + BOOST_TEST_LT(boost::math::constants::pi(), 3.15); + BOOST_TEST_EQ(boost::math::double_constants::half, 0.5); + static_assert(boost::math::float_constants::half == 0.5F, "float_constants"); + + // policies + const auto pol {boost::math::policies::make_policy( + boost::math::policies::domain_error())}; + static_cast(pol); + static_assert(boost::math::policies::is_policy::value, "is_policy"); + BOOST_TEST_GT((boost::math::policies::digits>()), 50); + + // error handling types are visible through the import + static_assert(boost::math::policies::is_noexcept_error_policy< + boost::math::policies::policy<>>::value == false, "default policy throws"); + + return boost::report_errors(); +} diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 9d673adc7d..29bcf179aa 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -44,6 +44,14 @@ if(HAVE_BOOST_TEST) enable_testing() boost_test_jamfile(FILE sycl_jamfile LINK_LIBRARIES Boost::math Boost::assert Boost::concept_check Boost::config Boost::core Boost::integer Boost::lexical_cast Boost::multiprecision Boost::predef Boost::random Boost::throw_exception Boost::unit_test_framework sycl COMPILE_DEFINITIONS BOOST_MATH_ENABLE_SYCL=1 COMPILE_OPTIONS -fsycl ) + elseif (BOOST_MATH_BUILD_MODULE) + + message(STATUS "Building boost.math as a C++20 module") + + enable_testing() + + add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../module" module) + else() boost_test(SOURCES check_cmake_version.cpp ARGUMENTS ${PROJECT_VERSION} LINK_LIBRARIES Boost::core Boost::config) From f9861a7d2239c63a37fed611dbd527f8c27d9882 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Wed, 15 Jul 2026 10:33:56 -0400 Subject: [PATCH 02/27] Guard std includes for module builds across all headers Mechanical sweep wrapping every standard library include in #ifndef BOOST_MATH_BUILD_MODULE so the module interface unit can provide them through the global module fragment or import std. Also converts the static constexpr color map data tables to BOOST_MATH_INLINE_CONSTEXPR for module linkage. No change in any existing configuration; validated against the full compile_test suite and the module build. --- include/boost/math/ccmath/copysign.hpp | 2 ++ include/boost/math/ccmath/detail/config.hpp | 2 ++ include/boost/math/ccmath/div.hpp | 2 ++ include/boost/math/ccmath/floor.hpp | 2 ++ include/boost/math/ccmath/fmod.hpp | 2 ++ include/boost/math/ccmath/hypot.hpp | 2 ++ include/boost/math/ccmath/ldexp.hpp | 2 ++ include/boost/math/ccmath/next.hpp | 2 ++ include/boost/math/ccmath/remainder.hpp | 2 ++ include/boost/math/ccmath/round.hpp | 2 ++ include/boost/math/ccmath/scalbln.hpp | 2 ++ include/boost/math/ccmath/scalbn.hpp | 2 ++ include/boost/math/ccmath/signbit.hpp | 4 ++++ include/boost/math/complex/details.hpp | 2 ++ include/boost/math/constants/info.hpp | 4 ++++ .../boost/math/differentiation/autodiff.hpp | 2 ++ .../math/differentiation/autodiff_cpp11.hpp | 2 ++ .../math/differentiation/autodiff_reverse.hpp | 2 ++ ..._mode_autodiff_expression_template_base.hpp | 2 ++ .../reverse_mode_autodiff_helper_functions.hpp | 2 ++ ...reverse_mode_autodiff_memory_management.hpp | 4 ++++ .../reverse_mode_autodiff_stl_expressions.hpp | 2 ++ .../detail/reverse_mode_autodiff_utilities.hpp | 2 ++ .../math/differentiation/finite_difference.hpp | 2 ++ .../math/differentiation/lanczos_smoothing.hpp | 2 ++ include/boost/math/distributions/arcsine.hpp | 2 ++ include/boost/math/distributions/bernoulli.hpp | 2 ++ include/boost/math/distributions/binomial.hpp | 2 ++ include/boost/math/distributions/cauchy.hpp | 2 ++ .../distributions/detail/derived_accessors.hpp | 2 ++ .../detail/hypergeometric_cdf.hpp | 2 ++ .../detail/hypergeometric_pdf.hpp | 4 ++++ ...irical_cumulative_distribution_function.hpp | 2 ++ .../boost/math/distributions/exponential.hpp | 2 ++ .../boost/math/distributions/extreme_value.hpp | 2 ++ include/boost/math/distributions/holtsmark.hpp | 2 ++ .../math/distributions/hyperexponential.hpp | 2 ++ .../math/distributions/hypergeometric.hpp | 2 ++ include/boost/math/distributions/landau.hpp | 2 ++ include/boost/math/distributions/mapairy.hpp | 2 ++ include/boost/math/distributions/saspoint5.hpp | 2 ++ .../boost/math/distributions/skew_normal.hpp | 2 ++ include/boost/math/filters/daubechies.hpp | 2 ++ .../interpolators/barycentric_rational.hpp | 2 ++ .../math/interpolators/bezier_polynomial.hpp | 2 ++ .../math/interpolators/bilinear_uniform.hpp | 2 ++ .../cardinal_quadratic_b_spline.hpp | 2 ++ .../cardinal_quintic_b_spline.hpp | 2 ++ .../interpolators/cardinal_trigonometric.hpp | 2 ++ .../boost/math/interpolators/catmull_rom.hpp | 2 ++ .../boost/math/interpolators/cubic_hermite.hpp | 4 ++++ .../detail/barycentric_rational_detail.hpp | 2 ++ .../detail/bezier_polynomial_detail.hpp | 2 ++ .../detail/bilinear_uniform_detail.hpp | 2 ++ .../detail/cardinal_cubic_b_spline_detail.hpp | 2 ++ .../cardinal_quadratic_b_spline_detail.hpp | 2 ++ .../cardinal_quintic_b_spline_detail.hpp | 2 ++ .../detail/cardinal_trigonometric_detail.hpp | 2 ++ .../detail/cubic_b_spline_detail.hpp | 2 ++ .../detail/cubic_hermite_detail.hpp | 2 ++ .../detail/quintic_hermite_detail.hpp | 2 ++ .../detail/septic_hermite_detail.hpp | 2 ++ .../vector_barycentric_rational_detail.hpp | 2 ++ .../detail/whittaker_shannon_detail.hpp | 2 ++ include/boost/math/interpolators/makima.hpp | 2 ++ include/boost/math/interpolators/pchip.hpp | 2 ++ .../math/interpolators/quintic_hermite.hpp | 2 ++ .../math/interpolators/septic_hermite.hpp | 2 ++ .../vector_barycentric_rational.hpp | 2 ++ .../math/interpolators/whittaker_shannon.hpp | 2 ++ include/boost/math/octonion.hpp | 2 ++ include/boost/math/optimization/cma_es.hpp | 2 ++ .../boost/math/optimization/detail/common.hpp | 2 ++ .../detail/differentiable_opt_utilties.hpp | 2 ++ .../detail/line_search_policies.hpp | 2 ++ .../detail/rdiff_optimization_policies.hpp | 2 ++ .../optimization/differential_evolution.hpp | 4 ++++ include/boost/math/optimization/jso.hpp | 4 ++++ include/boost/math/optimization/lbfgs.hpp | 4 ++++ include/boost/math/optimization/minimizer.hpp | 2 ++ include/boost/math/optimization/nesterov.hpp | 2 ++ .../boost/math/optimization/random_search.hpp | 2 ++ .../math/quadrature/detail/exp_sinh_detail.hpp | 4 ++++ .../detail/ooura_fourier_integrals_detail.hpp | 4 ++++ .../quadrature/detail/sinh_sinh_detail.hpp | 4 ++++ .../quadrature/detail/tanh_sinh_detail.hpp | 4 ++++ include/boost/math/quadrature/exp_sinh.hpp | 2 ++ include/boost/math/quadrature/gauss.hpp | 2 ++ .../boost/math/quadrature/gauss_kronrod.hpp | 2 ++ .../math/quadrature/naive_monte_carlo.hpp | 4 ++++ .../quadrature/ooura_fourier_integrals.hpp | 2 ++ include/boost/math/quadrature/sinh_sinh.hpp | 2 ++ include/boost/math/quadrature/tanh_sinh.hpp | 2 ++ include/boost/math/quadrature/trapezoidal.hpp | 2 ++ include/boost/math/quaternion.hpp | 6 ++++++ include/boost/math/special_functions/acosh.hpp | 2 ++ include/boost/math/special_functions/asinh.hpp | 2 ++ .../special_functions/cardinal_b_spline.hpp | 2 ++ .../boost/math/special_functions/chebyshev.hpp | 2 ++ .../special_functions/chebyshev_transform.hpp | 2 ++ .../boost/math/special_functions/cos_pi.hpp | 2 ++ .../special_functions/daubechies_scaling.hpp | 2 ++ .../special_functions/daubechies_wavelet.hpp | 2 ++ .../detail/bernoulli_details.hpp | 4 ++++ .../detail/bessel_derivatives_linear.hpp | 2 ++ .../detail/bessel_jy_derivatives_series.hpp | 2 ++ .../detail/daubechies_scaling_integer_grid.hpp | 2 ++ .../math/special_functions/detail/erf_inv.hpp | 2 ++ .../special_functions/detail/fp_traits.hpp | 2 ++ .../hypergeometric_1F1_scaled_series.hpp | 2 ++ ...ometric_1F1_small_a_negative_b_by_ratio.hpp | 2 ++ .../hypergeometric_pFq_checked_series.hpp | 2 ++ .../detail/hypergeometric_rational.hpp | 2 ++ .../detail/hypergeometric_series.hpp | 2 ++ .../special_functions/detail/polygamma.hpp | 4 ++++ .../detail/unchecked_bernoulli.hpp | 2 ++ include/boost/math/special_functions/expm1.hpp | 2 ++ .../boost/math/special_functions/fibonacci.hpp | 2 ++ .../fourier_transform_daubechies.hpp | 2 ++ .../math/special_functions/fpclassify.hpp | 4 ++++ .../math/special_functions/gegenbauer.hpp | 2 ++ .../special_functions/hypergeometric_pFq.hpp | 2 ++ .../boost/math/special_functions/jacobi.hpp | 2 ++ .../boost/math/special_functions/lambert_w.hpp | 2 ++ .../boost/math/special_functions/lanczos.hpp | 2 ++ .../boost/math/special_functions/legendre.hpp | 2 ++ .../special_functions/legendre_stieltjes.hpp | 2 ++ include/boost/math/special_functions/log1p.hpp | 2 ++ .../boost/math/special_functions/logaddexp.hpp | 2 ++ .../special_functions/logistic_sigmoid.hpp | 2 ++ include/boost/math/special_functions/logit.hpp | 2 ++ .../boost/math/special_functions/logsumexp.hpp | 2 ++ .../boost/math/special_functions/math_fwd.hpp | 2 ++ include/boost/math/special_functions/next.hpp | 2 ++ .../special_functions/nonfinite_num_facets.hpp | 2 ++ .../boost/math/special_functions/owens_t.hpp | 2 ++ include/boost/math/special_functions/prime.hpp | 2 ++ include/boost/math/special_functions/round.hpp | 2 ++ include/boost/math/special_functions/rsqrt.hpp | 2 ++ .../boost/math/special_functions/sin_pi.hpp | 2 ++ include/boost/math/special_functions/sinhc.hpp | 2 ++ .../special_functions/spherical_harmonic.hpp | 2 ++ include/boost/math/special_functions/trunc.hpp | 2 ++ .../boost/math/statistics/anderson_darling.hpp | 2 ++ .../math/statistics/bivariate_statistics.hpp | 4 ++++ .../math/statistics/chatterjee_correlation.hpp | 4 ++++ include/boost/math/statistics/detail/rank.hpp | 4 ++++ .../math/statistics/detail/single_pass.hpp | 4 ++++ .../math/statistics/linear_regression.hpp | 2 ++ include/boost/math/statistics/ljung_box.hpp | 2 ++ include/boost/math/statistics/runs_test.hpp | 2 ++ .../math/statistics/signal_statistics.hpp | 2 ++ include/boost/math/statistics/t_test.hpp | 2 ++ .../math/statistics/univariate_statistics.hpp | 4 ++++ include/boost/math/statistics/z_test.hpp | 2 ++ include/boost/math/tools/agm.hpp | 2 ++ include/boost/math/tools/array.hpp | 2 ++ include/boost/math/tools/atomic.hpp | 2 ++ include/boost/math/tools/big_constant.hpp | 2 ++ .../boost/math/tools/bivariate_statistics.hpp | 2 ++ .../math/tools/centered_continued_fraction.hpp | 2 ++ .../boost/math/tools/cohen_acceleration.hpp | 2 ++ include/boost/math/tools/color_maps.hpp | 18 +++++++++++------- include/boost/math/tools/complex.hpp | 2 ++ include/boost/math/tools/condition_numbers.hpp | 2 ++ include/boost/math/tools/cubic_roots.hpp | 2 ++ .../math/tools/detail/is_const_iterable.hpp | 2 ++ include/boost/math/tools/engel_expansion.hpp | 2 ++ include/boost/math/tools/estrin.hpp | 2 ++ .../boost/math/tools/is_constant_evaluated.hpp | 4 ++++ include/boost/math/tools/luroth_expansion.hpp | 2 ++ include/boost/math/tools/norms.hpp | 2 ++ include/boost/math/tools/polynomial.hpp | 2 ++ include/boost/math/tools/polynomial_gcd.hpp | 4 ++++ include/boost/math/tools/quartic_roots.hpp | 2 ++ include/boost/math/tools/random_vector.hpp | 2 ++ include/boost/math/tools/rational.hpp | 2 ++ include/boost/math/tools/recurrence.hpp | 2 ++ include/boost/math/tools/signal_statistics.hpp | 2 ++ .../math/tools/simple_continued_fraction.hpp | 2 ++ include/boost/math/tools/stats.hpp | 2 ++ include/boost/math/tools/test_value.hpp | 2 ++ include/boost/math/tools/traits.hpp | 2 ++ include/boost/math/tools/ulps_plot.hpp | 2 ++ .../boost/math/tools/univariate_statistics.hpp | 2 ++ include/boost/math/tools/utility.hpp | 2 ++ 186 files changed, 431 insertions(+), 7 deletions(-) diff --git a/include/boost/math/ccmath/copysign.hpp b/include/boost/math/ccmath/copysign.hpp index e117e57faa..e41b4071e4 100644 --- a/include/boost/math/ccmath/copysign.hpp +++ b/include/boost/math/ccmath/copysign.hpp @@ -6,10 +6,12 @@ #ifndef BOOST_MATH_CCMATH_COPYSIGN_HPP #define BOOST_MATH_CCMATH_COPYSIGN_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include #include +#endif #include #include #include diff --git a/include/boost/math/ccmath/detail/config.hpp b/include/boost/math/ccmath/detail/config.hpp index 097d69a16b..4304f4a374 100644 --- a/include/boost/math/ccmath/detail/config.hpp +++ b/include/boost/math/ccmath/detail/config.hpp @@ -8,9 +8,11 @@ #ifndef BOOST_MATH_CCMATH_DETAIL_CONFIG #define BOOST_MATH_CCMATH_DETAIL_CONFIG +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include +#endif #include #include diff --git a/include/boost/math/ccmath/div.hpp b/include/boost/math/ccmath/div.hpp index 613a22f3f5..6cf1df59de 100644 --- a/include/boost/math/ccmath/div.hpp +++ b/include/boost/math/ccmath/div.hpp @@ -6,8 +6,10 @@ #ifndef BOOST_MATH_CCMATH_DIV_HPP #define BOOST_MATH_CCMATH_DIV_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#endif #include #ifdef BOOST_MATH_NO_CCMATH diff --git a/include/boost/math/ccmath/floor.hpp b/include/boost/math/ccmath/floor.hpp index 5afed7d0ca..0484344bdd 100644 --- a/include/boost/math/ccmath/floor.hpp +++ b/include/boost/math/ccmath/floor.hpp @@ -15,7 +15,9 @@ #include #include #include +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif namespace boost::math::ccmath { diff --git a/include/boost/math/ccmath/fmod.hpp b/include/boost/math/ccmath/fmod.hpp index ba61cc95a2..b44034616e 100644 --- a/include/boost/math/ccmath/fmod.hpp +++ b/include/boost/math/ccmath/fmod.hpp @@ -12,7 +12,9 @@ #error "The header can only be used in C++17 and later." #endif +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif #include #include #include diff --git a/include/boost/math/ccmath/hypot.hpp b/include/boost/math/ccmath/hypot.hpp index 34dd5ab2c0..3fd09632c5 100644 --- a/include/boost/math/ccmath/hypot.hpp +++ b/include/boost/math/ccmath/hypot.hpp @@ -13,7 +13,9 @@ #error "The header can only be used in C++17 and later." #endif +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif #include #include #include diff --git a/include/boost/math/ccmath/ldexp.hpp b/include/boost/math/ccmath/ldexp.hpp index 3e2cd3610f..b1de3293f0 100644 --- a/include/boost/math/ccmath/ldexp.hpp +++ b/include/boost/math/ccmath/ldexp.hpp @@ -13,7 +13,9 @@ #error "The header can only be used in C++17 and later." #endif +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif #include #include #include diff --git a/include/boost/math/ccmath/next.hpp b/include/boost/math/ccmath/next.hpp index f03fe5cfa8..3a2090e6c5 100644 --- a/include/boost/math/ccmath/next.hpp +++ b/include/boost/math/ccmath/next.hpp @@ -13,9 +13,11 @@ #error "The header can only be used in C++17 and later." #endif +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include +#endif #include #include #include diff --git a/include/boost/math/ccmath/remainder.hpp b/include/boost/math/ccmath/remainder.hpp index b57420b879..21bb6afd27 100644 --- a/include/boost/math/ccmath/remainder.hpp +++ b/include/boost/math/ccmath/remainder.hpp @@ -12,7 +12,9 @@ #error "The header can only be used in C++17 and later." #endif +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif #include #include #include diff --git a/include/boost/math/ccmath/round.hpp b/include/boost/math/ccmath/round.hpp index 776f341c5c..0f21e721fa 100644 --- a/include/boost/math/ccmath/round.hpp +++ b/include/boost/math/ccmath/round.hpp @@ -6,7 +6,9 @@ #ifndef BOOST_MATH_CCMATH_ROUND_HPP #define BOOST_MATH_CCMATH_ROUND_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif #include #ifdef BOOST_MATH_NO_CCMATH diff --git a/include/boost/math/ccmath/scalbln.hpp b/include/boost/math/ccmath/scalbln.hpp index 2321f14c89..07b06dae69 100644 --- a/include/boost/math/ccmath/scalbln.hpp +++ b/include/boost/math/ccmath/scalbln.hpp @@ -12,7 +12,9 @@ #error "The header can only be used in C++17 and later." #endif +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif #include #include #include diff --git a/include/boost/math/ccmath/scalbn.hpp b/include/boost/math/ccmath/scalbn.hpp index 2026822525..dd29815dbc 100644 --- a/include/boost/math/ccmath/scalbn.hpp +++ b/include/boost/math/ccmath/scalbn.hpp @@ -13,7 +13,9 @@ #error "The header can only be used in C++17 and later." #endif +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif #include #include #include diff --git a/include/boost/math/ccmath/signbit.hpp b/include/boost/math/ccmath/signbit.hpp index 87f4cc7c9f..3f98c4c61e 100644 --- a/include/boost/math/ccmath/signbit.hpp +++ b/include/boost/math/ccmath/signbit.hpp @@ -12,14 +12,18 @@ #error "The header can only be used in C++17 and later." #endif +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif #include #include #include #ifdef __has_include # if __has_include() +#ifndef BOOST_MATH_BUILD_MODULE # include +#endif # if __cpp_lib_bit_cast >= 201806L # define BOOST_MATH_BIT_CAST(T, x) std::bit_cast(x) # endif diff --git a/include/boost/math/complex/details.hpp b/include/boost/math/complex/details.hpp index 0a3d35347d..340e2a4a6c 100644 --- a/include/boost/math/complex/details.hpp +++ b/include/boost/math/complex/details.hpp @@ -11,9 +11,11 @@ // that we need to implement all these functions. // +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include +#endif #include #include #include diff --git a/include/boost/math/constants/info.hpp b/include/boost/math/constants/info.hpp index b30c651e67..cddcda8fe5 100644 --- a/include/boost/math/constants/info.hpp +++ b/include/boost/math/constants/info.hpp @@ -11,11 +11,15 @@ #define BOOST_MATH_CONSTANTS_INFO_INCLUDED #include +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#endif #ifndef BOOST_MATH_NO_RTTI +#ifndef BOOST_MATH_BUILD_MODULE #include #endif +#endif namespace boost{ namespace math{ namespace constants{ diff --git a/include/boost/math/differentiation/autodiff.hpp b/include/boost/math/differentiation/autodiff.hpp index b8880f24de..83c8793072 100644 --- a/include/boost/math/differentiation/autodiff.hpp +++ b/include/boost/math/differentiation/autodiff.hpp @@ -20,6 +20,7 @@ #include #include +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include @@ -29,6 +30,7 @@ #include #include #include +#endif namespace boost { namespace math { diff --git a/include/boost/math/differentiation/autodiff_cpp11.hpp b/include/boost/math/differentiation/autodiff_cpp11.hpp index 1624c494ee..3a792a0d82 100644 --- a/include/boost/math/differentiation/autodiff_cpp11.hpp +++ b/include/boost/math/differentiation/autodiff_cpp11.hpp @@ -19,7 +19,9 @@ "Do not #include this file directly. This should only be #included by autodiff.hpp for C++11 compatibility." #endif +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif #include namespace boost { diff --git a/include/boost/math/differentiation/autodiff_reverse.hpp b/include/boost/math/differentiation/autodiff_reverse.hpp index d7b5124ce5..02d5ac2815 100644 --- a/include/boost/math/differentiation/autodiff_reverse.hpp +++ b/include/boost/math/differentiation/autodiff_reverse.hpp @@ -38,10 +38,12 @@ #include #include #include +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include #include +#endif #define BOOST_MATH_BUFFER_SIZE 65536 namespace boost { diff --git a/include/boost/math/differentiation/detail/reverse_mode_autodiff_expression_template_base.hpp b/include/boost/math/differentiation/detail/reverse_mode_autodiff_expression_template_base.hpp index 494b317c67..5d774201d2 100644 --- a/include/boost/math/differentiation/detail/reverse_mode_autodiff_expression_template_base.hpp +++ b/include/boost/math/differentiation/detail/reverse_mode_autodiff_expression_template_base.hpp @@ -5,8 +5,10 @@ #ifndef REVERSE_MODE_AUTODIFF_EXPRESSION_TEMPLATE_BASE_HPP #define REVERSE_MODE_AUTODIFF_EXPRESSION_TEMPLATE_BASE_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#endif namespace boost { namespace math { namespace differentiation { diff --git a/include/boost/math/differentiation/detail/reverse_mode_autodiff_helper_functions.hpp b/include/boost/math/differentiation/detail/reverse_mode_autodiff_helper_functions.hpp index 4bd88ad68a..1409d7f2e0 100644 --- a/include/boost/math/differentiation/detail/reverse_mode_autodiff_helper_functions.hpp +++ b/include/boost/math/differentiation/detail/reverse_mode_autodiff_helper_functions.hpp @@ -5,8 +5,10 @@ #ifndef BOOST_REVERSE_MODE_AUTODIFF_HELPER_FUNCTIONS_HPP #define BOOST_REVERSE_MODE_AUTODIFF_HELPER_FUNCTIONS_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#endif namespace boost { namespace math { namespace differentiation { diff --git a/include/boost/math/differentiation/detail/reverse_mode_autodiff_memory_management.hpp b/include/boost/math/differentiation/detail/reverse_mode_autodiff_memory_management.hpp index 382af5f5c5..5f840d66d6 100644 --- a/include/boost/math/differentiation/detail/reverse_mode_autodiff_memory_management.hpp +++ b/include/boost/math/differentiation/detail/reverse_mode_autodiff_memory_management.hpp @@ -6,15 +6,19 @@ #ifndef REVERSE_MODE_AUTODIFF_MEMORY_MANAGEMENT_HPP #define REVERSE_MODE_AUTODIFF_MEMORY_MANAGEMENT_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#endif #include +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include #include #include #include +#endif namespace boost { namespace math { namespace differentiation { diff --git a/include/boost/math/differentiation/detail/reverse_mode_autodiff_stl_expressions.hpp b/include/boost/math/differentiation/detail/reverse_mode_autodiff_stl_expressions.hpp index b5f9570d35..2bcd22ccff 100644 --- a/include/boost/math/differentiation/detail/reverse_mode_autodiff_stl_expressions.hpp +++ b/include/boost/math/differentiation/detail/reverse_mode_autodiff_stl_expressions.hpp @@ -15,8 +15,10 @@ #include #include #include +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#endif namespace boost { namespace math { namespace differentiation { diff --git a/include/boost/math/differentiation/detail/reverse_mode_autodiff_utilities.hpp b/include/boost/math/differentiation/detail/reverse_mode_autodiff_utilities.hpp index 9452f8827c..7346407b32 100644 --- a/include/boost/math/differentiation/detail/reverse_mode_autodiff_utilities.hpp +++ b/include/boost/math/differentiation/detail/reverse_mode_autodiff_utilities.hpp @@ -5,7 +5,9 @@ #ifndef REVERSE_MODE_AUTODIFF_UTILITIES_HPP #define REVERSE_MODE_AUTODIFF_UTILITIES_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif namespace boost { namespace math { diff --git a/include/boost/math/differentiation/finite_difference.hpp b/include/boost/math/differentiation/finite_difference.hpp index 1375bac7ad..5230c38cff 100644 --- a/include/boost/math/differentiation/finite_difference.hpp +++ b/include/boost/math/differentiation/finite_difference.hpp @@ -44,7 +44,9 @@ * 1) Squire, William, and George Trapp. "Using complex variables to estimate derivatives of real functions." Siam Review 40.1 (1998): 110-112. */ +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif #include namespace boost{ namespace math{ namespace differentiation { diff --git a/include/boost/math/differentiation/lanczos_smoothing.hpp b/include/boost/math/differentiation/lanczos_smoothing.hpp index 4103f538d7..97d2315c21 100644 --- a/include/boost/math/differentiation/lanczos_smoothing.hpp +++ b/include/boost/math/differentiation/lanczos_smoothing.hpp @@ -5,6 +5,7 @@ #ifndef BOOST_MATH_DIFFERENTIATION_LANCZOS_SMOOTHING_HPP #define BOOST_MATH_DIFFERENTIATION_LANCZOS_SMOOTHING_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include // for std::abs #include #include // to nan initialize @@ -13,6 +14,7 @@ #include #include #include +#endif #include #include diff --git a/include/boost/math/distributions/arcsine.hpp b/include/boost/math/distributions/arcsine.hpp index 4fe3c7d751..f7a57e15c0 100644 --- a/include/boost/math/distributions/arcsine.hpp +++ b/include/boost/math/distributions/arcsine.hpp @@ -42,10 +42,12 @@ #ifndef BOOST_MATH_HAS_NVRTC #include +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include // For std::domain_error. #endif +#endif #if defined (BOOST_MSVC) # pragma warning(push) diff --git a/include/boost/math/distributions/bernoulli.hpp b/include/boost/math/distributions/bernoulli.hpp index bfb5bf6180..50f18cd463 100644 --- a/include/boost/math/distributions/bernoulli.hpp +++ b/include/boost/math/distributions/bernoulli.hpp @@ -39,7 +39,9 @@ #include #ifndef BOOST_MATH_HAS_NVRTC +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif #include #endif diff --git a/include/boost/math/distributions/binomial.hpp b/include/boost/math/distributions/binomial.hpp index 262823170f..94817ac5a4 100644 --- a/include/boost/math/distributions/binomial.hpp +++ b/include/boost/math/distributions/binomial.hpp @@ -89,7 +89,9 @@ #include // isnan. #include // for root finding. +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif namespace boost { diff --git a/include/boost/math/distributions/cauchy.hpp b/include/boost/math/distributions/cauchy.hpp index 5a19f499a3..03fa8562aa 100644 --- a/include/boost/math/distributions/cauchy.hpp +++ b/include/boost/math/distributions/cauchy.hpp @@ -27,9 +27,11 @@ #ifndef BOOST_MATH_HAS_NVRTC #include +#ifndef BOOST_MATH_BUILD_MODULE #include #include #endif +#endif namespace boost{ namespace math { diff --git a/include/boost/math/distributions/detail/derived_accessors.hpp b/include/boost/math/distributions/detail/derived_accessors.hpp index 90679ef21f..08c478ffd1 100644 --- a/include/boost/math/distributions/detail/derived_accessors.hpp +++ b/include/boost/math/distributions/detail/derived_accessors.hpp @@ -32,8 +32,10 @@ #include #ifndef BOOST_MATH_HAS_NVRTC +#ifndef BOOST_MATH_BUILD_MODULE #include #endif +#endif #ifdef _MSC_VER # pragma warning(push) diff --git a/include/boost/math/distributions/detail/hypergeometric_cdf.hpp b/include/boost/math/distributions/detail/hypergeometric_cdf.hpp index 60e29bc10c..1f8cf4c4a7 100644 --- a/include/boost/math/distributions/detail/hypergeometric_cdf.hpp +++ b/include/boost/math/distributions/detail/hypergeometric_cdf.hpp @@ -10,7 +10,9 @@ #include #include +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif namespace boost{ namespace math{ namespace detail{ diff --git a/include/boost/math/distributions/detail/hypergeometric_pdf.hpp b/include/boost/math/distributions/detail/hypergeometric_pdf.hpp index 0ec3065eb3..0d346fbc74 100644 --- a/include/boost/math/distributions/detail/hypergeometric_pdf.hpp +++ b/include/boost/math/distributions/detail/hypergeometric_pdf.hpp @@ -15,12 +15,16 @@ #include #include #include +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#endif #ifdef BOOST_MATH_INSTRUMENT +#ifndef BOOST_MATH_BUILD_MODULE #include #endif +#endif namespace boost{ namespace math{ namespace detail{ diff --git a/include/boost/math/distributions/empirical_cumulative_distribution_function.hpp b/include/boost/math/distributions/empirical_cumulative_distribution_function.hpp index 0d43db16f2..0d77a1ec49 100644 --- a/include/boost/math/distributions/empirical_cumulative_distribution_function.hpp +++ b/include/boost/math/distributions/empirical_cumulative_distribution_function.hpp @@ -5,11 +5,13 @@ #ifndef BOOST_MATH_DISTRIBUTIONS_EMPIRICAL_CUMULATIVE_DISTRIBUTION_FUNCTION_HPP #define BOOST_MATH_DISTRIBUTIONS_EMPIRICAL_CUMULATIVE_DISTRIBUTION_FUNCTION_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include #include #include +#endif #include #ifndef BOOST_MATH_STANDALONE diff --git a/include/boost/math/distributions/exponential.hpp b/include/boost/math/distributions/exponential.hpp index 9d45ac4933..d3a119ce9c 100644 --- a/include/boost/math/distributions/exponential.hpp +++ b/include/boost/math/distributions/exponential.hpp @@ -26,9 +26,11 @@ #ifndef BOOST_MATH_HAS_NVRTC #include +#ifndef BOOST_MATH_BUILD_MODULE #include #include #endif +#endif namespace boost{ namespace math{ diff --git a/include/boost/math/distributions/extreme_value.hpp b/include/boost/math/distributions/extreme_value.hpp index 7049ac6a15..49e155328c 100644 --- a/include/boost/math/distributions/extreme_value.hpp +++ b/include/boost/math/distributions/extreme_value.hpp @@ -28,9 +28,11 @@ #ifndef BOOST_MATH_HAS_NVRTC #include +#ifndef BOOST_MATH_BUILD_MODULE #include #include #endif +#endif #ifdef _MSC_VER # pragma warning(push) diff --git a/include/boost/math/distributions/holtsmark.hpp b/include/boost/math/distributions/holtsmark.hpp index 04f5484f4e..ca21d05ec4 100644 --- a/include/boost/math/distributions/holtsmark.hpp +++ b/include/boost/math/distributions/holtsmark.hpp @@ -29,9 +29,11 @@ #ifndef BOOST_MATH_HAS_NVRTC #include #include +#ifndef BOOST_MATH_BUILD_MODULE #include #include #endif +#endif namespace boost { namespace math { template diff --git a/include/boost/math/distributions/hyperexponential.hpp b/include/boost/math/distributions/hyperexponential.hpp index 49f967d0fa..06096d07e7 100644 --- a/include/boost/math/distributions/hyperexponential.hpp +++ b/include/boost/math/distributions/hyperexponential.hpp @@ -24,6 +24,7 @@ #include #include #include +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include @@ -32,6 +33,7 @@ #include #include #include +#endif #ifdef _MSC_VER diff --git a/include/boost/math/distributions/hypergeometric.hpp b/include/boost/math/distributions/hypergeometric.hpp index d7d1b6a069..2ed3954ed2 100644 --- a/include/boost/math/distributions/hypergeometric.hpp +++ b/include/boost/math/distributions/hypergeometric.hpp @@ -16,7 +16,9 @@ #include #include #include +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif namespace boost { namespace math { diff --git a/include/boost/math/distributions/landau.hpp b/include/boost/math/distributions/landau.hpp index e8e9420be1..2e4b0617c0 100644 --- a/include/boost/math/distributions/landau.hpp +++ b/include/boost/math/distributions/landau.hpp @@ -28,9 +28,11 @@ #ifndef BOOST_MATH_HAS_NVRTC #include #include +#ifndef BOOST_MATH_BUILD_MODULE #include #include #endif +#endif namespace boost { namespace math { template diff --git a/include/boost/math/distributions/mapairy.hpp b/include/boost/math/distributions/mapairy.hpp index 8bf1f990c1..0f8e3f0ffb 100644 --- a/include/boost/math/distributions/mapairy.hpp +++ b/include/boost/math/distributions/mapairy.hpp @@ -28,8 +28,10 @@ #ifndef BOOST_MATH_HAS_NVRTC #include +#ifndef BOOST_MATH_BUILD_MODULE #include #endif +#endif namespace boost { namespace math { template diff --git a/include/boost/math/distributions/saspoint5.hpp b/include/boost/math/distributions/saspoint5.hpp index 7846b99560..16319ee40e 100644 --- a/include/boost/math/distributions/saspoint5.hpp +++ b/include/boost/math/distributions/saspoint5.hpp @@ -28,8 +28,10 @@ #ifndef BOOST_MATH_HAS_NVRTC #include +#ifndef BOOST_MATH_BUILD_MODULE #include #endif +#endif namespace boost { namespace math { template diff --git a/include/boost/math/distributions/skew_normal.hpp b/include/boost/math/distributions/skew_normal.hpp index 28595a9ee8..77f2a988cd 100644 --- a/include/boost/math/distributions/skew_normal.hpp +++ b/include/boost/math/distributions/skew_normal.hpp @@ -24,8 +24,10 @@ #include #include // pdf max finder. +#ifndef BOOST_MATH_BUILD_MODULE #include #include // std::lower_bound, std::distance +#endif #ifdef BOOST_MATH_INSTRUMENT_SKEW_NORMAL_ITERATIONS extern std::uintmax_t global_iter_count; diff --git a/include/boost/math/filters/daubechies.hpp b/include/boost/math/filters/daubechies.hpp index 0655be3793..13fa90fd28 100644 --- a/include/boost/math/filters/daubechies.hpp +++ b/include/boost/math/filters/daubechies.hpp @@ -6,8 +6,10 @@ */ #ifndef BOOST_MATH_FILTERS_DAUBECHIES_HPP #define BOOST_MATH_FILTERS_DAUBECHIES_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#endif #include #include diff --git a/include/boost/math/interpolators/barycentric_rational.hpp b/include/boost/math/interpolators/barycentric_rational.hpp index c18e38dd74..2286a1bdf0 100644 --- a/include/boost/math/interpolators/barycentric_rational.hpp +++ b/include/boost/math/interpolators/barycentric_rational.hpp @@ -26,7 +26,9 @@ #ifndef BOOST_MATH_INTERPOLATORS_BARYCENTRIC_RATIONAL_HPP #define BOOST_MATH_INTERPOLATORS_BARYCENTRIC_RATIONAL_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif #include namespace boost{ namespace math{ namespace interpolators{ diff --git a/include/boost/math/interpolators/bezier_polynomial.hpp b/include/boost/math/interpolators/bezier_polynomial.hpp index 022d205c09..0a4c66a7c2 100644 --- a/include/boost/math/interpolators/bezier_polynomial.hpp +++ b/include/boost/math/interpolators/bezier_polynomial.hpp @@ -5,7 +5,9 @@ // or copy at http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_MATH_INTERPOLATORS_BEZIER_POLYNOMIAL_HPP #define BOOST_MATH_INTERPOLATORS_BEZIER_POLYNOMIAL_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif #include #ifdef BOOST_MATH_NO_THREAD_LOCAL_WITH_NON_TRIVIAL_TYPES diff --git a/include/boost/math/interpolators/bilinear_uniform.hpp b/include/boost/math/interpolators/bilinear_uniform.hpp index 555204a875..667d85f711 100644 --- a/include/boost/math/interpolators/bilinear_uniform.hpp +++ b/include/boost/math/interpolators/bilinear_uniform.hpp @@ -17,8 +17,10 @@ #ifndef BOOST_MATH_INTERPOLATORS_BILINEAR_UNIFORM_HPP #define BOOST_MATH_INTERPOLATORS_BILINEAR_UNIFORM_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#endif #include namespace boost::math::interpolators { diff --git a/include/boost/math/interpolators/cardinal_quadratic_b_spline.hpp b/include/boost/math/interpolators/cardinal_quadratic_b_spline.hpp index a5b150f2f1..0f135f62c5 100644 --- a/include/boost/math/interpolators/cardinal_quadratic_b_spline.hpp +++ b/include/boost/math/interpolators/cardinal_quadratic_b_spline.hpp @@ -6,7 +6,9 @@ #ifndef BOOST_MATH_INTERPOLATORS_CARDINAL_QUADRATIC_B_SPLINE_HPP #define BOOST_MATH_INTERPOLATORS_CARDINAL_QUADRATIC_B_SPLINE_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif #include diff --git a/include/boost/math/interpolators/cardinal_quintic_b_spline.hpp b/include/boost/math/interpolators/cardinal_quintic_b_spline.hpp index 3d72865d93..e47b2177ac 100644 --- a/include/boost/math/interpolators/cardinal_quintic_b_spline.hpp +++ b/include/boost/math/interpolators/cardinal_quintic_b_spline.hpp @@ -6,8 +6,10 @@ #ifndef BOOST_MATH_INTERPOLATORS_CARDINAL_QUINTIC_B_SPLINE_HPP #define BOOST_MATH_INTERPOLATORS_CARDINAL_QUINTIC_B_SPLINE_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#endif #include diff --git a/include/boost/math/interpolators/cardinal_trigonometric.hpp b/include/boost/math/interpolators/cardinal_trigonometric.hpp index 28a58c8b28..1303ae2583 100644 --- a/include/boost/math/interpolators/cardinal_trigonometric.hpp +++ b/include/boost/math/interpolators/cardinal_trigonometric.hpp @@ -5,7 +5,9 @@ #ifndef BOOST_MATH_INTERPOLATORS_CARDINAL_TRIGONOMETRIC_HPP #define BOOST_MATH_INTERPOLATORS_CARDINAL_TRIGONOMETRIC_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif #include namespace boost { namespace math { namespace interpolators { diff --git a/include/boost/math/interpolators/catmull_rom.hpp b/include/boost/math/interpolators/catmull_rom.hpp index cf8e3cb3b8..a3bac29f7b 100644 --- a/include/boost/math/interpolators/catmull_rom.hpp +++ b/include/boost/math/interpolators/catmull_rom.hpp @@ -9,12 +9,14 @@ #ifndef BOOST_MATH_INTERPOLATORS_CATMULL_ROM #define BOOST_MATH_INTERPOLATORS_CATMULL_ROM +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include #include #include #include +#endif namespace std_workaround { diff --git a/include/boost/math/interpolators/cubic_hermite.hpp b/include/boost/math/interpolators/cubic_hermite.hpp index 04d1fa787f..b4204e5c04 100644 --- a/include/boost/math/interpolators/cubic_hermite.hpp +++ b/include/boost/math/interpolators/cubic_hermite.hpp @@ -6,9 +6,13 @@ #ifndef BOOST_MATH_INTERPOLATORS_CUBIC_HERMITE_HPP #define BOOST_MATH_INTERPOLATORS_CUBIC_HERMITE_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif #include +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif namespace boost { namespace math { diff --git a/include/boost/math/interpolators/detail/barycentric_rational_detail.hpp b/include/boost/math/interpolators/detail/barycentric_rational_detail.hpp index 004bf3f9b5..32b726ad6a 100644 --- a/include/boost/math/interpolators/detail/barycentric_rational_detail.hpp +++ b/include/boost/math/interpolators/detail/barycentric_rational_detail.hpp @@ -8,11 +8,13 @@ #ifndef BOOST_MATH_INTERPOLATORS_BARYCENTRIC_RATIONAL_DETAIL_HPP #define BOOST_MATH_INTERPOLATORS_BARYCENTRIC_RATIONAL_DETAIL_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include // for std::move #include // for std::is_sorted #include #include +#endif #include #include diff --git a/include/boost/math/interpolators/detail/bezier_polynomial_detail.hpp b/include/boost/math/interpolators/detail/bezier_polynomial_detail.hpp index 60fe5ab5d8..919537dd57 100644 --- a/include/boost/math/interpolators/detail/bezier_polynomial_detail.hpp +++ b/include/boost/math/interpolators/detail/bezier_polynomial_detail.hpp @@ -7,10 +7,12 @@ #ifndef BOOST_MATH_INTERPOLATORS_BEZIER_POLYNOMIAL_DETAIL_HPP #define BOOST_MATH_INTERPOLATORS_BEZIER_POLYNOMIAL_DETAIL_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include #include +#endif namespace boost::math::interpolators::detail { diff --git a/include/boost/math/interpolators/detail/bilinear_uniform_detail.hpp b/include/boost/math/interpolators/detail/bilinear_uniform_detail.hpp index 590e961f7f..e27de1a07a 100644 --- a/include/boost/math/interpolators/detail/bilinear_uniform_detail.hpp +++ b/include/boost/math/interpolators/detail/bilinear_uniform_detail.hpp @@ -7,12 +7,14 @@ #ifndef BOOST_MATH_INTERPOLATORS_BILINEAR_UNIFORM_DETAIL_HPP #define BOOST_MATH_INTERPOLATORS_BILINEAR_UNIFORM_DETAIL_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include #include #include #include +#endif namespace boost::math::interpolators::detail { diff --git a/include/boost/math/interpolators/detail/cardinal_cubic_b_spline_detail.hpp b/include/boost/math/interpolators/detail/cardinal_cubic_b_spline_detail.hpp index 2064caa515..d1905cb840 100644 --- a/include/boost/math/interpolators/detail/cardinal_cubic_b_spline_detail.hpp +++ b/include/boost/math/interpolators/detail/cardinal_cubic_b_spline_detail.hpp @@ -7,10 +7,12 @@ #ifndef BOOST_MATH_INTERPOLATORS_CARDINAL_CUBIC_B_SPLINE_DETAIL_HPP #define BOOST_MATH_INTERPOLATORS_CARDINAL_CUBIC_B_SPLINE_DETAIL_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include #include +#endif #include #include #include diff --git a/include/boost/math/interpolators/detail/cardinal_quadratic_b_spline_detail.hpp b/include/boost/math/interpolators/detail/cardinal_quadratic_b_spline_detail.hpp index cb5ce9f571..64fe260003 100644 --- a/include/boost/math/interpolators/detail/cardinal_quadratic_b_spline_detail.hpp +++ b/include/boost/math/interpolators/detail/cardinal_quadratic_b_spline_detail.hpp @@ -6,9 +6,11 @@ #ifndef BOOST_MATH_INTERPOLATORS_CARDINAL_QUADRATIC_B_SPLINE_DETAIL_HPP #define BOOST_MATH_INTERPOLATORS_CARDINAL_QUADRATIC_B_SPLINE_DETAIL_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include +#endif namespace boost{ namespace math{ namespace interpolators{ namespace detail{ diff --git a/include/boost/math/interpolators/detail/cardinal_quintic_b_spline_detail.hpp b/include/boost/math/interpolators/detail/cardinal_quintic_b_spline_detail.hpp index fcaa33661e..39c9219993 100644 --- a/include/boost/math/interpolators/detail/cardinal_quintic_b_spline_detail.hpp +++ b/include/boost/math/interpolators/detail/cardinal_quintic_b_spline_detail.hpp @@ -6,10 +6,12 @@ #ifndef BOOST_MATH_INTERPOLATORS_CARDINAL_QUINTIC_B_SPLINE_DETAIL_HPP #define BOOST_MATH_INTERPOLATORS_CARDINAL_QUINTIC_B_SPLINE_DETAIL_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include #include +#endif #include namespace boost{ namespace math{ namespace interpolators{ namespace detail{ diff --git a/include/boost/math/interpolators/detail/cardinal_trigonometric_detail.hpp b/include/boost/math/interpolators/detail/cardinal_trigonometric_detail.hpp index 62ef4bacec..e75fd698d6 100644 --- a/include/boost/math/interpolators/detail/cardinal_trigonometric_detail.hpp +++ b/include/boost/math/interpolators/detail/cardinal_trigonometric_detail.hpp @@ -5,9 +5,11 @@ #ifndef BOOST_MATH_INTERPOLATORS_DETAIL_CARDINAL_TRIGONOMETRIC_HPP #define BOOST_MATH_INTERPOLATORS_DETAIL_CARDINAL_TRIGONOMETRIC_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include +#endif #include #ifdef BOOST_HAS_FLOAT128 diff --git a/include/boost/math/interpolators/detail/cubic_b_spline_detail.hpp b/include/boost/math/interpolators/detail/cubic_b_spline_detail.hpp index ac2ce29dd8..fe011e29c7 100644 --- a/include/boost/math/interpolators/detail/cubic_b_spline_detail.hpp +++ b/include/boost/math/interpolators/detail/cubic_b_spline_detail.hpp @@ -7,10 +7,12 @@ #ifndef CUBIC_B_SPLINE_DETAIL_HPP #define CUBIC_B_SPLINE_DETAIL_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include #include +#endif #include #include diff --git a/include/boost/math/interpolators/detail/cubic_hermite_detail.hpp b/include/boost/math/interpolators/detail/cubic_hermite_detail.hpp index 0e04d37390..a1c84dca72 100644 --- a/include/boost/math/interpolators/detail/cubic_hermite_detail.hpp +++ b/include/boost/math/interpolators/detail/cubic_hermite_detail.hpp @@ -6,6 +6,7 @@ #ifndef BOOST_MATH_INTERPOLATORS_DETAIL_CUBIC_HERMITE_DETAIL_HPP #define BOOST_MATH_INTERPOLATORS_DETAIL_CUBIC_HERMITE_DETAIL_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include @@ -13,6 +14,7 @@ #include #include #include +#endif namespace boost { namespace math { diff --git a/include/boost/math/interpolators/detail/quintic_hermite_detail.hpp b/include/boost/math/interpolators/detail/quintic_hermite_detail.hpp index ad7eee13a1..85b1458fcd 100644 --- a/include/boost/math/interpolators/detail/quintic_hermite_detail.hpp +++ b/include/boost/math/interpolators/detail/quintic_hermite_detail.hpp @@ -6,12 +6,14 @@ */ #ifndef BOOST_MATH_INTERPOLATORS_DETAIL_QUINTIC_HERMITE_DETAIL_HPP #define BOOST_MATH_INTERPOLATORS_DETAIL_QUINTIC_HERMITE_DETAIL_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include #include #include #include +#endif namespace boost { namespace math { diff --git a/include/boost/math/interpolators/detail/septic_hermite_detail.hpp b/include/boost/math/interpolators/detail/septic_hermite_detail.hpp index f4677ce0b6..e4bcdf1f1f 100644 --- a/include/boost/math/interpolators/detail/septic_hermite_detail.hpp +++ b/include/boost/math/interpolators/detail/septic_hermite_detail.hpp @@ -6,12 +6,14 @@ */ #ifndef BOOST_MATH_INTERPOLATORS_DETAIL_SEPTIC_HERMITE_DETAIL_HPP #define BOOST_MATH_INTERPOLATORS_DETAIL_SEPTIC_HERMITE_DETAIL_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include #include #include #include +#endif namespace boost { namespace math { diff --git a/include/boost/math/interpolators/detail/vector_barycentric_rational_detail.hpp b/include/boost/math/interpolators/detail/vector_barycentric_rational_detail.hpp index fdece724c1..c6b1c19bf4 100644 --- a/include/boost/math/interpolators/detail/vector_barycentric_rational_detail.hpp +++ b/include/boost/math/interpolators/detail/vector_barycentric_rational_detail.hpp @@ -8,12 +8,14 @@ #ifndef BOOST_MATH_INTERPOLATORS_VECTOR_BARYCENTRIC_RATIONAL_DETAIL_HPP #define BOOST_MATH_INTERPOLATORS_VECTOR_BARYCENTRIC_RATIONAL_DETAIL_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include #include // for std::move #include #include +#endif #include namespace boost{ namespace math{ namespace interpolators{ namespace detail{ diff --git a/include/boost/math/interpolators/detail/whittaker_shannon_detail.hpp b/include/boost/math/interpolators/detail/whittaker_shannon_detail.hpp index 74ff47c463..66d88ca000 100644 --- a/include/boost/math/interpolators/detail/whittaker_shannon_detail.hpp +++ b/include/boost/math/interpolators/detail/whittaker_shannon_detail.hpp @@ -5,7 +5,9 @@ // or copy at http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_MATH_INTERPOLATORS_WHITAKKER_SHANNON_DETAIL_HPP #define BOOST_MATH_INTERPOLATORS_WHITAKKER_SHANNON_DETAIL_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif #include #include #include diff --git a/include/boost/math/interpolators/makima.hpp b/include/boost/math/interpolators/makima.hpp index f69fe40733..05c919c9d4 100644 --- a/include/boost/math/interpolators/makima.hpp +++ b/include/boost/math/interpolators/makima.hpp @@ -9,8 +9,10 @@ #ifndef BOOST_MATH_INTERPOLATORS_MAKIMA_HPP #define BOOST_MATH_INTERPOLATORS_MAKIMA_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#endif #include namespace boost { diff --git a/include/boost/math/interpolators/pchip.hpp b/include/boost/math/interpolators/pchip.hpp index a4ad5a3579..b5b8b17039 100644 --- a/include/boost/math/interpolators/pchip.hpp +++ b/include/boost/math/interpolators/pchip.hpp @@ -6,8 +6,10 @@ #ifndef BOOST_MATH_INTERPOLATORS_PCHIP_HPP #define BOOST_MATH_INTERPOLATORS_PCHIP_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#endif #include namespace boost { diff --git a/include/boost/math/interpolators/quintic_hermite.hpp b/include/boost/math/interpolators/quintic_hermite.hpp index 1c00b15469..762678f908 100644 --- a/include/boost/math/interpolators/quintic_hermite.hpp +++ b/include/boost/math/interpolators/quintic_hermite.hpp @@ -7,10 +7,12 @@ #ifndef BOOST_MATH_INTERPOLATORS_QUINTIC_HERMITE_HPP #define BOOST_MATH_INTERPOLATORS_QUINTIC_HERMITE_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include #include +#endif #include namespace boost { diff --git a/include/boost/math/interpolators/septic_hermite.hpp b/include/boost/math/interpolators/septic_hermite.hpp index e8cb8e5493..23fa563af4 100644 --- a/include/boost/math/interpolators/septic_hermite.hpp +++ b/include/boost/math/interpolators/septic_hermite.hpp @@ -6,10 +6,12 @@ */ #ifndef BOOST_MATH_INTERPOLATORS_SEPTIC_HERMITE_HPP #define BOOST_MATH_INTERPOLATORS_SEPTIC_HERMITE_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include #include +#endif #include namespace boost { diff --git a/include/boost/math/interpolators/vector_barycentric_rational.hpp b/include/boost/math/interpolators/vector_barycentric_rational.hpp index 1b899fbd5f..34a0dd5a4c 100644 --- a/include/boost/math/interpolators/vector_barycentric_rational.hpp +++ b/include/boost/math/interpolators/vector_barycentric_rational.hpp @@ -12,7 +12,9 @@ #ifndef BOOST_MATH_INTERPOLATORS_VECTOR_BARYCENTRIC_RATIONAL_HPP #define BOOST_MATH_INTERPOLATORS_VECTOR_BARYCENTRIC_RATIONAL_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif #include namespace boost{ namespace math{ namespace interpolators{ diff --git a/include/boost/math/interpolators/whittaker_shannon.hpp b/include/boost/math/interpolators/whittaker_shannon.hpp index a5c5367a9d..55ba8ceec5 100644 --- a/include/boost/math/interpolators/whittaker_shannon.hpp +++ b/include/boost/math/interpolators/whittaker_shannon.hpp @@ -5,7 +5,9 @@ // or copy at http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_MATH_INTERPOLATORS_WHITAKKER_SHANNON_HPP #define BOOST_MATH_INTERPOLATORS_WHITAKKER_SHANNON_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif #include namespace boost { namespace math { namespace interpolators { diff --git a/include/boost/math/octonion.hpp b/include/boost/math/octonion.hpp index 4239140564..4f66e533a4 100644 --- a/include/boost/math/octonion.hpp +++ b/include/boost/math/octonion.hpp @@ -12,7 +12,9 @@ #define BOOST_OCTONION_HPP #include +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif namespace boost diff --git a/include/boost/math/optimization/cma_es.hpp b/include/boost/math/optimization/cma_es.hpp index 42b901a190..06b22aea7d 100644 --- a/include/boost/math/optimization/cma_es.hpp +++ b/include/boost/math/optimization/cma_es.hpp @@ -6,6 +6,7 @@ */ #ifndef BOOST_MATH_OPTIMIZATION_CMA_ES_HPP #define BOOST_MATH_OPTIMIZATION_CMA_ES_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include @@ -15,6 +16,7 @@ #include #include #include +#endif #include #include #if __has_include() diff --git a/include/boost/math/optimization/detail/common.hpp b/include/boost/math/optimization/detail/common.hpp index 05124026e7..3882a24d20 100644 --- a/include/boost/math/optimization/detail/common.hpp +++ b/include/boost/math/optimization/detail/common.hpp @@ -6,6 +6,7 @@ */ #ifndef BOOST_MATH_OPTIMIZATION_DETAIL_COMMON_HPP #define BOOST_MATH_OPTIMIZATION_DETAIL_COMMON_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include // for std::sort #include #include @@ -13,6 +14,7 @@ #include #include #include // for std::false_type +#endif namespace boost::math::optimization::detail { diff --git a/include/boost/math/optimization/detail/differentiable_opt_utilties.hpp b/include/boost/math/optimization/detail/differentiable_opt_utilties.hpp index 8fd3c2a083..cc1e7c68fc 100644 --- a/include/boost/math/optimization/detail/differentiable_opt_utilties.hpp +++ b/include/boost/math/optimization/detail/differentiable_opt_utilties.hpp @@ -5,10 +5,12 @@ #ifndef BOOST_MATH_OPTIMIZATION_DETAIL_DIFFERENTIABLE_OPT_UTILITIES_HPP #define BOOST_MATH_OPTIMIZATION_DETAIL_DIFFERENTIABLE_OPT_UTILITIES_HPP #include +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include #include +#endif namespace boost { namespace math { diff --git a/include/boost/math/optimization/detail/line_search_policies.hpp b/include/boost/math/optimization/detail/line_search_policies.hpp index 1bc3c1cc4d..44c5ab9319 100644 --- a/include/boost/math/optimization/detail/line_search_policies.hpp +++ b/include/boost/math/optimization/detail/line_search_policies.hpp @@ -7,8 +7,10 @@ #define BOOST_MATH_OPTIMIZATION_DETAIL_LINE_SEARCH_POLICIES_HPP #include +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#endif namespace boost { namespace math { namespace optimization { diff --git a/include/boost/math/optimization/detail/rdiff_optimization_policies.hpp b/include/boost/math/optimization/detail/rdiff_optimization_policies.hpp index b4cad4b004..759c6173f3 100644 --- a/include/boost/math/optimization/detail/rdiff_optimization_policies.hpp +++ b/include/boost/math/optimization/detail/rdiff_optimization_policies.hpp @@ -6,8 +6,10 @@ #define BOOST_MATH_OPTIMIZATION_DETAIL_RDIFF_OPTIMIZATION_POLICIES_HPP #include +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#endif namespace boost { namespace math { diff --git a/include/boost/math/optimization/differential_evolution.hpp b/include/boost/math/optimization/differential_evolution.hpp index f734f92111..f9699032f7 100644 --- a/include/boost/math/optimization/differential_evolution.hpp +++ b/include/boost/math/optimization/differential_evolution.hpp @@ -6,8 +6,11 @@ */ #ifndef BOOST_MATH_OPTIMIZATION_DIFFERENTIAL_EVOLUTION_HPP #define BOOST_MATH_OPTIMIZATION_DIFFERENTIAL_EVOLUTION_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif #include +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include @@ -17,6 +20,7 @@ #include #include #include +#endif namespace boost::math::optimization { diff --git a/include/boost/math/optimization/jso.hpp b/include/boost/math/optimization/jso.hpp index 44359a00dc..09aff344c6 100644 --- a/include/boost/math/optimization/jso.hpp +++ b/include/boost/math/optimization/jso.hpp @@ -6,8 +6,11 @@ */ #ifndef BOOST_MATH_OPTIMIZATION_JSO_HPP #define BOOST_MATH_OPTIMIZATION_JSO_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif #include +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include @@ -18,6 +21,7 @@ #include #include #include +#endif namespace boost::math::optimization { diff --git a/include/boost/math/optimization/lbfgs.hpp b/include/boost/math/optimization/lbfgs.hpp index 5554b7721d..6fb778ccaf 100644 --- a/include/boost/math/optimization/lbfgs.hpp +++ b/include/boost/math/optimization/lbfgs.hpp @@ -7,10 +7,14 @@ #include #include #include +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif #include +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif namespace boost { namespace math { diff --git a/include/boost/math/optimization/minimizer.hpp b/include/boost/math/optimization/minimizer.hpp index 929c92b2f4..ca11016106 100644 --- a/include/boost/math/optimization/minimizer.hpp +++ b/include/boost/math/optimization/minimizer.hpp @@ -6,8 +6,10 @@ #define BOOST_MATH_OPTIMIZATION_MINIMIZER_HPP #include #include +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#endif namespace boost { namespace math { namespace optimization { diff --git a/include/boost/math/optimization/nesterov.hpp b/include/boost/math/optimization/nesterov.hpp index 1c882f4019..f6611d8aef 100644 --- a/include/boost/math/optimization/nesterov.hpp +++ b/include/boost/math/optimization/nesterov.hpp @@ -7,7 +7,9 @@ #include #include #include +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif namespace boost { namespace math { diff --git a/include/boost/math/optimization/random_search.hpp b/include/boost/math/optimization/random_search.hpp index 4ecd4ce367..2642adcd6c 100644 --- a/include/boost/math/optimization/random_search.hpp +++ b/include/boost/math/optimization/random_search.hpp @@ -6,6 +6,7 @@ */ #ifndef BOOST_MATH_OPTIMIZATION_RANDOM_SEARCH_HPP #define BOOST_MATH_OPTIMIZATION_RANDOM_SEARCH_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include @@ -16,6 +17,7 @@ #include #include #include +#endif #include namespace boost::math::optimization { diff --git a/include/boost/math/quadrature/detail/exp_sinh_detail.hpp b/include/boost/math/quadrature/detail/exp_sinh_detail.hpp index 77f2fbf060..cdce12c0c8 100644 --- a/include/boost/math/quadrature/detail/exp_sinh_detail.hpp +++ b/include/boost/math/quadrature/detail/exp_sinh_detail.hpp @@ -11,17 +11,21 @@ #ifndef BOOST_MATH_HAS_NVRTC +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include +#endif #include #include #include #include #ifdef BOOST_MATH_HAS_THREADS +#ifndef BOOST_MATH_BUILD_MODULE #include #endif +#endif namespace boost{ namespace math{ namespace quadrature { namespace detail{ diff --git a/include/boost/math/quadrature/detail/ooura_fourier_integrals_detail.hpp b/include/boost/math/quadrature/detail/ooura_fourier_integrals_detail.hpp index c677852da4..af21122e79 100644 --- a/include/boost/math/quadrature/detail/ooura_fourier_integrals_detail.hpp +++ b/include/boost/math/quadrature/detail/ooura_fourier_integrals_detail.hpp @@ -5,9 +5,11 @@ // or copy at http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_MATH_QUADRATURE_DETAIL_OOURA_FOURIER_INTEGRALS_DETAIL_HPP #define BOOST_MATH_QUADRATURE_DETAIL_OOURA_FOURIER_INTEGRALS_DETAIL_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include // for std::pair. #include #include +#endif #include #include #include @@ -15,9 +17,11 @@ #include #ifdef BOOST_MATH_HAS_THREADS +#ifndef BOOST_MATH_BUILD_MODULE #include #include #endif +#endif namespace boost { namespace math { namespace quadrature { namespace detail { diff --git a/include/boost/math/quadrature/detail/sinh_sinh_detail.hpp b/include/boost/math/quadrature/detail/sinh_sinh_detail.hpp index 7f7477a6e6..b5c257e5af 100644 --- a/include/boost/math/quadrature/detail/sinh_sinh_detail.hpp +++ b/include/boost/math/quadrature/detail/sinh_sinh_detail.hpp @@ -12,18 +12,22 @@ #ifndef BOOST_MATH_HAS_NVRTC +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include #include +#endif #include #include #include #include #ifdef BOOST_MATH_HAS_THREADS +#ifndef BOOST_MATH_BUILD_MODULE #include #endif +#endif namespace boost{ namespace math{ namespace quadrature { namespace detail{ diff --git a/include/boost/math/quadrature/detail/tanh_sinh_detail.hpp b/include/boost/math/quadrature/detail/tanh_sinh_detail.hpp index 47961423b4..e1e3ef625e 100644 --- a/include/boost/math/quadrature/detail/tanh_sinh_detail.hpp +++ b/include/boost/math/quadrature/detail/tanh_sinh_detail.hpp @@ -7,17 +7,21 @@ #ifndef BOOST_MATH_QUADRATURE_DETAIL_TANH_SINH_DETAIL_HPP #define BOOST_MATH_QUADRATURE_DETAIL_TANH_SINH_DETAIL_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include +#endif #include #include #include #include #ifdef BOOST_MATH_HAS_THREADS +#ifndef BOOST_MATH_BUILD_MODULE #include #endif +#endif namespace boost{ namespace math{ namespace quadrature { namespace detail{ diff --git a/include/boost/math/quadrature/exp_sinh.hpp b/include/boost/math/quadrature/exp_sinh.hpp index d3148e0c0a..c6eddedcbe 100644 --- a/include/boost/math/quadrature/exp_sinh.hpp +++ b/include/boost/math/quadrature/exp_sinh.hpp @@ -20,10 +20,12 @@ #ifndef BOOST_MATH_HAS_NVRTC +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include #include +#endif namespace boost{ namespace math{ namespace quadrature { diff --git a/include/boost/math/quadrature/gauss.hpp b/include/boost/math/quadrature/gauss.hpp index 91ffcf0bcd..758568c233 100644 --- a/include/boost/math/quadrature/gauss.hpp +++ b/include/boost/math/quadrature/gauss.hpp @@ -10,8 +10,10 @@ #pragma once #endif +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#endif #include #include diff --git a/include/boost/math/quadrature/gauss_kronrod.hpp b/include/boost/math/quadrature/gauss_kronrod.hpp index a81cb43c4f..ed9920a6c5 100644 --- a/include/boost/math/quadrature/gauss_kronrod.hpp +++ b/include/boost/math/quadrature/gauss_kronrod.hpp @@ -13,9 +13,11 @@ #pragma warning(disable: 4127) #endif +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include +#endif #include #include #include diff --git a/include/boost/math/quadrature/naive_monte_carlo.hpp b/include/boost/math/quadrature/naive_monte_carlo.hpp index 954612c268..f5b1ba4147 100644 --- a/include/boost/math/quadrature/naive_monte_carlo.hpp +++ b/include/boost/math/quadrature/naive_monte_carlo.hpp @@ -6,6 +6,7 @@ */ #ifndef BOOST_MATH_QUADRATURE_NAIVE_MONTE_CARLO_HPP #define BOOST_MATH_QUADRATURE_NAIVE_MONTE_CARLO_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include @@ -21,12 +22,15 @@ #include #include #include +#endif #include #include #ifdef BOOST_NAIVE_MONTE_CARLO_DEBUG_FAILURES +#ifndef BOOST_MATH_BUILD_MODULE # include #endif +#endif namespace boost { namespace math { namespace quadrature { diff --git a/include/boost/math/quadrature/ooura_fourier_integrals.hpp b/include/boost/math/quadrature/ooura_fourier_integrals.hpp index b31996c2bc..8d7c24287c 100644 --- a/include/boost/math/quadrature/ooura_fourier_integrals.hpp +++ b/include/boost/math/quadrature/ooura_fourier_integrals.hpp @@ -11,7 +11,9 @@ */ #ifndef BOOST_MATH_QUADRATURE_OOURA_FOURIER_INTEGRALS_HPP #define BOOST_MATH_QUADRATURE_OOURA_FOURIER_INTEGRALS_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif #include namespace boost { namespace math { namespace quadrature { diff --git a/include/boost/math/quadrature/sinh_sinh.hpp b/include/boost/math/quadrature/sinh_sinh.hpp index 7aabcb4376..5166d459b1 100644 --- a/include/boost/math/quadrature/sinh_sinh.hpp +++ b/include/boost/math/quadrature/sinh_sinh.hpp @@ -24,9 +24,11 @@ #ifndef BOOST_MATH_HAS_NVRTC +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include +#endif namespace boost{ namespace math{ namespace quadrature { diff --git a/include/boost/math/quadrature/tanh_sinh.hpp b/include/boost/math/quadrature/tanh_sinh.hpp index d5fbe82525..9bb21c0be3 100644 --- a/include/boost/math/quadrature/tanh_sinh.hpp +++ b/include/boost/math/quadrature/tanh_sinh.hpp @@ -29,9 +29,11 @@ #ifndef BOOST_MATH_QUADRATURE_TANH_SINH_HPP #define BOOST_MATH_QUADRATURE_TANH_SINH_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include +#endif #include namespace boost{ namespace math{ namespace quadrature { diff --git a/include/boost/math/quadrature/trapezoidal.hpp b/include/boost/math/quadrature/trapezoidal.hpp index 8190fb66ae..83f37125ed 100644 --- a/include/boost/math/quadrature/trapezoidal.hpp +++ b/include/boost/math/quadrature/trapezoidal.hpp @@ -15,10 +15,12 @@ #ifndef BOOST_MATH_QUADRATURE_TRAPEZOIDAL_HPP #define BOOST_MATH_QUADRATURE_TRAPEZOIDAL_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include #include +#endif #include #include #include diff --git a/include/boost/math/quaternion.hpp b/include/boost/math/quaternion.hpp index 831dd92bef..87fbfb0cc3 100644 --- a/include/boost/math/quaternion.hpp +++ b/include/boost/math/quaternion.hpp @@ -12,17 +12,23 @@ #include #include +#ifndef BOOST_MATH_BUILD_MODULE #include // for the "<<" operator +#endif +#ifndef BOOST_MATH_BUILD_MODULE #include #include // for the "<<" and ">>" operators #include // for the "<<" operator +#endif #include // for the Sinus cardinal #include // for the Hyperbolic Sinus cardinal #include +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif namespace boost { diff --git a/include/boost/math/special_functions/acosh.hpp b/include/boost/math/special_functions/acosh.hpp index 63e8e2dff0..18942c15f3 100644 --- a/include/boost/math/special_functions/acosh.hpp +++ b/include/boost/math/special_functions/acosh.hpp @@ -15,7 +15,9 @@ #pragma once #endif +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif #include #include #include diff --git a/include/boost/math/special_functions/asinh.hpp b/include/boost/math/special_functions/asinh.hpp index 52362dd294..e92ba52dac 100644 --- a/include/boost/math/special_functions/asinh.hpp +++ b/include/boost/math/special_functions/asinh.hpp @@ -16,7 +16,9 @@ #endif +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif #include #include #include diff --git a/include/boost/math/special_functions/cardinal_b_spline.hpp b/include/boost/math/special_functions/cardinal_b_spline.hpp index dfb4cf835d..c4c51a0c97 100644 --- a/include/boost/math/special_functions/cardinal_b_spline.hpp +++ b/include/boost/math/special_functions/cardinal_b_spline.hpp @@ -6,10 +6,12 @@ #ifndef BOOST_MATH_SPECIAL_CARDINAL_B_SPLINE_HPP #define BOOST_MATH_SPECIAL_CARDINAL_B_SPLINE_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include #include +#endif namespace boost { namespace math { diff --git a/include/boost/math/special_functions/chebyshev.hpp b/include/boost/math/special_functions/chebyshev.hpp index df8570821f..ed78d54663 100644 --- a/include/boost/math/special_functions/chebyshev.hpp +++ b/include/boost/math/special_functions/chebyshev.hpp @@ -5,8 +5,10 @@ #ifndef BOOST_MATH_SPECIAL_CHEBYSHEV_HPP #define BOOST_MATH_SPECIAL_CHEBYSHEV_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#endif #include #include #include diff --git a/include/boost/math/special_functions/chebyshev_transform.hpp b/include/boost/math/special_functions/chebyshev_transform.hpp index 20390be6e0..111c14de6d 100644 --- a/include/boost/math/special_functions/chebyshev_transform.hpp +++ b/include/boost/math/special_functions/chebyshev_transform.hpp @@ -5,8 +5,10 @@ #ifndef BOOST_MATH_SPECIAL_CHEBYSHEV_TRANSFORM_HPP #define BOOST_MATH_SPECIAL_CHEBYSHEV_TRANSFORM_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#endif #include #include diff --git a/include/boost/math/special_functions/cos_pi.hpp b/include/boost/math/special_functions/cos_pi.hpp index 7c33614de7..21413e3af2 100644 --- a/include/boost/math/special_functions/cos_pi.hpp +++ b/include/boost/math/special_functions/cos_pi.hpp @@ -15,8 +15,10 @@ #ifndef BOOST_MATH_HAS_NVRTC +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#endif #include #include #include diff --git a/include/boost/math/special_functions/daubechies_scaling.hpp b/include/boost/math/special_functions/daubechies_scaling.hpp index fe9d7b16d1..d67f08f424 100644 --- a/include/boost/math/special_functions/daubechies_scaling.hpp +++ b/include/boost/math/special_functions/daubechies_scaling.hpp @@ -8,6 +8,7 @@ #ifndef BOOST_MATH_SPECIAL_DAUBECHIES_SCALING_HPP #define BOOST_MATH_SPECIAL_DAUBECHIES_SCALING_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include @@ -17,6 +18,7 @@ #include #include #include +#endif #include #include #include diff --git a/include/boost/math/special_functions/daubechies_wavelet.hpp b/include/boost/math/special_functions/daubechies_wavelet.hpp index d374c84870..d11812686c 100644 --- a/include/boost/math/special_functions/daubechies_wavelet.hpp +++ b/include/boost/math/special_functions/daubechies_wavelet.hpp @@ -7,12 +7,14 @@ #ifndef BOOST_MATH_SPECIAL_DAUBECHIES_WAVELET_HPP #define BOOST_MATH_SPECIAL_DAUBECHIES_WAVELET_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include #include #include #include +#endif #include #include #include diff --git a/include/boost/math/special_functions/detail/bernoulli_details.hpp b/include/boost/math/special_functions/detail/bernoulli_details.hpp index 3dbc9b575d..8fd2c43ec1 100644 --- a/include/boost/math/special_functions/detail/bernoulli_details.hpp +++ b/include/boost/math/special_functions/detail/bernoulli_details.hpp @@ -13,11 +13,15 @@ #include #include #include +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#endif #if defined(BOOST_MATH_HAS_THREADS) && !defined(BOOST_NO_CXX11_HDR_MUTEX) && !defined(BOOST_MATH_NO_ATOMIC_INT) +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif #else # define BOOST_MATH_BERNOULLI_NOTHREADS #endif diff --git a/include/boost/math/special_functions/detail/bessel_derivatives_linear.hpp b/include/boost/math/special_functions/detail/bessel_derivatives_linear.hpp index ca62f38a5b..36b0bc3cd7 100644 --- a/include/boost/math/special_functions/detail/bessel_derivatives_linear.hpp +++ b/include/boost/math/special_functions/detail/bessel_derivatives_linear.hpp @@ -9,7 +9,9 @@ // Linear combination for bessel derivatives are defined here #ifndef BOOST_MATH_SF_DETAIL_BESSEL_DERIVATIVES_LINEAR_HPP #define BOOST_MATH_SF_DETAIL_BESSEL_DERIVATIVES_LINEAR_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif #ifdef _MSC_VER #pragma once #endif diff --git a/include/boost/math/special_functions/detail/bessel_jy_derivatives_series.hpp b/include/boost/math/special_functions/detail/bessel_jy_derivatives_series.hpp index d7bb64f8cd..c69a75495f 100644 --- a/include/boost/math/special_functions/detail/bessel_jy_derivatives_series.hpp +++ b/include/boost/math/special_functions/detail/bessel_jy_derivatives_series.hpp @@ -10,8 +10,10 @@ #pragma once #endif +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#endif namespace boost{ namespace math{ namespace detail{ diff --git a/include/boost/math/special_functions/detail/daubechies_scaling_integer_grid.hpp b/include/boost/math/special_functions/detail/daubechies_scaling_integer_grid.hpp index f680c2b0f6..264398f42c 100644 --- a/include/boost/math/special_functions/detail/daubechies_scaling_integer_grid.hpp +++ b/include/boost/math/special_functions/detail/daubechies_scaling_integer_grid.hpp @@ -8,8 +8,10 @@ // THIS FILE GENERATED BY EXAMPLE/DAUBECHIES_SCALING_INTEGER_GRID.CPP, DO NOT EDIT. #ifndef BOOST_MATH_DAUBECHIES_SCALING_INTEGER_GRID_HPP #define BOOST_MATH_DAUBECHIES_SCALING_INTEGER_GRID_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#endif #include /* In order to keep the character count as small as possible and speed up diff --git a/include/boost/math/special_functions/detail/erf_inv.hpp b/include/boost/math/special_functions/detail/erf_inv.hpp index cb65cffbc1..436048daa3 100644 --- a/include/boost/math/special_functions/detail/erf_inv.hpp +++ b/include/boost/math/special_functions/detail/erf_inv.hpp @@ -18,7 +18,9 @@ #ifndef BOOST_MATH_HAS_NVRTC +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif namespace boost{ namespace math{ diff --git a/include/boost/math/special_functions/detail/fp_traits.hpp b/include/boost/math/special_functions/detail/fp_traits.hpp index 7362d0fada..2f5882306c 100644 --- a/include/boost/math/special_functions/detail/fp_traits.hpp +++ b/include/boost/math/special_functions/detail/fp_traits.hpp @@ -21,11 +21,13 @@ With these techniques, the code could be simplified. # define BOOST_FPCLASSIFY_VAX_FORMAT #endif +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include #include #include +#endif #include #include #include diff --git a/include/boost/math/special_functions/detail/hypergeometric_1F1_scaled_series.hpp b/include/boost/math/special_functions/detail/hypergeometric_1F1_scaled_series.hpp index e128e3d7ad..ae26205b37 100644 --- a/include/boost/math/special_functions/detail/hypergeometric_1F1_scaled_series.hpp +++ b/include/boost/math/special_functions/detail/hypergeometric_1F1_scaled_series.hpp @@ -7,8 +7,10 @@ #ifndef BOOST_MATH_HYPERGEOMETRIC_1F1_SCALED_SERIES_HPP #define BOOST_MATH_HYPERGEOMETRIC_1F1_SCALED_SERIES_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#endif namespace boost{ namespace math{ namespace detail{ diff --git a/include/boost/math/special_functions/detail/hypergeometric_1F1_small_a_negative_b_by_ratio.hpp b/include/boost/math/special_functions/detail/hypergeometric_1F1_small_a_negative_b_by_ratio.hpp index 4414a75d86..61de314a8c 100644 --- a/include/boost/math/special_functions/detail/hypergeometric_1F1_small_a_negative_b_by_ratio.hpp +++ b/include/boost/math/special_functions/detail/hypergeometric_1F1_small_a_negative_b_by_ratio.hpp @@ -8,7 +8,9 @@ #ifndef BOOST_MATH_HYPERGEOMETRIC_1F1_SMALL_A_NEG_B_HPP #define BOOST_MATH_HYPERGEOMETRIC_1F1_SMALL_A_NEG_B_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif #include namespace boost { namespace math { namespace detail { diff --git a/include/boost/math/special_functions/detail/hypergeometric_pFq_checked_series.hpp b/include/boost/math/special_functions/detail/hypergeometric_pFq_checked_series.hpp index 895c586482..1d9ac6029d 100644 --- a/include/boost/math/special_functions/detail/hypergeometric_pFq_checked_series.hpp +++ b/include/boost/math/special_functions/detail/hypergeometric_pFq_checked_series.hpp @@ -11,8 +11,10 @@ # define BOOST_MATH_PFQ_MAX_B_TERMS 5 #endif +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#endif #include #include #include diff --git a/include/boost/math/special_functions/detail/hypergeometric_rational.hpp b/include/boost/math/special_functions/detail/hypergeometric_rational.hpp index b958e3af66..4103381776 100644 --- a/include/boost/math/special_functions/detail/hypergeometric_rational.hpp +++ b/include/boost/math/special_functions/detail/hypergeometric_rational.hpp @@ -10,7 +10,9 @@ #ifndef BOOST_MATH_HYPERGEOMETRIC_RATIONAL_HPP #define BOOST_MATH_HYPERGEOMETRIC_RATIONAL_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif namespace boost{ namespace math{ namespace detail{ diff --git a/include/boost/math/special_functions/detail/hypergeometric_series.hpp b/include/boost/math/special_functions/detail/hypergeometric_series.hpp index 2a2a54af9b..f63294f21b 100644 --- a/include/boost/math/special_functions/detail/hypergeometric_series.hpp +++ b/include/boost/math/special_functions/detail/hypergeometric_series.hpp @@ -10,8 +10,10 @@ #ifndef BOOST_MATH_DETAIL_HYPERGEOMETRIC_SERIES_HPP #define BOOST_MATH_DETAIL_HYPERGEOMETRIC_SERIES_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#endif #include #include #include diff --git a/include/boost/math/special_functions/detail/polygamma.hpp b/include/boost/math/special_functions/detail/polygamma.hpp index a608f22c7f..87d8cc0412 100644 --- a/include/boost/math/special_functions/detail/polygamma.hpp +++ b/include/boost/math/special_functions/detail/polygamma.hpp @@ -11,9 +11,11 @@ #ifndef _BOOST_POLYGAMMA_DETAIL_2013_07_30_HPP_ #define _BOOST_POLYGAMMA_DETAIL_2013_07_30_HPP_ +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include +#endif #include #include #include @@ -26,8 +28,10 @@ #include #ifdef BOOST_MATH_HAS_THREADS +#ifndef BOOST_MATH_BUILD_MODULE #include #endif +#endif #ifdef _MSC_VER #pragma once diff --git a/include/boost/math/special_functions/detail/unchecked_bernoulli.hpp b/include/boost/math/special_functions/detail/unchecked_bernoulli.hpp index 676332983a..c0fb3d9fde 100644 --- a/include/boost/math/special_functions/detail/unchecked_bernoulli.hpp +++ b/include/boost/math/special_functions/detail/unchecked_bernoulli.hpp @@ -11,11 +11,13 @@ #ifndef BOOST_MATH_UNCHECKED_BERNOULLI_HPP #define BOOST_MATH_UNCHECKED_BERNOULLI_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include #include #include +#endif #include #include #include diff --git a/include/boost/math/special_functions/expm1.hpp b/include/boost/math/special_functions/expm1.hpp index 7635c6471e..e647c58929 100644 --- a/include/boost/math/special_functions/expm1.hpp +++ b/include/boost/math/special_functions/expm1.hpp @@ -18,7 +18,9 @@ #if defined __has_include # if ((__cplusplus > 202002L) || (defined(_MSVC_LANG) && (_MSVC_LANG > 202002L))) # if __has_include () +#ifndef BOOST_MATH_BUILD_MODULE # include +#endif # endif # endif #endif diff --git a/include/boost/math/special_functions/fibonacci.hpp b/include/boost/math/special_functions/fibonacci.hpp index e62fa89281..b1cf435c9a 100644 --- a/include/boost/math/special_functions/fibonacci.hpp +++ b/include/boost/math/special_functions/fibonacci.hpp @@ -10,8 +10,10 @@ #include #include +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#endif #ifdef _MSC_VER #pragma once diff --git a/include/boost/math/special_functions/fourier_transform_daubechies.hpp b/include/boost/math/special_functions/fourier_transform_daubechies.hpp index 982e740233..7be4c71ff0 100644 --- a/include/boost/math/special_functions/fourier_transform_daubechies.hpp +++ b/include/boost/math/special_functions/fourier_transform_daubechies.hpp @@ -8,11 +8,13 @@ #ifndef BOOST_MATH_SPECIAL_FOURIER_TRANSFORM_DAUBECHIES_HPP #define BOOST_MATH_SPECIAL_FOURIER_TRANSFORM_DAUBECHIES_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include #include #include +#endif #include #include #include diff --git a/include/boost/math/special_functions/fpclassify.hpp b/include/boost/math/special_functions/fpclassify.hpp index c17b4a3a0b..6f76920405 100644 --- a/include/boost/math/special_functions/fpclassify.hpp +++ b/include/boost/math/special_functions/fpclassify.hpp @@ -19,9 +19,11 @@ #include #include #include +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include +#endif /*! \file fpclassify.hpp @@ -157,8 +159,10 @@ template<> BOOST_MATH_GPU_ENABLED inline int (fpclassify)(double t) #else #if defined(_MSC_VER) || defined(BOOST_BORLANDC) +#ifndef BOOST_MATH_BUILD_MODULE #include #endif +#endif #ifdef BOOST_MATH_USE_FLOAT128 #ifdef __has_include #if __has_include("quadmath.h") diff --git a/include/boost/math/special_functions/gegenbauer.hpp b/include/boost/math/special_functions/gegenbauer.hpp index 70324cf656..6dc032a578 100644 --- a/include/boost/math/special_functions/gegenbauer.hpp +++ b/include/boost/math/special_functions/gegenbauer.hpp @@ -12,8 +12,10 @@ #include #ifndef BOOST_MATH_NO_EXCEPTIONS +#ifndef BOOST_MATH_BUILD_MODULE #include #endif +#endif namespace boost { namespace math { diff --git a/include/boost/math/special_functions/hypergeometric_pFq.hpp b/include/boost/math/special_functions/hypergeometric_pFq.hpp index 96f68e510e..3b4c609555 100644 --- a/include/boost/math/special_functions/hypergeometric_pFq.hpp +++ b/include/boost/math/special_functions/hypergeometric_pFq.hpp @@ -10,8 +10,10 @@ #include #include +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#endif namespace boost { namespace math { diff --git a/include/boost/math/special_functions/jacobi.hpp b/include/boost/math/special_functions/jacobi.hpp index e4703be307..fb450faf39 100644 --- a/include/boost/math/special_functions/jacobi.hpp +++ b/include/boost/math/special_functions/jacobi.hpp @@ -6,8 +6,10 @@ #ifndef BOOST_MATH_SPECIAL_JACOBI_HPP #define BOOST_MATH_SPECIAL_JACOBI_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#endif namespace boost { namespace math { diff --git a/include/boost/math/special_functions/lambert_w.hpp b/include/boost/math/special_functions/lambert_w.hpp index 671432c679..0f41fcbc08 100644 --- a/include/boost/math/special_functions/lambert_w.hpp +++ b/include/boost/math/special_functions/lambert_w.hpp @@ -68,10 +68,12 @@ BOOST_MATH_INSTRUMENT_LAMBERT_W_SMALL_Z_SERIES_ITERATIONS // Show evaluation of #include #endif +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include #include +#endif // Needed for testing and diagnostics only. //#include diff --git a/include/boost/math/special_functions/lanczos.hpp b/include/boost/math/special_functions/lanczos.hpp index 409e14c5e1..7bb29cbdc5 100644 --- a/include/boost/math/special_functions/lanczos.hpp +++ b/include/boost/math/special_functions/lanczos.hpp @@ -19,8 +19,10 @@ #ifndef BOOST_MATH_HAS_NVRTC #include +#ifndef BOOST_MATH_BUILD_MODULE #include #endif +#endif #if defined(__GNUC__) && defined(BOOST_MATH_USE_FLOAT128) // diff --git a/include/boost/math/special_functions/legendre.hpp b/include/boost/math/special_functions/legendre.hpp index 992953e231..68c129e487 100644 --- a/include/boost/math/special_functions/legendre.hpp +++ b/include/boost/math/special_functions/legendre.hpp @@ -10,9 +10,11 @@ #pragma once #endif +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include +#endif #include #include #include diff --git a/include/boost/math/special_functions/legendre_stieltjes.hpp b/include/boost/math/special_functions/legendre_stieltjes.hpp index 44eafea2d5..5809446e39 100644 --- a/include/boost/math/special_functions/legendre_stieltjes.hpp +++ b/include/boost/math/special_functions/legendre_stieltjes.hpp @@ -16,8 +16,10 @@ * Patterson, TNL. "The optimum addition of points to quadrature formulae." Mathematics of Computation 22.104 (1968): 847-856. */ +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#endif #include #include diff --git a/include/boost/math/special_functions/log1p.hpp b/include/boost/math/special_functions/log1p.hpp index 3851fb3a4b..f140799532 100644 --- a/include/boost/math/special_functions/log1p.hpp +++ b/include/boost/math/special_functions/log1p.hpp @@ -15,7 +15,9 @@ #if defined __has_include # if ((__cplusplus > 202002L) || (defined(_MSVC_LANG) && (_MSVC_LANG > 202002L))) # if __has_include () +#ifndef BOOST_MATH_BUILD_MODULE # include +#endif # endif # endif #endif diff --git a/include/boost/math/special_functions/logaddexp.hpp b/include/boost/math/special_functions/logaddexp.hpp index 8949496f6e..1e4c4b89c4 100644 --- a/include/boost/math/special_functions/logaddexp.hpp +++ b/include/boost/math/special_functions/logaddexp.hpp @@ -3,8 +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) +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#endif #include #include diff --git a/include/boost/math/special_functions/logistic_sigmoid.hpp b/include/boost/math/special_functions/logistic_sigmoid.hpp index 7279b17e6c..b2b7c94b49 100644 --- a/include/boost/math/special_functions/logistic_sigmoid.hpp +++ b/include/boost/math/special_functions/logistic_sigmoid.hpp @@ -9,7 +9,9 @@ #include #include +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif namespace boost { namespace math { diff --git a/include/boost/math/special_functions/logit.hpp b/include/boost/math/special_functions/logit.hpp index e9da275e70..fda684fd24 100644 --- a/include/boost/math/special_functions/logit.hpp +++ b/include/boost/math/special_functions/logit.hpp @@ -10,8 +10,10 @@ #include #include #include +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#endif namespace boost { namespace math { diff --git a/include/boost/math/special_functions/logsumexp.hpp b/include/boost/math/special_functions/logsumexp.hpp index 8aa1d4bffd..425bd90b72 100644 --- a/include/boost/math/special_functions/logsumexp.hpp +++ b/include/boost/math/special_functions/logsumexp.hpp @@ -3,12 +3,14 @@ // 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_BUILD_MODULE #include #include #include #include #include #include +#endif #include namespace boost { namespace math { diff --git a/include/boost/math/special_functions/math_fwd.hpp b/include/boost/math/special_functions/math_fwd.hpp index 6c8394ddf9..32fb9b7a61 100644 --- a/include/boost/math/special_functions/math_fwd.hpp +++ b/include/boost/math/special_functions/math_fwd.hpp @@ -104,9 +104,11 @@ namespace detail{ #else +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include +#endif #include #include #include diff --git a/include/boost/math/special_functions/next.hpp b/include/boost/math/special_functions/next.hpp index f73cb2f6a5..ce3210ec2e 100644 --- a/include/boost/math/special_functions/next.hpp +++ b/include/boost/math/special_functions/next.hpp @@ -21,8 +21,10 @@ #include #include #include +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#endif #if !defined(_CRAYC) && !defined(BOOST_MATH_ENABLE_CUDA) && (!defined(__GNUC__) || (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ > 3))) diff --git a/include/boost/math/special_functions/nonfinite_num_facets.hpp b/include/boost/math/special_functions/nonfinite_num_facets.hpp index 5e08c10d3f..5ac935d6a1 100644 --- a/include/boost/math/special_functions/nonfinite_num_facets.hpp +++ b/include/boost/math/special_functions/nonfinite_num_facets.hpp @@ -18,10 +18,12 @@ for Floating-Point Infinities and NaNs. */ +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include #include +#endif #include #include #include diff --git a/include/boost/math/special_functions/owens_t.hpp b/include/boost/math/special_functions/owens_t.hpp index 4fa5c6aa7e..45f96ef127 100644 --- a/include/boost/math/special_functions/owens_t.hpp +++ b/include/boost/math/special_functions/owens_t.hpp @@ -24,8 +24,10 @@ #include #include +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#endif #ifdef _MSC_VER #pragma warning(push) diff --git a/include/boost/math/special_functions/prime.hpp b/include/boost/math/special_functions/prime.hpp index 35d9c1a470..acc219c9fe 100644 --- a/include/boost/math/special_functions/prime.hpp +++ b/include/boost/math/special_functions/prime.hpp @@ -10,8 +10,10 @@ #include #include +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#endif namespace boost{ namespace math{ diff --git a/include/boost/math/special_functions/round.hpp b/include/boost/math/special_functions/round.hpp index bb99da7e31..7569950e86 100644 --- a/include/boost/math/special_functions/round.hpp +++ b/include/boost/math/special_functions/round.hpp @@ -19,9 +19,11 @@ #include #include #include +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include +#endif #if !defined(BOOST_MATH_NO_CCMATH) && !defined(BOOST_MATH_NO_CONSTEXPR_DETECTION) #include diff --git a/include/boost/math/special_functions/rsqrt.hpp b/include/boost/math/special_functions/rsqrt.hpp index b42fa12bc8..f903b056d7 100644 --- a/include/boost/math/special_functions/rsqrt.hpp +++ b/include/boost/math/special_functions/rsqrt.hpp @@ -5,9 +5,11 @@ #ifndef BOOST_MATH_SPECIAL_FUNCTIONS_RSQRT_HPP #define BOOST_MATH_SPECIAL_FUNCTIONS_RSQRT_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include +#endif #include #ifndef BOOST_MATH_STANDALONE diff --git a/include/boost/math/special_functions/sin_pi.hpp b/include/boost/math/special_functions/sin_pi.hpp index 05a155434a..c388396681 100644 --- a/include/boost/math/special_functions/sin_pi.hpp +++ b/include/boost/math/special_functions/sin_pi.hpp @@ -15,9 +15,11 @@ #ifndef BOOST_MATH_HAS_NVRTC +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include +#endif #include #include #include diff --git a/include/boost/math/special_functions/sinhc.hpp b/include/boost/math/special_functions/sinhc.hpp index b8c5f9f2e4..1e2aa1503f 100644 --- a/include/boost/math/special_functions/sinhc.hpp +++ b/include/boost/math/special_functions/sinhc.hpp @@ -19,10 +19,12 @@ #include #include #include +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include #include +#endif // These are the the "Hyperbolic Sinus Cardinal" functions. diff --git a/include/boost/math/special_functions/spherical_harmonic.hpp b/include/boost/math/special_functions/spherical_harmonic.hpp index 5da9265757..5f025f5931 100644 --- a/include/boost/math/special_functions/spherical_harmonic.hpp +++ b/include/boost/math/special_functions/spherical_harmonic.hpp @@ -14,7 +14,9 @@ #include #include #include +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif namespace boost{ namespace math{ diff --git a/include/boost/math/special_functions/trunc.hpp b/include/boost/math/special_functions/trunc.hpp index b52f4f321c..c78adc0f65 100644 --- a/include/boost/math/special_functions/trunc.hpp +++ b/include/boost/math/special_functions/trunc.hpp @@ -17,7 +17,9 @@ #ifndef BOOST_MATH_HAS_NVRTC +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif #include #include #include diff --git a/include/boost/math/statistics/anderson_darling.hpp b/include/boost/math/statistics/anderson_darling.hpp index f892f27e0f..9c97418559 100644 --- a/include/boost/math/statistics/anderson_darling.hpp +++ b/include/boost/math/statistics/anderson_darling.hpp @@ -8,8 +8,10 @@ #ifndef BOOST_MATH_STATISTICS_ANDERSON_DARLING_HPP #define BOOST_MATH_STATISTICS_ANDERSON_DARLING_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#endif #include #include diff --git a/include/boost/math/statistics/bivariate_statistics.hpp b/include/boost/math/statistics/bivariate_statistics.hpp index d6f91faa93..f8b4a96bfc 100644 --- a/include/boost/math/statistics/bivariate_statistics.hpp +++ b/include/boost/math/statistics/bivariate_statistics.hpp @@ -7,6 +7,7 @@ #ifndef BOOST_MATH_STATISTICS_BIVARIATE_STATISTICS_HPP #define BOOST_MATH_STATISTICS_BIVARIATE_STATISTICS_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include @@ -15,14 +16,17 @@ #include #include #include +#endif #include #include #ifdef BOOST_MATH_EXEC_COMPATIBLE +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include #endif +#endif namespace boost{ namespace math{ namespace statistics { namespace detail { diff --git a/include/boost/math/statistics/chatterjee_correlation.hpp b/include/boost/math/statistics/chatterjee_correlation.hpp index 5f4b3bcf59..250872b069 100644 --- a/include/boost/math/statistics/chatterjee_correlation.hpp +++ b/include/boost/math/statistics/chatterjee_correlation.hpp @@ -7,6 +7,7 @@ #ifndef BOOST_MATH_STATISTICS_CHATTERJEE_CORRELATION_HPP #define BOOST_MATH_STATISTICS_CHATTERJEE_CORRELATION_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include @@ -15,15 +16,18 @@ #include #include #include +#endif #include #include #include #ifdef BOOST_MATH_EXEC_COMPATIBLE +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include #endif +#endif namespace boost { namespace math { namespace statistics { diff --git a/include/boost/math/statistics/detail/rank.hpp b/include/boost/math/statistics/detail/rank.hpp index 4e5211607e..7dd77930d0 100644 --- a/include/boost/math/statistics/detail/rank.hpp +++ b/include/boost/math/statistics/detail/rank.hpp @@ -6,17 +6,21 @@ #ifndef BOOST_MATH_STATISTICS_DETAIL_RANK_HPP #define BOOST_MATH_STATISTICS_DETAIL_RANK_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include #include #include #include +#endif #include #ifdef BOOST_MATH_EXEC_COMPATIBLE +#ifndef BOOST_MATH_BUILD_MODULE #include #endif +#endif namespace boost { namespace math { namespace statistics { namespace detail { diff --git a/include/boost/math/statistics/detail/single_pass.hpp b/include/boost/math/statistics/detail/single_pass.hpp index 015021f2b3..c146541a64 100644 --- a/include/boost/math/statistics/detail/single_pass.hpp +++ b/include/boost/math/statistics/detail/single_pass.hpp @@ -9,6 +9,7 @@ #include #include +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include @@ -18,11 +19,14 @@ #include #include #include +#endif #ifdef BOOST_MATH_HAS_THREADS +#ifndef BOOST_MATH_BUILD_MODULE #include #include #endif +#endif namespace boost { namespace math { namespace statistics { namespace detail { diff --git a/include/boost/math/statistics/linear_regression.hpp b/include/boost/math/statistics/linear_regression.hpp index 2def7ab7ea..fa1b33e881 100644 --- a/include/boost/math/statistics/linear_regression.hpp +++ b/include/boost/math/statistics/linear_regression.hpp @@ -9,12 +9,14 @@ #ifndef BOOST_MATH_STATISTICS_LINEAR_REGRESSION_HPP #define BOOST_MATH_STATISTICS_LINEAR_REGRESSION_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include #include #include #include +#endif #include #include diff --git a/include/boost/math/statistics/ljung_box.hpp b/include/boost/math/statistics/ljung_box.hpp index 6417665ce4..e7a97a5f7f 100644 --- a/include/boost/math/statistics/ljung_box.hpp +++ b/include/boost/math/statistics/ljung_box.hpp @@ -6,9 +6,11 @@ #ifndef BOOST_MATH_STATISTICS_LJUNG_BOX_HPP #define BOOST_MATH_STATISTICS_LJUNG_BOX_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include +#endif #include #include diff --git a/include/boost/math/statistics/runs_test.hpp b/include/boost/math/statistics/runs_test.hpp index dc1a6ecf68..8ad0191c5b 100644 --- a/include/boost/math/statistics/runs_test.hpp +++ b/include/boost/math/statistics/runs_test.hpp @@ -8,9 +8,11 @@ #ifndef BOOST_MATH_STATISTICS_RUNS_TEST_HPP #define BOOST_MATH_STATISTICS_RUNS_TEST_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include +#endif #include #include diff --git a/include/boost/math/statistics/signal_statistics.hpp b/include/boost/math/statistics/signal_statistics.hpp index d2ded721ce..2efed78d23 100644 --- a/include/boost/math/statistics/signal_statistics.hpp +++ b/include/boost/math/statistics/signal_statistics.hpp @@ -6,8 +6,10 @@ #ifndef BOOST_MATH_TOOLS_SIGNAL_STATISTICS_HPP #define BOOST_MATH_TOOLS_SIGNAL_STATISTICS_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#endif #include #include #include diff --git a/include/boost/math/statistics/t_test.hpp b/include/boost/math/statistics/t_test.hpp index ec06bda8c3..36e3f394ab 100644 --- a/include/boost/math/statistics/t_test.hpp +++ b/include/boost/math/statistics/t_test.hpp @@ -7,6 +7,7 @@ #ifndef BOOST_MATH_STATISTICS_T_TEST_HPP #define BOOST_MATH_STATISTICS_T_TEST_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include @@ -14,6 +15,7 @@ #include #include #include +#endif #include #include diff --git a/include/boost/math/statistics/univariate_statistics.hpp b/include/boost/math/statistics/univariate_statistics.hpp index 20acd63572..7839afb872 100644 --- a/include/boost/math/statistics/univariate_statistics.hpp +++ b/include/boost/math/statistics/univariate_statistics.hpp @@ -10,6 +10,7 @@ #include #include #include +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include @@ -19,9 +20,12 @@ #include #include #include +#endif #ifdef BOOST_MATH_EXEC_COMPATIBLE +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif namespace boost::math::statistics { diff --git a/include/boost/math/statistics/z_test.hpp b/include/boost/math/statistics/z_test.hpp index a8ef838e40..3166e1aff6 100644 --- a/include/boost/math/statistics/z_test.hpp +++ b/include/boost/math/statistics/z_test.hpp @@ -8,10 +8,12 @@ #include #include +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include #include +#endif namespace boost { namespace math { namespace statistics { namespace detail { diff --git a/include/boost/math/tools/agm.hpp b/include/boost/math/tools/agm.hpp index 2b5a06be5d..7ac1a622da 100644 --- a/include/boost/math/tools/agm.hpp +++ b/include/boost/math/tools/agm.hpp @@ -5,8 +5,10 @@ #ifndef BOOST_MATH_TOOLS_AGM_HPP #define BOOST_MATH_TOOLS_AGM_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#endif namespace boost { namespace math { namespace tools { diff --git a/include/boost/math/tools/array.hpp b/include/boost/math/tools/array.hpp index 23e666673c..8de8b09c2a 100644 --- a/include/boost/math/tools/array.hpp +++ b/include/boost/math/tools/array.hpp @@ -26,7 +26,9 @@ using cuda::std::array; #else +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif namespace boost { namespace math { diff --git a/include/boost/math/tools/atomic.hpp b/include/boost/math/tools/atomic.hpp index f558bd63ae..bf8ef0595a 100644 --- a/include/boost/math/tools/atomic.hpp +++ b/include/boost/math/tools/atomic.hpp @@ -11,7 +11,9 @@ #include #ifdef BOOST_MATH_HAS_THREADS +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif namespace boost { namespace math { diff --git a/include/boost/math/tools/big_constant.hpp b/include/boost/math/tools/big_constant.hpp index 8e731c090e..ef8bc32c37 100644 --- a/include/boost/math/tools/big_constant.hpp +++ b/include/boost/math/tools/big_constant.hpp @@ -18,9 +18,11 @@ #include #endif +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include +#endif namespace boost{ namespace math{ diff --git a/include/boost/math/tools/bivariate_statistics.hpp b/include/boost/math/tools/bivariate_statistics.hpp index eaed5838ea..dbb89576f6 100644 --- a/include/boost/math/tools/bivariate_statistics.hpp +++ b/include/boost/math/tools/bivariate_statistics.hpp @@ -6,9 +6,11 @@ #ifndef BOOST_MATH_TOOLS_BIVARIATE_STATISTICS_HPP #define BOOST_MATH_TOOLS_BIVARIATE_STATISTICS_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include +#endif #include #include diff --git a/include/boost/math/tools/centered_continued_fraction.hpp b/include/boost/math/tools/centered_continued_fraction.hpp index 87e76b51b3..5de98b24d6 100644 --- a/include/boost/math/tools/centered_continued_fraction.hpp +++ b/include/boost/math/tools/centered_continued_fraction.hpp @@ -6,6 +6,7 @@ #ifndef BOOST_MATH_TOOLS_CENTERED_CONTINUED_FRACTION_HPP #define BOOST_MATH_TOOLS_CENTERED_CONTINUED_FRACTION_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include @@ -16,6 +17,7 @@ #include #include #include +#endif #include #ifndef BOOST_MATH_STANDALONE diff --git a/include/boost/math/tools/cohen_acceleration.hpp b/include/boost/math/tools/cohen_acceleration.hpp index 2e76a75f8b..5fd360ab9e 100644 --- a/include/boost/math/tools/cohen_acceleration.hpp +++ b/include/boost/math/tools/cohen_acceleration.hpp @@ -5,9 +5,11 @@ #ifndef BOOST_MATH_TOOLS_COHEN_ACCELERATION_HPP #define BOOST_MATH_TOOLS_COHEN_ACCELERATION_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include +#endif namespace boost::math::tools { diff --git a/include/boost/math/tools/color_maps.hpp b/include/boost/math/tools/color_maps.hpp index e3cc8b9b09..f120e42b69 100644 --- a/include/boost/math/tools/color_maps.hpp +++ b/include/boost/math/tools/color_maps.hpp @@ -6,18 +6,22 @@ #ifndef BOOST_MATH_COLOR_MAPS_HPP #define BOOST_MATH_COLOR_MAPS_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include // for std::clamp #include // for table data #include // for std::floor #include // fixed width integer types +#endif #include #if __has_include("lodepng.h") #include "lodepng.h" +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include +#endif namespace boost::math::tools { @@ -44,7 +48,7 @@ namespace detail { // Data taken from: https://www.kennethmoreland.com/color-advice template -static constexpr std::array, 256> extended_kindlmann_data_ = {{ +BOOST_MATH_INLINE_CONSTEXPR std::array, 256> extended_kindlmann_data_ = {{ {0.0, 0.0, 0.0}, {0.01780246283347332, 0.0008750907117329381, 0.01626889466306607}, {0.03532931821571093, 0.001701802855992888, 0.03371323527689844}, @@ -304,7 +308,7 @@ static constexpr std::array, 256> extended_kindlmann_data_ = }}; template -static constexpr std::array, 256> kindlmann_data_ = {{ +BOOST_MATH_INLINE_CONSTEXPR std::array, 256> kindlmann_data_ = {{ {0.0, 0.0, 0.0}, {0.017846074066284252, 0.0009158559874893362, 0.016056295374498146}, {0.03572864786642702, 0.0017291229250328806, 0.03302143519907636}, @@ -564,7 +568,7 @@ static constexpr std::array, 256> kindlmann_data_ = {{ }}; template -static constexpr std::array, 256> inferno_data_ = {{ +BOOST_MATH_INLINE_CONSTEXPR std::array, 256> inferno_data_ = {{ {0.0014619955811715805, 0.0004659913919114934, 0.013866005775115809}, {0.0022669056023600243, 0.001269897101615975, 0.018569490325902337}, {0.003299036110031063, 0.0022490183451722313, 0.024239243465136288}, @@ -824,7 +828,7 @@ static constexpr std::array, 256> inferno_data_ = {{ }}; template -static constexpr std::array, 256> black_body_data_ = {{ +BOOST_MATH_INLINE_CONSTEXPR std::array, 256> black_body_data_ = {{ {0.0, 0.0, 0.0}, {0.013038855104993618, 0.0037537033758315535, 0.002103027943341456}, {0.02607771020998725, 0.007507406751663157, 0.004206055886683011}, @@ -1084,7 +1088,7 @@ static constexpr std::array, 256> black_body_data_ = {{ }}; template -static constexpr std::array, 256> plasma_data_ = {{ +BOOST_MATH_INLINE_CONSTEXPR std::array, 256> plasma_data_ = {{ {0.05038205347059877, 0.029801736499741757, 0.5279751010495176}, {0.06353382706361996, 0.028424851177690835, 0.5331235351456174}, {0.07535267397875561, 0.027204618108821313, 0.5380072654878371}, @@ -1344,7 +1348,7 @@ static constexpr std::array, 256> plasma_data_ = {{ }}; template -static constexpr std::array, 256> smooth_cool_warm_data_ = { +BOOST_MATH_INLINE_CONSTEXPR std::array, 256> smooth_cool_warm_data_ = { {{0.22999950386952345, 0.2989989340493756, 0.754000138575591}, {0.23451750918602265, 0.30586471825124395, 0.760211287847582}, {0.23905139222321087, 0.31271835359723077, 0.7663613706951183}, @@ -1603,7 +1607,7 @@ static constexpr std::array, 256> smooth_cool_warm_data_ = { {0.7060001359117047, 0.015991824033980695, 0.15000007192220008}}}; template -static constexpr std::array, 256> viridis_data_ = { +BOOST_MATH_INLINE_CONSTEXPR std::array, 256> viridis_data_ = { {{0.2670039853213788, 0.0048725657145795975, 0.32941506855247793}, {0.26850981914385313, 0.009602990407952114, 0.33542640725404194}, {0.2699440291511295, 0.014623657659867702, 0.34137927634304566}, diff --git a/include/boost/math/tools/complex.hpp b/include/boost/math/tools/complex.hpp index ec51440116..0d4034fa26 100644 --- a/include/boost/math/tools/complex.hpp +++ b/include/boost/math/tools/complex.hpp @@ -29,8 +29,10 @@ using complex = cuda::std::complex; #else +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#endif namespace boost { namespace math { diff --git a/include/boost/math/tools/condition_numbers.hpp b/include/boost/math/tools/condition_numbers.hpp index c285b479fb..580dfee08d 100644 --- a/include/boost/math/tools/condition_numbers.hpp +++ b/include/boost/math/tools/condition_numbers.hpp @@ -5,8 +5,10 @@ #ifndef BOOST_MATH_TOOLS_CONDITION_NUMBERS_HPP #define BOOST_MATH_TOOLS_CONDITION_NUMBERS_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#endif #include #include diff --git a/include/boost/math/tools/cubic_roots.hpp b/include/boost/math/tools/cubic_roots.hpp index 1097ad5ce4..dfd9db6822 100644 --- a/include/boost/math/tools/cubic_roots.hpp +++ b/include/boost/math/tools/cubic_roots.hpp @@ -4,8 +4,10 @@ // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_MATH_TOOLS_CUBIC_ROOTS_HPP #define BOOST_MATH_TOOLS_CUBIC_ROOTS_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#endif #include #include #include diff --git a/include/boost/math/tools/detail/is_const_iterable.hpp b/include/boost/math/tools/detail/is_const_iterable.hpp index e5efc82c30..a20d75af06 100644 --- a/include/boost/math/tools/detail/is_const_iterable.hpp +++ b/include/boost/math/tools/detail/is_const_iterable.hpp @@ -11,7 +11,9 @@ #define BOOST_MATH_HAS_IS_CONST_ITERABLE #include +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif namespace boost { namespace math { diff --git a/include/boost/math/tools/engel_expansion.hpp b/include/boost/math/tools/engel_expansion.hpp index 2d22a84d83..3f0ecd4c52 100644 --- a/include/boost/math/tools/engel_expansion.hpp +++ b/include/boost/math/tools/engel_expansion.hpp @@ -6,6 +6,7 @@ #ifndef BOOST_MATH_TOOLS_ENGEL_EXPANSION_HPP #define BOOST_MATH_TOOLS_ENGEL_EXPANSION_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include @@ -13,6 +14,7 @@ #include #include #include +#endif #include #ifndef BOOST_MATH_STANDALONE diff --git a/include/boost/math/tools/estrin.hpp b/include/boost/math/tools/estrin.hpp index 1955e9398f..3303de34cb 100644 --- a/include/boost/math/tools/estrin.hpp +++ b/include/boost/math/tools/estrin.hpp @@ -7,9 +7,11 @@ #ifndef BOOST_MATH_TOOLS_ESTRIN_HPP #define BOOST_MATH_TOOLS_ESTRIN_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include +#endif #include namespace boost { diff --git a/include/boost/math/tools/is_constant_evaluated.hpp b/include/boost/math/tools/is_constant_evaluated.hpp index eb903dbd71..28524df560 100644 --- a/include/boost/math/tools/is_constant_evaluated.hpp +++ b/include/boost/math/tools/is_constant_evaluated.hpp @@ -10,9 +10,13 @@ #ifdef __has_include # if __has_include() +#ifndef BOOST_MATH_BUILD_MODULE # include +#endif # ifdef __cpp_lib_is_constant_evaluated +#ifndef BOOST_MATH_BUILD_MODULE # include +#endif # define BOOST_MATH_HAS_IS_CONSTANT_EVALUATED # endif # endif diff --git a/include/boost/math/tools/luroth_expansion.hpp b/include/boost/math/tools/luroth_expansion.hpp index 583b227d7a..2f18ce4d64 100644 --- a/include/boost/math/tools/luroth_expansion.hpp +++ b/include/boost/math/tools/luroth_expansion.hpp @@ -6,6 +6,7 @@ #ifndef BOOST_MATH_TOOLS_LUROTH_EXPANSION_HPP #define BOOST_MATH_TOOLS_LUROTH_EXPANSION_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include @@ -13,6 +14,7 @@ #include #include #include +#endif #include #ifndef BOOST_MATH_STANDALONE diff --git a/include/boost/math/tools/norms.hpp b/include/boost/math/tools/norms.hpp index 3be45f14c4..d7d5ff9122 100644 --- a/include/boost/math/tools/norms.hpp +++ b/include/boost/math/tools/norms.hpp @@ -5,10 +5,12 @@ #ifndef BOOST_MATH_TOOLS_NORMS_HPP #define BOOST_MATH_TOOLS_NORMS_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include #include +#endif #include #include diff --git a/include/boost/math/tools/polynomial.hpp b/include/boost/math/tools/polynomial.hpp index 5d395cdbed..bfb50edbc0 100644 --- a/include/boost/math/tools/polynomial.hpp +++ b/include/boost/math/tools/polynomial.hpp @@ -22,12 +22,14 @@ #include #include +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include #include #include #include +#endif namespace boost{ namespace math{ namespace tools{ diff --git a/include/boost/math/tools/polynomial_gcd.hpp b/include/boost/math/tools/polynomial_gcd.hpp index 4a213e127a..78e09d1a0b 100644 --- a/include/boost/math/tools/polynomial_gcd.hpp +++ b/include/boost/math/tools/polynomial_gcd.hpp @@ -11,8 +11,10 @@ #pragma once #endif +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#endif #include #include @@ -20,9 +22,11 @@ #include #else +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include +#endif #include #include diff --git a/include/boost/math/tools/quartic_roots.hpp b/include/boost/math/tools/quartic_roots.hpp index 88a4f72531..a4c4ba1262 100644 --- a/include/boost/math/tools/quartic_roots.hpp +++ b/include/boost/math/tools/quartic_roots.hpp @@ -4,8 +4,10 @@ // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_MATH_TOOLS_QUARTIC_ROOTS_HPP #define BOOST_MATH_TOOLS_QUARTIC_ROOTS_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#endif #include namespace boost::math::tools { diff --git a/include/boost/math/tools/random_vector.hpp b/include/boost/math/tools/random_vector.hpp index 79c0af4030..74cac2fda3 100644 --- a/include/boost/math/tools/random_vector.hpp +++ b/include/boost/math/tools/random_vector.hpp @@ -4,10 +4,12 @@ // 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_BUILD_MODULE #include #include #include #include +#endif namespace boost { namespace math { diff --git a/include/boost/math/tools/rational.hpp b/include/boost/math/tools/rational.hpp index 95ec97e375..6f0fff6811 100644 --- a/include/boost/math/tools/rational.hpp +++ b/include/boost/math/tools/rational.hpp @@ -16,8 +16,10 @@ #include #ifndef BOOST_MATH_HAS_NVRTC +#ifndef BOOST_MATH_BUILD_MODULE #include #endif +#endif #if BOOST_MATH_POLY_METHOD == 1 # define BOOST_HEADER() diff --git a/include/boost/math/tools/recurrence.hpp b/include/boost/math/tools/recurrence.hpp index b08988d4bf..e202743a06 100644 --- a/include/boost/math/tools/recurrence.hpp +++ b/include/boost/math/tools/recurrence.hpp @@ -6,9 +6,11 @@ #ifndef BOOST_MATH_TOOLS_RECURRENCE_HPP_ #define BOOST_MATH_TOOLS_RECURRENCE_HPP_ +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include +#endif #include #include #include diff --git a/include/boost/math/tools/signal_statistics.hpp b/include/boost/math/tools/signal_statistics.hpp index 419e55f60a..7a8eaddb49 100644 --- a/include/boost/math/tools/signal_statistics.hpp +++ b/include/boost/math/tools/signal_statistics.hpp @@ -6,8 +6,10 @@ #ifndef BOOST_MATH_TOOLS_SIGNAL_STATISTICS_HPP #define BOOST_MATH_TOOLS_SIGNAL_STATISTICS_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#endif #include #include #include diff --git a/include/boost/math/tools/simple_continued_fraction.hpp b/include/boost/math/tools/simple_continued_fraction.hpp index daf2c3c657..74036c79e6 100644 --- a/include/boost/math/tools/simple_continued_fraction.hpp +++ b/include/boost/math/tools/simple_continued_fraction.hpp @@ -6,6 +6,7 @@ #ifndef BOOST_MATH_TOOLS_SIMPLE_CONTINUED_FRACTION_HPP #define BOOST_MATH_TOOLS_SIMPLE_CONTINUED_FRACTION_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include @@ -15,6 +16,7 @@ #include #include #include +#endif #include #ifndef BOOST_MATH_STANDALONE diff --git a/include/boost/math/tools/stats.hpp b/include/boost/math/tools/stats.hpp index b57cc7951d..022cee738f 100644 --- a/include/boost/math/tools/stats.hpp +++ b/include/boost/math/tools/stats.hpp @@ -10,8 +10,10 @@ #pragma once #endif +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#endif #include namespace boost{ namespace math{ namespace tools{ diff --git a/include/boost/math/tools/test_value.hpp b/include/boost/math/tools/test_value.hpp index c44fe05289..2e0664fa6c 100644 --- a/include/boost/math/tools/test_value.hpp +++ b/include/boost/math/tools/test_value.hpp @@ -30,8 +30,10 @@ #ifndef BOOST_MATH_STANDALONE #include #endif +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#endif #ifdef BOOST_MATH_INSTRUMENT_CREATE_TEST_VALUE // global int create_type(0); must be defined before including this file. diff --git a/include/boost/math/tools/traits.hpp b/include/boost/math/tools/traits.hpp index e909881e61..ad802650c3 100644 --- a/include/boost/math/tools/traits.hpp +++ b/include/boost/math/tools/traits.hpp @@ -25,7 +25,9 @@ as defined above, and has member functions "scale" and "location". #pragma once #endif +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif namespace boost{ namespace math{ namespace tools{ diff --git a/include/boost/math/tools/ulps_plot.hpp b/include/boost/math/tools/ulps_plot.hpp index 8e3995673b..89ad5daf25 100644 --- a/include/boost/math/tools/ulps_plot.hpp +++ b/include/boost/math/tools/ulps_plot.hpp @@ -4,6 +4,7 @@ // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_MATH_TOOLS_ULP_PLOT_HPP #define BOOST_MATH_TOOLS_ULP_PLOT_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include @@ -16,6 +17,7 @@ #include #include #include +#endif #include #include diff --git a/include/boost/math/tools/univariate_statistics.hpp b/include/boost/math/tools/univariate_statistics.hpp index 98a97abac2..cf9f40cd6a 100644 --- a/include/boost/math/tools/univariate_statistics.hpp +++ b/include/boost/math/tools/univariate_statistics.hpp @@ -6,9 +6,11 @@ #ifndef BOOST_MATH_TOOLS_UNIVARIATE_STATISTICS_HPP #define BOOST_MATH_TOOLS_UNIVARIATE_STATISTICS_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include #include #include +#endif #include #include diff --git a/include/boost/math/tools/utility.hpp b/include/boost/math/tools/utility.hpp index 3e22865780..8fd7bd01fb 100644 --- a/include/boost/math/tools/utility.hpp +++ b/include/boost/math/tools/utility.hpp @@ -10,7 +10,9 @@ #ifndef BOOST_MATH_HAS_GPU_SUPPORT +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif namespace boost { namespace math { From 2a1c7afea4305cb735d2eef48066d7d3c26e5d2a Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Wed, 15 Jul 2026 10:45:26 -0400 Subject: [PATCH 03/27] Export the special functions for the boost.math module * BOOST_MATH_EXPORT on the public declarations in math_fwd.hpp, round_fwd.hpp, unchecked_factorial.hpp, unchecked_bernoulli.hpp and every special function header (declaration and definition sites) * Adds special_functions.hpp to the module interface unit * rsqrt.hpp, jacobi.hpp and cardinal_b_spline.hpp now include tools/config.hpp so the export macro is always defined * math_unit_test.hpp resolves math entities through the import in module mode * Module test harness gains test_digamma_simple, test_expm1_simple, test_log1p_simple, git_issue_1194 and git_issue_1255 --- .../boost/math/special_functions/acosh.hpp | 4 +- include/boost/math/special_functions/airy.hpp | 32 +- .../boost/math/special_functions/asinh.hpp | 4 +- .../boost/math/special_functions/atanh.hpp | 4 +- .../math/special_functions/bernoulli.hpp | 16 +- .../boost/math/special_functions/bessel.hpp | 40 +- .../special_functions/bessel_iterators.hpp | 4 +- .../math/special_functions/bessel_prime.hpp | 24 +- include/boost/math/special_functions/beta.hpp | 22 +- .../boost/math/special_functions/binomial.hpp | 4 +- .../special_functions/cardinal_b_spline.hpp | 10 +- include/boost/math/special_functions/cbrt.hpp | 10 +- .../math/special_functions/chebyshev.hpp | 18 +- .../boost/math/special_functions/cos_pi.hpp | 12 +- .../special_functions/daubechies_scaling.hpp | 4 +- .../special_functions/daubechies_wavelet.hpp | 4 +- .../special_functions/detail/round_fwd.hpp | 48 +- .../detail/unchecked_bernoulli.hpp | 4 +- .../detail/unchecked_factorial.hpp | 18 +- .../boost/math/special_functions/digamma.hpp | 4 +- .../boost/math/special_functions/ellint_1.hpp | 8 +- .../boost/math/special_functions/ellint_2.hpp | 8 +- .../boost/math/special_functions/ellint_3.hpp | 6 +- .../boost/math/special_functions/ellint_d.hpp | 8 +- .../math/special_functions/ellint_rc.hpp | 4 +- .../math/special_functions/ellint_rd.hpp | 4 +- .../math/special_functions/ellint_rf.hpp | 4 +- .../math/special_functions/ellint_rg.hpp | 4 +- .../math/special_functions/ellint_rj.hpp | 4 +- include/boost/math/special_functions/erf.hpp | 24 +- .../boost/math/special_functions/expint.hpp | 8 +- .../boost/math/special_functions/expm1.hpp | 24 +- .../math/special_functions/factorials.hpp | 16 +- .../math/special_functions/fibonacci.hpp | 8 +- .../fourier_transform_daubechies.hpp | 4 +- .../math/special_functions/fpclassify.hpp | 18 +- .../boost/math/special_functions/gamma.hpp | 50 +- .../math/special_functions/gegenbauer.hpp | 6 +- .../boost/math/special_functions/hankel.hpp | 16 +- .../boost/math/special_functions/hermite.hpp | 6 +- .../math/special_functions/heuman_lambda.hpp | 4 +- .../special_functions/hypergeometric_0F1.hpp | 4 +- .../special_functions/hypergeometric_1F0.hpp | 4 +- .../special_functions/hypergeometric_1F1.hpp | 16 +- .../special_functions/hypergeometric_2F0.hpp | 4 +- .../special_functions/hypergeometric_pFq.hpp | 16 +- .../boost/math/special_functions/hypot.hpp | 8 +- .../boost/math/special_functions/jacobi.hpp | 10 +- .../special_functions/jacobi_elliptic.hpp | 52 +- .../math/special_functions/jacobi_theta.hpp | 96 +-- .../math/special_functions/jacobi_zeta.hpp | 4 +- .../boost/math/special_functions/laguerre.hpp | 10 +- .../math/special_functions/lambert_w.hpp | 16 +- .../boost/math/special_functions/legendre.hpp | 24 +- .../special_functions/legendre_stieltjes.hpp | 2 +- .../boost/math/special_functions/log1p.hpp | 20 +- .../math/special_functions/logaddexp.hpp | 2 +- .../special_functions/logistic_sigmoid.hpp | 4 +- .../boost/math/special_functions/logit.hpp | 4 +- .../math/special_functions/logsumexp.hpp | 6 +- .../boost/math/special_functions/math_fwd.hpp | 676 +++++++++--------- include/boost/math/special_functions/modf.hpp | 16 +- include/boost/math/special_functions/next.hpp | 24 +- .../nonfinite_num_facets.hpp | 4 +- .../boost/math/special_functions/owens_t.hpp | 4 +- .../math/special_functions/polygamma.hpp | 4 +- include/boost/math/special_functions/pow.hpp | 4 +- .../boost/math/special_functions/powm1.hpp | 4 +- .../boost/math/special_functions/prime.hpp | 2 +- .../special_functions/relative_difference.hpp | 6 +- .../boost/math/special_functions/round.hpp | 48 +- .../boost/math/special_functions/rsqrt.hpp | 3 +- include/boost/math/special_functions/sign.hpp | 14 +- .../boost/math/special_functions/sin_pi.hpp | 12 +- include/boost/math/special_functions/sinc.hpp | 8 +- .../boost/math/special_functions/sinhc.hpp | 6 +- .../special_functions/spherical_harmonic.hpp | 12 +- .../boost/math/special_functions/sqrt1pm1.hpp | 4 +- .../boost/math/special_functions/trigamma.hpp | 4 +- .../boost/math/special_functions/trunc.hpp | 32 +- include/boost/math/special_functions/ulp.hpp | 4 +- module/CMakeLists.txt | 5 + module/math.cxx | 3 + module/quick_test.cpp | 16 + test/git_issue_1194.cpp | 7 +- test/git_issue_1255.cpp | 5 + test/math_unit_test.hpp | 4 + test/test_digamma_simple.cpp | 5 + test/test_expm1_simple.cpp | 7 +- test/test_log1p_simple.cpp | 7 +- 90 files changed, 915 insertions(+), 857 deletions(-) diff --git a/include/boost/math/special_functions/acosh.hpp b/include/boost/math/special_functions/acosh.hpp index 18942c15f3..2661369cd2 100644 --- a/include/boost/math/special_functions/acosh.hpp +++ b/include/boost/math/special_functions/acosh.hpp @@ -75,7 +75,7 @@ namespace boost } } - template + BOOST_MATH_EXPORT template inline typename tools::promote_args::type acosh(T x, const Policy&) { typedef typename tools::promote_args::type result_type; @@ -90,7 +90,7 @@ namespace boost detail::acosh_imp(static_cast(x), forwarding_policy()), "boost::math::acosh<%1%>(%1%)"); } - template + BOOST_MATH_EXPORT template inline typename tools::promote_args::type acosh(T x) { return boost::math::acosh(x, policies::policy<>()); diff --git a/include/boost/math/special_functions/airy.hpp b/include/boost/math/special_functions/airy.hpp index 4219e5286e..b4087d361c 100644 --- a/include/boost/math/special_functions/airy.hpp +++ b/include/boost/math/special_functions/airy.hpp @@ -268,7 +268,7 @@ BOOST_MATH_GPU_ENABLED T airy_bi_zero_imp(int m, const Policy& pol) } // namespace detail -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type airy_ai(T x, const Policy&) { BOOST_FPU_EXCEPTION_GUARD @@ -284,13 +284,13 @@ BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type airy_ai(T x, return policies::checked_narrowing_cast(detail::airy_ai_imp(static_cast(x), forwarding_policy()), "boost::math::airy<%1%>(%1%)"); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type airy_ai(T x) { return airy_ai(x, policies::policy<>()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type airy_bi(T x, const Policy&) { BOOST_FPU_EXCEPTION_GUARD @@ -306,13 +306,13 @@ BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type airy_bi(T x, return policies::checked_narrowing_cast(detail::airy_bi_imp(static_cast(x), forwarding_policy()), "boost::math::airy<%1%>(%1%)"); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type airy_bi(T x) { return airy_bi(x, policies::policy<>()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type airy_ai_prime(T x, const Policy&) { BOOST_FPU_EXCEPTION_GUARD @@ -328,13 +328,13 @@ BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type airy_ai_prim return policies::checked_narrowing_cast(detail::airy_ai_prime_imp(static_cast(x), forwarding_policy()), "boost::math::airy<%1%>(%1%)"); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type airy_ai_prime(T x) { return airy_ai_prime(x, policies::policy<>()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type airy_bi_prime(T x, const Policy&) { BOOST_FPU_EXCEPTION_GUARD @@ -350,13 +350,13 @@ BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type airy_bi_prim return policies::checked_narrowing_cast(detail::airy_bi_prime_imp(static_cast(x), forwarding_policy()), "boost::math::airy<%1%>(%1%)"); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type airy_bi_prime(T x) { return airy_bi_prime(x, policies::policy<>()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline T airy_ai_zero(int m, const Policy& /*pol*/) { BOOST_FPU_EXCEPTION_GUARD @@ -376,13 +376,13 @@ BOOST_MATH_GPU_ENABLED inline T airy_ai_zero(int m, const Policy& /*pol*/) return policies::checked_narrowing_cast(detail::airy_ai_zero_imp(m, forwarding_policy()), "boost::math::airy_ai_zero<%1%>(unsigned)"); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline T airy_ai_zero(int m) { return airy_ai_zero(m, policies::policy<>()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline OutputIterator airy_ai_zero( int start_index, unsigned number_of_zeros, @@ -404,7 +404,7 @@ BOOST_MATH_GPU_ENABLED inline OutputIterator airy_ai_zero( return out_it; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline OutputIterator airy_ai_zero( int start_index, unsigned number_of_zeros, @@ -413,7 +413,7 @@ BOOST_MATH_GPU_ENABLED inline OutputIterator airy_ai_zero( return airy_ai_zero(start_index, number_of_zeros, out_it, policies::policy<>()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline T airy_bi_zero(int m, const Policy& /*pol*/) { BOOST_FPU_EXCEPTION_GUARD @@ -433,13 +433,13 @@ BOOST_MATH_GPU_ENABLED inline T airy_bi_zero(int m, const Policy& /*pol*/) return policies::checked_narrowing_cast(detail::airy_bi_zero_imp(m, forwarding_policy()), "boost::math::airy_bi_zero<%1%>(unsigned)"); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline T airy_bi_zero(int m) { return airy_bi_zero(m, policies::policy<>()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline OutputIterator airy_bi_zero( int start_index, unsigned number_of_zeros, @@ -461,7 +461,7 @@ BOOST_MATH_GPU_ENABLED inline OutputIterator airy_bi_zero( return out_it; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline OutputIterator airy_bi_zero( int start_index, unsigned number_of_zeros, diff --git a/include/boost/math/special_functions/asinh.hpp b/include/boost/math/special_functions/asinh.hpp index e92ba52dac..c5888651d2 100644 --- a/include/boost/math/special_functions/asinh.hpp +++ b/include/boost/math/special_functions/asinh.hpp @@ -84,12 +84,12 @@ namespace boost } } - template + BOOST_MATH_EXPORT template inline typename tools::promote_args::type asinh(T x) { return boost::math::asinh(x, policies::policy<>()); } - template + BOOST_MATH_EXPORT template inline typename tools::promote_args::type asinh(T x, const Policy&) { typedef typename tools::promote_args::type result_type; diff --git a/include/boost/math/special_functions/atanh.hpp b/include/boost/math/special_functions/atanh.hpp index 9d73e568c0..1fc2d22431 100644 --- a/include/boost/math/special_functions/atanh.hpp +++ b/include/boost/math/special_functions/atanh.hpp @@ -86,7 +86,7 @@ namespace boost } } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type atanh(T x, const Policy&) { typedef typename tools::promote_args::type result_type; @@ -101,7 +101,7 @@ namespace boost detail::atanh_imp(static_cast(x), forwarding_policy()), "boost::math::atanh<%1%>(%1%)"); } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type atanh(T x) { return boost::math::atanh(x, policies::policy<>()); diff --git a/include/boost/math/special_functions/bernoulli.hpp b/include/boost/math/special_functions/bernoulli.hpp index 102b49399e..2214c05fc3 100644 --- a/include/boost/math/special_functions/bernoulli.hpp +++ b/include/boost/math/special_functions/bernoulli.hpp @@ -58,7 +58,7 @@ OutputIterator bernoulli_number_imp(OutputIterator out, std::size_t start, std:: } // namespace detail -template +BOOST_MATH_EXPORT template inline T bernoulli_b2n(const int i, const Policy &pol) { using tag_type = std::integral_constant::value>; @@ -72,13 +72,13 @@ inline T bernoulli_b2n(const int i, const Policy &pol) return result; } -template +BOOST_MATH_EXPORT template inline T bernoulli_b2n(const int i) { return boost::math::bernoulli_b2n(i, policies::policy<>()); } -template +BOOST_MATH_EXPORT template inline OutputIterator bernoulli_b2n(const int start_index, const unsigned number_of_bernoullis_b2n, OutputIterator out_it, @@ -94,7 +94,7 @@ inline OutputIterator bernoulli_b2n(const int start_index, return boost::math::detail::bernoulli_number_imp(out_it, start_index, number_of_bernoullis_b2n, pol, tag_type()); } -template +BOOST_MATH_EXPORT template inline OutputIterator bernoulli_b2n(const int start_index, const unsigned number_of_bernoullis_b2n, OutputIterator out_it) @@ -102,7 +102,7 @@ inline OutputIterator bernoulli_b2n(const int start_index, return boost::math::bernoulli_b2n(start_index, number_of_bernoullis_b2n, out_it, policies::policy<>()); } -template +BOOST_MATH_EXPORT template inline T tangent_t2n(const int i, const Policy &pol) { if(i < 0) @@ -115,13 +115,13 @@ inline T tangent_t2n(const int i, const Policy &pol) return result; } -template +BOOST_MATH_EXPORT template inline T tangent_t2n(const int i) { return boost::math::tangent_t2n(i, policies::policy<>()); } -template +BOOST_MATH_EXPORT template inline OutputIterator tangent_t2n(const int start_index, const unsigned number_of_tangent_t2n, OutputIterator out_it, @@ -136,7 +136,7 @@ inline OutputIterator tangent_t2n(const int start_index, return boost::math::detail::get_bernoulli_numbers_cache().copy_tangent_numbers(out_it, start_index, number_of_tangent_t2n, pol); } -template +BOOST_MATH_EXPORT template inline OutputIterator tangent_t2n(const int start_index, const unsigned number_of_tangent_t2n, OutputIterator out_it) diff --git a/include/boost/math/special_functions/bessel.hpp b/include/boost/math/special_functions/bessel.hpp index 0cf9b63764..6ec04e99d7 100644 --- a/include/boost/math/special_functions/bessel.hpp +++ b/include/boost/math/special_functions/bessel.hpp @@ -532,7 +532,7 @@ BOOST_MATH_GPU_ENABLED inline T cyl_neumann_zero_imp(T v, int m, const Policy& p } // namespace detail -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename detail::bessel_traits::result_type cyl_bessel_j(T1 v, T2 x, const Policy& /* pol */) { BOOST_FPU_EXCEPTION_GUARD @@ -548,13 +548,13 @@ BOOST_MATH_GPU_ENABLED inline typename detail::bessel_traits::re return policies::checked_narrowing_cast(detail::cyl_bessel_j_imp(v, static_cast(x), tag_type(), forwarding_policy()), "boost::math::cyl_bessel_j<%1%>(%1%,%1%)"); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename detail::bessel_traits >::result_type cyl_bessel_j(T1 v, T2 x) { return cyl_bessel_j(v, x, policies::policy<>()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename detail::bessel_traits::result_type sph_bessel(unsigned v, T x, const Policy& /* pol */) { BOOST_FPU_EXCEPTION_GUARD @@ -569,13 +569,13 @@ BOOST_MATH_GPU_ENABLED inline typename detail::bessel_traits::resu return policies::checked_narrowing_cast(detail::sph_bessel_j_imp(v, static_cast(x), forwarding_policy()), "boost::math::sph_bessel<%1%>(%1%,%1%)"); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename detail::bessel_traits >::result_type sph_bessel(unsigned v, T x) { return sph_bessel(v, x, policies::policy<>()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename detail::bessel_traits::result_type cyl_bessel_i(T1 v, T2 x, const Policy& /* pol */) { BOOST_FPU_EXCEPTION_GUARD @@ -590,13 +590,13 @@ BOOST_MATH_GPU_ENABLED inline typename detail::bessel_traits::re return policies::checked_narrowing_cast(detail::cyl_bessel_i_imp(static_cast(v), static_cast(x), forwarding_policy()), "boost::math::cyl_bessel_i<%1%>(%1%,%1%)"); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename detail::bessel_traits >::result_type cyl_bessel_i(T1 v, T2 x) { return cyl_bessel_i(v, x, policies::policy<>()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename detail::bessel_traits::result_type cyl_bessel_k(T1 v, T2 x, const Policy& /* pol */) { BOOST_FPU_EXCEPTION_GUARD @@ -612,13 +612,13 @@ BOOST_MATH_GPU_ENABLED inline typename detail::bessel_traits::re return policies::checked_narrowing_cast(detail::cyl_bessel_k_imp(v, static_cast(x), tag_type(), forwarding_policy()), "boost::math::cyl_bessel_k<%1%>(%1%,%1%)"); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename detail::bessel_traits >::result_type cyl_bessel_k(T1 v, T2 x) { return cyl_bessel_k(v, x, policies::policy<>()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename detail::bessel_traits::result_type cyl_neumann(T1 v, T2 x, const Policy& /* pol */) { BOOST_FPU_EXCEPTION_GUARD @@ -634,13 +634,13 @@ BOOST_MATH_GPU_ENABLED inline typename detail::bessel_traits::re return policies::checked_narrowing_cast(detail::cyl_neumann_imp(v, static_cast(x), tag_type(), forwarding_policy()), "boost::math::cyl_neumann<%1%>(%1%,%1%)"); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename detail::bessel_traits >::result_type cyl_neumann(T1 v, T2 x) { return cyl_neumann(v, x, policies::policy<>()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename detail::bessel_traits::result_type sph_neumann(unsigned v, T x, const Policy& /* pol */) { BOOST_FPU_EXCEPTION_GUARD @@ -655,13 +655,13 @@ BOOST_MATH_GPU_ENABLED inline typename detail::bessel_traits::resu return policies::checked_narrowing_cast(detail::sph_neumann_imp(v, static_cast(x), forwarding_policy()), "boost::math::sph_neumann<%1%>(%1%,%1%)"); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename detail::bessel_traits >::result_type sph_neumann(unsigned v, T x) { return sph_neumann(v, x, policies::policy<>()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename detail::bessel_traits::result_type cyl_bessel_j_zero(T v, int m, const Policy& /* pol */) { BOOST_FPU_EXCEPTION_GUARD @@ -682,7 +682,7 @@ BOOST_MATH_GPU_ENABLED inline typename detail::bessel_traits::resu return policies::checked_narrowing_cast(detail::cyl_bessel_j_zero_imp(v, m, forwarding_policy()), "boost::math::cyl_bessel_j_zero<%1%>(%1%,%1%)"); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename detail::bessel_traits >::result_type cyl_bessel_j_zero(T v, int m) { static_assert( false == boost::math::numeric_limits::is_specialized @@ -693,7 +693,7 @@ BOOST_MATH_GPU_ENABLED inline typename detail::bessel_traits >(v, m, policies::policy<>()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline OutputIterator cyl_bessel_j_zero(T v, int start_index, unsigned number_of_zeros, @@ -713,7 +713,7 @@ BOOST_MATH_GPU_ENABLED inline OutputIterator cyl_bessel_j_zero(T v, return out_it; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline OutputIterator cyl_bessel_j_zero(T v, int start_index, unsigned number_of_zeros, @@ -722,7 +722,7 @@ BOOST_MATH_GPU_ENABLED inline OutputIterator cyl_bessel_j_zero(T v, return cyl_bessel_j_zero(v, start_index, number_of_zeros, out_it, policies::policy<>()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename detail::bessel_traits::result_type cyl_neumann_zero(T v, int m, const Policy& /* pol */) { BOOST_FPU_EXCEPTION_GUARD @@ -743,7 +743,7 @@ BOOST_MATH_GPU_ENABLED inline typename detail::bessel_traits::resu return policies::checked_narrowing_cast(detail::cyl_neumann_zero_imp(v, m, forwarding_policy()), "boost::math::cyl_neumann_zero<%1%>(%1%,%1%)"); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename detail::bessel_traits >::result_type cyl_neumann_zero(T v, int m) { static_assert( false == boost::math::numeric_limits::is_specialized @@ -754,7 +754,7 @@ BOOST_MATH_GPU_ENABLED inline typename detail::bessel_traits >(v, m, policies::policy<>()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline OutputIterator cyl_neumann_zero(T v, int start_index, unsigned number_of_zeros, @@ -774,7 +774,7 @@ BOOST_MATH_GPU_ENABLED inline OutputIterator cyl_neumann_zero(T v, return out_it; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline OutputIterator cyl_neumann_zero(T v, int start_index, unsigned number_of_zeros, diff --git a/include/boost/math/special_functions/bessel_iterators.hpp b/include/boost/math/special_functions/bessel_iterators.hpp index 7e0de2f865..404d63df3b 100644 --- a/include/boost/math/special_functions/bessel_iterators.hpp +++ b/include/boost/math/special_functions/bessel_iterators.hpp @@ -39,7 +39,7 @@ namespace boost { }; } // namespace detail - template > + BOOST_MATH_EXPORT template > struct bessel_j_backwards_iterator { typedef std::ptrdiff_t difference_type; @@ -134,7 +134,7 @@ namespace boost { boost::math::tools::backward_recurrence_iterator< detail::bessel_ik_recurrence > it; }; - template > + BOOST_MATH_EXPORT template > struct bessel_i_forwards_iterator { typedef std::ptrdiff_t difference_type; diff --git a/include/boost/math/special_functions/bessel_prime.hpp b/include/boost/math/special_functions/bessel_prime.hpp index ba71562885..e0773f50ac 100644 --- a/include/boost/math/special_functions/bessel_prime.hpp +++ b/include/boost/math/special_functions/bessel_prime.hpp @@ -208,7 +208,7 @@ inline T sph_neumann_prime_imp(unsigned v, T x, const Policy& pol) } // namespace detail -template +BOOST_MATH_EXPORT template inline typename detail::bessel_traits::result_type cyl_bessel_j_prime(T1 v, T2 x, const Policy& /* pol */) { BOOST_FPU_EXCEPTION_GUARD @@ -224,13 +224,13 @@ inline typename detail::bessel_traits::result_type cyl_bessel_j_ return policies::checked_narrowing_cast(detail::cyl_bessel_j_prime_imp(static_cast(v), static_cast(x), forwarding_policy()), "boost::math::cyl_bessel_j_prime<%1%,%1%>(%1%,%1%)"); } -template +BOOST_MATH_EXPORT template inline typename detail::bessel_traits >::result_type cyl_bessel_j_prime(T1 v, T2 x) { return cyl_bessel_j_prime(v, x, policies::policy<>()); } -template +BOOST_MATH_EXPORT template inline typename detail::bessel_traits::result_type sph_bessel_prime(unsigned v, T x, const Policy& /* pol */) { BOOST_FPU_EXCEPTION_GUARD @@ -245,13 +245,13 @@ inline typename detail::bessel_traits::result_type sph_bessel_prim return policies::checked_narrowing_cast(detail::sph_bessel_j_prime_imp(v, static_cast(x), forwarding_policy()), "boost::math::sph_bessel_j_prime<%1%>(%1%,%1%)"); } -template +BOOST_MATH_EXPORT template inline typename detail::bessel_traits >::result_type sph_bessel_prime(unsigned v, T x) { return sph_bessel_prime(v, x, policies::policy<>()); } -template +BOOST_MATH_EXPORT template inline typename detail::bessel_traits::result_type cyl_bessel_i_prime(T1 v, T2 x, const Policy& /* pol */) { BOOST_FPU_EXCEPTION_GUARD @@ -266,13 +266,13 @@ inline typename detail::bessel_traits::result_type cyl_bessel_i_ return policies::checked_narrowing_cast(detail::cyl_bessel_i_prime_imp(static_cast(v), static_cast(x), forwarding_policy()), "boost::math::cyl_bessel_i_prime<%1%>(%1%,%1%)"); } -template +BOOST_MATH_EXPORT template inline typename detail::bessel_traits >::result_type cyl_bessel_i_prime(T1 v, T2 x) { return cyl_bessel_i_prime(v, x, policies::policy<>()); } -template +BOOST_MATH_EXPORT template inline typename detail::bessel_traits::result_type cyl_bessel_k_prime(T1 v, T2 x, const Policy& /* pol */) { BOOST_FPU_EXCEPTION_GUARD @@ -288,13 +288,13 @@ inline typename detail::bessel_traits::result_type cyl_bessel_k_ return policies::checked_narrowing_cast(detail::cyl_bessel_k_prime_imp(static_cast(v), static_cast(x), forwarding_policy()), "boost::math::cyl_bessel_k_prime<%1%,%1%>(%1%,%1%)"); } -template +BOOST_MATH_EXPORT template inline typename detail::bessel_traits >::result_type cyl_bessel_k_prime(T1 v, T2 x) { return cyl_bessel_k_prime(v, x, policies::policy<>()); } -template +BOOST_MATH_EXPORT template inline typename detail::bessel_traits::result_type cyl_neumann_prime(T1 v, T2 x, const Policy& /* pol */) { BOOST_FPU_EXCEPTION_GUARD @@ -310,13 +310,13 @@ inline typename detail::bessel_traits::result_type cyl_neumann_p return policies::checked_narrowing_cast(detail::cyl_neumann_prime_imp(static_cast(v), static_cast(x), forwarding_policy()), "boost::math::cyl_neumann_prime<%1%,%1%>(%1%,%1%)"); } -template +BOOST_MATH_EXPORT template inline typename detail::bessel_traits >::result_type cyl_neumann_prime(T1 v, T2 x) { return cyl_neumann_prime(v, x, policies::policy<>()); } -template +BOOST_MATH_EXPORT template inline typename detail::bessel_traits::result_type sph_neumann_prime(unsigned v, T x, const Policy& /* pol */) { BOOST_FPU_EXCEPTION_GUARD @@ -331,7 +331,7 @@ inline typename detail::bessel_traits::result_type sph_neumann_pri return policies::checked_narrowing_cast(detail::sph_neumann_prime_imp(v, static_cast(x), forwarding_policy()), "boost::math::sph_neumann_prime<%1%>(%1%,%1%)"); } -template +BOOST_MATH_EXPORT template inline typename detail::bessel_traits >::result_type sph_neumann_prime(unsigned v, T x) { return sph_neumann_prime(v, x, policies::policy<>()); diff --git a/include/boost/math/special_functions/beta.hpp b/include/boost/math/special_functions/beta.hpp index 5c3a762ca0..dc1519c76d 100644 --- a/include/boost/math/special_functions/beta.hpp +++ b/include/boost/math/special_functions/beta.hpp @@ -1736,7 +1736,7 @@ BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type // which Lanczos approximation to use // and forward to the implementation functions: // -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type beta(RT1 a, RT2 b, A arg) { @@ -1745,14 +1745,14 @@ BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type return static_cast(boost::math::detail::beta(a, b, arg, static_cast(nullptr))); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type beta(RT1 a, RT2 b) { return boost::math::beta(a, b, policies::policy<>()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type beta(RT1 a, RT2 b, RT3 x, const Policy&) { @@ -1769,7 +1769,7 @@ BOOST_MATH_GPU_ENABLED 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, false), "boost::math::beta<%1%>(%1%,%1%,%1%)"); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type betac(RT1 a, RT2 b, RT3 x, const Policy&) { @@ -1785,14 +1785,14 @@ BOOST_MATH_GPU_ENABLED 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 +BOOST_MATH_EXPORT template 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 +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type ibeta(RT1 a, RT2 b, RT3 x, const Policy&) { @@ -1808,14 +1808,14 @@ BOOST_MATH_GPU_ENABLED 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 +BOOST_MATH_EXPORT template 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 +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type ibetac(RT1 a, RT2 b, RT3 x, const Policy&) { @@ -1831,14 +1831,14 @@ BOOST_MATH_GPU_ENABLED 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 +BOOST_MATH_EXPORT template 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 +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type ibeta_derivative(RT1 a, RT2 b, RT3 x, const Policy&) { @@ -1854,7 +1854,7 @@ BOOST_MATH_GPU_ENABLED 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 +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type ibeta_derivative(RT1 a, RT2 b, RT3 x) { diff --git a/include/boost/math/special_functions/binomial.hpp b/include/boost/math/special_functions/binomial.hpp index 3c49ff30d5..f7e04c4311 100644 --- a/include/boost/math/special_functions/binomial.hpp +++ b/include/boost/math/special_functions/binomial.hpp @@ -19,7 +19,7 @@ namespace boost{ namespace math{ -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED T binomial_coefficient(unsigned n, unsigned k, const Policy& pol) { static_assert(!boost::math::is_integral::value, "Type T must not be an integral type"); @@ -71,7 +71,7 @@ BOOST_MATH_GPU_ENABLED inline float binomial_coefficient(binomial_coefficient(n, k, forwarding_policy()), "boost::math::binomial_coefficient<%1%>(unsigned,unsigned)"); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline T binomial_coefficient(unsigned n, unsigned k) { return binomial_coefficient(n, k, policies::policy<>()); diff --git a/include/boost/math/special_functions/cardinal_b_spline.hpp b/include/boost/math/special_functions/cardinal_b_spline.hpp index c4c51a0c97..ab3745d3f3 100644 --- a/include/boost/math/special_functions/cardinal_b_spline.hpp +++ b/include/boost/math/special_functions/cardinal_b_spline.hpp @@ -13,6 +13,8 @@ #include #endif +#include + namespace boost { namespace math { namespace detail { @@ -32,7 +34,7 @@ namespace detail { } } -template +BOOST_MATH_EXPORT template Real cardinal_b_spline(Real x) { static_assert(!std::is_integral::value, "Does not work with integral types."); @@ -93,7 +95,7 @@ Real cardinal_b_spline(Real x) { } -template +BOOST_MATH_EXPORT template Real cardinal_b_spline_prime(Real x) { static_assert(!std::is_integral::value, "Cardinal B-splines do not work with integer types."); @@ -164,7 +166,7 @@ Real cardinal_b_spline_prime(Real x) } -template +BOOST_MATH_EXPORT template Real cardinal_b_spline_double_prime(Real x) { static_assert(!std::is_integral::value, "Cardinal B-splines do not work with integer types."); @@ -209,7 +211,7 @@ Real cardinal_b_spline_double_prime(Real x) } -template +BOOST_MATH_EXPORT template Real forward_cardinal_b_spline(Real x) { static_assert(!std::is_integral::value, "Cardinal B-splines do not work with integral types."); diff --git a/include/boost/math/special_functions/cbrt.hpp b/include/boost/math/special_functions/cbrt.hpp index 7fdf78d014..1a33b149ec 100644 --- a/include/boost/math/special_functions/cbrt.hpp +++ b/include/boost/math/special_functions/cbrt.hpp @@ -158,7 +158,7 @@ BOOST_MATH_GPU_ENABLED T cbrt_imp(T z, const Policy& pol) } // namespace detail -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type cbrt(T z, const Policy& pol) { using result_type = typename tools::promote_args::type; @@ -166,7 +166,7 @@ BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type cbrt(T z, co return static_cast(detail::cbrt_imp(value_type(z), pol)); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type cbrt(T z) { return cbrt(z, policies::policy<>()); @@ -180,7 +180,7 @@ BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type cbrt(T z) namespace boost { namespace math { -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED double cbrt(T x) { return ::cbrt(x); @@ -191,13 +191,13 @@ BOOST_MATH_GPU_ENABLED inline float cbrt(float x) return ::cbrtf(x); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED double cbrt(T x, const Policy&) { return ::cbrt(x); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED float cbrt(float x, const Policy&) { return ::cbrtf(x); diff --git a/include/boost/math/special_functions/chebyshev.hpp b/include/boost/math/special_functions/chebyshev.hpp index ed78d54663..41dfba8bb5 100644 --- a/include/boost/math/special_functions/chebyshev.hpp +++ b/include/boost/math/special_functions/chebyshev.hpp @@ -25,7 +25,7 @@ namespace boost { namespace math { -template +BOOST_MATH_EXPORT template inline tools::promote_args_t chebyshev_next(T1 const & x, T2 const & Tn, T3 const & Tn_1) { return 2*x*Tn - Tn_1; @@ -119,7 +119,7 @@ inline Real chebyshev_imp(unsigned n, Real const & x, const Policy&) } } // namespace detail -template +BOOST_MATH_EXPORT template inline tools::promote_args_t chebyshev_t(unsigned n, Real const & x, const Policy&) { using result_type = tools::promote_args_t; @@ -134,13 +134,13 @@ inline tools::promote_args_t chebyshev_t(unsigned n, Real const & x, const return policies::checked_narrowing_cast(detail::chebyshev_imp(n, static_cast(x), forwarding_policy()), "boost::math::chebyshev_t<%1%>(unsigned, %1%)"); } -template +BOOST_MATH_EXPORT template inline tools::promote_args_t chebyshev_t(unsigned n, Real const & x) { return chebyshev_t(n, x, policies::policy<>()); } -template +BOOST_MATH_EXPORT template inline tools::promote_args_t chebyshev_u(unsigned n, Real const & x, const Policy&) { using result_type = tools::promote_args_t; @@ -155,13 +155,13 @@ inline tools::promote_args_t chebyshev_u(unsigned n, Real const & x, const return policies::checked_narrowing_cast(detail::chebyshev_imp(n, static_cast(x), forwarding_policy()), "boost::math::chebyshev_u<%1%>(unsigned, %1%)"); } -template +BOOST_MATH_EXPORT template inline tools::promote_args_t chebyshev_u(unsigned n, Real const & x) { return chebyshev_u(n, x, policies::policy<>()); } -template +BOOST_MATH_EXPORT template inline tools::promote_args_t chebyshev_t_prime(unsigned n, Real const & x, const Policy&) { using result_type = tools::promote_args_t; @@ -179,7 +179,7 @@ inline tools::promote_args_t chebyshev_t_prime(unsigned n, Real const & x, return policies::checked_narrowing_cast(n * detail::chebyshev_imp(n - 1, static_cast(x), forwarding_policy()), "boost::math::chebyshev_t_prime<%1%>(unsigned, %1%)"); } -template +BOOST_MATH_EXPORT template inline tools::promote_args_t chebyshev_t_prime(unsigned n, Real const & x) { return chebyshev_t_prime(n, x, policies::policy<>()); @@ -193,7 +193,7 @@ inline tools::promote_args_t chebyshev_t_prime(unsigned n, Real const & x) * https://www.siam.org/books/ot99/OT99SampleChapter.pdf * However, our definition of c0 differs by a factor of 1/2, as stated in the docs. . . */ -template +BOOST_MATH_EXPORT template inline Real chebyshev_clenshaw_recurrence(const Real* const c, size_t length, const T2& x) { using boost::math::constants::half; @@ -293,7 +293,7 @@ inline Real unchecked_chebyshev_clenshaw_recurrence(const Real* const c, size_t } // namespace detail -template +BOOST_MATH_EXPORT template inline Real chebyshev_clenshaw_recurrence(const Real* const c, size_t length, const Real & a, const Real & b, const Real& x) { if (x < a || x > b) diff --git a/include/boost/math/special_functions/cos_pi.hpp b/include/boost/math/special_functions/cos_pi.hpp index 21413e3af2..f43c27d7b8 100644 --- a/include/boost/math/special_functions/cos_pi.hpp +++ b/include/boost/math/special_functions/cos_pi.hpp @@ -66,7 +66,7 @@ BOOST_MATH_GPU_ENABLED T cos_pi_imp(T x, const Policy&) } // namespace detail -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type cos_pi(T x, const Policy&) { typedef typename tools::promote_args::type result_type; @@ -83,7 +83,7 @@ BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type cos_pi(T x, return policies::checked_narrowing_cast(boost::math::detail::cos_pi_imp(x, forwarding_policy()), "cos_pi"); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type cos_pi(T x) { return boost::math::cos_pi(x, policies::policy<>()); @@ -97,25 +97,25 @@ BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type cos_pi(T x) namespace boost { namespace math { -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED auto cos_pi(T x) { return ::cospi(x); } -template <> +BOOST_MATH_EXPORT template <> BOOST_MATH_GPU_ENABLED auto cos_pi(float x) { return ::cospif(x); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED auto cos_pi(T x, const Policy&) { return ::cospi(x); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED auto cos_pi(float x, const Policy&) { return ::cospif(x); diff --git a/include/boost/math/special_functions/daubechies_scaling.hpp b/include/boost/math/special_functions/daubechies_scaling.hpp index d67f08f424..db07f47e0d 100644 --- a/include/boost/math/special_functions/daubechies_scaling.hpp +++ b/include/boost/math/special_functions/daubechies_scaling.hpp @@ -35,7 +35,7 @@ namespace boost::math { -template +BOOST_MATH_EXPORT template std::vector daubechies_scaling_dyadic_grid(int64_t j_max) { using std::isnan; @@ -324,7 +324,7 @@ struct null_interpolator } // namespace detail -template +BOOST_MATH_EXPORT template class daubechies_scaling { // // Some type manipulation so we know the type of the interpolator, and the vector type it requires: diff --git a/include/boost/math/special_functions/daubechies_wavelet.hpp b/include/boost/math/special_functions/daubechies_wavelet.hpp index d11812686c..1ae95a4366 100644 --- a/include/boost/math/special_functions/daubechies_wavelet.hpp +++ b/include/boost/math/special_functions/daubechies_wavelet.hpp @@ -33,7 +33,7 @@ namespace boost::math { - template + BOOST_MATH_EXPORT template std::vector daubechies_wavelet_dyadic_grid(int64_t j_max) { if (j_max == 0) @@ -77,7 +77,7 @@ namespace boost::math { } - template + BOOST_MATH_EXPORT template class daubechies_wavelet { // // Some type manipulation so we know the type of the interpolator, and the vector type it requires: diff --git a/include/boost/math/special_functions/detail/round_fwd.hpp b/include/boost/math/special_functions/detail/round_fwd.hpp index 7d69f8b9c5..7451fd7331 100644 --- a/include/boost/math/special_functions/detail/round_fwd.hpp +++ b/include/boost/math/special_functions/detail/round_fwd.hpp @@ -21,53 +21,53 @@ namespace boost namespace math { - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED typename tools::promote_args::type trunc(const T& v, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED typename tools::promote_args::type trunc(const T& v); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED int itrunc(const T& v, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED int itrunc(const T& v); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED long ltrunc(const T& v, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED long ltrunc(const T& v); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED long long lltrunc(const T& v, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED long long lltrunc(const T& v); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED typename tools::promote_args::type round(const T& v, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED typename tools::promote_args::type round(const T& v); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED int iround(const T& v, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED int iround(const T& v); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED long lround(const T& v, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED long lround(const T& v); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED long long llround(const T& v, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED long long llround(const T& v); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED T modf(const T& v, T* ipart, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED T modf(const T& v, T* ipart); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED T modf(const T& v, int* ipart, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED T modf(const T& v, int* ipart); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED T modf(const T& v, long* ipart, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED T modf(const T& v, long* ipart); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED T modf(const T& v, long long* ipart, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED T modf(const T& v, long long* ipart); } } diff --git a/include/boost/math/special_functions/detail/unchecked_bernoulli.hpp b/include/boost/math/special_functions/detail/unchecked_bernoulli.hpp index c0fb3d9fde..aae016b774 100644 --- a/include/boost/math/special_functions/detail/unchecked_bernoulli.hpp +++ b/include/boost/math/special_functions/detail/unchecked_bernoulli.hpp @@ -80,7 +80,7 @@ struct bernoulli_imp_variant } // namespace detail -template +BOOST_MATH_EXPORT template struct max_bernoulli_b2n : public detail::max_bernoulli_index::value>{}; namespace detail { @@ -1294,7 +1294,7 @@ inline T unchecked_bernoulli_imp(std::size_t n, const std::integral_constant +BOOST_MATH_EXPORT template inline BOOST_MATH_CONSTEXPR_TABLE_FUNCTION T unchecked_bernoulli_b2n(const std::size_t n) { typedef std::integral_constant::value> tag_type; diff --git a/include/boost/math/special_functions/detail/unchecked_factorial.hpp b/include/boost/math/special_functions/detail/unchecked_factorial.hpp index 12487eae05..6d207261d7 100644 --- a/include/boost/math/special_functions/detail/unchecked_factorial.hpp +++ b/include/boost/math/special_functions/detail/unchecked_factorial.hpp @@ -41,7 +41,7 @@ namespace boost { namespace math { // Forward declarations: -template +BOOST_MATH_EXPORT template struct max_factorial; // // see https://github.com/boostorg/math/issues/923 @@ -53,7 +53,7 @@ struct unchecked_factorial_data; #ifdef BOOST_MATH_HAS_NVRTC // Need fwd decl -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline T unchecked_factorial(unsigned i); #endif @@ -204,7 +204,7 @@ BOOST_MATH_GPU_ENABLED inline BOOST_MATH_CONSTEXPR_TABLE_FUNCTION float unchecke #endif -template <> +BOOST_MATH_EXPORT template <> struct max_factorial { static constexpr unsigned value = 34; @@ -579,7 +579,7 @@ BOOST_MATH_GPU_ENABLED inline BOOST_MATH_CONSTEXPR_TABLE_FUNCTION double uncheck return unchecked_factorial_data::factorials[i]; } -template <> +BOOST_MATH_EXPORT template <> struct max_factorial { static constexpr unsigned value = 170; @@ -631,7 +631,7 @@ BOOST_MATH_GPU_ENABLED inline BOOST_MATH_CONSTEXPR_TABLE_FUNCTION double uncheck return factorials[i]; } -template <> +BOOST_MATH_EXPORT template <> struct max_factorial { static constexpr unsigned value = 34; @@ -1008,7 +1008,7 @@ inline BOOST_MATH_CONSTEXPR_TABLE_FUNCTION long double unchecked_factorial::factorials[i]; } -template <> +BOOST_MATH_EXPORT template <> struct max_factorial { static constexpr unsigned value = 170; @@ -1383,7 +1383,7 @@ inline BOOST_MATH_CONSTEXPR_TABLE_FUNCTION BOOST_MATH_FLOAT128_TYPE unchecked_fa return unchecked_factorial_data::factorials[i]; } -template <> +BOOST_MATH_EXPORT template <> struct max_factorial { static constexpr unsigned value = 170; @@ -1687,7 +1687,7 @@ inline T unchecked_factorial_imp(unsigned i, const boost::math::integral_constan #endif // BOOST_MATH_HAS_GPU_SUPPORT -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline T unchecked_factorial(unsigned i) { typedef typename boost::math::policies::precision >::type tag_type; @@ -1700,7 +1700,7 @@ BOOST_MATH_GPU_ENABLED inline T unchecked_factorial(unsigned i) #define BOOST_MATH_DETAIL_FLOAT128_MAX_FACTORIAL #endif -template +BOOST_MATH_EXPORT template struct max_factorial { static constexpr unsigned value = diff --git a/include/boost/math/special_functions/digamma.hpp b/include/boost/math/special_functions/digamma.hpp index 718bd45529..ff37fb968f 100644 --- a/include/boost/math/special_functions/digamma.hpp +++ b/include/boost/math/special_functions/digamma.hpp @@ -590,7 +590,7 @@ T digamma_imp(T x, const boost::math::integral_constant* t, const Policy } // namespace detail -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type digamma(T x, const Policy&) { @@ -613,7 +613,7 @@ BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type return policies::checked_narrowing_cast(detail::digamma_imp(static_cast(x), static_cast(nullptr), forwarding_policy()), "boost::math::digamma<%1%>(%1%)"); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type digamma(T x) { diff --git a/include/boost/math/special_functions/ellint_1.hpp b/include/boost/math/special_functions/ellint_1.hpp index 96c7c9e9b9..7fdd424bcc 100644 --- a/include/boost/math/special_functions/ellint_1.hpp +++ b/include/boost/math/special_functions/ellint_1.hpp @@ -33,7 +33,7 @@ namespace boost { namespace math { -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED typename tools::promote_args::type ellint_1(T1 k, T2 phi, const Policy& pol); namespace detail{ @@ -787,7 +787,7 @@ BOOST_MATH_GPU_ENABLED typename tools::promote_args::type ellint_1(T1 k, } // namespace detail // Elliptic integral (Legendre form) of the first kind -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED typename tools::promote_args::type ellint_1(T1 k, T2 phi, const Policy& pol) // LCOV_EXCL_LINE gcc misses this but sees the function body, strange! { typedef typename tools::promote_args::type result_type; @@ -795,7 +795,7 @@ BOOST_MATH_GPU_ENABLED typename tools::promote_args::type ellint_1(T1 k, return policies::checked_narrowing_cast(detail::ellint_f_imp(static_cast(phi), static_cast(k), pol), "boost::math::ellint_1<%1%>(%1%,%1%)"); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED typename tools::promote_args::type ellint_1(T1 k, T2 phi) { typedef typename policies::is_policy::type tag_type; @@ -803,7 +803,7 @@ BOOST_MATH_GPU_ENABLED typename tools::promote_args::type ellint_1(T1 k, } // Complete elliptic integral (Legendre form) of the first kind -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED typename tools::promote_args::type ellint_1(T k) { return ellint_1(k, policies::policy<>()); diff --git a/include/boost/math/special_functions/ellint_2.hpp b/include/boost/math/special_functions/ellint_2.hpp index 501d36b66b..595c016d27 100644 --- a/include/boost/math/special_functions/ellint_2.hpp +++ b/include/boost/math/special_functions/ellint_2.hpp @@ -36,7 +36,7 @@ namespace boost { namespace math { -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED typename tools::promote_args::type ellint_2(T1 k, T2 phi, const Policy& pol); namespace detail{ @@ -726,14 +726,14 @@ BOOST_MATH_GPU_ENABLED typename tools::promote_args::type ellint_2(T1 k, } // detail // Elliptic integral (Legendre form) of the second kind -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED typename tools::promote_args::type ellint_2(T1 k, T2 phi) { typedef typename policies::is_policy::type tag_type; return detail::ellint_2(k, phi, tag_type()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED typename tools::promote_args::type ellint_2(T1 k, T2 phi, const Policy& pol) // LCOV_EXCL_LINE gcc misses this but sees the function body, strange! { typedef typename tools::promote_args::type result_type; @@ -743,7 +743,7 @@ BOOST_MATH_GPU_ENABLED typename tools::promote_args::type ellint_2(T1 k, // Complete elliptic integral (Legendre form) of the second kind -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED typename tools::promote_args::type ellint_2(T k) { return ellint_2(k, policies::policy<>()); diff --git a/include/boost/math/special_functions/ellint_3.hpp b/include/boost/math/special_functions/ellint_3.hpp index b8df7e2645..82d8bec187 100644 --- a/include/boost/math/special_functions/ellint_3.hpp +++ b/include/boost/math/special_functions/ellint_3.hpp @@ -340,7 +340,7 @@ BOOST_MATH_CUDA_ENABLED inline typename tools::promote_args::type ellint } // namespace detail -template +BOOST_MATH_EXPORT template BOOST_MATH_CUDA_ENABLED inline typename tools::promote_args::type ellint_3(T1 k, T2 v, T3 phi, const Policy&) { typedef typename tools::promote_args::type result_type; @@ -355,14 +355,14 @@ BOOST_MATH_CUDA_ENABLED inline typename tools::promote_args::type el forwarding_policy()), "boost::math::ellint_3<%1%>(%1%,%1%,%1%)"); } -template +BOOST_MATH_EXPORT template BOOST_MATH_CUDA_ENABLED typename detail::ellint_3_result::type ellint_3(T1 k, T2 v, T3 phi) { typedef typename policies::is_policy::type tag_type; return detail::ellint_3(k, v, phi, tag_type()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_CUDA_ENABLED inline typename tools::promote_args::type ellint_3(T1 k, T2 v) { return ellint_3(k, v, policies::policy<>()); diff --git a/include/boost/math/special_functions/ellint_d.hpp b/include/boost/math/special_functions/ellint_d.hpp index f5a8491f5a..f01928cb14 100644 --- a/include/boost/math/special_functions/ellint_d.hpp +++ b/include/boost/math/special_functions/ellint_d.hpp @@ -35,7 +35,7 @@ namespace boost { namespace math { -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED typename tools::promote_args::type ellint_d(T1 k, T2 phi, const Policy& pol); namespace detail{ @@ -155,21 +155,21 @@ BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type ellint_ } // detail // Complete elliptic integral (Legendre form) of the second kind -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type ellint_d(T k) { return ellint_d(k, policies::policy<>()); } // Elliptic integral (Legendre form) of the second kind -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type ellint_d(T1 k, T2 phi) { typedef typename policies::is_policy::type tag_type; return detail::ellint_d(k, phi, tag_type()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type ellint_d(T1 k, T2 phi, const Policy& pol) { typedef typename tools::promote_args::type result_type; diff --git a/include/boost/math/special_functions/ellint_rc.hpp b/include/boost/math/special_functions/ellint_rc.hpp index ae3c6375e5..912fccd5b4 100644 --- a/include/boost/math/special_functions/ellint_rc.hpp +++ b/include/boost/math/special_functions/ellint_rc.hpp @@ -87,7 +87,7 @@ BOOST_MATH_GPU_ENABLED T ellint_rc_imp(T x, T y, const Policy& pol) } // namespace detail -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type ellint_rc(T1 x, T2 y, const Policy& pol) { @@ -99,7 +99,7 @@ BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type static_cast(y), pol), "boost::math::ellint_rc<%1%>(%1%,%1%)"); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type ellint_rc(T1 x, T2 y) { diff --git a/include/boost/math/special_functions/ellint_rd.hpp b/include/boost/math/special_functions/ellint_rd.hpp index f2a33adc46..8e6bad4ad8 100644 --- a/include/boost/math/special_functions/ellint_rd.hpp +++ b/include/boost/math/special_functions/ellint_rd.hpp @@ -181,7 +181,7 @@ BOOST_MATH_GPU_ENABLED T ellint_rd_imp(T x, T y, T z, const Policy& pol) } // namespace detail -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type ellint_rd(T1 x, T2 y, T3 z, const Policy& pol) { @@ -194,7 +194,7 @@ BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type static_cast(z), pol), "boost::math::ellint_rd<%1%>(%1%,%1%,%1%)"); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type ellint_rd(T1 x, T2 y, T3 z) { diff --git a/include/boost/math/special_functions/ellint_rf.hpp b/include/boost/math/special_functions/ellint_rf.hpp index eb1c2b6e71..9d16bf8985 100644 --- a/include/boost/math/special_functions/ellint_rf.hpp +++ b/include/boost/math/special_functions/ellint_rf.hpp @@ -143,7 +143,7 @@ namespace boost { namespace math { namespace detail{ } // namespace detail -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type ellint_rf(T1 x, T2 y, T3 z, const Policy& pol) { @@ -156,7 +156,7 @@ BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type static_cast(z), pol), "boost::math::ellint_rf<%1%>(%1%,%1%,%1%)"); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type ellint_rf(T1 x, T2 y, T3 z) { diff --git a/include/boost/math/special_functions/ellint_rg.hpp b/include/boost/math/special_functions/ellint_rg.hpp index 8a7f706ac0..8958512ecc 100644 --- a/include/boost/math/special_functions/ellint_rg.hpp +++ b/include/boost/math/special_functions/ellint_rg.hpp @@ -104,7 +104,7 @@ namespace boost { namespace math { namespace detail{ } // namespace detail -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type ellint_rg(T1 x, T2 y, T3 z, const Policy& pol) { @@ -117,7 +117,7 @@ BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type static_cast(z), pol), "boost::math::ellint_rf<%1%>(%1%,%1%,%1%)"); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type ellint_rg(T1 x, T2 y, T3 z) { diff --git a/include/boost/math/special_functions/ellint_rj.hpp b/include/boost/math/special_functions/ellint_rj.hpp index 8c1f93788f..26f33c9566 100644 --- a/include/boost/math/special_functions/ellint_rj.hpp +++ b/include/boost/math/special_functions/ellint_rj.hpp @@ -271,7 +271,7 @@ BOOST_MATH_GPU_ENABLED T ellint_rj_imp(T x, T y, T z, T p, const Policy& pol) } // namespace detail -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type ellint_rj(T1 x, T2 y, T3 z, T4 p, const Policy& pol) { @@ -286,7 +286,7 @@ BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type pol), "boost::math::ellint_rj<%1%>(%1%,%1%,%1%,%1%)"); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type ellint_rj(T1 x, T2 y, T3 z, T4 p) { diff --git a/include/boost/math/special_functions/erf.hpp b/include/boost/math/special_functions/erf.hpp index dffb0c59cc..e07caf8f3f 100644 --- a/include/boost/math/special_functions/erf.hpp +++ b/include/boost/math/special_functions/erf.hpp @@ -1190,7 +1190,7 @@ T erf_imp(T z, bool invert, const Policy& pol, const std::integral_constant +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type erf(T z, const Policy& /* pol */) { typedef typename tools::promote_args::type result_type; @@ -1223,7 +1223,7 @@ BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type erf(T z, con tag_type()), "boost::math::erf<%1%>(%1%, %1%)"); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type erfc(T z, const Policy& /* pol */) { typedef typename tools::promote_args::type result_type; @@ -1256,13 +1256,13 @@ BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type erfc(T z, co tag_type()), "boost::math::erfc<%1%>(%1%, %1%)"); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type erf(T z) { return boost::math::erf(z, policies::policy<>()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type erfc(T z) { return boost::math::erfc(z, policies::policy<>()); @@ -1276,49 +1276,49 @@ BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type erfc(T z) namespace boost { namespace math { -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED auto erf(T x) { return ::erf(x); } -template <> +BOOST_MATH_EXPORT template <> BOOST_MATH_GPU_ENABLED auto erf(float x) { return ::erff(x); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED auto erf(T x, const Policy&) { return ::erf(x); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED auto erf(float x, const Policy&) { return ::erff(x); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED auto erfc(T x) { return ::erfc(x); } -template <> +BOOST_MATH_EXPORT template <> BOOST_MATH_GPU_ENABLED auto erfc(float x) { return ::erfcf(x); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED auto erfc(T x, const Policy&) { return ::erfc(x); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED auto erfc(float x, const Policy&) { return ::erfcf(x); diff --git a/include/boost/math/special_functions/expint.hpp b/include/boost/math/special_functions/expint.hpp index eeec63199e..756f50754a 100644 --- a/include/boost/math/special_functions/expint.hpp +++ b/include/boost/math/special_functions/expint.hpp @@ -38,7 +38,7 @@ namespace boost{ namespace math{ -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type expint(unsigned n, T z, const Policy& /*pol*/); @@ -1561,7 +1561,7 @@ expint_forwarder(unsigned n, T z, const boost::math::false_type&) } // namespace detail -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type expint(unsigned n, T z, const Policy& /*pol*/) { @@ -1588,7 +1588,7 @@ BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type tag_type()), "boost::math::expint<%1%>(unsigned, %1%)"); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename detail::expint_result::type expint(T const z, U const u) { @@ -1596,7 +1596,7 @@ BOOST_MATH_GPU_ENABLED inline typename detail::expint_result::type return detail::expint_forwarder(z, u, tag_type()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type expint(T z) { diff --git a/include/boost/math/special_functions/expm1.hpp b/include/boost/math/special_functions/expm1.hpp index e647c58929..490200aabb 100644 --- a/include/boost/math/special_functions/expm1.hpp +++ b/include/boost/math/special_functions/expm1.hpp @@ -262,7 +262,7 @@ namespace boost { } // namespace detail - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type expm1(T x, const Policy& /* pol */) { typedef typename tools::promote_args::type result_type; @@ -290,7 +290,7 @@ namespace boost { // // Since we now live in a post C++11 world, we can always defer to std::expm1 when appropriate: // - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline float expm1(float x, const Policy&) { BOOST_MATH_IF_CONSTEXPR(Policy::domain_error_type::value != boost::math::policies::ignore_error && Policy::domain_error_type::value != boost::math::policies::errno_on_error) @@ -306,7 +306,7 @@ namespace boost { return std::expm1(x); } #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS - template + BOOST_MATH_EXPORT template inline long double expm1(long double x, const Policy&) { BOOST_MATH_IF_CONSTEXPR(Policy::domain_error_type::value != boost::math::policies::ignore_error && Policy::domain_error_type::value != boost::math::policies::errno_on_error) @@ -322,7 +322,7 @@ namespace boost { return std::expm1(x); } #endif - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline double expm1(double x, const Policy&) { BOOST_MATH_IF_CONSTEXPR(Policy::domain_error_type::value != boost::math::policies::ignore_error && Policy::domain_error_type::value != boost::math::policies::errno_on_error) @@ -338,7 +338,7 @@ namespace boost { return std::expm1(x); } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type expm1(T x) { return expm1(x, policies::policy<>()); @@ -347,21 +347,21 @@ namespace boost { // Specific width floating point types: // #ifdef __STDCPP_FLOAT32_T__ - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline std::float32_t expm1(std::float32_t x, const Policy& pol) { return boost::math::expm1(static_cast(x), pol); } #endif #ifdef __STDCPP_FLOAT64_T__ - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline std::float64_t expm1(std::float64_t x, const Policy& pol) { return boost::math::expm1(static_cast(x), pol); } #endif #ifdef __STDCPP_FLOAT128_T__ - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline std::float128_t expm1(std::float128_t x, const Policy& pol) { if constexpr (std::numeric_limits::digits == std::numeric_limits::digits) @@ -382,25 +382,25 @@ namespace boost { namespace boost { namespace math { -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED auto expm1(T x) { return ::expm1(x); } -template <> +BOOST_MATH_EXPORT template <> BOOST_MATH_GPU_ENABLED auto expm1(float x) { return ::expm1f(x); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED auto expm1(T x, const Policy&) { return ::expm1(x); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED auto expm1(float x, const Policy&) { return ::expm1f(x); diff --git a/include/boost/math/special_functions/factorials.hpp b/include/boost/math/special_functions/factorials.hpp index ec6978bdc5..ec088d012d 100644 --- a/include/boost/math/special_functions/factorials.hpp +++ b/include/boost/math/special_functions/factorials.hpp @@ -29,7 +29,7 @@ namespace boost { namespace math { -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline T factorial(unsigned i, const Policy& pol) { static_assert(!boost::math::is_integral::value, "Type T must not be an integral type"); @@ -50,7 +50,7 @@ BOOST_MATH_GPU_ENABLED inline T factorial(unsigned i, const Policy& pol) return floor(result + 0.5f); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline T factorial(unsigned i) { return factorial(i, policies::policy<>()); @@ -73,7 +73,7 @@ inline double factorial(unsigned i) return tools::overflow_error(BOOST_CURRENT_FUNCTION); } */ -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED T double_factorial(unsigned i, const Policy& pol) { static_assert(!boost::math::is_integral::value, "Type T must not be an integral type"); @@ -108,7 +108,7 @@ BOOST_MATH_GPU_ENABLED T double_factorial(unsigned i, const Policy& pol) return policies::raise_overflow_error("boost::math::double_factorial<%1%>(unsigned)", 0, pol); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline T double_factorial(unsigned i) { return double_factorial(i, policies::policy<>()); @@ -231,7 +231,7 @@ inline T falling_factorial_imp(T x, unsigned n, const Policy& pol) } // namespace detail -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type falling_factorial(RT x, unsigned n) { @@ -240,7 +240,7 @@ inline typename tools::promote_args::type static_cast(x), n, policies::policy<>()); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type falling_factorial(RT x, unsigned n, const Policy& pol) { @@ -249,7 +249,7 @@ inline typename tools::promote_args::type static_cast(x), n, pol); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type rising_factorial(RT x, int n) { @@ -258,7 +258,7 @@ inline typename tools::promote_args::type static_cast(x), n, policies::policy<>()); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type rising_factorial(RT x, int n, const Policy& pol) { diff --git a/include/boost/math/special_functions/fibonacci.hpp b/include/boost/math/special_functions/fibonacci.hpp index b1cf435c9a..55b0d010a9 100644 --- a/include/boost/math/special_functions/fibonacci.hpp +++ b/include/boost/math/special_functions/fibonacci.hpp @@ -27,7 +27,7 @@ namespace detail { constexpr double fib_bits_deno = 1.1609640474436811739351597; } // namespace detail -template +BOOST_MATH_EXPORT template inline BOOST_MATH_CXX14_CONSTEXPR T unchecked_fibonacci(unsigned long long n) noexcept(std::is_fundamental::value) { // This function is called by the rest and computes the actual nth fibonacci number // First few fibonacci numbers: 0 (0th), 1 (1st), 1 (2nd), 2 (3rd), ... @@ -51,7 +51,7 @@ inline BOOST_MATH_CXX14_CONSTEXPR T unchecked_fibonacci(unsigned long long n) no return a; } -template +BOOST_MATH_EXPORT template T inline BOOST_MATH_CXX14_CONSTEXPR fibonacci(unsigned long long n, const Policy &pol) { // check for overflow using approximation to binet's formula: F_n ~ phi^n / sqrt(5) if (n > 20 && n * detail::fib_bits_phi - detail::fib_bits_deno > std::numeric_limits::digits) @@ -59,13 +59,13 @@ T inline BOOST_MATH_CXX14_CONSTEXPR fibonacci(unsigned long long n, const Policy return unchecked_fibonacci(n); } -template +BOOST_MATH_EXPORT template T inline BOOST_MATH_CXX14_CONSTEXPR fibonacci(unsigned long long n) { return fibonacci(n, policies::policy<>()); } // generator for next fibonacci number (see examples/reciprocal_fibonacci_constant.hpp) -template +BOOST_MATH_EXPORT template class fibonacci_generator { public: // return next fibonacci number diff --git a/include/boost/math/special_functions/fourier_transform_daubechies.hpp b/include/boost/math/special_functions/fourier_transform_daubechies.hpp index 7be4c71ff0..d148c3bed9 100644 --- a/include/boost/math/special_functions/fourier_transform_daubechies.hpp +++ b/include/boost/math/special_functions/fourier_transform_daubechies.hpp @@ -185,7 +185,7 @@ template constexpr std::array ft_daubechies * See more discusion near equation 6.1.1, * as well as efficiency gains from equation 7.1.4. */ -template std::complex fourier_transform_daubechies_scaling(Real omega) { +BOOST_MATH_EXPORT template std::complex fourier_transform_daubechies_scaling(Real omega) { // This arg promotion is kinda sad, but IMO the accuracy is not good enough in // float precision using this method. Requesting a better algorithm! if constexpr (std::is_same_v) { @@ -226,7 +226,7 @@ template std::complex fourier_transform_daubechie return phi * static_cast>(pow(prefactor, p)); } -template std::complex fourier_transform_daubechies_wavelet(Real omega) { +BOOST_MATH_EXPORT template std::complex fourier_transform_daubechies_wavelet(Real omega) { // See Daubechies, 10 Lectures on Wavelets, page 193, unlabelled equation in Theorem 6.3.6: // 𝓕[ψ](ω) = -exp(-iω/2)m₀(ω/2 + π)^{*}𝓕[𝜙](ω/2) if constexpr (std::is_same_v) { diff --git a/include/boost/math/special_functions/fpclassify.hpp b/include/boost/math/special_functions/fpclassify.hpp index 6f76920405..b87a6accd9 100644 --- a/include/boost/math/special_functions/fpclassify.hpp +++ b/include/boost/math/special_functions/fpclassify.hpp @@ -356,7 +356,7 @@ inline int fpclassify_imp BOOST_NO_MACRO_EXPAND(long double t, const native_tag& } // namespace detail -template +BOOST_MATH_EXPORT template inline int fpclassify BOOST_NO_MACRO_EXPAND(T t) { typedef typename detail::fp_traits::type traits; @@ -728,43 +728,43 @@ inline bool (isnan)(__float128 x) namespace boost { namespace math { -template , bool> = true> +BOOST_MATH_EXPORT template , bool> = true> BOOST_MATH_GPU_ENABLED inline bool isnan(T x) { return false; } -template , bool> = true> +BOOST_MATH_EXPORT template , bool> = true> BOOST_MATH_GPU_ENABLED inline bool isnan(T x) { return ::isnan(x); } -template , bool> = true> +BOOST_MATH_EXPORT template , bool> = true> BOOST_MATH_GPU_ENABLED inline bool isinf(T x) { return false; } -template , bool> = true> +BOOST_MATH_EXPORT template , bool> = true> BOOST_MATH_GPU_ENABLED inline bool isinf(T x) { return ::isinf(x); } -template , bool> = true> +BOOST_MATH_EXPORT template , bool> = true> BOOST_MATH_GPU_ENABLED inline bool isfinite(T x) { return true; } -template , bool> = true> +BOOST_MATH_EXPORT template , bool> = true> BOOST_MATH_GPU_ENABLED inline bool isfinite(T x) { return ::isfinite(x); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline bool isnormal(T x) { return x != static_cast(0) && x != static_cast(-0) && @@ -773,7 +773,7 @@ BOOST_MATH_GPU_ENABLED inline bool isnormal(T x) } // We skip the check for FP_SUBNORMAL since they are not supported on these platforms -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline int fpclassify(T x) { if (boost::math::isnan(x)) diff --git a/include/boost/math/special_functions/gamma.hpp b/include/boost/math/special_functions/gamma.hpp index a9c17da882..d549158791 100644 --- a/include/boost/math/special_functions/gamma.hpp +++ b/include/boost/math/special_functions/gamma.hpp @@ -2320,7 +2320,7 @@ BOOST_MATH_GPU_ENABLED inline tools::promote_args_t } // namespace detail -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type lgamma(T z, int* sign, const Policy&) { @@ -2338,28 +2338,28 @@ BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type return policies::checked_narrowing_cast(detail::lgamma_imp(static_cast(z), forwarding_policy(), evaluation_type(), sign), "boost::math::lgamma<%1%>(%1%)"); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type lgamma(T z, int* sign) { return lgamma(z, sign, policies::policy<>()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type lgamma(T x, const Policy& pol) { return ::boost::math::lgamma(x, nullptr, pol); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type lgamma(T x) { return ::boost::math::lgamma(x, nullptr, policies::policy<>()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type tgamma1pm1(T z, const Policy& /* pol */) { @@ -2377,7 +2377,7 @@ BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type return policies::checked_narrowing_cast::type, forwarding_policy>(detail::tgammap1m1_imp(static_cast(z), forwarding_policy(), evaluation_type()), "boost::math::tgamma1pm1<%!%>(%1%)"); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type tgamma1pm1(T z) { @@ -2387,7 +2387,7 @@ BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type // // Full upper incomplete gamma: // -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline tools::promote_args_t tgamma(T1 a, T2 z) { @@ -2399,14 +2399,14 @@ BOOST_MATH_GPU_ENABLED inline tools::promote_args_t using result_type = tools::promote_args_t; return static_cast(detail::tgamma(a, z, maybe_policy())); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline tools::promote_args_t tgamma(T1 a, T2 z, const Policy& pol) { using result_type = tools::promote_args_t; return static_cast(detail::tgamma(a, z, pol, boost::math::false_type())); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type tgamma(T z) { @@ -2415,7 +2415,7 @@ BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type // // Full lower incomplete gamma: // -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline tools::promote_args_t tgamma_lower(T1 a, T2 z, const Policy&) { @@ -2435,7 +2435,7 @@ BOOST_MATH_GPU_ENABLED inline tools::promote_args_t static_cast(z), false, false, forwarding_policy(), static_cast(nullptr)), "tgamma_lower<%1%>(%1%, %1%)"); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline tools::promote_args_t tgamma_lower(T1 a, T2 z) { @@ -2444,7 +2444,7 @@ BOOST_MATH_GPU_ENABLED inline tools::promote_args_t // // Regularised upper incomplete gamma: // -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline tools::promote_args_t gamma_q(T1 a, T2 z, const Policy& /* pol */) { @@ -2464,14 +2464,14 @@ BOOST_MATH_GPU_ENABLED inline tools::promote_args_t static_cast(z), true, true, forwarding_policy(), static_cast(nullptr)), "gamma_q<%1%>(%1%, %1%)"); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline tools::promote_args_t gamma_q(T1 a, T2 z) { return gamma_q(a, z, policies::policy<>()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline tools::promote_args_t lgamma_q(T1 a, T2 z, const Policy& /* pol */) { typedef tools::promote_args_t result_type; @@ -2488,13 +2488,13 @@ BOOST_MATH_GPU_ENABLED inline tools::promote_args_t lgamma_q(T1 a, T2 z, static_cast(z), forwarding_policy()), "lgamma_q<%1%>(%1%, %1%)"); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline tools::promote_args_t lgamma_q(T1 a, T2 z) { return lgamma_q(a, z, policies::policy<>()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline tools::promote_args_t lgamma_p(T1 a, T2 z, const Policy& /* pol */) { typedef tools::promote_args_t result_type; @@ -2511,7 +2511,7 @@ BOOST_MATH_GPU_ENABLED inline tools::promote_args_t lgamma_p(T1 a, T2 z, static_cast(z), forwarding_policy()), "lgamma_p<%1%>(%1%, %1%)"); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline tools::promote_args_t lgamma_p(T1 a, T2 z) { return lgamma_p(a, z, policies::policy<>()); @@ -2519,7 +2519,7 @@ BOOST_MATH_GPU_ENABLED inline tools::promote_args_t lgamma_p(T1 a, T2 z) // // Regularised lower incomplete gamma: // -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline tools::promote_args_t gamma_p(T1 a, T2 z, const Policy&) { @@ -2539,7 +2539,7 @@ BOOST_MATH_GPU_ENABLED inline tools::promote_args_t static_cast(z), true, false, forwarding_policy(), static_cast(nullptr)), "gamma_p<%1%>(%1%, %1%)"); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline tools::promote_args_t gamma_p(T1 a, T2 z) { @@ -2547,7 +2547,7 @@ BOOST_MATH_GPU_ENABLED inline tools::promote_args_t } // ratios of gamma functions: -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline tools::promote_args_t tgamma_delta_ratio(T1 z, T2 delta, const Policy& /* pol */) { @@ -2563,13 +2563,13 @@ BOOST_MATH_GPU_ENABLED inline tools::promote_args_t return policies::checked_narrowing_cast(detail::tgamma_delta_ratio_imp(static_cast(z), static_cast(delta), forwarding_policy()), "boost::math::tgamma_delta_ratio<%1%>(%1%, %1%)"); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline tools::promote_args_t tgamma_delta_ratio(T1 z, T2 delta) { return tgamma_delta_ratio(z, delta, policies::policy<>()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline tools::promote_args_t tgamma_ratio(T1 a, T2 b, const Policy&) { @@ -2584,14 +2584,14 @@ BOOST_MATH_GPU_ENABLED inline tools::promote_args_t return policies::checked_narrowing_cast(detail::tgamma_ratio_imp(static_cast(a), static_cast(b), forwarding_policy()), "boost::math::tgamma_delta_ratio<%1%>(%1%, %1%)"); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline tools::promote_args_t tgamma_ratio(T1 a, T2 b) { return tgamma_ratio(a, b, policies::policy<>()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline tools::promote_args_t gamma_p_derivative(T1 a, T2 x, const Policy&) { @@ -2607,7 +2607,7 @@ BOOST_MATH_GPU_ENABLED inline tools::promote_args_t return policies::checked_narrowing_cast(detail::gamma_p_derivative_imp(static_cast(a), static_cast(x), forwarding_policy()), "boost::math::gamma_p_derivative<%1%>(%1%, %1%)"); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline tools::promote_args_t gamma_p_derivative(T1 a, T2 x) { diff --git a/include/boost/math/special_functions/gegenbauer.hpp b/include/boost/math/special_functions/gegenbauer.hpp index 6dc032a578..a4651424a0 100644 --- a/include/boost/math/special_functions/gegenbauer.hpp +++ b/include/boost/math/special_functions/gegenbauer.hpp @@ -19,7 +19,7 @@ namespace boost { namespace math { -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED Real gegenbauer(unsigned n, Real lambda, Real x) { static_assert(!boost::math::is_integral::value, "Gegenbauer polynomials required floating point arguments."); @@ -61,7 +61,7 @@ BOOST_MATH_GPU_ENABLED Real gegenbauer(unsigned n, Real lambda, Real x) } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED Real gegenbauer_derivative(unsigned n, Real lambda, Real x, unsigned k) { if (k > n) { @@ -76,7 +76,7 @@ BOOST_MATH_GPU_ENABLED Real gegenbauer_derivative(unsigned n, Real lambda, Real return scale*gegen; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED Real gegenbauer_prime(unsigned n, Real lambda, Real x) { return gegenbauer_derivative(n, lambda, x, 1); } diff --git a/include/boost/math/special_functions/hankel.hpp b/include/boost/math/special_functions/hankel.hpp index 730c7afa03..e4e27e9723 100644 --- a/include/boost/math/special_functions/hankel.hpp +++ b/include/boost/math/special_functions/hankel.hpp @@ -104,7 +104,7 @@ BOOST_MATH_GPU_ENABLED inline boost::math::complex sph_hankel_imp(T v, T x, c } // namespace detail -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline boost::math::complex::result_type> cyl_hankel_1(T1 v, T2 x, const Policy& pol) { BOOST_FPU_EXCEPTION_GUARD @@ -114,13 +114,13 @@ BOOST_MATH_GPU_ENABLED inline boost::math::complex, Policy>(detail::hankel_imp(v, static_cast(x), tag_type(), pol, 1), "boost::math::cyl_hankel_1<%1%>(%1%,%1%)"); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline boost::math::complex >::result_type> cyl_hankel_1(T1 v, T2 x) { return cyl_hankel_1(v, x, policies::policy<>()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline boost::math::complex::result_type> cyl_hankel_2(T1 v, T2 x, const Policy& pol) { BOOST_FPU_EXCEPTION_GUARD @@ -130,13 +130,13 @@ BOOST_MATH_GPU_ENABLED inline boost::math::complex, Policy>(detail::hankel_imp(v, static_cast(x), tag_type(), pol, -1), "boost::math::cyl_hankel_1<%1%>(%1%,%1%)"); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline boost::math::complex >::result_type> cyl_hankel_2(T1 v, T2 x) { return cyl_hankel_2(v, x, policies::policy<>()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline boost::math::complex::result_type> sph_hankel_1(T1 v, T2 x, const Policy&) { BOOST_FPU_EXCEPTION_GUARD @@ -152,13 +152,13 @@ BOOST_MATH_GPU_ENABLED inline boost::math::complex, Policy>(detail::sph_hankel_imp(static_cast(v), static_cast(x), forwarding_policy(), 1), "boost::math::sph_hankel_1<%1%>(%1%,%1%)"); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline boost::math::complex >::result_type> sph_hankel_1(T1 v, T2 x) { return sph_hankel_1(v, x, policies::policy<>()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline boost::math::complex::result_type> sph_hankel_2(T1 v, T2 x, const Policy&) { BOOST_FPU_EXCEPTION_GUARD @@ -174,7 +174,7 @@ BOOST_MATH_GPU_ENABLED inline boost::math::complex, Policy>(detail::sph_hankel_imp(static_cast(v), static_cast(x), forwarding_policy(), -1), "boost::math::sph_hankel_1<%1%>(%1%,%1%)"); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline boost::math::complex >::result_type> sph_hankel_2(T1 v, T2 x) { return sph_hankel_2(v, x, policies::policy<>()); diff --git a/include/boost/math/special_functions/hermite.hpp b/include/boost/math/special_functions/hermite.hpp index 3d77fc03e3..7c6d74a91c 100644 --- a/include/boost/math/special_functions/hermite.hpp +++ b/include/boost/math/special_functions/hermite.hpp @@ -21,7 +21,7 @@ namespace boost{ namespace math{ // Recurrence relation for Hermite polynomials: -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type hermite_next(unsigned n, T1 x, T2 Hn, T3 Hnm1) { @@ -54,7 +54,7 @@ BOOST_MATH_GPU_ENABLED T hermite_imp(unsigned n, T x) } // namespace detail -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type hermite(unsigned n, T x, const Policy&) { @@ -63,7 +63,7 @@ BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type return policies::checked_narrowing_cast(detail::hermite_imp(n, static_cast(x)), "boost::math::hermite<%1%>(unsigned, %1%)"); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type hermite(unsigned n, T x) { diff --git a/include/boost/math/special_functions/heuman_lambda.hpp b/include/boost/math/special_functions/heuman_lambda.hpp index 05002725f2..cf1af9ea98 100644 --- a/include/boost/math/special_functions/heuman_lambda.hpp +++ b/include/boost/math/special_functions/heuman_lambda.hpp @@ -77,7 +77,7 @@ BOOST_MATH_GPU_ENABLED T heuman_lambda_imp(T phi, T k, const Policy& pol) } // detail -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type heuman_lambda(T1 k, T2 phi, const Policy& pol) { typedef typename tools::promote_args::type result_type; @@ -85,7 +85,7 @@ BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type heuman_ return policies::checked_narrowing_cast(detail::heuman_lambda_imp(static_cast(phi), static_cast(k), pol), "boost::math::heuman_lambda<%1%>(%1%,%1%)"); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type heuman_lambda(T1 k, T2 phi) { return boost::math::heuman_lambda(k, phi, policies::policy<>()); diff --git a/include/boost/math/special_functions/hypergeometric_0F1.hpp b/include/boost/math/special_functions/hypergeometric_0F1.hpp index a721e7e462..0a31a7e5fc 100644 --- a/include/boost/math/special_functions/hypergeometric_0F1.hpp +++ b/include/boost/math/special_functions/hypergeometric_0F1.hpp @@ -84,7 +84,7 @@ namespace boost { namespace math { namespace detail { } // namespace detail -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type hypergeometric_0F1(T1 b, T2 z, const Policy& /* pol */) { BOOST_FPU_EXCEPTION_GUARD @@ -104,7 +104,7 @@ inline typename tools::promote_args::type hypergeometric_0F1(T1 b, T2 z, "boost::math::hypergeometric_0F1<%1%>(%1%,%1%)"); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type hypergeometric_0F1(T1 b, T2 z) { return hypergeometric_0F1(b, z, policies::policy<>()); diff --git a/include/boost/math/special_functions/hypergeometric_1F0.hpp b/include/boost/math/special_functions/hypergeometric_1F0.hpp index 3fbf81ba8d..630e29a9ef 100644 --- a/include/boost/math/special_functions/hypergeometric_1F0.hpp +++ b/include/boost/math/special_functions/hypergeometric_1F0.hpp @@ -37,7 +37,7 @@ inline T hypergeometric_1F0_imp(const T& a, const T& z, const Policy& pol) } // namespace detail -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type hypergeometric_1F0(T1 a, T2 z, const Policy&) { BOOST_FPU_EXCEPTION_GUARD @@ -57,7 +57,7 @@ inline typename tools::promote_args::type hypergeometric_1F0(T1 a, T2 z, "boost::math::hypergeometric_1F0<%1%>(%1%,%1%)"); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type hypergeometric_1F0(T1 a, T2 z) { return hypergeometric_1F0(a, z, policies::policy<>()); diff --git a/include/boost/math/special_functions/hypergeometric_1F1.hpp b/include/boost/math/special_functions/hypergeometric_1F1.hpp index 21e25670c8..5b24c58cd9 100644 --- a/include/boost/math/special_functions/hypergeometric_1F1.hpp +++ b/include/boost/math/special_functions/hypergeometric_1F1.hpp @@ -706,7 +706,7 @@ namespace boost { namespace math { namespace detail { } // namespace detail -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type hypergeometric_1F1(T1 a, T2 b, T3 z, const Policy& /* pol */) { BOOST_FPU_EXCEPTION_GUARD @@ -727,13 +727,13 @@ inline typename tools::promote_args::type hypergeometric_1F1(T1 a, T "boost::math::hypergeometric_1F1<%1%>(%1%,%1%,%1%)"); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type hypergeometric_1F1(T1 a, T2 b, T3 z) { return hypergeometric_1F1(a, b, z, policies::policy<>()); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type hypergeometric_1F1_regularized(T1 a, T2 b, T3 z, const Policy& /* pol */) { BOOST_FPU_EXCEPTION_GUARD @@ -754,13 +754,13 @@ inline typename tools::promote_args::type hypergeometric_1F1_regular "boost::math::hypergeometric_1F1<%1%>(%1%,%1%,%1%)"); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type hypergeometric_1F1_regularized(T1 a, T2 b, T3 z) { return hypergeometric_1F1_regularized(a, b, z, policies::policy<>()); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type log_hypergeometric_1F1(T1 a, T2 b, T3 z, const Policy& /* pol */) { BOOST_FPU_EXCEPTION_GUARD @@ -782,13 +782,13 @@ inline typename tools::promote_args::type log_hypergeometric_1F1(T1 "boost::math::hypergeometric_1F1<%1%>(%1%,%1%,%1%)"); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type log_hypergeometric_1F1(T1 a, T2 b, T3 z) { return log_hypergeometric_1F1(a, b, z, policies::policy<>()); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type log_hypergeometric_1F1(T1 a, T2 b, T3 z, int* sign, const Policy& /* pol */) { BOOST_FPU_EXCEPTION_GUARD @@ -810,7 +810,7 @@ inline typename tools::promote_args::type log_hypergeometric_1F1(T1 "boost::math::hypergeometric_1F1<%1%>(%1%,%1%,%1%)"); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type log_hypergeometric_1F1(T1 a, T2 b, T3 z, int* sign) { return log_hypergeometric_1F1(a, b, z, sign, policies::policy<>()); diff --git a/include/boost/math/special_functions/hypergeometric_2F0.hpp b/include/boost/math/special_functions/hypergeometric_2F0.hpp index d22e6a029d..ea95d6ad2a 100644 --- a/include/boost/math/special_functions/hypergeometric_2F0.hpp +++ b/include/boost/math/special_functions/hypergeometric_2F0.hpp @@ -130,7 +130,7 @@ namespace boost { namespace math { namespace detail { } // namespace detail -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type hypergeometric_2F0(T1 a1, T2 a2, T3 z, const Policy& /* pol */) { BOOST_FPU_EXCEPTION_GUARD @@ -151,7 +151,7 @@ inline typename tools::promote_args::type hypergeometric_2F0(T1 a1, "boost::math::hypergeometric_2F0<%1%>(%1%,%1%,%1%)"); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type hypergeometric_2F0(T1 a1, T2 a2, T3 z) { return hypergeometric_2F0(a1, a2, z, policies::policy<>()); diff --git a/include/boost/math/special_functions/hypergeometric_pFq.hpp b/include/boost/math/special_functions/hypergeometric_pFq.hpp index 3b4c609555..369a60dae7 100644 --- a/include/boost/math/special_functions/hypergeometric_pFq.hpp +++ b/include/boost/math/special_functions/hypergeometric_pFq.hpp @@ -45,7 +45,7 @@ namespace boost { } - template + BOOST_MATH_EXPORT template inline typename tools::promote_args::type hypergeometric_pFq(const Seq& aj, const Seq& bj, const Real& z, Real* p_abs_error, const Policy& pol) { typedef typename tools::promote_args::type result_type; @@ -78,19 +78,19 @@ namespace boost { return policies::checked_narrowing_cast(r.first, function); } - template + BOOST_MATH_EXPORT template inline typename tools::promote_args::type hypergeometric_pFq(const Seq& aj, const Seq& bj, const Real& z, Real* p_abs_error = 0) { return hypergeometric_pFq(aj, bj, z, p_abs_error, boost::math::policies::policy<>()); } - template + BOOST_MATH_EXPORT template inline typename tools::promote_args::type hypergeometric_pFq(const std::initializer_list& aj, const std::initializer_list& bj, const Real& z, Real* p_abs_error, const Policy& pol) { return hypergeometric_pFq, Real, Policy>(aj, bj, z, p_abs_error, pol); } - template + BOOST_MATH_EXPORT template inline typename tools::promote_args::type hypergeometric_pFq(const std::initializer_list& aj, const std::initializer_list& bj, const Real& z, Real* p_abs_error = nullptr) { return hypergeometric_pFq, Real>(aj, bj, z, p_abs_error); @@ -112,7 +112,7 @@ namespace boost { unsigned old_p; }; - template + BOOST_MATH_EXPORT template Real hypergeometric_pFq_precision(const Seq& aj, const Seq& bj, Real z, unsigned digits10, double timeout, const Policy& pol) { unsigned current_precision = digits10 + 5; @@ -184,18 +184,18 @@ namespace boost { return r; } - template + BOOST_MATH_EXPORT template Real hypergeometric_pFq_precision(const Seq& aj, const Seq& bj, const Real& z, unsigned digits10, double timeout = 0.5) { return hypergeometric_pFq_precision(aj, bj, z, digits10, timeout, boost::math::policies::policy<>()); } - template + BOOST_MATH_EXPORT template Real hypergeometric_pFq_precision(const std::initializer_list& aj, const std::initializer_list& bj, const Real& z, unsigned digits10, double timeout, const Policy& pol) { return hypergeometric_pFq_precision< std::initializer_list, Real>(aj, bj, z, digits10, timeout, pol); } - template + BOOST_MATH_EXPORT template Real hypergeometric_pFq_precision(const std::initializer_list& aj, const std::initializer_list& bj, const Real& z, unsigned digits10, double timeout = 0.5) { return hypergeometric_pFq_precision< std::initializer_list, Real>(aj, bj, z, digits10, timeout, boost::math::policies::policy<>()); diff --git a/include/boost/math/special_functions/hypot.hpp b/include/boost/math/special_functions/hypot.hpp index 66a9492541..8d1824877d 100644 --- a/include/boost/math/special_functions/hypot.hpp +++ b/include/boost/math/special_functions/hypot.hpp @@ -99,7 +99,7 @@ BOOST_MATH_GPU_ENABLED T hypot_imp(T x, T y, T z, const Policy& pol) } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type hypot(T1 x, T2 y) { @@ -108,7 +108,7 @@ BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type static_cast(x), static_cast(y), policies::policy<>()); } -template , bool>> +BOOST_MATH_EXPORT template , bool>> BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type hypot(T1 x, T2 y, const Policy& pol) { @@ -117,7 +117,7 @@ BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type static_cast(x), static_cast(y), pol); } -template , bool>> +BOOST_MATH_EXPORT template , bool>> BOOST_MATH_GPU_ENABLED inline tools::promote_args_t hypot(T1 x, T2 y, T3 z) { @@ -128,7 +128,7 @@ BOOST_MATH_GPU_ENABLED inline tools::promote_args_t policies::policy<>()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline tools::promote_args_t hypot(T1 x, T2 y, T3 z, const Policy& pol) { diff --git a/include/boost/math/special_functions/jacobi.hpp b/include/boost/math/special_functions/jacobi.hpp index fb450faf39..e83f4778a9 100644 --- a/include/boost/math/special_functions/jacobi.hpp +++ b/include/boost/math/special_functions/jacobi.hpp @@ -11,9 +11,11 @@ #include #endif +#include + namespace boost { namespace math { -template +BOOST_MATH_EXPORT template Real jacobi(unsigned n, Real alpha, Real beta, Real x) { static_assert(!std::is_integral::value, "Jacobi polynomials do not work with integer arguments."); @@ -41,7 +43,7 @@ Real jacobi(unsigned n, Real alpha, Real beta, Real x) return yk; } -template +BOOST_MATH_EXPORT template Real jacobi_derivative(unsigned n, Real alpha, Real beta, Real x, unsigned k) { if (k > n) { @@ -55,13 +57,13 @@ Real jacobi_derivative(unsigned n, Real alpha, Real beta, Real x, unsigned k) return scale*jacobi(n-k, alpha + k, beta+k, x); } -template +BOOST_MATH_EXPORT template Real jacobi_prime(unsigned n, Real alpha, Real beta, Real x) { return jacobi_derivative(n, alpha, beta, x, 1); } -template +BOOST_MATH_EXPORT template Real jacobi_double_prime(unsigned n, Real alpha, Real beta, Real x) { return jacobi_derivative(n, alpha, beta, x, 2); diff --git a/include/boost/math/special_functions/jacobi_elliptic.hpp b/include/boost/math/special_functions/jacobi_elliptic.hpp index 149e9fb1ca..4c17da1cd8 100644 --- a/include/boost/math/special_functions/jacobi_elliptic.hpp +++ b/include/boost/math/special_functions/jacobi_elliptic.hpp @@ -114,7 +114,7 @@ T jacobi_imp(const T& x, const T& k, T* cn, T* dn, const Policy& pol, const char } // namespace detail -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_elliptic(T k, U theta, V* pcn, V* pdn, const Policy&) { BOOST_FPU_EXCEPTION_GUARD @@ -138,26 +138,26 @@ inline typename tools::promote_args::type jacobi_elliptic(T k, U theta, return policies::checked_narrowing_cast(sn, function); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_elliptic(T k, U theta, V* pcn, V* pdn) { return jacobi_elliptic(k, theta, pcn, pdn, policies::policy<>()); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_sn(U k, T theta, const Policy& pol) { typedef typename tools::promote_args::type result_type; return jacobi_elliptic(static_cast(k), static_cast(theta), static_cast(nullptr), static_cast(nullptr), pol); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_sn(U k, T theta) { return jacobi_sn(k, theta, policies::policy<>()); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_cn(T k, U theta, const Policy& pol) { typedef typename tools::promote_args::type result_type; @@ -166,13 +166,13 @@ inline typename tools::promote_args::type jacobi_cn(T k, U theta, const Po return cn; } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_cn(T k, U theta) { return jacobi_cn(k, theta, policies::policy<>()); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_dn(T k, U theta, const Policy& pol) { typedef typename tools::promote_args::type result_type; @@ -181,13 +181,13 @@ inline typename tools::promote_args::type jacobi_dn(T k, U theta, const Po return dn; } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_dn(T k, U theta) { return jacobi_dn(k, theta, policies::policy<>()); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_cd(T k, U theta, const Policy& pol) { typedef typename tools::promote_args::type result_type; @@ -196,13 +196,13 @@ inline typename tools::promote_args::type jacobi_cd(T k, U theta, const Po return cn / dn; } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_cd(T k, U theta) { return jacobi_cd(k, theta, policies::policy<>()); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_dc(T k, U theta, const Policy& pol) { typedef typename tools::promote_args::type result_type; @@ -211,26 +211,26 @@ inline typename tools::promote_args::type jacobi_dc(T k, U theta, const Po return dn / cn; } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_dc(T k, U theta) { return jacobi_dc(k, theta, policies::policy<>()); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_ns(T k, U theta, const Policy& pol) { typedef typename tools::promote_args::type result_type; return 1 / jacobi_elliptic(static_cast(k), static_cast(theta), static_cast(nullptr), static_cast(nullptr), pol); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_ns(T k, U theta) { return jacobi_ns(k, theta, policies::policy<>()); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_sd(T k, U theta, const Policy& pol) { typedef typename tools::promote_args::type result_type; @@ -239,13 +239,13 @@ inline typename tools::promote_args::type jacobi_sd(T k, U theta, const Po return sn / dn; } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_sd(T k, U theta) { return jacobi_sd(k, theta, policies::policy<>()); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_ds(T k, U theta, const Policy& pol) { typedef typename tools::promote_args::type result_type; @@ -254,37 +254,37 @@ inline typename tools::promote_args::type jacobi_ds(T k, U theta, const Po return dn / sn; } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_ds(T k, U theta) { return jacobi_ds(k, theta, policies::policy<>()); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_nc(T k, U theta, const Policy& pol) { return 1 / jacobi_cn(k, theta, pol); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_nc(T k, U theta) { return jacobi_nc(k, theta, policies::policy<>()); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_nd(T k, U theta, const Policy& pol) { return 1 / jacobi_dn(k, theta, pol); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_nd(T k, U theta) { return jacobi_nd(k, theta, policies::policy<>()); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_sc(T k, U theta, const Policy& pol) { typedef typename tools::promote_args::type result_type; @@ -293,13 +293,13 @@ inline typename tools::promote_args::type jacobi_sc(T k, U theta, const Po return sn / cn; } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_sc(T k, U theta) { return jacobi_sc(k, theta, policies::policy<>()); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_cs(T k, U theta, const Policy& pol) { typedef typename tools::promote_args::type result_type; @@ -308,7 +308,7 @@ inline typename tools::promote_args::type jacobi_cs(T k, U theta, const Po return cn / sn; } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_cs(T k, U theta) { return jacobi_cs(k, theta, policies::policy<>()); diff --git a/include/boost/math/special_functions/jacobi_theta.hpp b/include/boost/math/special_functions/jacobi_theta.hpp index e3e17e7e03..9af5a3e559 100644 --- a/include/boost/math/special_functions/jacobi_theta.hpp +++ b/include/boost/math/special_functions/jacobi_theta.hpp @@ -109,65 +109,65 @@ namespace boost{ namespace math{ // Simple functions - parameterized by q -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta1(T z, U q); -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta2(T z, U q); -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta3(T z, U q); -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta4(T z, U q); // Simple functions - parameterized by tau (assumed imaginary) // q = exp(i*PI*TAU) // tau = -log(q)/PI -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta1tau(T z, U tau); -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta2tau(T z, U tau); -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta3tau(T z, U tau); -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta4tau(T z, U tau); // Minus one versions for small q / large tau -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta3m1(T z, U q); -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta4m1(T z, U q); -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta3m1tau(T z, U tau); -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta4m1tau(T z, U tau); // Policied versions - parameterized by q -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta1(T z, U q, const Policy& pol); -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta2(T z, U q, const Policy& pol); -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta3(T z, U q, const Policy& pol); -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta4(T z, U q, const Policy& pol); // Policied versions - parameterized by tau -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta1tau(T z, U tau, const Policy& pol); -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta2tau(T z, U tau, const Policy& pol); -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta3tau(T z, U tau, const Policy& pol); -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta4tau(T z, U tau, const Policy& pol); // Policied m1 functions -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta3m1(T z, U q, const Policy& pol); -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta4m1(T z, U q, const Policy& pol); -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta3m1tau(T z, U tau, const Policy& pol); -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta4m1tau(T z, U tau, const Policy& pol); // Compare the non-oscillating component of the delta to the previous delta. @@ -543,7 +543,7 @@ jacobi_theta4_imp(RealType z, RealType q, const Policy& pol, const char *functio // Begin public API -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta1tau(T z, U tau, const Policy&) { BOOST_FPU_EXCEPTION_GUARD typedef typename tools::promote_args::type result_type; @@ -559,12 +559,12 @@ inline typename tools::promote_args::type jacobi_theta1tau(T z, U tau, con return policies::checked_narrowing_cast(jacobi_theta1tau_imp(static_cast(z), static_cast(tau), forwarding_policy(), function), function); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta1tau(T z, U tau) { return jacobi_theta1tau(z, tau, policies::policy<>()); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta1(T z, U q, const Policy&) { BOOST_FPU_EXCEPTION_GUARD typedef typename tools::promote_args::type result_type; @@ -580,12 +580,12 @@ inline typename tools::promote_args::type jacobi_theta1(T z, U q, const Po return policies::checked_narrowing_cast(jacobi_theta1_imp(static_cast(z), static_cast(q), forwarding_policy(), function), function); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta1(T z, U q) { return jacobi_theta1(z, q, policies::policy<>()); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta2tau(T z, U tau, const Policy&) { BOOST_FPU_EXCEPTION_GUARD typedef typename tools::promote_args::type result_type; @@ -601,12 +601,12 @@ inline typename tools::promote_args::type jacobi_theta2tau(T z, U tau, con return policies::checked_narrowing_cast(jacobi_theta2tau_imp(static_cast(z), static_cast(tau), forwarding_policy(), function), function); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta2tau(T z, U tau) { return jacobi_theta2tau(z, tau, policies::policy<>()); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta2(T z, U q, const Policy&) { BOOST_FPU_EXCEPTION_GUARD typedef typename tools::promote_args::type result_type; @@ -622,12 +622,12 @@ inline typename tools::promote_args::type jacobi_theta2(T z, U q, const Po return policies::checked_narrowing_cast(jacobi_theta2_imp(static_cast(z), static_cast(q), forwarding_policy(), function), function); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta2(T z, U q) { return jacobi_theta2(z, q, policies::policy<>()); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta3m1tau(T z, U tau, const Policy&) { BOOST_FPU_EXCEPTION_GUARD typedef typename tools::promote_args::type result_type; @@ -644,12 +644,12 @@ inline typename tools::promote_args::type jacobi_theta3m1tau(T z, U tau, c jacobi_theta3m1tau_imp(static_cast(z), static_cast(tau), forwarding_policy()), function); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta3m1tau(T z, U tau) { return jacobi_theta3m1tau(z, tau, policies::policy<>()); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta3tau(T z, U tau, const Policy&) { BOOST_FPU_EXCEPTION_GUARD typedef typename tools::promote_args::type result_type; @@ -665,13 +665,13 @@ inline typename tools::promote_args::type jacobi_theta3tau(T z, U tau, con return policies::checked_narrowing_cast(jacobi_theta3tau_imp(static_cast(z), static_cast(tau), forwarding_policy(), function), function); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta3tau(T z, U tau) { return jacobi_theta3tau(z, tau, policies::policy<>()); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta3m1(T z, U q, const Policy&) { BOOST_FPU_EXCEPTION_GUARD typedef typename tools::promote_args::type result_type; @@ -687,12 +687,12 @@ inline typename tools::promote_args::type jacobi_theta3m1(T z, U q, const return policies::checked_narrowing_cast(jacobi_theta3m1_imp(static_cast(z), static_cast(q), forwarding_policy(), function), function); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta3m1(T z, U q) { return jacobi_theta3m1(z, q, policies::policy<>()); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta3(T z, U q, const Policy&) { BOOST_FPU_EXCEPTION_GUARD typedef typename tools::promote_args::type result_type; @@ -708,12 +708,12 @@ inline typename tools::promote_args::type jacobi_theta3(T z, U q, const Po return policies::checked_narrowing_cast(jacobi_theta3_imp(static_cast(z), static_cast(q), forwarding_policy(), function), function); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta3(T z, U q) { return jacobi_theta3(z, q, policies::policy<>()); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta4m1tau(T z, U tau, const Policy&) { BOOST_FPU_EXCEPTION_GUARD typedef typename tools::promote_args::type result_type; @@ -729,12 +729,12 @@ inline typename tools::promote_args::type jacobi_theta4m1tau(T z, U tau, c return policies::checked_narrowing_cast(jacobi_theta4m1tau_imp(static_cast(z), static_cast(tau), forwarding_policy()), function); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta4m1tau(T z, U tau) { return jacobi_theta4m1tau(z, tau, policies::policy<>()); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta4tau(T z, U tau, const Policy&) { BOOST_FPU_EXCEPTION_GUARD typedef typename tools::promote_args::type result_type; @@ -750,12 +750,12 @@ inline typename tools::promote_args::type jacobi_theta4tau(T z, U tau, con return policies::checked_narrowing_cast(jacobi_theta4tau_imp(static_cast(z), static_cast(tau), forwarding_policy(), function), function); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta4tau(T z, U tau) { return jacobi_theta4tau(z, tau, policies::policy<>()); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta4m1(T z, U q, const Policy&) { BOOST_FPU_EXCEPTION_GUARD typedef typename tools::promote_args::type result_type; @@ -771,12 +771,12 @@ inline typename tools::promote_args::type jacobi_theta4m1(T z, U q, const return policies::checked_narrowing_cast(jacobi_theta4m1_imp(static_cast(z), static_cast(q), forwarding_policy(), function), function); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta4m1(T z, U q) { return jacobi_theta4m1(z, q, policies::policy<>()); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta4(T z, U q, const Policy&) { BOOST_FPU_EXCEPTION_GUARD typedef typename tools::promote_args::type result_type; @@ -792,7 +792,7 @@ inline typename tools::promote_args::type jacobi_theta4(T z, U q, const Po return policies::checked_narrowing_cast(jacobi_theta4_imp(static_cast(z), static_cast(q), forwarding_policy(), function), function); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type jacobi_theta4(T z, U q) { return jacobi_theta4(z, q, policies::policy<>()); } diff --git a/include/boost/math/special_functions/jacobi_zeta.hpp b/include/boost/math/special_functions/jacobi_zeta.hpp index 8b6f80912d..1dee1a6b61 100644 --- a/include/boost/math/special_functions/jacobi_zeta.hpp +++ b/include/boost/math/special_functions/jacobi_zeta.hpp @@ -63,7 +63,7 @@ BOOST_MATH_GPU_ENABLED inline T jacobi_zeta_imp(T phi, T k, const Policy& pol) } } // detail -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type jacobi_zeta(T1 k, T2 phi, const Policy& pol) { typedef typename tools::promote_args::type result_type; @@ -71,7 +71,7 @@ BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type jacobi_ return policies::checked_narrowing_cast(detail::jacobi_zeta_imp(static_cast(phi), static_cast(k), pol), "boost::math::jacobi_zeta<%1%>(%1%,%1%)"); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type jacobi_zeta(T1 k, T2 phi) { return boost::math::jacobi_zeta(k, phi, policies::policy<>()); diff --git a/include/boost/math/special_functions/laguerre.hpp b/include/boost/math/special_functions/laguerre.hpp index d747274536..6c7ef71b27 100644 --- a/include/boost/math/special_functions/laguerre.hpp +++ b/include/boost/math/special_functions/laguerre.hpp @@ -19,7 +19,7 @@ namespace boost{ namespace math{ // Recurrence relation for Laguerre polynomials: -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type laguerre_next(unsigned n, T1 x, T2 Ln, T3 Lnm1) { @@ -68,7 +68,7 @@ inline typename tools::promote_args::type } // namespace detail -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type laguerre(unsigned n, T x) { @@ -76,7 +76,7 @@ inline typename tools::promote_args::type } // Recurrence for associated polynomials: -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type laguerre_next(unsigned n, unsigned l, T1 x, T2 Pl, T3 Plm1) { @@ -113,7 +113,7 @@ T laguerre_imp(unsigned n, unsigned m, T x, const Policy& pol) } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type laguerre(unsigned n, unsigned m, T x, const Policy& pol) { @@ -122,7 +122,7 @@ inline typename tools::promote_args::type return policies::checked_narrowing_cast(detail::laguerre_imp(n, m, static_cast(x), pol), "boost::math::laguerre<%1%>(unsigned, unsigned, %1%)"); } -template +BOOST_MATH_EXPORT template inline typename laguerre_result::type laguerre(unsigned n, T1 m, T2 x) { diff --git a/include/boost/math/special_functions/lambert_w.hpp b/include/boost/math/special_functions/lambert_w.hpp index 0f41fcbc08..c3305c4269 100644 --- a/include/boost/math/special_functions/lambert_w.hpp +++ b/include/boost/math/special_functions/lambert_w.hpp @@ -2024,7 +2024,7 @@ T lambert_wm1_imp(const T z, const Policy& pol) ///////////////////////////// User Lambert w functions. ////////////////////////////// //! Lambert W0 using User-defined policy. - template + BOOST_MATH_EXPORT template inline typename boost::math::tools::promote_args::type lambert_w0(T z, const Policy& pol) @@ -2048,7 +2048,7 @@ T lambert_wm1_imp(const T z, const Policy& pol) } // lambert_w0(T z, const Policy& pol) //! Lambert W0 using default policy. - template + BOOST_MATH_EXPORT template inline typename tools::promote_args::type lambert_w0(T z) @@ -2073,7 +2073,7 @@ T lambert_wm1_imp(const T z, const Policy& pol) //! W-1 branch (-max(z) < z <= -1/e). //! Lambert W-1 using User-defined policy. - template + BOOST_MATH_EXPORT template inline typename tools::promote_args::type lambert_wm1(T z, const Policy& pol) @@ -2085,7 +2085,7 @@ T lambert_wm1_imp(const T z, const Policy& pol) } //! Lambert W-1 using default policy. - template + BOOST_MATH_EXPORT template inline typename tools::promote_args::type lambert_wm1(T z) @@ -2125,7 +2125,7 @@ T lambert_wm1_imp(const T z, const Policy& pol) } // lambert_w0_prime(T z) } // First derivative of Lambert W0 and W-1. - template + BOOST_MATH_EXPORT template inline typename tools::promote_args::type lambert_w0_prime(T z, const Policy& pol) { @@ -2133,14 +2133,14 @@ T lambert_wm1_imp(const T z, const Policy& pol) return lambert_w_detail::lambert_w0_prime(static_cast(z), pol); } - template + BOOST_MATH_EXPORT template inline typename tools::promote_args::type lambert_w0_prime(T z) { return lambert_w0_prime(z, policies::policy<>()); } - template + BOOST_MATH_EXPORT template inline typename tools::promote_args::type lambert_wm1_prime(T z, const Policy& pol) { @@ -2160,7 +2160,7 @@ T lambert_wm1_imp(const T z, const Policy& pol) return w/(z*(1+w)); } // lambert_wm1_prime(T z) - template + BOOST_MATH_EXPORT template inline typename tools::promote_args::type lambert_wm1_prime(T z) { diff --git a/include/boost/math/special_functions/legendre.hpp b/include/boost/math/special_functions/legendre.hpp index 68c129e487..84d7c13f16 100644 --- a/include/boost/math/special_functions/legendre.hpp +++ b/include/boost/math/special_functions/legendre.hpp @@ -25,7 +25,7 @@ namespace boost{ namespace math{ // Recurrence relation for legendre P and Q polynomials: -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type legendre_next(unsigned l, T1 x, T2 Pl, T3 Plm1) { @@ -215,7 +215,7 @@ std::vector legendre_p_zeros_imp(int n, const Policy& pol) } // namespace detail -template +BOOST_MATH_EXPORT template inline typename std::enable_if::value, typename tools::promote_args::type>::type legendre_p(int l, T x, const Policy& pol) { @@ -228,7 +228,7 @@ inline typename std::enable_if::value, typename tool } -template +BOOST_MATH_EXPORT template inline typename std::enable_if::value, typename tools::promote_args::type>::type legendre_p_prime(int l, T x, const Policy& pol) { @@ -240,21 +240,21 @@ inline typename std::enable_if::value, typename tool return policies::checked_narrowing_cast(detail::legendre_p_prime_imp(l, static_cast(x), pol), function); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type legendre_p(int l, T x) { return boost::math::legendre_p(l, x, policies::policy<>()); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type legendre_p_prime(int l, T x) { return boost::math::legendre_p_prime(l, x, policies::policy<>()); } -template +BOOST_MATH_EXPORT template inline std::vector legendre_p_zeros(int l, const Policy& pol) { if(l < 0) @@ -264,13 +264,13 @@ inline std::vector legendre_p_zeros(int l, const Policy& pol) } -template +BOOST_MATH_EXPORT template inline std::vector legendre_p_zeros(int l) { return boost::math::legendre_p_zeros(l, policies::policy<>()); } -template +BOOST_MATH_EXPORT template inline typename std::enable_if::value, typename tools::promote_args::type>::type legendre_q(unsigned l, T x, const Policy& pol) { @@ -279,7 +279,7 @@ inline typename std::enable_if::value, typename tool return policies::checked_narrowing_cast(detail::legendre_imp(l, static_cast(x), pol, true), "boost::math::legendre_q<%1%>(unsigned, %1%)"); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type legendre_q(unsigned l, T x) { @@ -287,7 +287,7 @@ inline typename tools::promote_args::type } // Recurrence for associated polynomials: -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type legendre_next(unsigned l, unsigned m, T1 x, T2 Pl, T3 Plm1) { @@ -360,7 +360,7 @@ inline T legendre_p_imp(int l, int m, T x, const Policy& pol) } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type legendre_p(int l, int m, T x, const Policy& pol) { @@ -369,7 +369,7 @@ inline typename tools::promote_args::type return policies::checked_narrowing_cast(detail::legendre_p_imp(l, m, static_cast(x), pol), "boost::math::legendre_p<%1%>(int, int, %1%)"); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type legendre_p(int l, int m, T x) { diff --git a/include/boost/math/special_functions/legendre_stieltjes.hpp b/include/boost/math/special_functions/legendre_stieltjes.hpp index 5809446e39..508dbb64d8 100644 --- a/include/boost/math/special_functions/legendre_stieltjes.hpp +++ b/include/boost/math/special_functions/legendre_stieltjes.hpp @@ -26,7 +26,7 @@ namespace boost{ namespace math{ -template +BOOST_MATH_EXPORT template class legendre_stieltjes { public: diff --git a/include/boost/math/special_functions/log1p.hpp b/include/boost/math/special_functions/log1p.hpp index f140799532..44efc73997 100644 --- a/include/boost/math/special_functions/log1p.hpp +++ b/include/boost/math/special_functions/log1p.hpp @@ -270,7 +270,7 @@ BOOST_MATH_GPU_ENABLED T log1p_imp(T const& x, const Policy& pol, const boost::m } // namespace detail -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type log1p(T x, const Policy&) { typedef typename tools::promote_args::type result_type; @@ -293,7 +293,7 @@ BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type log1p(T x, c detail::log1p_imp(static_cast(x), forwarding_policy(), tag_type()), "boost::math::log1p<%1%>(%1%)"); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline float log1p(float x, const Policy& pol) { if(x < -1) @@ -307,7 +307,7 @@ BOOST_MATH_GPU_ENABLED inline float log1p(float x, const Policy& pol) #endif } #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline long double log1p(long double x, const Policy& pol) { if(x < -1) @@ -317,7 +317,7 @@ BOOST_MATH_GPU_ENABLED inline long double log1p(long double x, const Policy& pol return std::log1p(x); } #endif -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline double log1p(double x, const Policy& pol) { if(x < -1) @@ -331,7 +331,7 @@ BOOST_MATH_GPU_ENABLED inline double log1p(double x, const Policy& pol) #endif } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type log1p(T x) { return boost::math::log1p(x, policies::policy<>()); @@ -339,7 +339,7 @@ BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type log1p(T x) // // Compute log(1+x)-x: // -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type log1pmx(T x, const Policy& pol) { @@ -369,7 +369,7 @@ BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type return result; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type log1pmx(T x) { return log1pmx(x, policies::policy<>()); @@ -379,21 +379,21 @@ BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type log1pmx(T x) // Specific width floating point types: // #ifdef __STDCPP_FLOAT32_T__ -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline std::float32_t log1p(std::float32_t x, const Policy& pol) { return boost::math::log1p(static_cast(x), pol); } #endif #ifdef __STDCPP_FLOAT64_T__ -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline std::float64_t log1p(std::float64_t x, const Policy& pol) { return boost::math::log1p(static_cast(x), pol); } #endif #ifdef __STDCPP_FLOAT128_T__ -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline std::float128_t log1p(std::float128_t x, const Policy& pol) { if constexpr (std::numeric_limits::digits == std::numeric_limits::digits) diff --git a/include/boost/math/special_functions/logaddexp.hpp b/include/boost/math/special_functions/logaddexp.hpp index 1e4c4b89c4..9135a23533 100644 --- a/include/boost/math/special_functions/logaddexp.hpp +++ b/include/boost/math/special_functions/logaddexp.hpp @@ -13,7 +13,7 @@ namespace boost { namespace math { // Calculates log(exp(x1) + exp(x2)) -template +BOOST_MATH_EXPORT template Real logaddexp(Real x1, Real x2) noexcept { using std::log1p; diff --git a/include/boost/math/special_functions/logistic_sigmoid.hpp b/include/boost/math/special_functions/logistic_sigmoid.hpp index b2b7c94b49..3049baba06 100644 --- a/include/boost/math/special_functions/logistic_sigmoid.hpp +++ b/include/boost/math/special_functions/logistic_sigmoid.hpp @@ -16,7 +16,7 @@ namespace boost { namespace math { -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED RealType logistic_sigmoid(RealType x, const Policy&) { BOOST_MATH_STD_USING @@ -36,7 +36,7 @@ BOOST_MATH_GPU_ENABLED RealType logistic_sigmoid(RealType x, const Policy&) return res; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED RealType logistic_sigmoid(RealType x) { return logistic_sigmoid(x, policies::policy<>()); diff --git a/include/boost/math/special_functions/logit.hpp b/include/boost/math/special_functions/logit.hpp index fda684fd24..cf2c1f184c 100644 --- a/include/boost/math/special_functions/logit.hpp +++ b/include/boost/math/special_functions/logit.hpp @@ -18,7 +18,7 @@ namespace boost { namespace math { -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED RealType logit(RealType p, const Policy&) { BOOST_MATH_STD_USING @@ -46,7 +46,7 @@ BOOST_MATH_GPU_ENABLED RealType logit(RealType p, const Policy&) return result; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED RealType logit(RealType p) { return logit(p, policies::policy<>()); diff --git a/include/boost/math/special_functions/logsumexp.hpp b/include/boost/math/special_functions/logsumexp.hpp index 425bd90b72..fb31685868 100644 --- a/include/boost/math/special_functions/logsumexp.hpp +++ b/include/boost/math/special_functions/logsumexp.hpp @@ -17,7 +17,7 @@ namespace boost { namespace math { // https://nhigham.com/2021/01/05/what-is-the-log-sum-exp-function/ // See equation (#) -template ::value_type> +BOOST_MATH_EXPORT template ::value_type> Real logsumexp(ForwardIterator first, ForwardIterator last) { using std::exp; @@ -40,13 +40,13 @@ Real logsumexp(ForwardIterator first, ForwardIterator last) return max_val + log1p(arg); } -template +BOOST_MATH_EXPORT template inline Real logsumexp(const Container& c) { return logsumexp(std::begin(c), std::end(c)); } -template ::type, +BOOST_MATH_EXPORT template ::type, typename std::enable_if::value, bool>::type = true> inline Real logsumexp(Args&& ...args) { diff --git a/include/boost/math/special_functions/math_fwd.hpp b/include/boost/math/special_functions/math_fwd.hpp index 32fb9b7a61..6ccd882372 100644 --- a/include/boost/math/special_functions/math_fwd.hpp +++ b/include/boost/math/special_functions/math_fwd.hpp @@ -35,7 +35,7 @@ namespace boost { namespace math { -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type beta(RT1 a, RT2 b, A arg); @@ -121,200 +121,200 @@ namespace boost { // Math functions (in roughly alphabetic order). // Beta functions. - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t beta(RT1 a, RT2 b); // Beta function (2 arguments). - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t beta(RT1 a, RT2 b, A x); // Beta function (3 arguments). - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t beta(RT1 a, RT2 b, RT3 x, const Policy& pol); // Beta function (3 arguments). - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t betac(RT1 a, RT2 b, RT3 x); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t betac(RT1 a, RT2 b, RT3 x, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t ibeta(RT1 a, RT2 b, RT3 x); // Incomplete beta function. - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t ibeta(RT1 a, RT2 b, RT3 x, const Policy& pol); // Incomplete beta function. - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t ibetac(RT1 a, RT2 b, RT3 x); // Incomplete beta complement function. - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t ibetac(RT1 a, RT2 b, RT3 x, const Policy& pol); // Incomplete beta complement function. - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t ibeta_inv(T1 a, T2 b, T3 p, T4* py); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t ibeta_inv(T1 a, T2 b, T3 p, T4* py, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t ibeta_inv(RT1 a, RT2 b, RT3 p); // Incomplete beta inverse function. - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t ibeta_inv(RT1 a, RT2 b, RT3 p, const Policy&); // Incomplete beta inverse function. - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t ibeta_inva(RT1 a, RT2 b, RT3 p); // Incomplete beta inverse function. - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t ibeta_inva(RT1 a, RT2 b, RT3 p, const Policy&); // Incomplete beta inverse function. - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t ibeta_invb(RT1 a, RT2 b, RT3 p); // Incomplete beta inverse function. - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t ibeta_invb(RT1 a, RT2 b, RT3 p, const Policy&); // Incomplete beta inverse function. - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t ibetac_inv(T1 a, T2 b, T3 q, T4* py); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t ibetac_inv(T1 a, T2 b, T3 q, T4* py, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t ibetac_inv(RT1 a, RT2 b, RT3 q); // Incomplete beta complement inverse function. - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t ibetac_inv(RT1 a, RT2 b, RT3 q, const Policy&); // Incomplete beta complement inverse function. - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t ibetac_inva(RT1 a, RT2 b, RT3 q); // Incomplete beta complement inverse function. - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t ibetac_inva(RT1 a, RT2 b, RT3 q, const Policy&); // Incomplete beta complement inverse function. - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t ibetac_invb(RT1 a, RT2 b, RT3 q); // Incomplete beta complement inverse function. - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t ibetac_invb(RT1 a, RT2 b, RT3 q, const Policy&); // Incomplete beta complement inverse function. - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t ibeta_derivative(RT1 a, RT2 b, RT3 x); // derivative of incomplete beta - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t ibeta_derivative(RT1 a, RT2 b, RT3 x, const Policy& pol); // derivative of incomplete beta // Binomial: - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED T binomial_coefficient(unsigned n, unsigned k, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED T binomial_coefficient(unsigned n, unsigned k); // erf & erfc error functions. - template // Error function. + BOOST_MATH_EXPORT template // Error function. BOOST_MATH_GPU_ENABLED tools::promote_args_t erf(RT z); - template // Error function. + BOOST_MATH_EXPORT template // Error function. BOOST_MATH_GPU_ENABLED tools::promote_args_t erf(RT z, const Policy&); - template // Error function complement. + BOOST_MATH_EXPORT template // Error function complement. BOOST_MATH_GPU_ENABLED tools::promote_args_t erfc(RT z); - template // Error function complement. + BOOST_MATH_EXPORT template // Error function complement. BOOST_MATH_GPU_ENABLED tools::promote_args_t erfc(RT z, const Policy&); - template // Error function inverse. + BOOST_MATH_EXPORT template // Error function inverse. BOOST_MATH_GPU_ENABLED tools::promote_args_t erf_inv(RT z); - template // Error function inverse. + BOOST_MATH_EXPORT template // Error function inverse. BOOST_MATH_GPU_ENABLED tools::promote_args_t erf_inv(RT z, const Policy& pol); - template // Error function complement inverse. + BOOST_MATH_EXPORT template // Error function complement inverse. BOOST_MATH_GPU_ENABLED tools::promote_args_t erfc_inv(RT z); - template // Error function complement inverse. + BOOST_MATH_EXPORT template // Error function complement inverse. BOOST_MATH_GPU_ENABLED tools::promote_args_t erfc_inv(RT z, const Policy& pol); // Polynomials: - template + BOOST_MATH_EXPORT template tools::promote_args_t legendre_next(unsigned l, T1 x, T2 Pl, T3 Plm1); - template + BOOST_MATH_EXPORT template tools::promote_args_t legendre_p(int l, T x); - template + BOOST_MATH_EXPORT template tools::promote_args_t legendre_p_prime(int l, T x); - template + BOOST_MATH_EXPORT template inline std::vector legendre_p_zeros(int l, const Policy& pol); - template + BOOST_MATH_EXPORT template inline std::vector legendre_p_zeros(int l); - template + BOOST_MATH_EXPORT template typename std::enable_if::value, tools::promote_args_t>::type legendre_p(int l, T x, const Policy& pol); - template + BOOST_MATH_EXPORT template inline typename std::enable_if::value, tools::promote_args_t>::type legendre_p_prime(int l, T x, const Policy& pol); - template + BOOST_MATH_EXPORT template tools::promote_args_t legendre_q(unsigned l, T x); - template + BOOST_MATH_EXPORT template typename std::enable_if::value, tools::promote_args_t>::type legendre_q(unsigned l, T x, const Policy& pol); - template + BOOST_MATH_EXPORT template tools::promote_args_t legendre_next(unsigned l, unsigned m, T1 x, T2 Pl, T3 Plm1); - template + BOOST_MATH_EXPORT template tools::promote_args_t legendre_p(int l, int m, T x); - template + BOOST_MATH_EXPORT template tools::promote_args_t legendre_p(int l, int m, T x, const Policy& pol); - template + BOOST_MATH_EXPORT template tools::promote_args_t laguerre_next(unsigned n, T1 x, T2 Ln, T3 Lnm1); - template + BOOST_MATH_EXPORT template tools::promote_args_t laguerre_next(unsigned n, unsigned l, T1 x, T2 Pl, T3 Plm1); - template + BOOST_MATH_EXPORT template tools::promote_args_t laguerre(unsigned n, T x); - template + BOOST_MATH_EXPORT template tools::promote_args_t laguerre(unsigned n, unsigned m, T x, const Policy& pol); @@ -328,148 +328,148 @@ namespace boost >::type; }; - template + BOOST_MATH_EXPORT template typename laguerre_result::type laguerre(unsigned n, T1 m, T2 x); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t hermite(unsigned n, T x); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t hermite(unsigned n, T x, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t hermite_next(unsigned n, T1 x, T2 Hn, T3 Hnm1); - template + BOOST_MATH_EXPORT template tools::promote_args_t chebyshev_next(T1 const & x, T2 const & Tn, T3 const & Tn_1); - template + BOOST_MATH_EXPORT template tools::promote_args_t chebyshev_t(unsigned n, Real const & x, const Policy&); - template + BOOST_MATH_EXPORT template tools::promote_args_t chebyshev_t(unsigned n, Real const & x); - template + BOOST_MATH_EXPORT template tools::promote_args_t chebyshev_u(unsigned n, Real const & x, const Policy&); - template + BOOST_MATH_EXPORT template tools::promote_args_t chebyshev_u(unsigned n, Real const & x); - template + BOOST_MATH_EXPORT template tools::promote_args_t chebyshev_t_prime(unsigned n, Real const & x, const Policy&); - template + BOOST_MATH_EXPORT template tools::promote_args_t chebyshev_t_prime(unsigned n, Real const & x); - template + BOOST_MATH_EXPORT template Real chebyshev_clenshaw_recurrence(const Real* const c, size_t length, const T2& x); - template + BOOST_MATH_EXPORT template std::complex> spherical_harmonic(unsigned n, int m, T1 theta, T2 phi); - template + BOOST_MATH_EXPORT template std::complex> spherical_harmonic(unsigned n, int m, T1 theta, T2 phi, const Policy& pol); - template + BOOST_MATH_EXPORT template tools::promote_args_t spherical_harmonic_r(unsigned n, int m, T1 theta, T2 phi); - template + BOOST_MATH_EXPORT template tools::promote_args_t spherical_harmonic_r(unsigned n, int m, T1 theta, T2 phi, const Policy& pol); - template + BOOST_MATH_EXPORT template tools::promote_args_t spherical_harmonic_i(unsigned n, int m, T1 theta, T2 phi); - template + BOOST_MATH_EXPORT template tools::promote_args_t spherical_harmonic_i(unsigned n, int m, T1 theta, T2 phi, const Policy& pol); // Elliptic integrals: - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t ellint_rf(T1 x, T2 y, T3 z); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t ellint_rf(T1 x, T2 y, T3 z, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t ellint_rd(T1 x, T2 y, T3 z); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t ellint_rd(T1 x, T2 y, T3 z, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t ellint_rc(T1 x, T2 y); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t ellint_rc(T1 x, T2 y, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t ellint_rj(T1 x, T2 y, T3 z, T4 p); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t ellint_rj(T1 x, T2 y, T3 z, T4 p, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t ellint_rg(T1 x, T2 y, T3 z); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t ellint_rg(T1 x, T2 y, T3 z, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t ellint_2(T k); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t ellint_2(T1 k, T2 phi); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t ellint_2(T1 k, T2 phi, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t ellint_1(T k); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t ellint_1(T1 k, T2 phi); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t ellint_1(T1 k, T2 phi, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t ellint_d(T k); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t ellint_d(T1 k, T2 phi); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t ellint_d(T1 k, T2 phi, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t jacobi_zeta(T1 k, T2 phi); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t jacobi_zeta(T1 k, T2 phi, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t heuman_lambda(T1 k, T2 phi); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t heuman_lambda(T1 k, T2 phi, const Policy& pol); namespace detail{ @@ -487,255 +487,255 @@ namespace boost } // namespace detail - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED typename detail::ellint_3_result::type ellint_3(T1 k, T2 v, T3 phi); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t ellint_3(T1 k, T2 v, T3 phi, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t ellint_3(T1 k, T2 v); // Factorial functions. // Note: not for integral types, at present. - template + BOOST_MATH_EXPORT template struct max_factorial; - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED RT factorial(unsigned int); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED RT factorial(unsigned int, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED RT unchecked_factorial(unsigned int BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(RT)); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED RT double_factorial(unsigned i); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED RT double_factorial(unsigned i, const Policy& pol); - template + BOOST_MATH_EXPORT template tools::promote_args_t falling_factorial(RT x, unsigned n); - template + BOOST_MATH_EXPORT template tools::promote_args_t falling_factorial(RT x, unsigned n, const Policy& pol); - template + BOOST_MATH_EXPORT template tools::promote_args_t rising_factorial(RT x, int n); - template + BOOST_MATH_EXPORT template tools::promote_args_t rising_factorial(RT x, int n, const Policy& pol); // Gamma functions. - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t tgamma(RT z); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t tgamma1pm1(RT z); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t tgamma1pm1(RT z, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t tgamma(RT1 a, RT2 z); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t tgamma(RT1 a, RT2 z, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t lgamma(RT z, int* sign); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t lgamma(RT z, int* sign, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t lgamma(RT x); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t lgamma(RT x, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t tgamma_lower(RT1 a, RT2 z); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t tgamma_lower(RT1 a, RT2 z, const Policy&); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t gamma_q(RT1 a, RT2 z); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t gamma_q(RT1 a, RT2 z, const Policy&); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t lgamma_q(RT1 a, RT2 z); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t lgamma_q(RT1 a, RT2 z, const Policy&); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t lgamma_p(RT1 a, RT2 z); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t lgamma_p(RT1 a, RT2 z, const Policy&); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t gamma_p(RT1 a, RT2 z); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t gamma_p(RT1 a, RT2 z, const Policy&); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t tgamma_delta_ratio(T1 z, T2 delta); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t tgamma_delta_ratio(T1 z, T2 delta, const Policy&); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t tgamma_ratio(T1 a, T2 b); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t tgamma_ratio(T1 a, T2 b, const Policy&); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t gamma_p_derivative(T1 a, T2 x); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t gamma_p_derivative(T1 a, T2 x, const Policy&); // gamma inverse. - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t gamma_p_inv(T1 a, T2 p); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t gamma_p_inva(T1 a, T2 p, const Policy&); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t gamma_p_inva(T1 a, T2 p); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t gamma_p_inv(T1 a, T2 p, const Policy&); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t gamma_q_inv(T1 a, T2 q); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t gamma_q_inv(T1 a, T2 q, const Policy&); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t gamma_q_inva(T1 a, T2 q); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t gamma_q_inva(T1 a, T2 q, const Policy&); // digamma: - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t digamma(T x); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t digamma(T x, const Policy&); // trigamma: - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t trigamma(T x); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t trigamma(T x, const Policy&); // polygamma: - template + BOOST_MATH_EXPORT template tools::promote_args_t polygamma(int n, T x); - template + BOOST_MATH_EXPORT template tools::promote_args_t polygamma(int n, T x, const Policy&); // Hypotenuse function sqrt(x ^ 2 + y ^ 2). - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t hypot(T1 x, T2 y); - template , bool> = true> + BOOST_MATH_EXPORT template , bool> = true> BOOST_MATH_GPU_ENABLED tools::promote_args_t hypot(T1 x, T2 y, const Policy&); - template , bool> = true> + BOOST_MATH_EXPORT template , bool> = true> BOOST_MATH_GPU_ENABLED tools::promote_args_t hypot(T1 x, T2 y, T3 z); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t hypot(T1 x, T2 y, T3 z, const Policy& pol); // cbrt - cube root. - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t cbrt(RT z); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t cbrt(RT z, const Policy&); // log1p is log(x + 1) - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t log1p(T); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t log1p(T, const Policy&); // log1pmx is log(x + 1) - x - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t log1pmx(T); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t log1pmx(T, const Policy&); // Exp (x) minus 1 functions. - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t expm1(T); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t expm1(T, const Policy&); // Power - 1 - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t powm1(const T1 a, const T2 z); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t powm1(const T1 a, const T2 z, const Policy&); // sqrt(1+x) - 1 - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t sqrt1pm1(const T& val); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t sqrt1pm1(const T& val, const Policy&); // sinus cardinals: - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t sinc_pi(T x); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t sinc_pi(T x, const Policy&); - template + BOOST_MATH_EXPORT template tools::promote_args_t sinhc_pi(T x); - template + BOOST_MATH_EXPORT template tools::promote_args_t sinhc_pi(T x, const Policy&); // inverse hyperbolics: - template + BOOST_MATH_EXPORT template tools::promote_args_t asinh(T x); - template + BOOST_MATH_EXPORT template tools::promote_args_t asinh(T x, const Policy&); - template + BOOST_MATH_EXPORT template tools::promote_args_t acosh(T x); - template + BOOST_MATH_EXPORT template tools::promote_args_t acosh(T x, const Policy&); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t atanh(T x); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t atanh(T x, const Policy&); namespace detail{ @@ -778,224 +778,224 @@ namespace boost } // detail // Bessel functions: - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED typename detail::bessel_traits::result_type cyl_bessel_j(T1 v, T2 x, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED typename detail::bessel_traits::result_type cyl_bessel_j_prime(T1 v, T2 x, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED typename detail::bessel_traits >::result_type cyl_bessel_j(T1 v, T2 x); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED typename detail::bessel_traits >::result_type cyl_bessel_j_prime(T1 v, T2 x); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED typename detail::bessel_traits::result_type sph_bessel(unsigned v, T x, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED typename detail::bessel_traits::result_type sph_bessel_prime(unsigned v, T x, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED typename detail::bessel_traits >::result_type sph_bessel(unsigned v, T x); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED typename detail::bessel_traits >::result_type sph_bessel_prime(unsigned v, T x); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED typename detail::bessel_traits::result_type cyl_bessel_i(T1 v, T2 x, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED typename detail::bessel_traits::result_type cyl_bessel_i_prime(T1 v, T2 x, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED typename detail::bessel_traits >::result_type cyl_bessel_i(T1 v, T2 x); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED typename detail::bessel_traits >::result_type cyl_bessel_i_prime(T1 v, T2 x); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED typename detail::bessel_traits::result_type cyl_bessel_k(T1 v, T2 x, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED typename detail::bessel_traits::result_type cyl_bessel_k_prime(T1 v, T2 x, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED typename detail::bessel_traits >::result_type cyl_bessel_k(T1 v, T2 x); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED typename detail::bessel_traits >::result_type cyl_bessel_k_prime(T1 v, T2 x); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED typename detail::bessel_traits::result_type cyl_neumann(T1 v, T2 x, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED typename detail::bessel_traits::result_type cyl_neumann_prime(T1 v, T2 x, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED typename detail::bessel_traits >::result_type cyl_neumann(T1 v, T2 x); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED typename detail::bessel_traits >::result_type cyl_neumann_prime(T1 v, T2 x); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED typename detail::bessel_traits::result_type sph_neumann(unsigned v, T x, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED typename detail::bessel_traits::result_type sph_neumann_prime(unsigned v, T x, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED typename detail::bessel_traits >::result_type sph_neumann(unsigned v, T x); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED typename detail::bessel_traits >::result_type sph_neumann_prime(unsigned v, T x); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED typename detail::bessel_traits::result_type cyl_bessel_j_zero(T v, int m, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED typename detail::bessel_traits >::result_type cyl_bessel_j_zero(T v, int m); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED OutputIterator cyl_bessel_j_zero(T v, int start_index, unsigned number_of_zeros, OutputIterator out_it); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED OutputIterator cyl_bessel_j_zero(T v, int start_index, unsigned number_of_zeros, OutputIterator out_it, const Policy&); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED typename detail::bessel_traits::result_type cyl_neumann_zero(T v, int m, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED typename detail::bessel_traits >::result_type cyl_neumann_zero(T v, int m); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED OutputIterator cyl_neumann_zero(T v, int start_index, unsigned number_of_zeros, OutputIterator out_it); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED OutputIterator cyl_neumann_zero(T v, int start_index, unsigned number_of_zeros, OutputIterator out_it, const Policy&); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED boost::math::complex >::result_type> cyl_hankel_1(T1 v, T2 x); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED boost::math::complex::result_type> cyl_hankel_1(T1 v, T2 x, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED boost::math::complex::result_type> cyl_hankel_2(T1 v, T2 x, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED boost::math::complex >::result_type> cyl_hankel_2(T1 v, T2 x); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED boost::math::complex::result_type> sph_hankel_1(T1 v, T2 x, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED boost::math::complex >::result_type> sph_hankel_1(T1 v, T2 x); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED boost::math::complex::result_type> sph_hankel_2(T1 v, T2 x, const Policy& pol); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED boost::math::complex >::result_type> sph_hankel_2(T1 v, T2 x); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t airy_ai(T x, const Policy&); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t airy_ai(T x); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t airy_bi(T x, const Policy&); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t airy_bi(T x); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t airy_ai_prime(T x, const Policy&); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t airy_ai_prime(T x); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t airy_bi_prime(T x, const Policy&); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t airy_bi_prime(T x); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED T airy_ai_zero(int m); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED T airy_ai_zero(int m, const Policy&); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED OutputIterator airy_ai_zero( int start_index, unsigned number_of_zeros, OutputIterator out_it); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED OutputIterator airy_ai_zero( int start_index, unsigned number_of_zeros, OutputIterator out_it, const Policy&); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED T airy_bi_zero(int m); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED T airy_bi_zero(int m, const Policy&); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED OutputIterator airy_bi_zero( int start_index, unsigned number_of_zeros, OutputIterator out_it); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED OutputIterator airy_bi_zero( int start_index, unsigned number_of_zeros, OutputIterator out_it, const Policy&); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t sin_pi(T x, const Policy&); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t sin_pi(T x); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t cos_pi(T x, const Policy&); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t cos_pi(T x); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED int fpclassify BOOST_NO_MACRO_EXPAND(T t); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED bool isfinite BOOST_NO_MACRO_EXPAND(T z); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED bool isinf BOOST_NO_MACRO_EXPAND(T t); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED bool isnan BOOST_NO_MACRO_EXPAND(T t); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED bool isnormal BOOST_NO_MACRO_EXPAND(T t); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED int signbit BOOST_NO_MACRO_EXPAND(T x); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED int sign BOOST_NO_MACRO_EXPAND(const T& z); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED typename tools::promote_args_permissive::type copysign BOOST_NO_MACRO_EXPAND(const T& x, const U& y); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED typename tools::promote_args_permissive::type changesign BOOST_NO_MACRO_EXPAND(const T& z); @@ -1014,13 +1014,13 @@ namespace boost } // namespace detail - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t expint(unsigned n, T z, const Policy&); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED typename detail::expint_result::type expint(T const z, U const u); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED tools::promote_args_t expint(T z); // Zeta: @@ -1028,162 +1028,162 @@ namespace boost tools::promote_args_t zeta(T s, const Policy&); // Owen's T function: - template + BOOST_MATH_EXPORT template tools::promote_args_t owens_t(T1 h, T2 a, const Policy& pol); - template + BOOST_MATH_EXPORT template tools::promote_args_t owens_t(T1 h, T2 a); // Jacobi Functions: - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_elliptic(T k, U theta, V* pcn, V* pdn, const Policy&); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_elliptic(T k, U theta, V* pcn = 0, V* pdn = 0); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_sn(U k, T theta, const Policy& pol); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_sn(U k, T theta); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_cn(T k, U theta, const Policy& pol); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_cn(T k, U theta); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_dn(T k, U theta, const Policy& pol); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_dn(T k, U theta); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_cd(T k, U theta, const Policy& pol); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_cd(T k, U theta); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_dc(T k, U theta, const Policy& pol); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_dc(T k, U theta); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_ns(T k, U theta, const Policy& pol); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_ns(T k, U theta); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_sd(T k, U theta, const Policy& pol); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_sd(T k, U theta); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_ds(T k, U theta, const Policy& pol); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_ds(T k, U theta); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_nc(T k, U theta, const Policy& pol); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_nc(T k, U theta); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_nd(T k, U theta, const Policy& pol); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_nd(T k, U theta); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_sc(T k, U theta, const Policy& pol); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_sc(T k, U theta); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_cs(T k, U theta, const Policy& pol); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_cs(T k, U theta); // Jacobi Theta Functions: - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_theta1(T z, U q, const Policy& pol); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_theta1(T z, U q); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_theta2(T z, U q, const Policy& pol); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_theta2(T z, U q); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_theta3(T z, U q, const Policy& pol); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_theta3(T z, U q); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_theta4(T z, U q, const Policy& pol); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_theta4(T z, U q); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_theta1tau(T z, U tau, const Policy& pol); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_theta1tau(T z, U tau); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_theta2tau(T z, U tau, const Policy& pol); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_theta2tau(T z, U tau); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_theta3tau(T z, U tau, const Policy& pol); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_theta3tau(T z, U tau); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_theta4tau(T z, U tau, const Policy& pol); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_theta4tau(T z, U tau); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_theta3m1(T z, U q, const Policy& pol); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_theta3m1(T z, U q); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_theta4m1(T z, U q, const Policy& pol); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_theta4m1(T z, U q); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_theta3m1tau(T z, U tau, const Policy& pol); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_theta3m1tau(T z, U tau); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_theta4m1tau(T z, U tau, const Policy& pol); - template + BOOST_MATH_EXPORT template tools::promote_args_t jacobi_theta4m1tau(T z, U tau); @@ -1191,103 +1191,103 @@ namespace boost tools::promote_args_t zeta(T s); // pow: - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED BOOST_MATH_CXX14_CONSTEXPR tools::promote_args_t pow(T base, const Policy& policy); - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED BOOST_MATH_CXX14_CONSTEXPR tools::promote_args_t pow(T base); // next: - template + BOOST_MATH_EXPORT template tools::promote_args_t nextafter(const T&, const U&, const Policy&); - template + BOOST_MATH_EXPORT template tools::promote_args_t nextafter(const T&, const U&); - template + BOOST_MATH_EXPORT template tools::promote_args_t float_next(const T&, const Policy&); - template + BOOST_MATH_EXPORT template tools::promote_args_t float_next(const T&); - template + BOOST_MATH_EXPORT template tools::promote_args_t float_prior(const T&, const Policy&); - template + BOOST_MATH_EXPORT template tools::promote_args_t float_prior(const T&); - template + BOOST_MATH_EXPORT template tools::promote_args_t float_distance(const T&, const U&, const Policy&); - template + BOOST_MATH_EXPORT template tools::promote_args_t float_distance(const T&, const U&); - template + BOOST_MATH_EXPORT template tools::promote_args_t float_advance(T val, int distance, const Policy& pol); - template + BOOST_MATH_EXPORT template tools::promote_args_t float_advance(const T& val, int distance); - template + BOOST_MATH_EXPORT template tools::promote_args_t ulp(const T& val, const Policy& pol); - template + BOOST_MATH_EXPORT template tools::promote_args_t ulp(const T& val); - template + BOOST_MATH_EXPORT template tools::promote_args_t relative_difference(const T&, const U&); - template + BOOST_MATH_EXPORT template tools::promote_args_t epsilon_difference(const T&, const U&); - template + BOOST_MATH_EXPORT template BOOST_MATH_CONSTEXPR_TABLE_FUNCTION T unchecked_bernoulli_b2n(const std::size_t n); - template + BOOST_MATH_EXPORT template T bernoulli_b2n(const int i, const Policy &pol); - template + BOOST_MATH_EXPORT template T bernoulli_b2n(const int i); - template + BOOST_MATH_EXPORT template OutputIterator bernoulli_b2n(const int start_index, const unsigned number_of_bernoullis_b2n, OutputIterator out_it, const Policy& pol); - template + BOOST_MATH_EXPORT template OutputIterator bernoulli_b2n(const int start_index, const unsigned number_of_bernoullis_b2n, OutputIterator out_it); - template + BOOST_MATH_EXPORT template T tangent_t2n(const int i, const Policy &pol); - template + BOOST_MATH_EXPORT template T tangent_t2n(const int i); - template + BOOST_MATH_EXPORT template OutputIterator tangent_t2n(const int start_index, const unsigned number_of_bernoullis_b2n, OutputIterator out_it, const Policy& pol); - template + BOOST_MATH_EXPORT template OutputIterator tangent_t2n(const int start_index, const unsigned number_of_bernoullis_b2n, OutputIterator out_it); // Lambert W: - template + BOOST_MATH_EXPORT template boost::math::tools::promote_args_t lambert_w0(T z, const Policy& pol); - template + BOOST_MATH_EXPORT template boost::math::tools::promote_args_t lambert_w0(T z); - template + BOOST_MATH_EXPORT template boost::math::tools::promote_args_t lambert_wm1(T z, const Policy& pol); - template + BOOST_MATH_EXPORT template boost::math::tools::promote_args_t lambert_wm1(T z); - template + BOOST_MATH_EXPORT template boost::math::tools::promote_args_t lambert_w0_prime(T z, const Policy& pol); - template + BOOST_MATH_EXPORT template boost::math::tools::promote_args_t lambert_w0_prime(T z); - template + BOOST_MATH_EXPORT template boost::math::tools::promote_args_t lambert_wm1_prime(T z, const Policy& pol); - template + BOOST_MATH_EXPORT template boost::math::tools::promote_args_t lambert_wm1_prime(T z); // Hypergeometrics: - template tools::promote_args_t hypergeometric_1F0(T1 a, T2 z); - template tools::promote_args_t hypergeometric_1F0(T1 a, T2 z, const Policy&); + BOOST_MATH_EXPORT template tools::promote_args_t hypergeometric_1F0(T1 a, T2 z); + BOOST_MATH_EXPORT template tools::promote_args_t hypergeometric_1F0(T1 a, T2 z, const Policy&); - template tools::promote_args_t hypergeometric_0F1(T1 b, T2 z); - template tools::promote_args_t hypergeometric_0F1(T1 b, T2 z, const Policy&); + BOOST_MATH_EXPORT template tools::promote_args_t hypergeometric_0F1(T1 b, T2 z); + BOOST_MATH_EXPORT template tools::promote_args_t hypergeometric_0F1(T1 b, T2 z, const Policy&); - template tools::promote_args_t hypergeometric_2F0(T1 a1, T2 a2, T3 z); - template tools::promote_args_t hypergeometric_2F0(T1 a1, T2 a2, T3 z, const Policy&); + BOOST_MATH_EXPORT template tools::promote_args_t hypergeometric_2F0(T1 a1, T2 a2, T3 z); + BOOST_MATH_EXPORT template tools::promote_args_t hypergeometric_2F0(T1 a1, T2 a2, T3 z, const Policy&); - template tools::promote_args_t hypergeometric_1F1(T1 a, T2 b, T3 z); - template tools::promote_args_t hypergeometric_1F1(T1 a, T2 b, T3 z, const Policy&); + BOOST_MATH_EXPORT template tools::promote_args_t hypergeometric_1F1(T1 a, T2 b, T3 z); + BOOST_MATH_EXPORT template tools::promote_args_t hypergeometric_1F1(T1 a, T2 b, T3 z, const Policy&); } // namespace math diff --git a/include/boost/math/special_functions/modf.hpp b/include/boost/math/special_functions/modf.hpp index 6e372ec9a3..75978461d6 100644 --- a/include/boost/math/special_functions/modf.hpp +++ b/include/boost/math/special_functions/modf.hpp @@ -21,49 +21,49 @@ namespace boost{ namespace math{ -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline T modf(const T& v, T* ipart, const Policy& pol) { *ipart = trunc(v, pol); return v - *ipart; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline T modf(const T& v, T* ipart) { return modf(v, ipart, policies::policy<>()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline T modf(const T& v, int* ipart, const Policy& pol) { *ipart = itrunc(v, pol); return v - *ipart; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline T modf(const T& v, int* ipart) { return modf(v, ipart, policies::policy<>()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline T modf(const T& v, long* ipart, const Policy& pol) { *ipart = ltrunc(v, pol); return v - *ipart; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline T modf(const T& v, long* ipart) { return modf(v, ipart, policies::policy<>()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline T modf(const T& v, long long* ipart, const Policy& pol) { *ipart = lltrunc(v, pol); return v - *ipart; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline T modf(const T& v, long long* ipart) { return modf(v, ipart, policies::policy<>()); diff --git a/include/boost/math/special_functions/next.hpp b/include/boost/math/special_functions/next.hpp index ce3210ec2e..ae5cb23621 100644 --- a/include/boost/math/special_functions/next.hpp +++ b/include/boost/math/special_functions/next.hpp @@ -267,7 +267,7 @@ T float_next_imp(const T& val, const std::false_type&, const Policy& pol) } // namespace detail -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type float_next(const T& val, const Policy& pol) { typedef typename tools::promote_args::type result_type; @@ -280,7 +280,7 @@ inline typename tools::promote_args::type float_next(const T& val, const Poli // the SSE2 registers if the FTZ or DAZ flags are set, so use our own // - albeit slower - code instead as at least that gives the correct answer. // -template +BOOST_MATH_EXPORT template inline double float_next(const double& val, const Policy& pol) { static const char* function = "float_next<%1%>(%1%)"; @@ -297,7 +297,7 @@ inline double float_next(const double& val, const Policy& pol) } #endif -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type float_next(const T& val) { return float_next(val, policies::policy<>()); @@ -411,7 +411,7 @@ T float_prior_imp(const T& val, const std::false_type&, const Policy& pol) } // namespace detail -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type float_prior(const T& val, const Policy& pol) { typedef typename tools::promote_args::type result_type; @@ -424,7 +424,7 @@ inline typename tools::promote_args::type float_prior(const T& val, const Pol // the SSE2 registers if the FTZ or DAZ flags are set, so use our own // - albeit slower - code instead as at least that gives the correct answer. // -template +BOOST_MATH_EXPORT template inline double float_prior(const double& val, const Policy& pol) { static const char* function = "float_prior<%1%>(%1%)"; @@ -441,20 +441,20 @@ inline double float_prior(const double& val, const Policy& pol) } #endif -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type float_prior(const T& val) { return float_prior(val, policies::policy<>()); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type nextafter(const T& val, const U& direction, const Policy& pol) { typedef typename tools::promote_args::type result_type; return val < direction ? boost::math::float_next(val, pol) : val == direction ? val : boost::math::float_prior(val, pol); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type nextafter(const T& val, const U& direction) { return nextafter(val, direction, policies::policy<>()); @@ -666,7 +666,7 @@ T float_distance_imp(const T& a, const T& b, const std::false_type&, const Polic } // namespace detail -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type float_distance(const T& a, const U& b, const Policy& pol) { // @@ -700,7 +700,7 @@ inline typename tools::promote_args::type float_distance(const T& a, const } } -template +BOOST_MATH_EXPORT template typename tools::promote_args::type float_distance(const T& a, const U& b) { return boost::math::float_distance(a, b, policies::policy<>()); @@ -868,14 +868,14 @@ T float_advance_imp(T val, int distance, const std::false_type&, const Policy& p } // namespace detail -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type float_advance(T val, int distance, const Policy& pol) { typedef typename tools::promote_args::type result_type; return detail::float_advance_imp(detail::normalize_value(static_cast(val), typename detail::has_hidden_guard_digits::type()), distance, std::integral_constant::is_specialized || (std::numeric_limits::radix == 2)>(), pol); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type float_advance(const T& val, int distance) { return boost::math::float_advance(val, distance, policies::policy<>()); diff --git a/include/boost/math/special_functions/nonfinite_num_facets.hpp b/include/boost/math/special_functions/nonfinite_num_facets.hpp index 5ac935d6a1..8ecb07e108 100644 --- a/include/boost/math/special_functions/nonfinite_num_facets.hpp +++ b/include/boost/math/special_functions/nonfinite_num_facets.hpp @@ -54,7 +54,7 @@ namespace boost { // class nonfinite_num_put ----------------------------------------------------- - template< + BOOST_MATH_EXPORT template< class CharType, class OutputIterator = std::ostreambuf_iterator > @@ -231,7 +231,7 @@ namespace boost { // class nonfinite_num_get ------------------------------------------------------ - template< + BOOST_MATH_EXPORT template< class CharType, class InputIterator = std::istreambuf_iterator > diff --git a/include/boost/math/special_functions/owens_t.hpp b/include/boost/math/special_functions/owens_t.hpp index 45f96ef127..c549cdcc92 100644 --- a/include/boost/math/special_functions/owens_t.hpp +++ b/include/boost/math/special_functions/owens_t.hpp @@ -1042,7 +1042,7 @@ namespace boost } // namespace detail - template + BOOST_MATH_EXPORT template inline typename tools::promote_args::type owens_t(T1 h, T2 a, const Policy& pol) { typedef typename tools::promote_args::type result_type; @@ -1051,7 +1051,7 @@ namespace boost return policies::checked_narrowing_cast(detail::owens_t(static_cast(h), static_cast(a), pol), "boost::math::owens_t<%1%>(%1%,%1%)"); } - template + BOOST_MATH_EXPORT template inline typename tools::promote_args::type owens_t(T1 h, T2 a) { return owens_t(h, a, policies::policy<>()); diff --git a/include/boost/math/special_functions/polygamma.hpp b/include/boost/math/special_functions/polygamma.hpp index 6b7815d5e0..79d52f1f1e 100644 --- a/include/boost/math/special_functions/polygamma.hpp +++ b/include/boost/math/special_functions/polygamma.hpp @@ -18,7 +18,7 @@ namespace boost { namespace math { - template + BOOST_MATH_EXPORT template inline typename tools::promote_args::type polygamma(const int n, T x, const Policy& pol) { // @@ -71,7 +71,7 @@ namespace boost { namespace math { "boost::math::polygamma<%1%>(int, %1%)"); } - template + BOOST_MATH_EXPORT template inline typename tools::promote_args::type polygamma(const int n, T x) { return boost::math::polygamma(n, x, policies::policy<>()); diff --git a/include/boost/math/special_functions/pow.hpp b/include/boost/math/special_functions/pow.hpp index 7a1bb14eba..2f2b431f45 100644 --- a/include/boost/math/special_functions/pow.hpp +++ b/include/boost/math/special_functions/pow.hpp @@ -122,14 +122,14 @@ struct select_power_if_positive } // namespace detail -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED constexpr inline typename tools::promote_args::type pow(T base, const Policy& policy) { using result_type = typename tools::promote_args::type; return detail::select_power_if_positive::type::result(static_cast(base), policy); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED constexpr inline typename tools::promote_args::type pow(T base) { return pow(base, policies::policy<>()); } diff --git a/include/boost/math/special_functions/powm1.hpp b/include/boost/math/special_functions/powm1.hpp index 80d02dc299..fdd3313085 100644 --- a/include/boost/math/special_functions/powm1.hpp +++ b/include/boost/math/special_functions/powm1.hpp @@ -70,7 +70,7 @@ BOOST_MATH_GPU_ENABLED inline T powm1_imp_dispatch(const T x, const T y, const P } // detail -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type powm1(const T1 a, const T2 z) { @@ -78,7 +78,7 @@ BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type return detail::powm1_imp_dispatch(static_cast(a), static_cast(z), policies::policy<>()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type powm1(const T1 a, const T2 z, const Policy& pol) { diff --git a/include/boost/math/special_functions/prime.hpp b/include/boost/math/special_functions/prime.hpp index acc219c9fe..85263d7e83 100644 --- a/include/boost/math/special_functions/prime.hpp +++ b/include/boost/math/special_functions/prime.hpp @@ -2408,7 +2408,7 @@ constexpr std::array prime_data_imp::a3; using prime_data = prime_data_imp; - template + BOOST_MATH_EXPORT template BOOST_MATH_CONSTEXPR_TABLE_FUNCTION std::uint32_t prime(unsigned n, const Policy& pol) { diff --git a/include/boost/math/special_functions/relative_difference.hpp b/include/boost/math/special_functions/relative_difference.hpp index f0f02a893c..b16b238f22 100644 --- a/include/boost/math/special_functions/relative_difference.hpp +++ b/include/boost/math/special_functions/relative_difference.hpp @@ -13,7 +13,7 @@ namespace boost{ namespace math{ - template + BOOST_MATH_EXPORT template typename boost::math::tools::promote_args::type relative_difference(const T& arg_a, const U& arg_b) { typedef typename boost::math::tools::promote_args::type result_type; @@ -70,7 +70,7 @@ namespace boost{ } #if (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)) && (LDBL_MAX_EXP <= DBL_MAX_EXP) - template <> + BOOST_MATH_EXPORT template <> inline boost::math::tools::promote_args::type relative_difference(const double& arg_a, const double& arg_b) { BOOST_MATH_STD_USING @@ -119,7 +119,7 @@ namespace boost{ } #endif - template + BOOST_MATH_EXPORT template inline typename boost::math::tools::promote_args::type epsilon_difference(const T& arg_a, const U& arg_b) { typedef typename boost::math::tools::promote_args::type result_type; diff --git a/include/boost/math/special_functions/round.hpp b/include/boost/math/special_functions/round.hpp index 7569950e86..fef0810615 100644 --- a/include/boost/math/special_functions/round.hpp +++ b/include/boost/math/special_functions/round.hpp @@ -77,12 +77,12 @@ BOOST_MATH_GPU_ENABLED inline tools::promote_args_t round(const T& v, const P } // namespace detail -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline tools::promote_args_t round(const T& v, const Policy& pol) { return detail::round(v, pol, std::integral_constant::value>()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline tools::promote_args_t round(const T& v) { return round(v, policies::policy<>()); @@ -100,7 +100,7 @@ BOOST_MATH_GPU_ENABLED inline tools::promote_args_t round(const T& v) // is to avoid macro substiution from MSVC // https://stackoverflow.com/questions/27442885/syntax-error-with-stdnumeric-limitsmax // -template +BOOST_MATH_EXPORT template inline int iround(const T& v, const Policy& pol) { BOOST_MATH_STD_USING @@ -142,13 +142,13 @@ inline int iround(const T& v, const Policy& pol) return static_cast(r); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline int iround(const T& v) { return iround(v, policies::policy<>()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline long lround(const T& v, const Policy& pol) { BOOST_MATH_STD_USING @@ -190,13 +190,13 @@ BOOST_MATH_GPU_ENABLED inline long lround(const T& v, const Policy& pol) return static_cast(r); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline long lround(const T& v) { return lround(v, policies::policy<>()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline long long llround(const T& v, const Policy& pol) { BOOST_MATH_STD_USING @@ -238,7 +238,7 @@ BOOST_MATH_GPU_ENABLED inline long long llround(const T& v, const Policy& pol) return static_cast(r); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline long long llround(const T& v) { return llround(v, policies::policy<>()); @@ -251,97 +251,97 @@ BOOST_MATH_GPU_ENABLED inline long long llround(const T& v) namespace boost { namespace math { -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED T round(T x) { return ::round(x); } -template <> +BOOST_MATH_EXPORT template <> BOOST_MATH_GPU_ENABLED float round(float x) { return ::roundf(x); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED T round(T x, const Policy&) { return ::round(x); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED float round(float x, const Policy&) { return ::roundf(x); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED int iround(T x) { return static_cast(::lround(x)); } -template <> +BOOST_MATH_EXPORT template <> BOOST_MATH_GPU_ENABLED int iround(float x) { return static_cast(::lroundf(x)); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED int iround(T x, const Policy&) { return static_cast(::lround(x)); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED int iround(float x, const Policy&) { return static_cast(::lroundf(x)); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED long lround(T x) { return ::lround(x); } -template <> +BOOST_MATH_EXPORT template <> BOOST_MATH_GPU_ENABLED long lround(float x) { return ::lroundf(x); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED long lround(T x, const Policy&) { return ::lround(x); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED long lround(float x, const Policy&) { return ::lroundf(x); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED long long llround(T x) { return ::llround(x); } -template <> +BOOST_MATH_EXPORT template <> BOOST_MATH_GPU_ENABLED long long llround(float x) { return ::llroundf(x); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED long long llround(T x, const Policy&) { return ::llround(x); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED long long llround(float x, const Policy&) { return ::llroundf(x); diff --git a/include/boost/math/special_functions/rsqrt.hpp b/include/boost/math/special_functions/rsqrt.hpp index f903b056d7..5ae008f116 100644 --- a/include/boost/math/special_functions/rsqrt.hpp +++ b/include/boost/math/special_functions/rsqrt.hpp @@ -11,6 +11,7 @@ #include #endif +#include #include #ifndef BOOST_MATH_STANDALONE # include @@ -21,7 +22,7 @@ namespace boost::math { -template +BOOST_MATH_EXPORT template inline Real rsqrt(Real const & x) { using std::sqrt; diff --git a/include/boost/math/special_functions/sign.hpp b/include/boost/math/special_functions/sign.hpp index 5d2dfc2e23..826299086b 100644 --- a/include/boost/math/special_functions/sign.hpp +++ b/include/boost/math/special_functions/sign.hpp @@ -164,7 +164,7 @@ BOOST_MATH_GPU_ENABLED int (signbit)(T x) return detail::signbit_impl(static_cast(x), method()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline int sign BOOST_NO_MACRO_EXPAND(const T& z) { return (z == 0) ? 0 : (boost::math::signbit)(z) ? -1 : 1; @@ -181,7 +181,7 @@ BOOST_MATH_GPU_ENABLED typename tools::promote_args_permissive::type (changes return detail::changesign_impl(static_cast(x), method()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args_permissive::type copysign BOOST_NO_MACRO_EXPAND(const T& x, const U& y) { @@ -201,31 +201,31 @@ BOOST_MATH_GPU_ENABLED inline typename tools::promote_args_permissive::typ namespace boost { namespace math { -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED int signbit(T x) { return ::signbit(x); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED T changesign(T x) { return -x; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED T copysign(T x, T y) { return ::copysign(x, y); } -template <> +BOOST_MATH_EXPORT template <> BOOST_MATH_GPU_ENABLED float copysign(float x, float y) { return ::copysignf(x, y); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED T sign(T z) { return (z == 0) ? 0 : ::signbit(z) ? -1 : 1; diff --git a/include/boost/math/special_functions/sin_pi.hpp b/include/boost/math/special_functions/sin_pi.hpp index c388396681..7b8454f70f 100644 --- a/include/boost/math/special_functions/sin_pi.hpp +++ b/include/boost/math/special_functions/sin_pi.hpp @@ -74,7 +74,7 @@ BOOST_MATH_GPU_ENABLED inline T sin_pi_dispatch(T x, const Policy& pol) } // namespace detail -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type sin_pi(T x, const Policy&) { typedef typename tools::promote_args::type result_type; @@ -91,7 +91,7 @@ BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type sin_pi(T x, return policies::checked_narrowing_cast(boost::math::detail::sin_pi_dispatch(x, forwarding_policy()), "sin_pi"); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type sin_pi(T x) { return boost::math::sin_pi(x, policies::policy<>()); @@ -104,25 +104,25 @@ inline typename tools::promote_args::type sin_pi(T x) namespace boost { namespace math { -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED auto sin_pi(T x) { return ::sinpi(x); } -template <> +BOOST_MATH_EXPORT template <> BOOST_MATH_GPU_ENABLED auto sin_pi(float x) { return ::sinpif(x); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED auto sin_pi(T x, const Policy&) { return ::sinpi(x); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED auto sin_pi(float x, const Policy&) { return ::sinpif(x); diff --git a/include/boost/math/special_functions/sinc.hpp b/include/boost/math/special_functions/sinc.hpp index 0c18ac3468..c610850f11 100644 --- a/include/boost/math/special_functions/sinc.hpp +++ b/include/boost/math/special_functions/sinc.hpp @@ -57,21 +57,21 @@ namespace boost } // namespace detail - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type sinc_pi(T x) { typedef typename tools::promote_args::type result_type; return detail::sinc_pi_imp(static_cast(x)); } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type sinc_pi(T x, const Policy&) { typedef typename tools::promote_args::type result_type; return detail::sinc_pi_imp(static_cast(x)); } - template class U> + BOOST_MATH_EXPORT template class U> BOOST_MATH_GPU_ENABLED inline U sinc_pi(const U x) { BOOST_MATH_STD_USING @@ -111,7 +111,7 @@ namespace boost } } - template class U, class Policy> + BOOST_MATH_EXPORT template class U, class Policy> BOOST_MATH_GPU_ENABLED inline U sinc_pi(const U x, const Policy&) { return sinc_pi(x); diff --git a/include/boost/math/special_functions/sinhc.hpp b/include/boost/math/special_functions/sinhc.hpp index 1e2aa1503f..010336cff9 100644 --- a/include/boost/math/special_functions/sinhc.hpp +++ b/include/boost/math/special_functions/sinhc.hpp @@ -80,21 +80,21 @@ namespace boost } // namespace detail - template + BOOST_MATH_EXPORT template inline typename tools::promote_args::type sinhc_pi(T x, const Policy& pol) { typedef typename tools::promote_args::type result_type; return policies::checked_narrowing_cast(detail::sinhc_pi_imp(static_cast(x), pol), "sinhc(%1%)"); } - template + BOOST_MATH_EXPORT template inline typename tools::promote_args::type sinhc_pi(T x) { typedef typename tools::promote_args::type result_type; return sinhc_pi(static_cast(x), policies::policy<>()); } - template class U> + BOOST_MATH_EXPORT template class U> inline U sinhc_pi(const U x) { using std::abs; diff --git a/include/boost/math/special_functions/spherical_harmonic.hpp b/include/boost/math/special_functions/spherical_harmonic.hpp index 5f025f5931..9e90b927d6 100644 --- a/include/boost/math/special_functions/spherical_harmonic.hpp +++ b/include/boost/math/special_functions/spherical_harmonic.hpp @@ -150,7 +150,7 @@ std::complex spherical_harmonic(unsigned n, int m, U theta, U phi, const Poli } // namespace detail -template +BOOST_MATH_EXPORT template inline std::complex::type> spherical_harmonic(unsigned n, int m, T1 theta, T2 phi, const Policy& pol) { @@ -159,14 +159,14 @@ inline std::complex::type> return detail::spherical_harmonic(n, m, static_cast(theta), static_cast(phi), pol); } -template +BOOST_MATH_EXPORT template inline std::complex::type> spherical_harmonic(unsigned n, int m, T1 theta, T2 phi) { return boost::math::spherical_harmonic(n, m, theta, phi, policies::policy<>()); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type spherical_harmonic_r(unsigned n, int m, T1 theta, T2 phi, const Policy& pol) { @@ -175,14 +175,14 @@ inline typename tools::promote_args::type return policies::checked_narrowing_cast(detail::spherical_harmonic_r(n, m, static_cast(theta), static_cast(phi), pol), "boost::math::spherical_harmonic_r<%1%>(unsigned, int, %1%, %1%)"); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type spherical_harmonic_r(unsigned n, int m, T1 theta, T2 phi) { return boost::math::spherical_harmonic_r(n, m, theta, phi, policies::policy<>()); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type spherical_harmonic_i(unsigned n, int m, T1 theta, T2 phi, const Policy& pol) { @@ -191,7 +191,7 @@ inline typename tools::promote_args::type return policies::checked_narrowing_cast(detail::spherical_harmonic_i(n, m, static_cast(theta), static_cast(phi), pol), "boost::math::spherical_harmonic_i<%1%>(unsigned, int, %1%, %1%)"); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type spherical_harmonic_i(unsigned n, int m, T1 theta, T2 phi) { diff --git a/include/boost/math/special_functions/sqrt1pm1.hpp b/include/boost/math/special_functions/sqrt1pm1.hpp index 4d8aeb38cf..38d187da54 100644 --- a/include/boost/math/special_functions/sqrt1pm1.hpp +++ b/include/boost/math/special_functions/sqrt1pm1.hpp @@ -21,7 +21,7 @@ namespace boost{ namespace math{ -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type sqrt1pm1(const T& val, const Policy& pol) { typedef typename tools::promote_args::type result_type; @@ -32,7 +32,7 @@ BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type sqrt1pm1(con return boost::math::expm1(boost::math::log1p(val, pol) / 2, pol); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type sqrt1pm1(const T& val) { return sqrt1pm1(val, policies::policy<>()); diff --git a/include/boost/math/special_functions/trigamma.hpp b/include/boost/math/special_functions/trigamma.hpp index 7ac99466cb..eb577f59f9 100644 --- a/include/boost/math/special_functions/trigamma.hpp +++ b/include/boost/math/special_functions/trigamma.hpp @@ -412,7 +412,7 @@ BOOST_MATH_GPU_ENABLED T trigamma_dispatch(T x, const Policy& pol, const Tag& ta } // namespace detail -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type trigamma(T x, const Policy&) { @@ -435,7 +435,7 @@ BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type return policies::checked_narrowing_cast(detail::trigamma_dispatch(static_cast(x), forwarding_policy(), tag_type()), "boost::math::trigamma<%1%>(%1%)"); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename tools::promote_args::type trigamma(T x) { diff --git a/include/boost/math/special_functions/trunc.hpp b/include/boost/math/special_functions/trunc.hpp index c78adc0f65..bdc59a3518 100644 --- a/include/boost/math/special_functions/trunc.hpp +++ b/include/boost/math/special_functions/trunc.hpp @@ -53,13 +53,13 @@ BOOST_MATH_GPU_ENABLED inline tools::promote_args_t trunc(const T& v, const P } // Namespace detail -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline tools::promote_args_t trunc(const T& v, const Policy& pol) { return detail::trunc(v, pol, std::integral_constant::value>()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline tools::promote_args_t trunc(const T& v) { return trunc(v, policies::policy<>()); @@ -90,13 +90,13 @@ BOOST_MATH_GPU_ENABLED inline double trunc_impl(double x) } // Namespace detail -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED auto trunc(T x, const Policy&) { return detail::trunc_impl(x); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED auto trunc(T x) { return detail::trunc_impl(x); @@ -119,7 +119,7 @@ BOOST_MATH_GPU_ENABLED auto trunc(T x) // is to avoid macro substiution from MSVC // https://stackoverflow.com/questions/27442885/syntax-error-with-stdnumeric-limitsmax // -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline int itrunc(const T& v, const Policy& pol) { BOOST_MATH_STD_USING @@ -161,13 +161,13 @@ BOOST_MATH_GPU_ENABLED inline int itrunc(const T& v, const Policy& pol) return static_cast(r); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline int itrunc(const T& v) { return itrunc(v, policies::policy<>()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline long ltrunc(const T& v, const Policy& pol) { BOOST_MATH_STD_USING @@ -209,13 +209,13 @@ BOOST_MATH_GPU_ENABLED inline long ltrunc(const T& v, const Policy& pol) return static_cast(r); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline long ltrunc(const T& v) { return ltrunc(v, policies::policy<>()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline long long lltrunc(const T& v, const Policy& pol) { BOOST_MATH_STD_USING @@ -257,7 +257,7 @@ BOOST_MATH_GPU_ENABLED inline long long lltrunc(const T& v, const Policy& pol) return static_cast(r); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline long long lltrunc(const T& v) { return lltrunc(v, policies::policy<>()); @@ -284,37 +284,37 @@ BOOST_MATH_GPU_ENABLED TargetType integer_trunc_impl(T v) } // Namespace detail -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED int itrunc(T v) { return detail::integer_trunc_impl(v); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED int itrunc(T v, const Policy&) { return detail::integer_trunc_impl(v); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED long ltrunc(T v) { return detail::integer_trunc_impl(v); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED long ltrunc(T v, const Policy&) { return detail::integer_trunc_impl(v); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED long long lltrunc(T v) { return detail::integer_trunc_impl(v); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED long long lltrunc(T v, const Policy&) { return detail::integer_trunc_impl(v); diff --git a/include/boost/math/special_functions/ulp.hpp b/include/boost/math/special_functions/ulp.hpp index 5805c171a3..9404a7832d 100644 --- a/include/boost/math/special_functions/ulp.hpp +++ b/include/boost/math/special_functions/ulp.hpp @@ -82,14 +82,14 @@ T ulp_imp(const T& val, const std::false_type&, const Policy& pol) } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type ulp(const T& val, const Policy& pol) { typedef typename tools::promote_args::type result_type; return detail::ulp_imp(static_cast(val), std::integral_constant::is_specialized || (std::numeric_limits::radix == 2)>(), pol); } -template +BOOST_MATH_EXPORT template inline typename tools::promote_args::type ulp(const T& val) { return ulp(val, policies::policy<>()); diff --git a/module/CMakeLists.txt b/module/CMakeLists.txt index 12ab1d5fa3..057dd01b61 100644 --- a/module/CMakeLists.txt +++ b/module/CMakeLists.txt @@ -54,6 +54,11 @@ message(STATUS "Boost.Math module: using 'import std;'") # Tests that switch to `import boost.math;` when BOOST_MATH_BUILD_MODULE is set. # The list grows as components are added to the module interface unit. set(BOOST_MATH_MODULE_TESTS + test_digamma_simple + test_expm1_simple + test_log1p_simple + git_issue_1194 + git_issue_1255 ) add_executable(module_quick_test "${CMAKE_CURRENT_SOURCE_DIR}/quick_test.cpp") diff --git a/module/math.cxx b/module/math.cxx index 582f6c8fcf..7e71230512 100644 --- a/module/math.cxx +++ b/module/math.cxx @@ -123,6 +123,9 @@ import std; #include #include +// Special functions (umbrella) +#include + #ifdef _MSC_VER # pragma warning( pop ) #elif defined(__clang__) diff --git a/module/quick_test.cpp b/module/quick_test.cpp index 84e543c48e..d94841ec95 100644 --- a/module/quick_test.cpp +++ b/module/quick_test.cpp @@ -36,5 +36,21 @@ int main() static_assert(boost::math::policies::is_noexcept_error_policy< boost::math::policies::policy<>>::value == false, "default policy throws"); + // special functions + BOOST_TEST_EQ(boost::math::tgamma(4.0), 6.0); + BOOST_TEST_EQ(boost::math::sign(-3.5), -1); + BOOST_TEST(boost::math::isnan(std::sqrt(-1.0))); + BOOST_TEST_EQ(boost::math::round(2.5), 3.0); + BOOST_TEST_EQ(boost::math::factorial(5), 120.0); + BOOST_TEST_EQ(boost::math::fpclassify(1.0), FP_NORMAL); + { + const auto erf_value {boost::math::erf(1.0)}; + BOOST_TEST_GT(erf_value, 0.84); + BOOST_TEST_LT(erf_value, 0.85); + const auto bessel_value {boost::math::cyl_bessel_j(0, 1.0)}; + BOOST_TEST_GT(bessel_value, 0.76); + BOOST_TEST_LT(bessel_value, 0.77); + } + return boost::report_errors(); } diff --git a/test/git_issue_1194.cpp b/test/git_issue_1194.cpp index 1c364a0c4d..58e273f999 100644 --- a/test/git_issue_1194.cpp +++ b/test/git_issue_1194.cpp @@ -3,8 +3,13 @@ // 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 "math_unit_test.hpp" +#ifndef BOOST_MATH_BUILD_MODULE #include +#else +import boost.math; +#endif + +#include "math_unit_test.hpp" #include int main() diff --git a/test/git_issue_1255.cpp b/test/git_issue_1255.cpp index 133986a2d6..3ff60d638a 100644 --- a/test/git_issue_1255.cpp +++ b/test/git_issue_1255.cpp @@ -6,7 +6,12 @@ // See also: https://godbolt.org/z/nhMsKb8Yr #include + +#ifndef BOOST_MATH_BUILD_MODULE #include +#else +import boost.math; +#endif #include #include diff --git a/test/math_unit_test.hpp b/test/math_unit_test.hpp index bd85caa86b..be1c953b1a 100644 --- a/test/math_unit_test.hpp +++ b/test/math_unit_test.hpp @@ -13,8 +13,12 @@ #include #include #include +// In module mode these declarations come from `import boost.math;`, which the +// including test performs before this header. +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#endif #if defined __has_include # if __has_include() #define BOOST_MATH_HAS_CXX_ABI 1 diff --git a/test/test_digamma_simple.cpp b/test/test_digamma_simple.cpp index 30aeb29e4b..ab4af50b6e 100644 --- a/test/test_digamma_simple.cpp +++ b/test/test_digamma_simple.cpp @@ -8,7 +8,12 @@ #include "sycl/sycl.hpp" #endif +#ifndef BOOST_MATH_BUILD_MODULE #include +#else +import boost.math; +#endif + #include "math_unit_test.hpp" template diff --git a/test/test_expm1_simple.cpp b/test/test_expm1_simple.cpp index 22b88a22cb..44ef924ffb 100644 --- a/test/test_expm1_simple.cpp +++ b/test/test_expm1_simple.cpp @@ -7,9 +7,14 @@ #include "sycl/sycl.hpp" #endif +#ifndef BOOST_MATH_BUILD_MODULE +#include +#else +import boost.math; +#endif + #include #include -#include #include "math_unit_test.hpp" constexpr int N = 50000; diff --git a/test/test_log1p_simple.cpp b/test/test_log1p_simple.cpp index 782805a856..b0c3b87839 100644 --- a/test/test_log1p_simple.cpp +++ b/test/test_log1p_simple.cpp @@ -7,9 +7,14 @@ #include "sycl/sycl.hpp" #endif +#ifndef BOOST_MATH_BUILD_MODULE +#include +#else +import boost.math; +#endif + #include #include -#include #include "math_unit_test.hpp" constexpr int N = 50000; From 5ee0d7734c6470a93bbba0742460681226f75246 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Wed, 15 Jul 2026 10:52:41 -0400 Subject: [PATCH 04/27] Export the statistical distributions for the boost.math module * BOOST_MATH_EXPORT on the 38 distribution class templates (fwd.hpp and definition sites), every non-member accessor overload, the convenience typedefs, the complement machinery and find_location/find_scale * distributions/fwd.hpp now includes tools/config.hpp so the export macro is always defined * Adds distributions.hpp to the module interface unit * Module test harness gains git_issue_1294, git_issue_800, git_issue_1120 and scipy_issue_17146 --- include/boost/math/distributions/arcsine.hpp | 36 ++++----- .../boost/math/distributions/bernoulli.hpp | 32 ++++---- include/boost/math/distributions/beta.hpp | 32 ++++---- include/boost/math/distributions/binomial.hpp | 38 ++++----- include/boost/math/distributions/cauchy.hpp | 40 +++++----- .../boost/math/distributions/chi_squared.hpp | 32 ++++---- .../boost/math/distributions/complement.hpp | 24 +++--- .../detail/derived_accessors.hpp | 30 +++---- .../boost/math/distributions/exponential.hpp | 42 +++++----- .../math/distributions/extreme_value.hpp | 42 +++++----- .../math/distributions/find_location.hpp | 8 +- .../boost/math/distributions/find_scale.hpp | 8 +- include/boost/math/distributions/fisher_f.hpp | 34 ++++---- include/boost/math/distributions/fwd.hpp | 78 ++++++++++--------- include/boost/math/distributions/gamma.hpp | 36 ++++----- .../boost/math/distributions/geometric.hpp | 36 ++++----- .../boost/math/distributions/holtsmark.hpp | 40 +++++----- .../math/distributions/hyperexponential.hpp | 32 ++++---- .../math/distributions/hypergeometric.hpp | 36 ++++----- .../distributions/inverse_chi_squared.hpp | 34 ++++---- .../math/distributions/inverse_gamma.hpp | 36 ++++----- .../math/distributions/inverse_gaussian.hpp | 36 ++++----- .../math/distributions/kolmogorov_smirnov.hpp | 32 ++++---- include/boost/math/distributions/landau.hpp | 40 +++++----- include/boost/math/distributions/laplace.hpp | 44 +++++------ include/boost/math/distributions/logistic.hpp | 42 +++++----- .../boost/math/distributions/lognormal.hpp | 38 ++++----- include/boost/math/distributions/mapairy.hpp | 40 +++++----- .../math/distributions/negative_binomial.hpp | 32 ++++---- .../math/distributions/non_central_beta.hpp | 34 ++++---- .../distributions/non_central_chi_squared.hpp | 34 ++++---- .../math/distributions/non_central_f.hpp | 32 ++++---- .../math/distributions/non_central_t.hpp | 34 ++++---- include/boost/math/distributions/normal.hpp | 40 +++++----- include/boost/math/distributions/pareto.hpp | 42 +++++----- include/boost/math/distributions/poisson.hpp | 34 ++++---- include/boost/math/distributions/rayleigh.hpp | 42 +++++----- .../boost/math/distributions/saspoint5.hpp | 40 +++++----- .../boost/math/distributions/skew_normal.hpp | 36 ++++----- .../boost/math/distributions/students_t.hpp | 36 ++++----- .../boost/math/distributions/triangular.hpp | 40 +++++----- include/boost/math/distributions/uniform.hpp | 38 ++++----- include/boost/math/distributions/weibull.hpp | 44 +++++------ module/CMakeLists.txt | 4 + module/math.cxx | 3 + module/quick_test.cpp | 13 ++++ test/git_issue_1120.cpp | 7 +- test/git_issue_1294.cpp | 5 ++ test/git_issue_800.cpp | 7 +- test/scipy_issue_17146.cpp | 7 +- 50 files changed, 822 insertions(+), 780 deletions(-) diff --git a/include/boost/math/distributions/arcsine.hpp b/include/boost/math/distributions/arcsine.hpp index f7a57e15c0..ded35dd9d0 100644 --- a/include/boost/math/distributions/arcsine.hpp +++ b/include/boost/math/distributions/arcsine.hpp @@ -266,7 +266,7 @@ namespace boost } } // namespace arcsine_detail - template > + BOOST_MATH_EXPORT template > class arcsine_distribution { public: @@ -299,30 +299,30 @@ namespace boost }; // template class arcsine_distribution // Convenient typedef to construct double version. - typedef arcsine_distribution arcsine; + BOOST_MATH_EXPORT typedef arcsine_distribution arcsine; #ifdef __cpp_deduction_guides - template + BOOST_MATH_EXPORT template arcsine_distribution(RealType)->arcsine_distribution::type>; - template + BOOST_MATH_EXPORT template arcsine_distribution(RealType, RealType)->arcsine_distribution::type>; #endif - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline const boost::math::pair range(const arcsine_distribution& dist) { // Range of permissible values for random variable x. using boost::math::tools::max_value; return boost::math::pair(static_cast(dist.x_min()), static_cast(dist.x_max())); } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline const boost::math::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 boost::math::pair(static_cast(dist.x_min()), static_cast(dist.x_max())); } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mean(const arcsine_distribution& dist) { // Mean of arcsine distribution . RealType result; @@ -343,7 +343,7 @@ namespace boost return static_cast(arcsine_detail::arcsine_mean(static_cast(x_min), static_cast(x_max))); } // mean - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType variance(const arcsine_distribution& dist) { // Variance of standard arcsine distribution = (1-0)/8 = 0.125. RealType result; @@ -363,7 +363,7 @@ namespace boost return static_cast(arcsine_detail::arcsine_variance(static_cast(x_min), static_cast(x_max))); } // variance - template + BOOST_MATH_EXPORT template 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. @@ -374,7 +374,7 @@ namespace boost std::numeric_limits::quiet_NaN(), Policy()); } // mode - template + BOOST_MATH_EXPORT template 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(); @@ -394,7 +394,7 @@ namespace boost return static_cast(arcsine_detail::arcsine_mean(static_cast(x_min), static_cast(x_max))); } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType skewness(const arcsine_distribution& dist) { RealType result; @@ -413,7 +413,7 @@ namespace boost return 0; } // skewness - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis_excess(const arcsine_distribution& dist) { RealType result; @@ -432,7 +432,7 @@ namespace boost return static_cast(-1.5f); } // kurtosis_excess - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis(const arcsine_distribution& dist) { RealType result; @@ -451,7 +451,7 @@ namespace boost return static_cast(1.5f); } // kurtosis - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType pdf(const arcsine_distribution& dist, const RealType& xx) { // Probability Density/Mass Function arcsine. BOOST_FPU_EXCEPTION_GUARD @@ -477,7 +477,7 @@ namespace boost static_cast(x_max))); } // pdf - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const arcsine_distribution& dist, const RealType& x) { // Cumulative Distribution Function arcsine. RealType x_min = dist.x_min(); @@ -500,7 +500,7 @@ namespace boost static_cast(x_max))); } // arcsine cdf - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const complemented2_type, RealType>& c) { // Complemented Cumulative Distribution Function arcsine. RealType x = c.param; @@ -525,7 +525,7 @@ namespace boost static_cast(x_max))); } // arcsine ccdf - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const arcsine_distribution& dist, const RealType& p) { // Quantile or Percent Point arcsine function or @@ -554,7 +554,7 @@ namespace boost static_cast(x_max))); } // quantile - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const complemented2_type, RealType>& c) { // Complement Quantile or Percent Point arcsine function. diff --git a/include/boost/math/distributions/bernoulli.hpp b/include/boost/math/distributions/bernoulli.hpp index 50f18cd463..811b18ec1b 100644 --- a/include/boost/math/distributions/bernoulli.hpp +++ b/include/boost/math/distributions/bernoulli.hpp @@ -108,7 +108,7 @@ namespace boost } // namespace bernoulli_detail - template > + BOOST_MATH_EXPORT template > class bernoulli_distribution { public: @@ -134,28 +134,28 @@ namespace boost RealType m_p; // success_fraction }; // template class bernoulli_distribution - typedef bernoulli_distribution bernoulli; + BOOST_MATH_EXPORT typedef bernoulli_distribution bernoulli; #ifdef __cpp_deduction_guides - template + BOOST_MATH_EXPORT template bernoulli_distribution(RealType)->bernoulli_distribution::type>; #endif - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline const boost::math::pair range(const bernoulli_distribution& /* dist */) { // Range of permissible values for random variable k = {0, 1}. using boost::math::tools::max_value; return boost::math::pair(static_cast(0), static_cast(1)); } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline const boost::math::pair support(const bernoulli_distribution& /* dist */) { // Range of supported values for random variable k = {0, 1}. // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero. return boost::math::pair(static_cast(0), static_cast(1)); } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mean(const bernoulli_distribution& dist) { // Mean of bernoulli distribution = p (n = 1). return dist.success_fraction(); @@ -168,13 +168,13 @@ namespace boost // return tools::domain_error(BOOST_CURRENT_FUNCTION, "Median is not implemented, result is %1%!", std::numeric_limits::quiet_NaN()); //} // median - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType variance(const bernoulli_distribution& dist) { // Variance of bernoulli distribution =p * q. return dist.success_fraction() * (1 - dist.success_fraction()); } // variance - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED RealType pdf(const bernoulli_distribution& dist, const RealType& k) { // Probability Density/Mass Function. BOOST_FPU_EXCEPTION_GUARD @@ -199,7 +199,7 @@ namespace boost } } // pdf - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const bernoulli_distribution& dist, const RealType& k) { // Cumulative Distribution Function Bernoulli. RealType p = dist.success_fraction(); @@ -223,7 +223,7 @@ namespace boost } } // bernoulli cdf - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const complemented2_type, RealType>& c) { // Complemented Cumulative Distribution Function bernoulli. RealType const& k = c.param; @@ -249,7 +249,7 @@ namespace boost } } // bernoulli cdf complement - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const bernoulli_distribution& dist, const RealType& p) { // Quantile or Percent Point Bernoulli function. // Return the number of expected successes k either 0 or 1. @@ -274,7 +274,7 @@ namespace boost } } // quantile - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const complemented2_type, RealType>& c) { // Quantile or Percent Point bernoulli function. // Return the number of expected successes k for a given @@ -303,13 +303,13 @@ namespace boost } } // quantile complemented. - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mode(const bernoulli_distribution& dist) { return static_cast((dist.success_fraction() <= 0.5) ? 0 : 1); // p = 0.5 can be 0 or 1 } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType skewness(const bernoulli_distribution& dist) { BOOST_MATH_STD_USING; // Aid ADL for sqrt. @@ -317,7 +317,7 @@ namespace boost return (1 - 2 * p) / sqrt(p * (1 - p)); } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis_excess(const bernoulli_distribution& dist) { RealType p = dist.success_fraction(); @@ -328,7 +328,7 @@ namespace boost return 1 / (1 - p) + 1/p -6; } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis(const bernoulli_distribution& dist) { RealType p = dist.success_fraction(); diff --git a/include/boost/math/distributions/beta.hpp b/include/boost/math/distributions/beta.hpp index fef991a870..45fc99b649 100644 --- a/include/boost/math/distributions/beta.hpp +++ b/include/boost/math/distributions/beta.hpp @@ -151,7 +151,7 @@ namespace boost // is deliberately NOT included to avoid a name clash with the beta function. // Use beta_distribution<> mybeta(...) to construct type double. - template > + BOOST_MATH_EXPORT template > class beta_distribution { public: @@ -275,33 +275,33 @@ namespace boost }; // template class beta_distribution #ifdef __cpp_deduction_guides - template + BOOST_MATH_EXPORT template beta_distribution(RealType)->beta_distribution::type>; - template + BOOST_MATH_EXPORT template beta_distribution(RealType, RealType)->beta_distribution::type>; #endif - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline const boost::math::pair range(const beta_distribution& /* dist */) { // Range of permissible values for random variable x. using boost::math::tools::max_value; return boost::math::pair(static_cast(0), static_cast(1)); } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline const boost::math::pair support(const beta_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 boost::math::pair(static_cast(0), static_cast(1)); } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mean(const beta_distribution& dist) { // Mean of beta distribution = np. return dist.alpha() / (dist.alpha() + dist.beta()); } // mean - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType variance(const beta_distribution& dist) { // Variance of beta distribution = np(1-p). RealType a = dist.alpha(); @@ -309,7 +309,7 @@ namespace boost return (a * b) / ((a + b ) * (a + b) * (a + b + 1)); } // variance - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mode(const beta_distribution& dist) { constexpr auto function = "boost::math::mode(beta_distribution<%1%> const&)"; @@ -343,7 +343,7 @@ namespace boost //But WILL be provided by the derived accessor as quantile(0.5). - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType skewness(const beta_distribution& dist) { BOOST_MATH_STD_USING // ADL of std functions. @@ -352,7 +352,7 @@ namespace boost return (2 * (b-a) * sqrt(a + b + 1)) / ((a + b + 2) * sqrt(a * b)); } // skewness - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis_excess(const beta_distribution& dist) { RealType a = dist.alpha(); @@ -363,13 +363,13 @@ namespace boost return n / d; } // kurtosis_excess - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis(const beta_distribution& dist) { return 3 + kurtosis_excess(dist); } // kurtosis - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType pdf(const beta_distribution& dist, const RealType& x) { // Probability Density/Mass Function. BOOST_FPU_EXCEPTION_GUARD @@ -428,7 +428,7 @@ namespace boost return static_cast(ibeta_derivative(a, b, x, Policy())); } // pdf - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const beta_distribution& dist, const RealType& x) { // Cumulative Distribution Function beta. BOOST_MATH_STD_USING // for ADL of std functions @@ -459,7 +459,7 @@ namespace boost return static_cast(ibeta(a, b, x, Policy())); } // beta cdf - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const complemented2_type, RealType>& c) { // Complemented Cumulative Distribution Function beta. @@ -495,7 +495,7 @@ namespace boost return static_cast(ibetac(a, b, x, Policy())); } // beta cdf - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const beta_distribution& dist, const RealType& p) { // Quantile or Percent Point beta function or // Inverse Cumulative probability distribution function CDF. @@ -530,7 +530,7 @@ namespace boost return static_cast(ibeta_inv(a, b, p, static_cast(nullptr), Policy())); } // quantile - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const complemented2_type, RealType>& c) { // Complement Quantile or Percent Point beta 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 94817ac5a4..b278d6db3c 100644 --- a/include/boost/math/distributions/binomial.hpp +++ b/include/boost/math/distributions/binomial.hpp @@ -98,7 +98,7 @@ namespace boost namespace math { - template + BOOST_MATH_EXPORT template class binomial_distribution; namespace binomial_detail{ @@ -276,7 +276,7 @@ namespace boost } - template > + BOOST_MATH_EXPORT template > class binomial_distribution { public: @@ -410,45 +410,45 @@ namespace boost RealType m_p; // success_fraction }; // template class binomial_distribution - typedef binomial_distribution<> binomial; + BOOST_MATH_EXPORT typedef binomial_distribution<> binomial; // typedef binomial_distribution binomial; // IS now included since no longer a name clash with function binomial. //typedef binomial_distribution binomial; // Reserved name of type double. #ifdef __cpp_deduction_guides - template + BOOST_MATH_EXPORT template binomial_distribution(RealType)->binomial_distribution::type>; - template + BOOST_MATH_EXPORT template binomial_distribution(RealType,RealType)->binomial_distribution::type>; #endif - template + BOOST_MATH_EXPORT template BOOST_MATH_CUDA_ENABLED const boost::math::pair range(const binomial_distribution& dist) { // Range of permissible values for random variable k. using boost::math::tools::max_value; return boost::math::pair(static_cast(0), dist.trials()); } - template + BOOST_MATH_EXPORT template BOOST_MATH_CUDA_ENABLED const boost::math::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 boost::math::pair(static_cast(0), dist.trials()); } - template + BOOST_MATH_EXPORT template 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_EXPORT template 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_EXPORT template BOOST_MATH_CUDA_ENABLED RealType pdf(const binomial_distribution& dist, const RealType& k) { // Probability Density/Mass Function. BOOST_FPU_EXCEPTION_GUARD @@ -504,7 +504,7 @@ namespace boost } // pdf - template + BOOST_MATH_EXPORT template 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. @@ -576,7 +576,7 @@ namespace boost return ibetac(k + 1, n - k, p, Policy()); } // binomial cdf - template + BOOST_MATH_EXPORT template 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. @@ -653,19 +653,19 @@ namespace boost return ibeta(k + 1, n - k, p, Policy()); } // binomial cdf - template + BOOST_MATH_EXPORT template 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_EXPORT template 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_EXPORT template BOOST_MATH_CUDA_ENABLED inline RealType mode(const binomial_distribution& dist) { BOOST_MATH_STD_USING // ADL of std functions. @@ -674,7 +674,7 @@ namespace boost return floor(p * (n + 1)); } - template + BOOST_MATH_EXPORT template 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. ; @@ -692,7 +692,7 @@ namespace boost return floor(p * n); // Chose the middle value. } - template + BOOST_MATH_EXPORT template BOOST_MATH_CUDA_ENABLED inline RealType skewness(const binomial_distribution& dist) { BOOST_MATH_STD_USING // ADL of std functions. @@ -701,7 +701,7 @@ namespace boost return (1 - 2 * p) / sqrt(n * p * (1 - p)); } - template + BOOST_MATH_EXPORT template BOOST_MATH_CUDA_ENABLED inline RealType kurtosis(const binomial_distribution& dist) { RealType p = dist.success_fraction(); @@ -709,7 +709,7 @@ namespace boost return 3 - 6 / n + 1 / (n * p * (1 - p)); } - template + BOOST_MATH_EXPORT template BOOST_MATH_CUDA_ENABLED inline RealType kurtosis_excess(const binomial_distribution& dist) { RealType p = dist.success_fraction(); diff --git a/include/boost/math/distributions/cauchy.hpp b/include/boost/math/distributions/cauchy.hpp index 03fa8562aa..ee23318264 100644 --- a/include/boost/math/distributions/cauchy.hpp +++ b/include/boost/math/distributions/cauchy.hpp @@ -36,7 +36,7 @@ namespace boost{ namespace math { -template +BOOST_MATH_EXPORT template class cauchy_distribution; namespace detail @@ -149,7 +149,7 @@ BOOST_MATH_GPU_ENABLED RealType quantile_imp( } // namespace detail -template > +BOOST_MATH_EXPORT template > class cauchy_distribution { public: @@ -179,16 +179,16 @@ class cauchy_distribution RealType m_hg; // The scale )or shape), this is the half width at half height. }; -typedef cauchy_distribution cauchy; +BOOST_MATH_EXPORT typedef cauchy_distribution cauchy; #ifdef __cpp_deduction_guides -template +BOOST_MATH_EXPORT template cauchy_distribution(RealType)->cauchy_distribution::type>; -template +BOOST_MATH_EXPORT template cauchy_distribution(RealType,RealType)->cauchy_distribution::type>; #endif -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline const boost::math::pair range(const cauchy_distribution&) { // Range of permissible values for random variable x. BOOST_MATH_IF_CONSTEXPR (boost::math::numeric_limits::has_infinity) @@ -202,7 +202,7 @@ BOOST_MATH_GPU_ENABLED inline const boost::math::pair range( } } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline const boost::math::pair support(const cauchy_distribution& ) { // 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. @@ -217,7 +217,7 @@ BOOST_MATH_GPU_ENABLED inline const boost::math::pair suppor } } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType pdf(const cauchy_distribution& dist, const RealType& x) { BOOST_MATH_STD_USING // for ADL of std functions @@ -254,31 +254,31 @@ BOOST_MATH_GPU_ENABLED inline RealType pdf(const cauchy_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const cauchy_distribution& dist, const RealType& x) { return detail::cdf_imp(dist, x, false); } // cdf -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const cauchy_distribution& dist, const RealType& p) { return detail::quantile_imp(dist, p, false); } // quantile -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const complemented2_type, RealType>& c) { return detail::cdf_imp(c.dist, c.param, true); } // cdf complement -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const complemented2_type, RealType>& c) { return detail::quantile_imp(c.dist, c.param, true); } // quantile complement -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mean(const cauchy_distribution&) { // There is no mean: typedef typename Policy::assert_undefined_type assert_type; @@ -291,7 +291,7 @@ BOOST_MATH_GPU_ENABLED inline RealType mean(const cauchy_distribution::quiet_NaN(), Policy()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType variance(const cauchy_distribution& /*dist*/) { // There is no variance: @@ -305,19 +305,19 @@ BOOST_MATH_GPU_ENABLED inline RealType variance(const cauchy_distribution::quiet_NaN(), Policy()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mode(const cauchy_distribution& dist) { return dist.location(); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType median(const cauchy_distribution& dist) { return dist.location(); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType skewness(const cauchy_distribution& /*dist*/) { // There is no skewness: @@ -331,7 +331,7 @@ BOOST_MATH_GPU_ENABLED inline RealType skewness(const cauchy_distribution::quiet_NaN(), Policy()); // infinity? } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis(const cauchy_distribution& /*dist*/) { // There is no kurtosis: @@ -345,7 +345,7 @@ BOOST_MATH_GPU_ENABLED inline RealType kurtosis(const cauchy_distribution::quiet_NaN(), Policy()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis_excess(const cauchy_distribution& /*dist*/) { // There is no kurtosis excess: @@ -359,7 +359,7 @@ BOOST_MATH_GPU_ENABLED inline RealType kurtosis_excess(const cauchy_distribution boost::math::numeric_limits::quiet_NaN(), Policy()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType entropy(const cauchy_distribution & dist) { using std::log; diff --git a/include/boost/math/distributions/chi_squared.hpp b/include/boost/math/distributions/chi_squared.hpp index 9823a2d555..fb83dd92f6 100644 --- a/include/boost/math/distributions/chi_squared.hpp +++ b/include/boost/math/distributions/chi_squared.hpp @@ -22,7 +22,7 @@ namespace boost{ namespace math{ -template > +BOOST_MATH_EXPORT template > class chi_squared_distribution { public: @@ -56,10 +56,10 @@ class chi_squared_distribution RealType m_df; // degrees of freedom is a positive real number. }; // class chi_squared_distribution -using chi_squared = chi_squared_distribution; +BOOST_MATH_EXPORT using chi_squared = chi_squared_distribution; #ifdef __cpp_deduction_guides -template +BOOST_MATH_EXPORT template chi_squared_distribution(RealType)->chi_squared_distribution::type>; #endif @@ -68,7 +68,7 @@ chi_squared_distribution(RealType)->chi_squared_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline boost::math::pair range(const chi_squared_distribution& /*dist*/) { // Range of permissible values for random variable x. BOOST_MATH_IF_CONSTEXPR (boost::math::numeric_limits::has_infinity) @@ -86,14 +86,14 @@ BOOST_MATH_GPU_ENABLED inline boost::math::pair range(const #pragma warning(pop) #endif -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline boost::math::pair support(const chi_squared_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 boost::math::pair(static_cast(0), tools::max_value()); // 0 to + infinity. } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED RealType pdf(const chi_squared_distribution& dist, const RealType& chi_square) { BOOST_MATH_STD_USING // for ADL of std functions @@ -134,7 +134,7 @@ BOOST_MATH_GPU_ENABLED RealType pdf(const chi_squared_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const chi_squared_distribution& dist, const RealType& chi_square) { RealType degrees_of_freedom = dist.degrees_of_freedom(); @@ -155,7 +155,7 @@ BOOST_MATH_GPU_ENABLED inline RealType cdf(const chi_squared_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const chi_squared_distribution& dist, const RealType& p) { RealType degrees_of_freedom = dist.degrees_of_freedom(); @@ -172,7 +172,7 @@ BOOST_MATH_GPU_ENABLED inline RealType quantile(const chi_squared_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const complemented2_type, RealType>& c) { RealType const& degrees_of_freedom = c.dist.degrees_of_freedom(); @@ -193,7 +193,7 @@ BOOST_MATH_GPU_ENABLED inline RealType cdf(const complemented2_type +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const complemented2_type, RealType>& c) { RealType const& degrees_of_freedom = c.dist.degrees_of_freedom(); @@ -209,19 +209,19 @@ BOOST_MATH_GPU_ENABLED inline RealType quantile(const complemented2_type +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mean(const chi_squared_distribution& dist) { // Mean of Chi-Squared distribution = v. return dist.degrees_of_freedom(); } // mean -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType variance(const chi_squared_distribution& dist) { // Variance of Chi-Squared distribution = 2v. return 2 * dist.degrees_of_freedom(); } // variance -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mode(const chi_squared_distribution& dist) { RealType df = dist.degrees_of_freedom(); @@ -235,7 +235,7 @@ BOOST_MATH_GPU_ENABLED inline RealType mode(const chi_squared_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType skewness(const chi_squared_distribution& dist) { BOOST_MATH_STD_USING // For ADL @@ -243,14 +243,14 @@ BOOST_MATH_GPU_ENABLED inline RealType skewness(const chi_squared_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis(const chi_squared_distribution& dist) { RealType df = dist.degrees_of_freedom(); return 3 + 12 / df; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis_excess(const chi_squared_distribution& dist) { RealType df = dist.degrees_of_freedom(); diff --git a/include/boost/math/distributions/complement.hpp b/include/boost/math/distributions/complement.hpp index c63b8a5041..627f5454ca 100644 --- a/include/boost/math/distributions/complement.hpp +++ b/include/boost/math/distributions/complement.hpp @@ -19,7 +19,7 @@ // namespace boost{ namespace math{ -template +BOOST_MATH_EXPORT template struct complemented2_type { BOOST_MATH_GPU_ENABLED complemented2_type( @@ -35,7 +35,7 @@ struct complemented2_type complemented2_type& operator=(const complemented2_type&) = delete; }; -template +BOOST_MATH_EXPORT template struct complemented3_type { BOOST_MATH_GPU_ENABLED complemented3_type( @@ -53,7 +53,7 @@ struct complemented3_type complemented3_type& operator=(const complemented3_type&) = delete; }; -template +BOOST_MATH_EXPORT template struct complemented4_type { BOOST_MATH_GPU_ENABLED complemented4_type( @@ -74,7 +74,7 @@ struct complemented4_type complemented4_type& operator=(const complemented4_type&) = delete; }; -template +BOOST_MATH_EXPORT template struct complemented5_type { BOOST_MATH_GPU_ENABLED complemented5_type( @@ -98,7 +98,7 @@ struct complemented5_type complemented5_type& operator=(const complemented5_type&) = delete; }; -template +BOOST_MATH_EXPORT template struct complemented6_type { BOOST_MATH_GPU_ENABLED complemented6_type( @@ -125,7 +125,7 @@ struct complemented6_type complemented6_type& operator=(const complemented6_type&) = delete; }; -template +BOOST_MATH_EXPORT template struct complemented7_type { BOOST_MATH_GPU_ENABLED complemented7_type( @@ -155,37 +155,37 @@ struct complemented7_type complemented7_type& operator=(const complemented7_type&) = delete; }; -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline complemented2_type complement(const Dist& d, const RealType& r) { return complemented2_type(d, r); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline complemented3_type complement(const Dist& d, const RealType1& r1, const RealType2& r2) { return complemented3_type(d, r1, r2); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline complemented4_type complement(const Dist& d, const RealType1& r1, const RealType2& r2, const RealType3& r3) { return complemented4_type(d, r1, r2, r3); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline complemented5_type complement(const Dist& d, const RealType1& r1, const RealType2& r2, const RealType3& r3, const RealType4& r4) { return complemented5_type(d, r1, r2, r3, r4); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline complemented6_type complement(const Dist& d, const RealType1& r1, const RealType2& r2, const RealType3& r3, const RealType4& r4, const RealType5& r5) { return complemented6_type(d, r1, r2, r3, r4, r5); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline complemented7_type complement(const Dist& d, const RealType1& r1, const RealType2& r2, const RealType3& r3, const RealType4& r4, const RealType5& r5, const RealType6& r6) { return complemented7_type(d, r1, r2, r3, r4, r5, r6); diff --git a/include/boost/math/distributions/detail/derived_accessors.hpp b/include/boost/math/distributions/detail/derived_accessors.hpp index 08c478ffd1..22d54d31d5 100644 --- a/include/boost/math/distributions/detail/derived_accessors.hpp +++ b/include/boost/math/distributions/detail/derived_accessors.hpp @@ -45,24 +45,24 @@ namespace boost{ namespace math{ -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED typename Distribution::value_type variance(const Distribution& dist); -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename Distribution::value_type standard_deviation(const Distribution& dist) { BOOST_MATH_STD_USING // ADL of sqrt. return sqrt(variance(dist)); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename Distribution::value_type variance(const Distribution& dist) { typename Distribution::value_type result = standard_deviation(dist); return result * result; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename Distribution::value_type hazard(const Distribution& dist, const RealType& x) { // hazard function // http://www.itl.nist.gov/div898/handbook/eda/section3/eda362.htm#HAZ @@ -81,7 +81,7 @@ BOOST_MATH_GPU_ENABLED inline typename Distribution::value_type hazard(const Dis return d / p; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename Distribution::value_type chf(const Distribution& dist, const RealType& x) { // cumulative hazard function. // http://www.itl.nist.gov/div898/handbook/eda/section3/eda362.htm#HAZ @@ -89,7 +89,7 @@ BOOST_MATH_GPU_ENABLED inline typename Distribution::value_type chf(const Distri return -log(cdf(complement(dist, x))); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename Distribution::value_type coefficient_of_variation(const Distribution& dist) { typedef typename Distribution::value_type value_type; @@ -110,33 +110,33 @@ BOOST_MATH_GPU_ENABLED inline typename Distribution::value_type coefficient_of_v // argument types. We just use a typecast to forward on to the "real" // implementation with all arguments of the same type: // -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename Distribution::value_type pdf(const Distribution& dist, const RealType& x) { typedef typename Distribution::value_type value_type; return pdf(dist, static_cast(x)); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename Distribution::value_type logpdf(const Distribution& dist, const RealType& x) { using std::log; typedef typename Distribution::value_type value_type; return log(pdf(dist, static_cast(x))); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename Distribution::value_type cdf(const Distribution& dist, const RealType& x) { typedef typename Distribution::value_type value_type; return cdf(dist, static_cast(x)); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename Distribution::value_type logcdf(const Distribution& dist, const Realtype& x) { using std::log; using value_type = typename Distribution::value_type; return log(cdf(dist, static_cast(x))); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename Distribution::value_type quantile(const Distribution& dist, const RealType& x) { typedef typename Distribution::value_type value_type; @@ -150,14 +150,14 @@ inline typename Distribution::value_type chf(const Distribution& dist, const Rea return chf(dist, static_cast(x)); } */ -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename Distribution::value_type cdf(const complemented2_type& c) { typedef typename Distribution::value_type value_type; return cdf(complement(c.dist, static_cast(c.param))); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename Distribution::value_type logcdf(const complemented2_type& c) { using std::log; @@ -165,14 +165,14 @@ BOOST_MATH_GPU_ENABLED inline typename Distribution::value_type logcdf(const com return log(cdf(complement(c.dist, static_cast(c.param)))); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename Distribution::value_type quantile(const complemented2_type& c) { typedef typename Distribution::value_type value_type; return quantile(complement(c.dist, static_cast(c.param))); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename Dist::value_type median(const Dist& d) { // median - default definition for those distributions for which a // simple closed form is not known, diff --git a/include/boost/math/distributions/exponential.hpp b/include/boost/math/distributions/exponential.hpp index d3a119ce9c..e47686a745 100644 --- a/include/boost/math/distributions/exponential.hpp +++ b/include/boost/math/distributions/exponential.hpp @@ -66,7 +66,7 @@ BOOST_MATH_GPU_ENABLED inline bool verify_exp_x(const char* function, RealType x } // namespace detail -template > +BOOST_MATH_EXPORT template > class exponential_distribution { public: @@ -86,14 +86,14 @@ class exponential_distribution RealType m_lambda; }; -using exponential = exponential_distribution; +BOOST_MATH_EXPORT using exponential = exponential_distribution; #ifdef __cpp_deduction_guides -template +BOOST_MATH_EXPORT template exponential_distribution(RealType)->exponential_distribution::type>; #endif -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline boost::math::pair range(const exponential_distribution& /*dist*/) { // Range of permissible values for random variable x. BOOST_MATH_IF_CONSTEXPR (boost::math::numeric_limits::has_infinity) @@ -107,7 +107,7 @@ BOOST_MATH_GPU_ENABLED inline boost::math::pair range(const } } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline boost::math::pair support(const exponential_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. @@ -117,7 +117,7 @@ BOOST_MATH_GPU_ENABLED inline boost::math::pair support(cons // min_value() to avoid a discontinuity at x = 0. } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType pdf(const exponential_distribution& dist, const RealType& x) { BOOST_MATH_STD_USING // for ADL of std functions @@ -137,7 +137,7 @@ BOOST_MATH_GPU_ENABLED inline RealType pdf(const exponential_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType logpdf(const exponential_distribution& dist, const RealType& x) { BOOST_MATH_STD_USING // for ADL of std functions @@ -155,7 +155,7 @@ BOOST_MATH_GPU_ENABLED inline RealType logpdf(const exponential_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const exponential_distribution& dist, const RealType& x) { BOOST_MATH_STD_USING // for ADL of std functions @@ -173,7 +173,7 @@ BOOST_MATH_GPU_ENABLED inline RealType cdf(const exponential_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType logcdf(const exponential_distribution& dist, const RealType& x) { BOOST_MATH_STD_USING // for ADL of std functions @@ -191,7 +191,7 @@ BOOST_MATH_GPU_ENABLED inline RealType logcdf(const exponential_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const exponential_distribution& dist, const RealType& p) { BOOST_MATH_STD_USING // for ADL of std functions @@ -214,7 +214,7 @@ BOOST_MATH_GPU_ENABLED inline RealType quantile(const exponential_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const complemented2_type, RealType>& c) { BOOST_MATH_STD_USING // for ADL of std functions @@ -235,7 +235,7 @@ BOOST_MATH_GPU_ENABLED inline RealType cdf(const complemented2_type +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType logcdf(const complemented2_type, RealType>& c) { BOOST_MATH_STD_USING // for ADL of std functions @@ -256,7 +256,7 @@ BOOST_MATH_GPU_ENABLED inline RealType logcdf(const complemented2_type +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const complemented2_type, RealType>& c) { BOOST_MATH_STD_USING // for ADL of std functions @@ -281,7 +281,7 @@ BOOST_MATH_GPU_ENABLED inline RealType quantile(const complemented2_type +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mean(const exponential_distribution& dist) { RealType result = 0; @@ -291,7 +291,7 @@ BOOST_MATH_GPU_ENABLED inline RealType mean(const exponential_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType standard_deviation(const exponential_distribution& dist) { RealType result = 0; @@ -301,38 +301,38 @@ BOOST_MATH_GPU_ENABLED inline RealType standard_deviation(const exponential_dist return 1 / lambda; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mode(const exponential_distribution& /*dist*/) { return 0; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType median(const exponential_distribution& dist) { using boost::math::constants::ln_two; return ln_two() / dist.lambda(); // ln(2) / lambda } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType skewness(const exponential_distribution& /*dist*/) { return 2; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis(const exponential_distribution& /*dist*/) { return 9; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis_excess(const exponential_distribution& /*dist*/) { return 6; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType entropy(const exponential_distribution& dist) { using std::log; diff --git a/include/boost/math/distributions/extreme_value.hpp b/include/boost/math/distributions/extreme_value.hpp index 49e155328c..cfcca70f8d 100644 --- a/include/boost/math/distributions/extreme_value.hpp +++ b/include/boost/math/distributions/extreme_value.hpp @@ -60,7 +60,7 @@ BOOST_MATH_GPU_ENABLED inline bool verify_scale_b(const char* function, RealType } // namespace detail -template > +BOOST_MATH_EXPORT template > class extreme_value_distribution { public: @@ -83,16 +83,16 @@ class extreme_value_distribution RealType m_b; }; -using extreme_value = extreme_value_distribution; +BOOST_MATH_EXPORT using extreme_value = extreme_value_distribution; #ifdef __cpp_deduction_guides -template +BOOST_MATH_EXPORT template extreme_value_distribution(RealType)->extreme_value_distribution::type>; -template +BOOST_MATH_EXPORT template extreme_value_distribution(RealType,RealType)->extreme_value_distribution::type>; #endif -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline boost::math::pair range(const extreme_value_distribution& /*dist*/) { // Range of permissible values for random variable x. using boost::math::tools::max_value; @@ -101,7 +101,7 @@ BOOST_MATH_GPU_ENABLED inline boost::math::pair range(const boost::math::numeric_limits::has_infinity ? boost::math::numeric_limits::infinity() : max_value()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline boost::math::pair support(const extreme_value_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. @@ -109,7 +109,7 @@ BOOST_MATH_GPU_ENABLED inline boost::math::pair support(cons return boost::math::pair(-max_value(), max_value()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType pdf(const extreme_value_distribution& dist, const RealType& x) { BOOST_MATH_STD_USING // for ADL of std functions @@ -134,7 +134,7 @@ BOOST_MATH_GPU_ENABLED inline RealType pdf(const extreme_value_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType logpdf(const extreme_value_distribution& dist, const RealType& x) { BOOST_MATH_STD_USING // for ADL of std functions @@ -159,7 +159,7 @@ BOOST_MATH_GPU_ENABLED inline RealType logpdf(const extreme_value_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const extreme_value_distribution& dist, const RealType& x) { BOOST_MATH_STD_USING // for ADL of std functions @@ -183,7 +183,7 @@ BOOST_MATH_GPU_ENABLED inline RealType cdf(const extreme_value_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType logcdf(const extreme_value_distribution& dist, const RealType& x) { BOOST_MATH_STD_USING // for ADL of std functions @@ -207,7 +207,7 @@ BOOST_MATH_GPU_ENABLED inline RealType logcdf(const extreme_value_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED RealType quantile(const extreme_value_distribution& dist, const RealType& p) { BOOST_MATH_STD_USING // for ADL of std functions @@ -234,7 +234,7 @@ BOOST_MATH_GPU_ENABLED RealType quantile(const extreme_value_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const complemented2_type, RealType>& c) { BOOST_MATH_STD_USING // for ADL of std functions @@ -258,7 +258,7 @@ BOOST_MATH_GPU_ENABLED inline RealType cdf(const complemented2_type +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType logcdf(const complemented2_type, RealType>& c) { BOOST_MATH_STD_USING // for ADL of std functions @@ -282,7 +282,7 @@ BOOST_MATH_GPU_ENABLED inline RealType logcdf(const complemented2_type +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED RealType quantile(const complemented2_type, RealType>& c) { BOOST_MATH_STD_USING // for ADL of std functions @@ -310,7 +310,7 @@ BOOST_MATH_GPU_ENABLED RealType quantile(const complemented2_type +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mean(const extreme_value_distribution& dist) { RealType a = dist.location(); @@ -323,7 +323,7 @@ BOOST_MATH_GPU_ENABLED inline RealType mean(const extreme_value_distribution() * b; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType standard_deviation(const extreme_value_distribution& dist) { BOOST_MATH_STD_USING // for ADL of std functions. @@ -337,20 +337,20 @@ BOOST_MATH_GPU_ENABLED inline RealType standard_deviation(const extreme_value_di return constants::pi() * b / sqrt(static_cast(6)); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mode(const extreme_value_distribution& dist) { return dist.location(); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType median(const extreme_value_distribution& dist) { using constants::ln_ln_two; return dist.location() - dist.scale() * ln_ln_two(); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType skewness(const extreme_value_distribution& /*dist*/) { // @@ -360,14 +360,14 @@ BOOST_MATH_GPU_ENABLED inline RealType skewness(const extreme_value_distribution return static_cast(1.1395470994046486574927930193898461120875997958366L); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis(const extreme_value_distribution& /*dist*/) { // See http://mathworld.wolfram.com/ExtremeValueDistribution.html return RealType(27) / 5; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis_excess(const extreme_value_distribution& /*dist*/) { // See http://mathworld.wolfram.com/ExtremeValueDistribution.html diff --git a/include/boost/math/distributions/find_location.hpp b/include/boost/math/distributions/find_location.hpp index c23b41eb10..da793f3b00 100644 --- a/include/boost/math/distributions/find_location.hpp +++ b/include/boost/math/distributions/find_location.hpp @@ -28,7 +28,7 @@ namespace boost // Applies to normal, lognormal, extreme value, Cauchy, (and symmetrical triangular), // enforced by static_assert below. - template + BOOST_MATH_EXPORT template inline typename Dist::value_type find_location( // For example, normal mean. typename Dist::value_type z, // location of random variable z to give probability, P(X > z) == p. @@ -63,7 +63,7 @@ namespace boost return z - (quantile(Dist(), p) * scale); } // find_location - template + BOOST_MATH_EXPORT template inline // with default policy. typename Dist::value_type find_location( // For example, normal mean. typename Dist::value_type z, // location of random variable z to give probability, P(X > z) == p. @@ -77,7 +77,7 @@ namespace boost // So the user can start from the complement q = (1 - p) of the probability p, // for example, l = find_location(complement(z, q, sd)); - template + BOOST_MATH_EXPORT template inline typename Dist::value_type find_location( // Default policy. complemented3_type const& c) { @@ -106,7 +106,7 @@ namespace boost } // find_location complement - template + BOOST_MATH_EXPORT template inline typename Dist::value_type find_location( // Explicit policy. complemented4_type const& c) { diff --git a/include/boost/math/distributions/find_scale.hpp b/include/boost/math/distributions/find_scale.hpp index cd08ce95a2..39102e4c4c 100644 --- a/include/boost/math/distributions/find_scale.hpp +++ b/include/boost/math/distributions/find_scale.hpp @@ -29,7 +29,7 @@ namespace boost // distributions that have scale. // BOOST_STATIC_ASSERTs, see below, are used to enforce this. - template + BOOST_MATH_EXPORT template inline typename Dist::value_type find_scale( // For example, normal mean. typename Dist::value_type z, // location of random variable z to give probability, P(X > z) == p. @@ -85,7 +85,7 @@ namespace boost return result; } // template find_scale - template + BOOST_MATH_EXPORT template inline // with default policy. typename Dist::value_type find_scale( // For example, normal mean. typename Dist::value_type z, // location of random variable z to give probability, P(X > z) == p. @@ -96,7 +96,7 @@ namespace boost return (find_scale(z, p, location, policies::policy<>())); } // find_scale - template + BOOST_MATH_EXPORT template inline typename Dist::value_type find_scale( complemented4_type const& c) { @@ -146,7 +146,7 @@ namespace boost // So the user can start from the complement q = (1 - p) of the probability p, // for example, s = find_scale(complement(z, q, l)); - template + BOOST_MATH_EXPORT template inline typename Dist::value_type find_scale( complemented3_type const& c) { diff --git a/include/boost/math/distributions/fisher_f.hpp b/include/boost/math/distributions/fisher_f.hpp index 56b288d88e..1cc96dbbd7 100644 --- a/include/boost/math/distributions/fisher_f.hpp +++ b/include/boost/math/distributions/fisher_f.hpp @@ -19,7 +19,7 @@ namespace boost{ namespace math{ -template > +BOOST_MATH_EXPORT template > class fisher_f_distribution { public: @@ -53,21 +53,21 @@ class fisher_f_distribution RealType m_df2; // degrees of freedom are a real number. }; -typedef fisher_f_distribution fisher_f; +BOOST_MATH_EXPORT typedef fisher_f_distribution fisher_f; #ifdef __cpp_deduction_guides -template +BOOST_MATH_EXPORT template fisher_f_distribution(RealType,RealType)->fisher_f_distribution::type>; #endif -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline const boost::math::pair range(const fisher_f_distribution& /*dist*/) { // Range of permissible values for random variable x. using boost::math::tools::max_value; return boost::math::pair(static_cast(0), max_value()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline const boost::math::pair support(const fisher_f_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. @@ -75,7 +75,7 @@ BOOST_MATH_GPU_ENABLED inline const boost::math::pair suppor return boost::math::pair(static_cast(0), max_value()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED RealType pdf(const fisher_f_distribution& dist, const RealType& x) { BOOST_MATH_STD_USING // for ADL of std functions @@ -132,7 +132,7 @@ BOOST_MATH_GPU_ENABLED RealType pdf(const fisher_f_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const fisher_f_distribution& dist, const RealType& x) { constexpr auto function = "boost::math::cdf(fisher_f_distribution<%1%> const&, %1%)"; @@ -167,7 +167,7 @@ BOOST_MATH_GPU_ENABLED inline RealType cdf(const fisher_f_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const fisher_f_distribution& dist, const RealType& p) { constexpr auto function = "boost::math::quantile(fisher_f_distribution<%1%> const&, %1%)"; @@ -192,7 +192,7 @@ BOOST_MATH_GPU_ENABLED inline RealType quantile(const fisher_f_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const complemented2_type, RealType>& c) { constexpr auto function = "boost::math::cdf(fisher_f_distribution<%1%> const&, %1%)"; @@ -228,7 +228,7 @@ BOOST_MATH_GPU_ENABLED inline RealType cdf(const complemented2_type +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const complemented2_type, RealType>& c) { constexpr auto function = "boost::math::quantile(fisher_f_distribution<%1%> const&, %1%)"; @@ -252,7 +252,7 @@ BOOST_MATH_GPU_ENABLED inline RealType quantile(const complemented2_type +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mean(const fisher_f_distribution& dist) { // Mean of F distribution = v. constexpr auto function = "boost::math::mean(fisher_f_distribution<%1%> const&)"; @@ -273,7 +273,7 @@ BOOST_MATH_GPU_ENABLED inline RealType mean(const fisher_f_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType variance(const fisher_f_distribution& dist) { // Variance of F distribution. constexpr auto function = "boost::math::variance(fisher_f_distribution<%1%> const&)"; @@ -294,7 +294,7 @@ BOOST_MATH_GPU_ENABLED inline RealType variance(const fisher_f_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mode(const fisher_f_distribution& dist) { constexpr auto function = "boost::math::mode(fisher_f_distribution<%1%> const&)"; @@ -323,7 +323,7 @@ BOOST_MATH_GPU_ENABLED inline RealType mode(const fisher_f_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType skewness(const fisher_f_distribution& dist) { constexpr auto function = "boost::math::skewness(fisher_f_distribution<%1%> const&)"; @@ -346,16 +346,16 @@ BOOST_MATH_GPU_ENABLED inline RealType skewness(const fisher_f_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED RealType kurtosis_excess(const fisher_f_distribution& dist); -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis(const fisher_f_distribution& dist) { return 3 + kurtosis_excess(dist); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis_excess(const fisher_f_distribution& dist) { constexpr auto function = "boost::math::kurtosis_excess(fisher_f_distribution<%1%> const&)"; diff --git a/include/boost/math/distributions/fwd.hpp b/include/boost/math/distributions/fwd.hpp index c231be418d..9a1c071071 100644 --- a/include/boost/math/distributions/fwd.hpp +++ b/include/boost/math/distributions/fwd.hpp @@ -11,120 +11,122 @@ #ifndef BOOST_MATH_DISTRIBUTIONS_FWD_HPP #define BOOST_MATH_DISTRIBUTIONS_FWD_HPP +#include + namespace boost{ namespace math{ -template +BOOST_MATH_EXPORT template class arcsine_distribution; -template +BOOST_MATH_EXPORT template class bernoulli_distribution; -template +BOOST_MATH_EXPORT template class beta_distribution; -template +BOOST_MATH_EXPORT template class binomial_distribution; -template +BOOST_MATH_EXPORT template class cauchy_distribution; -template +BOOST_MATH_EXPORT template class chi_squared_distribution; -template +BOOST_MATH_EXPORT template class exponential_distribution; -template +BOOST_MATH_EXPORT template class extreme_value_distribution; -template +BOOST_MATH_EXPORT template class fisher_f_distribution; -template +BOOST_MATH_EXPORT template class gamma_distribution; -template +BOOST_MATH_EXPORT template class geometric_distribution; -template +BOOST_MATH_EXPORT template class hyperexponential_distribution; -template +BOOST_MATH_EXPORT template class hypergeometric_distribution; -template +BOOST_MATH_EXPORT template class inverse_chi_squared_distribution; -template +BOOST_MATH_EXPORT template class inverse_gamma_distribution; -template +BOOST_MATH_EXPORT template class inverse_gaussian_distribution; -template +BOOST_MATH_EXPORT template class kolmogorov_smirnov_distribution; -template +BOOST_MATH_EXPORT template class landau_distribution; -template +BOOST_MATH_EXPORT template class mapairy_distribution; -template +BOOST_MATH_EXPORT template class holtsmark_distribution; -template +BOOST_MATH_EXPORT template class saspoint5_distribution; -template +BOOST_MATH_EXPORT template class laplace_distribution; -template +BOOST_MATH_EXPORT template class logistic_distribution; -template +BOOST_MATH_EXPORT template class lognormal_distribution; -template +BOOST_MATH_EXPORT template class negative_binomial_distribution; -template +BOOST_MATH_EXPORT template class non_central_beta_distribution; -template +BOOST_MATH_EXPORT template class non_central_chi_squared_distribution; -template +BOOST_MATH_EXPORT template class non_central_f_distribution; -template +BOOST_MATH_EXPORT template class non_central_t_distribution; -template +BOOST_MATH_EXPORT template class normal_distribution; -template +BOOST_MATH_EXPORT template class pareto_distribution; -template +BOOST_MATH_EXPORT template class poisson_distribution; -template +BOOST_MATH_EXPORT template class rayleigh_distribution; -template +BOOST_MATH_EXPORT template class skew_normal_distribution; -template +BOOST_MATH_EXPORT template class students_t_distribution; -template +BOOST_MATH_EXPORT template class triangular_distribution; -template +BOOST_MATH_EXPORT template class uniform_distribution; -template +BOOST_MATH_EXPORT template class weibull_distribution; }} // namespaces diff --git a/include/boost/math/distributions/gamma.hpp b/include/boost/math/distributions/gamma.hpp index 5176f906d8..ae7b3ea4ff 100644 --- a/include/boost/math/distributions/gamma.hpp +++ b/include/boost/math/distributions/gamma.hpp @@ -69,7 +69,7 @@ BOOST_MATH_GPU_ENABLED inline bool check_gamma( } // namespace detail -template > +BOOST_MATH_EXPORT template > class gamma_distribution { public: @@ -103,20 +103,20 @@ class gamma_distribution // NO typedef because of clash with name of gamma function. #ifdef __cpp_deduction_guides -template +BOOST_MATH_EXPORT template gamma_distribution(RealType)->gamma_distribution::type>; -template +BOOST_MATH_EXPORT template gamma_distribution(RealType,RealType)->gamma_distribution::type>; #endif -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline boost::math::pair range(const gamma_distribution& /* dist */) { // Range of permissible values for random variable x. using boost::math::tools::max_value; return boost::math::pair(static_cast(0), max_value()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline boost::math::pair support(const gamma_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. @@ -125,7 +125,7 @@ BOOST_MATH_GPU_ENABLED inline boost::math::pair support(cons return boost::math::pair(min_value(), max_value()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType pdf(const gamma_distribution& dist, const RealType& x) { BOOST_MATH_STD_USING // for ADL of std functions @@ -149,7 +149,7 @@ BOOST_MATH_GPU_ENABLED inline RealType pdf(const gamma_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType logpdf(const gamma_distribution& dist, const RealType& x) { BOOST_MATH_STD_USING // for ADL of std functions @@ -176,7 +176,7 @@ BOOST_MATH_GPU_ENABLED inline RealType logpdf(const gamma_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const gamma_distribution& dist, const RealType& x) { BOOST_MATH_STD_USING // for ADL of std functions @@ -196,7 +196,7 @@ BOOST_MATH_GPU_ENABLED inline RealType cdf(const gamma_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const gamma_distribution& dist, const RealType& p) { BOOST_MATH_STD_USING // for ADL of std functions @@ -220,7 +220,7 @@ BOOST_MATH_GPU_ENABLED inline RealType quantile(const gamma_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const complemented2_type, RealType>& c) { BOOST_MATH_STD_USING // for ADL of std functions @@ -241,7 +241,7 @@ BOOST_MATH_GPU_ENABLED inline RealType cdf(const complemented2_type +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const complemented2_type, RealType>& c) { BOOST_MATH_STD_USING // for ADL of std functions @@ -266,7 +266,7 @@ BOOST_MATH_GPU_ENABLED inline RealType quantile(const complemented2_type +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mean(const gamma_distribution& dist) { BOOST_MATH_STD_USING // for ADL of std functions @@ -284,7 +284,7 @@ BOOST_MATH_GPU_ENABLED inline RealType mean(const gamma_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType variance(const gamma_distribution& dist) { BOOST_MATH_STD_USING // for ADL of std functions @@ -302,7 +302,7 @@ BOOST_MATH_GPU_ENABLED inline RealType variance(const gamma_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mode(const gamma_distribution& dist) { BOOST_MATH_STD_USING // for ADL of std functions @@ -331,7 +331,7 @@ BOOST_MATH_GPU_ENABLED inline RealType mode(const gamma_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType skewness(const gamma_distribution& dist) { BOOST_MATH_STD_USING // for ADL of std functions @@ -349,7 +349,7 @@ BOOST_MATH_GPU_ENABLED inline RealType skewness(const gamma_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis_excess(const gamma_distribution& dist) { BOOST_MATH_STD_USING // for ADL of std functions @@ -367,13 +367,13 @@ BOOST_MATH_GPU_ENABLED inline RealType kurtosis_excess(const gamma_distribution< return result; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis(const gamma_distribution& dist) { return kurtosis_excess(dist) + 3; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType entropy(const gamma_distribution& dist) { BOOST_MATH_STD_USING diff --git a/include/boost/math/distributions/geometric.hpp b/include/boost/math/distributions/geometric.hpp index 0a7b383c24..6a4731f39c 100644 --- a/include/boost/math/distributions/geometric.hpp +++ b/include/boost/math/distributions/geometric.hpp @@ -109,7 +109,7 @@ namespace boost } // check_dist_and_prob } // namespace geometric_detail - template > + BOOST_MATH_EXPORT template > class geometric_distribution { public: @@ -235,21 +235,21 @@ namespace boost RealType m_p; // success_fraction }; // template class geometric_distribution - typedef geometric_distribution geometric; // Reserved name of type double. + BOOST_MATH_EXPORT typedef geometric_distribution geometric; // Reserved name of type double. #ifdef __cpp_deduction_guides - template + BOOST_MATH_EXPORT template geometric_distribution(RealType)->geometric_distribution::type>; #endif - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline const boost::math::pair range(const geometric_distribution& /* dist */) { // Range of permissible values for random variable k. using boost::math::tools::max_value; return boost::math::pair(static_cast(0), max_value()); // max_integer? } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline const boost::math::pair support(const geometric_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. @@ -257,7 +257,7 @@ namespace boost return boost::math::pair(static_cast(0), max_value()); // max_integer? } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mean(const geometric_distribution& dist) { // Mean of geometric distribution = (1-p)/p. return (1 - dist.success_fraction() ) / dist.success_fraction(); @@ -265,21 +265,21 @@ namespace boost // median implemented via quantile(half) in derived accessors. - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mode(const geometric_distribution&) { // Mode of geometric distribution = zero. BOOST_MATH_STD_USING // ADL of std functions. return 0; } // mode - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType variance(const geometric_distribution& dist) { // Variance of Binomial distribution = (1-p) / p^2. return (1 - dist.success_fraction()) / (dist.success_fraction() * dist.success_fraction()); } // variance - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType skewness(const geometric_distribution& dist) { // skewness of geometric distribution = 2-p / (sqrt(r(1-p)) BOOST_MATH_STD_USING // ADL of std functions. @@ -287,7 +287,7 @@ namespace boost return (2 - p) / sqrt(1 - p); } // skewness - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis(const geometric_distribution& dist) { // kurtosis of geometric distribution // http://en.wikipedia.org/wiki/geometric is kurtosis_excess so add 3 @@ -295,7 +295,7 @@ namespace boost return 3 + (p*p - 6*p + 6) / (1 - p); } // kurtosis - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis_excess(const geometric_distribution& dist) { // kurtosis excess of geometric distribution // http://mathworld.wolfram.com/Kurtosis.html table of kurtosis_excess @@ -310,7 +310,7 @@ namespace boost // RealType chf(const geometric_distribution& dist) // chf of geometric distribution provided by derived accessors. - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType pdf(const geometric_distribution& dist, const RealType& k) { // Probability Density/Mass Function. BOOST_FPU_EXCEPTION_GUARD @@ -348,7 +348,7 @@ namespace boost return result; } // geometric_pdf - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const geometric_distribution& dist, const RealType& k) { // Cumulative Distribution Function of geometric. constexpr auto function = "boost::math::cdf(const geometric_distribution<%1%>&, %1%)"; @@ -379,7 +379,7 @@ namespace boost return probability; } // cdf Cumulative Distribution Function geometric. - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType logcdf(const geometric_distribution& dist, const RealType& k) { // Cumulative Distribution Function of geometric. BOOST_MATH_STD_USING @@ -409,7 +409,7 @@ namespace boost return log1p(-exp(z), Policy()); } // logcdf Cumulative Distribution Function geometric. - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const complemented2_type, RealType>& c) { // Complemented Cumulative Distribution Function geometric. BOOST_MATH_STD_USING @@ -434,7 +434,7 @@ namespace boost return probability; } // cdf Complemented Cumulative Distribution Function geometric. - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType logcdf(const complemented2_type, RealType>& c) { // Complemented Cumulative Distribution Function geometric. BOOST_MATH_STD_USING @@ -458,7 +458,7 @@ namespace boost return boost::math::log1p(-p, Policy()) * (k+1); } // logcdf Complemented Cumulative Distribution Function geometric. - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const geometric_distribution& dist, const RealType& x) { // Quantile, percentile/100 or Percent Point geometric function. // Return the number of expected failures k for a given probability p. @@ -509,7 +509,7 @@ namespace boost return result; } // RealType quantile(const geometric_distribution dist, p) - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const complemented2_type, RealType>& c) { // Quantile or Percent Point Binomial function. // Return the number of expected failures k for a given diff --git a/include/boost/math/distributions/holtsmark.hpp b/include/boost/math/distributions/holtsmark.hpp index ca21d05ec4..115988f5af 100644 --- a/include/boost/math/distributions/holtsmark.hpp +++ b/include/boost/math/distributions/holtsmark.hpp @@ -36,7 +36,7 @@ #endif namespace boost { namespace math { -template +BOOST_MATH_EXPORT template class holtsmark_distribution; namespace detail { @@ -2344,7 +2344,7 @@ BOOST_MATH_GPU_ENABLED inline RealType holtsmark_entropy_imp(const holtsmark_dis } // detail -template > +BOOST_MATH_EXPORT template > class holtsmark_distribution { public: @@ -2374,16 +2374,16 @@ class holtsmark_distribution RealType c; // The scale parameter. }; -typedef holtsmark_distribution holtsmark; +BOOST_MATH_EXPORT typedef holtsmark_distribution holtsmark; #ifdef __cpp_deduction_guides -template +BOOST_MATH_EXPORT template holtsmark_distribution(RealType) -> holtsmark_distribution::type>; -template +BOOST_MATH_EXPORT template holtsmark_distribution(RealType, RealType) -> holtsmark_distribution::type>; #endif -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline const boost::math::pair range(const holtsmark_distribution&) { // Range of permissible values for random variable x. BOOST_MATH_IF_CONSTEXPR (boost::math::numeric_limits::has_infinity) @@ -2397,7 +2397,7 @@ BOOST_MATH_GPU_ENABLED inline const boost::math::pair range( } } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline const boost::math::pair support(const holtsmark_distribution&) { // 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. @@ -2412,61 +2412,61 @@ BOOST_MATH_GPU_ENABLED inline const boost::math::pair suppor } } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType pdf(const holtsmark_distribution& dist, const RealType& x) { return detail::holtsmark_pdf_imp(dist, x); } // pdf -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const holtsmark_distribution& dist, const RealType& x) { return detail::holtsmark_cdf_imp(dist, x, false); } // cdf -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const holtsmark_distribution& dist, const RealType& p) { return detail::holtsmark_quantile_imp(dist, p, false); } // quantile -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const complemented2_type, RealType>& c) { return detail::holtsmark_cdf_imp(c.dist, c.param, true); } // cdf complement -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const complemented2_type, RealType>& c) { return detail::holtsmark_quantile_imp(c.dist, c.param, true); } // quantile complement -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mean(const holtsmark_distribution &dist) { return dist.location(); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType variance(const holtsmark_distribution& /*dist*/) { return boost::math::numeric_limits::infinity(); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mode(const holtsmark_distribution& dist) { return dist.location(); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType median(const holtsmark_distribution& dist) { return dist.location(); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType skewness(const holtsmark_distribution& /*dist*/) { // There is no skewness: @@ -2480,7 +2480,7 @@ BOOST_MATH_GPU_ENABLED inline RealType skewness(const holtsmark_distribution::quiet_NaN(), Policy()); // infinity? } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis(const holtsmark_distribution& /*dist*/) { // There is no kurtosis: @@ -2494,7 +2494,7 @@ BOOST_MATH_GPU_ENABLED inline RealType kurtosis(const holtsmark_distribution::quiet_NaN(), Policy()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis_excess(const holtsmark_distribution& /*dist*/) { // There is no kurtosis excess: @@ -2508,7 +2508,7 @@ BOOST_MATH_GPU_ENABLED inline RealType kurtosis_excess(const holtsmark_distribut boost::math::numeric_limits::quiet_NaN(), Policy()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType entropy(const holtsmark_distribution& dist) { return detail::holtsmark_entropy_imp(dist); diff --git a/include/boost/math/distributions/hyperexponential.hpp b/include/boost/math/distributions/hyperexponential.hpp index 06096d07e7..0c30f53ed7 100644 --- a/include/boost/math/distributions/hyperexponential.hpp +++ b/include/boost/math/distributions/hyperexponential.hpp @@ -52,7 +52,7 @@ typename Dist::value_type generic_quantile(const Dist& dist, const typename Dist } // Namespace detail -template +BOOST_MATH_EXPORT template class hyperexponential_distribution; @@ -240,7 +240,7 @@ RealT quantile_impl(hyperexponential_distribution const& dist, R }} // Namespace ::hyperexp_detail -template > +BOOST_MATH_EXPORT template > class hyperexponential_distribution { public: typedef RealT value_type; @@ -397,11 +397,11 @@ public: hyperexponential_distribution(std::initializer_list l1) // Convenient type synonym for double. -typedef hyperexponential_distribution hyperexponential; +BOOST_MATH_EXPORT typedef hyperexponential_distribution hyperexponential; // Range of permissible values for random variable x -template +BOOST_MATH_EXPORT template std::pair range(hyperexponential_distribution const&) { if (std::numeric_limits::has_infinity) @@ -414,13 +414,13 @@ std::pair range(hyperexponential_distribution const& // 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. -template +BOOST_MATH_EXPORT template std::pair support(hyperexponential_distribution const&) { return std::make_pair(tools::min_value(), tools::max_value()); // to +. } -template +BOOST_MATH_EXPORT template RealT pdf(hyperexponential_distribution const& dist, RealT const& x) { BOOST_MATH_STD_USING @@ -446,7 +446,7 @@ RealT pdf(hyperexponential_distribution const& dist, RealT const return result; } -template +BOOST_MATH_EXPORT template RealT cdf(hyperexponential_distribution const& dist, RealT const& x) { RealT result = 0; @@ -470,13 +470,13 @@ RealT cdf(hyperexponential_distribution const& dist, RealT const return result; } -template +BOOST_MATH_EXPORT template RealT quantile(hyperexponential_distribution const& dist, RealT const& p) { return hyperexp_detail::quantile_impl(dist, p , false); } -template +BOOST_MATH_EXPORT template RealT cdf(complemented2_type, RealT> const& c) { RealT const& x = c.param; @@ -504,7 +504,7 @@ RealT cdf(complemented2_type, RealT } -template +BOOST_MATH_EXPORT template RealT quantile(complemented2_type, RealT> const& c) { RealT const& p = c.param; @@ -513,7 +513,7 @@ RealT quantile(complemented2_type, return hyperexp_detail::quantile_impl(dist, p , true); } -template +BOOST_MATH_EXPORT template RealT mean(hyperexponential_distribution const& dist) { RealT result = 0; @@ -532,7 +532,7 @@ RealT mean(hyperexponential_distribution const& dist) return result; } -template +BOOST_MATH_EXPORT template RealT variance(hyperexponential_distribution const& dist) { RealT result = 0; @@ -553,7 +553,7 @@ RealT variance(hyperexponential_distribution const& dist) return result; } -template +BOOST_MATH_EXPORT template RealT skewness(hyperexponential_distribution const& dist) { BOOST_MATH_STD_USING @@ -584,7 +584,7 @@ RealT skewness(hyperexponential_distribution const& dist) return num / pow(den, static_cast(1.5)); } -template +BOOST_MATH_EXPORT template RealT kurtosis(hyperexponential_distribution const& dist) { const std::size_t n = dist.num_phases(); @@ -617,13 +617,13 @@ RealT kurtosis(hyperexponential_distribution const& dist) return num/(den*den); } -template +BOOST_MATH_EXPORT template RealT kurtosis_excess(hyperexponential_distribution const& dist) { return kurtosis(dist) - 3; } -template +BOOST_MATH_EXPORT template RealT mode(hyperexponential_distribution const& /*dist*/) { return 0; diff --git a/include/boost/math/distributions/hypergeometric.hpp b/include/boost/math/distributions/hypergeometric.hpp index 2ed3954ed2..83afb84137 100644 --- a/include/boost/math/distributions/hypergeometric.hpp +++ b/include/boost/math/distributions/hypergeometric.hpp @@ -22,7 +22,7 @@ namespace boost { namespace math { - template > + BOOST_MATH_EXPORT template > class hypergeometric_distribution { public: @@ -93,9 +93,9 @@ namespace boost { namespace math { }; // class hypergeometric_distribution - typedef hypergeometric_distribution hypergeometric; + BOOST_MATH_EXPORT typedef hypergeometric_distribution hypergeometric; - template + BOOST_MATH_EXPORT template inline const std::pair range(const hypergeometric_distribution& dist) { // Range of permissible values for random variable x. #ifdef _MSC_VER @@ -113,13 +113,13 @@ namespace boost { namespace math { #endif } - template + BOOST_MATH_EXPORT template inline const std::pair support(const hypergeometric_distribution& d) { return range(d); } - template + BOOST_MATH_EXPORT template inline RealType pdf(const hypergeometric_distribution& dist, const std::uint64_t& x) { static const char* function = "boost::math::pdf(const hypergeometric_distribution<%1%>&, const %1%&)"; @@ -133,7 +133,7 @@ namespace boost { namespace math { x, dist.defective(), dist.sample_count(), dist.total(), Policy()); } - template + BOOST_MATH_EXPORT template inline RealType pdf(const hypergeometric_distribution& dist, const U& x) { BOOST_MATH_STD_USING @@ -148,7 +148,7 @@ namespace boost { namespace math { return pdf(dist, u); } - template + BOOST_MATH_EXPORT template inline RealType cdf(const hypergeometric_distribution& dist, const std::uint64_t& x) { static const char* function = "boost::math::cdf(const hypergeometric_distribution<%1%>&, const %1%&)"; @@ -162,7 +162,7 @@ namespace boost { namespace math { x, dist.defective(), dist.sample_count(), dist.total(), false, Policy()); } - template + BOOST_MATH_EXPORT template inline RealType cdf(const hypergeometric_distribution& dist, const U& x) { BOOST_MATH_STD_USING @@ -177,7 +177,7 @@ namespace boost { namespace math { return cdf(dist, u); } - template + BOOST_MATH_EXPORT template inline RealType cdf(const complemented2_type, std::uint64_t>& c) { static const char* function = "boost::math::cdf(const hypergeometric_distribution<%1%>&, const %1%&)"; @@ -191,7 +191,7 @@ namespace boost { namespace math { c.param, c.dist.defective(), c.dist.sample_count(), c.dist.total(), true, Policy()); } - template + BOOST_MATH_EXPORT template inline RealType cdf(const complemented2_type, U>& c) { BOOST_MATH_STD_USING @@ -206,7 +206,7 @@ namespace boost { namespace math { return cdf(complement(c.dist, u)); } - template + BOOST_MATH_EXPORT template inline RealType quantile(const hypergeometric_distribution& dist, const RealType& p) { BOOST_MATH_STD_USING // for ADL of std functions @@ -223,7 +223,7 @@ namespace boost { namespace math { return static_cast(detail::hypergeometric_quantile(p, RealType(1 - p), dist.defective(), dist.sample_count(), dist.total(), Policy())); } // quantile - template + BOOST_MATH_EXPORT template inline RealType quantile(const complemented2_type, RealType>& c) { BOOST_MATH_STD_USING // for ADL of std functions @@ -241,13 +241,13 @@ namespace boost { namespace math { // https://www.wolframalpha.com/input/?i=kurtosis+hypergeometric+distribution - template + BOOST_MATH_EXPORT template inline RealType mean(const hypergeometric_distribution& dist) { return static_cast(dist.defective() * dist.sample_count()) / dist.total(); } // RealType mean(const hypergeometric_distribution& dist) - template + BOOST_MATH_EXPORT template inline RealType variance(const hypergeometric_distribution& dist) { RealType r = static_cast(dist.defective()); @@ -256,7 +256,7 @@ namespace boost { namespace math { return n * r * (N - r) * (N - n) / (N * N * (N - 1)); } // RealType variance(const hypergeometric_distribution& dist) - template + BOOST_MATH_EXPORT template inline RealType mode(const hypergeometric_distribution& dist) { BOOST_MATH_STD_USING @@ -266,7 +266,7 @@ namespace boost { namespace math { return floor((r + 1) * (n + 1) / (N + 2)); } - template + BOOST_MATH_EXPORT template inline RealType skewness(const hypergeometric_distribution& dist) { BOOST_MATH_STD_USING @@ -276,7 +276,7 @@ namespace boost { namespace math { return (N - 2 * r) * sqrt(N - 1) * (N - 2 * n) / (sqrt(n * r * (N - r) * (N - n)) * (N - 2)); } // RealType skewness(const hypergeometric_distribution& dist) - template + BOOST_MATH_EXPORT template inline RealType kurtosis_excess(const hypergeometric_distribution& dist) { // https://www.wolframalpha.com/input/?i=kurtosis+hypergeometric+distribution shown as plain text: @@ -298,7 +298,7 @@ namespace boost { namespace math { return result; } // RealType kurtosis_excess(const hypergeometric_distribution& dist) - template + BOOST_MATH_EXPORT template inline RealType kurtosis(const hypergeometric_distribution& dist) { return kurtosis_excess(dist) + 3; diff --git a/include/boost/math/distributions/inverse_chi_squared.hpp b/include/boost/math/distributions/inverse_chi_squared.hpp index ca7e7f87e7..75bc25761d 100644 --- a/include/boost/math/distributions/inverse_chi_squared.hpp +++ b/include/boost/math/distributions/inverse_chi_squared.hpp @@ -44,7 +44,7 @@ namespace detail } // bool check_inverse_chi_squared } // namespace detail -template > +BOOST_MATH_EXPORT template > class inverse_chi_squared_distribution { public: @@ -95,30 +95,30 @@ class inverse_chi_squared_distribution }; // class chi_squared_distribution -typedef inverse_chi_squared_distribution inverse_chi_squared; +BOOST_MATH_EXPORT typedef inverse_chi_squared_distribution inverse_chi_squared; #ifdef __cpp_deduction_guides -template +BOOST_MATH_EXPORT template inverse_chi_squared_distribution(RealType)->inverse_chi_squared_distribution::type>; -template +BOOST_MATH_EXPORT template inverse_chi_squared_distribution(RealType,RealType)->inverse_chi_squared_distribution::type>; #endif -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline const boost::math::pair range(const inverse_chi_squared_distribution& /*dist*/) { // Range of permissible values for random variable x. using boost::math::tools::max_value; return boost::math::pair(static_cast(0), max_value()); // 0 to + infinity. } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline const boost::math::pair support(const inverse_chi_squared_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 boost::math::pair(static_cast(0), tools::max_value()); // 0 to + infinity. } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED RealType pdf(const inverse_chi_squared_distribution& dist, const RealType& x) { BOOST_MATH_STD_USING // for ADL of std functions. @@ -158,7 +158,7 @@ BOOST_MATH_GPU_ENABLED RealType pdf(const inverse_chi_squared_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const inverse_chi_squared_distribution& dist, const RealType& x) { constexpr auto function = "boost::math::cdf(const inverse_chi_squared_distribution<%1%>&, %1%)"; @@ -187,7 +187,7 @@ BOOST_MATH_GPU_ENABLED inline RealType cdf(const inverse_chi_squared_distributio return boost::math::gamma_q(df / 2, (df * (scale / 2)) / x, Policy()); } // cdf -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const inverse_chi_squared_distribution& dist, const RealType& p) { using boost::math::gamma_q_inv; @@ -219,7 +219,7 @@ BOOST_MATH_GPU_ENABLED inline RealType quantile(const inverse_chi_squared_distri return result; } // quantile -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const complemented2_type, RealType>& c) { using boost::math::gamma_q_inv; @@ -250,7 +250,7 @@ BOOST_MATH_GPU_ENABLED inline RealType cdf(const complemented2_type +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const complemented2_type, RealType>& c) { using boost::math::gamma_q_inv; @@ -279,7 +279,7 @@ BOOST_MATH_GPU_ENABLED inline RealType quantile(const complemented2_type +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mean(const inverse_chi_squared_distribution& dist) { // Mean of inverse Chi-Squared distribution. RealType df = dist.degrees_of_freedom(); @@ -294,7 +294,7 @@ BOOST_MATH_GPU_ENABLED inline RealType mean(const inverse_chi_squared_distributi return (df * scale) / (df - 2); } // mean -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType variance(const inverse_chi_squared_distribution& dist) { // Variance of inverse Chi-Squared distribution. RealType df = dist.degrees_of_freedom(); @@ -310,7 +310,7 @@ BOOST_MATH_GPU_ENABLED inline RealType variance(const inverse_chi_squared_distri return 2 * df * df * scale * scale / ((df - 2)*(df - 2) * (df - 4)); } // variance -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mode(const inverse_chi_squared_distribution& dist) { // mode is not defined in Mathematica. // See Discussion section http://en.wikipedia.org/wiki/Talk:Scaled-inverse-chi-square_distribution @@ -340,7 +340,7 @@ BOOST_MATH_GPU_ENABLED inline RealType mode(const inverse_chi_squared_distributi //} // Now implemented via quantile(half) in derived accessors. -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType skewness(const inverse_chi_squared_distribution& dist) { BOOST_MATH_STD_USING // For ADL @@ -355,7 +355,7 @@ BOOST_MATH_GPU_ENABLED inline RealType skewness(const inverse_chi_squared_distri return 4 * sqrt (2 * (df - 4)) / (df - 6); // Not a function of scale. } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis(const inverse_chi_squared_distribution& dist) { RealType df = dist.degrees_of_freedom(); @@ -369,7 +369,7 @@ BOOST_MATH_GPU_ENABLED inline RealType kurtosis(const inverse_chi_squared_distri return kurtosis_excess(dist) + 3; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis_excess(const inverse_chi_squared_distribution& dist) { RealType df = dist.degrees_of_freedom(); diff --git a/include/boost/math/distributions/inverse_gamma.hpp b/include/boost/math/distributions/inverse_gamma.hpp index 6aa798ed82..2cf2ff5f5c 100644 --- a/include/boost/math/distributions/inverse_gamma.hpp +++ b/include/boost/math/distributions/inverse_gamma.hpp @@ -86,7 +86,7 @@ BOOST_MATH_GPU_ENABLED inline bool check_inverse_gamma( } // namespace detail -template > +BOOST_MATH_EXPORT template > class inverse_gamma_distribution { public: @@ -119,27 +119,27 @@ class inverse_gamma_distribution RealType m_scale; // distribution scale }; -using inverse_gamma = inverse_gamma_distribution; +BOOST_MATH_EXPORT using inverse_gamma = inverse_gamma_distribution; // typedef - but potential clash with name of inverse gamma *function*. // but there is a typedef for the gamma distribution (gamma) #ifdef __cpp_deduction_guides -template +BOOST_MATH_EXPORT template inverse_gamma_distribution(RealType)->inverse_gamma_distribution::type>; -template +BOOST_MATH_EXPORT template inverse_gamma_distribution(RealType,RealType)->inverse_gamma_distribution::type>; #endif // Allow random variable x to be zero, treated as a special case (unlike some definitions). -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline boost::math::pair range(const inverse_gamma_distribution& /* dist */) { // Range of permissible values for random variable x. using boost::math::tools::max_value; return boost::math::pair(static_cast(0), max_value()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline boost::math::pair support(const inverse_gamma_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. @@ -148,7 +148,7 @@ BOOST_MATH_GPU_ENABLED inline boost::math::pair support(cons return boost::math::pair(static_cast(0), max_value()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType pdf(const inverse_gamma_distribution& dist, const RealType& x) { BOOST_MATH_STD_USING // for ADL of std functions @@ -195,7 +195,7 @@ BOOST_MATH_GPU_ENABLED inline RealType pdf(const inverse_gamma_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType logpdf(const inverse_gamma_distribution& dist, const RealType& x) { BOOST_MATH_STD_USING // for ADL of std functions @@ -232,7 +232,7 @@ BOOST_MATH_GPU_ENABLED inline RealType logpdf(const inverse_gamma_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const inverse_gamma_distribution& dist, const RealType& x) { BOOST_MATH_STD_USING // for ADL of std functions @@ -260,7 +260,7 @@ BOOST_MATH_GPU_ENABLED inline RealType cdf(const inverse_gamma_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const inverse_gamma_distribution& dist, const RealType& p) { BOOST_MATH_STD_USING // for ADL of std functions @@ -287,7 +287,7 @@ BOOST_MATH_GPU_ENABLED inline RealType quantile(const inverse_gamma_distribution return result; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const complemented2_type, RealType>& c) { BOOST_MATH_STD_USING // for ADL of std functions @@ -310,7 +310,7 @@ BOOST_MATH_GPU_ENABLED inline RealType cdf(const complemented2_type +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const complemented2_type, RealType>& c) { BOOST_MATH_STD_USING // for ADL of std functions @@ -338,7 +338,7 @@ BOOST_MATH_GPU_ENABLED inline RealType quantile(const complemented2_type +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mean(const inverse_gamma_distribution& dist) { BOOST_MATH_STD_USING // for ADL of std functions @@ -365,7 +365,7 @@ BOOST_MATH_GPU_ENABLED inline RealType mean(const inverse_gamma_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType variance(const inverse_gamma_distribution& dist) { BOOST_MATH_STD_USING // for ADL of std functions @@ -391,7 +391,7 @@ BOOST_MATH_GPU_ENABLED inline RealType variance(const inverse_gamma_distribution return result; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mode(const inverse_gamma_distribution& dist) { BOOST_MATH_STD_USING // for ADL of std functions @@ -418,7 +418,7 @@ BOOST_MATH_GPU_ENABLED inline RealType mode(const inverse_gamma_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType skewness(const inverse_gamma_distribution& dist) { BOOST_MATH_STD_USING // for ADL of std functions @@ -444,7 +444,7 @@ BOOST_MATH_GPU_ENABLED inline RealType skewness(const inverse_gamma_distribution return result; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis_excess(const inverse_gamma_distribution& dist) { BOOST_MATH_STD_USING // for ADL of std functions @@ -470,7 +470,7 @@ BOOST_MATH_GPU_ENABLED inline RealType kurtosis_excess(const inverse_gamma_distr return result; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis(const inverse_gamma_distribution& dist) { constexpr auto function = "boost::math::kurtosis(const inverse_gamma_distribution<%1%>&)"; diff --git a/include/boost/math/distributions/inverse_gaussian.hpp b/include/boost/math/distributions/inverse_gaussian.hpp index 795ad23d4a..4240d897dc 100644 --- a/include/boost/math/distributions/inverse_gaussian.hpp +++ b/include/boost/math/distributions/inverse_gaussian.hpp @@ -64,7 +64,7 @@ namespace boost{ namespace math{ -template > +BOOST_MATH_EXPORT template > class inverse_gaussian_distribution { public: @@ -110,23 +110,23 @@ class inverse_gaussian_distribution RealType m_scale; // distribution standard deviation or scale, aka lambda. }; // class normal_distribution -using inverse_gaussian = inverse_gaussian_distribution; +BOOST_MATH_EXPORT using inverse_gaussian = inverse_gaussian_distribution; #ifdef __cpp_deduction_guides -template +BOOST_MATH_EXPORT template inverse_gaussian_distribution(RealType)->inverse_gaussian_distribution::type>; -template +BOOST_MATH_EXPORT template inverse_gaussian_distribution(RealType,RealType)->inverse_gaussian_distribution::type>; #endif -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline boost::math::pair range(const inverse_gaussian_distribution& /*dist*/) { // Range of permissible values for random variable x, zero to max. using boost::math::tools::max_value; return boost::math::pair(static_cast(0.), max_value()); // - to + max value. } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline boost::math::pair support(const inverse_gaussian_distribution& /*dist*/) { // Range of supported values for random variable x, zero to max. // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero. @@ -134,7 +134,7 @@ BOOST_MATH_GPU_ENABLED inline boost::math::pair support(cons return boost::math::pair(static_cast(0.), max_value()); // - to + max value. } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType pdf(const inverse_gaussian_distribution& dist, const RealType& x) { // Probability Density Function BOOST_MATH_STD_USING // for ADL of std functions @@ -171,7 +171,7 @@ BOOST_MATH_GPU_ENABLED inline RealType pdf(const inverse_gaussian_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType logpdf(const inverse_gaussian_distribution& dist, const RealType& x) { // Probability Density Function BOOST_MATH_STD_USING // for ADL of std functions @@ -208,7 +208,7 @@ BOOST_MATH_GPU_ENABLED inline RealType logpdf(const inverse_gaussian_distributio return result; } // pdf -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const inverse_gaussian_distribution& dist, const RealType& x) { // Cumulative Density Function. BOOST_MATH_STD_USING // for ADL of std functions. @@ -339,7 +339,7 @@ namespace detail } // guess_ig } // namespace detail -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const inverse_gaussian_distribution& dist, const RealType& p) { BOOST_MATH_STD_USING // for ADL of std functions. @@ -401,7 +401,7 @@ BOOST_MATH_GPU_ENABLED inline RealType quantile(const inverse_gaussian_distribut return result; } // quantile -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const complemented2_type, RealType>& c) { BOOST_MATH_STD_USING // for ADL of std functions. @@ -437,7 +437,7 @@ BOOST_MATH_GPU_ENABLED inline RealType cdf(const complemented2_type +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const complemented2_type, RealType>& c) { BOOST_MATH_STD_USING // for ADL of std functions @@ -486,7 +486,7 @@ BOOST_MATH_GPU_ENABLED inline RealType quantile(const complemented2_type +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mean(const inverse_gaussian_distribution& dist) { // aka mu return dist.mean(); @@ -504,7 +504,7 @@ BOOST_MATH_GPU_ENABLED inline RealType shape(const inverse_gaussian_distribution return dist.shape(); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType standard_deviation(const inverse_gaussian_distribution& dist) { BOOST_MATH_STD_USING @@ -514,7 +514,7 @@ BOOST_MATH_GPU_ENABLED inline RealType standard_deviation(const inverse_gaussian return result; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mode(const inverse_gaussian_distribution& dist) { BOOST_MATH_STD_USING @@ -525,7 +525,7 @@ BOOST_MATH_GPU_ENABLED inline RealType mode(const inverse_gaussian_distribution< return result; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType skewness(const inverse_gaussian_distribution& dist) { BOOST_MATH_STD_USING @@ -535,7 +535,7 @@ BOOST_MATH_GPU_ENABLED inline RealType skewness(const inverse_gaussian_distribut return result; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis(const inverse_gaussian_distribution& dist) { RealType scale = dist.scale(); @@ -544,7 +544,7 @@ BOOST_MATH_GPU_ENABLED inline RealType kurtosis(const inverse_gaussian_distribut return result; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis_excess(const inverse_gaussian_distribution& dist) { RealType scale = dist.scale(); diff --git a/include/boost/math/distributions/kolmogorov_smirnov.hpp b/include/boost/math/distributions/kolmogorov_smirnov.hpp index 0934344134..66d4997ce8 100644 --- a/include/boost/math/distributions/kolmogorov_smirnov.hpp +++ b/include/boost/math/distributions/kolmogorov_smirnov.hpp @@ -186,7 +186,7 @@ inline RealType kolmogorov_smirnov_pdf_large_x(RealType x, RealType n, const Pol } // detail -template > +BOOST_MATH_EXPORT template > class kolmogorov_smirnov_distribution { public: @@ -211,10 +211,10 @@ template > RealType n_obs_; // positive integer }; -typedef kolmogorov_smirnov_distribution kolmogorov_k; // Convenience typedef for double version. +BOOST_MATH_EXPORT typedef kolmogorov_smirnov_distribution kolmogorov_k; // Convenience typedef for double version. #ifdef __cpp_deduction_guides -template +BOOST_MATH_EXPORT template kolmogorov_smirnov_distribution(RealType)->kolmogorov_smirnov_distribution::type>; #endif @@ -271,14 +271,14 @@ struct kolmogorov_smirnov_negative_pdf_functor }; } // namespace detail -template +BOOST_MATH_EXPORT template inline const std::pair range(const kolmogorov_smirnov_distribution& /*dist*/) { // Range of permissible values for random variable x. using boost::math::tools::max_value; return std::pair(static_cast(0), max_value()); } -template +BOOST_MATH_EXPORT template inline const std::pair support(const kolmogorov_smirnov_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. @@ -287,7 +287,7 @@ inline const std::pair support(const kolmogorov_smirnov_dist return std::pair(static_cast(0), max_value()); } -template +BOOST_MATH_EXPORT template inline RealType pdf(const kolmogorov_smirnov_distribution& dist, const RealType& x) { BOOST_FPU_EXCEPTION_GUARD @@ -315,7 +315,7 @@ inline RealType pdf(const kolmogorov_smirnov_distribution& dis return detail::kolmogorov_smirnov_pdf_large_x(x, n, Policy()); } // pdf -template +BOOST_MATH_EXPORT template inline RealType cdf(const kolmogorov_smirnov_distribution& dist, const RealType& x) { BOOST_MATH_STD_USING // for ADL of std function exp. @@ -337,7 +337,7 @@ inline RealType cdf(const kolmogorov_smirnov_distribution& dis return jacobi_theta4tau(RealType(0), 2*x*x*n/constants::pi(), Policy()); } // cdf -template +BOOST_MATH_EXPORT template inline RealType cdf(const complemented2_type, RealType>& c) { BOOST_MATH_STD_USING // for ADL of std function exp. RealType x = c.param; @@ -364,7 +364,7 @@ inline RealType cdf(const complemented2_type(), Policy()); } // cdf (complemented) -template +BOOST_MATH_EXPORT template inline RealType quantile(const kolmogorov_smirnov_distribution& dist, const RealType& p) { BOOST_MATH_STD_USING @@ -391,7 +391,7 @@ inline RealType quantile(const kolmogorov_smirnov_distribution return result; } // quantile -template +BOOST_MATH_EXPORT template inline RealType quantile(const complemented2_type, RealType>& c) { BOOST_MATH_STD_USING static const char* function = "boost::math::quantile(const kolmogorov_smirnov_distribution<%1%>&, %1%)"; @@ -422,7 +422,7 @@ inline RealType quantile(const complemented2_type +BOOST_MATH_EXPORT template inline RealType mode(const kolmogorov_smirnov_distribution& dist) { BOOST_MATH_STD_USING @@ -440,7 +440,7 @@ inline RealType mode(const kolmogorov_smirnov_distribution& di // Mean and variance come directly from // https://www.jstatsoft.org/article/view/v008i18 Section 3 -template +BOOST_MATH_EXPORT template inline RealType mean(const kolmogorov_smirnov_distribution& dist) { BOOST_MATH_STD_USING @@ -452,7 +452,7 @@ inline RealType mean(const kolmogorov_smirnov_distribution& di return constants::root_half_pi() * constants::ln_two() / sqrt(n); } -template +BOOST_MATH_EXPORT template inline RealType variance(const kolmogorov_smirnov_distribution& dist) { static const char* function = "boost::math::variance(const kolmogorov_smirnov_distribution<%1%>&)"; @@ -466,7 +466,7 @@ inline RealType variance(const kolmogorov_smirnov_distribution // Skewness and kurtosis come from integrating the PDF // The alternating series pops out a Dirichlet eta function which is related to the zeta function -template +BOOST_MATH_EXPORT template inline RealType skewness(const kolmogorov_smirnov_distribution& dist) { BOOST_MATH_STD_USING @@ -481,7 +481,7 @@ inline RealType skewness(const kolmogorov_smirnov_distribution return (ex3 - 3 * mean * var - mean * mean * mean) / var / sqrt(var); } -template +BOOST_MATH_EXPORT template inline RealType kurtosis(const kolmogorov_smirnov_distribution& dist) { BOOST_MATH_STD_USING @@ -497,7 +497,7 @@ inline RealType kurtosis(const kolmogorov_smirnov_distribution return (ex4 - 4 * mean * skew * var * sqrt(var) - 6 * mean * mean * var - mean * mean * mean * mean) / var / var; } -template +BOOST_MATH_EXPORT template inline RealType kurtosis_excess(const kolmogorov_smirnov_distribution& dist) { static const char* function = "boost::math::kurtosis_excess(const kolmogorov_smirnov_distribution<%1%>&)"; diff --git a/include/boost/math/distributions/landau.hpp b/include/boost/math/distributions/landau.hpp index 2e4b0617c0..b77f7106b4 100644 --- a/include/boost/math/distributions/landau.hpp +++ b/include/boost/math/distributions/landau.hpp @@ -35,7 +35,7 @@ #endif namespace boost { namespace math { -template +BOOST_MATH_EXPORT template class landau_distribution; namespace detail { @@ -4444,7 +4444,7 @@ BOOST_MATH_GPU_ENABLED inline RealType landau_entropy_imp(const landau_distribut } // detail -template > +BOOST_MATH_EXPORT template > class landau_distribution { public: @@ -4483,16 +4483,16 @@ class landau_distribution RealType location_bias; // = -2 / pi * log(c) }; -typedef landau_distribution landau; +BOOST_MATH_EXPORT typedef landau_distribution landau; #ifdef __cpp_deduction_guides -template +BOOST_MATH_EXPORT template landau_distribution(RealType) -> landau_distribution::type>; -template +BOOST_MATH_EXPORT template landau_distribution(RealType, RealType) -> landau_distribution::type>; #endif -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline const boost::math::pair range(const landau_distribution&) { // Range of permissible values for random variable x. BOOST_MATH_IF_CONSTEXPR (boost::math::numeric_limits::has_infinity) @@ -4506,7 +4506,7 @@ BOOST_MATH_GPU_ENABLED inline const boost::math::pair range( } } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline const boost::math::pair support(const landau_distribution&) { // 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. @@ -4521,37 +4521,37 @@ BOOST_MATH_GPU_ENABLED inline const boost::math::pair suppor } } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType pdf(const landau_distribution& dist, const RealType& x) { return detail::landau_pdf_imp(dist, x); } // pdf -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const landau_distribution& dist, const RealType& x) { return detail::landau_cdf_imp(dist, x, false); } // cdf -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const landau_distribution& dist, const RealType& p) { return detail::landau_quantile_imp(dist, p, false); } // quantile -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const complemented2_type, RealType>& c) { return detail::landau_cdf_imp(c.dist, c.param, true); } // cdf complement -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const complemented2_type, RealType>& c) { return detail::landau_quantile_imp(c.dist, c.param, true); } // quantile complement -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mean(const landau_distribution&) { // There is no mean: typedef typename Policy::assert_undefined_type assert_type; @@ -4564,7 +4564,7 @@ BOOST_MATH_GPU_ENABLED inline RealType mean(const landau_distribution::quiet_NaN(), Policy()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType variance(const landau_distribution& /*dist*/) { // There is no variance: @@ -4578,19 +4578,19 @@ BOOST_MATH_GPU_ENABLED inline RealType variance(const landau_distribution::quiet_NaN(), Policy()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mode(const landau_distribution& dist) { return detail::landau_mode_imp(dist); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType median(const landau_distribution& dist) { return detail::landau_median_imp(dist); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType skewness(const landau_distribution& /*dist*/) { // There is no skewness: @@ -4604,7 +4604,7 @@ BOOST_MATH_GPU_ENABLED inline RealType skewness(const landau_distribution::quiet_NaN(), Policy()); // infinity? } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis(const landau_distribution& /*dist*/) { // There is no kurtosis: @@ -4618,7 +4618,7 @@ BOOST_MATH_GPU_ENABLED inline RealType kurtosis(const landau_distribution::quiet_NaN(), Policy()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis_excess(const landau_distribution& /*dist*/) { // There is no kurtosis excess: @@ -4632,7 +4632,7 @@ BOOST_MATH_GPU_ENABLED inline RealType kurtosis_excess(const landau_distribution boost::math::numeric_limits::quiet_NaN(), Policy()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType entropy(const landau_distribution& dist) { return detail::landau_entropy_imp(dist); diff --git a/include/boost/math/distributions/laplace.hpp b/include/boost/math/distributions/laplace.hpp index 81a0abe1ab..db309c3adc 100644 --- a/include/boost/math/distributions/laplace.hpp +++ b/include/boost/math/distributions/laplace.hpp @@ -35,7 +35,7 @@ namespace boost{ namespace math{ # pragma warning(disable:4127) // conditional expression is constant #endif -template > +BOOST_MATH_EXPORT template > class laplace_distribution { public: @@ -84,18 +84,18 @@ class laplace_distribution // // Convenient type synonym for double. -using laplace = laplace_distribution; +BOOST_MATH_EXPORT using laplace = laplace_distribution; #ifdef __cpp_deduction_guides -template +BOOST_MATH_EXPORT template laplace_distribution(RealType)->laplace_distribution::type>; -template +BOOST_MATH_EXPORT template laplace_distribution(RealType,RealType)->laplace_distribution::type>; #endif // // Non-member functions. -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline boost::math::pair range(const laplace_distribution&) { BOOST_MATH_IF_CONSTEXPR (boost::math::numeric_limits::has_infinity) @@ -110,7 +110,7 @@ BOOST_MATH_GPU_ENABLED inline boost::math::pair range(const } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline boost::math::pair support(const laplace_distribution&) { BOOST_MATH_IF_CONSTEXPR (boost::math::numeric_limits::has_infinity) @@ -124,7 +124,7 @@ BOOST_MATH_GPU_ENABLED inline boost::math::pair support(cons } } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType pdf(const laplace_distribution& dist, const RealType& x) { BOOST_MATH_STD_USING // for ADL of std functions @@ -156,7 +156,7 @@ BOOST_MATH_GPU_ENABLED inline RealType pdf(const laplace_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType logpdf(const laplace_distribution& dist, const RealType& x) { BOOST_MATH_STD_USING // for ADL of std functions @@ -198,7 +198,7 @@ BOOST_MATH_GPU_ENABLED inline RealType logpdf(const laplace_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const laplace_distribution& dist, const RealType& x) { BOOST_MATH_STD_USING // For ADL of std functions. @@ -232,7 +232,7 @@ BOOST_MATH_GPU_ENABLED inline RealType cdf(const laplace_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType logcdf(const laplace_distribution& dist, const RealType& x) { BOOST_MATH_STD_USING // For ADL of std functions. @@ -277,7 +277,7 @@ BOOST_MATH_GPU_ENABLED inline RealType logcdf(const laplace_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const laplace_distribution& dist, const RealType& p) { BOOST_MATH_STD_USING // for ADL of std functions. @@ -315,7 +315,7 @@ BOOST_MATH_GPU_ENABLED inline RealType quantile(const laplace_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const complemented2_type, RealType>& c) { // Calculate complement of cdf. @@ -352,7 +352,7 @@ BOOST_MATH_GPU_ENABLED inline RealType cdf(const complemented2_type +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType logcdf(const complemented2_type, RealType>& c) { // Calculate complement of logcdf. @@ -393,7 +393,7 @@ BOOST_MATH_GPU_ENABLED inline RealType logcdf(const complemented2_type +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const complemented2_type, RealType>& c) { BOOST_MATH_STD_USING // for ADL of std functions. @@ -428,49 +428,49 @@ BOOST_MATH_GPU_ENABLED inline RealType quantile(const complemented2_type +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mean(const laplace_distribution& dist) { return dist.location(); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType standard_deviation(const laplace_distribution& dist) { return constants::root_two() * dist.scale(); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mode(const laplace_distribution& dist) { return dist.location(); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType median(const laplace_distribution& dist) { return dist.location(); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType skewness(const laplace_distribution& /*dist*/) { return 0; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis(const laplace_distribution& /*dist*/) { return 6; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis_excess(const laplace_distribution& /*dist*/) { return 3; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType entropy(const laplace_distribution & dist) { using std::log; diff --git a/include/boost/math/distributions/logistic.hpp b/include/boost/math/distributions/logistic.hpp index bc2dd1ff5a..8132fbcc23 100644 --- a/include/boost/math/distributions/logistic.hpp +++ b/include/boost/math/distributions/logistic.hpp @@ -24,7 +24,7 @@ namespace boost { namespace math { - template > + BOOST_MATH_EXPORT template > class logistic_distribution { public: @@ -57,16 +57,16 @@ namespace boost { namespace math { }; // class logistic_distribution - typedef logistic_distribution logistic; + BOOST_MATH_EXPORT typedef logistic_distribution logistic; #ifdef __cpp_deduction_guides - template + BOOST_MATH_EXPORT template logistic_distribution(RealType)->logistic_distribution::type>; - template + BOOST_MATH_EXPORT template logistic_distribution(RealType,RealType)->logistic_distribution::type>; #endif - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline const boost::math::pair range(const logistic_distribution& /* dist */) { // Range of permissible values for random variable x. using boost::math::tools::max_value; @@ -75,7 +75,7 @@ namespace boost { namespace math { boost::math::numeric_limits::has_infinity ? boost::math::numeric_limits::infinity() : max_value()); } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline const boost::math::pair support(const logistic_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. @@ -83,7 +83,7 @@ namespace boost { namespace math { return boost::math::pair(-max_value(), max_value()); // - to + infinity } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType pdf(const logistic_distribution& dist, const RealType& x) { constexpr auto function = "boost::math::pdf(const logistic_distribution<%1%>&, %1%)"; @@ -120,7 +120,7 @@ namespace boost { namespace math { return (exp_term) / (scale * (1 + exp_term) * (1 + exp_term)); } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const logistic_distribution& dist, const RealType& x) { RealType scale = dist.scale(); @@ -152,7 +152,7 @@ namespace boost { namespace math { return logistic_sigmoid(power, policies::make_forwarding_policy_t()); } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType logcdf(const logistic_distribution& dist, const RealType& x) { RealType scale = dist.scale(); @@ -195,7 +195,7 @@ namespace boost { namespace math { return -log1p(exp(power)); } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const logistic_distribution& dist, const RealType& p) { RealType location = dist.location(); @@ -223,7 +223,7 @@ namespace boost { namespace math { return location + scale * logit(p, Policy()); } // RealType quantile(const logistic_distribution& dist, const RealType& p) - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const complemented2_type, RealType>& c) { RealType location = c.dist.location(); @@ -255,7 +255,7 @@ namespace boost { namespace math { return logistic_sigmoid(power, policies::make_forwarding_policy_t()); } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType logcdf(const complemented2_type, RealType>& c) { BOOST_MATH_STD_USING @@ -291,7 +291,7 @@ namespace boost { namespace math { return -log1p(exp(power)); } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const complemented2_type, RealType>& c) { RealType scale = c.dist.scale(); @@ -319,13 +319,13 @@ namespace boost { namespace math { return location - scale * logit(q, Policy()); } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mean(const logistic_distribution& dist) { return dist.location(); } // RealType mean(const logistic_distribution& dist) - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType variance(const logistic_distribution& dist) { BOOST_MATH_STD_USING @@ -333,36 +333,36 @@ namespace boost { namespace math { return boost::math::constants::pi()*boost::math::constants::pi()*scale*scale/3; } // RealType variance(const logistic_distribution& dist) - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mode(const logistic_distribution& dist) { return dist.location(); } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType median(const logistic_distribution& dist) { return dist.location(); } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType skewness(const logistic_distribution& /*dist*/) { return 0; } // RealType skewness(const logistic_distribution& dist) - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis_excess(const logistic_distribution& /*dist*/) { return static_cast(6)/5; } // RealType kurtosis_excess(const logistic_distribution& dist) - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis(const logistic_distribution& dist) { return kurtosis_excess(dist) + 3; } // RealType kurtosis_excess(const logistic_distribution& dist) - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType entropy(const logistic_distribution& dist) { using std::log; diff --git a/include/boost/math/distributions/lognormal.hpp b/include/boost/math/distributions/lognormal.hpp index dfc3e4b2a2..0b6db0b443 100644 --- a/include/boost/math/distributions/lognormal.hpp +++ b/include/boost/math/distributions/lognormal.hpp @@ -45,7 +45,7 @@ namespace detail } // namespace detail -template > +BOOST_MATH_EXPORT template > class lognormal_distribution { public: @@ -77,23 +77,23 @@ class lognormal_distribution RealType m_scale; // distribution scale. }; -typedef lognormal_distribution lognormal; +BOOST_MATH_EXPORT typedef lognormal_distribution lognormal; #ifdef __cpp_deduction_guides -template +BOOST_MATH_EXPORT template lognormal_distribution(RealType)->lognormal_distribution::type>; -template +BOOST_MATH_EXPORT template lognormal_distribution(RealType,RealType)->lognormal_distribution::type>; #endif -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline const boost::math::pair range(const lognormal_distribution& /*dist*/) { // Range of permissible values for random variable x is >0 to +infinity. using boost::math::tools::max_value; return boost::math::pair(static_cast(0), max_value()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline const boost::math::pair support(const lognormal_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. @@ -101,7 +101,7 @@ BOOST_MATH_GPU_ENABLED inline const boost::math::pair suppor return boost::math::pair(static_cast(0), max_value()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED RealType pdf(const lognormal_distribution& dist, const RealType& x) { BOOST_MATH_STD_USING // for ADL of std functions @@ -132,7 +132,7 @@ BOOST_MATH_GPU_ENABLED RealType pdf(const lognormal_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const lognormal_distribution& dist, const RealType& x) { BOOST_MATH_STD_USING // for ADL of std functions @@ -154,7 +154,7 @@ BOOST_MATH_GPU_ENABLED inline RealType cdf(const lognormal_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const lognormal_distribution& dist, const RealType& p) { BOOST_MATH_STD_USING // for ADL of std functions @@ -178,7 +178,7 @@ BOOST_MATH_GPU_ENABLED inline RealType quantile(const lognormal_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const complemented2_type, RealType>& c) { BOOST_MATH_STD_USING // for ADL of std functions @@ -200,7 +200,7 @@ BOOST_MATH_GPU_ENABLED inline RealType cdf(const complemented2_type +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const complemented2_type, RealType>& c) { BOOST_MATH_STD_USING // for ADL of std functions @@ -224,7 +224,7 @@ BOOST_MATH_GPU_ENABLED inline RealType quantile(const complemented2_type +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mean(const lognormal_distribution& dist) { BOOST_MATH_STD_USING // for ADL of std functions @@ -241,7 +241,7 @@ BOOST_MATH_GPU_ENABLED inline RealType mean(const lognormal_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType variance(const lognormal_distribution& dist) { BOOST_MATH_STD_USING // for ADL of std functions @@ -258,7 +258,7 @@ BOOST_MATH_GPU_ENABLED inline RealType variance(const lognormal_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mode(const lognormal_distribution& dist) { BOOST_MATH_STD_USING // for ADL of std functions @@ -275,7 +275,7 @@ BOOST_MATH_GPU_ENABLED inline RealType mode(const lognormal_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType median(const lognormal_distribution& dist) { BOOST_MATH_STD_USING // for ADL of std functions @@ -283,7 +283,7 @@ BOOST_MATH_GPU_ENABLED inline RealType median(const lognormal_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType skewness(const lognormal_distribution& dist) { BOOST_MATH_STD_USING // for ADL of std functions @@ -303,7 +303,7 @@ BOOST_MATH_GPU_ENABLED inline RealType skewness(const lognormal_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis(const lognormal_distribution& dist) { BOOST_MATH_STD_USING // for ADL of std functions @@ -321,7 +321,7 @@ BOOST_MATH_GPU_ENABLED inline RealType kurtosis(const lognormal_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis_excess(const lognormal_distribution& dist) { BOOST_MATH_STD_USING // for ADL of std functions @@ -339,7 +339,7 @@ BOOST_MATH_GPU_ENABLED inline RealType kurtosis_excess(const lognormal_distribut return exp(4 * ss) + 2 * exp(3 * ss) + 3 * exp(2 * ss) - 6; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType entropy(const lognormal_distribution& dist) { BOOST_MATH_STD_USING diff --git a/include/boost/math/distributions/mapairy.hpp b/include/boost/math/distributions/mapairy.hpp index 0f8e3f0ffb..db53b8c3a4 100644 --- a/include/boost/math/distributions/mapairy.hpp +++ b/include/boost/math/distributions/mapairy.hpp @@ -34,7 +34,7 @@ #endif namespace boost { namespace math { -template +BOOST_MATH_EXPORT template class mapairy_distribution; namespace detail { @@ -4046,7 +4046,7 @@ BOOST_MATH_GPU_ENABLED inline RealType mapairy_entropy_imp(const mapairy_distrib } // detail -template > +BOOST_MATH_EXPORT template > class mapairy_distribution { public: @@ -4076,16 +4076,16 @@ class mapairy_distribution RealType c; // The scale parameter. }; -typedef mapairy_distribution mapairy; +BOOST_MATH_EXPORT typedef mapairy_distribution mapairy; #ifdef __cpp_deduction_guides -template +BOOST_MATH_EXPORT template mapairy_distribution(RealType) -> mapairy_distribution::type>; -template +BOOST_MATH_EXPORT template mapairy_distribution(RealType, RealType) -> mapairy_distribution::type>; #endif -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline const boost::math::pair range(const mapairy_distribution&) { // Range of permissible values for random variable x. BOOST_MATH_IF_CONSTEXPR (boost::math::numeric_limits::has_infinity) @@ -4099,7 +4099,7 @@ BOOST_MATH_GPU_ENABLED inline const boost::math::pair range( } } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline const boost::math::pair support(const mapairy_distribution&) { // 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. @@ -4114,61 +4114,61 @@ BOOST_MATH_GPU_ENABLED inline const boost::math::pair suppor } } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType pdf(const mapairy_distribution& dist, const RealType& x) { return detail::mapairy_pdf_imp(dist, x); } // pdf -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const mapairy_distribution& dist, const RealType& x) { return detail::mapairy_cdf_imp(dist, x, false); } // cdf -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const mapairy_distribution& dist, const RealType& p) { return detail::mapairy_quantile_imp(dist, p, false); } // quantile -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const complemented2_type, RealType>& c) { return detail::mapairy_cdf_imp(c.dist, c.param, true); } // cdf complement -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const complemented2_type, RealType>& c) { return detail::mapairy_quantile_imp(c.dist, c.param, true); } // quantile complement -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mean(const mapairy_distribution &dist) { return dist.location(); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType variance(const mapairy_distribution& /*dist*/) { return boost::math::numeric_limits::infinity(); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mode(const mapairy_distribution& dist) { return detail::mapairy_mode_imp(dist); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType median(const mapairy_distribution& dist) { return detail::mapairy_median_imp(dist); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType skewness(const mapairy_distribution& /*dist*/) { // There is no skewness: @@ -4182,7 +4182,7 @@ BOOST_MATH_GPU_ENABLED inline RealType skewness(const mapairy_distribution::quiet_NaN(), Policy()); // infinity? } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis(const mapairy_distribution& /*dist*/) { // There is no kurtosis: @@ -4196,7 +4196,7 @@ BOOST_MATH_GPU_ENABLED inline RealType kurtosis(const mapairy_distribution::quiet_NaN(), Policy()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis_excess(const mapairy_distribution& /*dist*/) { // There is no kurtosis excess: @@ -4210,7 +4210,7 @@ BOOST_MATH_GPU_ENABLED inline RealType kurtosis_excess(const mapairy_distributio boost::math::numeric_limits::quiet_NaN(), Policy()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType entropy(const mapairy_distribution& dist) { return detail::mapairy_entropy_imp(dist); diff --git a/include/boost/math/distributions/negative_binomial.hpp b/include/boost/math/distributions/negative_binomial.hpp index f520c94803..da99e53ce1 100644 --- a/include/boost/math/distributions/negative_binomial.hpp +++ b/include/boost/math/distributions/negative_binomial.hpp @@ -129,7 +129,7 @@ namespace boost } // check_dist_and_prob } // namespace negative_binomial_detail - template > + BOOST_MATH_EXPORT template > class negative_binomial_distribution { public: @@ -251,21 +251,21 @@ namespace boost RealType m_p; // success_fraction }; // template class negative_binomial_distribution - typedef negative_binomial_distribution negative_binomial; // Reserved name of type double. + BOOST_MATH_EXPORT typedef negative_binomial_distribution negative_binomial; // Reserved name of type double. #ifdef __cpp_deduction_guides - template + BOOST_MATH_EXPORT template negative_binomial_distribution(RealType,RealType)->negative_binomial_distribution::type>; #endif - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline const boost::math::pair range(const negative_binomial_distribution& /* dist */) { // Range of permissible values for random variable k. using boost::math::tools::max_value; return boost::math::pair(static_cast(0), max_value()); // max_integer? } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline const boost::math::pair support(const negative_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. @@ -273,7 +273,7 @@ namespace boost return boost::math::pair(static_cast(0), max_value()); // max_integer? } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mean(const negative_binomial_distribution& dist) { // Mean of Negative Binomial distribution = r(1-p)/p. return dist.successes() * (1 - dist.success_fraction() ) / dist.success_fraction(); @@ -286,14 +286,14 @@ namespace boost //} // median // Now implemented via quantile(half) in derived accessors. - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mode(const negative_binomial_distribution& dist) { // Mode of Negative Binomial distribution = floor[(r-1) * (1 - p)/p] BOOST_MATH_STD_USING // ADL of std functions. return floor((dist.successes() -1) * (1 - dist.success_fraction()) / dist.success_fraction()); } // mode - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType skewness(const negative_binomial_distribution& dist) { // skewness of Negative Binomial distribution = 2-p / (sqrt(r(1-p)) BOOST_MATH_STD_USING // ADL of std functions. @@ -304,7 +304,7 @@ namespace boost sqrt(r * (1 - p)); } // skewness - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis(const negative_binomial_distribution& dist) { // kurtosis of Negative Binomial distribution // http://en.wikipedia.org/wiki/Negative_binomial is kurtosis_excess so add 3 @@ -313,7 +313,7 @@ namespace boost return 3 + (6 / r) + ((p * p) / (r * (1 - p))); } // kurtosis - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis_excess(const negative_binomial_distribution& dist) { // kurtosis excess of Negative Binomial distribution // http://mathworld.wolfram.com/Kurtosis.html table of kurtosis_excess @@ -322,7 +322,7 @@ namespace boost return (6 - p * (6-p)) / (r * (1-p)); } // kurtosis_excess - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType variance(const negative_binomial_distribution& dist) { // Variance of Binomial distribution = r (1-p) / p^2. return dist.successes() * (1 - dist.success_fraction()) @@ -336,7 +336,7 @@ namespace boost // RealType chf(const negative_binomial_distribution& dist) // chf of Negative Binomial distribution provided by derived accessors. - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType pdf(const negative_binomial_distribution& dist, const RealType& k) { // Probability Density/Mass Function. BOOST_FPU_EXCEPTION_GUARD @@ -362,7 +362,7 @@ namespace boost return result; } // negative_binomial_pdf - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const negative_binomial_distribution& dist, const RealType& k) { // Cumulative Distribution Function of Negative Binomial. constexpr auto function = "boost::math::cdf(const negative_binomial_distribution<%1%>&, %1%)"; @@ -388,7 +388,7 @@ namespace boost return probability; } // cdf Cumulative Distribution Function Negative Binomial. - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const complemented2_type, RealType>& c) { // Complemented Cumulative Distribution Function Negative Binomial. @@ -422,7 +422,7 @@ namespace boost return probability; } // cdf Cumulative Distribution Function Negative Binomial. - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const negative_binomial_distribution& dist, const RealType& P) { // Quantile, percentile/100 or Percent Point Negative Binomial function. // Return the number of expected failures k for a given probability p. @@ -507,7 +507,7 @@ namespace boost max_iter); } // RealType quantile(const negative_binomial_distribution dist, p) - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const complemented2_type, RealType>& c) { // Quantile or Percent Point Binomial function. // Return the number of expected failures k for a given diff --git a/include/boost/math/distributions/non_central_beta.hpp b/include/boost/math/distributions/non_central_beta.hpp index ea0c5a168e..00938ab9e4 100644 --- a/include/boost/math/distributions/non_central_beta.hpp +++ b/include/boost/math/distributions/non_central_beta.hpp @@ -31,7 +31,7 @@ namespace boost namespace math { - template + BOOST_MATH_EXPORT template class non_central_beta_distribution; namespace detail{ @@ -716,7 +716,7 @@ namespace boost } // namespace detail - template > + BOOST_MATH_EXPORT template > class non_central_beta_distribution { public: @@ -759,23 +759,23 @@ namespace boost RealType ncp; // non-centrality parameter }; // template class non_central_beta_distribution - typedef non_central_beta_distribution non_central_beta; // Reserved name of type double. + BOOST_MATH_EXPORT typedef non_central_beta_distribution non_central_beta; // Reserved name of type double. #ifdef __cpp_deduction_guides - template + BOOST_MATH_EXPORT template non_central_beta_distribution(RealType,RealType,RealType)->non_central_beta_distribution::type>; #endif // Non-member functions to give properties of the distribution. - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline const boost::math::pair range(const non_central_beta_distribution& /* dist */) { // Range of permissible values for random variable k. using boost::math::tools::max_value; return boost::math::pair(static_cast(0), static_cast(1)); } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline const boost::math::pair support(const non_central_beta_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. @@ -783,7 +783,7 @@ namespace boost return boost::math::pair(static_cast(0), static_cast(1)); } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mode(const non_central_beta_distribution& dist) { // mode. constexpr auto function = "mode(non_central_beta_distribution<%1%> const&)"; @@ -820,7 +820,7 @@ namespace boost // prototypes retained so we can fill in the blanks // later: // - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mean(const non_central_beta_distribution& dist) { BOOST_MATH_STD_USING @@ -831,7 +831,7 @@ namespace boost return exp(-d / 2) * a * detail::hypergeometric_2F2(1 + a, apb, a, 1 + apb, d / 2, Policy()) / apb; } // mean - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType variance(const non_central_beta_distribution& dist) { // @@ -851,7 +851,7 @@ namespace boost // RealType standard_deviation(const non_central_beta_distribution& dist) // standard_deviation provided by derived accessors. - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType skewness(const non_central_beta_distribution& /*dist*/) { // skewness = sqrt(l). const char* function = "boost::math::non_central_beta_distribution<%1%>::skewness()"; @@ -862,7 +862,7 @@ namespace boost boost::math::numeric_limits::quiet_NaN(), Policy()); // infinity? LCOV_EXCL_LINE } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis_excess(const non_central_beta_distribution& /*dist*/) { const char* function = "boost::math::non_central_beta_distribution<%1%>::kurtosis_excess()"; @@ -873,19 +873,19 @@ namespace boost boost::math::numeric_limits::quiet_NaN(), Policy()); // infinity? LCOV_EXCL_LINE } // kurtosis_excess - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis(const non_central_beta_distribution& dist) { return kurtosis_excess(dist) + 3; } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType pdf(const non_central_beta_distribution& dist, const RealType& x) { // Probability Density/Mass Function. return detail::nc_beta_pdf(dist, x); } // pdf - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED RealType cdf(const non_central_beta_distribution& dist, const RealType& x) { const char* function = "boost::math::non_central_beta_distribution<%1%>::cdf(%1%)"; @@ -920,7 +920,7 @@ namespace boost return detail::non_central_beta_cdf(x, RealType(1 - x), a, b, l, false, Policy()); } // cdf - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED RealType cdf(const complemented2_type, RealType>& c) { // Complemented Cumulative Distribution Function const char* function = "boost::math::non_central_beta_distribution<%1%>::cdf(%1%)"; @@ -957,13 +957,13 @@ namespace boost return detail::non_central_beta_cdf(x, RealType(1 - x), a, b, l, true, Policy()); } // ccdf - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const non_central_beta_distribution& dist, const RealType& p) { // Quantile (or Percent Point) function. return detail::nc_beta_quantile(dist, p, false); } // quantile - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const complemented2_type, RealType>& c) { // Quantile (or Percent Point) function. return detail::nc_beta_quantile(c.dist, c.param, true); diff --git a/include/boost/math/distributions/non_central_chi_squared.hpp b/include/boost/math/distributions/non_central_chi_squared.hpp index 5917b3732d..3c20ae2bb0 100644 --- a/include/boost/math/distributions/non_central_chi_squared.hpp +++ b/include/boost/math/distributions/non_central_chi_squared.hpp @@ -32,7 +32,7 @@ namespace boost namespace math { - template + BOOST_MATH_EXPORT template class non_central_chi_squared_distribution; namespace detail{ @@ -659,7 +659,7 @@ namespace boost } - template > + BOOST_MATH_EXPORT template > class non_central_chi_squared_distribution { public: @@ -776,23 +776,23 @@ namespace boost RealType ncp; // non-centrality parameter }; // template class non_central_chi_squared_distribution - typedef non_central_chi_squared_distribution non_central_chi_squared; // Reserved name of type double. + BOOST_MATH_EXPORT typedef non_central_chi_squared_distribution non_central_chi_squared; // Reserved name of type double. #ifdef __cpp_deduction_guides - template + BOOST_MATH_EXPORT template non_central_chi_squared_distribution(RealType,RealType)->non_central_chi_squared_distribution::type>; #endif // Non-member functions to give properties of the distribution. - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline const boost::math::pair range(const non_central_chi_squared_distribution& /* dist */) { // Range of permissible values for random variable k. using boost::math::tools::max_value; return boost::math::pair(static_cast(0), max_value()); // Max integer? } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline const boost::math::pair support(const non_central_chi_squared_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. @@ -800,7 +800,7 @@ namespace boost return boost::math::pair(static_cast(0), max_value()); } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mean(const non_central_chi_squared_distribution& dist) { // Mean of poisson distribution = lambda. constexpr auto function = "boost::math::non_central_chi_squared_distribution<%1%>::mean()"; @@ -820,7 +820,7 @@ namespace boost return k + l; } // mean - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mode(const non_central_chi_squared_distribution& dist) { // mode. constexpr auto function = "mode(non_central_chi_squared_distribution<%1%> const&)"; @@ -843,7 +843,7 @@ namespace boost return detail::generic_find_mode(dist, starting_point, function); } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType variance(const non_central_chi_squared_distribution& dist) { // variance. constexpr auto function = "boost::math::non_central_chi_squared_distribution<%1%>::variance()"; @@ -866,7 +866,7 @@ namespace boost // RealType standard_deviation(const non_central_chi_squared_distribution& dist) // standard_deviation provided by derived accessors. - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType skewness(const non_central_chi_squared_distribution& dist) { // skewness = sqrt(l). constexpr auto function = "boost::math::non_central_chi_squared_distribution<%1%>::skewness()"; @@ -887,7 +887,7 @@ namespace boost return pow(2 / (k + 2 * l), RealType(3)/2) * (k + 3 * l); } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis_excess(const non_central_chi_squared_distribution& dist) { constexpr auto function = "boost::math::non_central_chi_squared_distribution<%1%>::kurtosis_excess()"; @@ -907,19 +907,19 @@ namespace boost return 12 * (k + 4 * l) / ((k + 2 * l) * (k + 2 * l)); } // kurtosis_excess - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis(const non_central_chi_squared_distribution& dist) { return kurtosis_excess(dist) + 3; } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType pdf(const non_central_chi_squared_distribution& dist, const RealType& x) { // Probability Density/Mass Function. return detail::nccs_pdf(dist, x); } // pdf - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED RealType cdf(const non_central_chi_squared_distribution& dist, const RealType& x) { constexpr auto function = "boost::math::non_central_chi_squared_distribution<%1%>::cdf(%1%)"; @@ -946,7 +946,7 @@ namespace boost return detail::non_central_chi_squared_cdf(x, k, l, false, Policy()); } // cdf - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED RealType cdf(const complemented2_type, RealType>& c) { // Complemented Cumulative Distribution Function constexpr auto function = "boost::math::non_central_chi_squared_distribution<%1%>::cdf(%1%)"; @@ -975,13 +975,13 @@ namespace boost return detail::non_central_chi_squared_cdf(x, k, l, true, Policy()); } // ccdf - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const non_central_chi_squared_distribution& dist, const RealType& p) { // Quantile (or Percent Point) function. return detail::nccs_quantile(dist, p, false); } // quantile - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const complemented2_type, RealType>& c) { // Quantile (or Percent Point) function. return detail::nccs_quantile(c.dist, c.param, true); diff --git a/include/boost/math/distributions/non_central_f.hpp b/include/boost/math/distributions/non_central_f.hpp index 9bae5c41ff..3131e6c4a3 100644 --- a/include/boost/math/distributions/non_central_f.hpp +++ b/include/boost/math/distributions/non_central_f.hpp @@ -181,7 +181,7 @@ namespace boost } } // namespace detail - template > + BOOST_MATH_EXPORT template > class non_central_f_distribution { public: @@ -359,23 +359,23 @@ namespace boost RealType ncp; // non-centrality parameter }; // template class non_central_f_distribution - typedef non_central_f_distribution non_central_f; // Reserved name of type double. + BOOST_MATH_EXPORT typedef non_central_f_distribution non_central_f; // Reserved name of type double. #ifdef __cpp_deduction_guides - template + BOOST_MATH_EXPORT template non_central_f_distribution(RealType,RealType,RealType)->non_central_f_distribution::type>; #endif // Non-member functions to give properties of the distribution. - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline const boost::math::pair range(const non_central_f_distribution& /* dist */) { // Range of permissible values for random variable k. using boost::math::tools::max_value; return boost::math::pair(static_cast(0), max_value()); } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline const boost::math::pair support(const non_central_f_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. @@ -383,7 +383,7 @@ namespace boost return boost::math::pair(static_cast(0), max_value()); } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mean(const non_central_f_distribution& dist) { constexpr auto function = "mean(non_central_f_distribution<%1%> const&)"; @@ -413,7 +413,7 @@ namespace boost return v2 * (v1 + l) / (v1 * (v2 - 2)); } // mean - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mode(const non_central_f_distribution& dist) { // mode. constexpr auto function = "mode(non_central_chi_squared_distribution<%1%> const&)"; @@ -443,7 +443,7 @@ namespace boost function); } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType variance(const non_central_f_distribution& dist) { // variance. constexpr auto function = "variance(non_central_f_distribution<%1%> const&)"; @@ -479,7 +479,7 @@ namespace boost // RealType standard_deviation(const non_central_f_distribution& dist) // standard_deviation provided by derived accessors. - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType skewness(const non_central_f_distribution& dist) { // skewness = sqrt(l). constexpr auto function = "skewness(non_central_f_distribution<%1%> const&)"; @@ -516,7 +516,7 @@ namespace boost return result; } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis_excess(const non_central_f_distribution& dist) { constexpr auto function = "kurtosis_excess(non_central_f_distribution<%1%> const&)"; @@ -563,13 +563,13 @@ namespace boost return result; } // kurtosis_excess - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis(const non_central_f_distribution& dist) { return kurtosis_excess(dist) + 3; } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType pdf(const non_central_f_distribution& dist, const RealType& x) { // Probability Density/Mass Function. typedef typename policies::evaluation::type value_type; @@ -589,7 +589,7 @@ namespace boost "pdf(non_central_f_distribution<%1%>, %1%)"); } // pdf - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED RealType cdf(const non_central_f_distribution& dist, const RealType& x) { constexpr auto function = "cdf(const non_central_f_distribution<%1%>&, %1%)"; @@ -630,7 +630,7 @@ namespace boost return r; } // cdf - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED RealType cdf(const complemented2_type, RealType>& c) { // Complemented Cumulative Distribution Function constexpr auto function = "cdf(complement(const non_central_f_distribution<%1%>&, %1%))"; @@ -671,7 +671,7 @@ namespace boost return r; } // ccdf - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const non_central_f_distribution& dist, const RealType& p) { // Quantile (or Percent Point) function. RealType alpha = dist.degrees_of_freedom1() / 2; @@ -685,7 +685,7 @@ namespace boost return (x / (1 - x)) * (dist.degrees_of_freedom2() / dist.degrees_of_freedom1()); } // quantile - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const complemented2_type, RealType>& c) { // Quantile (or Percent Point) function. RealType alpha = c.dist.degrees_of_freedom1() / 2; diff --git a/include/boost/math/distributions/non_central_t.hpp b/include/boost/math/distributions/non_central_t.hpp index 9bc1cf8ccc..72d1d1678d 100644 --- a/include/boost/math/distributions/non_central_t.hpp +++ b/include/boost/math/distributions/non_central_t.hpp @@ -24,7 +24,7 @@ namespace boost namespace math { - template + BOOST_MATH_EXPORT template class non_central_t_distribution; namespace detail{ @@ -835,7 +835,7 @@ namespace boost } } // namespace detail ====================================================================== - template > + BOOST_MATH_EXPORT template > class non_central_t_distribution { public: @@ -953,23 +953,23 @@ namespace boost RealType ncp; // non-centrality parameter }; // template class non_central_t_distribution - typedef non_central_t_distribution non_central_t; // Reserved name of type double. + BOOST_MATH_EXPORT typedef non_central_t_distribution non_central_t; // Reserved name of type double. #ifdef __cpp_deduction_guides - template + BOOST_MATH_EXPORT template non_central_t_distribution(RealType,RealType)->non_central_t_distribution::type>; #endif // Non-member functions to give properties of the distribution. - template + BOOST_MATH_EXPORT template inline const std::pair range(const non_central_t_distribution& /* dist */) { // Range of permissible values for random variable k. using boost::math::tools::max_value; return std::pair(-max_value(), max_value()); } - template + BOOST_MATH_EXPORT template inline const std::pair support(const non_central_t_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. @@ -977,7 +977,7 @@ namespace boost return std::pair(-max_value(), max_value()); } - template + BOOST_MATH_EXPORT template inline RealType mode(const non_central_t_distribution& dist) { // mode. static const char* function = "mode(non_central_t_distribution<%1%> const&)"; @@ -1007,7 +1007,7 @@ namespace boost sqrt(var)); } - template + BOOST_MATH_EXPORT template inline RealType mean(const non_central_t_distribution& dist) { BOOST_MATH_STD_USING @@ -1042,7 +1042,7 @@ namespace boost } // mean - template + BOOST_MATH_EXPORT template inline RealType variance(const non_central_t_distribution& dist) { // variance. const char* function = "variance(const non_central_t_distribution<%1%>&)"; @@ -1078,7 +1078,7 @@ namespace boost // RealType standard_deviation(const non_central_t_distribution& dist) // standard_deviation provided by derived accessors. - template + BOOST_MATH_EXPORT template inline RealType skewness(const non_central_t_distribution& dist) { // skewness = sqrt(l). const char* function = "skewness(const non_central_t_distribution<%1%>&)"; @@ -1110,7 +1110,7 @@ namespace boost detail::skewness(static_cast(v), static_cast(l), forwarding_policy()), function); } - template + BOOST_MATH_EXPORT template inline RealType kurtosis_excess(const non_central_t_distribution& dist) { const char* function = "kurtosis_excess(const non_central_t_distribution<%1%>&)"; @@ -1142,13 +1142,13 @@ namespace boost detail::kurtosis_excess(static_cast(v), static_cast(l), forwarding_policy()), function); } // kurtosis_excess - template + BOOST_MATH_EXPORT template inline RealType kurtosis(const non_central_t_distribution& dist) { return kurtosis_excess(dist) + 3; } - template + BOOST_MATH_EXPORT template inline RealType pdf(const non_central_t_distribution& dist, const RealType& t) { // Probability Density/Mass Function. const char* function = "pdf(non_central_t_distribution<%1%>, %1%)"; @@ -1187,7 +1187,7 @@ namespace boost function); } // pdf - template + BOOST_MATH_EXPORT template RealType cdf(const non_central_t_distribution& dist, const RealType& x) { const char* function = "boost::math::cdf(non_central_t_distribution<%1%>&, %1%)"; @@ -1239,7 +1239,7 @@ namespace boost function); } // cdf - template + BOOST_MATH_EXPORT template RealType cdf(const complemented2_type, RealType>& c) { // Complemented Cumulative Distribution Function // was const char* function = "boost::math::non_central_t_distribution<%1%>::cdf(%1%)"; @@ -1292,7 +1292,7 @@ namespace boost function); } // ccdf - template + BOOST_MATH_EXPORT template inline RealType quantile(const non_central_t_distribution& dist, const RealType& p) { // Quantile (or Percent Point) function. static const char* function = "quantile(const non_central_t_distribution<%1%>, %1%)"; @@ -1301,7 +1301,7 @@ namespace boost return detail::non_central_t_quantile(function, v, l, p, RealType(1-p), Policy()); } // quantile - template + BOOST_MATH_EXPORT template inline RealType quantile(const complemented2_type, RealType>& c) { // Quantile (or Percent Point) function. static const char* function = "quantile(const complement(non_central_t_distribution<%1%>, %1%))"; diff --git a/include/boost/math/distributions/normal.hpp b/include/boost/math/distributions/normal.hpp index aa27c8feb1..61a409ce23 100644 --- a/include/boost/math/distributions/normal.hpp +++ b/include/boost/math/distributions/normal.hpp @@ -28,7 +28,7 @@ namespace boost{ namespace math{ -template > +BOOST_MATH_EXPORT template > class normal_distribution { public: @@ -73,7 +73,7 @@ class normal_distribution RealType m_sd; // distribution standard deviation or scale. }; // class normal_distribution -using normal = normal_distribution; +BOOST_MATH_EXPORT using normal = normal_distribution; // // Deduction guides, note we don't check the @@ -82,9 +82,9 @@ using normal = normal_distribution; // #ifdef __cpp_deduction_guides -template +BOOST_MATH_EXPORT template normal_distribution(RealType, RealType)->normal_distribution::type>; -template +BOOST_MATH_EXPORT template normal_distribution(RealType)->normal_distribution::type>; #endif @@ -94,7 +94,7 @@ normal_distribution(RealType)->normal_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline boost::math::pair range(const normal_distribution& /*dist*/) { // Range of permissible values for random variable x. BOOST_MATH_IF_CONSTEXPR (boost::math::numeric_limits::has_infinity) @@ -108,7 +108,7 @@ BOOST_MATH_GPU_ENABLED inline boost::math::pair range(const } } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline boost::math::pair support(const normal_distribution& /*dist*/) { // This is range values for random variable x where cdf rises from 0 to 1, and outside it, the pdf is zero. BOOST_MATH_IF_CONSTEXPR (boost::math::numeric_limits::has_infinity) @@ -126,7 +126,7 @@ BOOST_MATH_GPU_ENABLED inline boost::math::pair support(cons #pragma warning(pop) #endif -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType pdf(const normal_distribution& dist, const RealType& x) { BOOST_MATH_STD_USING // for ADL of std functions @@ -164,7 +164,7 @@ BOOST_MATH_GPU_ENABLED inline RealType pdf(const normal_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType logpdf(const normal_distribution& dist, const RealType& x) { BOOST_MATH_STD_USING // for ADL of std functions @@ -200,7 +200,7 @@ BOOST_MATH_GPU_ENABLED inline RealType logpdf(const normal_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const normal_distribution& dist, const RealType& x) { BOOST_MATH_STD_USING // for ADL of std functions @@ -231,7 +231,7 @@ BOOST_MATH_GPU_ENABLED inline RealType cdf(const normal_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const normal_distribution& dist, const RealType& p) { BOOST_MATH_STD_USING // for ADL of std functions @@ -255,7 +255,7 @@ BOOST_MATH_GPU_ENABLED inline RealType quantile(const normal_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const complemented2_type, RealType>& c) { BOOST_MATH_STD_USING // for ADL of std functions @@ -283,7 +283,7 @@ BOOST_MATH_GPU_ENABLED inline RealType cdf(const complemented2_type +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const complemented2_type, RealType>& c) { BOOST_MATH_STD_USING // for ADL of std functions @@ -305,49 +305,49 @@ BOOST_MATH_GPU_ENABLED inline RealType quantile(const complemented2_type +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mean(const normal_distribution& dist) { return dist.mean(); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType standard_deviation(const normal_distribution& dist) { return dist.standard_deviation(); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mode(const normal_distribution& dist) { return dist.mean(); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType median(const normal_distribution& dist) { return dist.mean(); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType skewness(const normal_distribution& /*dist*/) { return 0; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis(const normal_distribution& /*dist*/) { return 3; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis_excess(const normal_distribution& /*dist*/) { return 0; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType entropy(const normal_distribution & dist) { BOOST_MATH_STD_USING diff --git a/include/boost/math/distributions/pareto.hpp b/include/boost/math/distributions/pareto.hpp index 97cf8024a0..82326e4d6e 100644 --- a/include/boost/math/distributions/pareto.hpp +++ b/include/boost/math/distributions/pareto.hpp @@ -132,7 +132,7 @@ namespace boost } // namespace detail - template > + BOOST_MATH_EXPORT template > class pareto_distribution { public: @@ -161,24 +161,24 @@ namespace boost RealType m_shape; // distribution shape (k) or alpha }; - typedef pareto_distribution pareto; // Convenience to allow pareto(2., 3.); + BOOST_MATH_EXPORT typedef pareto_distribution pareto; // Convenience to allow pareto(2., 3.); #ifdef __cpp_deduction_guides - template + BOOST_MATH_EXPORT template pareto_distribution(RealType)->pareto_distribution::type>; - template + BOOST_MATH_EXPORT template pareto_distribution(RealType,RealType)->pareto_distribution::type>; #endif - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline const boost::math::pair range(const pareto_distribution& /*dist*/) { // Range of permissible values for random variable x. using boost::math::tools::max_value; return boost::math::pair(static_cast(0), max_value()); // scale zero to + infinity. } // range - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline const boost::math::pair support(const pareto_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. @@ -186,7 +186,7 @@ namespace boost return boost::math::pair(dist.scale(), max_value() ); // scale to + infinity. } // support - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType pdf(const pareto_distribution& dist, const RealType& x) { BOOST_MATH_STD_USING // for ADL of std function pow. @@ -205,7 +205,7 @@ namespace boost return result; } // pdf - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const pareto_distribution& dist, const RealType& x) { BOOST_MATH_STD_USING // for ADL of std function pow. @@ -228,7 +228,7 @@ namespace boost return result; } // cdf - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType logcdf(const pareto_distribution& dist, const RealType& x) { BOOST_MATH_STD_USING // for ADL of std function pow. @@ -250,7 +250,7 @@ namespace boost return result; } // logcdf - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const pareto_distribution& dist, const RealType& p) { BOOST_MATH_STD_USING // for ADL of std function pow. @@ -277,7 +277,7 @@ namespace boost return result; } // quantile - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const complemented2_type, RealType>& c) { BOOST_MATH_STD_USING // for ADL of std function pow. @@ -299,7 +299,7 @@ namespace boost return result; } // cdf complement - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType logcdf(const complemented2_type, RealType>& c) { BOOST_MATH_STD_USING // for ADL of std function pow. @@ -321,7 +321,7 @@ namespace boost return result; } // logcdf complement - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const complemented2_type, RealType>& c) { BOOST_MATH_STD_USING // for ADL of std function pow. @@ -348,7 +348,7 @@ namespace boost return result; } // quantile complement - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mean(const pareto_distribution& dist) { RealType result = 0; @@ -368,13 +368,13 @@ namespace boost } } // mean - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mode(const pareto_distribution& dist) { return dist.scale(); } // mode - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType median(const pareto_distribution& dist) { RealType result = 0; @@ -387,7 +387,7 @@ namespace boost return dist.scale() * pow(RealType(2), (1/dist.shape())); } // median - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType variance(const pareto_distribution& dist) { RealType result = 0; @@ -412,7 +412,7 @@ namespace boost return result; } // variance - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType skewness(const pareto_distribution& dist) { BOOST_MATH_STD_USING @@ -438,7 +438,7 @@ namespace boost return result; } // skewness - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis(const pareto_distribution& dist) { RealType result = 0; @@ -462,7 +462,7 @@ namespace boost return result; } // kurtosis - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis_excess(const pareto_distribution& dist) { RealType result = 0; @@ -486,7 +486,7 @@ namespace boost return result; } // kurtosis_excess - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType entropy(const pareto_distribution& dist) { BOOST_MATH_STD_USING diff --git a/include/boost/math/distributions/poisson.hpp b/include/boost/math/distributions/poisson.hpp index c2fad66be0..c5e4404335 100644 --- a/include/boost/math/distributions/poisson.hpp +++ b/include/boost/math/distributions/poisson.hpp @@ -143,7 +143,7 @@ namespace boost } // namespace poisson_detail - template > + BOOST_MATH_EXPORT template > class poisson_distribution { public: @@ -168,23 +168,23 @@ namespace boost RealType m_l; // mean number of occurrences. }; // template class poisson_distribution - using poisson = poisson_distribution; // Reserved name of type double. + BOOST_MATH_EXPORT using poisson = poisson_distribution; // Reserved name of type double. #ifdef __cpp_deduction_guides - template + BOOST_MATH_EXPORT template poisson_distribution(RealType)->poisson_distribution::type>; #endif // Non-member functions to give properties of the distribution. - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline boost::math::pair range(const poisson_distribution& /* dist */) { // Range of permissible values for random variable k. using boost::math::tools::max_value; return boost::math::pair(static_cast(0), max_value()); // Max integer? } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline boost::math::pair support(const poisson_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. @@ -192,13 +192,13 @@ namespace boost return boost::math::pair(static_cast(0), max_value()); } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mean(const poisson_distribution& dist) { // Mean of poisson distribution = lambda. return dist.mean(); } // mean - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mode(const poisson_distribution& dist) { // mode. BOOST_MATH_STD_USING // ADL of std functions. @@ -207,7 +207,7 @@ namespace boost // Median now implemented via quantile(half) in derived accessors. - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType variance(const poisson_distribution& dist) { // variance. return dist.mean(); @@ -215,14 +215,14 @@ namespace boost // standard_deviation provided by derived accessors. - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType skewness(const poisson_distribution& dist) { // skewness = sqrt(l). BOOST_MATH_STD_USING // ADL of std functions. return 1 / sqrt(dist.mean()); } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis_excess(const poisson_distribution& dist) { // skewness = sqrt(l). return 1 / dist.mean(); // kurtosis_excess 1/mean from Wiki & MathWorld eq 31. @@ -231,7 +231,7 @@ namespace boost // whereas the true kurtosis is 3. } // RealType kurtosis_excess - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis(const poisson_distribution& dist) { // kurtosis is 4th moment about the mean = u4 / sd ^ 4 // http://en.wikipedia.org/wiki/Kurtosis @@ -243,7 +243,7 @@ namespace boost // whereas the true kurtosis is 3. } // RealType kurtosis - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED RealType pdf(const poisson_distribution& dist, const RealType& k) { // Probability Density/Mass Function. // Probability that there are EXACTLY k occurrences (or arrivals). @@ -275,7 +275,7 @@ namespace boost return boost::math::gamma_p_derivative(k+1, mean, Policy()); } // pdf - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED RealType logpdf(const poisson_distribution& dist, const RealType& k) { BOOST_FPU_EXCEPTION_GUARD @@ -311,7 +311,7 @@ namespace boost return result; } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED RealType cdf(const poisson_distribution& dist, const RealType& k) { // Cumulative Distribution Function Poisson. // The random variate k is the number of occurrences(or arrivals) @@ -362,7 +362,7 @@ namespace boost return gamma_q(k+1, mean, Policy()); } // binomial cdf - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED RealType cdf(const complemented2_type, RealType>& c) { // Complemented Cumulative Distribution Function Poisson // The random variate k is the number of events, occurrences or arrivals. @@ -412,7 +412,7 @@ namespace boost // CCDF = gamma_p(k+1, lambda) } // poisson ccdf - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const poisson_distribution& dist, const RealType& p) { // Quantile (or Percent Point) Poisson function. // Return the number of expected events k for a given probability p. @@ -478,7 +478,7 @@ namespace boost max_iter); } // quantile - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const complemented2_type, RealType>& c) { // Quantile (or Percent Point) of Poisson function. // Return the number of expected events k for a given diff --git a/include/boost/math/distributions/rayleigh.hpp b/include/boost/math/distributions/rayleigh.hpp index 155525b539..15218cda46 100644 --- a/include/boost/math/distributions/rayleigh.hpp +++ b/include/boost/math/distributions/rayleigh.hpp @@ -54,7 +54,7 @@ namespace detail } // bool verify_rayleigh_x } // namespace detail -template > +BOOST_MATH_EXPORT template > class rayleigh_distribution { public: @@ -77,21 +77,21 @@ class rayleigh_distribution RealType m_sigma; }; // class rayleigh_distribution -using rayleigh = rayleigh_distribution; +BOOST_MATH_EXPORT using rayleigh = rayleigh_distribution; #ifdef __cpp_deduction_guides -template +BOOST_MATH_EXPORT template rayleigh_distribution(RealType)->rayleigh_distribution::type>; #endif -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline boost::math::pair range(const rayleigh_distribution& /*dist*/) { // Range of permissible values for random variable x. using boost::math::tools::max_value; return boost::math::pair(static_cast(0), boost::math::numeric_limits::has_infinity ? boost::math::numeric_limits::infinity() : max_value()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline boost::math::pair support(const rayleigh_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. @@ -99,7 +99,7 @@ BOOST_MATH_GPU_ENABLED inline boost::math::pair support(cons return boost::math::pair(static_cast(0), max_value()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType pdf(const rayleigh_distribution& dist, const RealType& x) { BOOST_MATH_STD_USING // for ADL of std function exp. @@ -124,7 +124,7 @@ BOOST_MATH_GPU_ENABLED inline RealType pdf(const rayleigh_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType logpdf(const rayleigh_distribution& dist, const RealType& x) { BOOST_MATH_STD_USING // for ADL of std function exp. @@ -150,7 +150,7 @@ BOOST_MATH_GPU_ENABLED inline RealType logpdf(const rayleigh_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const rayleigh_distribution& dist, const RealType& x) { BOOST_MATH_STD_USING // for ADL of std functions @@ -170,7 +170,7 @@ BOOST_MATH_GPU_ENABLED inline RealType cdf(const rayleigh_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType logcdf(const rayleigh_distribution& dist, const RealType& x) { BOOST_MATH_STD_USING // for ADL of std functions @@ -190,7 +190,7 @@ BOOST_MATH_GPU_ENABLED inline RealType logcdf(const rayleigh_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const rayleigh_distribution& dist, const RealType& p) { BOOST_MATH_STD_USING // for ADL of std functions @@ -215,7 +215,7 @@ BOOST_MATH_GPU_ENABLED inline RealType quantile(const rayleigh_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const complemented2_type, RealType>& c) { BOOST_MATH_STD_USING // for ADL of std functions @@ -240,7 +240,7 @@ BOOST_MATH_GPU_ENABLED inline RealType cdf(const complemented2_type +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType logcdf(const complemented2_type, RealType>& c) { BOOST_MATH_STD_USING // for ADL of std functions @@ -265,7 +265,7 @@ BOOST_MATH_GPU_ENABLED inline RealType logcdf(const complemented2_type +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const complemented2_type, RealType>& c) { BOOST_MATH_STD_USING // for ADL of std functions, log & sqrt. @@ -294,7 +294,7 @@ BOOST_MATH_GPU_ENABLED inline RealType quantile(const complemented2_type +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mean(const rayleigh_distribution& dist) { RealType result = 0; @@ -308,7 +308,7 @@ BOOST_MATH_GPU_ENABLED inline RealType mean(const rayleigh_distribution(); } // mean -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType variance(const rayleigh_distribution& dist) { RealType result = 0; @@ -322,20 +322,20 @@ BOOST_MATH_GPU_ENABLED inline RealType variance(const rayleigh_distribution() * sigma * sigma / 2; } // variance -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mode(const rayleigh_distribution& dist) { return dist.sigma(); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType median(const rayleigh_distribution& dist) { using boost::math::constants::root_ln_four; return root_ln_four() * dist.sigma(); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType skewness(const rayleigh_distribution& /*dist*/) { return static_cast(0.63111065781893713819189935154422777984404221106391L); @@ -343,7 +343,7 @@ BOOST_MATH_GPU_ENABLED inline RealType skewness(const rayleigh_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis(const rayleigh_distribution& /*dist*/) { return static_cast(3.2450893006876380628486604106197544154170667057995L); @@ -351,7 +351,7 @@ BOOST_MATH_GPU_ENABLED inline RealType kurtosis(const rayleigh_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis_excess(const rayleigh_distribution& /*dist*/) { return static_cast(0.2450893006876380628486604106197544154170667057995L); @@ -359,7 +359,7 @@ BOOST_MATH_GPU_ENABLED inline RealType kurtosis_excess(const rayleigh_distributi // -(6*pi*pi - 24*pi + 16) / pow(4-pi,2) } // kurtosis_excess -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType entropy(const rayleigh_distribution& dist) { BOOST_MATH_STD_USING diff --git a/include/boost/math/distributions/saspoint5.hpp b/include/boost/math/distributions/saspoint5.hpp index 16319ee40e..d3c7cee1df 100644 --- a/include/boost/math/distributions/saspoint5.hpp +++ b/include/boost/math/distributions/saspoint5.hpp @@ -34,7 +34,7 @@ #endif namespace boost { namespace math { -template +BOOST_MATH_EXPORT template class saspoint5_distribution; namespace detail { @@ -2606,7 +2606,7 @@ BOOST_MATH_GPU_ENABLED inline RealType saspoint5_entropy_imp(const saspoint5_dis } // detail -template > +BOOST_MATH_EXPORT template > class saspoint5_distribution { public: @@ -2636,16 +2636,16 @@ class saspoint5_distribution RealType c; // The scale parameter. }; -typedef saspoint5_distribution saspoint5; +BOOST_MATH_EXPORT typedef saspoint5_distribution saspoint5; #ifdef __cpp_deduction_guides -template +BOOST_MATH_EXPORT template saspoint5_distribution(RealType) -> saspoint5_distribution::type>; -template +BOOST_MATH_EXPORT template saspoint5_distribution(RealType, RealType) -> saspoint5_distribution::type>; #endif -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline const boost::math::pair range(const saspoint5_distribution&) { // Range of permissible values for random variable x. BOOST_MATH_IF_CONSTEXPR (boost::math::numeric_limits::has_infinity) @@ -2659,7 +2659,7 @@ BOOST_MATH_GPU_ENABLED inline const boost::math::pair range( } } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline const boost::math::pair support(const saspoint5_distribution&) { // 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. @@ -2674,37 +2674,37 @@ BOOST_MATH_GPU_ENABLED inline const boost::math::pair suppor } } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType pdf(const saspoint5_distribution& dist, const RealType& x) { return detail::saspoint5_pdf_imp(dist, x); } // pdf -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const saspoint5_distribution& dist, const RealType& x) { return detail::saspoint5_cdf_imp(dist, x, false); } // cdf -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const saspoint5_distribution& dist, const RealType& p) { return detail::saspoint5_quantile_imp(dist, p, false); } // quantile -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const complemented2_type, RealType>& c) { return detail::saspoint5_cdf_imp(c.dist, c.param, true); } // cdf complement -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const complemented2_type, RealType>& c) { return detail::saspoint5_quantile_imp(c.dist, c.param, true); } // quantile complement -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mean(const saspoint5_distribution &dist) { // There is no mean: @@ -2718,7 +2718,7 @@ BOOST_MATH_GPU_ENABLED inline RealType mean(const saspoint5_distribution::quiet_NaN(), Policy()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType variance(const saspoint5_distribution& /*dist*/) { // There is no variance: @@ -2732,19 +2732,19 @@ BOOST_MATH_GPU_ENABLED inline RealType variance(const saspoint5_distribution::quiet_NaN(), Policy()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mode(const saspoint5_distribution& dist) { return dist.location(); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType median(const saspoint5_distribution& dist) { return dist.location(); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType skewness(const saspoint5_distribution& /*dist*/) { // There is no skewness: @@ -2758,7 +2758,7 @@ BOOST_MATH_GPU_ENABLED inline RealType skewness(const saspoint5_distribution::quiet_NaN(), Policy()); // infinity? } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis(const saspoint5_distribution& /*dist*/) { // There is no kurtosis: @@ -2772,7 +2772,7 @@ BOOST_MATH_GPU_ENABLED inline RealType kurtosis(const saspoint5_distribution::quiet_NaN(), Policy()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis_excess(const saspoint5_distribution& /*dist*/) { // There is no kurtosis excess: @@ -2786,7 +2786,7 @@ BOOST_MATH_GPU_ENABLED inline RealType kurtosis_excess(const saspoint5_distribut boost::math::numeric_limits::quiet_NaN(), Policy()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType entropy(const saspoint5_distribution& dist) { return detail::saspoint5_entropy_imp(dist); diff --git a/include/boost/math/distributions/skew_normal.hpp b/include/boost/math/distributions/skew_normal.hpp index 77f2a988cd..c4e429ed2f 100644 --- a/include/boost/math/distributions/skew_normal.hpp +++ b/include/boost/math/distributions/skew_normal.hpp @@ -57,7 +57,7 @@ namespace boost{ namespace math{ } // namespace detail - template > + BOOST_MATH_EXPORT template > class skew_normal_distribution { public: @@ -100,18 +100,18 @@ namespace boost{ namespace math{ RealType shape_; // distribution shape. }; // class skew_normal_distribution - typedef skew_normal_distribution skew_normal; + BOOST_MATH_EXPORT typedef skew_normal_distribution skew_normal; #ifdef __cpp_deduction_guides - template + BOOST_MATH_EXPORT template skew_normal_distribution(RealType)->skew_normal_distribution::type>; - template + BOOST_MATH_EXPORT template skew_normal_distribution(RealType,RealType)->skew_normal_distribution::type>; - template + BOOST_MATH_EXPORT template skew_normal_distribution(RealType,RealType,RealType)->skew_normal_distribution::type>; #endif - template + BOOST_MATH_EXPORT template inline const std::pair range(const skew_normal_distribution& /*dist*/) { // Range of permissible values for random variable x. using boost::math::tools::max_value; @@ -120,7 +120,7 @@ namespace boost{ namespace math{ std::numeric_limits::has_infinity ? std::numeric_limits::infinity() : max_value()); // - to + max value. } - template + BOOST_MATH_EXPORT template inline const std::pair support(const skew_normal_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. @@ -129,7 +129,7 @@ namespace boost{ namespace math{ return std::pair(-max_value(), max_value()); // - to + max value. } - template + BOOST_MATH_EXPORT template inline RealType pdf(const skew_normal_distribution& dist, const RealType& x) { const RealType scale = dist.scale(); @@ -174,7 +174,7 @@ namespace boost{ namespace math{ return result; } // pdf - template + BOOST_MATH_EXPORT template inline RealType cdf(const skew_normal_distribution& dist, const RealType& x) { const RealType scale = dist.scale(); @@ -223,7 +223,7 @@ namespace boost{ namespace math{ return result; } // cdf - template + BOOST_MATH_EXPORT template inline RealType cdf(const complemented2_type, RealType>& c) { const RealType scale = c.dist.scale(); @@ -283,7 +283,7 @@ namespace boost{ namespace math{ return dist.shape(); } - template + BOOST_MATH_EXPORT template inline RealType mean(const skew_normal_distribution& dist) { BOOST_MATH_STD_USING // for ADL of std functions @@ -297,7 +297,7 @@ namespace boost{ namespace math{ return dist.location() + dist.scale() * dist.shape() / sqrt(pi()+pi()*dist.shape()*dist.shape()) * root_two(); } - template + BOOST_MATH_EXPORT template inline RealType variance(const skew_normal_distribution& dist) { using namespace boost::math::constants; @@ -460,7 +460,7 @@ namespace boost{ namespace math{ } // namespace detail - template + BOOST_MATH_EXPORT template inline RealType mode(const skew_normal_distribution& dist) { const RealType scale = dist.scale(); @@ -586,7 +586,7 @@ namespace boost{ namespace math{ - template + BOOST_MATH_EXPORT template inline RealType skewness(const skew_normal_distribution& dist) { BOOST_MATH_STD_USING // for ADL of std functions @@ -599,13 +599,13 @@ namespace boost{ namespace math{ pow(static_cast(1)-two_div_pi()*delta*delta, static_cast(1.5))); } - template + BOOST_MATH_EXPORT template inline RealType kurtosis(const skew_normal_distribution& dist) { return kurtosis_excess(dist)+static_cast(3); } - template + BOOST_MATH_EXPORT template inline RealType kurtosis_excess(const skew_normal_distribution& dist) { using namespace boost::math::constants; @@ -620,7 +620,7 @@ namespace boost{ namespace math{ return factor * y*y / (x*x); } - template + BOOST_MATH_EXPORT template inline RealType quantile(const skew_normal_distribution& dist, const RealType& p) { const RealType scale = dist.scale(); @@ -722,7 +722,7 @@ namespace boost{ namespace math{ return result; } // quantile - template + BOOST_MATH_EXPORT template inline RealType quantile(const complemented2_type, RealType>& c) { const RealType scale = c.dist.scale(); diff --git a/include/boost/math/distributions/students_t.hpp b/include/boost/math/distributions/students_t.hpp index 859118768e..2d5ffaf8a7 100644 --- a/include/boost/math/distributions/students_t.hpp +++ b/include/boost/math/distributions/students_t.hpp @@ -33,7 +33,7 @@ namespace boost { namespace math { -template > +BOOST_MATH_EXPORT template > class students_t_distribution { public: @@ -69,14 +69,14 @@ class students_t_distribution RealType df_; // degrees of freedom is a real number > 0 or +infinity. }; -typedef students_t_distribution students_t; // Convenience typedef for double version. +BOOST_MATH_EXPORT typedef students_t_distribution students_t; // Convenience typedef for double version. #ifdef __cpp_deduction_guides -template +BOOST_MATH_EXPORT template students_t_distribution(RealType)->students_t_distribution::type>; #endif -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline const boost::math::pair range(const students_t_distribution& /*dist*/) { // Range of permissible values for random variable x. // Now including infinity. @@ -85,7 +85,7 @@ BOOST_MATH_GPU_ENABLED inline const boost::math::pair range( return boost::math::pair(((::boost::math::numeric_limits::is_specialized & ::boost::math::numeric_limits::has_infinity) ? -boost::math::numeric_limits::infinity() : -max_value()), ((::boost::math::numeric_limits::is_specialized & ::boost::math::numeric_limits::has_infinity) ? +boost::math::numeric_limits::infinity() : +max_value())); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline const boost::math::pair support(const students_t_distribution& /*dist*/) { // Range of supported values for random variable x. // Now including infinity. @@ -95,7 +95,7 @@ BOOST_MATH_GPU_ENABLED inline const boost::math::pair suppor return boost::math::pair(((::boost::math::numeric_limits::is_specialized & ::boost::math::numeric_limits::has_infinity) ? -boost::math::numeric_limits::infinity() : -max_value()), ((::boost::math::numeric_limits::is_specialized & ::boost::math::numeric_limits::has_infinity) ? +boost::math::numeric_limits::infinity() : +max_value())); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType pdf(const students_t_distribution& dist, const RealType& x) { BOOST_FPU_EXCEPTION_GUARD @@ -148,7 +148,7 @@ BOOST_MATH_GPU_ENABLED inline RealType pdf(const students_t_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const students_t_distribution& dist, const RealType& x) { BOOST_MATH_STD_USING // for ADL of std functions @@ -229,7 +229,7 @@ BOOST_MATH_GPU_ENABLED inline RealType cdf(const students_t_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const students_t_distribution& dist, const RealType& p) { BOOST_MATH_STD_USING // for ADL of std functions @@ -283,13 +283,13 @@ BOOST_MATH_GPU_ENABLED inline RealType quantile(const students_t_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const complemented2_type, RealType>& c) { return cdf(c.dist, -c.param); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const complemented2_type, RealType>& c) { return -quantile(c.dist, c.param); @@ -553,14 +553,14 @@ BOOST_MATH_GPU_ENABLED RealType students_t_distribution::find_ return detail::solve_for_degrees_of_freedom(f, hint, t > 0, function, Policy()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mode(const students_t_distribution& /*dist*/) { // Assume no checks on degrees of freedom are useful (unlike mean). return 0; // Always zero by definition. } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType median(const students_t_distribution& /*dist*/) { // Assume no checks on degrees of freedom are useful (unlike mean). @@ -569,7 +569,7 @@ BOOST_MATH_GPU_ENABLED inline RealType median(const students_t_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mean(const students_t_distribution& dist) { // Revised for https://svn.boost.org/trac/boost/ticket/7177 RealType df = dist.degrees_of_freedom(); @@ -583,7 +583,7 @@ BOOST_MATH_GPU_ENABLED inline RealType mean(const students_t_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType variance(const students_t_distribution& dist) { // http://en.wikipedia.org/wiki/Student%27s_t-distribution // Revised for https://svn.boost.org/trac/boost/ticket/7177 @@ -615,7 +615,7 @@ BOOST_MATH_GPU_ENABLED inline RealType variance(const students_t_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType skewness(const students_t_distribution& dist) { RealType df = dist.degrees_of_freedom(); @@ -630,7 +630,7 @@ BOOST_MATH_GPU_ENABLED inline RealType skewness(const students_t_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis(const students_t_distribution& dist) { RealType df = dist.degrees_of_freedom(); @@ -662,7 +662,7 @@ BOOST_MATH_GPU_ENABLED inline RealType kurtosis(const students_t_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis_excess(const students_t_distribution& dist) { // see http://mathworld.wolfram.com/Kurtosis.html @@ -695,7 +695,7 @@ BOOST_MATH_GPU_ENABLED inline RealType kurtosis_excess(const students_t_distribu } } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType entropy(const students_t_distribution& dist) { BOOST_MATH_STD_USING diff --git a/include/boost/math/distributions/triangular.hpp b/include/boost/math/distributions/triangular.hpp index e14d3f84a5..0a26021a2f 100644 --- a/include/boost/math/distributions/triangular.hpp +++ b/include/boost/math/distributions/triangular.hpp @@ -147,7 +147,7 @@ namespace boost{ namespace math } // bool check_triangular } // namespace detail - template > + BOOST_MATH_EXPORT template > class triangular_distribution { public: @@ -183,32 +183,32 @@ namespace boost{ namespace math RealType m_upper; // distribution upper aka b }; // class triangular_distribution - typedef triangular_distribution triangular; + BOOST_MATH_EXPORT typedef triangular_distribution triangular; #ifdef __cpp_deduction_guides - template + BOOST_MATH_EXPORT template triangular_distribution(RealType)->triangular_distribution::type>; - template + BOOST_MATH_EXPORT template triangular_distribution(RealType,RealType)->triangular_distribution::type>; - template + BOOST_MATH_EXPORT template triangular_distribution(RealType,RealType,RealType)->triangular_distribution::type>; #endif - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline const boost::math::pair range(const triangular_distribution& /* dist */) { // Range of permissible values for random variable x. using boost::math::tools::max_value; return boost::math::pair(-max_value(), max_value()); } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline const boost::math::pair support(const triangular_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 boost::math::pair(dist.lower(), dist.upper()); } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED RealType pdf(const triangular_distribution& dist, const RealType& x) { constexpr auto function = "boost::math::pdf(const triangular_distribution<%1%>&, %1%)"; @@ -246,7 +246,7 @@ namespace boost{ namespace math } } // RealType pdf(const triangular_distribution& dist, const RealType& x) - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const triangular_distribution& dist, const RealType& x) { constexpr auto function = "boost::math::cdf(const triangular_distribution<%1%>&, %1%)"; @@ -281,7 +281,7 @@ namespace boost{ namespace math } } // RealType cdf(const triangular_distribution& dist, const RealType& x) - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED RealType quantile(const triangular_distribution& dist, const RealType& p) { BOOST_MATH_STD_USING // for ADL of std functions (sqrt). @@ -324,7 +324,7 @@ namespace boost{ namespace math } // RealType quantile(const triangular_distribution& dist, const RealType& q) - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED RealType cdf(const complemented2_type, RealType>& c) { constexpr auto function = "boost::math::cdf(const triangular_distribution<%1%>&, %1%)"; @@ -359,7 +359,7 @@ namespace boost{ namespace math } } // RealType cdf(const complemented2_type, RealType>& c) - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED RealType quantile(const complemented2_type, RealType>& c) { BOOST_MATH_STD_USING // Aid ADL for sqrt. @@ -408,7 +408,7 @@ namespace boost{ namespace math return result; } // RealType quantile(const complemented2_type, RealType>& c) - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mean(const triangular_distribution& dist) { constexpr auto function = "boost::math::mean(const triangular_distribution<%1%>&)"; @@ -424,7 +424,7 @@ namespace boost{ namespace math } // RealType mean(const triangular_distribution& dist) - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType variance(const triangular_distribution& dist) { constexpr auto function = "boost::math::mean(const triangular_distribution<%1%>&)"; @@ -439,7 +439,7 @@ namespace boost{ namespace math return (lower * lower + upper * upper + mode * mode - lower * upper - lower * mode - upper * mode) / 18; } // RealType variance(const triangular_distribution& dist) - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mode(const triangular_distribution& dist) { constexpr auto function = "boost::math::mode(const triangular_distribution<%1%>&)"; @@ -452,7 +452,7 @@ namespace boost{ namespace math return mode; } // RealType mode - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType median(const triangular_distribution& dist) { BOOST_MATH_STD_USING // ADL of std functions. @@ -475,7 +475,7 @@ namespace boost{ namespace math } } // RealType mode - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType skewness(const triangular_distribution& dist) { BOOST_MATH_STD_USING // for ADL of std functions @@ -496,7 +496,7 @@ namespace boost{ namespace math // #11768: Skewness formula for triangular distribution is incorrect - corrected 29 Oct 2015 for release 1.61. } // RealType skewness(const triangular_distribution& dist) - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis(const triangular_distribution& dist) { // These checks may be belt and braces as should have been checked on construction? constexpr auto function = "boost::math::kurtosis(const triangular_distribution<%1%>&)"; @@ -511,7 +511,7 @@ namespace boost{ namespace math return static_cast(12)/5; // 12/5 = 2.4; } // RealType kurtosis_excess(const triangular_distribution& dist) - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis_excess(const triangular_distribution& dist) { // These checks may be belt and braces as should have been checked on construction? constexpr auto function = "boost::math::kurtosis_excess(const triangular_distribution<%1%>&)"; @@ -527,7 +527,7 @@ namespace boost{ namespace math // Assuming mathworld really means kurtosis excess? Wikipedia now corrected to match this. } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType entropy(const triangular_distribution& dist) { BOOST_MATH_STD_USING diff --git a/include/boost/math/distributions/uniform.hpp b/include/boost/math/distributions/uniform.hpp index 08472f95e1..423c1773fc 100644 --- a/include/boost/math/distributions/uniform.hpp +++ b/include/boost/math/distributions/uniform.hpp @@ -111,7 +111,7 @@ namespace boost{ namespace math } // namespace detail - template > + BOOST_MATH_EXPORT template > class uniform_distribution { public: @@ -140,16 +140,16 @@ namespace boost{ namespace math RealType m_upper; // distribution upper aka b. }; // class uniform_distribution - typedef uniform_distribution uniform; + BOOST_MATH_EXPORT typedef uniform_distribution uniform; #ifdef __cpp_deduction_guides - template + BOOST_MATH_EXPORT template uniform_distribution(RealType)->uniform_distribution::type>; - template + BOOST_MATH_EXPORT template uniform_distribution(RealType,RealType)->uniform_distribution::type>; #endif - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline const boost::math::pair range(const uniform_distribution& /* dist */) { // Range of permissible values for random variable x. using boost::math::tools::max_value; @@ -157,7 +157,7 @@ namespace boost{ namespace math // Note RealType infinity is NOT permitted, only max_value. } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline const boost::math::pair support(const uniform_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. @@ -165,7 +165,7 @@ namespace boost{ namespace math return boost::math::pair(dist.lower(), dist.upper()); } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType pdf(const uniform_distribution& dist, const RealType& x) { RealType lower = dist.lower(); @@ -190,7 +190,7 @@ namespace boost{ namespace math } } // RealType pdf(const uniform_distribution& dist, const RealType& x) - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const uniform_distribution& dist, const RealType& x) { RealType lower = dist.lower(); @@ -215,7 +215,7 @@ namespace boost{ namespace math return (x - lower) / (upper - lower); // lower <= x <= upper } // RealType cdf(const uniform_distribution& dist, const RealType& x) - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const uniform_distribution& dist, const RealType& p) { RealType lower = dist.lower(); @@ -240,7 +240,7 @@ namespace boost{ namespace math return p * (upper - lower) + lower; } // RealType quantile(const uniform_distribution& dist, const RealType& p) - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const complemented2_type, RealType>& c) { RealType lower = c.dist.lower(); @@ -266,7 +266,7 @@ namespace boost{ namespace math return (upper - x) / (upper - lower); } // RealType cdf(const complemented2_type, RealType>& c) - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const complemented2_type, RealType>& c) { RealType lower = c.dist.lower(); @@ -292,7 +292,7 @@ namespace boost{ namespace math return -q * (upper - lower) + upper; } // RealType quantile(const complemented2_type, RealType>& c) - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mean(const uniform_distribution& dist) { RealType lower = dist.lower(); @@ -305,7 +305,7 @@ namespace boost{ namespace math return (lower + upper ) / 2; } // RealType mean(const uniform_distribution& dist) - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType variance(const uniform_distribution& dist) { RealType lower = dist.lower(); @@ -319,7 +319,7 @@ namespace boost{ namespace math // for standard uniform = 0.833333333333333333333333333333333333333333; } // RealType variance(const uniform_distribution& dist) - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mode(const uniform_distribution& dist) { RealType lower = dist.lower(); @@ -333,7 +333,7 @@ namespace boost{ namespace math return result; } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType median(const uniform_distribution& dist) { RealType lower = dist.lower(); @@ -345,7 +345,7 @@ namespace boost{ namespace math } return (lower + upper) / 2; // } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType skewness(const uniform_distribution& dist) { RealType lower = dist.lower(); @@ -358,7 +358,7 @@ namespace boost{ namespace math return 0; } // RealType skewness(const uniform_distribution& dist) - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis_excess(const uniform_distribution& dist) { RealType lower = dist.lower(); @@ -371,13 +371,13 @@ namespace boost{ namespace math return static_cast(-6)/5; // -6/5 = -1.2; } // RealType kurtosis_excess(const uniform_distribution& dist) - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis(const uniform_distribution& dist) { return kurtosis_excess(dist) + 3; } - template + BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType entropy(const uniform_distribution& dist) { BOOST_MATH_STD_USING diff --git a/include/boost/math/distributions/weibull.hpp b/include/boost/math/distributions/weibull.hpp index eb4de106c8..61a8673cd1 100644 --- a/include/boost/math/distributions/weibull.hpp +++ b/include/boost/math/distributions/weibull.hpp @@ -69,7 +69,7 @@ BOOST_MATH_GPU_ENABLED inline bool check_weibull( } // namespace detail -template > +BOOST_MATH_EXPORT template > class weibull_distribution { public: @@ -100,23 +100,23 @@ class weibull_distribution RealType m_scale; // distribution scale }; -using weibull = weibull_distribution; +BOOST_MATH_EXPORT using weibull = weibull_distribution; #ifdef __cpp_deduction_guides -template +BOOST_MATH_EXPORT template weibull_distribution(RealType)->weibull_distribution::type>; -template +BOOST_MATH_EXPORT template weibull_distribution(RealType,RealType)->weibull_distribution::type>; #endif -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline boost::math::pair range(const weibull_distribution& /*dist*/) { // Range of permissible values for random variable x. using boost::math::tools::max_value; return boost::math::pair(static_cast(0), max_value()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline boost::math::pair support(const weibull_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. @@ -126,7 +126,7 @@ BOOST_MATH_GPU_ENABLED inline boost::math::pair support(cons // A discontinuity at x == 0, so only support down to min_value. } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType pdf(const weibull_distribution& dist, const RealType& x) { BOOST_MATH_STD_USING // for ADL of std functions @@ -160,7 +160,7 @@ BOOST_MATH_GPU_ENABLED inline RealType pdf(const weibull_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType logpdf(const weibull_distribution& dist, const RealType& x) { BOOST_MATH_STD_USING // for ADL of std functions @@ -194,7 +194,7 @@ BOOST_MATH_GPU_ENABLED inline RealType logpdf(const weibull_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const weibull_distribution& dist, const RealType& x) { BOOST_MATH_STD_USING // for ADL of std functions @@ -215,7 +215,7 @@ BOOST_MATH_GPU_ENABLED inline RealType cdf(const weibull_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType logcdf(const weibull_distribution& dist, const RealType& x) { BOOST_MATH_STD_USING // for ADL of std functions @@ -236,7 +236,7 @@ BOOST_MATH_GPU_ENABLED inline RealType logcdf(const weibull_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const weibull_distribution& dist, const RealType& p) { BOOST_MATH_STD_USING // for ADL of std functions @@ -260,7 +260,7 @@ BOOST_MATH_GPU_ENABLED inline RealType quantile(const weibull_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType cdf(const complemented2_type, RealType>& c) { BOOST_MATH_STD_USING // for ADL of std functions @@ -281,7 +281,7 @@ BOOST_MATH_GPU_ENABLED inline RealType cdf(const complemented2_type +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType logcdf(const complemented2_type, RealType>& c) { BOOST_MATH_STD_USING // for ADL of std functions @@ -302,7 +302,7 @@ BOOST_MATH_GPU_ENABLED inline RealType logcdf(const complemented2_type +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType quantile(const complemented2_type, RealType>& c) { BOOST_MATH_STD_USING // for ADL of std functions @@ -327,7 +327,7 @@ BOOST_MATH_GPU_ENABLED inline RealType quantile(const complemented2_type +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mean(const weibull_distribution& dist) { BOOST_MATH_STD_USING // for ADL of std functions @@ -345,7 +345,7 @@ BOOST_MATH_GPU_ENABLED inline RealType mean(const weibull_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType variance(const weibull_distribution& dist) { RealType shape = dist.shape(); @@ -365,7 +365,7 @@ BOOST_MATH_GPU_ENABLED inline RealType variance(const weibull_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType mode(const weibull_distribution& dist) { BOOST_MATH_STD_USING // for ADL of std function pow. @@ -386,7 +386,7 @@ BOOST_MATH_GPU_ENABLED inline RealType mode(const weibull_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType median(const weibull_distribution& dist) { BOOST_MATH_STD_USING // for ADL of std function pow. @@ -406,7 +406,7 @@ BOOST_MATH_GPU_ENABLED inline RealType median(const weibull_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType skewness(const weibull_distribution& dist) { BOOST_MATH_STD_USING // for ADL of std functions @@ -431,7 +431,7 @@ BOOST_MATH_GPU_ENABLED inline RealType skewness(const weibull_distribution +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis_excess(const weibull_distribution& dist) { BOOST_MATH_STD_USING // for ADL of std functions @@ -459,13 +459,13 @@ BOOST_MATH_GPU_ENABLED inline RealType kurtosis_excess(const weibull_distributio return result; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType kurtosis(const weibull_distribution& dist) { return kurtosis_excess(dist) + 3; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline RealType entropy(const weibull_distribution& dist) { BOOST_MATH_STD_USING diff --git a/module/CMakeLists.txt b/module/CMakeLists.txt index 057dd01b61..8443c71c6b 100644 --- a/module/CMakeLists.txt +++ b/module/CMakeLists.txt @@ -59,6 +59,10 @@ set(BOOST_MATH_MODULE_TESTS test_log1p_simple git_issue_1194 git_issue_1255 + git_issue_1294 + git_issue_800 + git_issue_1120 + scipy_issue_17146 ) add_executable(module_quick_test "${CMAKE_CURRENT_SOURCE_DIR}/quick_test.cpp") diff --git a/module/math.cxx b/module/math.cxx index 7e71230512..9de28aabb1 100644 --- a/module/math.cxx +++ b/module/math.cxx @@ -126,6 +126,9 @@ import std; // Special functions (umbrella) #include +// Statistical distributions (umbrella) +#include + #ifdef _MSC_VER # pragma warning( pop ) #elif defined(__clang__) diff --git a/module/quick_test.cpp b/module/quick_test.cpp index d94841ec95..e033fa2812 100644 --- a/module/quick_test.cpp +++ b/module/quick_test.cpp @@ -52,5 +52,18 @@ int main() BOOST_TEST_LT(bessel_value, 0.77); } + // distributions + { + const boost::math::normal_distribution<> dist {}; + BOOST_TEST_EQ(boost::math::cdf(dist, 0.0), 0.5); + BOOST_TEST_EQ(boost::math::median(dist), 0.0); + BOOST_TEST_EQ(boost::math::cdf(boost::math::complement(dist, 0.0)), 0.5); + const boost::math::students_t st {5.0}; + BOOST_TEST_GT(boost::math::pdf(st, 0.0), 0.37); + const auto q {boost::math::quantile(boost::math::binomial(50, 0.5), 0.5)}; + BOOST_TEST_GT(q, 24.0); + BOOST_TEST_LT(q, 26.0); + } + return boost::report_errors(); } diff --git a/test/git_issue_1120.cpp b/test/git_issue_1120.cpp index 3a74d9c218..bf3695e066 100644 --- a/test/git_issue_1120.cpp +++ b/test/git_issue_1120.cpp @@ -19,8 +19,13 @@ #define BOOST_MATH_INSTRUMENT_SKEW_NORMAL_ITERATIONS -#include +#ifndef BOOST_MATH_BUILD_MODULE #include +#else +import boost.math; +#endif + +#include #include "math_unit_test.hpp" std::uintmax_t global_iter_count; diff --git a/test/git_issue_1294.cpp b/test/git_issue_1294.cpp index 047a8ea7b3..3fd4c3f6b0 100644 --- a/test/git_issue_1294.cpp +++ b/test/git_issue_1294.cpp @@ -6,7 +6,12 @@ // // See: https://github.com/boostorg/math/issues/1294 +#ifndef BOOST_MATH_BUILD_MODULE #include +#else +import boost.math; +#endif + #include "math_unit_test.hpp" int main() diff --git a/test/git_issue_800.cpp b/test/git_issue_800.cpp index 64d3f012ce..a5980d3034 100644 --- a/test/git_issue_800.cpp +++ b/test/git_issue_800.cpp @@ -3,8 +3,13 @@ // 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 "math_unit_test.hpp" +#ifndef BOOST_MATH_BUILD_MODULE #include +#else +import boost.math; +#endif + +#include "math_unit_test.hpp" template void test() diff --git a/test/scipy_issue_17146.cpp b/test/scipy_issue_17146.cpp index b14d8b0f2e..24637ef047 100644 --- a/test/scipy_issue_17146.cpp +++ b/test/scipy_issue_17146.cpp @@ -3,9 +3,14 @@ // Boost Software License, Version 1.0. (See accompanying file // LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt) +#ifndef BOOST_MATH_BUILD_MODULE +#include +#else +import boost.math; +#endif + #include #include -#include #include "math_unit_test.hpp" int main() From 8a5dcf9b0ed3d4caeee178c8e6f7270ebb4f9761 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Wed, 15 Jul 2026 10:54:47 -0400 Subject: [PATCH 05/27] Export ccmath for the boost.math module * BOOST_MATH_EXPORT on the constexpr cmath function set * Adds ccmath/ccmath.hpp to the module interface unit * Module test harness gains ccmath_isinf_test and ccmath_isnan_test --- include/boost/math/ccmath/abs.hpp | 4 ++-- include/boost/math/ccmath/ceil.hpp | 4 ++-- include/boost/math/ccmath/copysign.hpp | 4 ++-- include/boost/math/ccmath/div.hpp | 4 ++-- include/boost/math/ccmath/fabs.hpp | 2 +- include/boost/math/ccmath/fdim.hpp | 4 ++-- include/boost/math/ccmath/floor.hpp | 4 ++-- include/boost/math/ccmath/fma.hpp | 4 ++-- include/boost/math/ccmath/fmax.hpp | 4 ++-- include/boost/math/ccmath/fmin.hpp | 4 ++-- include/boost/math/ccmath/fmod.hpp | 4 ++-- include/boost/math/ccmath/fpclassify.hpp | 4 ++-- include/boost/math/ccmath/frexp.hpp | 4 ++-- include/boost/math/ccmath/hypot.hpp | 4 ++-- include/boost/math/ccmath/ilogb.hpp | 4 ++-- include/boost/math/ccmath/isfinite.hpp | 2 +- include/boost/math/ccmath/isgreater.hpp | 2 +- include/boost/math/ccmath/isgreaterequal.hpp | 2 +- include/boost/math/ccmath/isinf.hpp | 2 +- include/boost/math/ccmath/isless.hpp | 2 +- include/boost/math/ccmath/islessequal.hpp | 2 +- include/boost/math/ccmath/isnan.hpp | 2 +- include/boost/math/ccmath/isnormal.hpp | 2 +- include/boost/math/ccmath/isunordered.hpp | 2 +- include/boost/math/ccmath/ldexp.hpp | 4 ++-- include/boost/math/ccmath/logb.hpp | 4 ++-- include/boost/math/ccmath/modf.hpp | 2 +- include/boost/math/ccmath/next.hpp | 4 ++-- include/boost/math/ccmath/remainder.hpp | 4 ++-- include/boost/math/ccmath/round.hpp | 12 ++++++------ include/boost/math/ccmath/scalbln.hpp | 4 ++-- include/boost/math/ccmath/scalbn.hpp | 4 ++-- include/boost/math/ccmath/signbit.hpp | 4 ++-- include/boost/math/ccmath/sqrt.hpp | 4 ++-- include/boost/math/ccmath/trunc.hpp | 4 ++-- module/CMakeLists.txt | 2 ++ module/math.cxx | 3 +++ module/quick_test.cpp | 5 +++++ test/ccmath_isinf_test.cpp | 4 ++++ test/ccmath_isnan_test.cpp | 4 ++++ 40 files changed, 81 insertions(+), 63 deletions(-) diff --git a/include/boost/math/ccmath/abs.hpp b/include/boost/math/ccmath/abs.hpp index db59502ab6..aacb6dd95c 100644 --- a/include/boost/math/ccmath/abs.hpp +++ b/include/boost/math/ccmath/abs.hpp @@ -44,7 +44,7 @@ constexpr T abs_impl(T x) noexcept } // Namespace detail -template , bool> = true> +BOOST_MATH_EXPORT template , bool> = true> constexpr T abs(T x) noexcept { if(BOOST_MATH_IS_CONSTANT_EVALUATED(x)) @@ -60,7 +60,7 @@ constexpr T abs(T x) noexcept // If abs() is called with an argument of type X for which is_unsigned_v is true and if X // cannot be converted to int by integral promotion (7.3.7), the program is ill-formed. -template , bool> = true> +BOOST_MATH_EXPORT template , bool> = true> constexpr T abs(T x) noexcept { if constexpr (std::is_convertible_v) diff --git a/include/boost/math/ccmath/ceil.hpp b/include/boost/math/ccmath/ceil.hpp index bc264a0be0..d1eab9b7e8 100644 --- a/include/boost/math/ccmath/ceil.hpp +++ b/include/boost/math/ccmath/ceil.hpp @@ -38,7 +38,7 @@ inline constexpr T ceil_impl(T arg) noexcept } // Namespace detail -template , bool> = true> +BOOST_MATH_EXPORT template , bool> = true> inline constexpr Real ceil(Real arg) noexcept { if(BOOST_MATH_IS_CONSTANT_EVALUATED(arg)) @@ -55,7 +55,7 @@ inline constexpr Real ceil(Real arg) noexcept } } -template , bool> = true> +BOOST_MATH_EXPORT template , bool> = true> inline constexpr double ceil(Z arg) noexcept { return boost::math::ccmath::ceil(static_cast(arg)); diff --git a/include/boost/math/ccmath/copysign.hpp b/include/boost/math/ccmath/copysign.hpp index e41b4071e4..16a6d7c7a2 100644 --- a/include/boost/math/ccmath/copysign.hpp +++ b/include/boost/math/ccmath/copysign.hpp @@ -37,7 +37,7 @@ constexpr T copysign_impl(const T mag, const T sgn) noexcept } // Namespace detail -template , bool> = true> +BOOST_MATH_EXPORT template , bool> = true> constexpr Real copysign(Real mag, Real sgn) noexcept { if(BOOST_MATH_IS_CONSTANT_EVALUATED(mag)) @@ -51,7 +51,7 @@ constexpr Real copysign(Real mag, Real sgn) noexcept } } -template +BOOST_MATH_EXPORT template constexpr auto copysign(T1 mag, T2 sgn) noexcept { if (BOOST_MATH_IS_CONSTANT_EVALUATED(mag)) diff --git a/include/boost/math/ccmath/div.hpp b/include/boost/math/ccmath/div.hpp index 6cf1df59de..59b70e5eb5 100644 --- a/include/boost/math/ccmath/div.hpp +++ b/include/boost/math/ccmath/div.hpp @@ -36,14 +36,14 @@ inline constexpr ReturnType div_impl(const Z x, const Z y) noexcept } // Namespace detail // Used for types other than built-ins (e.g. boost multiprecision) -template +BOOST_MATH_EXPORT template struct div_t { Z quot; Z rem; }; -template +BOOST_MATH_EXPORT template inline constexpr auto div(Z x, Z y) noexcept { if constexpr (std::is_same_v) diff --git a/include/boost/math/ccmath/fabs.hpp b/include/boost/math/ccmath/fabs.hpp index 02191db3d1..12787bb817 100644 --- a/include/boost/math/ccmath/fabs.hpp +++ b/include/boost/math/ccmath/fabs.hpp @@ -18,7 +18,7 @@ namespace boost::math::ccmath { -template +BOOST_MATH_EXPORT template inline constexpr auto fabs(T x) noexcept { return boost::math::ccmath::abs(x); diff --git a/include/boost/math/ccmath/fdim.hpp b/include/boost/math/ccmath/fdim.hpp index d6b4e25cec..723a2a8df6 100644 --- a/include/boost/math/ccmath/fdim.hpp +++ b/include/boost/math/ccmath/fdim.hpp @@ -38,7 +38,7 @@ constexpr T fdim_impl(const T x, const T y) noexcept } // Namespace detail -template , bool> = true> +BOOST_MATH_EXPORT template , bool> = true> constexpr Real fdim(Real x, Real y) noexcept { if (BOOST_MATH_IS_CONSTANT_EVALUATED(x)) @@ -61,7 +61,7 @@ constexpr Real fdim(Real x, Real y) noexcept } } -template +BOOST_MATH_EXPORT template constexpr auto fdim(T1 x, T2 y) noexcept { if (BOOST_MATH_IS_CONSTANT_EVALUATED(x)) diff --git a/include/boost/math/ccmath/floor.hpp b/include/boost/math/ccmath/floor.hpp index 0484344bdd..006666198e 100644 --- a/include/boost/math/ccmath/floor.hpp +++ b/include/boost/math/ccmath/floor.hpp @@ -93,7 +93,7 @@ inline constexpr T floor_impl(T arg) noexcept } // Namespace detail -template , bool> = true> +BOOST_MATH_EXPORT template , bool> = true> inline constexpr Real floor(Real arg) noexcept { if(BOOST_MATH_IS_CONSTANT_EVALUATED(arg)) @@ -110,7 +110,7 @@ inline constexpr Real floor(Real arg) noexcept } } -template , bool> = true> +BOOST_MATH_EXPORT template , bool> = true> inline constexpr double floor(Z arg) noexcept { return boost::math::ccmath::floor(static_cast(arg)); diff --git a/include/boost/math/ccmath/fma.hpp b/include/boost/math/ccmath/fma.hpp index c4d16c8ae5..ba319c6f3b 100644 --- a/include/boost/math/ccmath/fma.hpp +++ b/include/boost/math/ccmath/fma.hpp @@ -43,7 +43,7 @@ constexpr T fma_imp(const T x, const T y, const T z) noexcept } // Namespace detail -template , bool> = true> +BOOST_MATH_EXPORT template , bool> = true> constexpr Real fma(Real x, Real y, Real z) noexcept { if (BOOST_MATH_IS_CONSTANT_EVALUATED(x)) @@ -78,7 +78,7 @@ constexpr Real fma(Real x, Real y, Real z) noexcept } } -template +BOOST_MATH_EXPORT template constexpr auto fma(T1 x, T2 y, T3 z) noexcept { if (BOOST_MATH_IS_CONSTANT_EVALUATED(x)) diff --git a/include/boost/math/ccmath/fmax.hpp b/include/boost/math/ccmath/fmax.hpp index 8a0d17d03e..278a022a1c 100644 --- a/include/boost/math/ccmath/fmax.hpp +++ b/include/boost/math/ccmath/fmax.hpp @@ -34,7 +34,7 @@ constexpr T fmax_impl(const T x, const T y) noexcept } // Namespace detail -template , bool> = true> +BOOST_MATH_EXPORT template , bool> = true> constexpr Real fmax(Real x, Real y) noexcept { if (BOOST_MATH_IS_CONSTANT_EVALUATED(x)) @@ -57,7 +57,7 @@ constexpr Real fmax(Real x, Real y) noexcept } } -template +BOOST_MATH_EXPORT template constexpr auto fmax(T1 x, T2 y) noexcept { if (BOOST_MATH_IS_CONSTANT_EVALUATED(x)) diff --git a/include/boost/math/ccmath/fmin.hpp b/include/boost/math/ccmath/fmin.hpp index 29885b69c8..5e2c3e8839 100644 --- a/include/boost/math/ccmath/fmin.hpp +++ b/include/boost/math/ccmath/fmin.hpp @@ -34,7 +34,7 @@ constexpr T fmin_impl(const T x, const T y) noexcept } // Namespace detail -template , bool> = true> +BOOST_MATH_EXPORT template , bool> = true> constexpr Real fmin(Real x, Real y) noexcept { if (BOOST_MATH_IS_CONSTANT_EVALUATED(x)) @@ -57,7 +57,7 @@ constexpr Real fmin(Real x, Real y) noexcept } } -template +BOOST_MATH_EXPORT template constexpr auto fmin(T1 x, T2 y) noexcept { if (BOOST_MATH_IS_CONSTANT_EVALUATED(x)) diff --git a/include/boost/math/ccmath/fmod.hpp b/include/boost/math/ccmath/fmod.hpp index b44034616e..bf0df1c18f 100644 --- a/include/boost/math/ccmath/fmod.hpp +++ b/include/boost/math/ccmath/fmod.hpp @@ -45,7 +45,7 @@ constexpr T fmod_impl(T x, T y) } // Namespace detail -template , bool> = true> +BOOST_MATH_EXPORT template , bool> = true> constexpr Real fmod(Real x, Real y) { if(BOOST_MATH_IS_CONSTANT_EVALUATED(x)) @@ -84,7 +84,7 @@ constexpr Real fmod(Real x, Real y) } } -template +BOOST_MATH_EXPORT template constexpr auto fmod(T1 x, T2 y) { if(BOOST_MATH_IS_CONSTANT_EVALUATED(x)) diff --git a/include/boost/math/ccmath/fpclassify.hpp b/include/boost/math/ccmath/fpclassify.hpp index ce0728a277..6c2c3e4771 100644 --- a/include/boost/math/ccmath/fpclassify.hpp +++ b/include/boost/math/ccmath/fpclassify.hpp @@ -20,7 +20,7 @@ namespace boost::math::ccmath { -template , bool> = true> +BOOST_MATH_EXPORT template , bool> = true> inline constexpr int fpclassify BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(T x) { if(BOOST_MATH_IS_CONSTANT_EVALUATED(x)) @@ -37,7 +37,7 @@ inline constexpr int fpclassify BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(T x) } } -template , bool> = true> +BOOST_MATH_EXPORT template , bool> = true> inline constexpr int fpclassify(Z x) { return boost::math::ccmath::fpclassify(static_cast(x)); diff --git a/include/boost/math/ccmath/frexp.hpp b/include/boost/math/ccmath/frexp.hpp index 6c200cb641..91c1ff6bc9 100644 --- a/include/boost/math/ccmath/frexp.hpp +++ b/include/boost/math/ccmath/frexp.hpp @@ -60,7 +60,7 @@ inline constexpr Real frexp_impl(Real arg, int* exp) } // namespace detail -template , bool> = true> +BOOST_MATH_EXPORT template , bool> = true> inline constexpr Real frexp(Real arg, int* exp) { if(BOOST_MATH_IS_CONSTANT_EVALUATED(arg)) @@ -78,7 +78,7 @@ inline constexpr Real frexp(Real arg, int* exp) } } -template , bool> = true> +BOOST_MATH_EXPORT template , bool> = true> inline constexpr double frexp(Z arg, int* exp) { return boost::math::ccmath::frexp(static_cast(arg), exp); diff --git a/include/boost/math/ccmath/hypot.hpp b/include/boost/math/ccmath/hypot.hpp index 3fd09632c5..f23cff2c9f 100644 --- a/include/boost/math/ccmath/hypot.hpp +++ b/include/boost/math/ccmath/hypot.hpp @@ -50,7 +50,7 @@ constexpr T hypot_impl(T x, T y) noexcept } // Namespace detail -template , bool> = true> +BOOST_MATH_EXPORT template , bool> = true> constexpr Real hypot(Real x, Real y) noexcept { if(BOOST_MATH_IS_CONSTANT_EVALUATED(x)) @@ -86,7 +86,7 @@ constexpr Real hypot(Real x, Real y) noexcept } } -template +BOOST_MATH_EXPORT template constexpr auto hypot(T1 x, T2 y) noexcept { if(BOOST_MATH_IS_CONSTANT_EVALUATED(x)) diff --git a/include/boost/math/ccmath/ilogb.hpp b/include/boost/math/ccmath/ilogb.hpp index 6ec6fca9aa..fc70ff0f80 100644 --- a/include/boost/math/ccmath/ilogb.hpp +++ b/include/boost/math/ccmath/ilogb.hpp @@ -20,7 +20,7 @@ namespace boost::math::ccmath { // If arg is not zero, infinite, or NaN, the value returned is exactly equivalent to static_cast(std::logb(arg)) -template , bool> = true> +BOOST_MATH_EXPORT template , bool> = true> inline constexpr int ilogb(Real arg) noexcept { if(BOOST_MATH_IS_CONSTANT_EVALUATED(arg)) @@ -37,7 +37,7 @@ inline constexpr int ilogb(Real arg) noexcept } } -template , bool> = true> +BOOST_MATH_EXPORT template , bool> = true> inline constexpr int ilogb(Z arg) noexcept { return boost::math::ccmath::ilogb(static_cast(arg)); diff --git a/include/boost/math/ccmath/isfinite.hpp b/include/boost/math/ccmath/isfinite.hpp index 328742ccad..61a046d674 100644 --- a/include/boost/math/ccmath/isfinite.hpp +++ b/include/boost/math/ccmath/isfinite.hpp @@ -17,7 +17,7 @@ namespace boost::math::ccmath { -template +BOOST_MATH_EXPORT template inline constexpr bool isfinite(T x) { if(BOOST_MATH_IS_CONSTANT_EVALUATED(x)) diff --git a/include/boost/math/ccmath/isgreater.hpp b/include/boost/math/ccmath/isgreater.hpp index 7b29f9bffe..88bba0d50e 100644 --- a/include/boost/math/ccmath/isgreater.hpp +++ b/include/boost/math/ccmath/isgreater.hpp @@ -16,7 +16,7 @@ namespace boost::math::ccmath { -template +BOOST_MATH_EXPORT template inline constexpr bool isgreater(T1 x, T2 y) noexcept { if (BOOST_MATH_IS_CONSTANT_EVALUATED(x)) diff --git a/include/boost/math/ccmath/isgreaterequal.hpp b/include/boost/math/ccmath/isgreaterequal.hpp index d6586a95d8..eb99de662f 100644 --- a/include/boost/math/ccmath/isgreaterequal.hpp +++ b/include/boost/math/ccmath/isgreaterequal.hpp @@ -16,7 +16,7 @@ namespace boost::math::ccmath { -template +BOOST_MATH_EXPORT template inline constexpr bool isgreaterequal(T1 x, T2 y) noexcept { if (BOOST_MATH_IS_CONSTANT_EVALUATED(x)) diff --git a/include/boost/math/ccmath/isinf.hpp b/include/boost/math/ccmath/isinf.hpp index f1b0e7c726..2807aa5cfa 100644 --- a/include/boost/math/ccmath/isinf.hpp +++ b/include/boost/math/ccmath/isinf.hpp @@ -15,7 +15,7 @@ namespace boost::math::ccmath { -template +BOOST_MATH_EXPORT template constexpr bool isinf BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(T x) noexcept { if(BOOST_MATH_IS_CONSTANT_EVALUATED(x)) diff --git a/include/boost/math/ccmath/isless.hpp b/include/boost/math/ccmath/isless.hpp index bf923e6f80..bfbd5f50ee 100644 --- a/include/boost/math/ccmath/isless.hpp +++ b/include/boost/math/ccmath/isless.hpp @@ -16,7 +16,7 @@ namespace boost::math::ccmath { -template +BOOST_MATH_EXPORT template inline constexpr bool isless(T1 x, T2 y) noexcept { if (BOOST_MATH_IS_CONSTANT_EVALUATED(x)) diff --git a/include/boost/math/ccmath/islessequal.hpp b/include/boost/math/ccmath/islessequal.hpp index 075d4cad67..0821110fe2 100644 --- a/include/boost/math/ccmath/islessequal.hpp +++ b/include/boost/math/ccmath/islessequal.hpp @@ -16,7 +16,7 @@ namespace boost::math::ccmath { -template +BOOST_MATH_EXPORT template inline constexpr bool islessequal(T1 x, T2 y) noexcept { if (BOOST_MATH_IS_CONSTANT_EVALUATED(x)) diff --git a/include/boost/math/ccmath/isnan.hpp b/include/boost/math/ccmath/isnan.hpp index 753f2079b2..bb3b25dc84 100644 --- a/include/boost/math/ccmath/isnan.hpp +++ b/include/boost/math/ccmath/isnan.hpp @@ -15,7 +15,7 @@ namespace boost::math::ccmath { -template +BOOST_MATH_EXPORT template inline constexpr bool isnan BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(T x) { if(BOOST_MATH_IS_CONSTANT_EVALUATED(x)) diff --git a/include/boost/math/ccmath/isnormal.hpp b/include/boost/math/ccmath/isnormal.hpp index cf5a4d1536..a8cb2ba6ae 100644 --- a/include/boost/math/ccmath/isnormal.hpp +++ b/include/boost/math/ccmath/isnormal.hpp @@ -18,7 +18,7 @@ namespace boost::math::ccmath { -template +BOOST_MATH_EXPORT template inline constexpr bool isnormal(T x) { if(BOOST_MATH_IS_CONSTANT_EVALUATED(x)) diff --git a/include/boost/math/ccmath/isunordered.hpp b/include/boost/math/ccmath/isunordered.hpp index 9d55db0d38..bb71147237 100644 --- a/include/boost/math/ccmath/isunordered.hpp +++ b/include/boost/math/ccmath/isunordered.hpp @@ -16,7 +16,7 @@ namespace boost::math::ccmath { -template +BOOST_MATH_EXPORT template inline constexpr bool isunordered(const T x, const T y) noexcept { if(BOOST_MATH_IS_CONSTANT_EVALUATED(x)) diff --git a/include/boost/math/ccmath/ldexp.hpp b/include/boost/math/ccmath/ldexp.hpp index b1de3293f0..a916a6ee40 100644 --- a/include/boost/math/ccmath/ldexp.hpp +++ b/include/boost/math/ccmath/ldexp.hpp @@ -43,7 +43,7 @@ inline constexpr Real ldexp_impl(Real arg, int exp) noexcept } // Namespace detail -template , bool> = true> +BOOST_MATH_EXPORT template , bool> = true> inline constexpr Real ldexp(Real arg, int exp) noexcept { if(BOOST_MATH_IS_CONSTANT_EVALUATED(arg)) @@ -60,7 +60,7 @@ inline constexpr Real ldexp(Real arg, int exp) noexcept } } -template , bool> = true> +BOOST_MATH_EXPORT template , bool> = true> inline constexpr double ldexp(Z arg, int exp) noexcept { return boost::math::ccmath::ldexp(static_cast(arg), exp); diff --git a/include/boost/math/ccmath/logb.hpp b/include/boost/math/ccmath/logb.hpp index 9a0c4a1c02..97b4b51d05 100644 --- a/include/boost/math/ccmath/logb.hpp +++ b/include/boost/math/ccmath/logb.hpp @@ -36,7 +36,7 @@ constexpr T logb_impl(T arg) noexcept } // Namespace detail -template , bool> = true> +BOOST_MATH_EXPORT template , bool> = true> constexpr Real logb(Real arg) noexcept { if(BOOST_MATH_IS_CONSTANT_EVALUATED(arg)) @@ -63,7 +63,7 @@ constexpr Real logb(Real arg) noexcept } } -template , bool> = true> +BOOST_MATH_EXPORT template , bool> = true> constexpr double logb(Z arg) noexcept { return boost::math::ccmath::logb(static_cast(arg)); diff --git a/include/boost/math/ccmath/modf.hpp b/include/boost/math/ccmath/modf.hpp index 87b6a4b508..87f6f63546 100644 --- a/include/boost/math/ccmath/modf.hpp +++ b/include/boost/math/ccmath/modf.hpp @@ -45,7 +45,7 @@ inline constexpr Real modf_impl(Real x, Real* iptr) } // Namespace detail -template +BOOST_MATH_EXPORT template inline constexpr Real modf(Real x, Real* iptr) { if(BOOST_MATH_IS_CONSTANT_EVALUATED(x)) diff --git a/include/boost/math/ccmath/next.hpp b/include/boost/math/ccmath/next.hpp index 3a2090e6c5..f1607d36b5 100644 --- a/include/boost/math/ccmath/next.hpp +++ b/include/boost/math/ccmath/next.hpp @@ -383,7 +383,7 @@ constexpr result_type float_prior(const T& val) } // namespace detail -template > +BOOST_MATH_EXPORT template > constexpr result_type nextafter(const T& val, const U& direction) { if (BOOST_MATH_IS_CONSTANT_EVALUATED(val)) @@ -429,7 +429,7 @@ constexpr long double nextafterl(long double val, long double direction) return boost::math::ccmath::nextafter(val, direction); } -template , typename return_type = std::conditional_t, double, T>> +BOOST_MATH_EXPORT template , typename return_type = std::conditional_t, double, T>> constexpr return_type nexttoward(T val, long double direction) { if (BOOST_MATH_IS_CONSTANT_EVALUATED(val)) diff --git a/include/boost/math/ccmath/remainder.hpp b/include/boost/math/ccmath/remainder.hpp index 21bb6afd27..a7f533f1b4 100644 --- a/include/boost/math/ccmath/remainder.hpp +++ b/include/boost/math/ccmath/remainder.hpp @@ -45,7 +45,7 @@ constexpr T remainder_impl(const T x, const T y) } // Namespace detail -template , bool> = true> +BOOST_MATH_EXPORT template , bool> = true> constexpr Real remainder(Real x, Real y) { if (BOOST_MATH_IS_CONSTANT_EVALUATED(x)) @@ -76,7 +76,7 @@ constexpr Real remainder(Real x, Real y) } } -template +BOOST_MATH_EXPORT template constexpr auto remainder(T1 x, T2 y) { if (BOOST_MATH_IS_CONSTANT_EVALUATED(x)) diff --git a/include/boost/math/ccmath/round.hpp b/include/boost/math/ccmath/round.hpp index 0f21e721fa..505ee5c670 100644 --- a/include/boost/math/ccmath/round.hpp +++ b/include/boost/math/ccmath/round.hpp @@ -71,7 +71,7 @@ inline constexpr ReturnType int_round_impl(T arg) } // Namespace detail -template , bool> = true> +BOOST_MATH_EXPORT template , bool> = true> inline constexpr Real round(Real arg) noexcept { if(BOOST_MATH_IS_CONSTANT_EVALUATED(arg)) @@ -88,7 +88,7 @@ inline constexpr Real round(Real arg) noexcept } } -template , bool> = true> +BOOST_MATH_EXPORT template , bool> = true> inline constexpr double round(Z arg) noexcept { return boost::math::ccmath::round(static_cast(arg)); @@ -106,7 +106,7 @@ inline constexpr long double roundl(long double arg) noexcept } #endif -template , bool> = true> +BOOST_MATH_EXPORT template , bool> = true> inline constexpr long lround(Real arg) { if(BOOST_MATH_IS_CONSTANT_EVALUATED(arg)) @@ -123,7 +123,7 @@ inline constexpr long lround(Real arg) } } -template , bool> = true> +BOOST_MATH_EXPORT template , bool> = true> inline constexpr long lround(Z arg) { return boost::math::ccmath::lround(static_cast(arg)); @@ -141,7 +141,7 @@ inline constexpr long lroundl(long double arg) } #endif -template , bool> = true> +BOOST_MATH_EXPORT template , bool> = true> inline constexpr long long llround(Real arg) { if(BOOST_MATH_IS_CONSTANT_EVALUATED(arg)) @@ -158,7 +158,7 @@ inline constexpr long long llround(Real arg) } } -template , bool> = true> +BOOST_MATH_EXPORT template , bool> = true> inline constexpr long llround(Z arg) { return boost::math::ccmath::llround(static_cast(arg)); diff --git a/include/boost/math/ccmath/scalbln.hpp b/include/boost/math/ccmath/scalbln.hpp index 07b06dae69..7a1214d3d8 100644 --- a/include/boost/math/ccmath/scalbln.hpp +++ b/include/boost/math/ccmath/scalbln.hpp @@ -22,7 +22,7 @@ namespace boost::math::ccmath { -template , bool> = true> +BOOST_MATH_EXPORT template , bool> = true> inline constexpr Real scalbln(Real arg, long exp) noexcept { if(BOOST_MATH_IS_CONSTANT_EVALUATED(arg)) @@ -39,7 +39,7 @@ inline constexpr Real scalbln(Real arg, long exp) noexcept } } -template , bool> = true> +BOOST_MATH_EXPORT template , bool> = true> inline constexpr double scalbln(Z arg, long exp) noexcept { return boost::math::ccmath::scalbln(static_cast(arg), exp); diff --git a/include/boost/math/ccmath/scalbn.hpp b/include/boost/math/ccmath/scalbn.hpp index dd29815dbc..78dd380dee 100644 --- a/include/boost/math/ccmath/scalbn.hpp +++ b/include/boost/math/ccmath/scalbn.hpp @@ -43,7 +43,7 @@ inline constexpr Real scalbn_impl(Real arg, Z exp) noexcept } // Namespace detail -template , bool> = true> +BOOST_MATH_EXPORT template , bool> = true> inline constexpr Real scalbn(Real arg, int exp) noexcept { if(BOOST_MATH_IS_CONSTANT_EVALUATED(arg)) @@ -60,7 +60,7 @@ inline constexpr Real scalbn(Real arg, int exp) noexcept } } -template , bool> = true> +BOOST_MATH_EXPORT template , bool> = true> inline constexpr double scalbn(Z arg, int exp) noexcept { return boost::math::ccmath::scalbn(static_cast(arg), exp); diff --git a/include/boost/math/ccmath/signbit.hpp b/include/boost/math/ccmath/signbit.hpp index 3f98c4c61e..871f6b2e25 100644 --- a/include/boost/math/ccmath/signbit.hpp +++ b/include/boost/math/ccmath/signbit.hpp @@ -197,7 +197,7 @@ constexpr bool signbit_impl(T arg) } // Return value: true if arg is negative, false if arg is 0, NAN, or positive -template , bool> = true> +BOOST_MATH_EXPORT template , bool> = true> constexpr bool signbit(Real arg) { if (BOOST_MATH_IS_CONSTANT_EVALUATED(arg)) @@ -211,7 +211,7 @@ constexpr bool signbit(Real arg) } } -template , bool> = true> +BOOST_MATH_EXPORT template , bool> = true> constexpr bool signbit(Z arg) { return boost::math::ccmath::signbit(static_cast(arg)); diff --git a/include/boost/math/ccmath/sqrt.hpp b/include/boost/math/ccmath/sqrt.hpp index 3639610700..605127a612 100644 --- a/include/boost/math/ccmath/sqrt.hpp +++ b/include/boost/math/ccmath/sqrt.hpp @@ -43,7 +43,7 @@ constexpr Real sqrt_impl(Real x) } // namespace detail -template , bool> = true> +BOOST_MATH_EXPORT template , bool> = true> constexpr Real sqrt(Real x) { if(BOOST_MATH_IS_CONSTANT_EVALUATED(x)) @@ -69,7 +69,7 @@ constexpr Real sqrt(Real x) } } -template , bool> = true> +BOOST_MATH_EXPORT template , bool> = true> constexpr double sqrt(Z x) { return detail::sqrt_impl(static_cast(x)); diff --git a/include/boost/math/ccmath/trunc.hpp b/include/boost/math/ccmath/trunc.hpp index 7d30fd8b4c..1e2d761f74 100644 --- a/include/boost/math/ccmath/trunc.hpp +++ b/include/boost/math/ccmath/trunc.hpp @@ -30,7 +30,7 @@ inline constexpr T trunc_impl(T arg) noexcept } // Namespace detail -template , bool> = true> +BOOST_MATH_EXPORT template , bool> = true> inline constexpr Real trunc(Real arg) noexcept { if(BOOST_MATH_IS_CONSTANT_EVALUATED(arg)) @@ -47,7 +47,7 @@ inline constexpr Real trunc(Real arg) noexcept } } -template , bool> = true> +BOOST_MATH_EXPORT template , bool> = true> inline constexpr double trunc(Z arg) noexcept { return boost::math::ccmath::trunc(static_cast(arg)); diff --git a/module/CMakeLists.txt b/module/CMakeLists.txt index 8443c71c6b..8a2f70e24c 100644 --- a/module/CMakeLists.txt +++ b/module/CMakeLists.txt @@ -63,6 +63,8 @@ set(BOOST_MATH_MODULE_TESTS git_issue_800 git_issue_1120 scipy_issue_17146 + ccmath_isinf_test + ccmath_isnan_test ) add_executable(module_quick_test "${CMAKE_CURRENT_SOURCE_DIR}/quick_test.cpp") diff --git a/module/math.cxx b/module/math.cxx index 9de28aabb1..f7823e759f 100644 --- a/module/math.cxx +++ b/module/math.cxx @@ -129,6 +129,9 @@ import std; // Statistical distributions (umbrella) #include +// Constexpr cmath (umbrella) +#include + #ifdef _MSC_VER # pragma warning( pop ) #elif defined(__clang__) diff --git a/module/quick_test.cpp b/module/quick_test.cpp index e033fa2812..0a6034b814 100644 --- a/module/quick_test.cpp +++ b/module/quick_test.cpp @@ -52,6 +52,11 @@ int main() BOOST_TEST_LT(bessel_value, 0.77); } + // ccmath + static_assert(boost::math::ccmath::abs(-1) == 1, "ccmath abs"); + static_assert(boost::math::ccmath::isnan(0.0) == false, "ccmath isnan"); + static_assert(boost::math::ccmath::sqrt(4.0) == 2.0, "ccmath sqrt"); + // distributions { const boost::math::normal_distribution<> dist {}; diff --git a/test/ccmath_isinf_test.cpp b/test/ccmath_isinf_test.cpp index 3ee5d1375a..1e03f69af4 100644 --- a/test/ccmath_isinf_test.cpp +++ b/test/ccmath_isinf_test.cpp @@ -7,7 +7,11 @@ #include #include #include +#ifndef BOOST_MATH_BUILD_MODULE #include +#else +import boost.math; +#endif #include #ifdef BOOST_HAS_FLOAT128 diff --git a/test/ccmath_isnan_test.cpp b/test/ccmath_isnan_test.cpp index 40d712a242..8b47fa3a4b 100644 --- a/test/ccmath_isnan_test.cpp +++ b/test/ccmath_isnan_test.cpp @@ -7,7 +7,11 @@ #include #include #include +#ifndef BOOST_MATH_BUILD_MODULE #include +#else +import boost.math; +#endif #include #include From cf763575fdbffce7cb96bd70e1ac4f6b3260e6a6 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Wed, 15 Jul 2026 11:00:31 -0400 Subject: [PATCH 06/27] Export the public tools for the boost.math module * BOOST_MATH_EXPORT on the root finders, minima, polynomial and its operators, rational/polynomial evaluators, series and continued fraction machinery, recurrences, norms, condition numbers, color maps, expansions, agm and toms748 * Adds the curated tools headers to the module interface unit * Module test harness gains git_issue_1139, cubic_roots_test and quartic_roots_test --- include/boost/math/tools/agm.hpp | 4 +- .../tools/centered_continued_fraction.hpp | 6 +- .../boost/math/tools/cohen_acceleration.hpp | 4 +- include/boost/math/tools/color_maps.hpp | 16 ++--- .../boost/math/tools/condition_numbers.hpp | 4 +- include/boost/math/tools/cubic_roots.hpp | 6 +- include/boost/math/tools/engel_expansion.hpp | 6 +- include/boost/math/tools/estrin.hpp | 6 +- include/boost/math/tools/fraction.hpp | 16 ++--- include/boost/math/tools/luroth_expansion.hpp | 6 +- include/boost/math/tools/minima.hpp | 4 +- include/boost/math/tools/norms.hpp | 44 ++++++------ include/boost/math/tools/polynomial.hpp | 72 +++++++++---------- include/boost/math/tools/quartic_roots.hpp | 2 +- include/boost/math/tools/rational.hpp | 28 ++++---- include/boost/math/tools/recurrence.hpp | 12 ++-- include/boost/math/tools/roots.hpp | 22 +++--- include/boost/math/tools/series.hpp | 18 ++--- .../math/tools/simple_continued_fraction.hpp | 6 +- include/boost/math/tools/toms748_solve.hpp | 14 ++-- module/CMakeLists.txt | 3 + module/math.cxx | 22 ++++++ module/quick_test.cpp | 12 ++++ test/cubic_roots_test.cpp | 7 +- test/git_issue_1139.cpp | 7 +- test/quartic_roots_test.cpp | 7 +- 26 files changed, 209 insertions(+), 145 deletions(-) diff --git a/include/boost/math/tools/agm.hpp b/include/boost/math/tools/agm.hpp index 7ac1a622da..82aa02977a 100644 --- a/include/boost/math/tools/agm.hpp +++ b/include/boost/math/tools/agm.hpp @@ -5,6 +5,8 @@ #ifndef BOOST_MATH_TOOLS_AGM_HPP #define BOOST_MATH_TOOLS_AGM_HPP + +#include #ifndef BOOST_MATH_BUILD_MODULE #include #include @@ -12,7 +14,7 @@ namespace boost { namespace math { namespace tools { -template +BOOST_MATH_EXPORT template Real agm(Real a, Real g) { using std::sqrt; diff --git a/include/boost/math/tools/centered_continued_fraction.hpp b/include/boost/math/tools/centered_continued_fraction.hpp index 5de98b24d6..500d6b591e 100644 --- a/include/boost/math/tools/centered_continued_fraction.hpp +++ b/include/boost/math/tools/centered_continued_fraction.hpp @@ -6,6 +6,8 @@ #ifndef BOOST_MATH_TOOLS_CENTERED_CONTINUED_FRACTION_HPP #define BOOST_MATH_TOOLS_CENTERED_CONTINUED_FRACTION_HPP +#include + #ifndef BOOST_MATH_BUILD_MODULE #include #include @@ -33,7 +35,7 @@ namespace boost::math::tools { -template +BOOST_MATH_EXPORT template class centered_continued_fraction { public: centered_continued_fraction(Real x) : x_{x} { @@ -144,7 +146,7 @@ class centered_continued_fraction { }; -template +BOOST_MATH_EXPORT template std::ostream& operator<<(std::ostream& out, centered_continued_fraction& scf) { constexpr const int p = std::numeric_limits::max_digits10; if constexpr (p == 2147483647) diff --git a/include/boost/math/tools/cohen_acceleration.hpp b/include/boost/math/tools/cohen_acceleration.hpp index 5fd360ab9e..02f1f515c0 100644 --- a/include/boost/math/tools/cohen_acceleration.hpp +++ b/include/boost/math/tools/cohen_acceleration.hpp @@ -5,6 +5,8 @@ #ifndef BOOST_MATH_TOOLS_COHEN_ACCELERATION_HPP #define BOOST_MATH_TOOLS_COHEN_ACCELERATION_HPP + +#include #ifndef BOOST_MATH_BUILD_MODULE #include #include @@ -15,7 +17,7 @@ namespace boost::math::tools { // Algorithm 1 of https://people.mpim-bonn.mpg.de/zagier/files/exp-math-9/fulltext.pdf // Convergence Acceleration of Alternating Series: Henri Cohen, Fernando Rodriguez Villegas, and Don Zagier -template +BOOST_MATH_EXPORT template auto cohen_acceleration(G& generator, std::int64_t n = -1) { using Real = decltype(generator()); diff --git a/include/boost/math/tools/color_maps.hpp b/include/boost/math/tools/color_maps.hpp index f120e42b69..38cf425ba2 100644 --- a/include/boost/math/tools/color_maps.hpp +++ b/include/boost/math/tools/color_maps.hpp @@ -1899,36 +1899,36 @@ color_map_(Real scalar, std::array, 256> const &table) { } } // namespace detail -template std::array viridis(Real x) { +BOOST_MATH_EXPORT template std::array viridis(Real x) { return detail::color_map_(x, detail::viridis_data_); } -template std::array smooth_cool_warm(Real x) { +BOOST_MATH_EXPORT template std::array smooth_cool_warm(Real x) { return detail::color_map_(x, detail::smooth_cool_warm_data_); } -template std::array plasma(Real x) { +BOOST_MATH_EXPORT template std::array plasma(Real x) { return detail::color_map_(x, detail::plasma_data_); } -template std::array black_body(Real x) { +BOOST_MATH_EXPORT template std::array black_body(Real x) { return detail::color_map_(x, detail::black_body_data_); } -template std::array inferno(Real x) { +BOOST_MATH_EXPORT template std::array inferno(Real x) { return detail::color_map_(x, detail::inferno_data_); } -template std::array kindlmann(Real x) { +BOOST_MATH_EXPORT template std::array kindlmann(Real x) { return detail::color_map_(x, detail::kindlmann_data_); } -template +BOOST_MATH_EXPORT template std::array extended_kindlmann(Real x) { return detail::color_map_(x, detail::extended_kindlmann_data_); } -template +BOOST_MATH_EXPORT template std::array to_8bit_rgba(const std::array &v) { using std::sqrt; std::array pixel {}; diff --git a/include/boost/math/tools/condition_numbers.hpp b/include/boost/math/tools/condition_numbers.hpp index 580dfee08d..e34986c514 100644 --- a/include/boost/math/tools/condition_numbers.hpp +++ b/include/boost/math/tools/condition_numbers.hpp @@ -14,7 +14,7 @@ namespace boost { namespace math { namespace tools { -template +BOOST_MATH_EXPORT template class summation_condition_number { public: summation_condition_number(Real const x = 0) @@ -82,7 +82,7 @@ class summation_condition_number { Real m_c; }; -template +BOOST_MATH_EXPORT template Real evaluation_condition_number(F const & f, Real const & x) { using std::abs; diff --git a/include/boost/math/tools/cubic_roots.hpp b/include/boost/math/tools/cubic_roots.hpp index dfd9db6822..d5ba06fc8f 100644 --- a/include/boost/math/tools/cubic_roots.hpp +++ b/include/boost/math/tools/cubic_roots.hpp @@ -41,7 +41,7 @@ bool roots_less(const Real& lhs, const Real& rhs) // algorithm apparently exists: Algorithm 954: An Accurate and Efficient Cubic // and Quartic Equation Solver for Physical Applications However, I don't have // access to that paper! -template +BOOST_MATH_EXPORT template std::array cubic_roots(Real a, Real b, Real c, Real d) { using std::abs; using std::acos; @@ -147,7 +147,7 @@ std::array cubic_roots(Real a, Real b, Real c, Real d) { // eps*|rp'(r)| (second element) for a root. Recall that for a numerically // computed root r satisfying r = r_0(1+eps) of a function p, |p(r)| <= // eps|rp'(r)|. -template +BOOST_MATH_EXPORT template std::array cubic_root_residual(Real a, Real b, Real c, Real d, Real root) { using std::abs; @@ -174,7 +174,7 @@ std::array cubic_root_residual(Real a, Real b, Real c, Real d, // Computes the condition number of rootfinding. This is defined in Corless, A // Graduate Introduction to Numerical Methods, Section 3.2.1. -template +BOOST_MATH_EXPORT template Real cubic_root_condition_number(Real a, Real b, Real c, Real d, Real root) { using std::abs; using std::fma; diff --git a/include/boost/math/tools/engel_expansion.hpp b/include/boost/math/tools/engel_expansion.hpp index 3f0ecd4c52..21b02b87a2 100644 --- a/include/boost/math/tools/engel_expansion.hpp +++ b/include/boost/math/tools/engel_expansion.hpp @@ -6,6 +6,8 @@ #ifndef BOOST_MATH_TOOLS_ENGEL_EXPANSION_HPP #define BOOST_MATH_TOOLS_ENGEL_EXPANSION_HPP +#include + #ifndef BOOST_MATH_BUILD_MODULE #include #include @@ -26,7 +28,7 @@ namespace boost::math::tools { -template +BOOST_MATH_EXPORT template class engel_expansion { public: engel_expansion(Real x) : x_{x} @@ -98,7 +100,7 @@ class engel_expansion { }; -template +BOOST_MATH_EXPORT template std::ostream& operator<<(std::ostream& out, engel_expansion& engel) { constexpr const int p = std::numeric_limits::max_digits10; diff --git a/include/boost/math/tools/estrin.hpp b/include/boost/math/tools/estrin.hpp index 3303de34cb..566e710d5a 100644 --- a/include/boost/math/tools/estrin.hpp +++ b/include/boost/math/tools/estrin.hpp @@ -18,7 +18,7 @@ namespace boost { namespace math { namespace tools { -template +BOOST_MATH_EXPORT template inline RealOrComplex evaluate_polynomial_estrin(RandomAccessContainer1 const &coeffs, RandomAccessContainer2 &scratch, RealOrComplex z) { // Does anyone care about the complex coefficients, real argument case? // I've never seen it used, and this static assert makes the error messages much better: @@ -52,13 +52,13 @@ inline RealOrComplex evaluate_polynomial_estrin(RandomAccessContainer1 const &co } // The std::array template specialization doesn't need to allocate: -template +BOOST_MATH_EXPORT template inline RealOrComplex2 evaluate_polynomial_estrin(const std::array &coeffs, RealOrComplex2 z) { std::array ds; return evaluate_polynomial_estrin(coeffs, ds, z); } -template +BOOST_MATH_EXPORT template inline RealOrComplex evaluate_polynomial_estrin(const RandomAccessContainer &coeffs, RealOrComplex z) { auto n = coeffs.size(); // Normally, I'd make `ds` a RandomAccessContainer, but its value type needs to be RealOrComplex, diff --git a/include/boost/math/tools/fraction.hpp b/include/boost/math/tools/fraction.hpp index f36d024c40..39c93e1ad9 100644 --- a/include/boost/math/tools/fraction.hpp +++ b/include/boost/math/tools/fraction.hpp @@ -161,7 +161,7 @@ BOOST_MATH_GPU_ENABLED inline typename detail::fraction_traits::result_type } // namespace detail -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename detail::fraction_traits::result_type continued_fraction_b(Gen& g, const U& factor, boost::math::uintmax_t& max_terms) noexcept(BOOST_MATH_IS_FLOAT(typename detail::fraction_traits::result_type) #ifndef BOOST_MATH_HAS_GPU_SUPPORT @@ -172,7 +172,7 @@ BOOST_MATH_GPU_ENABLED inline typename detail::fraction_traits::result_type return detail::continued_fraction_b_impl(g, factor, max_terms); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename detail::fraction_traits::result_type continued_fraction_b(Gen& g, const U& factor) noexcept(BOOST_MATH_IS_FLOAT(typename detail::fraction_traits::result_type) #ifndef BOOST_MATH_HAS_GPU_SUPPORT @@ -184,7 +184,7 @@ BOOST_MATH_GPU_ENABLED inline typename detail::fraction_traits::result_type return detail::continued_fraction_b_impl(g, factor, max_terms); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename detail::fraction_traits::result_type continued_fraction_b(Gen& g, int bits) noexcept(BOOST_MATH_IS_FLOAT(typename detail::fraction_traits::result_type) #ifndef BOOST_MATH_HAS_GPU_SUPPORT @@ -202,7 +202,7 @@ BOOST_MATH_GPU_ENABLED inline typename detail::fraction_traits::result_type return detail::continued_fraction_b_impl(g, factor, max_terms); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename detail::fraction_traits::result_type continued_fraction_b(Gen& g, int bits, boost::math::uintmax_t& max_terms) noexcept(BOOST_MATH_IS_FLOAT(typename detail::fraction_traits::result_type) #ifndef BOOST_MATH_HAS_GPU_SUPPORT @@ -288,7 +288,7 @@ BOOST_MATH_GPU_ENABLED inline typename detail::fraction_traits::result_type } // namespace detail -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename detail::fraction_traits::result_type continued_fraction_a(Gen& g, const U& factor, boost::math::uintmax_t& max_terms) noexcept(BOOST_MATH_IS_FLOAT(typename detail::fraction_traits::result_type) #ifndef BOOST_MATH_HAS_GPU_SUPPORT @@ -299,7 +299,7 @@ BOOST_MATH_GPU_ENABLED inline typename detail::fraction_traits::result_type return detail::continued_fraction_a_impl(g, factor, max_terms); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename detail::fraction_traits::result_type continued_fraction_a(Gen& g, const U& factor) noexcept(BOOST_MATH_IS_FLOAT(typename detail::fraction_traits::result_type) #ifndef BOOST_MATH_HAS_GPU_SUPPORT @@ -311,7 +311,7 @@ BOOST_MATH_GPU_ENABLED inline typename detail::fraction_traits::result_type return detail::continued_fraction_a_impl(g, factor, max_iter); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename detail::fraction_traits::result_type continued_fraction_a(Gen& g, int bits) noexcept(BOOST_MATH_IS_FLOAT(typename detail::fraction_traits::result_type) #ifndef BOOST_MATH_HAS_GPU_SUPPORT @@ -330,7 +330,7 @@ BOOST_MATH_GPU_ENABLED inline typename detail::fraction_traits::result_type return detail::continued_fraction_a_impl(g, factor, max_iter); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename detail::fraction_traits::result_type continued_fraction_a(Gen& g, int bits, boost::math::uintmax_t& max_terms) noexcept(BOOST_MATH_IS_FLOAT(typename detail::fraction_traits::result_type) #ifndef BOOST_MATH_HAS_GPU_SUPPORT diff --git a/include/boost/math/tools/luroth_expansion.hpp b/include/boost/math/tools/luroth_expansion.hpp index 2f18ce4d64..ff51f4431c 100644 --- a/include/boost/math/tools/luroth_expansion.hpp +++ b/include/boost/math/tools/luroth_expansion.hpp @@ -6,6 +6,8 @@ #ifndef BOOST_MATH_TOOLS_LUROTH_EXPANSION_HPP #define BOOST_MATH_TOOLS_LUROTH_EXPANSION_HPP +#include + #ifndef BOOST_MATH_BUILD_MODULE #include #include @@ -26,7 +28,7 @@ namespace boost::math::tools { -template +BOOST_MATH_EXPORT template class luroth_expansion { public: luroth_expansion(Real x) : x_{x} @@ -117,7 +119,7 @@ class luroth_expansion { }; -template +BOOST_MATH_EXPORT template std::ostream& operator<<(std::ostream& out, luroth_expansion& luroth) { constexpr const int p = std::numeric_limits::max_digits10; diff --git a/include/boost/math/tools/minima.hpp b/include/boost/math/tools/minima.hpp index a6be94cb2b..5d3d7c41ee 100644 --- a/include/boost/math/tools/minima.hpp +++ b/include/boost/math/tools/minima.hpp @@ -21,7 +21,7 @@ namespace boost{ namespace math{ namespace tools{ -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED boost::math::pair brent_find_minima(F f, T min, T max, int bits, boost::math::uintmax_t& max_iter) noexcept(BOOST_MATH_IS_FLOAT(T) #ifndef BOOST_MATH_HAS_GPU_SUPPORT @@ -143,7 +143,7 @@ BOOST_MATH_GPU_ENABLED boost::math::pair brent_find_minima(F f, T min, T m return boost::math::make_pair(x, fx); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline boost::math::pair brent_find_minima(F f, T min, T max, int digits) noexcept(BOOST_MATH_IS_FLOAT(T) #ifndef BOOST_MATH_HAS_GPU_SUPPORT diff --git a/include/boost/math/tools/norms.hpp b/include/boost/math/tools/norms.hpp index d7d5ff9122..8e5953927e 100644 --- a/include/boost/math/tools/norms.hpp +++ b/include/boost/math/tools/norms.hpp @@ -26,7 +26,7 @@ namespace boost::math::tools { // Mallat, "A Wavelet Tour of Signal Processing", equation 2.60: -template +BOOST_MATH_EXPORT template auto total_variation(ForwardIterator first, ForwardIterator last) { using T = typename std::iterator_traits::value_type; @@ -76,14 +76,14 @@ auto total_variation(ForwardIterator first, ForwardIterator last) } } -template +BOOST_MATH_EXPORT template inline auto total_variation(Container const & v) { return total_variation(v.cbegin(), v.cend()); } -template +BOOST_MATH_EXPORT template auto sup_norm(ForwardIterator first, ForwardIterator last) { BOOST_MATH_ASSERT_MSG(first != last, "At least one value is required to compute the sup norm."); @@ -112,13 +112,13 @@ auto sup_norm(ForwardIterator first, ForwardIterator last) } } -template +BOOST_MATH_EXPORT template inline auto sup_norm(Container const & v) { return sup_norm(v.cbegin(), v.cend()); } -template +BOOST_MATH_EXPORT template auto l1_norm(ForwardIterator first, ForwardIterator last) { using T = typename std::iterator_traits::value_type; @@ -154,14 +154,14 @@ auto l1_norm(ForwardIterator first, ForwardIterator last) } -template +BOOST_MATH_EXPORT template inline auto l1_norm(Container const & v) { return l1_norm(v.cbegin(), v.cend()); } -template +BOOST_MATH_EXPORT template auto l2_norm(ForwardIterator first, ForwardIterator last) { using T = typename std::iterator_traits::value_type; @@ -230,13 +230,13 @@ auto l2_norm(ForwardIterator first, ForwardIterator last) } } -template +BOOST_MATH_EXPORT template inline auto l2_norm(Container const & v) { return l2_norm(v.cbegin(), v.cend()); } -template +BOOST_MATH_EXPORT template size_t l0_pseudo_norm(ForwardIterator first, ForwardIterator last) { using RealOrComplex = typename std::iterator_traits::value_type; @@ -251,13 +251,13 @@ size_t l0_pseudo_norm(ForwardIterator first, ForwardIterator last) return count; } -template +BOOST_MATH_EXPORT template inline size_t l0_pseudo_norm(Container const & v) { return l0_pseudo_norm(v.cbegin(), v.cend()); } -template +BOOST_MATH_EXPORT template size_t hamming_distance(ForwardIterator first1, ForwardIterator last1, ForwardIterator first2) { size_t count = 0; @@ -273,13 +273,13 @@ size_t hamming_distance(ForwardIterator first1, ForwardIterator last1, ForwardIt return count; } -template +BOOST_MATH_EXPORT template inline size_t hamming_distance(Container const & v, Container const & w) { return hamming_distance(v.cbegin(), v.cend(), w.cbegin()); } -template +BOOST_MATH_EXPORT template auto lp_norm(ForwardIterator first, ForwardIterator last, unsigned p) { using std::abs; @@ -358,14 +358,14 @@ auto lp_norm(ForwardIterator first, ForwardIterator last, unsigned p) } } -template +BOOST_MATH_EXPORT template inline auto lp_norm(Container const & v, unsigned p) { return lp_norm(v.cbegin(), v.cend(), p); } -template +BOOST_MATH_EXPORT template auto lp_distance(ForwardIterator first1, ForwardIterator last1, ForwardIterator first2, unsigned p) { using std::pow; @@ -414,14 +414,14 @@ auto lp_distance(ForwardIterator first1, ForwardIterator last1, ForwardIterator } } -template +BOOST_MATH_EXPORT template inline auto lp_distance(Container const & v, Container const & w, unsigned p) { return lp_distance(v.cbegin(), v.cend(), w.cbegin(), p); } -template +BOOST_MATH_EXPORT template auto l1_distance(ForwardIterator first1, ForwardIterator last1, ForwardIterator first2) { using std::abs; @@ -484,7 +484,7 @@ auto l1_distance(ForwardIterator first1, ForwardIterator last1, ForwardIterator } -template +BOOST_MATH_EXPORT template auto l1_distance(Container const & v, Container const & w) { using std::size; @@ -493,7 +493,7 @@ auto l1_distance(Container const & v, Container const & w) return l1_distance(v.cbegin(), v.cend(), w.begin()); } -template +BOOST_MATH_EXPORT template auto l2_distance(ForwardIterator first1, ForwardIterator last1, ForwardIterator first2) { using std::abs; @@ -557,7 +557,7 @@ auto l2_distance(ForwardIterator first1, ForwardIterator last1, ForwardIterator } } -template +BOOST_MATH_EXPORT template auto l2_distance(Container const & v, Container const & w) { using std::size; @@ -566,7 +566,7 @@ auto l2_distance(Container const & v, Container const & w) return l2_distance(v.cbegin(), v.cend(), w.begin()); } -template +BOOST_MATH_EXPORT template auto sup_distance(ForwardIterator first1, ForwardIterator last1, ForwardIterator first2) { using std::abs; @@ -626,7 +626,7 @@ auto sup_distance(ForwardIterator first1, ForwardIterator last1, ForwardIterator } } -template +BOOST_MATH_EXPORT template auto sup_distance(Container const & v, Container const & w) { using std::size; diff --git a/include/boost/math/tools/polynomial.hpp b/include/boost/math/tools/polynomial.hpp index bfb50edbc0..11b452119a 100644 --- a/include/boost/math/tools/polynomial.hpp +++ b/include/boost/math/tools/polynomial.hpp @@ -33,7 +33,7 @@ namespace boost{ namespace math{ namespace tools{ -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED T chebyshev_coefficient(unsigned n, unsigned m) { BOOST_MATH_STD_USING @@ -57,7 +57,7 @@ BOOST_MATH_GPU_ENABLED T chebyshev_coefficient(unsigned n, unsigned m) return result; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED Seq polynomial_to_chebyshev(const Seq& s) { // Converts a Polynomial into Chebyshev form: @@ -93,7 +93,7 @@ BOOST_MATH_GPU_ENABLED Seq polynomial_to_chebyshev(const Seq& s) return result; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED T evaluate_chebyshev(const Seq& a, const T& x) { // Clenshaw's formula: @@ -111,7 +111,7 @@ BOOST_MATH_GPU_ENABLED T evaluate_chebyshev(const Seq& a, const T& x) } -template +BOOST_MATH_EXPORT template class polynomial; namespace detail { @@ -249,13 +249,13 @@ struct minus /** * Returns the zero element for multiplication of polynomials. */ -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED polynomial zero_element(std::multiplies< polynomial >) { return polynomial(); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED polynomial identity_element(std::multiplies< polynomial >) { return polynomial(T(1)); @@ -265,7 +265,7 @@ BOOST_MATH_GPU_ENABLED polynomial identity_element(std::multiplies< polynomia * because the same amount of computation yields both. * This function is not defined for division by zero: user beware. */ -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED std::pair< polynomial, polynomial > quotient_remainder(const polynomial& dividend, const polynomial& divisor) { @@ -276,7 +276,7 @@ quotient_remainder(const polynomial& dividend, const polynomial& divisor) } -template +BOOST_MATH_EXPORT template class polynomial { public: @@ -639,7 +639,7 @@ class polynomial }; -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline polynomial operator + (const polynomial& a, const polynomial& b) { polynomial result(a); @@ -647,26 +647,26 @@ BOOST_MATH_GPU_ENABLED inline polynomial operator + (const polynomial& a, return result; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline polynomial operator + (polynomial&& a, const polynomial& b) { a += b; return std::move(a); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline polynomial operator + (const polynomial& a, polynomial&& b) { b += a; return b; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline polynomial operator + (polynomial&& a, polynomial&& b) { a += b; return a; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline polynomial operator - (const polynomial& a, const polynomial& b) { polynomial result(a); @@ -674,26 +674,26 @@ BOOST_MATH_GPU_ENABLED inline polynomial operator - (const polynomial& a, return result; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline polynomial operator - (polynomial&& a, const polynomial& b) { a -= b; return a; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline polynomial operator - (const polynomial& a, polynomial&& b) { b -= a; return -b; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline polynomial operator - (polynomial&& a, polynomial&& b) { a -= b; return a; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline polynomial operator * (const polynomial& a, const polynomial& b) { polynomial result; @@ -701,94 +701,94 @@ BOOST_MATH_GPU_ENABLED inline polynomial operator * (const polynomial& a, return result; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline polynomial operator / (const polynomial& a, const polynomial& b) { return quotient_remainder(a, b).first; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline polynomial operator % (const polynomial& a, const polynomial& b) { return quotient_remainder(a, b).second; } -template +BOOST_MATH_EXPORT template 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_EXPORT template 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_EXPORT template 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_EXPORT template 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_EXPORT template 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_EXPORT template 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_EXPORT template 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_EXPORT template 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_EXPORT template BOOST_MATH_GPU_ENABLED bool operator == (const polynomial &a, const polynomial &b) { return a.data() == b.data(); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED bool operator != (const polynomial &a, const polynomial &b) { return a.data() != b.data(); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED polynomial operator >> (polynomial a, const U& b) { a >>= b; return a; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED polynomial operator << (polynomial a, const U& b) { a <<= b; @@ -796,26 +796,26 @@ BOOST_MATH_GPU_ENABLED polynomial operator << (polynomial a, const U& b) } // Unary minus (negate). -template +BOOST_MATH_EXPORT template 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_EXPORT template BOOST_MATH_GPU_ENABLED bool odd(polynomial const &a) { return a.size() > 0 && a[0] != static_cast(0); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED bool even(polynomial const &a) { return !odd(a); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED polynomial pow(polynomial base, int exp) { if (exp < 0) @@ -839,7 +839,7 @@ BOOST_MATH_GPU_ENABLED polynomial pow(polynomial base, int exp) return result; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline std::basic_ostream& operator << (std::basic_ostream& os, const polynomial& poly) { os << "{ "; diff --git a/include/boost/math/tools/quartic_roots.hpp b/include/boost/math/tools/quartic_roots.hpp index a4c4ba1262..2ae33f6306 100644 --- a/include/boost/math/tools/quartic_roots.hpp +++ b/include/boost/math/tools/quartic_roots.hpp @@ -52,7 +52,7 @@ std::array polish_and_sort(Real a, Real b, Real c, Real d, Real e, std: // Solves ax^4 + bx^3 + cx^2 + dx + e = 0. // Only returns the real roots, as these are the only roots of interest in ray intersection problems. // Follows Graphics Gems V: https://github.com/erich666/GraphicsGems/blob/master/gems/Roots3And4.c -template +BOOST_MATH_EXPORT template std::array quartic_roots(Real a, Real b, Real c, Real d, Real e) { using std::abs; using std::sqrt; diff --git a/include/boost/math/tools/rational.hpp b/include/boost/math/tools/rational.hpp index 6f0fff6811..d67d91f236 100644 --- a/include/boost/math/tools/rational.hpp +++ b/include/boost/math/tools/rational.hpp @@ -174,7 +174,7 @@ namespace boost{ namespace math{ namespace tools{ // // Forward declaration to keep two phase lookup happy: // -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED U evaluate_polynomial(const T* poly, U const& z, boost::math::size_t count) BOOST_MATH_NOEXCEPT(U); namespace detail{ @@ -192,7 +192,7 @@ BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial_c_imp(const T* a, const V& v // This requires a for-loop which may be more expensive than // the loop expanded versions above: // -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline U evaluate_polynomial(const T* poly, U const& z, boost::math::size_t count) BOOST_MATH_NOEXCEPT(U) { BOOST_MATH_ASSERT(count > 0); @@ -208,7 +208,7 @@ BOOST_MATH_GPU_ENABLED inline U evaluate_polynomial(const T* poly, U const& z, b // Compile time sized polynomials, just inline forwarders to the // implementations above: // -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial(const T(&a)[N], const V& val) BOOST_MATH_NOEXCEPT(V) { typedef boost::math::integral_constant(N)> tag_type; @@ -216,7 +216,7 @@ BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial(const T(&a)[N], const V& val } #ifndef BOOST_MATH_HAS_NVRTC -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial(const std::array& a, const V& val) BOOST_MATH_NOEXCEPT(V) { typedef boost::math::integral_constant(N)> tag_type; @@ -226,20 +226,20 @@ BOOST_MATH_GPU_ENABLED inline V evaluate_polynomial(const std::array& a, co // // Even polynomials are trivial: just square the argument! // -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline U evaluate_even_polynomial(const T* poly, U z, boost::math::size_t count) BOOST_MATH_NOEXCEPT(U) { return evaluate_polynomial(poly, U(z*z), count); } -template +BOOST_MATH_EXPORT template 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)); } #ifndef BOOST_MATH_HAS_NVRTC -template +BOOST_MATH_EXPORT template 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)); @@ -248,13 +248,13 @@ BOOST_MATH_GPU_ENABLED inline V evaluate_even_polynomial(const std::array& // // Odd polynomials come next: // -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline U evaluate_odd_polynomial(const T* poly, U z, boost::math::size_t count) BOOST_MATH_NOEXCEPT(U) { return poly[0] + z * evaluate_polynomial(poly+1, U(z*z), count-1); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline V evaluate_odd_polynomial(const T(&a)[N], const V& z) BOOST_MATH_NOEXCEPT(V) { typedef boost::math::integral_constant(N-1)> tag_type; @@ -262,7 +262,7 @@ BOOST_MATH_GPU_ENABLED inline V evaluate_odd_polynomial(const T(&a)[N], const V& } #ifndef BOOST_MATH_HAS_NVRTC -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline V evaluate_odd_polynomial(const std::array& a, const V& z) BOOST_MATH_NOEXCEPT(V) { typedef boost::math::integral_constant(N-1)> tag_type; @@ -270,7 +270,7 @@ BOOST_MATH_GPU_ENABLED inline V evaluate_odd_polynomial(const std::array& a } #endif -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED V evaluate_rational(const T* num, const U* denom, const V& z_, boost::math::size_t count) BOOST_MATH_NOEXCEPT(V); namespace detail{ @@ -290,7 +290,7 @@ BOOST_MATH_GPU_ENABLED inline V evaluate_rational_c_imp(const T* num, const U* d // occur in polynomial evaluation, if z is large. This is important // in our Lanczos code for example. // -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED V evaluate_rational(const T* num, const U* denom, const V& z_, boost::math::size_t count) BOOST_MATH_NOEXCEPT(V) { V z(z_); @@ -323,14 +323,14 @@ BOOST_MATH_GPU_ENABLED V evaluate_rational(const T* num, const U* denom, const V return s1 / s2; } -template +BOOST_MATH_EXPORT template 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(N)>*>(nullptr)); } #ifndef BOOST_MATH_HAS_NVRTC -template +BOOST_MATH_EXPORT template 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(N)>*>(nullptr)); diff --git a/include/boost/math/tools/recurrence.hpp b/include/boost/math/tools/recurrence.hpp index e202743a06..7c54f81b89 100644 --- a/include/boost/math/tools/recurrence.hpp +++ b/include/boost/math/tools/recurrence.hpp @@ -101,7 +101,7 @@ namespace boost { // factor: Convergence criteria, should be no less than machine epsilon. // max_iter: Maximum iterations to use solving the continued fraction. // - template + BOOST_MATH_EXPORT template T function_ratio_from_backwards_recurrence(const Recurrence& r, const T& factor, std::uintmax_t& max_iter) { detail::function_ratio_from_backwards_recurrence_fraction f(r); @@ -122,7 +122,7 @@ namespace boost { // factor: Convergence criteria, should be no less than machine epsilon. // max_iter: Maximum iterations to use solving the continued fraction. // - template + BOOST_MATH_EXPORT template T function_ratio_from_forwards_recurrence(const Recurrence& r, const T& factor, std::uintmax_t& max_iter) { boost::math::tools::detail::function_ratio_from_backwards_recurrence_fraction > f(r); @@ -142,7 +142,7 @@ namespace boost { // first: w(-1); // second: w(0); // - template + BOOST_MATH_EXPORT template inline T apply_recurrence_relation_forward(const NextCoefs& get_coefs, unsigned number_of_steps, T first, T second, long long* log_scaling = nullptr, T* previous = nullptr) { BOOST_MATH_STD_USING @@ -198,7 +198,7 @@ namespace boost { // first: w(1); // second: w(0); // - template + BOOST_MATH_EXPORT template inline T apply_recurrence_relation_backward(const NextCoefs& get_coefs, unsigned number_of_steps, T first, T second, long long* log_scaling = nullptr, T* previous = nullptr) { BOOST_MATH_STD_USING @@ -241,7 +241,7 @@ namespace boost { return second; } - template + BOOST_MATH_EXPORT template struct forward_recurrence_iterator { typedef typename std::remove_reference(std::declval()(0)))>::type value_type; @@ -283,7 +283,7 @@ namespace boost { int k; }; - template + BOOST_MATH_EXPORT template struct backward_recurrence_iterator { typedef typename std::remove_reference(std::declval()(0)))>::type value_type; diff --git a/include/boost/math/tools/roots.hpp b/include/boost/math/tools/roots.hpp index af9b76d998..fc1de49f00 100644 --- a/include/boost/math/tools/roots.hpp +++ b/include/boost/math/tools/roots.hpp @@ -133,7 +133,7 @@ BOOST_MATH_GPU_ENABLED void handle_zero_derivative(F f, } // namespace -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED boost::math::pair bisect(F f, T min, T max, Tol tol, boost::math::uintmax_t& max_iter, const Policy& pol) noexcept(policies::is_noexcept_error_policy::value && BOOST_MATH_IS_FLOAT(T) #ifndef BOOST_MATH_HAS_GPU_SUPPORT && noexcept(std::declval()(std::declval())) @@ -209,7 +209,7 @@ BOOST_MATH_GPU_ENABLED boost::math::pair bisect(F f, T min, T max, Tol tol return boost::math::make_pair(min, max); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline boost::math::pair bisect(F f, T min, T max, Tol tol, boost::math::uintmax_t& max_iter) noexcept(policies::is_noexcept_error_policy >::value && BOOST_MATH_IS_FLOAT(T) #ifndef BOOST_MATH_HAS_GPU_SUPPORT && noexcept(std::declval()(std::declval())) @@ -219,7 +219,7 @@ BOOST_MATH_GPU_ENABLED inline boost::math::pair bisect(F f, T min, T max, return bisect(f, min, max, tol, max_iter, policies::policy<>()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline boost::math::pair bisect(F f, T min, T max, Tol tol) noexcept(policies::is_noexcept_error_policy >::value && BOOST_MATH_IS_FLOAT(T) #ifndef BOOST_MATH_HAS_GPU_SUPPORT && noexcept(std::declval()(std::declval())) @@ -231,7 +231,7 @@ BOOST_MATH_GPU_ENABLED inline boost::math::pair bisect(F f, T min, T max, } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED T newton_raphson_iterate(F f, T guess, T min, T max, int digits, boost::math::uintmax_t& max_iter) noexcept(policies::is_noexcept_error_policy >::value && BOOST_MATH_IS_FLOAT(T) #ifndef BOOST_MATH_HAS_GPU_SUPPORT && noexcept(std::declval()(std::declval())) @@ -353,7 +353,7 @@ BOOST_MATH_GPU_ENABLED T newton_raphson_iterate(F f, T guess, T min, T max, int return result; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline T newton_raphson_iterate(F f, T guess, T min, T max, int digits) noexcept(policies::is_noexcept_error_policy >::value && BOOST_MATH_IS_FLOAT(T) #ifndef BOOST_MATH_HAS_GPU_SUPPORT && noexcept(std::declval()(std::declval())) @@ -759,13 +759,13 @@ namespace detail { } } // T second_order_root_finder -template +BOOST_MATH_EXPORT template T halley_iterate(F f, T guess, T min, T max, int digits, std::uintmax_t& max_iter) noexcept(policies::is_noexcept_error_policy >::value&& BOOST_MATH_IS_FLOAT(T) && noexcept(std::declval()(std::declval()))) { return detail::second_order_root_finder(f, guess, min, max, digits, max_iter); } -template +BOOST_MATH_EXPORT template inline T halley_iterate(F f, T guess, T min, T max, int digits) noexcept(policies::is_noexcept_error_policy >::value&& BOOST_MATH_IS_FLOAT(T) && noexcept(std::declval()(std::declval()))) { std::uintmax_t m = (std::numeric_limits::max)(); @@ -797,13 +797,13 @@ namespace detail { } -template +BOOST_MATH_EXPORT template T schroder_iterate(F f, T guess, T min, T max, int digits, std::uintmax_t& max_iter) noexcept(policies::is_noexcept_error_policy >::value&& BOOST_MATH_IS_FLOAT(T) && noexcept(std::declval()(std::declval()))) { return detail::second_order_root_finder(f, guess, min, max, digits, max_iter); } -template +BOOST_MATH_EXPORT template inline T schroder_iterate(F f, T guess, T min, T max, int digits) noexcept(policies::is_noexcept_error_policy >::value&& BOOST_MATH_IS_FLOAT(T) && noexcept(std::declval()(std::declval()))) { std::uintmax_t m = (std::numeric_limits::max)(); @@ -832,7 +832,7 @@ inline T schroeder_iterate(F f, T guess, T min, T max, int digits) noexcept(poli * so this default should recover full precision even in this somewhat pathological case. * For isolated roots, the problem is so rapidly convergent that this doesn't matter at all. */ -template +BOOST_MATH_EXPORT template ComplexType complex_newton(F g, ComplexType guess, int max_iterations = std::numeric_limits::digits) { typedef typename ComplexType::value_type Real; @@ -1054,7 +1054,7 @@ std::pair quadratic_roots_imp(T const& a, T const& b, T const& c) } } // namespace detail -template +BOOST_MATH_EXPORT template inline std::pair::type, typename tools::promote_args::type> quadratic_roots(T1 const& a, T2 const& b, T3 const& c) { typedef typename tools::promote_args::type value_type; diff --git a/include/boost/math/tools/series.hpp b/include/boost/math/tools/series.hpp index 4617ea3df7..270fb8e103 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 +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename Functor::result_type sum_series(Functor& func, const U& factor, boost::math::uintmax_t& max_terms, const V& init_value) noexcept(BOOST_MATH_IS_FLOAT(typename Functor::result_type) #ifndef BOOST_MATH_HAS_GPU_SUPPORT && noexcept(std::declval()()) @@ -48,7 +48,7 @@ BOOST_MATH_GPU_ENABLED inline typename Functor::result_type sum_series(Functor& return result; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename Functor::result_type sum_series(Functor& func, const U& factor, boost::math::uintmax_t& max_terms) noexcept(BOOST_MATH_IS_FLOAT(typename Functor::result_type) #ifndef BOOST_MATH_HAS_GPU_SUPPORT && noexcept(std::declval()()) @@ -59,7 +59,7 @@ BOOST_MATH_GPU_ENABLED inline typename Functor::result_type sum_series(Functor& return sum_series(func, factor, max_terms, init_value); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename Functor::result_type sum_series(Functor& func, int bits, boost::math::uintmax_t& max_terms, const U& init_value) noexcept(BOOST_MATH_IS_FLOAT(typename Functor::result_type) #ifndef BOOST_MATH_HAS_GPU_SUPPORT && noexcept(std::declval()()) @@ -72,7 +72,7 @@ BOOST_MATH_GPU_ENABLED inline typename Functor::result_type sum_series(Functor& return sum_series(func, factor, max_terms, init_value); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename Functor::result_type sum_series(Functor& func, int bits) noexcept(BOOST_MATH_IS_FLOAT(typename Functor::result_type) #ifndef BOOST_MATH_HAS_GPU_SUPPORT && noexcept(std::declval()()) @@ -86,7 +86,7 @@ BOOST_MATH_GPU_ENABLED inline typename Functor::result_type sum_series(Functor& return sum_series(func, bits, iters, init_val); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename Functor::result_type sum_series(Functor& func, int bits, boost::math::uintmax_t& max_terms) noexcept(BOOST_MATH_IS_FLOAT(typename Functor::result_type) #ifndef BOOST_MATH_HAS_GPU_SUPPORT && noexcept(std::declval()()) @@ -99,7 +99,7 @@ BOOST_MATH_GPU_ENABLED inline typename Functor::result_type sum_series(Functor& return sum_series(func, bits, max_terms, init_val); } -template +BOOST_MATH_EXPORT template 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) #ifndef BOOST_MATH_HAS_GPU_SUPPORT && noexcept(std::declval()()) @@ -113,7 +113,7 @@ BOOST_MATH_GPU_ENABLED inline typename Functor::result_type sum_series(Functor& // // Checked summation: // -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename Functor::result_type checked_sum_series(Functor& func, const U& factor, boost::math::uintmax_t& max_terms, const V& init_value, V& norm) noexcept(BOOST_MATH_IS_FLOAT(typename Functor::result_type) #ifndef BOOST_MATH_HAS_GPU_SUPPORT && noexcept(std::declval()()) @@ -153,7 +153,7 @@ BOOST_MATH_GPU_ENABLED inline typename Functor::result_type checked_sum_series(F // by the algorithm to be off by up to 1ulp. However this occurs rarely, and // in any case the result is still much better than a naive summation. // -template +BOOST_MATH_EXPORT template 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) #ifndef BOOST_MATH_HAS_GPU_SUPPORT && noexcept(std::declval()()) @@ -180,7 +180,7 @@ BOOST_MATH_GPU_ENABLED inline typename Functor::result_type kahan_sum_series(Fun return result; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline typename Functor::result_type kahan_sum_series(Functor& func, int bits, boost::math::uintmax_t& max_terms) noexcept(BOOST_MATH_IS_FLOAT(typename Functor::result_type) #ifndef BOOST_MATH_HAS_GPU_SUPPORT && noexcept(std::declval()()) diff --git a/include/boost/math/tools/simple_continued_fraction.hpp b/include/boost/math/tools/simple_continued_fraction.hpp index 74036c79e6..ba1d220c2b 100644 --- a/include/boost/math/tools/simple_continued_fraction.hpp +++ b/include/boost/math/tools/simple_continued_fraction.hpp @@ -6,6 +6,8 @@ #ifndef BOOST_MATH_TOOLS_SIMPLE_CONTINUED_FRACTION_HPP #define BOOST_MATH_TOOLS_SIMPLE_CONTINUED_FRACTION_HPP +#include + #ifndef BOOST_MATH_BUILD_MODULE #include #include @@ -32,7 +34,7 @@ namespace boost::math::tools { -template +BOOST_MATH_EXPORT template class simple_continued_fraction { public: simple_continued_fraction(Real x) : x_{x} { @@ -151,7 +153,7 @@ class simple_continued_fraction { }; -template +BOOST_MATH_EXPORT template std::ostream& operator<<(std::ostream& out, simple_continued_fraction& scf) { constexpr const int p = std::numeric_limits::max_digits10; if constexpr (p == 2147483647) { diff --git a/include/boost/math/tools/toms748_solve.hpp b/include/boost/math/tools/toms748_solve.hpp index ed2d09444a..6d6b6b64fd 100644 --- a/include/boost/math/tools/toms748_solve.hpp +++ b/include/boost/math/tools/toms748_solve.hpp @@ -29,7 +29,7 @@ namespace boost{ namespace math{ namespace tools{ -template +BOOST_MATH_EXPORT template class eps_tolerance { public: @@ -306,7 +306,7 @@ BOOST_MATH_GPU_ENABLED T cubic_interpolate(const T& a, const T& b, const T& d, } // namespace detail -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED boost::math::pair toms748_solve(F f, const T& ax, const T& bx, const T& fax, const T& fbx, Tol tol, boost::math::uintmax_t& max_iter, const Policy& pol) { // @@ -489,13 +489,13 @@ BOOST_MATH_GPU_ENABLED boost::math::pair toms748_solve(F f, const T& ax, c return boost::math::make_pair(a, b); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline boost::math::pair toms748_solve(F f, const T& ax, const T& bx, const T& fax, const T& fbx, Tol tol, boost::math::uintmax_t& max_iter) { return toms748_solve(f, ax, bx, fax, fbx, tol, max_iter, policies::policy<>()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline boost::math::pair toms748_solve(F f, const T& ax, const T& bx, Tol tol, boost::math::uintmax_t& max_iter, const Policy& pol) { if (max_iter <= 2) @@ -506,13 +506,13 @@ BOOST_MATH_GPU_ENABLED inline boost::math::pair toms748_solve(F f, const T return r; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline boost::math::pair toms748_solve(F f, const T& ax, const T& bx, Tol tol, boost::math::uintmax_t& max_iter) { return toms748_solve(f, ax, bx, tol, max_iter, policies::policy<>()); } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED boost::math::pair bracket_and_solve_root(F f, const T& guess, T factor, bool rising, Tol tol, boost::math::uintmax_t& max_iter, const Policy& pol) { BOOST_MATH_STD_USING @@ -621,7 +621,7 @@ BOOST_MATH_GPU_ENABLED boost::math::pair bracket_and_solve_root(F f, const return r; } -template +BOOST_MATH_EXPORT template BOOST_MATH_GPU_ENABLED inline boost::math::pair bracket_and_solve_root(F f, const T& guess, const T& factor, bool rising, Tol tol, boost::math::uintmax_t& max_iter) { return bracket_and_solve_root(f, guess, factor, rising, tol, max_iter, policies::policy<>()); diff --git a/module/CMakeLists.txt b/module/CMakeLists.txt index 8a2f70e24c..d2509e2ff0 100644 --- a/module/CMakeLists.txt +++ b/module/CMakeLists.txt @@ -65,6 +65,9 @@ set(BOOST_MATH_MODULE_TESTS scipy_issue_17146 ccmath_isinf_test ccmath_isnan_test + git_issue_1139 + cubic_roots_test + quartic_roots_test ) add_executable(module_quick_test "${CMAKE_CURRENT_SOURCE_DIR}/quick_test.cpp") diff --git a/module/math.cxx b/module/math.cxx index f7823e759f..118022e3e8 100644 --- a/module/math.cxx +++ b/module/math.cxx @@ -132,6 +132,28 @@ import std; // Constexpr cmath (umbrella) #include +// Tools (curated public set) +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + #ifdef _MSC_VER # pragma warning( pop ) #elif defined(__clang__) diff --git a/module/quick_test.cpp b/module/quick_test.cpp index 0a6034b814..a79881dcad 100644 --- a/module/quick_test.cpp +++ b/module/quick_test.cpp @@ -57,6 +57,18 @@ int main() static_assert(boost::math::ccmath::isnan(0.0) == false, "ccmath isnan"); static_assert(boost::math::ccmath::sqrt(4.0) == 2.0, "ccmath sqrt"); + // tools + { + const double coeffs[] {1.0, 2.0, 3.0}; + BOOST_TEST_EQ(boost::math::tools::evaluate_polynomial(coeffs, 2.0), 17.0); + const auto roots {boost::math::tools::cubic_roots(1.0, -6.0, 11.0, -6.0)}; + BOOST_TEST_EQ(roots[0], 1.0); + BOOST_TEST_EQ(roots[2], 3.0); + const boost::math::tools::polynomial p {{1.0, 1.0}}; + const auto p2 {p * p}; + BOOST_TEST_EQ(p2[1], 2.0); + } + // distributions { const boost::math::normal_distribution<> dist {}; diff --git a/test/cubic_roots_test.cpp b/test/cubic_roots_test.cpp index b6ee44af2a..fc0a03af8d 100644 --- a/test/cubic_roots_test.cpp +++ b/test/cubic_roots_test.cpp @@ -5,8 +5,13 @@ * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) */ -#include "math_unit_test.hpp" +#ifndef BOOST_MATH_BUILD_MODULE #include +#else +import boost.math; +#endif + +#include "math_unit_test.hpp" #include #include #include diff --git a/test/git_issue_1139.cpp b/test/git_issue_1139.cpp index 5bca58ec8e..e58fe98d4f 100644 --- a/test/git_issue_1139.cpp +++ b/test/git_issue_1139.cpp @@ -5,8 +5,13 @@ // // See: https://github.com/boostorg/math/issues/1139 -#include "math_unit_test.hpp" +#ifndef BOOST_MATH_BUILD_MODULE #include +#else +import boost.math; +#endif + +#include "math_unit_test.hpp" int main() { diff --git a/test/quartic_roots_test.cpp b/test/quartic_roots_test.cpp index f46330e3d1..df9d242d0c 100644 --- a/test/quartic_roots_test.cpp +++ b/test/quartic_roots_test.cpp @@ -5,9 +5,14 @@ * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) */ +#ifndef BOOST_MATH_BUILD_MODULE +#include +#else +import boost.math; +#endif + #include "math_unit_test.hpp" #include -#include #ifdef BOOST_HAS_FLOAT128 #include using boost::multiprecision::float128; From 88d19ef7bfe0601e33ec350f92891da834b6107c Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Wed, 15 Jul 2026 11:08:30 -0400 Subject: [PATCH 07/27] Export quadrature and the modern interpolators for the boost.math module * BOOST_MATH_EXPORT on the integrator class templates, trapezoidal and the wavelet transform, plus the interpolator class templates and their stream operators * Adds the quadrature and interpolator headers to the module interface unit (cardinal_trigonometric and the deprecated boost::math namespace shims stay textual only) * Module test harness gains git_issue_898, cardinal_quadratic_b_spline_test and whittaker_shannon_test --- Testing/Temporary/CTestCostData.txt | 1 + .../interpolators/barycentric_rational.hpp | 2 +- .../math/interpolators/bezier_polynomial.hpp | 4 ++- .../math/interpolators/bilinear_uniform.hpp | 4 ++- .../interpolators/cardinal_cubic_b_spline.hpp | 2 +- .../cardinal_quadratic_b_spline.hpp | 4 ++- .../cardinal_quintic_b_spline.hpp | 2 +- .../boost/math/interpolators/catmull_rom.hpp | 4 ++- .../math/interpolators/cubic_hermite.hpp | 8 ++++-- include/boost/math/interpolators/makima.hpp | 4 ++- include/boost/math/interpolators/pchip.hpp | 4 ++- .../math/interpolators/quintic_hermite.hpp | 8 ++++-- .../math/interpolators/septic_hermite.hpp | 8 ++++-- .../vector_barycentric_rational.hpp | 2 +- .../math/interpolators/whittaker_shannon.hpp | 2 +- include/boost/math/quadrature/exp_sinh.hpp | 2 +- include/boost/math/quadrature/gauss.hpp | 2 +- .../boost/math/quadrature/gauss_kronrod.hpp | 2 +- .../math/quadrature/naive_monte_carlo.hpp | 2 +- .../quadrature/ooura_fourier_integrals.hpp | 4 +-- include/boost/math/quadrature/sinh_sinh.hpp | 2 +- include/boost/math/quadrature/tanh_sinh.hpp | 2 +- include/boost/math/quadrature/trapezoidal.hpp | 4 +-- .../math/quadrature/wavelet_transforms.hpp | 2 +- module/CMakeLists.txt | 3 ++ module/math.cxx | 28 +++++++++++++++++++ module/quick_test.cpp | 14 ++++++++++ test/cardinal_quadratic_b_spline_test.cpp | 7 ++++- test/git_issue_898.cpp | 5 ++++ test/whittaker_shannon_test.cpp | 7 ++++- 30 files changed, 112 insertions(+), 33 deletions(-) create mode 100644 Testing/Temporary/CTestCostData.txt diff --git a/Testing/Temporary/CTestCostData.txt b/Testing/Temporary/CTestCostData.txt new file mode 100644 index 0000000000..ed97d539c0 --- /dev/null +++ b/Testing/Temporary/CTestCostData.txt @@ -0,0 +1 @@ +--- diff --git a/include/boost/math/interpolators/barycentric_rational.hpp b/include/boost/math/interpolators/barycentric_rational.hpp index 2286a1bdf0..860ed3b043 100644 --- a/include/boost/math/interpolators/barycentric_rational.hpp +++ b/include/boost/math/interpolators/barycentric_rational.hpp @@ -33,7 +33,7 @@ namespace boost{ namespace math{ namespace interpolators{ -template +BOOST_MATH_EXPORT template class barycentric_rational { public: diff --git a/include/boost/math/interpolators/bezier_polynomial.hpp b/include/boost/math/interpolators/bezier_polynomial.hpp index 0a4c66a7c2..03c555bf62 100644 --- a/include/boost/math/interpolators/bezier_polynomial.hpp +++ b/include/boost/math/interpolators/bezier_polynomial.hpp @@ -5,6 +5,8 @@ // or copy at http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_MATH_INTERPOLATORS_BEZIER_POLYNOMIAL_HPP #define BOOST_MATH_INTERPOLATORS_BEZIER_POLYNOMIAL_HPP + +#include #ifndef BOOST_MATH_BUILD_MODULE #include #endif @@ -16,7 +18,7 @@ namespace boost::math::interpolators { -template +BOOST_MATH_EXPORT template class bezier_polynomial { public: diff --git a/include/boost/math/interpolators/bilinear_uniform.hpp b/include/boost/math/interpolators/bilinear_uniform.hpp index 667d85f711..4271fd41cd 100644 --- a/include/boost/math/interpolators/bilinear_uniform.hpp +++ b/include/boost/math/interpolators/bilinear_uniform.hpp @@ -17,6 +17,8 @@ #ifndef BOOST_MATH_INTERPOLATORS_BILINEAR_UNIFORM_HPP #define BOOST_MATH_INTERPOLATORS_BILINEAR_UNIFORM_HPP +#include + #ifndef BOOST_MATH_BUILD_MODULE #include #include @@ -25,7 +27,7 @@ namespace boost::math::interpolators { -template +BOOST_MATH_EXPORT template class bilinear_uniform { public: diff --git a/include/boost/math/interpolators/cardinal_cubic_b_spline.hpp b/include/boost/math/interpolators/cardinal_cubic_b_spline.hpp index 1a38caebae..e9f2b176da 100644 --- a/include/boost/math/interpolators/cardinal_cubic_b_spline.hpp +++ b/include/boost/math/interpolators/cardinal_cubic_b_spline.hpp @@ -26,7 +26,7 @@ namespace boost{ namespace math{ namespace interpolators { -template +BOOST_MATH_EXPORT template class cardinal_cubic_b_spline { public: diff --git a/include/boost/math/interpolators/cardinal_quadratic_b_spline.hpp b/include/boost/math/interpolators/cardinal_quadratic_b_spline.hpp index 0f135f62c5..3e6037da12 100644 --- a/include/boost/math/interpolators/cardinal_quadratic_b_spline.hpp +++ b/include/boost/math/interpolators/cardinal_quadratic_b_spline.hpp @@ -6,6 +6,8 @@ #ifndef BOOST_MATH_INTERPOLATORS_CARDINAL_QUADRATIC_B_SPLINE_HPP #define BOOST_MATH_INTERPOLATORS_CARDINAL_QUADRATIC_B_SPLINE_HPP + +#include #ifndef BOOST_MATH_BUILD_MODULE #include #endif @@ -14,7 +16,7 @@ namespace boost{ namespace math{ namespace interpolators { -template +BOOST_MATH_EXPORT template class cardinal_quadratic_b_spline { public: diff --git a/include/boost/math/interpolators/cardinal_quintic_b_spline.hpp b/include/boost/math/interpolators/cardinal_quintic_b_spline.hpp index e47b2177ac..0325032761 100644 --- a/include/boost/math/interpolators/cardinal_quintic_b_spline.hpp +++ b/include/boost/math/interpolators/cardinal_quintic_b_spline.hpp @@ -15,7 +15,7 @@ namespace boost{ namespace math{ namespace interpolators { -template +BOOST_MATH_EXPORT template class cardinal_quintic_b_spline { public: diff --git a/include/boost/math/interpolators/catmull_rom.hpp b/include/boost/math/interpolators/catmull_rom.hpp index a3bac29f7b..0387c8253f 100644 --- a/include/boost/math/interpolators/catmull_rom.hpp +++ b/include/boost/math/interpolators/catmull_rom.hpp @@ -9,6 +9,8 @@ #ifndef BOOST_MATH_INTERPOLATORS_CATMULL_ROM #define BOOST_MATH_INTERPOLATORS_CATMULL_ROM +#include + #ifndef BOOST_MATH_BUILD_MODULE #include #include @@ -55,7 +57,7 @@ namespace boost{ namespace math{ } } -template > +BOOST_MATH_EXPORT template > class catmull_rom { typedef typename Point::value_type value_type; diff --git a/include/boost/math/interpolators/cubic_hermite.hpp b/include/boost/math/interpolators/cubic_hermite.hpp index b4204e5c04..88f26fb953 100644 --- a/include/boost/math/interpolators/cubic_hermite.hpp +++ b/include/boost/math/interpolators/cubic_hermite.hpp @@ -6,6 +6,8 @@ #ifndef BOOST_MATH_INTERPOLATORS_CUBIC_HERMITE_HPP #define BOOST_MATH_INTERPOLATORS_CUBIC_HERMITE_HPP + +#include #ifndef BOOST_MATH_BUILD_MODULE #include #endif @@ -18,7 +20,7 @@ namespace boost { namespace math { namespace interpolators { -template +BOOST_MATH_EXPORT template class cubic_hermite { public: using Real = typename RandomAccessContainer::value_type; @@ -60,7 +62,7 @@ class cubic_hermite { std::shared_ptr> impl_; }; -template +BOOST_MATH_EXPORT template class cardinal_cubic_hermite { public: using Real = typename RandomAccessContainer::value_type; @@ -100,7 +102,7 @@ class cardinal_cubic_hermite { }; -template +BOOST_MATH_EXPORT template class cardinal_cubic_hermite_aos { public: using Point = typename RandomAccessContainer::value_type; diff --git a/include/boost/math/interpolators/makima.hpp b/include/boost/math/interpolators/makima.hpp index 05c919c9d4..3f323a4203 100644 --- a/include/boost/math/interpolators/makima.hpp +++ b/include/boost/math/interpolators/makima.hpp @@ -9,6 +9,8 @@ #ifndef BOOST_MATH_INTERPOLATORS_MAKIMA_HPP #define BOOST_MATH_INTERPOLATORS_MAKIMA_HPP + +#include #ifndef BOOST_MATH_BUILD_MODULE #include #include @@ -19,7 +21,7 @@ namespace boost { namespace math { namespace interpolators { -template +BOOST_MATH_EXPORT template class makima { public: using Real = typename RandomAccessContainer::value_type; diff --git a/include/boost/math/interpolators/pchip.hpp b/include/boost/math/interpolators/pchip.hpp index b5b8b17039..ff507ceeda 100644 --- a/include/boost/math/interpolators/pchip.hpp +++ b/include/boost/math/interpolators/pchip.hpp @@ -6,6 +6,8 @@ #ifndef BOOST_MATH_INTERPOLATORS_PCHIP_HPP #define BOOST_MATH_INTERPOLATORS_PCHIP_HPP + +#include #ifndef BOOST_MATH_BUILD_MODULE #include #include @@ -16,7 +18,7 @@ namespace boost { namespace math { namespace interpolators { -template +BOOST_MATH_EXPORT template class pchip { public: using Real = typename RandomAccessContainer::value_type; diff --git a/include/boost/math/interpolators/quintic_hermite.hpp b/include/boost/math/interpolators/quintic_hermite.hpp index 762678f908..5fc5d493ab 100644 --- a/include/boost/math/interpolators/quintic_hermite.hpp +++ b/include/boost/math/interpolators/quintic_hermite.hpp @@ -7,6 +7,8 @@ #ifndef BOOST_MATH_INTERPOLATORS_QUINTIC_HERMITE_HPP #define BOOST_MATH_INTERPOLATORS_QUINTIC_HERMITE_HPP + +#include #ifndef BOOST_MATH_BUILD_MODULE #include #include @@ -19,7 +21,7 @@ namespace boost { namespace math { namespace interpolators { -template +BOOST_MATH_EXPORT template class quintic_hermite { public: using Real = typename RandomAccessContainer::value_type; @@ -67,7 +69,7 @@ class quintic_hermite { std::shared_ptr> impl_; }; -template +BOOST_MATH_EXPORT template class cardinal_quintic_hermite { public: using Real = typename RandomAccessContainer::value_type; @@ -102,7 +104,7 @@ class cardinal_quintic_hermite { std::shared_ptr> impl_; }; -template +BOOST_MATH_EXPORT template class cardinal_quintic_hermite_aos { public: using Point = typename RandomAccessContainer::value_type; diff --git a/include/boost/math/interpolators/septic_hermite.hpp b/include/boost/math/interpolators/septic_hermite.hpp index 23fa563af4..d2eae92e00 100644 --- a/include/boost/math/interpolators/septic_hermite.hpp +++ b/include/boost/math/interpolators/septic_hermite.hpp @@ -6,6 +6,8 @@ */ #ifndef BOOST_MATH_INTERPOLATORS_SEPTIC_HERMITE_HPP #define BOOST_MATH_INTERPOLATORS_SEPTIC_HERMITE_HPP + +#include #ifndef BOOST_MATH_BUILD_MODULE #include #include @@ -18,7 +20,7 @@ namespace boost { namespace math { namespace interpolators { -template +BOOST_MATH_EXPORT template class septic_hermite { public: @@ -64,7 +66,7 @@ class septic_hermite std::shared_ptr> impl_; }; -template +BOOST_MATH_EXPORT template class cardinal_septic_hermite { public: @@ -105,7 +107,7 @@ class cardinal_septic_hermite }; -template +BOOST_MATH_EXPORT template class cardinal_septic_hermite_aos { public: using Point = typename RandomAccessContainer::value_type; diff --git a/include/boost/math/interpolators/vector_barycentric_rational.hpp b/include/boost/math/interpolators/vector_barycentric_rational.hpp index 34a0dd5a4c..e06c87ccd3 100644 --- a/include/boost/math/interpolators/vector_barycentric_rational.hpp +++ b/include/boost/math/interpolators/vector_barycentric_rational.hpp @@ -19,7 +19,7 @@ namespace boost{ namespace math{ namespace interpolators{ -template +BOOST_MATH_EXPORT template class vector_barycentric_rational { public: diff --git a/include/boost/math/interpolators/whittaker_shannon.hpp b/include/boost/math/interpolators/whittaker_shannon.hpp index 55ba8ceec5..0834c7f45c 100644 --- a/include/boost/math/interpolators/whittaker_shannon.hpp +++ b/include/boost/math/interpolators/whittaker_shannon.hpp @@ -12,7 +12,7 @@ namespace boost { namespace math { namespace interpolators { -template +BOOST_MATH_EXPORT template class whittaker_shannon { public: diff --git a/include/boost/math/quadrature/exp_sinh.hpp b/include/boost/math/quadrature/exp_sinh.hpp index c6eddedcbe..7eae7249c0 100644 --- a/include/boost/math/quadrature/exp_sinh.hpp +++ b/include/boost/math/quadrature/exp_sinh.hpp @@ -29,7 +29,7 @@ namespace boost{ namespace math{ namespace quadrature { -template > +BOOST_MATH_EXPORT template > class exp_sinh { public: diff --git a/include/boost/math/quadrature/gauss.hpp b/include/boost/math/quadrature/gauss.hpp index 758568c233..414c9bef4c 100644 --- a/include/boost/math/quadrature/gauss.hpp +++ b/include/boost/math/quadrature/gauss.hpp @@ -773,7 +773,7 @@ class gauss_detail } -template > +BOOST_MATH_EXPORT template > class gauss : public detail::gauss_detail::value> { typedef detail::gauss_detail::value> base; diff --git a/include/boost/math/quadrature/gauss_kronrod.hpp b/include/boost/math/quadrature/gauss_kronrod.hpp index ed9920a6c5..b4d6f1f9f8 100644 --- a/include/boost/math/quadrature/gauss_kronrod.hpp +++ b/include/boost/math/quadrature/gauss_kronrod.hpp @@ -1127,7 +1127,7 @@ class gauss_kronrod_detail } -template > +BOOST_MATH_EXPORT template > class gauss_kronrod : public detail::gauss_kronrod_detail::value> { typedef detail::gauss_kronrod_detail::value> base; diff --git a/include/boost/math/quadrature/naive_monte_carlo.hpp b/include/boost/math/quadrature/naive_monte_carlo.hpp index f5b1ba4147..a042b1a3e5 100644 --- a/include/boost/math/quadrature/naive_monte_carlo.hpp +++ b/include/boost/math/quadrature/naive_monte_carlo.hpp @@ -41,7 +41,7 @@ namespace detail { DOUBLE_INFINITE}; } -template, +BOOST_MATH_EXPORT template, typename std::enable_if::value, bool>::type = true> class naive_monte_carlo { diff --git a/include/boost/math/quadrature/ooura_fourier_integrals.hpp b/include/boost/math/quadrature/ooura_fourier_integrals.hpp index 8d7c24287c..40166b3c28 100644 --- a/include/boost/math/quadrature/ooura_fourier_integrals.hpp +++ b/include/boost/math/quadrature/ooura_fourier_integrals.hpp @@ -18,7 +18,7 @@ namespace boost { namespace math { namespace quadrature { -template +BOOST_MATH_EXPORT template class ooura_fourier_sin { public: ooura_fourier_sin(const Real relative_error_tolerance = tools::root_epsilon(), size_t levels = sizeof(Real)) : impl_(std::make_shared>(relative_error_tolerance, levels)) @@ -51,7 +51,7 @@ class ooura_fourier_sin { }; -template +BOOST_MATH_EXPORT template class ooura_fourier_cos { public: ooura_fourier_cos(const Real relative_error_tolerance = tools::root_epsilon(), size_t levels = sizeof(Real)) : impl_(std::make_shared>(relative_error_tolerance, levels)) diff --git a/include/boost/math/quadrature/sinh_sinh.hpp b/include/boost/math/quadrature/sinh_sinh.hpp index 5166d459b1..12a0640222 100644 --- a/include/boost/math/quadrature/sinh_sinh.hpp +++ b/include/boost/math/quadrature/sinh_sinh.hpp @@ -32,7 +32,7 @@ namespace boost{ namespace math{ namespace quadrature { -template > +BOOST_MATH_EXPORT template > class sinh_sinh { public: diff --git a/include/boost/math/quadrature/tanh_sinh.hpp b/include/boost/math/quadrature/tanh_sinh.hpp index 9bb21c0be3..f417b36064 100644 --- a/include/boost/math/quadrature/tanh_sinh.hpp +++ b/include/boost/math/quadrature/tanh_sinh.hpp @@ -38,7 +38,7 @@ namespace boost{ namespace math{ namespace quadrature { -template > +BOOST_MATH_EXPORT template > class tanh_sinh { public: diff --git a/include/boost/math/quadrature/trapezoidal.hpp b/include/boost/math/quadrature/trapezoidal.hpp index 83f37125ed..7a257f85a0 100644 --- a/include/boost/math/quadrature/trapezoidal.hpp +++ b/include/boost/math/quadrature/trapezoidal.hpp @@ -28,7 +28,7 @@ namespace boost{ namespace math{ namespace quadrature { -template +BOOST_MATH_EXPORT template auto trapezoidal(F f, Real a, Real b, Real tol, std::size_t max_refinements, Real* error_estimate, Real* L1, const Policy& pol)->decltype(std::declval()(std::declval())) { static const char* function = "boost::math::quadrature::trapezoidal<%1%>(F, %1%, %1%, %1%)"; @@ -117,7 +117,7 @@ auto trapezoidal(F f, Real a, Real b, Real tol, std::size_t max_refinements, Rea return static_cast(I1); } -template +BOOST_MATH_EXPORT template auto trapezoidal(F f, Real a, Real b, Real tol = boost::math::tools::root_epsilon(), std::size_t max_refinements = 12, Real* error_estimate = nullptr, Real* L1 = nullptr)->decltype(std::declval()(std::declval())) { return trapezoidal(f, a, b, tol, max_refinements, error_estimate, L1, boost::math::policies::policy<>()); diff --git a/include/boost/math/quadrature/wavelet_transforms.hpp b/include/boost/math/quadrature/wavelet_transforms.hpp index 7c811d5caf..416f4c77cc 100644 --- a/include/boost/math/quadrature/wavelet_transforms.hpp +++ b/include/boost/math/quadrature/wavelet_transforms.hpp @@ -11,7 +11,7 @@ namespace boost::math::quadrature { -template +BOOST_MATH_EXPORT template class daubechies_wavelet_transform { public: diff --git a/module/CMakeLists.txt b/module/CMakeLists.txt index d2509e2ff0..823cc7f4d0 100644 --- a/module/CMakeLists.txt +++ b/module/CMakeLists.txt @@ -68,6 +68,9 @@ set(BOOST_MATH_MODULE_TESTS git_issue_1139 cubic_roots_test quartic_roots_test + git_issue_898 + cardinal_quadratic_b_spline_test + whittaker_shannon_test ) add_executable(module_quick_test "${CMAKE_CURRENT_SOURCE_DIR}/quick_test.cpp") diff --git a/module/math.cxx b/module/math.cxx index 118022e3e8..02f90e4177 100644 --- a/module/math.cxx +++ b/module/math.cxx @@ -154,6 +154,34 @@ import std; #include #include +// Quadrature +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Interpolators (the deprecated boost::math namespace shims and the FFTW +// dependent cardinal_trigonometric interpolator are intentionally excluded) +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + #ifdef _MSC_VER # pragma warning( pop ) #elif defined(__clang__) diff --git a/module/quick_test.cpp b/module/quick_test.cpp index a79881dcad..adf179f5f6 100644 --- a/module/quick_test.cpp +++ b/module/quick_test.cpp @@ -13,6 +13,7 @@ import std; #else #include #include +#include #endif import boost.math; @@ -69,6 +70,19 @@ int main() BOOST_TEST_EQ(p2[1], 2.0); } + // quadrature and interpolators + { + const auto integral {boost::math::quadrature::trapezoidal( + [](double x) { return x * x; }, 0.0, 1.0)}; + BOOST_TEST_GT(integral, 0.333); + BOOST_TEST_LT(integral, 0.334); + std::vector v {0.0, 1.0, 4.0, 9.0, 16.0}; + boost::math::interpolators::cardinal_cubic_b_spline spline {v.data(), v.size(), 0.0, 1.0}; + const auto interp {spline(2.0)}; + BOOST_TEST_GT(interp, 3.9); + BOOST_TEST_LT(interp, 4.1); + } + // distributions { const boost::math::normal_distribution<> dist {}; diff --git a/test/cardinal_quadratic_b_spline_test.cpp b/test/cardinal_quadratic_b_spline_test.cpp index 3955d4f572..74385b130c 100644 --- a/test/cardinal_quadratic_b_spline_test.cpp +++ b/test/cardinal_quadratic_b_spline_test.cpp @@ -5,13 +5,18 @@ * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) */ +#ifndef BOOST_MATH_BUILD_MODULE +#include +#else +import boost.math; +#endif + #include "math_unit_test.hpp" #include #include #include #include #include -#include using boost::math::interpolators::cardinal_quadratic_b_spline; #if __has_include() diff --git a/test/git_issue_898.cpp b/test/git_issue_898.cpp index 4316dfbd4d..300976d5d3 100644 --- a/test/git_issue_898.cpp +++ b/test/git_issue_898.cpp @@ -6,8 +6,13 @@ #include #include +#ifndef BOOST_MATH_BUILD_MODULE #include #include +#else +import boost.math; +#endif + #include "math_unit_test.hpp" // numerically evaluate the integral for Stefan-Boltzmann Law from Planck's Law diff --git a/test/whittaker_shannon_test.cpp b/test/whittaker_shannon_test.cpp index 0ca97daaec..cf64ec9952 100644 --- a/test/whittaker_shannon_test.cpp +++ b/test/whittaker_shannon_test.cpp @@ -5,12 +5,17 @@ * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) */ +#ifndef BOOST_MATH_BUILD_MODULE +#include +#else +import boost.math; +#endif + #include "math_unit_test.hpp" #include #include #include #include -#include #if __has_include() # include From 39b0970cf7ff86406f86d8a8dec5abd757f567cf Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Wed, 15 Jul 2026 11:16:46 -0400 Subject: [PATCH 08/27] Export statistics and optimization for the boost.math module * BOOST_MATH_EXPORT on the statistics free functions (univariate, bivariate, tests, regression, signal) and the optimization algorithms, parameter structs and constraint/convergence policies * BOOST_MATH_TEST_EXPORT on the optimization detail helpers the differential evolution test exercises directly * Adds the statistics and optimization headers to the module interface unit; cma_es is excluded because it requires Eigen * test_functions_for_optimization.hpp resolves constants through the import in module mode * Module test harness gains test_runs_test, linear_regression_test, ljung_box_test, differential_evolution_test and random_search_test --- include/boost/math/optimization/cma_es.hpp | 6 +- .../boost/math/optimization/detail/common.hpp | 6 +- .../optimization/differential_evolution.hpp | 8 +- .../math/optimization/gradient_descent.hpp | 8 +- include/boost/math/optimization/jso.hpp | 8 +- include/boost/math/optimization/lbfgs.hpp | 12 +- include/boost/math/optimization/minimizer.hpp | 30 +-- include/boost/math/optimization/nesterov.hpp | 8 +- .../boost/math/optimization/random_search.hpp | 8 +- .../math/statistics/anderson_darling.hpp | 2 +- .../math/statistics/bivariate_statistics.hpp | 24 +- .../statistics/chatterjee_correlation.hpp | 8 +- .../math/statistics/linear_regression.hpp | 8 +- include/boost/math/statistics/ljung_box.hpp | 4 +- include/boost/math/statistics/runs_test.hpp | 4 +- .../math/statistics/signal_statistics.hpp | 28 +-- include/boost/math/statistics/t_test.hpp | 28 +-- .../math/statistics/univariate_statistics.hpp | 220 +++++++++--------- include/boost/math/statistics/z_test.hpp | 20 +- module/CMakeLists.txt | 5 + module/math.cxx | 22 ++ module/quick_test.cpp | 11 + test/differential_evolution_test.cpp | 7 +- test/linear_regression_test.cpp | 7 +- test/ljung_box_test.cpp | 7 +- test/random_search_test.cpp | 7 +- test/test_functions_for_optimization.hpp | 2 + test/test_runs_test.cpp | 7 +- 28 files changed, 293 insertions(+), 222 deletions(-) diff --git a/include/boost/math/optimization/cma_es.hpp b/include/boost/math/optimization/cma_es.hpp index 06b22aea7d..2299976eb1 100644 --- a/include/boost/math/optimization/cma_es.hpp +++ b/include/boost/math/optimization/cma_es.hpp @@ -40,7 +40,7 @@ namespace boost::math::optimization { -template struct cma_es_parameters { +BOOST_MATH_EXPORT template struct cma_es_parameters { using Real = typename ArgumentContainer::value_type; using DimensionlessReal = decltype(Real()/Real()); ArgumentContainer lower_bounds; @@ -55,7 +55,7 @@ template struct cma_es_parameters { DimensionlessReal learning_rate = 1; }; -template +BOOST_MATH_EXPORT template void validate_cma_es_parameters(cma_es_parameters ¶ms) { using Real = typename ArgumentContainer::value_type; using DimensionlessReal = decltype(Real()/Real()); @@ -86,7 +86,7 @@ void validate_cma_es_parameters(cma_es_parameters ¶ms) { } } -template +BOOST_MATH_EXPORT template ArgumentContainer cma_es( const Func cost_function, cma_es_parameters ¶ms, diff --git a/include/boost/math/optimization/detail/common.hpp b/include/boost/math/optimization/detail/common.hpp index 3882a24d20..59ca39aa75 100644 --- a/include/boost/math/optimization/detail/common.hpp +++ b/include/boost/math/optimization/detail/common.hpp @@ -66,7 +66,7 @@ void validate_bounds(ArgumentContainer const &lower_bounds, ArgumentContainer co } } -template +BOOST_MATH_TEST_EXPORT template std::vector random_initial_population(ArgumentContainer const &lower_bounds, ArgumentContainer const &upper_bounds, size_t initial_population_size, URBG &&gen) { @@ -114,7 +114,7 @@ std::vector random_initial_population(ArgumentContainer const return population; } -template +BOOST_MATH_TEST_EXPORT template void validate_initial_guess(ArgumentContainer const &initial_guess, ArgumentContainer const &lower_bounds, ArgumentContainer const &upper_bounds) { using std::isfinite; @@ -146,7 +146,7 @@ void validate_initial_guess(ArgumentContainer const &initial_guess, ArgumentCont } // Return indices corresponding to the minimum function values. -template std::vector best_indices(std::vector const &function_values) { +BOOST_MATH_TEST_EXPORT template std::vector best_indices(std::vector const &function_values) { using std::isnan; const size_t n = function_values.size(); std::vector indices(n); diff --git a/include/boost/math/optimization/differential_evolution.hpp b/include/boost/math/optimization/differential_evolution.hpp index f9699032f7..95c73643e0 100644 --- a/include/boost/math/optimization/differential_evolution.hpp +++ b/include/boost/math/optimization/differential_evolution.hpp @@ -6,6 +6,8 @@ */ #ifndef BOOST_MATH_OPTIMIZATION_DIFFERENTIAL_EVOLUTION_HPP #define BOOST_MATH_OPTIMIZATION_DIFFERENTIAL_EVOLUTION_HPP + +#include #ifndef BOOST_MATH_BUILD_MODULE #include #endif @@ -31,7 +33,7 @@ namespace boost::math::optimization { // https://www.cp.eng.chula.ac.th/~prabhas//teaching/ec/ec2012/storn_price_de.pdf // We provide the parameters in a struct-there are too many of them and they are too unwieldy to pass individually: -template struct differential_evolution_parameters { +BOOST_MATH_EXPORT template struct differential_evolution_parameters { using Real = typename ArgumentContainer::value_type; using DimensionlessReal = decltype(Real()/Real()); ArgumentContainer lower_bounds; @@ -46,7 +48,7 @@ template struct differential_evolution_parameters { unsigned threads = std::thread::hardware_concurrency(); }; -template +BOOST_MATH_EXPORT template void validate_differential_evolution_parameters(differential_evolution_parameters const &de_params) { using std::isfinite; using std::isnan; @@ -84,7 +86,7 @@ void validate_differential_evolution_parameters(differential_evolution_parameter } } -template +BOOST_MATH_EXPORT template ArgumentContainer differential_evolution( const Func cost_function, differential_evolution_parameters const &de_params, URBG &gen, std::invoke_result_t target_value = diff --git a/include/boost/math/optimization/gradient_descent.hpp b/include/boost/math/optimization/gradient_descent.hpp index 68972e2968..dc2db10b79 100644 --- a/include/boost/math/optimization/gradient_descent.hpp +++ b/include/boost/math/optimization/gradient_descent.hpp @@ -12,7 +12,7 @@ namespace boost { namespace math { namespace optimization { -template +BOOST_MATH_EXPORT template struct gradient_descent_update_policy { RealType lr_; @@ -124,7 +124,7 @@ class gradient_descent * custom learning rate */ -template +BOOST_MATH_EXPORT template auto make_gradient_descent(Objective&& obj, ArgumentContainer& x, @@ -144,7 +144,7 @@ make_gradient_descent(Objective&& obj, gradient_descent_update_policy(lr)); } -template @@ -168,7 +168,7 @@ make_gradient_descent(Objective&& obj, gradient_descent_update_policy(lr)); } -template #ifndef BOOST_MATH_BUILD_MODULE #include #endif @@ -35,7 +37,7 @@ namespace boost::math::optimization { // to understand without also reading: Zhang, J., & Sanderson, A. C. (2009). // JADE: adaptive differential evolution with optional external archive. // IEEE Transactions on evolutionary computation, 13(5), 945-958." -template struct jso_parameters { +BOOST_MATH_EXPORT template struct jso_parameters { using Real = typename ArgumentContainer::value_type; using DimensionlessReal = decltype(Real()/Real()); ArgumentContainer lower_bounds; @@ -53,7 +55,7 @@ template struct jso_parameters { ArgumentContainer const *initial_guess = nullptr; }; -template +BOOST_MATH_EXPORT template void validate_jso_parameters(jso_parameters &jso_params) { using std::isfinite; using std::isnan; @@ -95,7 +97,7 @@ void validate_jso_parameters(jso_parameters &jso_params) { } } -template +BOOST_MATH_EXPORT template ArgumentContainer jso(const Func cost_function, jso_parameters &jso_params, URBG &gen, diff --git a/include/boost/math/optimization/lbfgs.hpp b/include/boost/math/optimization/lbfgs.hpp index 6fb778ccaf..cddb46d77e 100644 --- a/include/boost/math/optimization/lbfgs.hpp +++ b/include/boost/math/optimization/lbfgs.hpp @@ -39,7 +39,7 @@ namespace optimization { * pages 176-180 * algorithms 7.4/7.5 * */ -template +BOOST_MATH_EXPORT template struct lbfgs_optimizer_state { size_t m = 10; // default history length @@ -100,7 +100,7 @@ struct lbfgs_optimizer_state /** @brief> helper update for l-bfgs * x += alpha * search direction * */ -template +BOOST_MATH_EXPORT template struct lbfgs_update_policy { template +BOOST_MATH_EXPORT template auto make_lbfgs(Objective&& obj, ArgumentContainer& x, std::size_t m = 10) { @@ -290,7 +290,7 @@ make_lbfgs(Objective&& obj, ArgumentContainer& x, std::size_t m = 10) strong_wolfe_line_search_policy{}); } -template auto @@ -318,7 +318,7 @@ make_lbfgs(Objective&& obj, strong_wolfe_line_search_policy{}); } -template @@ -348,7 +348,7 @@ make_lbfgs(Objective&& obj, std::forward(lsp)); } -template +BOOST_MATH_EXPORT template struct optimization_result { size_t num_iter = 0; @@ -22,7 +22,7 @@ struct optimization_result bool converged; }; -template +BOOST_MATH_EXPORT template std::ostream& operator<<(std::ostream& os, const optimization_result& r) { @@ -42,7 +42,7 @@ operator<<(std::ostream& os, const optimization_result& r) return os; } /*****************************************************************************************/ -template +BOOST_MATH_EXPORT template struct gradient_norm_convergence_policy { RealType tol_; @@ -58,7 +58,7 @@ struct gradient_norm_convergence_policy } }; -template +BOOST_MATH_EXPORT template struct objective_tol_convergence_policy { RealType tol_; @@ -86,7 +86,7 @@ struct objective_tol_convergence_policy } }; -template +BOOST_MATH_EXPORT template struct relative_objective_tol_policy { RealType rel_tol_; @@ -115,7 +115,7 @@ struct relative_objective_tol_policy } }; -template +BOOST_MATH_EXPORT template struct combined_convergence_policy { Policy1 p1_; @@ -167,13 +167,13 @@ struct wallclock_termination_policy }; /*****************************************************************************************/ -template +BOOST_MATH_EXPORT template struct unconstrained_policy { void operator()(ArgumentContainer&) {} }; -template +BOOST_MATH_EXPORT template struct box_constraints { RealType min_, max_; @@ -188,7 +188,7 @@ struct box_constraints } }; -template +BOOST_MATH_EXPORT template struct nonnegativity_constraint { void operator()(ArgumentContainer& x) const @@ -199,7 +199,7 @@ struct nonnegativity_constraint } } }; -template +BOOST_MATH_EXPORT template struct l2_ball_constraint { RealType radius_; @@ -220,7 +220,7 @@ struct l2_ball_constraint } }; -template +BOOST_MATH_EXPORT template struct l1_ball_constraint { RealType radius_; @@ -241,7 +241,7 @@ struct l1_ball_constraint } } }; -template +BOOST_MATH_EXPORT template struct simplex_constraint { void operator()(ArgumentContainer& x) const @@ -259,7 +259,7 @@ struct simplex_constraint } }; -template +BOOST_MATH_EXPORT template struct function_constraint { using func_t = void (*)(ArgumentContainer&); @@ -273,7 +273,7 @@ struct function_constraint void operator()(ArgumentContainer& x) const { f_(x); } }; -template +BOOST_MATH_EXPORT template struct unit_sphere_constraint { void operator()(ArgumentContainer& x) const @@ -315,7 +315,7 @@ minimize_impl(Optimizer& opt, result.converged = converged(opt.gradients(), opt.objective_value()); return result; } -template, class ConvergencePolicy = diff --git a/include/boost/math/optimization/nesterov.hpp b/include/boost/math/optimization/nesterov.hpp index f6611d8aef..78491d2f1d 100644 --- a/include/boost/math/optimization/nesterov.hpp +++ b/include/boost/math/optimization/nesterov.hpp @@ -20,7 +20,7 @@ namespace rdiff = boost::math::differentiation::reverse_mode; /** * @brief The nesterov_update_policy class */ -template +BOOST_MATH_EXPORT template struct nesterov_update_policy { RealType lr_, mu_; @@ -130,7 +130,7 @@ class nesterov_accelerated_gradient } } }; -template +BOOST_MATH_EXPORT template auto make_nag(Objective&& obj, ArgumentContainer& x, @@ -151,7 +151,7 @@ make_nag(Objective&& obj, reverse_mode_gradient_evaluation_policy{}, nesterov_update_policy(lr, mu)); } -template @@ -176,7 +176,7 @@ make_nag(Objective&& obj, reverse_mode_gradient_evaluation_policy{}, nesterov_update_policy(lr, mu)); } -template #ifndef BOOST_MATH_BUILD_MODULE #include #include @@ -22,7 +24,7 @@ namespace boost::math::optimization { -template struct random_search_parameters { +BOOST_MATH_EXPORT template struct random_search_parameters { using Real = typename ArgumentContainer::value_type; ArgumentContainer lower_bounds; ArgumentContainer upper_bounds; @@ -31,7 +33,7 @@ template struct random_search_parameters { unsigned threads = std::thread::hardware_concurrency(); }; -template +BOOST_MATH_EXPORT template void validate_random_search_parameters(random_search_parameters const ¶ms) { using std::isfinite; using std::isnan; @@ -47,7 +49,7 @@ void validate_random_search_parameters(random_search_parameters +BOOST_MATH_EXPORT template ArgumentContainer random_search( const Func cost_function, random_search_parameters const ¶ms, diff --git a/include/boost/math/statistics/anderson_darling.hpp b/include/boost/math/statistics/anderson_darling.hpp index 9c97418559..e65bcbe848 100644 --- a/include/boost/math/statistics/anderson_darling.hpp +++ b/include/boost/math/statistics/anderson_darling.hpp @@ -17,7 +17,7 @@ namespace boost { namespace math { namespace statistics { -template +BOOST_MATH_EXPORT template auto anderson_darling_normality_statistic(RandomAccessContainer const & v, typename RandomAccessContainer::value_type mu = std::numeric_limits::quiet_NaN(), typename RandomAccessContainer::value_type sd = std::numeric_limits::quiet_NaN()) diff --git a/include/boost/math/statistics/bivariate_statistics.hpp b/include/boost/math/statistics/bivariate_statistics.hpp index f8b4a96bfc..ccb2392e35 100644 --- a/include/boost/math/statistics/bivariate_statistics.hpp +++ b/include/boost/math/statistics/bivariate_statistics.hpp @@ -331,7 +331,7 @@ ReturnType correlation_coefficient_parallel_impl(ForwardIterator u_begin, Forwar #ifdef BOOST_MATH_EXEC_COMPATIBLE -template +BOOST_MATH_EXPORT template inline auto means_and_covariance(ExecutionPolicy&& exec, Container const & u, Container const & v) { if constexpr (std::is_same_v, decltype(std::execution::seq)>) @@ -366,25 +366,25 @@ inline auto means_and_covariance(ExecutionPolicy&& exec, Container const & u, Co } } -template +BOOST_MATH_EXPORT template inline auto means_and_covariance(Container const & u, Container const & v) { return means_and_covariance(std::execution::seq, u, v); } -template +BOOST_MATH_EXPORT template inline auto covariance(ExecutionPolicy&& exec, Container const & u, Container const & v) { return std::get<2>(means_and_covariance(exec, u, v)); } -template +BOOST_MATH_EXPORT template inline auto covariance(Container const & u, Container const & v) { return covariance(std::execution::seq, u, v); } -template +BOOST_MATH_EXPORT template inline auto correlation_coefficient(ExecutionPolicy&& exec, Container const & u, Container const & v) { if constexpr (std::is_same_v, decltype(std::execution::seq)>) @@ -415,7 +415,7 @@ inline auto correlation_coefficient(ExecutionPolicy&& exec, Container const & u, } } -template +BOOST_MATH_EXPORT template inline auto correlation_coefficient(Container const & u, Container const & v) { return correlation_coefficient(std::execution::seq, u, v); @@ -423,7 +423,7 @@ inline auto correlation_coefficient(Container const & u, Container const & v) #else // C++11 and single threaded bindings -template::value, bool>::type = true> +BOOST_MATH_EXPORT template::value, bool>::type = true> inline auto means_and_covariance(Container const & u, Container const & v) -> std::tuple { using ReturnType = std::tuple; @@ -431,7 +431,7 @@ inline auto means_and_covariance(Container const & u, Container const & v) -> st return std::make_tuple(std::get<0>(temp), std::get<1>(temp), std::get<2>(temp)); } -template::value, bool>::type = true> +BOOST_MATH_EXPORT template::value, bool>::type = true> inline auto means_and_covariance(Container const & u, Container const & v) -> std::tuple { using ReturnType = std::tuple; @@ -439,28 +439,28 @@ inline auto means_and_covariance(Container const & u, Container const & v) -> st return std::make_tuple(std::get<0>(temp), std::get<1>(temp), std::get<2>(temp)); } -template::value, bool>::type = true> +BOOST_MATH_EXPORT template::value, bool>::type = true> inline double covariance(Container const & u, Container const & v) { using ReturnType = std::tuple; return std::get<2>(detail::means_and_covariance_seq_impl(std::begin(u), std::end(u), std::begin(v), std::end(v))); } -template::value, bool>::type = true> +BOOST_MATH_EXPORT template::value, bool>::type = true> inline Real covariance(Container const & u, Container const & v) { using ReturnType = std::tuple; return std::get<2>(detail::means_and_covariance_seq_impl(std::begin(u), std::end(u), std::begin(v), std::end(v))); } -template::value, bool>::type = true> +BOOST_MATH_EXPORT template::value, bool>::type = true> inline double correlation_coefficient(Container const & u, Container const & v) { using ReturnType = std::tuple; return std::get<5>(detail::correlation_coefficient_seq_impl(std::begin(u), std::end(u), std::begin(v), std::end(v))); } -template::value, bool>::type = true> +BOOST_MATH_EXPORT template::value, bool>::type = true> inline Real correlation_coefficient(Container const & u, Container const & v) { using ReturnType = std::tuple; diff --git a/include/boost/math/statistics/chatterjee_correlation.hpp b/include/boost/math/statistics/chatterjee_correlation.hpp index 250872b069..4e88bb2e0e 100644 --- a/include/boost/math/statistics/chatterjee_correlation.hpp +++ b/include/boost/math/statistics/chatterjee_correlation.hpp @@ -162,14 +162,14 @@ ReturnType chatterjee_correlation_mnn_seq_impl(ForwardIterator u_begin, ForwardI } // Namespace detail -template ::value, double, Real>::type> inline ReturnType chatterjee_correlation(const Container& u, const Container& v) { return detail::chatterjee_correlation_seq_impl(std::begin(u), std::end(u), std::begin(v), std::end(v)); } -template ::value, double, Real>::type> inline ReturnType chatterjee_correlation_mnn(const Container& u, const Container& v, std::size_t M) { @@ -292,7 +292,7 @@ ReturnType chatterjee_correlation_mnn_par_impl(ExecutionPolicy&& exec, ForwardIt } // Namespace detail -template , double, Real>> inline ReturnType chatterjee_correlation(ExecutionPolicy&& exec, const Container& u, const Container& v) { @@ -309,7 +309,7 @@ inline ReturnType chatterjee_correlation(ExecutionPolicy&& exec, const Container } } -template , double, Real>> inline ReturnType chatterjee_correlation_mnn(ExecutionPolicy&& exec, const Container& u, const Container& v, std::size_t M) { diff --git a/include/boost/math/statistics/linear_regression.hpp b/include/boost/math/statistics/linear_regression.hpp index fa1b33e881..eb99bc221a 100644 --- a/include/boost/math/statistics/linear_regression.hpp +++ b/include/boost/math/statistics/linear_regression.hpp @@ -104,28 +104,28 @@ ReturnType simple_ordinary_least_squares_with_R_squared_impl(RandomAccessContain } } // namespace detail -template::value, bool>::type = true> inline auto simple_ordinary_least_squares(RandomAccessContainer const & x, RandomAccessContainer const & y) -> std::pair { return detail::simple_ordinary_least_squares_impl>(x, y); } -template::value, bool>::type = true> inline auto simple_ordinary_least_squares(RandomAccessContainer const & x, RandomAccessContainer const & y) -> std::pair { return detail::simple_ordinary_least_squares_impl>(x, y); } -template::value, bool>::type = true> inline auto simple_ordinary_least_squares_with_R_squared(RandomAccessContainer const & x, RandomAccessContainer const & y) -> std::tuple { return detail::simple_ordinary_least_squares_with_R_squared_impl>(x, y); } -template::value, bool>::type = true> inline auto simple_ordinary_least_squares_with_R_squared(RandomAccessContainer const & x, RandomAccessContainer const & y) -> std::tuple { diff --git a/include/boost/math/statistics/ljung_box.hpp b/include/boost/math/statistics/ljung_box.hpp index e7a97a5f7f..8a762db681 100644 --- a/include/boost/math/statistics/ljung_box.hpp +++ b/include/boost/math/statistics/ljung_box.hpp @@ -16,7 +16,7 @@ namespace boost::math::statistics { -template +BOOST_MATH_EXPORT template auto ljung_box(RandomAccessIterator begin, RandomAccessIterator end, int64_t lags = -1, int64_t fit_dof = 0) { using Real = typename std::iterator_traits::value_type; int64_t n = std::distance(begin, end); @@ -63,7 +63,7 @@ auto ljung_box(RandomAccessIterator begin, RandomAccessIterator end, int64_t lag } -template +BOOST_MATH_EXPORT template auto ljung_box(RandomAccessContainer const & v, int64_t lags = -1, int64_t fit_dof = 0) { return ljung_box(v.begin(), v.end(), lags, fit_dof); } diff --git a/include/boost/math/statistics/runs_test.hpp b/include/boost/math/statistics/runs_test.hpp index 8ad0191c5b..c618250c5d 100644 --- a/include/boost/math/statistics/runs_test.hpp +++ b/include/boost/math/statistics/runs_test.hpp @@ -18,7 +18,7 @@ namespace boost::math::statistics { -template +BOOST_MATH_EXPORT template auto runs_above_and_below_threshold(RandomAccessContainer const & v, typename RandomAccessContainer::value_type threshold) { @@ -105,7 +105,7 @@ auto runs_above_and_below_threshold(RandomAccessContainer const & v, return std::make_pair(statistic, pvalue); } -template +BOOST_MATH_EXPORT template auto runs_above_and_below_median(RandomAccessContainer const & v) { using Real = typename RandomAccessContainer::value_type; diff --git a/include/boost/math/statistics/signal_statistics.hpp b/include/boost/math/statistics/signal_statistics.hpp index 2efed78d23..b6de06511e 100644 --- a/include/boost/math/statistics/signal_statistics.hpp +++ b/include/boost/math/statistics/signal_statistics.hpp @@ -25,7 +25,7 @@ namespace boost::math::statistics { -template +BOOST_MATH_EXPORT template auto absolute_gini_coefficient(ForwardIterator first, ForwardIterator last) { using std::abs; @@ -55,20 +55,20 @@ auto absolute_gini_coefficient(ForwardIterator first, ForwardIterator last) return ((2*num)/denom - i)/(i-1); } -template +BOOST_MATH_EXPORT template inline auto absolute_gini_coefficient(RandomAccessContainer & v) { return boost::math::statistics::absolute_gini_coefficient(v.begin(), v.end()); } -template +BOOST_MATH_EXPORT template auto sample_absolute_gini_coefficient(ForwardIterator first, ForwardIterator last) { size_t n = std::distance(first, last); return n*boost::math::statistics::absolute_gini_coefficient(first, last)/(n-1); } -template +BOOST_MATH_EXPORT template inline auto sample_absolute_gini_coefficient(RandomAccessContainer & v) { return boost::math::statistics::sample_absolute_gini_coefficient(v.begin(), v.end()); @@ -77,7 +77,7 @@ inline auto sample_absolute_gini_coefficient(RandomAccessContainer & v) // The Hoyer sparsity measure is defined in: // https://arxiv.org/pdf/0811.4706.pdf -template +BOOST_MATH_EXPORT template auto hoyer_sparsity(const ForwardIterator first, const ForwardIterator last) { using T = typename std::iterator_traits::value_type; @@ -126,14 +126,14 @@ auto hoyer_sparsity(const ForwardIterator first, const ForwardIterator last) } } -template +BOOST_MATH_EXPORT template inline auto hoyer_sparsity(Container const & v) { return boost::math::statistics::hoyer_sparsity(v.cbegin(), v.cend()); } -template +BOOST_MATH_EXPORT template auto oracle_snr(Container const & signal, Container const & noisy_signal) { using Real = typename Container::value_type; @@ -202,7 +202,7 @@ auto oracle_snr(Container const & signal, Container const & noisy_signal) } } -template +BOOST_MATH_EXPORT template auto mean_invariant_oracle_snr(Container const & signal, Container const & noisy_signal) { using Real = typename Container::value_type; @@ -230,7 +230,7 @@ auto mean_invariant_oracle_snr(Container const & signal, Container const & noisy } -template +BOOST_MATH_EXPORT template auto mean_invariant_oracle_snr_db(Container const & signal, Container const & noisy_signal) { using std::log10; @@ -239,7 +239,7 @@ auto mean_invariant_oracle_snr_db(Container const & signal, Container const & no // Follows the definition of SNR given in Mallat, A Wavelet Tour of Signal Processing, equation 11.16. -template +BOOST_MATH_EXPORT template auto oracle_snr_db(Container const & signal, Container const & noisy_signal) { using std::log10; @@ -250,7 +250,7 @@ auto oracle_snr_db(Container const & signal, Container const & noisy_signal) // D. R. Pauluzzi and N. C. Beaulieu, "A comparison of SNR estimation techniques for the AWGN channel," IEEE Trans. Communications, Vol. 48, No. 10, pp. 1681-1691, 2000. // A nice python implementation: // https://github.com/gnuradio/gnuradio/blob/master/gr-digital/examples/snr_estimators.py -template +BOOST_MATH_EXPORT template auto m2m4_snr_estimator(ForwardIterator first, ForwardIterator last, decltype(*first) estimated_signal_kurtosis=1, decltype(*first) estimated_noise_kurtosis=3) { BOOST_MATH_ASSERT_MSG(estimated_signal_kurtosis > 0, "The estimated signal kurtosis must be positive"); @@ -327,13 +327,13 @@ auto m2m4_snr_estimator(ForwardIterator first, ForwardIterator last, decltype(*f } } -template +BOOST_MATH_EXPORT template inline auto m2m4_snr_estimator(Container const & noisy_signal, typename Container::value_type estimated_signal_kurtosis=1, typename Container::value_type estimated_noise_kurtosis=3) { return m2m4_snr_estimator(noisy_signal.cbegin(), noisy_signal.cend(), estimated_signal_kurtosis, estimated_noise_kurtosis); } -template +BOOST_MATH_EXPORT template inline auto m2m4_snr_estimator_db(ForwardIterator first, ForwardIterator last, decltype(*first) estimated_signal_kurtosis=1, decltype(*first) estimated_noise_kurtosis=3) { using std::log10; @@ -341,7 +341,7 @@ inline auto m2m4_snr_estimator_db(ForwardIterator first, ForwardIterator last, d } -template +BOOST_MATH_EXPORT template inline auto m2m4_snr_estimator_db(Container const & noisy_signal, typename Container::value_type estimated_signal_kurtosis=1, typename Container::value_type estimated_noise_kurtosis=3) { using std::log10; diff --git a/include/boost/math/statistics/t_test.hpp b/include/boost/math/statistics/t_test.hpp index 36e3f394ab..d7cbfc81e1 100644 --- a/include/boost/math/statistics/t_test.hpp +++ b/include/boost/math/statistics/t_test.hpp @@ -181,93 +181,93 @@ ReturnType paired_samples_t_test_impl(ForwardIterator begin_1, ForwardIterator e } } // namespace detail -template::value, bool>::type = true> +BOOST_MATH_EXPORT template::value, bool>::type = true> inline auto one_sample_t_test(Real sample_mean, Real sample_variance, Real num_samples, Real assumed_mean) -> std::pair { return detail::one_sample_t_test_impl>(sample_mean, sample_variance, num_samples, assumed_mean); } -template::value, bool>::type = true> +BOOST_MATH_EXPORT template::value, bool>::type = true> inline auto one_sample_t_test(Real sample_mean, Real sample_variance, Real num_samples, Real assumed_mean) -> std::pair { return detail::one_sample_t_test_impl>(sample_mean, sample_variance, num_samples, assumed_mean); } -template::value_type, +BOOST_MATH_EXPORT template::value_type, typename std::enable_if::value, bool>::type = true> inline auto one_sample_t_test(ForwardIterator begin, ForwardIterator end, Real assumed_mean) -> std::pair { return detail::one_sample_t_test_impl>(begin, end, assumed_mean); } -template::value_type, +BOOST_MATH_EXPORT template::value_type, typename std::enable_if::value, bool>::type = true> inline auto one_sample_t_test(ForwardIterator begin, ForwardIterator end, Real assumed_mean) -> std::pair { return detail::one_sample_t_test_impl>(begin, end, assumed_mean); } -template::value, bool>::type = true> inline auto one_sample_t_test(Container const & v, Real assumed_mean) -> std::pair { return detail::one_sample_t_test_impl>(std::begin(v), std::end(v), assumed_mean); } -template::value, bool>::type = true> inline auto one_sample_t_test(Container const & v, Real assumed_mean) -> std::pair { return detail::one_sample_t_test_impl>(std::begin(v), std::end(v), assumed_mean); } -template::value_type, +BOOST_MATH_EXPORT template::value_type, typename std::enable_if::value, bool>::type = true> inline auto two_sample_t_test(ForwardIterator begin_1, ForwardIterator end_1, ForwardIterator begin_2, ForwardIterator end_2) -> std::pair { return detail::two_sample_t_test_impl>(begin_1, end_1, begin_2, end_2); } -template::value_type, +BOOST_MATH_EXPORT template::value_type, typename std::enable_if::value, bool>::type = true> inline auto two_sample_t_test(ForwardIterator begin_1, ForwardIterator end_1, ForwardIterator begin_2, ForwardIterator end_2) -> std::pair { return detail::two_sample_t_test_impl>(begin_1, end_1, begin_2, end_2); } -template::value, bool>::type = true> +BOOST_MATH_EXPORT template::value, bool>::type = true> inline auto two_sample_t_test(Container const & u, Container const & v) -> std::pair { return detail::two_sample_t_test_impl>(std::begin(u), std::end(u), std::begin(v), std::end(v)); } -template::value, bool>::type = true> +BOOST_MATH_EXPORT template::value, bool>::type = true> inline auto two_sample_t_test(Container const & u, Container const & v) -> std::pair { return detail::two_sample_t_test_impl>(std::begin(u), std::end(u), std::begin(v), std::end(v)); } -template::value_type, +BOOST_MATH_EXPORT template::value_type, typename std::enable_if::value, bool>::type = true> inline auto paired_samples_t_test(ForwardIterator begin_1, ForwardIterator end_1, ForwardIterator begin_2, ForwardIterator end_2) -> std::pair { return detail::paired_samples_t_test_impl>(begin_1, end_1, begin_2, end_2); } -template::value_type, +BOOST_MATH_EXPORT template::value_type, typename std::enable_if::value, bool>::type = true> inline auto paired_samples_t_test(ForwardIterator begin_1, ForwardIterator end_1, ForwardIterator begin_2, ForwardIterator end_2) -> std::pair { return detail::paired_samples_t_test_impl>(begin_1, end_1, begin_2, end_2); } -template::value, bool>::type = true> +BOOST_MATH_EXPORT template::value, bool>::type = true> inline auto paired_samples_t_test(Container const & u, Container const & v) -> std::pair { return detail::paired_samples_t_test_impl>(std::begin(u), std::end(u), std::begin(v), std::end(v)); } -template::value, bool>::type = true> +BOOST_MATH_EXPORT template::value, bool>::type = true> inline auto paired_samples_t_test(Container const & u, Container const & v) -> std::pair { return detail::paired_samples_t_test_impl>(std::begin(u), std::end(u), std::begin(v), std::end(v)); diff --git a/include/boost/math/statistics/univariate_statistics.hpp b/include/boost/math/statistics/univariate_statistics.hpp index 7839afb872..3403d32f79 100644 --- a/include/boost/math/statistics/univariate_statistics.hpp +++ b/include/boost/math/statistics/univariate_statistics.hpp @@ -29,7 +29,7 @@ namespace boost::math::statistics { -template +BOOST_MATH_EXPORT template inline auto mean(ExecutionPolicy&& exec, ForwardIterator first, ForwardIterator last) { using Real = typename std::iterator_traits::value_type; @@ -59,25 +59,25 @@ inline auto mean(ExecutionPolicy&& exec, ForwardIterator first, ForwardIterator } } -template +BOOST_MATH_EXPORT template inline auto mean(ExecutionPolicy&& exec, Container const & v) { return mean(exec, std::cbegin(v), std::cend(v)); } -template +BOOST_MATH_EXPORT template inline auto mean(ForwardIterator first, ForwardIterator last) { return mean(std::execution::seq, first, last); } -template +BOOST_MATH_EXPORT template inline auto mean(Container const & v) { return mean(std::execution::seq, std::cbegin(v), std::cend(v)); } -template +BOOST_MATH_EXPORT template inline auto variance(ExecutionPolicy&& exec, ForwardIterator first, ForwardIterator last) { using Real = typename std::iterator_traits::value_type; @@ -108,25 +108,25 @@ inline auto variance(ExecutionPolicy&& exec, ForwardIterator first, ForwardItera } } -template +BOOST_MATH_EXPORT template inline auto variance(ExecutionPolicy&& exec, Container const & v) { return variance(exec, std::cbegin(v), std::cend(v)); } -template +BOOST_MATH_EXPORT template inline auto variance(ForwardIterator first, ForwardIterator last) { return variance(std::execution::seq, first, last); } -template +BOOST_MATH_EXPORT template inline auto variance(Container const & v) { return variance(std::execution::seq, std::cbegin(v), std::cend(v)); } -template +BOOST_MATH_EXPORT template inline auto sample_variance(ExecutionPolicy&& exec, ForwardIterator first, ForwardIterator last) { const auto n = std::distance(first, last); @@ -134,25 +134,25 @@ inline auto sample_variance(ExecutionPolicy&& exec, ForwardIterator first, Forwa return n*variance(exec, first, last)/(n-1); } -template +BOOST_MATH_EXPORT template inline auto sample_variance(ExecutionPolicy&& exec, Container const & v) { return sample_variance(exec, std::cbegin(v), std::cend(v)); } -template +BOOST_MATH_EXPORT template inline auto sample_variance(ForwardIterator first, ForwardIterator last) { return sample_variance(std::execution::seq, first, last); } -template +BOOST_MATH_EXPORT template inline auto sample_variance(Container const & v) { return sample_variance(std::execution::seq, std::cbegin(v), std::cend(v)); } -template +BOOST_MATH_EXPORT template inline auto mean_and_sample_variance(ExecutionPolicy&& exec, ForwardIterator first, ForwardIterator last) { using Real = typename std::iterator_traits::value_type; @@ -185,25 +185,25 @@ inline auto mean_and_sample_variance(ExecutionPolicy&& exec, ForwardIterator fir } } -template +BOOST_MATH_EXPORT template inline auto mean_and_sample_variance(ExecutionPolicy&& exec, Container const & v) { return mean_and_sample_variance(exec, std::cbegin(v), std::cend(v)); } -template +BOOST_MATH_EXPORT template inline auto mean_and_sample_variance(ForwardIterator first, ForwardIterator last) { return mean_and_sample_variance(std::execution::seq, first, last); } -template +BOOST_MATH_EXPORT template inline auto mean_and_sample_variance(Container const & v) { return mean_and_sample_variance(std::execution::seq, std::cbegin(v), std::cend(v)); } -template +BOOST_MATH_EXPORT template inline auto first_four_moments(ExecutionPolicy&& exec, ForwardIterator first, ForwardIterator last) { using Real = typename std::iterator_traits::value_type; @@ -240,26 +240,26 @@ inline auto first_four_moments(ExecutionPolicy&& exec, ForwardIterator first, Fo } } -template +BOOST_MATH_EXPORT template inline auto first_four_moments(ExecutionPolicy&& exec, Container const & v) { return first_four_moments(exec, std::cbegin(v), std::cend(v)); } -template +BOOST_MATH_EXPORT template inline auto first_four_moments(ForwardIterator first, ForwardIterator last) { return first_four_moments(std::execution::seq, first, last); } -template +BOOST_MATH_EXPORT template inline auto first_four_moments(Container const & v) { return first_four_moments(std::execution::seq, std::cbegin(v), std::cend(v)); } // https://prod.sandia.gov/techlib-noauth/access-control.cgi/2008/086212.pdf -template +BOOST_MATH_EXPORT template inline auto skewness(ExecutionPolicy&& exec, ForwardIterator first, ForwardIterator last) { using Real = typename std::iterator_traits::value_type; @@ -302,19 +302,19 @@ inline auto skewness(ExecutionPolicy&& exec, ForwardIterator first, ForwardItera } } -template +BOOST_MATH_EXPORT template inline auto skewness(ExecutionPolicy&& exec, Container & v) { return skewness(exec, std::cbegin(v), std::cend(v)); } -template +BOOST_MATH_EXPORT template inline auto skewness(ForwardIterator first, ForwardIterator last) { return skewness(std::execution::seq, first, last); } -template +BOOST_MATH_EXPORT template inline auto skewness(Container const & v) { return skewness(std::execution::seq, std::cbegin(v), std::cend(v)); @@ -322,7 +322,7 @@ inline auto skewness(Container const & v) // Follows equation 1.6 of: // https://prod.sandia.gov/techlib-noauth/access-control.cgi/2008/086212.pdf -template +BOOST_MATH_EXPORT template inline auto kurtosis(ExecutionPolicy&& exec, ForwardIterator first, ForwardIterator last) { const auto [M1, M2, M3, M4] = first_four_moments(exec, first, last); @@ -333,50 +333,50 @@ inline auto kurtosis(ExecutionPolicy&& exec, ForwardIterator first, ForwardItera return M4/(M2*M2); } -template +BOOST_MATH_EXPORT template inline auto kurtosis(ExecutionPolicy&& exec, Container const & v) { return kurtosis(exec, std::cbegin(v), std::cend(v)); } -template +BOOST_MATH_EXPORT template inline auto kurtosis(ForwardIterator first, ForwardIterator last) { return kurtosis(std::execution::seq, first, last); } -template +BOOST_MATH_EXPORT template inline auto kurtosis(Container const & v) { return kurtosis(std::execution::seq, std::cbegin(v), std::cend(v)); } -template +BOOST_MATH_EXPORT template inline auto excess_kurtosis(ExecutionPolicy&& exec, ForwardIterator first, ForwardIterator last) { return kurtosis(exec, first, last) - 3; } -template +BOOST_MATH_EXPORT template inline auto excess_kurtosis(ExecutionPolicy&& exec, Container const & v) { return excess_kurtosis(exec, std::cbegin(v), std::cend(v)); } -template +BOOST_MATH_EXPORT template inline auto excess_kurtosis(ForwardIterator first, ForwardIterator last) { return excess_kurtosis(std::execution::seq, first, last); } -template +BOOST_MATH_EXPORT template inline auto excess_kurtosis(Container const & v) { return excess_kurtosis(std::execution::seq, std::cbegin(v), std::cend(v)); } -template +BOOST_MATH_EXPORT template auto median(ExecutionPolicy&& exec, RandomAccessIterator first, RandomAccessIterator last) { const auto num_elems = std::distance(first, last); @@ -397,19 +397,19 @@ auto median(ExecutionPolicy&& exec, RandomAccessIterator first, RandomAccessIter } -template +BOOST_MATH_EXPORT template inline auto median(ExecutionPolicy&& exec, RandomAccessContainer & v) { return median(exec, std::begin(v), std::end(v)); } -template +BOOST_MATH_EXPORT template inline auto median(RandomAccessIterator first, RandomAccessIterator last) { return median(std::execution::seq, first, last); } -template +BOOST_MATH_EXPORT template inline auto median(RandomAccessContainer & v) { return median(std::execution::seq, std::begin(v), std::end(v)); @@ -421,7 +421,7 @@ inline auto median(RandomAccessContainer & v) // https://github.com/boostorg/math/issues/585 // We will fix this at a later date, for now just use a serial implementation: // -template +BOOST_MATH_EXPORT template inline auto gini_coefficient(ExecutionPolicy&& exec, RandomAccessIterator first, RandomAccessIterator last) { using Real = typename std::iterator_traits::value_type; @@ -454,7 +454,7 @@ inline auto gini_coefficient(ExecutionPolicy&& exec, RandomAccessIterator first, } } #else -template +BOOST_MATH_EXPORT template inline auto gini_coefficient(ExecutionPolicy&& exec, RandomAccessIterator first, RandomAccessIterator last) { using Real = typename std::iterator_traits::value_type; @@ -475,50 +475,50 @@ inline auto gini_coefficient(ExecutionPolicy&& exec, RandomAccessIterator first, } #endif -template +BOOST_MATH_EXPORT template inline auto gini_coefficient(ExecutionPolicy&& exec, RandomAccessContainer & v) { return gini_coefficient(exec, std::begin(v), std::end(v)); } -template +BOOST_MATH_EXPORT template inline auto gini_coefficient(RandomAccessIterator first, RandomAccessIterator last) { return gini_coefficient(std::execution::seq, first, last); } -template +BOOST_MATH_EXPORT template inline auto gini_coefficient(RandomAccessContainer & v) { return gini_coefficient(std::execution::seq, std::begin(v), std::end(v)); } -template +BOOST_MATH_EXPORT template inline auto sample_gini_coefficient(ExecutionPolicy&& exec, RandomAccessIterator first, RandomAccessIterator last) { const auto n = std::distance(first, last); return n*gini_coefficient(exec, first, last)/(n-1); } -template +BOOST_MATH_EXPORT template inline auto sample_gini_coefficient(ExecutionPolicy&& exec, RandomAccessContainer & v) { return sample_gini_coefficient(exec, std::begin(v), std::end(v)); } -template +BOOST_MATH_EXPORT template inline auto sample_gini_coefficient(RandomAccessIterator first, RandomAccessIterator last) { return sample_gini_coefficient(std::execution::seq, first, last); } -template +BOOST_MATH_EXPORT template inline auto sample_gini_coefficient(RandomAccessContainer & v) { return sample_gini_coefficient(std::execution::seq, std::begin(v), std::end(v)); } -template +BOOST_MATH_EXPORT template auto median_absolute_deviation(ExecutionPolicy&& exec, RandomAccessIterator first, RandomAccessIterator last, typename std::iterator_traits::value_type center=std::numeric_limits::value_type>::quiet_NaN()) { @@ -547,28 +547,28 @@ auto median_absolute_deviation(ExecutionPolicy&& exec, RandomAccessIterator firs } } -template +BOOST_MATH_EXPORT template inline auto median_absolute_deviation(ExecutionPolicy&& exec, RandomAccessContainer & v, typename RandomAccessContainer::value_type center=std::numeric_limits::quiet_NaN()) { return median_absolute_deviation(exec, std::begin(v), std::end(v), center); } -template +BOOST_MATH_EXPORT template inline auto median_absolute_deviation(RandomAccessIterator first, RandomAccessIterator last, typename RandomAccessIterator::value_type center=std::numeric_limits::quiet_NaN()) { return median_absolute_deviation(std::execution::seq, first, last, center); } -template +BOOST_MATH_EXPORT template inline auto median_absolute_deviation(RandomAccessContainer & v, typename RandomAccessContainer::value_type center=std::numeric_limits::quiet_NaN()) { return median_absolute_deviation(std::execution::seq, std::begin(v), std::end(v), center); } -template +BOOST_MATH_EXPORT template auto interquartile_range(ExecutionPolicy&& exec, ForwardIterator first, ForwardIterator last) { using Real = typename std::iterator_traits::value_type; @@ -609,25 +609,25 @@ auto interquartile_range(ExecutionPolicy&& exec, ForwardIterator first, ForwardI } } -template +BOOST_MATH_EXPORT template inline auto interquartile_range(ExecutionPolicy&& exec, RandomAccessContainer & v) { return interquartile_range(exec, std::begin(v), std::end(v)); } -template +BOOST_MATH_EXPORT template inline auto interquartile_range(RandomAccessIterator first, RandomAccessIterator last) { return interquartile_range(std::execution::seq, first, last); } -template +BOOST_MATH_EXPORT template inline auto interquartile_range(RandomAccessContainer & v) { return interquartile_range(std::execution::seq, std::begin(v), std::end(v)); } -template +BOOST_MATH_EXPORT template inline OutputIterator mode(ExecutionPolicy&& exec, ForwardIterator first, ForwardIterator last, OutputIterator output) { if(!std::is_sorted(exec, first, last)) @@ -645,13 +645,13 @@ inline OutputIterator mode(ExecutionPolicy&& exec, ForwardIterator first, Forwar return detail::mode_impl(first, last, output); } -template +BOOST_MATH_EXPORT template inline OutputIterator mode(ExecutionPolicy&& exec, Container & v, OutputIterator output) { return mode(exec, std::begin(v), std::end(v), output); } -template +BOOST_MATH_EXPORT template inline OutputIterator mode(ForwardIterator first, ForwardIterator last, OutputIterator output) { return mode(std::execution::seq, first, last, output); @@ -659,7 +659,7 @@ inline OutputIterator mode(ForwardIterator first, ForwardIterator last, OutputIt // Requires enable_if_t to not clash with impl that returns std::list // Very ugly. std::is_execution_policy_v returns false for the std::execution objects and decltype of the objects (e.g. std::execution::seq) -template && +BOOST_MATH_EXPORT template && !std::is_convertible_v && !std::is_convertible_v #if __cpp_lib_execution > 201900 @@ -673,7 +673,7 @@ inline OutputIterator mode(Container & v, OutputIterator output) // std::list is the return type for the proposed STL stats library -template::value_type> +BOOST_MATH_EXPORT template::value_type> inline auto mode(ExecutionPolicy&& exec, ForwardIterator first, ForwardIterator last) { std::list modes; @@ -681,19 +681,19 @@ inline auto mode(ExecutionPolicy&& exec, ForwardIterator first, ForwardIterator return modes; } -template +BOOST_MATH_EXPORT template inline auto mode(ExecutionPolicy&& exec, Container & v) { return mode(exec, std::begin(v), std::end(v)); } -template +BOOST_MATH_EXPORT template inline auto mode(ForwardIterator first, ForwardIterator last) { return mode(std::execution::seq, first, last); } -template +BOOST_MATH_EXPORT template inline auto mode(Container & v) { return mode(std::execution::seq, std::begin(v), std::end(v)); @@ -708,7 +708,7 @@ namespace boost { namespace math { namespace statistics { template using enable_if_t = typename std::enable_if::type; -template::value_type, +BOOST_MATH_EXPORT template::value_type, enable_if_t::value, bool> = true> inline double mean(const ForwardIterator first, const ForwardIterator last) { @@ -716,14 +716,14 @@ inline double mean(const ForwardIterator first, const ForwardIterator last) return detail::mean_sequential_impl(first, last); } -template::value, bool> = true> inline double mean(const Container& c) { return mean(std::begin(c), std::end(c)); } -template::value_type, +BOOST_MATH_EXPORT template::value_type, enable_if_t::value, bool> = true> inline Real mean(const ForwardIterator first, const ForwardIterator last) { @@ -731,28 +731,28 @@ inline Real mean(const ForwardIterator first, const ForwardIterator last) return detail::mean_sequential_impl(first, last); } -template::value, bool> = true> inline Real mean(const Container& c) { return mean(std::begin(c), std::end(c)); } -template::value_type, +BOOST_MATH_EXPORT template::value_type, enable_if_t::value, bool> = true> inline double variance(const ForwardIterator first, const ForwardIterator last) { return std::get<2>(detail::variance_sequential_impl>(first, last)); } -template::value, bool> = true> inline double variance(const Container& c) { return variance(std::begin(c), std::end(c)); } -template::value_type, +BOOST_MATH_EXPORT template::value_type, enable_if_t::value, bool> = true> inline Real variance(const ForwardIterator first, const ForwardIterator last) { @@ -760,14 +760,14 @@ inline Real variance(const ForwardIterator first, const ForwardIterator last) } -template::value, bool> = true> inline Real variance(const Container& c) { return variance(std::begin(c), std::end(c)); } -template::value_type, +BOOST_MATH_EXPORT template::value_type, enable_if_t::value, bool> = true> inline double sample_variance(const ForwardIterator first, const ForwardIterator last) { @@ -776,14 +776,14 @@ inline double sample_variance(const ForwardIterator first, const ForwardIterator return n*variance(first, last)/(n-1); } -template::value, bool> = true> inline double sample_variance(const Container& c) { return sample_variance(std::begin(c), std::end(c)); } -template::value_type, +BOOST_MATH_EXPORT template::value_type, enable_if_t::value, bool> = true> inline Real sample_variance(const ForwardIterator first, const ForwardIterator last) { @@ -792,14 +792,14 @@ inline Real sample_variance(const ForwardIterator first, const ForwardIterator l return n*variance(first, last)/(n-1); } -template::value, bool> = true> inline Real sample_variance(const Container& c) { return sample_variance(std::begin(c), std::end(c)); } -template::value_type, +BOOST_MATH_EXPORT template::value_type, enable_if_t::value, bool> = true> inline std::pair mean_and_sample_variance(const ForwardIterator first, const ForwardIterator last) { @@ -807,14 +807,14 @@ inline std::pair mean_and_sample_variance(const ForwardIterator return std::make_pair(std::get<0>(results), std::get<3>(results)*std::get<2>(results)/(std::get<3>(results)-1.0)); } -template::value, bool> = true> inline std::pair mean_and_sample_variance(const Container& c) { return mean_and_sample_variance(std::begin(c), std::end(c)); } -template::value_type, +BOOST_MATH_EXPORT template::value_type, enable_if_t::value, bool> = true> inline std::pair mean_and_sample_variance(const ForwardIterator first, const ForwardIterator last) { @@ -822,14 +822,14 @@ inline std::pair mean_and_sample_variance(const ForwardIterator firs return std::make_pair(std::get<0>(results), std::get<3>(results)*std::get<2>(results)/(std::get<3>(results)-Real(1))); } -template::value, bool> = true> inline std::pair mean_and_sample_variance(const Container& c) { return mean_and_sample_variance(std::begin(c), std::end(c)); } -template::value_type, +BOOST_MATH_EXPORT template::value_type, enable_if_t::value, bool> = true> inline std::tuple first_four_moments(const ForwardIterator first, const ForwardIterator last) { @@ -838,14 +838,14 @@ inline std::tuple first_four_moments(const Forwa std::get<3>(results) / std::get<4>(results)); } -template::value, bool> = true> inline std::tuple first_four_moments(const Container& c) { return first_four_moments(std::begin(c), std::end(c)); } -template::value_type, +BOOST_MATH_EXPORT template::value_type, enable_if_t::value, bool> = true> inline std::tuple first_four_moments(const ForwardIterator first, const ForwardIterator last) { @@ -854,42 +854,42 @@ inline std::tuple first_four_moments(const ForwardIterat std::get<3>(results) / std::get<4>(results)); } -template::value, bool> = true> inline std::tuple first_four_moments(const Container& c) { return first_four_moments(std::begin(c), std::end(c)); } -template::value_type, +BOOST_MATH_EXPORT template::value_type, enable_if_t::value, bool> = true> inline double skewness(const ForwardIterator first, const ForwardIterator last) { return detail::skewness_sequential_impl(first, last); } -template::value, bool> = true> inline double skewness(const Container& c) { return skewness(std::begin(c), std::end(c)); } -template::value_type, +BOOST_MATH_EXPORT template::value_type, enable_if_t::value, bool> = true> inline Real skewness(const ForwardIterator first, const ForwardIterator last) { return detail::skewness_sequential_impl(first, last); } -template::value, bool> = true> inline Real skewness(const Container& c) { return skewness(std::begin(c), std::end(c)); } -template::value_type, +BOOST_MATH_EXPORT template::value_type, enable_if_t::value, bool> = true> inline double kurtosis(const ForwardIterator first, const ForwardIterator last) { @@ -905,14 +905,14 @@ inline double kurtosis(const ForwardIterator first, const ForwardIterator last) } } -template::value, bool> = true> inline double kurtosis(const Container& c) { return kurtosis(std::begin(c), std::end(c)); } -template::value_type, +BOOST_MATH_EXPORT template::value_type, enable_if_t::value, bool> = true> inline Real kurtosis(const ForwardIterator first, const ForwardIterator last) { @@ -928,42 +928,42 @@ inline Real kurtosis(const ForwardIterator first, const ForwardIterator last) } } -template::value, bool> = true> inline Real kurtosis(const Container& c) { return kurtosis(std::begin(c), std::end(c)); } -template::value_type, +BOOST_MATH_EXPORT template::value_type, enable_if_t::value, bool> = true> inline double excess_kurtosis(const ForwardIterator first, const ForwardIterator last) { return kurtosis(first, last) - 3; } -template::value, bool> = true> inline double excess_kurtosis(const Container& c) { return excess_kurtosis(std::begin(c), std::end(c)); } -template::value_type, +BOOST_MATH_EXPORT template::value_type, enable_if_t::value, bool> = true> inline Real excess_kurtosis(const ForwardIterator first, const ForwardIterator last) { return kurtosis(first, last) - 3; } -template::value, bool> = true> inline Real excess_kurtosis(const Container& c) { return excess_kurtosis(std::begin(c), std::end(c)); } -template::value_type> +BOOST_MATH_EXPORT template::value_type> Real median(RandomAccessIterator first, RandomAccessIterator last) { const auto num_elems = std::distance(first, last); @@ -983,13 +983,13 @@ Real median(RandomAccessIterator first, RandomAccessIterator last) } } -template +BOOST_MATH_EXPORT template inline Real median(RandomAccessContainer& c) { return median(std::begin(c), std::end(c)); } -template::value_type, +BOOST_MATH_EXPORT template::value_type, enable_if_t::value, bool> = true> inline double gini_coefficient(RandomAccessIterator first, RandomAccessIterator last) { @@ -1001,14 +1001,14 @@ inline double gini_coefficient(RandomAccessIterator first, RandomAccessIterator return detail::gini_coefficient_sequential_impl(first, last); } -template::value, bool> = true> inline double gini_coefficient(RandomAccessContainer& c) { return gini_coefficient(std::begin(c), std::end(c)); } -template::value_type, +BOOST_MATH_EXPORT template::value_type, enable_if_t::value, bool> = true> inline Real gini_coefficient(RandomAccessIterator first, RandomAccessIterator last) { @@ -1020,14 +1020,14 @@ inline Real gini_coefficient(RandomAccessIterator first, RandomAccessIterator la return detail::gini_coefficient_sequential_impl(first, last); } -template::value, bool> = true> inline Real gini_coefficient(RandomAccessContainer& c) { return gini_coefficient(std::begin(c), std::end(c)); } -template::value_type, +BOOST_MATH_EXPORT template::value_type, enable_if_t::value, bool> = true> inline double sample_gini_coefficient(RandomAccessIterator first, RandomAccessIterator last) { @@ -1035,14 +1035,14 @@ inline double sample_gini_coefficient(RandomAccessIterator first, RandomAccessIt return n*gini_coefficient(first, last)/(n-1); } -template::value, bool> = true> inline double sample_gini_coefficient(RandomAccessContainer& c) { return sample_gini_coefficient(std::begin(c), std::end(c)); } -template::value_type, +BOOST_MATH_EXPORT template::value_type, enable_if_t::value, bool> = true> inline Real sample_gini_coefficient(RandomAccessIterator first, RandomAccessIterator last) { @@ -1050,14 +1050,14 @@ inline Real sample_gini_coefficient(RandomAccessIterator first, RandomAccessIter return n*gini_coefficient(first, last)/(n-1); } -template::value, bool> = true> inline Real sample_gini_coefficient(RandomAccessContainer& c) { return sample_gini_coefficient(std::begin(c), std::end(c)); } -template::value_type> +BOOST_MATH_EXPORT template::value_type> Real median_absolute_deviation(RandomAccessIterator first, RandomAccessIterator last, typename std::iterator_traits::value_type center=std::numeric_limits::value_type>::quiet_NaN()) { @@ -1085,14 +1085,14 @@ Real median_absolute_deviation(RandomAccessIterator first, RandomAccessIterator } } -template +BOOST_MATH_EXPORT template inline Real median_absolute_deviation(RandomAccessContainer& c, typename RandomAccessContainer::value_type center=std::numeric_limits::quiet_NaN()) { return median_absolute_deviation(std::begin(c), std::end(c), center); } -template::value_type> +BOOST_MATH_EXPORT template::value_type> Real interquartile_range(ForwardIterator first, ForwardIterator last) { static_assert(!std::is_integral::value, "Integer values have not yet been implemented."); @@ -1134,7 +1134,7 @@ Real interquartile_range(ForwardIterator first, ForwardIterator last) } } -template +BOOST_MATH_EXPORT template Real interquartile_range(Container& c) { return interquartile_range(std::begin(c), std::end(c)); @@ -1164,13 +1164,13 @@ inline OutputIterator mode(ForwardIterator first, ForwardIterator last, OutputIt return detail::mode_impl(first, last, output); } -template +BOOST_MATH_EXPORT template inline OutputIterator mode(Container& c, OutputIterator output) { return mode(std::begin(c), std::end(c), output); } -template::value_type> +BOOST_MATH_EXPORT template::value_type> inline std::list mode(ForwardIterator first, ForwardIterator last) { std::list modes; @@ -1178,7 +1178,7 @@ inline std::list mode(ForwardIterator first, ForwardIterator last) return modes; } -template +BOOST_MATH_EXPORT template inline std::list mode(Container& c) { return mode(std::begin(c), std::end(c)); diff --git a/include/boost/math/statistics/z_test.hpp b/include/boost/math/statistics/z_test.hpp index 3166e1aff6..433f09da95 100644 --- a/include/boost/math/statistics/z_test.hpp +++ b/include/boost/math/statistics/z_test.hpp @@ -92,67 +92,67 @@ ReturnType two_sample_z_test_impl(ForwardIterator begin_1, ForwardIterator end_1 } // detail -template::value, bool>::type = true> +BOOST_MATH_EXPORT template::value, bool>::type = true> inline auto one_sample_z_test(Real sample_mean, Real sample_variance, Real sample_size, Real assumed_mean) -> std::pair { return detail::one_sample_z_test_impl>(sample_mean, sample_variance, sample_size, assumed_mean); } -template::value, bool>::type = true> +BOOST_MATH_EXPORT template::value, bool>::type = true> inline auto one_sample_z_test(Real sample_mean, Real sample_variance, Real sample_size, Real assumed_mean) -> std::pair { return detail::one_sample_z_test_impl>(sample_mean, sample_variance, sample_size, assumed_mean); } -template::value_type, +BOOST_MATH_EXPORT template::value_type, typename std::enable_if::value, bool>::type = true> inline auto one_sample_z_test(ForwardIterator begin, ForwardIterator end, Real assumed_mean) -> std::pair { return detail::one_sample_z_test_impl>(begin, end, assumed_mean); } -template::value_type, +BOOST_MATH_EXPORT template::value_type, typename std::enable_if::value, bool>::type = true> inline auto one_sample_z_test(ForwardIterator begin, ForwardIterator end, Real assumed_mean) -> std::pair { return detail::one_sample_z_test_impl>(begin, end, assumed_mean); } -template::value, bool>::type = true> inline auto one_sample_z_test(Container const & v, Real assumed_mean) -> std::pair { return detail::one_sample_z_test_impl>(std::begin(v), std::end(v), assumed_mean); } -template::value, bool>::type = true> inline auto one_sample_z_test(Container const & v, Real assumed_mean) -> std::pair { return detail::one_sample_z_test_impl>(std::begin(v), std::end(v), assumed_mean); } -template::value_type, +BOOST_MATH_EXPORT template::value_type, typename std::enable_if::value, bool>::type = true> inline auto two_sample_z_test(ForwardIterator begin_1, ForwardIterator end_1, ForwardIterator begin_2, ForwardIterator end_2) -> std::pair { return detail::two_sample_z_test_impl>(begin_1, end_1, begin_2, end_2); } -template::value_type, +BOOST_MATH_EXPORT template::value_type, typename std::enable_if::value, bool>::type = true> inline auto two_sample_z_test(ForwardIterator begin_1, ForwardIterator end_1, ForwardIterator begin_2, ForwardIterator end_2) -> std::pair { return detail::two_sample_z_test_impl>(begin_1, end_1, begin_2, end_2); } -template::value, bool>::type = true> +BOOST_MATH_EXPORT template::value, bool>::type = true> inline auto two_sample_z_test(Container const & u, Container const & v) -> std::pair { return detail::two_sample_z_test_impl>(std::begin(u), std::end(u), std::begin(v), std::end(v)); } -template::value, bool>::type = true> +BOOST_MATH_EXPORT template::value, bool>::type = true> inline auto two_sample_z_test(Container const & u, Container const & v) -> std::pair { return detail::two_sample_z_test_impl>(std::begin(u), std::end(u), std::begin(v), std::end(v)); diff --git a/module/CMakeLists.txt b/module/CMakeLists.txt index 823cc7f4d0..118e028db5 100644 --- a/module/CMakeLists.txt +++ b/module/CMakeLists.txt @@ -71,6 +71,11 @@ set(BOOST_MATH_MODULE_TESTS git_issue_898 cardinal_quadratic_b_spline_test whittaker_shannon_test + test_runs_test + linear_regression_test + ljung_box_test + differential_evolution_test + random_search_test ) add_executable(module_quick_test "${CMAKE_CURRENT_SOURCE_DIR}/quick_test.cpp") diff --git a/module/math.cxx b/module/math.cxx index 02f90e4177..1e18b039a1 100644 --- a/module/math.cxx +++ b/module/math.cxx @@ -182,6 +182,28 @@ import std; #include #include +// Statistics +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Optimization (cma_es is excluded: it requires Eigen) +#include +#include +#include +#include +#include +#include +#include +#include + #ifdef _MSC_VER # pragma warning( pop ) #elif defined(__clang__) diff --git a/module/quick_test.cpp b/module/quick_test.cpp index adf179f5f6..e65e996d03 100644 --- a/module/quick_test.cpp +++ b/module/quick_test.cpp @@ -83,6 +83,17 @@ int main() BOOST_TEST_LT(interp, 4.1); } + // statistics and optimization + { + std::vector data {1.0, 2.0, 3.0, 4.0, 5.0}; + BOOST_TEST_EQ(boost::math::statistics::mean(data), 3.0); + BOOST_TEST_EQ(boost::math::statistics::median(data), 3.0); + boost::math::optimization::random_search_parameters> params {}; + params.lower_bounds = {-1.0}; + params.upper_bounds = {1.0}; + static_cast(params); + } + // distributions { const boost::math::normal_distribution<> dist {}; diff --git a/test/differential_evolution_test.cpp b/test/differential_evolution_test.cpp index fdbb97dfad..bdab45cecb 100644 --- a/test/differential_evolution_test.cpp +++ b/test/differential_evolution_test.cpp @@ -5,9 +5,14 @@ * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) */ +#ifndef BOOST_MATH_BUILD_MODULE +#include +#else +import boost.math; +#endif + #include "math_unit_test.hpp" #include "test_functions_for_optimization.hpp" -#include #include using boost::math::optimization::differential_evolution; diff --git a/test/linear_regression_test.cpp b/test/linear_regression_test.cpp index 03570c53ac..d60353423c 100644 --- a/test/linear_regression_test.cpp +++ b/test/linear_regression_test.cpp @@ -6,13 +6,18 @@ * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) */ +#ifndef BOOST_MATH_BUILD_MODULE +#include +#else +import boost.math; +#endif + #include "math_unit_test.hpp" #include #include #include #include #include -#include using boost::math::statistics::simple_ordinary_least_squares; using boost::math::statistics::simple_ordinary_least_squares_with_R_squared; diff --git a/test/ljung_box_test.cpp b/test/ljung_box_test.cpp index 59d0827032..5abe08e2df 100644 --- a/test/ljung_box_test.cpp +++ b/test/ljung_box_test.cpp @@ -5,11 +5,16 @@ * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) */ +#ifndef BOOST_MATH_BUILD_MODULE +#include +#else +import boost.math; +#endif + #include "math_unit_test.hpp" #include #include #include -#include using boost::math::statistics::ljung_box; diff --git a/test/random_search_test.cpp b/test/random_search_test.cpp index 51eccf7450..6f45e97a82 100644 --- a/test/random_search_test.cpp +++ b/test/random_search_test.cpp @@ -5,9 +5,14 @@ * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) */ +#ifndef BOOST_MATH_BUILD_MODULE +#include +#else +import boost.math; +#endif + #include "math_unit_test.hpp" #include "test_functions_for_optimization.hpp" -#include #include #include using boost::math::optimization::random_search; diff --git a/test/test_functions_for_optimization.hpp b/test/test_functions_for_optimization.hpp index da989fc09e..8b52084060 100644 --- a/test/test_functions_for_optimization.hpp +++ b/test/test_functions_for_optimization.hpp @@ -7,7 +7,9 @@ #ifndef TEST_FUNCTIONS_FOR_OPTIMIZATION_HPP #define TEST_FUNCTIONS_FOR_OPTIMIZATION_HPP +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif #include #include diff --git a/test/test_runs_test.cpp b/test/test_runs_test.cpp index 94d5c5a2ca..13b986d675 100644 --- a/test/test_runs_test.cpp +++ b/test/test_runs_test.cpp @@ -5,10 +5,15 @@ * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) */ +#ifndef BOOST_MATH_BUILD_MODULE +#include +#else +import boost.math; +#endif + #include "math_unit_test.hpp" #include #include -#include using boost::math::statistics::runs_above_and_below_median; From 18f8fb76b2bd54fbe03606f2b17ff9ce9d9cdb61 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Wed, 15 Jul 2026 11:27:01 -0400 Subject: [PATCH 09/27] Export differentiation and the algebra types for the boost.math module * BOOST_MATH_EXPORT on autodiff (make_fvar, make_ftuple, promote, real_cast), finite differences, lanczos smoothing, the complex inverse trigonometric functions, quaternion and octonion including their macro generated operator sets, and the boost/math_fwd.hpp forward declarations * Fixes a pre-existing ambiguity: autodiff's fully qualified differentiation::detail::fvar references are ambiguous whenever finite_difference.hpp is visible in the same translation unit, so they now name the autodiff_v1 inline namespace explicitly * Adds differentiation, complex.hpp, quaternion.hpp and octonion.hpp to the module interface unit (finite_difference and lanczos_smoothing precede autodiff by necessity) * Module test harness gains quaternion_constexpr_test and octonion_test_simple; both tests now include what they use --- include/boost/math/complex/acos.hpp | 2 +- include/boost/math/complex/acosh.hpp | 2 +- include/boost/math/complex/asin.hpp | 2 +- include/boost/math/complex/asinh.hpp | 2 +- include/boost/math/complex/atan.hpp | 2 +- include/boost/math/complex/atanh.hpp | 2 +- include/boost/math/complex/fabs.hpp | 2 +- .../boost/math/differentiation/autodiff.hpp | 20 ++-- .../differentiation/finite_difference.hpp | 4 +- .../differentiation/lanczos_smoothing.hpp | 2 +- include/boost/math/octonion.hpp | 94 ++++++++-------- include/boost/math/quaternion.hpp | 102 +++++++++--------- include/boost/math_fwd.hpp | 6 +- module/CMakeLists.txt | 6 ++ module/math.cxx | 12 +++ module/quick_test.cpp | 28 +++++ test/octonion_test_simple.cpp | 5 + test/quaternion_constexpr_test.cpp | 6 ++ 18 files changed, 179 insertions(+), 120 deletions(-) diff --git a/include/boost/math/complex/acos.hpp b/include/boost/math/complex/acos.hpp index 91df777414..a5b2ca0bc6 100644 --- a/include/boost/math/complex/acos.hpp +++ b/include/boost/math/complex/acos.hpp @@ -19,7 +19,7 @@ namespace std{ using ::sqrt; using ::fabs; using ::acos; using ::asin; using ::a namespace boost{ namespace math{ -template +BOOST_MATH_EXPORT template [[deprecated("Replaced by C++11")]] std::complex acos(const std::complex& z) { // diff --git a/include/boost/math/complex/acosh.hpp b/include/boost/math/complex/acosh.hpp index c5b52826e5..38266f6466 100644 --- a/include/boost/math/complex/acosh.hpp +++ b/include/boost/math/complex/acosh.hpp @@ -15,7 +15,7 @@ namespace boost{ namespace math{ -template +BOOST_MATH_EXPORT template [[deprecated("Replaced by C++11")]] inline std::complex acosh(const std::complex& z) { // diff --git a/include/boost/math/complex/asin.hpp b/include/boost/math/complex/asin.hpp index d1fbc2f164..f91c929867 100644 --- a/include/boost/math/complex/asin.hpp +++ b/include/boost/math/complex/asin.hpp @@ -19,7 +19,7 @@ namespace std{ using ::sqrt; using ::fabs; using ::acos; using ::asin; using ::a namespace boost{ namespace math{ -template +BOOST_MATH_EXPORT template [[deprecated("Replaced by C++11")]] inline std::complex asin(const std::complex& z) { // diff --git a/include/boost/math/complex/asinh.hpp b/include/boost/math/complex/asinh.hpp index 1c9a42eb07..8ba135d0e3 100644 --- a/include/boost/math/complex/asinh.hpp +++ b/include/boost/math/complex/asinh.hpp @@ -15,7 +15,7 @@ namespace boost{ namespace math{ -template +BOOST_MATH_EXPORT template [[deprecated("Replaced by C++11")]] inline std::complex asinh(const std::complex& x) { // diff --git a/include/boost/math/complex/atan.hpp b/include/boost/math/complex/atan.hpp index a11ea41ee5..f5691ee997 100644 --- a/include/boost/math/complex/atan.hpp +++ b/include/boost/math/complex/atan.hpp @@ -15,7 +15,7 @@ namespace boost{ namespace math{ -template +BOOST_MATH_EXPORT template [[deprecated("Replaced by C++11")]] std::complex atan(const std::complex& x) { // diff --git a/include/boost/math/complex/atanh.hpp b/include/boost/math/complex/atanh.hpp index 5b7dc90108..d089487426 100644 --- a/include/boost/math/complex/atanh.hpp +++ b/include/boost/math/complex/atanh.hpp @@ -20,7 +20,7 @@ namespace std{ using ::sqrt; using ::fabs; using ::acos; using ::asin; using ::a namespace boost{ namespace math{ -template +BOOST_MATH_EXPORT template [[deprecated("Replaced by C++11")]] std::complex atanh(const std::complex& z) { // diff --git a/include/boost/math/complex/fabs.hpp b/include/boost/math/complex/fabs.hpp index 5eb8b3bd80..710eee823a 100644 --- a/include/boost/math/complex/fabs.hpp +++ b/include/boost/math/complex/fabs.hpp @@ -12,7 +12,7 @@ namespace boost{ namespace math{ -template +BOOST_MATH_EXPORT template inline T fabs(const std::complex& z) { return ::boost::math::hypot(z.real(), z.imag()); diff --git a/include/boost/math/differentiation/autodiff.hpp b/include/boost/math/differentiation/autodiff.hpp index 83c8793072..7e6d4fccb2 100644 --- a/include/boost/math/differentiation/autodiff.hpp +++ b/include/boost/math/differentiation/autodiff.hpp @@ -51,7 +51,7 @@ struct promote_args_n { } // namespace detail -template +BOOST_MATH_EXPORT template using promote = typename detail::promote_args_n::type; namespace detail { @@ -617,10 +617,10 @@ struct zero : std::integral_constant {}; } // namespace detail -template +BOOST_MATH_EXPORT template using autodiff_fvar = typename detail::nest_fvar::type; -template +BOOST_MATH_EXPORT template autodiff_fvar make_fvar(RealType const& ca) { return autodiff_fvar(ca, true); } @@ -640,7 +640,7 @@ auto make_ftuple_impl(std::index_sequence, RealTypes const&... ca) { } // namespace detail -template +BOOST_MATH_EXPORT template auto make_ftuple(RealTypes const&... ca) { static_assert(sizeof...(Orders) == sizeof...(RealTypes), "Number of Orders must match number of function parameters."); @@ -1984,8 +1984,8 @@ namespace std { // boost::math::tools::digits() is handled by this std::numeric_limits<> specialization, // and similarly for max_value, min_value, log_max_value, log_min_value, and epsilon. template -class numeric_limits> - : public numeric_limits::root_type> { +class numeric_limits> + : public numeric_limits::root_type> { }; } // namespace std @@ -1996,7 +1996,7 @@ namespace tools { namespace detail { template -using autodiff_fvar_type = differentiation::detail::fvar; +using autodiff_fvar_type = differentiation::autodiff_v1::detail::fvar; template using autodiff_root_type = typename autodiff_fvar_type::root_type; @@ -2029,7 +2029,7 @@ struct promote_args> { using type = detail::autodiff_fvar_type::type, Order1>; }; -template +BOOST_MATH_EXPORT template inline constexpr destination_t real_cast(detail::autodiff_fvar_type const& from_v) noexcept(BOOST_MATH_IS_FLOAT(destination_t) && BOOST_MATH_IS_FLOAT(RealType)) { return real_cast(static_cast>(from_v)); @@ -2039,8 +2039,8 @@ inline constexpr destination_t real_cast(detail::autodiff_fvar_type -using fvar_t = differentiation::detail::fvar; +BOOST_MATH_EXPORT template +using fvar_t = differentiation::autodiff_v1::detail::fvar; template struct evaluation, Policy> { using type = fvar_t::type, Order>; diff --git a/include/boost/math/differentiation/finite_difference.hpp b/include/boost/math/differentiation/finite_difference.hpp index 5230c38cff..3b420f58cb 100644 --- a/include/boost/math/differentiation/finite_difference.hpp +++ b/include/boost/math/differentiation/finite_difference.hpp @@ -69,7 +69,7 @@ namespace detail { } } -template +BOOST_MATH_EXPORT template Real complex_step_derivative(const F f, Real x) { // Is it really this easy? Yes. @@ -258,7 +258,7 @@ namespace detail { } -template +BOOST_MATH_EXPORT template inline Real finite_difference_derivative(const F f, Real x, Real* error = nullptr) { return detail::finite_difference_derivative(f, x, error, detail::fd_tag()); diff --git a/include/boost/math/differentiation/lanczos_smoothing.hpp b/include/boost/math/differentiation/lanczos_smoothing.hpp index 97d2315c21..1257945be9 100644 --- a/include/boost/math/differentiation/lanczos_smoothing.hpp +++ b/include/boost/math/differentiation/lanczos_smoothing.hpp @@ -254,7 +254,7 @@ std::vector acceleration_filter(std::size_t n, std::size_t p, int64_t s) } // namespace detail -template +BOOST_MATH_EXPORT template class discrete_lanczos_derivative { public: discrete_lanczos_derivative(Real const & spacing, diff --git a/include/boost/math/octonion.hpp b/include/boost/math/octonion.hpp index 4f66e533a4..69ee6db1f1 100644 --- a/include/boost/math/octonion.hpp +++ b/include/boost/math/octonion.hpp @@ -181,7 +181,7 @@ namespace boost // the The behavior of octonion is unspecified if T is not // one of float, double or long double. - template + BOOST_MATH_EXPORT template class octonion { public: @@ -1257,7 +1257,7 @@ namespace boost BOOST_OCTONION_MEMBER_DIV_GENERATOR(type) - template<> + BOOST_MATH_EXPORT template<> class octonion { public: @@ -1315,7 +1315,7 @@ namespace boost }; - template<> + BOOST_MATH_EXPORT template<> class octonion { public: @@ -1375,7 +1375,7 @@ namespace boost }; - template<> + BOOST_MATH_EXPORT template<> class octonion { public: @@ -1483,37 +1483,37 @@ namespace boost } #define BOOST_OCTONION_OPERATOR_GENERATOR_1_L(op) \ - template \ + BOOST_MATH_EXPORT template \ inline octonion operator op (T const & lhs, octonion const & rhs) \ BOOST_OCTONION_OPERATOR_GENERATOR_BODY(op) #define BOOST_OCTONION_OPERATOR_GENERATOR_1_R(op) \ - template \ + BOOST_MATH_EXPORT template \ inline octonion operator op (octonion const & lhs, T const & rhs) \ BOOST_OCTONION_OPERATOR_GENERATOR_BODY(op) #define BOOST_OCTONION_OPERATOR_GENERATOR_2_L(op) \ - template \ + BOOST_MATH_EXPORT template \ inline octonion operator op (::std::complex const & lhs, octonion const & rhs) \ BOOST_OCTONION_OPERATOR_GENERATOR_BODY(op) #define BOOST_OCTONION_OPERATOR_GENERATOR_2_R(op) \ - template \ + BOOST_MATH_EXPORT template \ inline octonion operator op (octonion const & lhs, ::std::complex const & rhs) \ BOOST_OCTONION_OPERATOR_GENERATOR_BODY(op) #define BOOST_OCTONION_OPERATOR_GENERATOR_3_L(op) \ - template \ + BOOST_MATH_EXPORT template \ inline octonion operator op (::boost::math::quaternion const & lhs, octonion const & rhs) \ BOOST_OCTONION_OPERATOR_GENERATOR_BODY(op) #define BOOST_OCTONION_OPERATOR_GENERATOR_3_R(op) \ - template \ + BOOST_MATH_EXPORT template \ inline octonion operator op (octonion const & lhs, ::boost::math::quaternion const & rhs) \ BOOST_OCTONION_OPERATOR_GENERATOR_BODY(op) #define BOOST_OCTONION_OPERATOR_GENERATOR_4(op) \ - template \ + BOOST_MATH_EXPORT template \ inline octonion operator op (octonion const & lhs, octonion const & rhs) \ BOOST_OCTONION_OPERATOR_GENERATOR_BODY(op) @@ -1546,21 +1546,21 @@ namespace boost #undef BOOST_OCTONION_OPERATOR_GENERATOR_BODY - template + BOOST_MATH_EXPORT template inline octonion operator + (octonion const & o) { return(o); } - template + BOOST_MATH_EXPORT template inline octonion operator - (octonion const & o) { return(octonion(-o.R_component_1(),-o.R_component_2(),-o.R_component_3(),-o.R_component_4(),-o.R_component_5(),-o.R_component_6(),-o.R_component_7(),-o.R_component_8())); } - template + BOOST_MATH_EXPORT template inline bool operator == (T const & lhs, octonion const & rhs) { return( @@ -1576,7 +1576,7 @@ namespace boost } - template + BOOST_MATH_EXPORT template inline bool operator == (octonion const & lhs, T const & rhs) { return( @@ -1592,7 +1592,7 @@ namespace boost } - template + BOOST_MATH_EXPORT template inline bool operator == (::std::complex const & lhs, octonion const & rhs) { return( @@ -1608,7 +1608,7 @@ namespace boost } - template + BOOST_MATH_EXPORT template inline bool operator == (octonion const & lhs, ::std::complex const & rhs) { return( @@ -1624,7 +1624,7 @@ namespace boost } - template + BOOST_MATH_EXPORT template inline bool operator == (::boost::math::quaternion const & lhs, octonion const & rhs) { return( @@ -1640,7 +1640,7 @@ namespace boost } - template + BOOST_MATH_EXPORT template inline bool operator == (octonion const & lhs, ::boost::math::quaternion const & rhs) { return( @@ -1656,7 +1656,7 @@ namespace boost } - template + BOOST_MATH_EXPORT template inline bool operator == (octonion const & lhs, octonion const & rhs) { return( @@ -1677,31 +1677,31 @@ namespace boost return(!(lhs == rhs)); \ } - template + BOOST_MATH_EXPORT template inline bool operator != (T const & lhs, octonion const & rhs) BOOST_OCTONION_NOT_EQUAL_GENERATOR - template + BOOST_MATH_EXPORT template inline bool operator != (octonion const & lhs, T const & rhs) BOOST_OCTONION_NOT_EQUAL_GENERATOR - template + BOOST_MATH_EXPORT template inline bool operator != (::std::complex const & lhs, octonion const & rhs) BOOST_OCTONION_NOT_EQUAL_GENERATOR - template + BOOST_MATH_EXPORT template inline bool operator != (octonion const & lhs, ::std::complex const & rhs) BOOST_OCTONION_NOT_EQUAL_GENERATOR - template + BOOST_MATH_EXPORT template inline bool operator != (::boost::math::quaternion const & lhs, octonion const & rhs) BOOST_OCTONION_NOT_EQUAL_GENERATOR - template + BOOST_MATH_EXPORT template inline bool operator != (octonion const & lhs, ::boost::math::quaternion const & rhs) BOOST_OCTONION_NOT_EQUAL_GENERATOR - template + BOOST_MATH_EXPORT template inline bool operator != (octonion const & lhs, octonion const & rhs) BOOST_OCTONION_NOT_EQUAL_GENERATOR @@ -1712,7 +1712,7 @@ namespace boost // Note: the default values in the constructors of the complex and quaternions make for // a very complex and ambiguous situation; we have made choices to disambiguate. - template + BOOST_MATH_EXPORT template ::std::basic_istream & operator >> ( ::std::basic_istream & is, octonion & o) { @@ -3858,7 +3858,7 @@ namespace boost // LCOV_EXCL_STOP - template + BOOST_MATH_EXPORT template ::std::basic_ostream & operator << ( ::std::basic_ostream & os, octonion const & o) { @@ -3886,14 +3886,14 @@ namespace boost // values - template + BOOST_MATH_EXPORT template inline T real(octonion const & o) { return(o.real()); } - template + BOOST_MATH_EXPORT template inline octonion unreal(octonion const & o) { return(o.unreal()); @@ -3915,7 +3915,7 @@ namespace boost temp[7] = o.R_component_8(); - template + BOOST_MATH_EXPORT template inline T sup(octonion const & o) { #ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP @@ -3928,7 +3928,7 @@ namespace boost } - template + BOOST_MATH_EXPORT template inline T l1(octonion const & o) { #ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP @@ -3941,7 +3941,7 @@ namespace boost } - template + BOOST_MATH_EXPORT template inline T abs(const octonion & o) { #ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP @@ -3978,14 +3978,14 @@ namespace boost // Note: This is the Cayley norm, not the Euclidean norm... - template + BOOST_MATH_EXPORT template inline T norm(octonion const & o) { return(real(o*conj(o))); } - template + BOOST_MATH_EXPORT template inline octonion conj(octonion const & o) { return(octonion( +o.R_component_1(), @@ -4003,7 +4003,7 @@ namespace boost // to the complex "arg" and the quaternionic "cylindropolar". - template + BOOST_MATH_EXPORT template inline octonion spherical(T const & rho, T const & theta, T const & phi1, @@ -4058,7 +4058,7 @@ namespace boost } - template + BOOST_MATH_EXPORT template inline octonion multipolar(T const & rho1, T const & theta1, T const & rho2, @@ -4084,7 +4084,7 @@ namespace boost } - template + BOOST_MATH_EXPORT template inline octonion cylindrical(T const & r, T const & angle, T const & h1, @@ -4104,7 +4104,7 @@ namespace boost } - template + BOOST_MATH_EXPORT template inline octonion exp(octonion const & o) { using ::std::exp; @@ -4126,7 +4126,7 @@ namespace boost } - template + BOOST_MATH_EXPORT template inline octonion cos(octonion const & o) { using ::std::sin; @@ -4147,7 +4147,7 @@ namespace boost } - template + BOOST_MATH_EXPORT template inline octonion sin(octonion const & o) { using ::std::sin; @@ -4168,35 +4168,35 @@ namespace boost } - template + BOOST_MATH_EXPORT template inline octonion tan(octonion const & o) { return(sin(o)/cos(o)); } - template + BOOST_MATH_EXPORT template inline octonion cosh(octonion const & o) { return((exp(+o)+exp(-o))/static_cast(2)); } - template + BOOST_MATH_EXPORT template inline octonion sinh(octonion const & o) { return((exp(+o)-exp(-o))/static_cast(2)); } - template + BOOST_MATH_EXPORT template inline octonion tanh(octonion const & o) { return(sinh(o)/cosh(o)); } - template + BOOST_MATH_EXPORT template octonion pow(octonion const & o, int n) { diff --git a/include/boost/math/quaternion.hpp b/include/boost/math/quaternion.hpp index 87fbfb0cc3..2067598dd4 100644 --- a/include/boost/math/quaternion.hpp +++ b/include/boost/math/quaternion.hpp @@ -65,7 +65,7 @@ namespace boost } #endif - template + BOOST_MATH_EXPORT template class quaternion { public: @@ -430,84 +430,84 @@ namespace boost }; // swap: -template +BOOST_MATH_EXPORT template BOOST_MATH_CXX14_CONSTEXPR void swap(quaternion& a, quaternion& b) { a.swap(b); } // operator+ -template +BOOST_MATH_EXPORT template inline constexpr typename std::enable_if::value, quaternion >::type operator + (const quaternion& a, const T2& b) { return quaternion(static_cast(a.R_component_1() + b), a.R_component_2(), a.R_component_3(), a.R_component_4()); } -template +BOOST_MATH_EXPORT template inline constexpr typename std::enable_if::value, quaternion >::type operator + (const T1& a, const quaternion& b) { return quaternion(static_cast(b.R_component_1() + a), b.R_component_2(), b.R_component_3(), b.R_component_4()); } -template +BOOST_MATH_EXPORT template inline BOOST_MATH_CXX14_CONSTEXPR typename std::enable_if::value, quaternion >::type operator + (const quaternion& a, const std::complex& b) { return quaternion(a.R_component_1() + std::real(b), a.R_component_2() + std::imag(b), a.R_component_3(), a.R_component_4()); } -template +BOOST_MATH_EXPORT template inline BOOST_MATH_CXX14_CONSTEXPR typename std::enable_if::value, quaternion >::type operator + (const std::complex& a, const quaternion& b) { return quaternion(b.R_component_1() + std::real(a), b.R_component_2() + std::imag(a), b.R_component_3(), b.R_component_4()); } -template +BOOST_MATH_EXPORT template inline constexpr quaternion operator + (const quaternion& a, const quaternion& b) { return quaternion(a.R_component_1() + b.R_component_1(), a.R_component_2() + b.R_component_2(), a.R_component_3() + b.R_component_3(), a.R_component_4() + b.R_component_4()); } // operator- -template +BOOST_MATH_EXPORT template inline constexpr typename std::enable_if::value, quaternion >::type operator - (const quaternion& a, const T2& b) { return quaternion(static_cast(a.R_component_1() - b), a.R_component_2(), a.R_component_3(), a.R_component_4()); } -template +BOOST_MATH_EXPORT template inline constexpr typename std::enable_if::value, quaternion >::type operator - (const T1& a, const quaternion& b) { return quaternion(static_cast(a - b.R_component_1()), -b.R_component_2(), -b.R_component_3(), -b.R_component_4()); } -template +BOOST_MATH_EXPORT template inline BOOST_MATH_CXX14_CONSTEXPR typename std::enable_if::value, quaternion >::type operator - (const quaternion& a, const std::complex& b) { return quaternion(a.R_component_1() - std::real(b), a.R_component_2() - std::imag(b), a.R_component_3(), a.R_component_4()); } -template +BOOST_MATH_EXPORT template inline BOOST_MATH_CXX14_CONSTEXPR typename std::enable_if::value, quaternion >::type operator - (const std::complex& a, const quaternion& b) { return quaternion(std::real(a) - b.R_component_1(), std::imag(a) - b.R_component_2(), -b.R_component_3(), -b.R_component_4()); } -template +BOOST_MATH_EXPORT template inline constexpr quaternion operator - (const quaternion& a, const quaternion& b) { return quaternion(a.R_component_1() - b.R_component_1(), a.R_component_2() - b.R_component_2(), a.R_component_3() - b.R_component_3(), a.R_component_4() - b.R_component_4()); } // operator* -template +BOOST_MATH_EXPORT template inline constexpr typename std::enable_if::value, quaternion >::type operator * (const quaternion& a, const T2& b) { return quaternion(static_cast(a.R_component_1() * b), a.R_component_2() * b, a.R_component_3() * b, a.R_component_4() * b); } -template +BOOST_MATH_EXPORT template inline constexpr typename std::enable_if::value, quaternion >::type operator * (const T1& a, const quaternion& b) { return quaternion(static_cast(a * b.R_component_1()), a * b.R_component_2(), a * b.R_component_3(), a * b.R_component_4()); } -template +BOOST_MATH_EXPORT template inline BOOST_MATH_CXX14_CONSTEXPR typename std::enable_if::value, quaternion >::type operator * (const quaternion& a, const std::complex& b) { @@ -515,7 +515,7 @@ operator * (const quaternion& a, const std::complex& b) result *= b; return result; } -template +BOOST_MATH_EXPORT template inline BOOST_MATH_CXX14_CONSTEXPR typename std::enable_if::value, quaternion >::type operator * (const std::complex& a, const quaternion& b) { @@ -523,7 +523,7 @@ operator * (const std::complex& a, const quaternion& b) result *= b; return result; } -template +BOOST_MATH_EXPORT template inline BOOST_MATH_CXX14_CONSTEXPR quaternion operator * (const quaternion& a, const quaternion& b) { quaternion result(a); @@ -532,13 +532,13 @@ inline BOOST_MATH_CXX14_CONSTEXPR quaternion operator * (const quaternion& } // operator/ -template +BOOST_MATH_EXPORT template inline constexpr typename std::enable_if::value, quaternion >::type operator / (const quaternion& a, const T2& b) { return quaternion(a.R_component_1() / b, a.R_component_2() / b, a.R_component_3() / b, a.R_component_4() / b); } -template +BOOST_MATH_EXPORT template inline BOOST_MATH_CXX14_CONSTEXPR typename std::enable_if::value, quaternion >::type operator / (const T1& a, const quaternion& b) { @@ -546,7 +546,7 @@ operator / (const T1& a, const quaternion& b) result /= b; return result; } -template +BOOST_MATH_EXPORT template inline BOOST_MATH_CXX14_CONSTEXPR typename std::enable_if::value, quaternion >::type operator / (const quaternion& a, const std::complex& b) { @@ -554,7 +554,7 @@ operator / (const quaternion& a, const std::complex& b) result /= b; return result; } -template +BOOST_MATH_EXPORT template inline BOOST_MATH_CXX14_CONSTEXPR typename std::enable_if::value, quaternion >::type operator / (const std::complex& a, const quaternion& b) { @@ -562,7 +562,7 @@ operator / (const std::complex& a, const quaternion& b) result /= b; return result; } -template +BOOST_MATH_EXPORT template inline BOOST_MATH_CXX14_CONSTEXPR quaternion operator / (const quaternion& a, const quaternion& b) { quaternion result(a); @@ -571,21 +571,21 @@ inline BOOST_MATH_CXX14_CONSTEXPR quaternion operator / (const quaternion& } - template + BOOST_MATH_EXPORT template inline constexpr const quaternion& operator + (quaternion const & q) { return q; } - template + BOOST_MATH_EXPORT template inline constexpr quaternion operator - (quaternion const & q) { return(quaternion(-q.R_component_1(),-q.R_component_2(),-q.R_component_3(),-q.R_component_4())); } - template + BOOST_MATH_EXPORT template inline constexpr typename std::enable_if::value, bool>::type operator == (R const & lhs, quaternion const & rhs) { return ( @@ -597,14 +597,14 @@ inline BOOST_MATH_CXX14_CONSTEXPR quaternion operator / (const quaternion& } - template + BOOST_MATH_EXPORT template inline constexpr typename std::enable_if::value, bool>::type operator == (quaternion const & lhs, R const & rhs) { return rhs == lhs; } - template + BOOST_MATH_EXPORT template inline constexpr bool operator == (::std::complex const & lhs, quaternion const & rhs) { return ( @@ -616,14 +616,14 @@ inline BOOST_MATH_CXX14_CONSTEXPR quaternion operator / (const quaternion& } - template + BOOST_MATH_EXPORT template inline constexpr bool operator == (quaternion const & lhs, ::std::complex const & rhs) { return rhs == lhs; } - template + BOOST_MATH_EXPORT template inline constexpr bool operator == (quaternion const & lhs, quaternion const & rhs) { return ( @@ -645,7 +645,7 @@ inline BOOST_MATH_CXX14_CONSTEXPR quaternion operator / (const quaternion& // a // (a), (a,b), (a,b,c), (a,b,c,d) // (a,(c)), (a,(c,d)), ((a)), ((a),c), ((a),(c)), ((a),(c,d)), ((a,b)), ((a,b),c), ((a,b),(c)), ((a,b),(c,d)) - template + BOOST_MATH_EXPORT template ::std::basic_istream & operator >> ( ::std::basic_istream & is, quaternion & q) { @@ -864,7 +864,7 @@ inline BOOST_MATH_CXX14_CONSTEXPR quaternion operator / (const quaternion& } - template + BOOST_MATH_EXPORT template ::std::basic_ostream & operator << ( ::std::basic_ostream & os, quaternion const & q) { @@ -885,20 +885,20 @@ inline BOOST_MATH_CXX14_CONSTEXPR quaternion operator / (const quaternion& // values - template + BOOST_MATH_EXPORT template inline constexpr T real(quaternion const & q) { return(q.real()); } - template + BOOST_MATH_EXPORT template inline constexpr quaternion unreal(quaternion const & q) { return(q.unreal()); } - template + BOOST_MATH_EXPORT template inline T sup(quaternion const & q) { using ::std::abs; @@ -906,7 +906,7 @@ inline BOOST_MATH_CXX14_CONSTEXPR quaternion operator / (const quaternion& } - template + BOOST_MATH_EXPORT template inline T l1(quaternion const & q) { using ::std::abs; @@ -914,7 +914,7 @@ inline BOOST_MATH_CXX14_CONSTEXPR quaternion operator / (const quaternion& } - template + BOOST_MATH_EXPORT template inline T abs(quaternion const & q) { using ::std::abs; @@ -949,14 +949,14 @@ inline BOOST_MATH_CXX14_CONSTEXPR quaternion operator / (const quaternion& // Note: This is the Cayley norm, not the Euclidean norm... - template + BOOST_MATH_EXPORT template inline BOOST_MATH_CXX14_CONSTEXPR T norm(quaternionconst & q) { return(real(q*conj(q))); } - template + BOOST_MATH_EXPORT template inline constexpr quaternion conj(quaternion const & q) { return(quaternion( +q.R_component_1(), @@ -966,7 +966,7 @@ inline BOOST_MATH_CXX14_CONSTEXPR quaternion operator / (const quaternion& } - template + BOOST_MATH_EXPORT template inline quaternion spherical( T const & rho, T const & theta, T const & phi1, @@ -997,7 +997,7 @@ inline BOOST_MATH_CXX14_CONSTEXPR quaternion operator / (const quaternion& } - template + BOOST_MATH_EXPORT template inline quaternion semipolar( T const & rho, T const & alpha, T const & theta1, @@ -1015,7 +1015,7 @@ inline BOOST_MATH_CXX14_CONSTEXPR quaternion operator / (const quaternion& } - template + BOOST_MATH_EXPORT template inline quaternion multipolar( T const & rho1, T const & theta1, T const & rho2, @@ -1033,7 +1033,7 @@ inline BOOST_MATH_CXX14_CONSTEXPR quaternion operator / (const quaternion& } - template + BOOST_MATH_EXPORT template inline quaternion cylindrospherical( T const & t, T const & radius, T const & longitude, @@ -1052,7 +1052,7 @@ inline BOOST_MATH_CXX14_CONSTEXPR quaternion operator / (const quaternion& } - template + BOOST_MATH_EXPORT template inline quaternion cylindrical(T const & r, T const & angle, T const & h1, @@ -1072,7 +1072,7 @@ inline BOOST_MATH_CXX14_CONSTEXPR quaternion operator / (const quaternion& // (please see the documentation) - template + BOOST_MATH_EXPORT template inline quaternion exp(quaternion const & q) { using ::std::exp; @@ -1092,7 +1092,7 @@ inline BOOST_MATH_CXX14_CONSTEXPR quaternion operator / (const quaternion& } - template + BOOST_MATH_EXPORT template inline quaternion cos(quaternion const & q) { using ::std::sin; @@ -1111,7 +1111,7 @@ inline BOOST_MATH_CXX14_CONSTEXPR quaternion operator / (const quaternion& } - template + BOOST_MATH_EXPORT template inline quaternion sin(quaternion const & q) { using ::std::sin; @@ -1130,35 +1130,35 @@ inline BOOST_MATH_CXX14_CONSTEXPR quaternion operator / (const quaternion& } - template + BOOST_MATH_EXPORT template inline quaternion tan(quaternion const & q) { return(sin(q)/cos(q)); } - template + BOOST_MATH_EXPORT template inline quaternion cosh(quaternion const & q) { return((exp(+q)+exp(-q))/static_cast(2)); } - template + BOOST_MATH_EXPORT template inline quaternion sinh(quaternion const & q) { return((exp(+q)-exp(-q))/static_cast(2)); } - template + BOOST_MATH_EXPORT template inline quaternion tanh(quaternion const & q) { return(sinh(q)/cosh(q)); } - template + BOOST_MATH_EXPORT template quaternion pow(quaternion const & q, int n) { diff --git a/include/boost/math_fwd.hpp b/include/boost/math_fwd.hpp index cb044718d9..1218917ee7 100644 --- a/include/boost/math_fwd.hpp +++ b/include/boost/math_fwd.hpp @@ -9,6 +9,8 @@ #ifndef BOOST_MATH_FWD_HPP #define BOOST_MATH_FWD_HPP +#include + namespace boost { namespace math @@ -17,7 +19,7 @@ namespace math // From ----------------------------------------// -template < typename T > +BOOST_MATH_EXPORT template < typename T > class quaternion; // Also has many function templates (including operators) @@ -25,7 +27,7 @@ template < typename T > // From ------------------------------------------// -template < typename T > +BOOST_MATH_EXPORT template < typename T > class octonion; template < > diff --git a/module/CMakeLists.txt b/module/CMakeLists.txt index 118e028db5..dc53fd37b2 100644 --- a/module/CMakeLists.txt +++ b/module/CMakeLists.txt @@ -76,8 +76,13 @@ set(BOOST_MATH_MODULE_TESTS ljung_box_test differential_evolution_test random_search_test + quaternion_constexpr_test + octonion_test_simple ) +# octonion_test_simple additionally uses Boost.MPL textually +set(BOOST_MATH_MODULE_EXTRA_LIBS_octonion_test_simple Boost::mpl) + add_executable(module_quick_test "${CMAKE_CURRENT_SOURCE_DIR}/quick_test.cpp") target_link_libraries(module_quick_test PRIVATE boost_math_module Boost::core) # The superproject pins an older policy version (CMP0155), so C++ sources are not @@ -93,6 +98,7 @@ foreach(test ${BOOST_MATH_MODULE_TESTS}) PRIVATE boost_math_module Boost::core + ${BOOST_MATH_MODULE_EXTRA_LIBS_${test}} ) set_target_properties(module_${test} PROPERTIES CXX_SCAN_FOR_MODULES ON CXX_MODULE_STD ON) add_test(NAME module_${test} COMMAND module_${test}) diff --git a/module/math.cxx b/module/math.cxx index 1e18b039a1..a7d025cb93 100644 --- a/module/math.cxx +++ b/module/math.cxx @@ -204,6 +204,18 @@ import std; #include #include +// Differentiation. finite_difference and lanczos_smoothing must precede +// autodiff: their unqualified detail:: references become ambiguous once +// autodiff's inline namespace introduces a second differentiation::detail. +#include +#include +#include + +// Algebra types and complex inverse trigonometric functions +#include +#include +#include + #ifdef _MSC_VER # pragma warning( pop ) #elif defined(__clang__) diff --git a/module/quick_test.cpp b/module/quick_test.cpp index e65e996d03..b28bc50873 100644 --- a/module/quick_test.cpp +++ b/module/quick_test.cpp @@ -14,6 +14,8 @@ import std; #include #include #include +#include +#include #endif import boost.math; @@ -107,5 +109,31 @@ int main() BOOST_TEST_LT(q, 26.0); } + // differentiation + { + const auto derivative {boost::math::differentiation::finite_difference_derivative( + [](double x) { return x * x; }, 1.0)}; + BOOST_TEST_GT(derivative, 1.99); + BOOST_TEST_LT(derivative, 2.01); + const auto x {boost::math::differentiation::make_fvar(3.0)}; + const auto y {x * x}; + BOOST_TEST_EQ(y.derivative(1), 6.0); + // std::numeric_limits partial specialization is reachable through the import + using fvar_type = decltype(x); + static_assert(std::numeric_limits::is_specialized, "autodiff limits"); + } + + // quaternion, octonion and complex inverse trig + { + const boost::math::quaternion q {1.0, 2.0, 3.0, 4.0}; + BOOST_TEST_EQ(boost::math::norm(q), 30.0); + const boost::math::octonion o {1.0, 1.0}; + BOOST_TEST_GT(boost::math::abs(o), 1.41); + const std::complex z {0.5, 0.0}; + const auto az {boost::math::asin(z)}; + BOOST_TEST_GT(az.real(), 0.52); + BOOST_TEST_LT(az.real(), 0.53); + } + return boost::report_errors(); } diff --git a/test/octonion_test_simple.cpp b/test/octonion_test_simple.cpp index 53a9fc3d9e..97fc92eed4 100644 --- a/test/octonion_test_simple.cpp +++ b/test/octonion_test_simple.cpp @@ -5,9 +5,14 @@ // http://www.boost.org/LICENSE_1_0.txt) #include +#ifndef BOOST_MATH_BUILD_MODULE #include +#else +import boost.math; +#endif #include +#include #include #include diff --git a/test/quaternion_constexpr_test.cpp b/test/quaternion_constexpr_test.cpp index d212abe2ff..2c0cde6d72 100644 --- a/test/quaternion_constexpr_test.cpp +++ b/test/quaternion_constexpr_test.cpp @@ -6,7 +6,13 @@ // http://www.boost.org/LICENSE_1_0.txt) +#ifndef BOOST_MATH_BUILD_MODULE #include +#else +import boost.math; +#endif + +#include typedef boost::math::quaternion qt; typedef std::complex ct; From 0fd6b77191893d8fa9c81cc91da9b1b665266798 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Wed, 15 Jul 2026 11:34:27 -0400 Subject: [PATCH 10/27] Add documentation of module support --- doc/math.qbk | 1 + doc/overview/modules.qbk | 48 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 doc/overview/modules.qbk diff --git a/doc/math.qbk b/doc/math.qbk index f48c87b88c..e807897f93 100644 --- a/doc/math.qbk +++ b/doc/math.qbk @@ -562,6 +562,7 @@ and as a CD ISBN 0-9504833-2-X 978-0-9504833-2-0, Classification 519.2-dc22. [include overview/result_type_calc.qbk] [include overview/error_handling.qbk] [include overview/gpu.qbk] +[include overview/modules.qbk] [section:compilers_overview Compilers] [compilers_overview] diff --git a/doc/overview/modules.qbk b/doc/overview/modules.qbk new file mode 100644 index 0000000000..6d7cbdea38 --- /dev/null +++ b/doc/overview/modules.qbk @@ -0,0 +1,48 @@ +[section:cxx20_modules Support for C++20 Modules] + +[h4 C++20 Modules Support] + +Boost.Math can be consumed as the named module `boost.math`. +The module covers the public interface of the library: special functions, statistical distributions, constants, policies, ccmath, the public tools (root finding, minima, polynomials, rational and series evaluation, norms, condition numbers and friends), quadrature, the modern interpolators, statistics, optimization, differentiation (autodiff, finite differences and Lanczos smoothing), the complex inverse trigonometric functions, and the quaternion and octonion types. + + import boost.math; + + int main() + { + return boost::math::cdf(boost::math::normal_distribution<>(), 0.0) == 0.5 ? 0 : 1; + } + +Module support is completely inert unless the module is built and consumed explicitly: nothing changes for existing header users. + +[h4 How to build] + +The module interface unit lives in `libs/math/module/math.cxx` and requires a toolchain with support for the C++23 standard library module (`import std`), for example clang 20 or later with libc++, CMake 4.4 with Ninja, and the matching `CMAKE_EXPERIMENTAL_CXX_IMPORT_STD` UUID. +From a Boost superproject checkout: + + cmake -G Ninja -DBOOST_INCLUDE_LIBRARIES=math -DBUILD_TESTING=ON \ + -DBOOST_MATH_BUILD_MODULE=ON \ + -DCMAKE_CXX_COMPILER=clang++-20 \ + -DCMAKE_CXX_FLAGS="-stdlib=libc++" \ + -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD= \ + -DCMAKE_CXX_STDLIB_MODULES_JSON=/usr/lib/llvm-20/lib/libc++.modules.json .. + cmake --build . --target tests + ctest + +The module test suite reuses a curated subset of the regular test files, which switch from textual inclusion to `import boost.math;` when `BOOST_MATH_BUILD_MODULE` is defined. +The `cmake-module-test` job in the library's CI runs this configuration on every commit. + +[h4 Limitations] + +* The module is always built in standalone mode, so it has no dependencies on other Boost libraries. +* Macros do not cross module boundaries. + The policy configuration macros (`BOOST_MATH_DOMAIN_ERROR_POLICY` and friends) and the convenience macros `BOOST_MATH_DECLARE_DISTRIBUTIONS` and `BOOST_MATH_DECLARE_SPECIAL_FUNCTIONS` therefore have no effect on an importing translation unit. + Configure policies at the call site with `boost::math::policies::make_policy` or a `policy<...>` type instead; those interfaces are fully available through the import. +* The `user_error` policy is not supported through the module, because a user supplied `boost::math::policies::user_..._error` definition cannot attach to the module. +* A program should consume Boost.Math either through the module or through textual includes, not both. + The only headers that are safe to include textually alongside the import are `boost/math/tools/config.hpp` and `boost/math/tools/assert.hpp`, which the test support headers rely on. +* Excluded from the module: the TR1/C99 interfaces and `common_factor` headers, `boost/math/bindings`, `boost/math/concepts`, `boost/math/cstdfloat`, all deprecated headers, and the headers that require external non-Boost dependencies (`chebyshev_transform.hpp` and `interpolators/cardinal_trigonometric.hpp` need FFTW, `optimization/cma_es.hpp` needs Eigen). + These remain available as ordinary includes. +* `__float128` support (`BOOST_MATH_USE_FLOAT128`) is not enabled in the module build. +* On libc++ the parallel execution policy overloads in statistics compile out (no `` support), matching the ordinary header behavior on that standard library. + +[endsect] [/section:cxx20_modules Support for C++20 Modules] From f43138960e9745caf70a0529beade1d07f524de1 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Wed, 15 Jul 2026 11:38:52 -0400 Subject: [PATCH 11/27] Clarify that the module is consumable from C++20 The standard library maintainers agreed to provide import std in C++20 mode as well as C++23, so the docs no longer claim a C++23 requirement. The library sources never gated on C++23: the only floor is the C++17 inline variable check in tools/config.hpp. --- doc/overview/modules.qbk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/overview/modules.qbk b/doc/overview/modules.qbk index 6d7cbdea38..7de87a9412 100644 --- a/doc/overview/modules.qbk +++ b/doc/overview/modules.qbk @@ -16,7 +16,9 @@ Module support is completely inert unless the module is built and consumed expli [h4 How to build] -The module interface unit lives in `libs/math/module/math.cxx` and requires a toolchain with support for the C++23 standard library module (`import std`), for example clang 20 or later with libc++, CMake 4.4 with Ninja, and the matching `CMAKE_EXPERIMENTAL_CXX_IMPORT_STD` UUID. +The module is consumable from C++20 onward. +The interface unit lives in `libs/math/module/math.cxx` and builds with any toolchain that provides the standard library module (`import std`); the standard library maintainers agreed to make `import std` available in C++20 mode as well as C++23, so a C++23 compilation mode is not required. +The configuration exercised in CI is clang 20 or later with libc++, CMake 4.4 with Ninja, and the matching `CMAKE_EXPERIMENTAL_CXX_IMPORT_STD` UUID. From a Boost superproject checkout: cmake -G Ninja -DBOOST_INCLUDE_LIBRARIES=math -DBUILD_TESTING=ON \ From ff56f1c6419aa67e0567d20bb49427cf88f38d06 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Wed, 15 Jul 2026 11:47:51 -0400 Subject: [PATCH 12/27] Remove accidental commit test folder --- Testing/Temporary/CTestCostData.txt | 1 - 1 file changed, 1 deletion(-) delete mode 100644 Testing/Temporary/CTestCostData.txt diff --git a/Testing/Temporary/CTestCostData.txt b/Testing/Temporary/CTestCostData.txt deleted file mode 100644 index ed97d539c0..0000000000 --- a/Testing/Temporary/CTestCostData.txt +++ /dev/null @@ -1 +0,0 @@ ---- From 4014fa492af22d2fdb4a63a75e5ea7626ed02c8a Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Wed, 15 Jul 2026 11:57:23 -0400 Subject: [PATCH 13/27] Silence the reserved module identifier warning in module builds --- .github/workflows/ci.yml | 2 +- doc/overview/modules.qbk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 07c000147a..36d118d9bb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -891,7 +891,7 @@ jobs: -DBUILD_TESTING=ON \ -DBOOST_MATH_BUILD_MODULE=ON \ -DCMAKE_CXX_COMPILER=clang++-$LLVM_VERSION \ - -DCMAKE_CXX_FLAGS="-stdlib=libc++" \ + -DCMAKE_CXX_FLAGS="-stdlib=libc++ -Wno-reserved-module-identifier" \ -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=$IMPORT_STD_UUID \ -DCMAKE_CXX_STDLIB_MODULES_JSON=/usr/lib/llvm-$LLVM_VERSION/lib/libc++.modules.json \ .. diff --git a/doc/overview/modules.qbk b/doc/overview/modules.qbk index 7de87a9412..52f98460ab 100644 --- a/doc/overview/modules.qbk +++ b/doc/overview/modules.qbk @@ -24,7 +24,7 @@ From a Boost superproject checkout: cmake -G Ninja -DBOOST_INCLUDE_LIBRARIES=math -DBUILD_TESTING=ON \ -DBOOST_MATH_BUILD_MODULE=ON \ -DCMAKE_CXX_COMPILER=clang++-20 \ - -DCMAKE_CXX_FLAGS="-stdlib=libc++" \ + -DCMAKE_CXX_FLAGS="-stdlib=libc++ -Wno-reserved-module-identifier" \ -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD= \ -DCMAKE_CXX_STDLIB_MODULES_JSON=/usr/lib/llvm-20/lib/libc++.modules.json .. cmake --build . --target tests From 5e49f1ca921b1b84e2f741ec21338cee8a12953b Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Wed, 15 Jul 2026 13:04:09 -0400 Subject: [PATCH 14/27] Add a GCC module test to CI --- .github/workflows/ci.yml | 65 +++++++++++++++++++ doc/overview/modules.qbk | 2 +- .../detail/bezier_polynomial_detail.hpp | 2 +- include/boost/math/octonion.hpp | 6 +- .../boost/math/special_functions/cos_pi.hpp | 2 +- .../special_functions/detail/bessel_jy.hpp | 4 +- .../detail/unchecked_factorial.hpp | 10 +-- include/boost/math/special_functions/erf.hpp | 4 +- .../boost/math/special_functions/expm1.hpp | 2 +- .../boost/math/special_functions/prime.hpp | 2 +- .../special_functions/relative_difference.hpp | 2 +- .../boost/math/special_functions/round.hpp | 8 +-- include/boost/math/special_functions/sign.hpp | 2 +- .../boost/math/special_functions/sin_pi.hpp | 2 +- module/CMakeLists.txt | 9 +++ module/quick_test.cpp | 6 +- 16 files changed, 103 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 36d118d9bb..a5115c5983 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -897,3 +897,68 @@ jobs: .. cmake --build . --target tests ctest --output-on-failure --no-tests=error + + cmake-module-test-gcc: + strategy: + fail-fast: false + + runs-on: ubuntu-latest + + # GCC 15 (the first release with import std support and + # libstdc++.modules.json) is not packaged for the runner image, so the job + # runs in a container that ships it. + container: ubuntu:26.04 + + env: + GCC_VERSION: "15" + # Pinned so the experimental `import std` feature UUID below stays valid. + CMAKE_VERSION: 4.4.0 + # CMake gates `import std` behind this UUID; it is specific to the CMake version. + IMPORT_STD_UUID: f35a9ac6-8463-4d38-8eec-5d6008153e7d + + steps: + - name: Install toolchain + run: | + apt-get update + apt-get install -y g++-$GCC_VERSION gcc-$GCC_VERSION ninja-build wget ca-certificates git python3 + wget -q https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-linux-x86_64.tar.gz + tar -xzf cmake-$CMAKE_VERSION-linux-x86_64.tar.gz -C /opt + echo "/opt/cmake-$CMAKE_VERSION-linux-x86_64/bin" >> "$GITHUB_PATH" + + - uses: actions/checkout@v6 + + - 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: Build with the standard library module and boost.math module, then test + run: | + cd ../boost-root + mkdir __build__ && cd __build__ + cmake -G Ninja \ + -DBOOST_INCLUDE_LIBRARIES=$LIBRARY \ + -DBUILD_TESTING=ON \ + -DBOOST_MATH_BUILD_MODULE=ON \ + -DCMAKE_C_COMPILER=gcc-$GCC_VERSION \ + -DCMAKE_CXX_COMPILER=g++-$GCC_VERSION \ + -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=$IMPORT_STD_UUID \ + .. + cmake --build . --target tests + ctest --output-on-failure --no-tests=error diff --git a/doc/overview/modules.qbk b/doc/overview/modules.qbk index 52f98460ab..4e8d65b237 100644 --- a/doc/overview/modules.qbk +++ b/doc/overview/modules.qbk @@ -18,7 +18,7 @@ Module support is completely inert unless the module is built and consumed expli The module is consumable from C++20 onward. The interface unit lives in `libs/math/module/math.cxx` and builds with any toolchain that provides the standard library module (`import std`); the standard library maintainers agreed to make `import std` available in C++20 mode as well as C++23, so a C++23 compilation mode is not required. -The configuration exercised in CI is clang 20 or later with libc++, CMake 4.4 with Ninja, and the matching `CMAKE_EXPERIMENTAL_CXX_IMPORT_STD` UUID. +CI exercises two configurations, both with CMake 4.4, Ninja and the matching `CMAKE_EXPERIMENTAL_CXX_IMPORT_STD` UUID: clang 20 with libc++ runs the full module test suite, and GCC 15 with libstdc++ builds the module and runs the quick test (libstdc++ cannot yet mix the textual standard library includes used by the wider test sources with `import std` in the same translation unit). From a Boost superproject checkout: cmake -G Ninja -DBOOST_INCLUDE_LIBRARIES=math -DBUILD_TESTING=ON \ diff --git a/include/boost/math/interpolators/detail/bezier_polynomial_detail.hpp b/include/boost/math/interpolators/detail/bezier_polynomial_detail.hpp index 919537dd57..8276b0cd0c 100644 --- a/include/boost/math/interpolators/detail/bezier_polynomial_detail.hpp +++ b/include/boost/math/interpolators/detail/bezier_polynomial_detail.hpp @@ -18,7 +18,7 @@ namespace boost::math::interpolators::detail { template -static inline RandomAccessContainer& get_bezier_storage() +inline RandomAccessContainer& get_bezier_storage() { static thread_local RandomAccessContainer the_storage; return the_storage; diff --git a/include/boost/math/octonion.hpp b/include/boost/math/octonion.hpp index 69ee6db1f1..562369ea75 100644 --- a/include/boost/math/octonion.hpp +++ b/include/boost/math/octonion.hpp @@ -1257,7 +1257,7 @@ namespace boost BOOST_OCTONION_MEMBER_DIV_GENERATOR(type) - BOOST_MATH_EXPORT template<> + template<> class octonion { public: @@ -1315,7 +1315,7 @@ namespace boost }; - BOOST_MATH_EXPORT template<> + template<> class octonion { public: @@ -1375,7 +1375,7 @@ namespace boost }; - BOOST_MATH_EXPORT template<> + template<> class octonion { public: diff --git a/include/boost/math/special_functions/cos_pi.hpp b/include/boost/math/special_functions/cos_pi.hpp index f43c27d7b8..1167f7d8dd 100644 --- a/include/boost/math/special_functions/cos_pi.hpp +++ b/include/boost/math/special_functions/cos_pi.hpp @@ -103,7 +103,7 @@ BOOST_MATH_GPU_ENABLED auto cos_pi(T x) return ::cospi(x); } -BOOST_MATH_EXPORT template <> +template <> BOOST_MATH_GPU_ENABLED auto cos_pi(float x) { return ::cospif(x); diff --git a/include/boost/math/special_functions/detail/bessel_jy.hpp b/include/boost/math/special_functions/detail/bessel_jy.hpp index 2907f91eeb..7d4e6323c4 100644 --- a/include/boost/math/special_functions/detail/bessel_jy.hpp +++ b/include/boost/math/special_functions/detail/bessel_jy.hpp @@ -256,8 +256,8 @@ namespace boost { namespace math { return 0; } - BOOST_MATH_STATIC const int need_j = 1; - BOOST_MATH_STATIC const int need_y = 2; + BOOST_MATH_INLINE_CONSTEXPR int need_j = 1; + BOOST_MATH_INLINE_CONSTEXPR int need_y = 2; // Compute J(v, x) and Y(v, x) simultaneously by Steed's method, see // Barnett et al, Computer Physics Communications, vol 8, 377 (1974) diff --git a/include/boost/math/special_functions/detail/unchecked_factorial.hpp b/include/boost/math/special_functions/detail/unchecked_factorial.hpp index 6d207261d7..b7a9daef67 100644 --- a/include/boost/math/special_functions/detail/unchecked_factorial.hpp +++ b/include/boost/math/special_functions/detail/unchecked_factorial.hpp @@ -204,7 +204,7 @@ BOOST_MATH_GPU_ENABLED inline BOOST_MATH_CONSTEXPR_TABLE_FUNCTION float unchecke #endif -BOOST_MATH_EXPORT template <> +template <> struct max_factorial { static constexpr unsigned value = 34; @@ -579,7 +579,7 @@ BOOST_MATH_GPU_ENABLED inline BOOST_MATH_CONSTEXPR_TABLE_FUNCTION double uncheck return unchecked_factorial_data::factorials[i]; } -BOOST_MATH_EXPORT template <> +template <> struct max_factorial { static constexpr unsigned value = 170; @@ -631,7 +631,7 @@ BOOST_MATH_GPU_ENABLED inline BOOST_MATH_CONSTEXPR_TABLE_FUNCTION double uncheck return factorials[i]; } -BOOST_MATH_EXPORT template <> +template <> struct max_factorial { static constexpr unsigned value = 34; @@ -1008,7 +1008,7 @@ inline BOOST_MATH_CONSTEXPR_TABLE_FUNCTION long double unchecked_factorial::factorials[i]; } -BOOST_MATH_EXPORT template <> +template <> struct max_factorial { static constexpr unsigned value = 170; @@ -1383,7 +1383,7 @@ inline BOOST_MATH_CONSTEXPR_TABLE_FUNCTION BOOST_MATH_FLOAT128_TYPE unchecked_fa return unchecked_factorial_data::factorials[i]; } -BOOST_MATH_EXPORT template <> +template <> struct max_factorial { static constexpr unsigned value = 170; diff --git a/include/boost/math/special_functions/erf.hpp b/include/boost/math/special_functions/erf.hpp index e07caf8f3f..cf33413333 100644 --- a/include/boost/math/special_functions/erf.hpp +++ b/include/boost/math/special_functions/erf.hpp @@ -1282,7 +1282,7 @@ BOOST_MATH_GPU_ENABLED auto erf(T x) return ::erf(x); } -BOOST_MATH_EXPORT template <> +template <> BOOST_MATH_GPU_ENABLED auto erf(float x) { return ::erff(x); @@ -1306,7 +1306,7 @@ BOOST_MATH_GPU_ENABLED auto erfc(T x) return ::erfc(x); } -BOOST_MATH_EXPORT template <> +template <> BOOST_MATH_GPU_ENABLED auto erfc(float x) { return ::erfcf(x); diff --git a/include/boost/math/special_functions/expm1.hpp b/include/boost/math/special_functions/expm1.hpp index 490200aabb..163d1b4a96 100644 --- a/include/boost/math/special_functions/expm1.hpp +++ b/include/boost/math/special_functions/expm1.hpp @@ -388,7 +388,7 @@ BOOST_MATH_GPU_ENABLED auto expm1(T x) return ::expm1(x); } -BOOST_MATH_EXPORT template <> +template <> BOOST_MATH_GPU_ENABLED auto expm1(float x) { return ::expm1f(x); diff --git a/include/boost/math/special_functions/prime.hpp b/include/boost/math/special_functions/prime.hpp index 85263d7e83..017fe02eb5 100644 --- a/include/boost/math/special_functions/prime.hpp +++ b/include/boost/math/special_functions/prime.hpp @@ -2428,7 +2428,7 @@ constexpr std::array prime_data_imp::a3; return boost::math::prime(n, boost::math::policies::policy<>()); } - static const unsigned max_prime = 9999; + BOOST_MATH_EXPORT BOOST_MATH_INLINE_CONSTEXPR unsigned max_prime = 9999; }} // namespace boost and math diff --git a/include/boost/math/special_functions/relative_difference.hpp b/include/boost/math/special_functions/relative_difference.hpp index b16b238f22..9150abcf37 100644 --- a/include/boost/math/special_functions/relative_difference.hpp +++ b/include/boost/math/special_functions/relative_difference.hpp @@ -70,7 +70,7 @@ namespace boost{ } #if (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)) && (LDBL_MAX_EXP <= DBL_MAX_EXP) - BOOST_MATH_EXPORT template <> + template <> inline boost::math::tools::promote_args::type relative_difference(const double& arg_a, const double& arg_b) { BOOST_MATH_STD_USING diff --git a/include/boost/math/special_functions/round.hpp b/include/boost/math/special_functions/round.hpp index fef0810615..c20f9751dc 100644 --- a/include/boost/math/special_functions/round.hpp +++ b/include/boost/math/special_functions/round.hpp @@ -257,7 +257,7 @@ BOOST_MATH_GPU_ENABLED T round(T x) return ::round(x); } -BOOST_MATH_EXPORT template <> +template <> BOOST_MATH_GPU_ENABLED float round(float x) { return ::roundf(x); @@ -281,7 +281,7 @@ BOOST_MATH_GPU_ENABLED int iround(T x) return static_cast(::lround(x)); } -BOOST_MATH_EXPORT template <> +template <> BOOST_MATH_GPU_ENABLED int iround(float x) { return static_cast(::lroundf(x)); @@ -305,7 +305,7 @@ BOOST_MATH_GPU_ENABLED long lround(T x) return ::lround(x); } -BOOST_MATH_EXPORT template <> +template <> BOOST_MATH_GPU_ENABLED long lround(float x) { return ::lroundf(x); @@ -329,7 +329,7 @@ BOOST_MATH_GPU_ENABLED long long llround(T x) return ::llround(x); } -BOOST_MATH_EXPORT template <> +template <> BOOST_MATH_GPU_ENABLED long long llround(float x) { return ::llroundf(x); diff --git a/include/boost/math/special_functions/sign.hpp b/include/boost/math/special_functions/sign.hpp index 826299086b..b90a889c9c 100644 --- a/include/boost/math/special_functions/sign.hpp +++ b/include/boost/math/special_functions/sign.hpp @@ -219,7 +219,7 @@ BOOST_MATH_GPU_ENABLED T copysign(T x, T y) return ::copysign(x, y); } -BOOST_MATH_EXPORT template <> +template <> BOOST_MATH_GPU_ENABLED float copysign(float x, float y) { return ::copysignf(x, y); diff --git a/include/boost/math/special_functions/sin_pi.hpp b/include/boost/math/special_functions/sin_pi.hpp index 7b8454f70f..c1d7ea066e 100644 --- a/include/boost/math/special_functions/sin_pi.hpp +++ b/include/boost/math/special_functions/sin_pi.hpp @@ -110,7 +110,7 @@ BOOST_MATH_GPU_ENABLED auto sin_pi(T x) return ::sinpi(x); } -BOOST_MATH_EXPORT template <> +template <> BOOST_MATH_GPU_ENABLED auto sin_pi(float x) { return ::sinpif(x); diff --git a/module/CMakeLists.txt b/module/CMakeLists.txt index dc53fd37b2..ac855f0639 100644 --- a/module/CMakeLists.txt +++ b/module/CMakeLists.txt @@ -80,6 +80,15 @@ set(BOOST_MATH_MODULE_TESTS octonion_test_simple ) +# GCC 15 compiles the module itself, but libstdc++ cannot yet mix the textual +# standard library includes the test sources use with import std in the same +# consumer translation unit, so only the quick test runs there. The full list +# runs under clang/libc++. +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + message(STATUS "Boost.Math module: GCC consumer tests limited to module_quick_test") + set(BOOST_MATH_MODULE_TESTS) +endif() + # octonion_test_simple additionally uses Boost.MPL textually set(BOOST_MATH_MODULE_EXTRA_LIBS_octonion_test_simple Boost::mpl) diff --git a/module/quick_test.cpp b/module/quick_test.cpp index b28bc50873..d50d5355b3 100644 --- a/module/quick_test.cpp +++ b/module/quick_test.cpp @@ -7,12 +7,16 @@ #include +// The FP_ classification macros do not cross module boundaries, so +// is always included textually (before any import, which is the include +// ordering both libstdc++ and libc++ support). +#include + // Import the STL if we can #if defined(__cpp_lib_modules) && __cpp_lib_modules >= 202207L import std; #else #include -#include #include #include #include From 5b18f2cbf8b31318dabed623b316308c614f6b35 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Wed, 15 Jul 2026 13:26:21 -0400 Subject: [PATCH 15/27] Fix doc inspection failure --- doc/overview/modules.qbk | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/overview/modules.qbk b/doc/overview/modules.qbk index 4e8d65b237..c9a6531213 100644 --- a/doc/overview/modules.qbk +++ b/doc/overview/modules.qbk @@ -48,3 +48,10 @@ The `cmake-module-test` job in the library's CI runs this configuration on every * On libc++ the parallel execution policy overloads in statistics compile out (no `` support), matching the ordinary header behavior on that standard library. [endsect] [/section:cxx20_modules Support for C++20 Modules] + +[/ + Copyright 2026 Matt Borland. + Distributed under 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). +] From 74fc0c02a47ab3a192c13d4eb1ae746875084785 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Wed, 15 Jul 2026 13:29:33 -0400 Subject: [PATCH 16/27] Keep cstdfloat out of the module purview --- include/boost/math/differentiation/autodiff.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/boost/math/differentiation/autodiff.hpp b/include/boost/math/differentiation/autodiff.hpp index 7e6d4fccb2..dab82c4408 100644 --- a/include/boost/math/differentiation/autodiff.hpp +++ b/include/boost/math/differentiation/autodiff.hpp @@ -6,7 +6,11 @@ #ifndef BOOST_MATH_DIFFERENTIATION_AUTODIFF_HPP #define BOOST_MATH_DIFFERENTIATION_AUTODIFF_HPP +// cstdfloat is outside the module surface and textually includes standard +// library headers, which must not enter the module purview. +#ifndef BOOST_MATH_BUILD_MODULE #include +#endif #include #include #include From 3986feb49ee19a34057c39cd5c41dbee91bea0c5 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Thu, 16 Jul 2026 13:24:12 -0400 Subject: [PATCH 17/27] Change module file extension and add extern "C++" --- module/{math.cxx => math.cppm} | 4 ++++ 1 file changed, 4 insertions(+) rename module/{math.cxx => math.cppm} (99%) diff --git a/module/math.cxx b/module/math.cppm similarity index 99% rename from module/math.cxx rename to module/math.cppm index a7d025cb93..468ec20135 100644 --- a/module/math.cxx +++ b/module/math.cppm @@ -118,6 +118,8 @@ import std; # pragma clang diagnostic ignored "-Winclude-angled-in-module-purview" #endif +extern "C++" { + // Foundation components #include #include @@ -216,6 +218,8 @@ import std; #include #include +} // extern "C++" + #ifdef _MSC_VER # pragma warning( pop ) #elif defined(__clang__) From e5b102ecc4ea62ad09ee8e1c2fd5d41ce801c617 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Thu, 16 Jul 2026 13:28:23 -0400 Subject: [PATCH 18/27] Update references to file extension --- doc/overview/modules.qbk | 2 +- include/boost/math/tools/config.hpp | 4 ++-- module/CMakeLists.txt | 4 ++-- module/quick_test.cpp | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/overview/modules.qbk b/doc/overview/modules.qbk index c9a6531213..e9f26a1254 100644 --- a/doc/overview/modules.qbk +++ b/doc/overview/modules.qbk @@ -17,7 +17,7 @@ Module support is completely inert unless the module is built and consumed expli [h4 How to build] The module is consumable from C++20 onward. -The interface unit lives in `libs/math/module/math.cxx` and builds with any toolchain that provides the standard library module (`import std`); the standard library maintainers agreed to make `import std` available in C++20 mode as well as C++23, so a C++23 compilation mode is not required. +The interface unit lives in `libs/math/module/math.cppm` and builds with any toolchain that provides the standard library module (`import std`); the standard library maintainers agreed to make `import std` available in C++20 mode as well as C++23, so a C++23 compilation mode is not required. CI exercises two configurations, both with CMake 4.4, Ninja and the matching `CMAKE_EXPERIMENTAL_CXX_IMPORT_STD` UUID: clang 20 with libc++ runs the full module test suite, and GCC 15 with libstdc++ builds the module and runs the quick test (libstdc++ cannot yet mix the textual standard library includes used by the wider test sources with `import std` in the same translation unit). From a Boost superproject checkout: diff --git a/include/boost/math/tools/config.hpp b/include/boost/math/tools/config.hpp index d5c751c460..ec1e16d556 100644 --- a/include/boost/math/tools/config.hpp +++ b/include/boost/math/tools/config.hpp @@ -13,12 +13,12 @@ // C++20 named module support. // BOOST_MATH_BUILD_MODULE is defined when building or consuming the boost.math -// module (module/math.cxx and the module test harness). BOOST_MATH_EXPORT marks +// module (module/math.cppm and the module test harness). BOOST_MATH_EXPORT marks // every public entity and expands to nothing in ordinary header builds. // BOOST_MATH_TEST_EXPORT additionally exports detail entities exercised by the // module test suite, and only when the module is built with // BOOST_MATH_EXPORT_TESTING. BOOST_MATH_INTERFACE_UNIT is defined only by -// module/math.cxx itself and guards entities that a module consumer must +// module/math.cppm itself and guards entities that a module consumer must // receive from the import rather than redeclare. #ifdef BOOST_MATH_BUILD_MODULE diff --git a/module/CMakeLists.txt b/module/CMakeLists.txt index ac855f0639..a404ed1285 100644 --- a/module/CMakeLists.txt +++ b/module/CMakeLists.txt @@ -17,12 +17,12 @@ endif() add_library(boost_math_module) target_sources(boost_math_module PUBLIC - FILE_SET math_module TYPE CXX_MODULES FILES math.cxx + FILE_SET math_module TYPE CXX_MODULES FILES math.cppm ) target_link_libraries(boost_math_module PUBLIC Boost::math) target_compile_features(boost_math_module PUBLIC cxx_std_23) -# math.cxx defines BOOST_MATH_BUILD_MODULE and BOOST_MATH_STANDALONE itself, +# math.cppm defines BOOST_MATH_BUILD_MODULE and BOOST_MATH_STANDALONE itself, # but the tests link this target and need both macros too: BOOST_MATH_BUILD_MODULE # so they import the module instead of including the headers directly, and # BOOST_MATH_STANDALONE so any textually included support header (for example diff --git a/module/quick_test.cpp b/module/quick_test.cpp index d50d5355b3..41199a00f8 100644 --- a/module/quick_test.cpp +++ b/module/quick_test.cpp @@ -3,7 +3,7 @@ // https://www.boost.org/LICENSE_1_0.txt // // Smoke test for the boost.math module: exercises at least one entity from -// every component exported by module/math.cxx. +// every component exported by module/math.cppm. #include From 70ec7a7cd41259ed911b0117990165b34744afac Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Thu, 16 Jul 2026 13:29:14 -0400 Subject: [PATCH 19/27] Add CPPM to allowable extensions --- module/Jamfile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/module/Jamfile b/module/Jamfile index 70772268d5..39996bf018 100644 --- a/module/Jamfile +++ b/module/Jamfile @@ -10,6 +10,11 @@ import modules ; import testing ; import path ; import pch ; +import type ; + +# b2 registers the standard C++ suffixes (cpp cxx cc) but not cppm, so teach it +# that the .cppm module interface unit is a C++ source. +type.register-suffixes cppm : CPP ; project : requirements @@ -23,6 +28,6 @@ project clang:23 ; -obj math : math.cxx : BOOST_MATH_EXPORT_TESTING msvc:-interface ; +obj math : math.cppm : BOOST_MATH_EXPORT_TESTING msvc:-interface ; run quick_test.cpp math : : : math ; From d89dc67028ce8fb3bbd3d9b4e49aa12984df3f70 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Thu, 16 Jul 2026 13:33:00 -0400 Subject: [PATCH 20/27] Remove workaround that doesn't work with modules --- include/boost/math/octonion.hpp | 144 -------------------------------- 1 file changed, 144 deletions(-) diff --git a/include/boost/math/octonion.hpp b/include/boost/math/octonion.hpp index 562369ea75..e7efd67824 100644 --- a/include/boost/math/octonion.hpp +++ b/include/boost/math/octonion.hpp @@ -952,7 +952,6 @@ namespace boost return(*this); \ } -#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) #define BOOST_OCTONION_MEMBER_DIV_GENERATOR_2(type) \ octonion & operator /= (::std::complex const & rhs) \ { \ @@ -994,50 +993,7 @@ namespace boost \ return(*this); \ } -#else - #define BOOST_OCTONION_MEMBER_DIV_GENERATOR_2(type) \ - octonion & operator /= (::std::complex const & rhs) \ - { \ - using ::std::valarray; \ - \ - valarray tr(2); \ - \ - tr[0] = rhs.real(); \ - tr[1] = rhs.imag(); \ - \ - type mixam = static_cast(1)/(abs(tr).max)(); \ - \ - tr *= mixam; \ - \ - valarray tt(8); \ - \ - tt[0] = +a*tr[0]-b*tr[1]; \ - tt[1] = -a*tr[1]+b*tr[0]; \ - tt[2] = +c*tr[0]-d*tr[1]; \ - tt[3] = +c*tr[1]+d*tr[0]; \ - tt[4] = +e*tr[0]-f*tr[1]; \ - tt[5] = +e*tr[1]+f*tr[0]; \ - tt[6] = +g*tr[0]+h*tr[1]; \ - tt[7] = +g*tr[1]+h*tr[0]; \ - \ - tr *= tr; \ - \ - tt *= (mixam/tr.sum()); \ - \ - a = tt[0]; \ - b = tt[1]; \ - c = tt[2]; \ - d = tt[3]; \ - e = tt[4]; \ - f = tt[5]; \ - g = tt[6]; \ - h = tt[7]; \ - \ - return(*this); \ - } -#endif /* BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP */ -#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) #define BOOST_OCTONION_MEMBER_DIV_GENERATOR_3(type) \ octonion & operator /= (::boost::math::quaternion const & rhs) \ { \ @@ -1081,52 +1037,7 @@ namespace boost \ return(*this); \ } -#else - #define BOOST_OCTONION_MEMBER_DIV_GENERATOR_3(type) \ - octonion & operator /= (::boost::math::quaternion const & rhs) \ - { \ - using ::std::valarray; \ - \ - valarray tr(4); \ - \ - tr[0] = static_cast(rhs.R_component_1()); \ - tr[1] = static_cast(rhs.R_component_2()); \ - tr[2] = static_cast(rhs.R_component_3()); \ - tr[3] = static_cast(rhs.R_component_4()); \ - \ - type mixam = static_cast(1)/(abs(tr).max)(); \ - \ - tr *= mixam; \ - \ - valarray tt(8); \ - \ - tt[0] = +a*tr[0]+b*tr[1]+c*tr[2]+d*tr[3]; \ - tt[1] = -a*tr[1]+b*tr[0]-c*tr[3]+d*tr[2]; \ - tt[2] = -a*tr[2]+b*tr[3]+c*tr[0]-d*tr[1]; \ - tt[3] = -a*tr[3]-b*tr[2]+c*tr[1]+d*tr[0]; \ - tt[4] = +e*tr[0]-f*tr[1]-g*tr[2]-h*tr[3]; \ - tt[5] = +e*tr[1]+f*tr[0]+g*tr[3]-h*tr[2]; \ - tt[6] = +e*tr[2]-f*tr[3]+g*tr[0]+h*tr[1]; \ - tt[7] = +e*tr[3]+f*tr[2]-g*tr[1]+h*tr[0]; \ - \ - tr *= tr; \ - \ - tt *= (mixam/tr.sum()); \ - \ - a = tt[0]; \ - b = tt[1]; \ - c = tt[2]; \ - d = tt[3]; \ - e = tt[4]; \ - f = tt[5]; \ - g = tt[6]; \ - h = tt[7]; \ - \ - return(*this); \ - } -#endif /* BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP */ -#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) #define BOOST_OCTONION_MEMBER_DIV_GENERATOR_4(type) \ template \ octonion & operator /= (octonion const & rhs) \ @@ -1175,55 +1086,6 @@ namespace boost \ return(*this); \ } -#else - #define BOOST_OCTONION_MEMBER_DIV_GENERATOR_4(type) \ - template \ - octonion & operator /= (octonion const & rhs) \ - { \ - using ::std::valarray; \ - \ - valarray tr(8); \ - \ - tr[0] = static_cast(rhs.R_component_1()); \ - tr[1] = static_cast(rhs.R_component_2()); \ - tr[2] = static_cast(rhs.R_component_3()); \ - tr[3] = static_cast(rhs.R_component_4()); \ - tr[4] = static_cast(rhs.R_component_5()); \ - tr[5] = static_cast(rhs.R_component_6()); \ - tr[6] = static_cast(rhs.R_component_7()); \ - tr[7] = static_cast(rhs.R_component_8()); \ - \ - type mixam = static_cast(1)/(abs(tr).max)(); \ - \ - tr *= mixam; \ - \ - valarray tt(8); \ - \ - tt[0] = +a*tr[0]+b*tr[1]+c*tr[2]+d*tr[3]+e*tr[4]+f*tr[5]+g*tr[6]+h*tr[7]; \ - tt[1] = -a*tr[1]+b*tr[0]-c*tr[3]+d*tr[2]-e*tr[5]+f*tr[4]+g*tr[7]-h*tr[6]; \ - tt[2] = -a*tr[2]+b*tr[3]+c*tr[0]-d*tr[1]-e*tr[6]-f*tr[7]+g*tr[4]+h*tr[5]; \ - tt[3] = -a*tr[3]-b*tr[2]+c*tr[1]+d*tr[0]-e*tr[7]+f*tr[6]-g*tr[5]+h*tr[4]; \ - tt[4] = -a*tr[4]+b*tr[5]+c*tr[6]+d*tr[7]+e*tr[0]-f*tr[1]-g*tr[2]-h*tr[3]; \ - tt[5] = -a*tr[5]-b*tr[4]+c*tr[7]-d*tr[6]+e*tr[1]+f*tr[0]+g*tr[3]-h*tr[2]; \ - tt[6] = -a*tr[6]-b*tr[7]-c*tr[4]+d*tr[5]+e*tr[2]-f*tr[3]+g*tr[0]+h*tr[1]; \ - tt[7] = -a*tr[7]+b*tr[6]-c*tr[5]-d*tr[4]+e*tr[3]+f*tr[2]-g*tr[1]+h*tr[0]; \ - \ - tr *= tr; \ - \ - tt *= (mixam/tr.sum()); \ - \ - a = tt[0]; \ - b = tt[1]; \ - c = tt[2]; \ - d = tt[3]; \ - e = tt[4]; \ - f = tt[5]; \ - g = tt[6]; \ - h = tt[7]; \ - \ - return(*this); \ - } -#endif /* BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP */ #define BOOST_OCTONION_MEMBER_ADD_GENERATOR(type) \ @@ -3918,9 +3780,7 @@ namespace boost BOOST_MATH_EXPORT template inline T sup(octonion const & o) { -#ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP using ::std::abs; -#endif /* BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP */ BOOST_OCTONION_VALARRAY_LOADER @@ -3931,9 +3791,7 @@ namespace boost BOOST_MATH_EXPORT template inline T l1(octonion const & o) { -#ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP using ::std::abs; -#endif /* BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP */ BOOST_OCTONION_VALARRAY_LOADER @@ -3944,9 +3802,7 @@ namespace boost BOOST_MATH_EXPORT template inline T abs(const octonion & o) { -#ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP using ::std::abs; -#endif /* BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP */ using ::std::sqrt; From 361472797f754c3ae9f576c42d019a0155e4c571 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Thu, 16 Jul 2026 13:49:43 -0400 Subject: [PATCH 21/27] Add MSVC modules testing --- .github/workflows/ci.yml | 97 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 95 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a5115c5983..554570432c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -882,7 +882,7 @@ jobs: git submodule update --init tools/boostdep python3 tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY - - name: Build with the standard library module and boost.math module, then test + - name: Configure run: | cd ../boost-root mkdir __build__ && cd __build__ @@ -895,6 +895,16 @@ jobs: -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=$IMPORT_STD_UUID \ -DCMAKE_CXX_STDLIB_MODULES_JSON=/usr/lib/llvm-$LLVM_VERSION/lib/libc++.modules.json \ .. + + # Kept as a separate step so the boost.math module build time is visible on its own. + - name: Build the Boost.Math module + run: | + cd ../boost-root/__build__ + cmake --build . --target boost_math_module + + - name: Build and run the tests + run: | + cd ../boost-root/__build__ cmake --build . --target tests ctest --output-on-failure --no-tests=error @@ -948,7 +958,7 @@ jobs: git submodule update --init tools/boostdep python3 tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY - - name: Build with the standard library module and boost.math module, then test + - name: Configure run: | cd ../boost-root mkdir __build__ && cd __build__ @@ -960,5 +970,88 @@ jobs: -DCMAKE_CXX_COMPILER=g++-$GCC_VERSION \ -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=$IMPORT_STD_UUID \ .. + + # Kept as a separate step so the boost.math module build time is visible on its own. + - name: Build the Boost.Math module + run: | + cd ../boost-root/__build__ + cmake --build . --target boost_math_module + + - name: Build and run the tests + run: | + cd ../boost-root/__build__ + cmake --build . --target tests + ctest --output-on-failure --no-tests=error + + cmake-module-test-msvc: + strategy: + fail-fast: false + + runs-on: windows-2025 + + env: + # Pinned so the experimental import std feature UUID below stays valid. + CMAKE_VERSION: 4.4.0 + # CMake gates import std behind this UUID; it is specific to the CMake version. + IMPORT_STD_UUID: f35a9ac6-8463-4d38-8eec-5d6008153e7d + + steps: + - uses: actions/checkout@v6 + + # Puts cl.exe and the MSVC INCLUDE/LIB environment on PATH for the later steps. + - name: Set up the MSVC environment + uses: ilammy/msvc-dev-cmd@v1 + + - name: Install toolchain + shell: pwsh + run: | + # A pinned CMake (the import std UUID is tied to the version) and Ninja + # (required for C++ modules). + curl.exe -L -o cmake.zip "https://github.com/Kitware/CMake/releases/download/v$env:CMAKE_VERSION/cmake-$env:CMAKE_VERSION-windows-x86_64.zip" + Expand-Archive -Path cmake.zip -DestinationPath C:\tools + "C:\tools\cmake-$env:CMAKE_VERSION-windows-x86_64\bin" | Out-File -FilePath $env:GITHUB_PATH -Append -Encoding utf8 + choco install ninja -y + + - name: Setup Boost + shell: pwsh + run: | + $LIBRARY = ($env:GITHUB_REPOSITORY -split '/')[-1] + "LIBRARY=$LIBRARY" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8 + $ref = if ($env:GITHUB_BASE_REF) { $env:GITHUB_BASE_REF } else { $env:GITHUB_REF } + $ref = $ref -replace '^refs/heads/', '' + $branch = if ($ref -eq 'master') { 'master' } else { 'develop' } + cd .. + git clone -b $branch --depth 1 https://github.com/boostorg/boost.git boost-root + cd boost-root + New-Item -ItemType Directory -Force -Path "libs/$LIBRARY" | Out-Null + Copy-Item -Recurse -Force "$env:GITHUB_WORKSPACE/*" "libs/$LIBRARY" + git submodule update --init tools/boostdep + python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY + + - name: Configure + shell: pwsh + run: | + cd ../boost-root + New-Item -ItemType Directory -Force -Path __build__ | Out-Null + cd __build__ + cmake -G Ninja ` + -DBOOST_INCLUDE_LIBRARIES=$env:LIBRARY ` + -DBUILD_TESTING=ON ` + -DBOOST_MATH_BUILD_MODULE=ON ` + -DCMAKE_CXX_COMPILER=cl ` + -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=$env:IMPORT_STD_UUID ` + .. + + # Kept as a separate step so the boost.math module build time is visible on its own. + - name: Build the Boost.Math module + shell: pwsh + run: | + cd ../boost-root/__build__ + cmake --build . --target boost_math_module + + - name: Build and run the tests + shell: pwsh + run: | + cd ../boost-root/__build__ cmake --build . --target tests ctest --output-on-failure --no-tests=error From f096e4a51bacdc10d2c3cd4c833819fae2a4f922 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Thu, 16 Jul 2026 14:14:59 -0400 Subject: [PATCH 22/27] Ignore clang warnings --- module/CMakeLists.txt | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/module/CMakeLists.txt b/module/CMakeLists.txt index a404ed1285..0c91f21391 100644 --- a/module/CMakeLists.txt +++ b/module/CMakeLists.txt @@ -22,6 +22,12 @@ target_sources(boost_math_module target_link_libraries(boost_math_module PUBLIC Boost::math) target_compile_features(boost_math_module PUBLIC cxx_std_23) +# The purview includes the library's angled headers by design. +# clang-scan-deps warns on that and ignores -Wno-include-angled-in-module-purview, +# so -w keeps the dependency-scan output clean (this glue unit's code is fully +# warned on in the header builds). +target_compile_options(boost_math_module PRIVATE $<$:-w>) + # math.cppm defines BOOST_MATH_BUILD_MODULE and BOOST_MATH_STANDALONE itself, # but the tests link this target and need both macros too: BOOST_MATH_BUILD_MODULE # so they import the module instead of including the headers directly, and @@ -82,10 +88,11 @@ set(BOOST_MATH_MODULE_TESTS # GCC 15 compiles the module itself, but libstdc++ cannot yet mix the textual # standard library includes the test sources use with import std in the same -# consumer translation unit, so only the quick test runs there. The full list -# runs under clang/libc++. -if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - message(STATUS "Boost.Math module: GCC consumer tests limited to module_quick_test") +# consumer translation unit, so only the quick test runs there. MSVC is treated +# the same way until the full consumer suite has been validated against it. The +# full list runs under clang/libc++. +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + message(STATUS "Boost.Math module: ${CMAKE_CXX_COMPILER_ID} consumer tests limited to module_quick_test") set(BOOST_MATH_MODULE_TESTS) endif() From 03b38dbbadffeb6d412422e3f06bc0be7513a523 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Thu, 16 Jul 2026 15:44:30 -0400 Subject: [PATCH 23/27] Remove anonymous namespace breaking module linkage --- include/boost/math/distributions/hyperexponential.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/math/distributions/hyperexponential.hpp b/include/boost/math/distributions/hyperexponential.hpp index 0c30f53ed7..e14c3f8e87 100644 --- a/include/boost/math/distributions/hyperexponential.hpp +++ b/include/boost/math/distributions/hyperexponential.hpp @@ -56,7 +56,7 @@ BOOST_MATH_EXPORT template class hyperexponential_distribution; -namespace /**/ { namespace hyperexp_detail { +namespace hyperexp_detail { template void normalize(std::vector& v) @@ -237,7 +237,7 @@ RealT quantile_impl(hyperexponential_distribution const& dist, R return result; } -}} // Namespace ::hyperexp_detail +} // Namespace hyperexp_detail BOOST_MATH_EXPORT template > From 02463612c7df3f42f3a757de44dc04be87f8886c Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Thu, 16 Jul 2026 15:54:58 -0400 Subject: [PATCH 24/27] Attempt fix MSVC problem --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 554570432c..e8951ebcb1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1035,11 +1035,11 @@ jobs: New-Item -ItemType Directory -Force -Path __build__ | Out-Null cd __build__ cmake -G Ninja ` - -DBOOST_INCLUDE_LIBRARIES=$env:LIBRARY ` + -DBOOST_INCLUDE_LIBRARIES="$env:LIBRARY" ` -DBUILD_TESTING=ON ` -DBOOST_MATH_BUILD_MODULE=ON ` -DCMAKE_CXX_COMPILER=cl ` - -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=$env:IMPORT_STD_UUID ` + -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD="$env:IMPORT_STD_UUID" ` .. # Kept as a separate step so the boost.math module build time is visible on its own. From 0270056a543b0a7583f15991b9dacfc73974a8b7 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Fri, 17 Jul 2026 14:42:22 -0400 Subject: [PATCH 25/27] Fix John's initial issue --- .../detail/lambert_w_lookup_table.ipp | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/include/boost/math/special_functions/detail/lambert_w_lookup_table.ipp b/include/boost/math/special_functions/detail/lambert_w_lookup_table.ipp index 9f1b488ead..815dda29b5 100644 --- a/include/boost/math/special_functions/detail/lambert_w_lookup_table.ipp +++ b/include/boost/math/special_functions/detail/lambert_w_lookup_table.ipp @@ -21,21 +21,21 @@ namespace math { namespace lambert_w_detail { namespace lambert_w_lookup { -static constexpr std::size_t noof_sqrts = 12; -static constexpr std::size_t noof_halves = 12; -static constexpr std::size_t noof_w0es = 65; -static constexpr std::size_t noof_w0zs = 65; -static constexpr std::size_t noof_wm1es = 64; -static constexpr std::size_t noof_wm1zs = 64; +BOOST_MATH_INLINE_CONSTEXPR std::size_t noof_sqrts = 12; +BOOST_MATH_INLINE_CONSTEXPR std::size_t noof_halves = 12; +BOOST_MATH_INLINE_CONSTEXPR std::size_t noof_w0es = 65; +BOOST_MATH_INLINE_CONSTEXPR std::size_t noof_w0zs = 65; +BOOST_MATH_INLINE_CONSTEXPR std::size_t noof_wm1es = 64; +BOOST_MATH_INLINE_CONSTEXPR std::size_t noof_wm1zs = 64; -static constexpr lookup_t halves[noof_halves] = +BOOST_MATH_INLINE_CONSTEXPR lookup_t halves[noof_halves] = { // Common to Lambert W0 and W-1 (and exactly representable). static_cast(0.5L), static_cast(0.25L), static_cast(0.125L), static_cast(0.0625L), static_cast(0.03125L), static_cast(0.015625L), static_cast(0.0078125L), static_cast(0.00390625L), static_cast(0.001953125L), static_cast(0.0009765625L), static_cast(0.00048828125L), static_cast(0.000244140625L) }; // halves, 0.5, 0.25, ... 0.000244140625, common to W0 and W-1. -static constexpr lookup_t sqrtw0s[noof_sqrts] = +BOOST_MATH_INLINE_CONSTEXPR lookup_t sqrtw0s[noof_sqrts] = { // For Lambert W0 only. static_cast(0.6065306597126334242631173765403218567L), static_cast(0.7788007830714048686684607000907199500L), static_cast(0.8824969025845954031047175929687018290L), static_cast(0.9394130628134757862473572557999761753L), @@ -45,7 +45,7 @@ static constexpr lookup_t sqrtw0s[noof_sqrts] = static_cast(0.9995118379398893653889967919448497792L), static_cast(0.9997558891748972165136242351259789505L) }; // sqrtw0s -static constexpr lookup_t sqrtwm1s[noof_sqrts] = +BOOST_MATH_INLINE_CONSTEXPR lookup_t sqrtwm1s[noof_sqrts] = { // For Lambert W-1 only. static_cast(1.648721270700128146848650787814163572L), static_cast(1.284025416687741484073420568062436458L), static_cast(1.133148453066826316829007227811793873L), static_cast(1.064494458917859429563390594642889673L), @@ -55,7 +55,7 @@ static constexpr lookup_t sqrtwm1s[noof_sqrts] = static_cast(1.000488400478694473126173623807163354L), static_cast(1.000244170429747854937005233924135774L) }; // sqrtwm1s -static constexpr lookup_t w0es[noof_w0zs] = +BOOST_MATH_INLINE_CONSTEXPR lookup_t w0es[noof_w0zs] = { // Fukushima e powers array e[0] = 2.718, 1., e[2] = e^-1 = 0.135, e[3] = e^-2 = 0.133 ... e[64] = 4.3596100000630809736231248158884615452e-28. static_cast(2.7182818284590452353602874713526624978e+00L), static_cast(1.0000000000000000000000000000000000000e+00L), static_cast(3.6787944117144232159552377016146086745e-01L), @@ -93,7 +93,7 @@ static constexpr lookup_t w0es[noof_w0zs] = }; // w0es -static constexpr lookup_t w0zs[noof_w0zs] = +BOOST_MATH_INLINE_CONSTEXPR lookup_t w0zs[noof_w0zs] = { // z values for W[0], W[1], W[2] ... W[64] (Fukushima array Fk). static_cast(0.0000000000000000000000000000000000000e+00L), static_cast(2.7182818284590452353602874713526624978e+00L), static_cast(1.4778112197861300454460854921150015626e+01L), static_cast(6.0256610769563003222785588963745153691e+01L), static_cast(2.1839260013257695631244104481144351361e+02L), @@ -115,7 +115,7 @@ static constexpr lookup_t w0zs[noof_w0zs] = }; // w0zs -static constexpr lookup_t wm1es[noof_wm1es] = +BOOST_MATH_INLINE_CONSTEXPR lookup_t wm1es[noof_wm1es] = { // Fukushima e array e[0] = e^1 = 2.718, e[1] = e^2 = 7.39 ... e[64] = 4.60718e+28. static_cast(2.7182818284590452353602874713526624978e+00L), static_cast(7.3890560989306502272304274605750078132e+00L), static_cast(2.0085536923187667740928529654581717897e+01L), static_cast(5.4598150033144239078110261202860878403e+01L), static_cast(1.4841315910257660342111558004055227962e+02L), @@ -136,7 +136,7 @@ static constexpr lookup_t wm1es[noof_wm1es] = static_cast(8.4383566687414544890733294803731179601e+26L), static_cast(2.2937831594696098790993528402686136005e+27L), static_cast(6.2351490808116168829092387089284697448e+27L) }; // wm1es -static constexpr lookup_t wm1zs[noof_wm1zs] = +BOOST_MATH_INLINE_CONSTEXPR lookup_t wm1zs[noof_wm1zs] = { // Fukushima G array of z values for integral K, (Fukushima Gk) g[0] (k = -1) = 1 ... g[64] = -1.0264389699511303e-26. static_cast(-3.6787944117144232159552377016146086745e-01L), static_cast(-2.7067056647322538378799898994496880682e-01L), static_cast(-1.4936120510359182893802724695018532990e-01L), static_cast(-7.3262555554936721174872085092964968848e-02L), static_cast(-3.3689734995427335483180242115742121244e-02L), From 249249870c95c08de1ef0af0cce5515b2d6266ee Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Fri, 17 Jul 2026 14:53:24 -0400 Subject: [PATCH 26/27] Inline constexpr variable templates --- .../reverse_mode_autodiff_expression_template_base.hpp | 2 +- include/boost/math/distributions/students_t.hpp | 2 +- include/boost/math/optimization/detail/common.hpp | 2 +- include/boost/math/tools/traits.hpp | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/boost/math/differentiation/detail/reverse_mode_autodiff_expression_template_base.hpp b/include/boost/math/differentiation/detail/reverse_mode_autodiff_expression_template_base.hpp index 5d774201d2..d31b34b3eb 100644 --- a/include/boost/math/differentiation/detail/reverse_mode_autodiff_expression_template_base.hpp +++ b/include/boost/math/differentiation/detail/reverse_mode_autodiff_expression_template_base.hpp @@ -98,7 +98,7 @@ struct count_rvar_impl< = count_rvar_impl::value; }; template -constexpr std::size_t count_rvars = detail::count_rvar_impl::value; +BOOST_MATH_INLINE_CONSTEXPR std::size_t count_rvars = detail::count_rvar_impl::value; template struct is_expression : std::is_base_of::type> diff --git a/include/boost/math/distributions/students_t.hpp b/include/boost/math/distributions/students_t.hpp index 2d5ffaf8a7..d768175b6c 100644 --- a/include/boost/math/distributions/students_t.hpp +++ b/include/boost/math/distributions/students_t.hpp @@ -309,7 +309,7 @@ BOOST_MATH_GPU_ENABLED inline bool analytical_df_if_cdf_matches(const Distributi // Minimum degrees-of-freedom used as the warm-start fallback when the // Edgeworth approximation yields no valid positive root or is inaccurate -constexpr double df_hint_fallback = 0.01; +BOOST_MATH_INLINE_CONSTEXPR double df_hint_fallback = 0.01; // // Functors for finding degrees of freedom: diff --git a/include/boost/math/optimization/detail/common.hpp b/include/boost/math/optimization/detail/common.hpp index 59ca39aa75..8ea49a2f28 100644 --- a/include/boost/math/optimization/detail/common.hpp +++ b/include/boost/math/optimization/detail/common.hpp @@ -23,7 +23,7 @@ template struct has_resize : std::false_type {}; template struct has_resize().resize(size_t{}))>> : std::true_type {}; -template constexpr bool has_resize_v = has_resize::value; +template BOOST_MATH_INLINE_CONSTEXPR bool has_resize_v = has_resize::value; template void validate_bounds(ArgumentContainer const &lower_bounds, ArgumentContainer const &upper_bounds) { diff --git a/include/boost/math/tools/traits.hpp b/include/boost/math/tools/traits.hpp index ad802650c3..22d9cbb669 100644 --- a/include/boost/math/tools/traits.hpp +++ b/include/boost/math/tools/traits.hpp @@ -58,13 +58,13 @@ BOOST_MATH_HAS_NAMED_TRAIT(has_backend_type, backend_type) // C++17-esque helpers #if defined(__cpp_variable_templates) && __cpp_variable_templates >= 201304L template -constexpr bool has_value_type_v = has_value_type::value; +BOOST_MATH_INLINE_CONSTEXPR bool has_value_type_v = has_value_type::value; template -constexpr bool has_policy_type_v = has_policy_type::value; +BOOST_MATH_INLINE_CONSTEXPR bool has_policy_type_v = has_policy_type::value; template -constexpr bool has_backend_type_v = has_backend_type::value; +BOOST_MATH_INLINE_CONSTEXPR bool has_backend_type_v = has_backend_type::value; #endif template From b76b7c428b7e654177327c348ba665471d069839 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Fri, 17 Jul 2026 15:12:08 -0400 Subject: [PATCH 27/27] Add tests for functions previously causing module linkage issues --- module/CMakeLists.txt | 3 ++ test/ccmath_next_module_test.cpp | 35 +++++++++++++++++++ test/lambert_w_module_test.cpp | 56 ++++++++++++++++++++++++++++++ test/students_t_df_module_test.cpp | 40 +++++++++++++++++++++ 4 files changed, 134 insertions(+) create mode 100644 test/ccmath_next_module_test.cpp create mode 100644 test/lambert_w_module_test.cpp create mode 100644 test/students_t_df_module_test.cpp diff --git a/module/CMakeLists.txt b/module/CMakeLists.txt index 0c91f21391..fac19649fc 100644 --- a/module/CMakeLists.txt +++ b/module/CMakeLists.txt @@ -84,6 +84,9 @@ set(BOOST_MATH_MODULE_TESTS random_search_test quaternion_constexpr_test octonion_test_simple + lambert_w_module_test + students_t_df_module_test + ccmath_next_module_test ) # GCC 15 compiles the module itself, but libstdc++ cannot yet mix the textual diff --git a/test/ccmath_next_module_test.cpp b/test/ccmath_next_module_test.cpp new file mode 100644 index 0000000000..a0ce907c9a --- /dev/null +++ b/test/ccmath_next_module_test.cpp @@ -0,0 +1,35 @@ +// (C) Copyright Matt Borland 2026. +// 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) +// +// Module build check for ccmath::nextafter. Its detail dispatch defaults a +// template parameter to boost::math::tools::detail::has_backend_type_v, so +// building this against the boost.math module exercises the variable templates +// in tools/traits.hpp from a module consumer. + +#ifndef BOOST_MATH_BUILD_MODULE +#include +#else +import boost.math; +#endif + +#include +#include "math_unit_test.hpp" + +template +void test_spots(T, const char* type_name) +{ + std::cout << "Testing ccmath next for type " << type_name << std::endl; + + CHECK_EQUAL(boost::math::ccmath::nextafter(static_cast(1), static_cast(2)), std::nextafter(static_cast(1), static_cast(2))); + CHECK_EQUAL(boost::math::ccmath::nextafter(static_cast(1), static_cast(0)), std::nextafter(static_cast(1), static_cast(0))); +} + +int main() +{ + test_spots(0.0F, "float"); + test_spots(0.0, "double"); + + return boost::math::test::report_errors(); +} diff --git a/test/lambert_w_module_test.cpp b/test/lambert_w_module_test.cpp new file mode 100644 index 0000000000..f7059c22f0 --- /dev/null +++ b/test/lambert_w_module_test.cpp @@ -0,0 +1,56 @@ +// (C) Copyright Matt Borland 2026. +// 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) +// +// Module build check for lambert_w. The lookup tables in +// detail/lambert_w_lookup_table.ipp are namespace-scope arrays that are indexed +// at run time (an odr-use), so if they were left with internal linkage a module +// consumer could not resolve them. Exercising lambert_w0 and lambert_wm1 here +// forces that resolution when the test is built against the boost.math module. + +#ifndef BOOST_MATH_BUILD_MODULE +#include +#else +import boost.math; +#endif + +#include +#include "math_unit_test.hpp" + +template +void test_spots(T, const char* t) +{ + std::cout << "Testing lambert_w for type " << t << std::endl; + + using std::exp; + const T tolerance = 16; + + // W0 at 1 is the omega constant. + CHECK_ULP_CLOSE(::boost::math::lambert_w0(static_cast(1)), + static_cast(0.56714329040978387299996866221035554975381578718651L), tolerance); + + // W0 identity: w * e^w == z. Runtime indexing here reaches the w0 tables. + for (const T z : {static_cast(0.5), static_cast(2), static_cast(10), + static_cast(100), static_cast(1000)}) + { + const T w = ::boost::math::lambert_w0(z); + CHECK_ULP_CLOSE(w * exp(w), z, tolerance); + } + + // W-1 identity on its branch (z in [-1/e, 0)); reaches the wm1 tables. + for (const T z : {static_cast(-0.3), static_cast(-0.1), + static_cast(-0.01), static_cast(-0.001)}) + { + const T w = ::boost::math::lambert_wm1(z); + CHECK_ULP_CLOSE(w * exp(w), z, tolerance); + } +} + +int main() +{ + test_spots(0.0F, "float"); + test_spots(0.0, "double"); + + return boost::math::test::report_errors(); +} diff --git a/test/students_t_df_module_test.cpp b/test/students_t_df_module_test.cpp new file mode 100644 index 0000000000..56a91f6437 --- /dev/null +++ b/test/students_t_df_module_test.cpp @@ -0,0 +1,40 @@ +// (C) Copyright Matt Borland 2026. +// 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) +// +// Module build check for students_t. find_degrees_of_freedom(t, p) reads the +// namespace-scope constant detail::df_hint_fallback; building this against the +// boost.math module confirms that constant is usable from a module consumer. + +#ifndef BOOST_MATH_BUILD_MODULE +#include +#else +import boost.math; +#endif + +#include "math_unit_test.hpp" + +template +void test_spots(T, const char* type_name) +{ + std::cout << "Testing students_t find_degrees_of_freedom for type " << type_name << std::endl; + + using dist_t = boost::math::students_t_distribution; + + // The (t, p) overload runs the Edgeworth warm-start that seeds the root + // finder from detail::df_hint_fallback. Recovering df and feeding it back + // through the cdf is self-checking. + const T df {dist_t::find_degrees_of_freedom(static_cast(2), static_cast(0.95))}; + CHECK_GE(df, static_cast(0)); + + const dist_t d {df}; + CHECK_ABSOLUTE_ERROR(boost::math::cdf(d, static_cast(2)), static_cast(0.95), static_cast(1e-4)); +} + +int main() +{ + test_spots(0.0, "double"); + + return boost::math::test::report_errors(); +}