2
0
mirror of https://github.com/boostorg/math.git synced 2026-01-19 04:22:09 +00:00

Merge pull request #597 from mborland/standalone

Complete Standalone Mode
This commit is contained in:
jzmaddock
2021-04-04 17:35:10 +01:00
committed by GitHub
68 changed files with 499 additions and 113 deletions

View File

@@ -27,7 +27,7 @@ jobs:
fetch-depth: '0'
- uses: mstachniuk/ci-skip@v1
with:
commit-filter: '[skip ci];[ci skip];[CI SKIP];[SKIP CI];***CI SKIP***;***SKIP CI***;[windows];[Windows];[WINDOWS];[apple];[Apple];[APPLE]'
commit-filter: '[skip ci];[ci skip];[CI SKIP];[SKIP CI];***CI SKIP***;***SKIP CI***;[windows];[Windows];[WINDOWS];[apple];[Apple];[APPLE];[standalone];[STANDALONE]'
commit-filter-separator: ';'
fail-fast: true
- name: Set TOOLSET
@@ -75,7 +75,7 @@ jobs:
run: ./config_info_travis
working-directory: ../boost-root/libs/config/test
- name: Test
run: ../../../b2 -j3 toolset=$TOOLSET ${{ matrix.suite }} define=CI_SUPPRESS_KNOWN_ISSUES define=SLOW_COMPILER
run: ../../../b2 toolset=$TOOLSET ${{ matrix.suite }} define=CI_SUPPRESS_KNOWN_ISSUES define=SLOW_COMPILER
working-directory: ../boost-root/libs/math/test
ubuntu-bionic:
runs-on: ubuntu-18.04
@@ -91,7 +91,7 @@ jobs:
fetch-depth: '0'
- uses: mstachniuk/ci-skip@v1
with:
commit-filter: '[skip ci];[ci skip];[CI SKIP];[SKIP CI];***CI SKIP***;***SKIP CI***;[windows];[Windows];[WINDOWS];[apple];[Apple];[APPLE]'
commit-filter: '[skip ci];[ci skip];[CI SKIP];[SKIP CI];***CI SKIP***;***SKIP CI***;[windows];[Windows];[WINDOWS];[apple];[Apple];[APPLE];[standalone];[STANDALONE]'
commit-filter-separator: ';'
fail-fast: true
- name: Set TOOLSET
@@ -139,7 +139,7 @@ jobs:
run: ./config_info_travis
working-directory: ../boost-root/libs/config/test
- name: Test
run: ../../../b2 -j3 toolset=$TOOLSET ${{ matrix.suite }} define=CI_SUPPRESS_KNOWN_ISSUES define=SLOW_COMPILER
run: ../../../b2 toolset=$TOOLSET ${{ matrix.suite }} define=CI_SUPPRESS_KNOWN_ISSUES define=SLOW_COMPILER
working-directory: ../boost-root/libs/math/test
ubuntu-xenial:
runs-on: ubuntu-16.04
@@ -155,7 +155,7 @@ jobs:
fetch-depth: '0'
- uses: mstachniuk/ci-skip@v1
with:
commit-filter: '[skip ci];[ci skip];[CI SKIP];[SKIP CI];***CI SKIP***;***SKIP CI***;[windows];[Windows];[WINDOWS];[apple];[Apple];[APPLE]'
commit-filter: '[skip ci];[ci skip];[CI SKIP];[SKIP CI];***CI SKIP***;***SKIP CI***;[windows];[Windows];[WINDOWS];[apple];[Apple];[APPLE];[standalone];[STANDALONE]'
commit-filter-separator: ';'
fail-fast: true
- name: Set TOOLSET
@@ -203,7 +203,7 @@ jobs:
run: ./config_info_travis
working-directory: ../boost-root/libs/config/test
- name: Test
run: ../../../b2 -j3 toolset=$TOOLSET ${{ matrix.suite }} define=CI_SUPPRESS_KNOWN_ISSUES define=SLOW_COMPILER
run: ../../../b2 toolset=$TOOLSET ${{ matrix.suite }} define=CI_SUPPRESS_KNOWN_ISSUES define=SLOW_COMPILER
working-directory: ../boost-root/libs/math/test
macos:
runs-on: macos-latest
@@ -219,7 +219,7 @@ jobs:
fetch-depth: '0'
- uses: mstachniuk/ci-skip@v1
with:
commit-filter: '[skip ci];[ci skip];[CI SKIP];[SKIP CI];***CI SKIP***;***SKIP CI***;[windows];[Windows];[WINDOWS];[linux];[Linux];[LINUX]'
commit-filter: '[skip ci];[ci skip];[CI SKIP];[SKIP CI];***CI SKIP***;***SKIP CI***;[windows];[Windows];[WINDOWS];[linux];[Linux];[LINUX];[standalone];[STANDALONE]'
commit-filter-separator: ';'
fail-fast: true
- name: Checkout main boost
@@ -246,7 +246,7 @@ jobs:
run: ./config_info_travis
working-directory: ../boost-root/libs/config/test
- name: Test
run: ../../../b2 -j3 toolset=${{ matrix.toolset }} cxxstd=${{ matrix.standard }} ${{ matrix.suite }} define=CI_SUPPRESS_KNOWN_ISSUES define=SLOW_COMPILER
run: ../../../b2 toolset=${{ matrix.toolset }} cxxstd=${{ matrix.standard }} ${{ matrix.suite }} define=CI_SUPPRESS_KNOWN_ISSUES define=SLOW_COMPILER
working-directory: ../boost-root/libs/math/test
windows:
runs-on: windows-latest
@@ -267,7 +267,7 @@ jobs:
fetch-depth: '0'
- uses: mstachniuk/ci-skip@v1
with:
commit-filter: '[skip ci];[ci skip];[CI SKIP];[SKIP CI];***CI SKIP***;***SKIP CI***;[apple];[Apple];[APPLE];[linux];[Linux];[LINUX]'
commit-filter: '[skip ci];[ci skip];[CI SKIP];[SKIP CI];***CI SKIP***;***SKIP CI***;[apple];[Apple];[APPLE];[linux];[Linux];[LINUX];[standalone];[STANDALONE]'
commit-filter-separator: ';'
fail-fast: true
- name: Checkout main boost
@@ -294,5 +294,48 @@ jobs:
run: config_info_travis
working-directory: ../boost-root/libs/config/test
- name: Test
run: ..\..\..\b2 -j3 --hash %ARGS% define=CI_SUPPRESS_KNOWN_ISSUES ${{ matrix.suite }}
run: ..\..\..\b2 --hash %ARGS% define=CI_SUPPRESS_KNOWN_ISSUES ${{ matrix.suite }}
working-directory: ../boost-root/libs/math/test
standalone:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v2
with:
fetch-depth: '0'
- uses: mstachniuk/ci-skip@v1
with:
commit-filter: '[skip ci];[ci skip];[CI SKIP];[SKIP CI];***CI SKIP***;***SKIP CI***;[windows];[Windows];[WINDOWS];[apple];[Apple];[APPLE]'
commit-filter-separator: ';'
fail-fast: true
- name: Add repository
continue-on-error: true
id: addrepo
run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test"
- name: Retry Add Repo
continue-on-error: true
id: retry1
if: steps.addrepo.outcome=='failure'
run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test"
- name: Retry Add Repo 2
continue-on-error: true
id: retry2
if: steps.retry1.outcome=='failure'
run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test"
- name: Install packages
run: sudo apt install g++-10
- name: Checkout main boost
run: git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
- name: Update tools/boostdep
run: git submodule update --init tools/boostdep
working-directory: ../boost-root
- name: Copy files
run: cp -r $GITHUB_WORKSPACE/* libs/math
working-directory: ../boost-root
- name: Run CMake
run: cmake -DBUILD_TESTING=1 -DCMAKE_CXX_COMPILER=g++-10 .
working-directory: ../boost-root/libs/math
- name: Run Compile Tests
run: make -j$((`nproc`+1))
working-directory: ../boost-root/libs/math

View File

@@ -40,9 +40,3 @@ if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt")
add_subdirectory(test)
endif()
if(BUILD_EXAMPLE AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/example/CMakeLists.txt")
add_subdirectory(example)
endif()

23
LICENSE Normal file
View File

@@ -0,0 +1,23 @@
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

View File

@@ -65,6 +65,10 @@ Quaternion and Octonians are class templates similar to std::complex.
The full documentation is available on [boost.org](http://www.boost.org/doc/libs/release/libs/math).
### Standalone Mode (Beta)
Defining BOOST_MATH_STANDALONE allows Boost.Math to be used without any Boost dependencies. Some functionality is reduced in this mode. A static_assert message will alert you if a particular feature has been disabled by standalone mode.
### Build Status
| | Master | Develop |
@@ -111,6 +115,7 @@ The default action for a PR or commit to a PR is for CI to run the full compleme
* [linux] to test using GCC Versions 5-10 and Clang Versions 5-10 on Ubuntu LTS versions 16.04-20.04.
* [apple] to test Apple Clang on the latest version of MacOS.
* [windows] to test MSVC-14.0, MSVC-14.2 and mingw on the latest version of Windows.
* [standalone] to run standalone mode commpile tests
### Building documentation ###

View File

@@ -179,8 +179,7 @@ As one would expect, the variable can be `const` (but sadly [*not yet `constexpr
// constexpr cpp_bin_float_50 seventh_constexpr (cpp_bin_float_50(1) / 7);
// std::cout << "seventh_constexpr = " << seventh_constexpr << std::endl; //
// nor use the macro BOOST_CONSTEXPR_OR_CONST unless it returns `const`
// BOOST_CONSTEXPR_OR_CONST cpp_bin_float_50 seventh_constexpr(seventh_const);
// constexpr cpp_bin_float_50 seventh_constexpr(seventh_const);
//] [/big_seventh_example_constexpr

View File

@@ -14,7 +14,7 @@
#include <iostream>
#include <iomanip>
#if defined(BOOST_INTEL)
#if defined(__INTEL_COMPILER)
# pragma warning(disable:239)
# pragma warning(disable:264)
#endif

View File

@@ -7,9 +7,10 @@
#define BOOST_MATH_NTL_DIGAMMA
#include <boost/math/tools/rational.hpp>
#include <boost/math/tools/config.hpp>
#include <boost/math/tools/lexical_cast.hpp>
#include <boost/math/policies/error_handling.hpp>
#include <boost/math/constants/constants.hpp>
#include <boost/lexical_cast.hpp>
namespace boost{ namespace math{ namespace detail{
@@ -283,6 +284,11 @@ template <class T>
T big_digamma(T x)
{
BOOST_MATH_STD_USING
#ifdef BOOST_MATH_STANDALONE
static_assert(sizeof(T) == 0, "big_digamma can not be used in standalone mode");
#endif
if(x < 0)
{
return big_digamma_helper(static_cast<T>(1-x)) + constants::pi<T>() / tan(constants::pi<T>() * (1-x));

View File

@@ -11,7 +11,6 @@
#ifndef BOOST_MATH_MPLFR_BINDINGS_HPP
#define BOOST_MATH_MPLFR_BINDINGS_HPP
#include <boost/lexical_cast.hpp>
#include <type_traits>
#ifdef _MSC_VER
@@ -38,6 +37,7 @@
#include <boost/math/bindings/detail/big_lanczos.hpp>
#include <boost/math/tools/big_constant.hpp>
#include <boost/math/tools/config.hpp>
#include <boost/math/tools/lexical_cast.hpp>
inline mpfr_class fabs(const mpfr_class& v)
{
@@ -456,6 +456,10 @@ inline mpfr_class skewness(const extreme_value_distribution<mpfr_class, Policy>&
// This is 12 * sqrt(6) * zeta(3) / pi^3:
// See http://mathworld.wolfram.com/ExtremeValueDistribution.html
//
#ifdef BOOST_MATH_STANDALONE
static_assert(sizeof(Policy) == 0, "mpfr skewness can not be calculated in standalone mode");
#endif
return boost::lexical_cast<mpfr_class>("1.1395470994046486574927930193898461120875997958366");
}
@@ -463,6 +467,10 @@ template <class Policy>
inline mpfr_class skewness(const rayleigh_distribution<mpfr_class, Policy>& /*dist*/)
{
// using namespace boost::math::constants;
#ifdef BOOST_MATH_STANDALONE
static_assert(sizeof(Policy) == 0, "mpfr skewness can not be calculated in standalone mode");
#endif
return boost::lexical_cast<mpfr_class>("0.63111065781893713819189935154422777984404221106391");
// Computed using NTL at 150 bit, about 50 decimal digits.
// return 2 * root_pi<RealType>() * pi_minus_three<RealType>() / pow23_four_minus_pi<RealType>();
@@ -472,6 +480,10 @@ template <class Policy>
inline mpfr_class kurtosis(const rayleigh_distribution<mpfr_class, Policy>& /*dist*/)
{
// using namespace boost::math::constants;
#ifdef BOOST_MATH_STANDALONE
static_assert(sizeof(Policy) == 0, "mpfr kurtosis can not be calculated in standalone mode");
#endif
return boost::lexical_cast<mpfr_class>("3.2450893006876380628486604106197544154170667057995");
// Computed using NTL at 150 bit, about 50 decimal digits.
// return 3 - (6 * pi<RealType>() * pi<RealType>() - 24 * pi<RealType>() + 16) /
@@ -483,6 +495,10 @@ inline mpfr_class kurtosis_excess(const rayleigh_distribution<mpfr_class, Policy
{
//using namespace boost::math::constants;
// Computed using NTL at 150 bit, about 50 decimal digits.
#ifdef BOOST_MATH_STANDALONE
static_assert(sizeof(Policy) == 0, "mpfr excess kurtosis can not be calculated in standalone mode");
#endif
return boost::lexical_cast<mpfr_class>("0.2450893006876380628486604106197544154170667057995");
// return -(6 * pi<RealType>() * pi<RealType>() - 24 * pi<RealType>() + 16) /
// (four_minus_pi<RealType>() * four_minus_pi<RealType>());
@@ -792,6 +808,10 @@ inline mpfr_class erf_inv_imp(const mpfr_class& p, const mpfr_class& q, const Po
inline mpfr_class bessel_i0(mpfr_class x)
{
#ifdef BOOST_MATH_STANDALONE
static_assert(sizeof(x) == 0, "mpfr bessel_i0 can not be calculated in standalone mode");
#endif
static const mpfr_class P1[] = {
boost::lexical_cast<mpfr_class>("-2.2335582639474375249e+15"),
boost::lexical_cast<mpfr_class>("-5.5050369673018427753e+14"),

View File

@@ -11,7 +11,6 @@
#ifndef BOOST_MATH_MPREAL_BINDINGS_HPP
#define BOOST_MATH_MPREAL_BINDINGS_HPP
#include <boost/lexical_cast.hpp>
#include <type_traits>
#ifdef _MSC_VER
@@ -37,6 +36,7 @@
#include <boost/math/bindings/detail/big_digamma.hpp>
#include <boost/math/bindings/detail/big_lanczos.hpp>
#include <boost/math/tools/config.hpp>
#include <boost/math/tools/lexical_cast.hpp>
namespace mpfr{
@@ -403,6 +403,10 @@ inline mpfr::mpreal skewness(const extreme_value_distribution<mpfr::mpreal, Poli
// This is 12 * sqrt(6) * zeta(3) / pi^3:
// See http://mathworld.wolfram.com/ExtremeValueDistribution.html
//
#ifdef BOOST_MATH_STANDALONE
static_assert(sizeof(Policy) == 0, "mpreal skewness can not be calculated in standalone mode");
#endif
return boost::lexical_cast<mpfr::mpreal>("1.1395470994046486574927930193898461120875997958366");
}
@@ -410,6 +414,10 @@ template <class Policy>
inline mpfr::mpreal skewness(const rayleigh_distribution<mpfr::mpreal, Policy>& /*dist*/)
{
// using namespace boost::math::constants;
#ifdef BOOST_MATH_STANDALONE
static_assert(sizeof(Policy) == 0, "mpreal skewness can not be calculated in standalone mode");
#endif
return boost::lexical_cast<mpfr::mpreal>("0.63111065781893713819189935154422777984404221106391");
// Computed using NTL at 150 bit, about 50 decimal digits.
// return 2 * root_pi<RealType>() * pi_minus_three<RealType>() / pow23_four_minus_pi<RealType>();
@@ -419,6 +427,10 @@ template <class Policy>
inline mpfr::mpreal kurtosis(const rayleigh_distribution<mpfr::mpreal, Policy>& /*dist*/)
{
// using namespace boost::math::constants;
#ifdef BOOST_MATH_STANDALONE
static_assert(sizeof(Policy) == 0, "mpreal kurtosis can not be calculated in standalone mode");
#endif
return boost::lexical_cast<mpfr::mpreal>("3.2450893006876380628486604106197544154170667057995");
// Computed using NTL at 150 bit, about 50 decimal digits.
// return 3 - (6 * pi<RealType>() * pi<RealType>() - 24 * pi<RealType>() + 16) /
@@ -430,6 +442,10 @@ inline mpfr::mpreal kurtosis_excess(const rayleigh_distribution<mpfr::mpreal, Po
{
//using namespace boost::math::constants;
// Computed using NTL at 150 bit, about 50 decimal digits.
#ifdef BOOST_MATH_STANDALONE
static_assert(sizeof(Policy) == 0, "mpreal excess kurtosis can not be calculated in standalone mode");
#endif
return boost::lexical_cast<mpfr::mpreal>("0.2450893006876380628486604106197544154170667057995");
// return -(6 * pi<RealType>() * pi<RealType>() - 24 * pi<RealType>() + 16) /
// (four_minus_pi<RealType>() * four_minus_pi<RealType>());
@@ -739,6 +755,10 @@ mpfr::mpreal erf_inv_imp(const mpfr::mpreal& p, const mpfr::mpreal& q, const Pol
inline mpfr::mpreal bessel_i0(mpfr::mpreal x)
{
#ifdef BOOST_MATH_STANDALONE
static_assert(sizeof(x) == 0, "mpreal bessel_i0 can not be calculated in standalone mode");
#endif
static const mpfr::mpreal P1[] = {
boost::lexical_cast<mpfr::mpreal>("-2.2335582639474375249e+15"),
boost::lexical_cast<mpfr::mpreal>("-5.5050369673018427753e+14"),

View File

@@ -10,10 +10,14 @@
#ifndef BOOST_MATH_COMMON_FACTOR_HPP
#define BOOST_MATH_COMMON_FACTOR_HPP
#ifndef BOOST_MATH_STANDALONE
#include <boost/math/common_factor_ct.hpp>
#include <boost/math/common_factor_rt.hpp>
#include <boost/math/tools/header_deprecated.hpp>
BOOST_HEADER_DEPRECATED("<boost/integer/common_factor.hpp>");
BOOST_MATH_HEADER_DEPRECATED("<boost/integer/common_factor.hpp>");
#else
#error Common factor is not available in standalone mode because it requires boost.integer.
#endif // BOOST_MATH_STANDALONE
#endif // BOOST_MATH_COMMON_FACTOR_HPP

View File

@@ -10,6 +10,7 @@
#ifndef BOOST_MATH_COMMON_FACTOR_CT_HPP
#define BOOST_MATH_COMMON_FACTOR_CT_HPP
#ifndef BOOST_MATH_STANDALONE
#include <boost/integer/common_factor_ct.hpp>
#include <boost/math/tools/header_deprecated.hpp>
@@ -26,6 +27,8 @@ namespace math
} // namespace math
} // namespace boost
#else
#error Common factor is not available in standalone mode because it requires boost.integer.
#endif // BOOST_MATH_STANDALONE
#endif // BOOST_MATH_COMMON_FACTOR_CT_HPP

View File

@@ -7,6 +7,7 @@
#ifndef BOOST_MATH_COMMON_FACTOR_RT_HPP
#define BOOST_MATH_COMMON_FACTOR_RT_HPP
#ifndef BOOST_MATH_STANDALONE
#include <boost/integer/common_factor_rt.hpp>
#include <boost/math/tools/header_deprecated.hpp>
@@ -22,5 +23,8 @@ namespace boost {
using boost::integer::lcm_evaluator;
}
}
#else
#error Common factor is not available in standalone mode because it requires boost.integer.
#endif // BOOST_MATH_STANDALONE
#endif // BOOST_MATH_COMMON_FACTOR_RT_HPP

View File

@@ -118,7 +118,7 @@ namespace boost {
} // boost::math::cstdfloat::detail
// We will now define preprocessor symbols representing quadruple-precision <cmath> functions.
#if defined(BOOST_INTEL)
#if defined(__INTEL_COMPILER)
#define BOOST_CSTDFLOAT_FLOAT128_LDEXP __ldexpq
#define BOOST_CSTDFLOAT_FLOAT128_FREXP __frexpq
#define BOOST_CSTDFLOAT_FLOAT128_FABS __fabsq
@@ -462,7 +462,7 @@ inline boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT
typedef boost::math::cstdfloat::detail::float_internal128_t float_type;
// Scale the argument x to the range (-ln2 < x < ln2).
BOOST_CONSTEXPR_OR_CONST float_type one_over_ln2 = float_type(BOOST_FLOAT128_C(1.44269504088896340735992468100189213742664595415299));
constexpr float_type one_over_ln2 = float_type(BOOST_FLOAT128_C(1.44269504088896340735992468100189213742664595415299));
const float_type x_over_ln2 = x * one_over_ln2;
std::int_fast32_t n;
@@ -592,7 +592,7 @@ inline boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT
// Take the reflection checks (slightly adapted) from <boost/math/gamma.hpp>.
const bool floor_of_z_is_equal_to_z = (positive_x == ::BOOST_CSTDFLOAT_FLOAT128_FLOOR(positive_x));
BOOST_CONSTEXPR_OR_CONST float_type my_pi = BOOST_FLOAT128_C(3.14159265358979323846264338327950288419716939937511);
constexpr float_type my_pi = BOOST_FLOAT128_C(3.14159265358979323846264338327950288419716939937511);
if (floor_of_z_is_equal_to_z)
{

View File

@@ -160,7 +160,7 @@
}
// #elif defined(__GNUC__)
#elif defined(BOOST_INTEL)
#elif defined(__INTEL_COMPILER)
// The section for I/O stream support for the ICC compiler is particularly
// long, because these functions must be painstakingly synthesized from
@@ -173,7 +173,7 @@
#include <cstring>
#include <cctype>
#include <boost/lexical_cast.hpp>
#include <boost/math/tools/lexical_cast.hpp>
namespace boost { namespace math { namespace cstdfloat { namespace detail {
@@ -331,7 +331,12 @@
}
str.append(1U, 'e');
#ifdef BOOST_MATH_STANDALONE
static_assert(sizeof(string_type), "IO streams for intel compilers using _Quad types can not be used in standalone mode");
#else
string_type e = boost::lexical_cast<string_type>(std::abs(my_exp));
#endif
if(e.size() < 2U)
{
@@ -576,12 +581,12 @@
bool is_neg = false;
bool is_neg_expon = false;
BOOST_CONSTEXPR_OR_CONST int ten = 10;
constexpr int ten = 10;
int expon = 0;
int digits_seen = 0;
BOOST_CONSTEXPR_OR_CONST int max_digits = std::numeric_limits<float_type>::max_digits10 + 1;
constexpr int max_digits = std::numeric_limits<float_type>::max_digits10 + 1;
if(*p == static_cast<char>('+'))
{
@@ -767,7 +772,7 @@
}
}
#endif // Use __GNUC__ or BOOST_INTEL libquadmath
#endif // Use __GNUC__ or __INTEL_COMPILER libquadmath
#endif // Not BOOST_CSTDFLOAT_NO_LIBQUADMATH_SUPPORT (i.e., the user would like to have libquadmath support)

View File

@@ -30,7 +30,7 @@
// Define the name of the global quadruple-precision function to be used for
// calculating quiet_NaN() in the specialization of std::numeric_limits<>.
#if defined(BOOST_INTEL)
#if defined(__INTEL_COMPILER)
#define BOOST_CSTDFLOAT_FLOAT128_SQRT __sqrtq
#elif defined(__GNUC__)
#define BOOST_CSTDFLOAT_FLOAT128_SQRT sqrtq

View File

@@ -212,7 +212,7 @@
namespace boost { namespace math { namespace cstdfloat { namespace detail {
#if defined(__GNUC__)
typedef __float128 float_internal128_t;
#elif defined(BOOST_INTEL)
#elif defined(__INTEL_COMPILER)
typedef _Quad float_internal128_t;
#else
#error "Sorry, the compiler is neither GCC, nor Intel, I don't know how to configure <boost/cstdfloat.hpp>."

View File

@@ -113,9 +113,9 @@ struct type_at {
template <typename RealType, size_t Order, size_t Depth>
struct type_at<fvar<RealType, Order>, Depth> {
using type = typename conditional<Depth == 0,
fvar<RealType, Order>,
typename type_at<RealType, Depth - 1>::type>::type;
using type = typename std::conditional<Depth == 0,
fvar<RealType, Order>,
typename type_at<RealType, Depth - 1>::type>::type;
};
template <typename RealType, size_t Depth>
@@ -2041,13 +2041,13 @@ template <class Policy, std::size_t Order>
using fvar_t = differentiation::detail::fvar<Policy, Order>;
template <class Policy, std::size_t Order>
struct evaluation<fvar_t<float, Order>, Policy> {
using type = fvar_t<typename conditional<Policy::promote_float_type::value, double, float>::type, Order>;
using type = fvar_t<typename std::conditional<Policy::promote_float_type::value, double, float>::type, Order>;
};
template <class Policy, std::size_t Order>
struct evaluation<fvar_t<double, Order>, Policy> {
using type =
fvar_t<typename conditional<Policy::promote_double_type::value, long double, double>::type, Order>;
fvar_t<typename std::conditional<Policy::promote_double_type::value, long double, double>::type, Order>;
};
} // namespace policies

View File

@@ -11,9 +11,8 @@
#include <vector>
#include <utility> // for std::move
#include <algorithm> // for std::is_sorted
#include <boost/lexical_cast.hpp>
#include <string>
#include <boost/math/special_functions/fpclassify.hpp>
#include <boost/core/demangle.hpp>
#include <boost/math/tools/assert.hpp>
namespace boost{ namespace math{ namespace detail{
@@ -72,13 +71,13 @@ barycentric_rational_imp<Real>::barycentric_rational_imp(InputIterator1 start_x,
// But if we're going to do a memcpy, we can do some error checking which is inexpensive relative to the copy:
if(boost::math::isnan(*start_x))
{
std::string msg = std::string("x[") + boost::lexical_cast<std::string>(i) + "] is a NAN";
std::string msg = std::string("x[") + std::to_string(i) + "] is a NAN";
throw std::domain_error(msg);
}
if(boost::math::isnan(*start_y))
{
std::string msg = std::string("y[") + boost::lexical_cast<std::string>(i) + "] is a NAN";
std::string msg = std::string("y[") + std::to_string(i) + "] is a NAN";
throw std::domain_error(msg);
}
@@ -128,10 +127,10 @@ void barycentric_rational_imp<Real>::calculate_weights(size_t approximation_orde
if (abs(diff) < (numeric_limits<Real>::min)())
{
std::string msg = std::string("Spacing between x[")
+ boost::lexical_cast<std::string>(k) + std::string("] and x[")
+ boost::lexical_cast<std::string>(i) + std::string("] is ")
+ boost::lexical_cast<std::string>(diff) + std::string(", which is smaller than the epsilon of ")
+ boost::core::demangle(typeid(Real).name());
+ std::to_string(k) + std::string("] and x[")
+ std::to_string(i) + std::string("] is ")
+ std::string("smaller than the epsilon of ")
+ std::string(typeid(Real).name());
throw std::logic_error(msg);
}
inv_product *= diff;

View File

@@ -11,7 +11,6 @@
#include <cstddef>
#include <vector>
#include <type_traits>
#include <boost/lexical_cast.hpp>
namespace boost {
namespace math {

View File

@@ -72,7 +72,7 @@ T t2n_asymptotic(int n)
//
struct max_bernoulli_root_functor
{
max_bernoulli_root_functor(ulong_long_type t) : target(static_cast<double>(t)) {}
max_bernoulli_root_functor(unsigned long long t) : target(static_cast<double>(t)) {}
double operator()(double n)
{
BOOST_MATH_STD_USING
@@ -99,7 +99,7 @@ inline std::size_t find_bernoulli_overflow_limit(const std::false_type&)
// Set a limit on how large the result can ever be:
static const double max_result = static_cast<double>((std::numeric_limits<std::size_t>::max)() - 1000u);
ulong_long_type t = lltrunc(boost::math::tools::log_max_value<T>());
unsigned long long t = lltrunc(boost::math::tools::log_max_value<T>());
max_bernoulli_root_functor fun(t);
boost::math::tools::equal_floor tol;
std::uintmax_t max_iter = boost::math::policies::get_max_root_iterations<Policy>();

View File

@@ -13,6 +13,8 @@
#pragma warning(disable:4702) // Unreachable code: optimization warning
#endif
#include <type_traits>
namespace boost{ namespace math{
namespace detail{
@@ -310,11 +312,11 @@ T erf_inv_imp(const T& p, const T& q, const Policy& pol, const std::integral_con
std::uintmax_t max_iter = policies::get_max_root_iterations<Policy>();
if(p <= 0.5)
{
result = tools::halley_iterate(detail::erf_roots<typename remove_cv<T>::type, Policy>(p, 1), guess, static_cast<T>(0), tools::max_value<T>(), (policies::digits<T, Policy>() * 2) / 3, max_iter);
result = tools::halley_iterate(detail::erf_roots<typename std::remove_cv<T>::type, Policy>(p, 1), guess, static_cast<T>(0), tools::max_value<T>(), (policies::digits<T, Policy>() * 2) / 3, max_iter);
}
else
{
result = tools::halley_iterate(detail::erf_roots<typename remove_cv<T>::type, Policy>(q, -1), guess, static_cast<T>(0), tools::max_value<T>(), (policies::digits<T, Policy>() * 2) / 3, max_iter);
result = tools::halley_iterate(detail::erf_roots<typename std::remove_cv<T>::type, Policy>(q, -1), guess, static_cast<T>(0), tools::max_value<T>(), (policies::digits<T, Policy>() * 2) / 3, max_iter);
}
policies::check_root_iterations<T>("boost::math::erf_inv<%1%>", max_iter, pol);
}

View File

@@ -33,11 +33,13 @@ With these techniques, the code could be simplified.
#define BOOST_MATH_ENDIAN_BIG_BYTE BOOST_ENDIAN_BIG_BYTE
#define BOOST_MATH_ENDIAN_LITTLE_BYTE BOOST_ENDIAN_LITTLE_BYTE
#elif (__cplusplus > 202000L || _MSVC_LANG > 202000L) && __has_include(<bit>)
#elif (__cplusplus > 202000L || _MSVC_LANG > 202000L)
#if __has_include(<bit>)
#include <bit>
#define BOOST_MATH_ENDIAN_BIG_BYTE (std::endian::native == std::endian::big)
#define BOOST_MATH_ENDIAN_LITTLE_BYTE (std::endian::native == std::endian::little)
#endif
#elif defined(_WIN32)
@@ -246,7 +248,7 @@ private:
#elif BOOST_MATH_ENDIAN_LITTLE_BYTE
static constexpr int offset_ = 4;
#else
static_assert(false, "Endian type could not be identified");
static_assert(sizeof(double_precision) == 0, "Endian type could not be identified");
#endif
};
@@ -306,7 +308,7 @@ private:
#elif BOOST_MATH_ENDIAN_LITTLE_BYTE
static constexpr int offset_ = 4;
#else
static_assert(false, "Endian type could not be identified");
static_assert(sizeof(double_precision) == 0, "Endian type could not be identified");
#endif
};
@@ -420,7 +422,7 @@ private:
#elif BOOST_MATH_ENDIAN_LITTLE_BYTE
static constexpr int offset_ = 12;
#else
static_assert(false, "Endian type could not be identified");
static_assert(sizeof(extended_double_precision) == 0, "Endian type could not be identified");
#endif
};
@@ -501,7 +503,7 @@ private:
#elif BOOST_MATH_ENDIAN_LITTLE_BYTE
static constexpr int offset_ = 12;
#else
static_assert(false, "Endian type could not be identified");
static_assert(sizeof(extended_double_precision) == 0, "Endian type could not be identified");
#endif
};
@@ -580,7 +582,7 @@ struct select_native<long double>
&& !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)\
&& !defined(__FAST_MATH__)\
&& !defined(BOOST_MATH_DISABLE_STD_FPCLASSIFY)\
&& !defined(BOOST_INTEL)\
&& !defined(__INTEL_COMPILER)\
&& !defined(sun)\
&& !defined(__VXWORKS__)
# define BOOST_MATH_USE_STD_FPCLASSIFY

View File

@@ -14,6 +14,7 @@
#include <cmath>
#include <limits>
#include <mutex>
#include <string>
#include <boost/math/policies/policy.hpp>
#include <boost/math/special_functions/bernoulli.hpp>
#include <boost/math/special_functions/trunc.hpp>
@@ -22,7 +23,8 @@
#include <boost/math/special_functions/sin_pi.hpp>
#include <boost/math/special_functions/cos_pi.hpp>
#include <boost/math/special_functions/pow.hpp>
#include <boost/math/tools/assert.hpp>
#include <boost/math/tools/assert.hpp>
#include <boost/math/tools/config.hpp>
#ifdef _MSC_VER
#pragma once
@@ -141,7 +143,7 @@ namespace boost { namespace math { namespace detail{
const int iter = N - itrunc(x);
if(iter > (int)policies::get_max_series_iterations<Policy>())
return policies::raise_evaluation_error<T>(function, ("Exceeded maximum series evaluations evaluating at n = " + boost::lexical_cast<std::string>(n) + " and x = %1%").c_str(), x, pol);
return policies::raise_evaluation_error<T>(function, ("Exceeded maximum series evaluations evaluating at n = " + std::to_string(n) + " and x = %1%").c_str(), x, pol);
const int minus_m_minus_one = -m - 1;

View File

@@ -71,7 +71,7 @@ struct bernoulli_imp_variant
(std::numeric_limits<T>::max_exponent == 16384)
&& (std::numeric_limits<T>::radix == 2)
&& (std::numeric_limits<T>::digits <= std::numeric_limits<long double>::digits)
&& (std::is_convertible<long double, T>::value) ? 3 : (!is_convertible<std::int64_t, T>::value ? 4 : 0)
&& (std::is_convertible<long double, T>::value) ? 3 : (!std::is_convertible<std::int64_t, T>::value ? 4 : 0)
)
);
};

View File

@@ -14,9 +14,7 @@
#pragma warning(push) // Temporary until lexical cast fixed.
#pragma warning(disable: 4127 4701)
#endif
#ifndef BOOST_MATH_NO_LEXICAL_CAST
#include <boost/lexical_cast.hpp>
#endif
#include <boost/math/tools/lexical_cast.hpp>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
@@ -26,8 +24,6 @@
#include <array>
#include <type_traits>
#include <type_traits>
#if defined(__GNUC__) && defined(BOOST_MATH_USE_FLOAT128)
//
// This is the only way we can avoid

View File

@@ -2007,7 +2007,7 @@ inline typename tools::promote_args<T>::type
policies::discrete_quantile<>,
policies::assert_undefined<> >::type forwarding_policy;
return policies::checked_narrowing_cast<typename remove_cv<result_type>::type, forwarding_policy>(detail::tgammap1m1_imp(static_cast<value_type>(z), forwarding_policy(), evaluation_type()), "boost::math::tgamma1pm1<%!%>(%1%)");
return policies::checked_narrowing_cast<typename std::remove_cv<result_type>::type, forwarding_policy>(detail::tgammap1m1_imp(static_cast<value_type>(z), forwarding_policy(), evaluation_type()), "boost::math::tgamma1pm1<%!%>(%1%)");
}
template <class T>

View File

@@ -18,6 +18,7 @@
#include <cmath>
#include <cstddef>
#include <boost/math/tools/assert.hpp>
#include <boost/math/tools/config.hpp>
// Support compilers with P0024R2 implemented without linking TBB
// https://en.cppreference.com/w/cpp/compiler_support

View File

@@ -8,9 +8,7 @@
#define BOOST_MATH_TOOLS_BIG_CONSTANT_HPP
#include <boost/math/tools/config.hpp>
#ifndef BOOST_MATH_NO_LEXICAL_CAST
#include <boost/lexical_cast.hpp>
#endif
#include <boost/math/tools/lexical_cast.hpp>
#include <type_traits>
#include <limits>
@@ -42,12 +40,12 @@ typedef double largest_float;
#endif
template <class T>
inline BOOST_CONSTEXPR_OR_CONST T make_big_value(largest_float v, const char*, std::true_type const&, std::false_type const&) BOOST_MATH_NOEXCEPT(T)
inline constexpr T make_big_value(largest_float v, const char*, std::true_type const&, std::false_type const&) BOOST_MATH_NOEXCEPT(T)
{
return static_cast<T>(v);
}
template <class T>
inline BOOST_CONSTEXPR_OR_CONST T make_big_value(largest_float v, const char*, std::true_type const&, std::true_type const&) BOOST_MATH_NOEXCEPT(T)
inline constexpr T make_big_value(largest_float v, const char*, std::true_type const&, std::true_type const&) BOOST_MATH_NOEXCEPT(T)
{
return static_cast<T>(v);
}

View File

@@ -12,7 +12,10 @@
#include <cmath>
#include <limits>
#include <stdexcept>
#ifndef BOOST_MATH_STANDALONE
#include <boost/core/demangle.hpp>
#endif
namespace boost::math::tools {
@@ -77,7 +80,11 @@ public:
if (b_[i] == 0) {
std::ostringstream oss;
oss << "Found a zero partial denominator: b[" << i << "] = " << b_[i] << "."
#ifndef BOOST_MATH_STANDALONE
<< " This means the integer type '" << boost::core::demangle(typeid(Z).name())
#else
<< " This means the integer type '" << typeid(Z).name()
#endif
<< "' has overflowed and you need to use a wider type,"
<< " or there is a bug.";
throw std::overflow_error(oss.str());

View File

@@ -19,6 +19,7 @@
#define BOOST_PREVENT_MACRO_SUBSTITUTION
#define BOOST_MATH_NO_REAL_CONCEPT_TESTS
#define BOOST_MATH_NO_DISTRIBUTION_CONCEPT_TESTS
#define BOOST_MATH_NO_LEXICAL_CAST
#define TEST_STD
#if (__cplusplus > 201400L || _MSVC_LANG > 201400L)
@@ -30,15 +31,22 @@
#if (__cplusplus > 201700L || _MSVC_LANG > 201700L)
#define BOOST_IF_CONSTEXPR if constexpr
#if !__has_include(<execution>)
#define BOOST_NO_CXX17_HDR_EXECUTION
#endif
#else
#define BOOST_IF_CONSTEXPR if
#define BOOST_NO_CXX17_IF_CONSTEXPR
#define BOOST_NO_CXX17_HDR_EXECUTION
#endif
#define BOOST_JOIN(X, Y) BOOST_DO_JOIN(X, Y)
#define BOOST_DO_JOIN(X, Y) BOOST_DO_JOIN2(X,Y)
#define BOOST_DO_JOIN2(X, Y) X##Y
#define BOOST_STRINGIZE(X) BOOST_DO_STRINGIZE(X)
#define BOOST_DO_STRINGIZE(X) #X
#endif // BOOST_MATH_STANDALONE
#include <algorithm> // for min and max

View File

@@ -11,7 +11,7 @@
#endif
#include <type_traits>
#include <boost/lexical_cast.hpp>
#include <boost/math/tools/lexical_cast.hpp>
namespace boost{ namespace math{ namespace tools{
@@ -26,7 +26,8 @@ namespace boost{ namespace math{ namespace tools{
{
#ifdef BOOST_MATH_NO_LEXICAL_CAST
// This function should not compile, we don't have the necessary functionality to support it:
static_assert(sizeof(Real) == 0, "sizeof(Real) should be 0");
static_assert(sizeof(Real) == 0, "boost.lexical_cast is not supported in standalone mode.");
return Real(0);
#else
return boost::lexical_cast<Real>(p);
#endif

View File

@@ -0,0 +1,26 @@
// (C) Copyright Matt Borland 2021
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_MATH_TOOLS_LEXICAL_CAST
#define BOOST_MATH_TOOLS_LEXICAL_CAST
#ifndef BOOST_MATH_STANDALONE
#include <boost/lexical_cast.hpp>
#else
#ifndef BOOST_MATH_NO_LEXICAL_CAST
#define BOOST_MATH_NO_LEXICAL_CAST
#endif
namespace boost {
template <typename T1, typename T2>
inline T1 lexical_cast(const T2)
{
static_assert(sizeof(T1) == 0, "boost.lexical_cast can not be used in standalone mode. Please disable standalone mode and try again");
return T1(0);
}
}
#endif // BOOST_MATH_STANDALONE
#endif // BOOST_MATH_TOOLS_LEXICAL_CAST

View File

@@ -1,5 +1,5 @@
// (C) Copyright Jeremy William Murphy 2016.
// (C) Copyright Matt Borland 2021.
// 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)
@@ -14,8 +14,63 @@
#include <algorithm>
#include <type_traits>
#include <boost/math/tools/polynomial.hpp>
#ifndef BOOST_MATH_STANDALONE
#include <boost/integer/common_factor_rt.hpp>
// std::gcd was introduced in C++17
#elif (__cplusplus > 201700L || _MSVC_LANG > 201700L)
#define BOOST_MATH_CXX17_NUMERIC
#include <numeric>
#include <utility>
#include <iterator>
#include <type_traits>
#include <boost/math/tools/assert.hpp>
namespace boost::integer {
template <typename Iter, typename T = typename std::iterator_traits<Iter>::value_type>
std::pair<T, Iter> gcd_range(Iter first, Iter last) noexcept(std::is_arithmetic_v<T>)
{
using std::gcd;
BOOST_MATH_ASSERT(first != last);
T d = *first;
++first;
while (d != T(1) && first != last)
{
d = gcd(d, *first);
++first;
}
return std::make_pair(d, first);
}
namespace gcd_detail {
template <typename EuclideanDomain>
inline EuclideanDomain Euclid_gcd(EuclideanDomain a, EuclideanDomain b) noexcept(std::is_arithmetic_v<EuclideanDomain>)
{
using std::swap;
while (b != EuclideanDomain(0))
{
a %= b;
swap(a, b);
}
return a;
}
enum method_type
{
method_euclid = 0,
method_binary = 1,
method_mixed = 2
};
} // namespace gcd_detail
} // namespace boost::integer
#endif
namespace boost{
namespace integer {
@@ -36,8 +91,6 @@ namespace boost{
}
}
namespace math{ namespace tools{
/* From Knuth, 4.6.1:
@@ -54,6 +107,10 @@ namespace math{ namespace tools{
template <class T>
T content(polynomial<T> const &x)
{
#if defined(BOOST_MATH_STANDALONE) && !defined(BOOST_MATH_CXX17_NUMERIC)
static_assert(sizeof(T) == 0, "polynomial gcd can only be used in standalone mode with C++17 or higher");
#endif
return x ? boost::integer::gcd_range(x.data().begin(), x.data().end()).first : T(0);
}
@@ -88,7 +145,14 @@ namespace detail
template <class T>
T reduce_to_primitive(polynomial<T> &u, polynomial<T> &v)
{
#ifndef BOOST_MATH_STANDALONE
using boost::integer::gcd;
#elif defined(BOOST_MATH_CXX17_NUMERIC)
using std::gcd;
#else
static_assert(sizeof(T) == 0, "polynomial gcd can only be used in standalone mode with C++17 or higher");
#endif
T const u_cont = content(u), v_cont = content(v);
u /= u_cont;
v /= v_cont;
@@ -185,6 +249,10 @@ template <typename T>
typename std::enable_if<!std::numeric_limits<T>::is_integer && (std::numeric_limits<T>::min_exponent != std::numeric_limits<T>::max_exponent) && !std::numeric_limits<T>::is_exact, polynomial<T> >::type
gcd(polynomial<T> const &u, polynomial<T> const &v)
{
#if defined(BOOST_MATH_STANDALONE) && !defined(BOOST_MATH_CXX17_NUMERIC)
static_assert(sizeof(T) == 0, "polynomial gcd can only be used in standalone mode with C++17 or higher");
#endif
return boost::integer::gcd_detail::Euclid_gcd(u, v);
}

View File

@@ -12,7 +12,10 @@
#include <cmath>
#include <limits>
#include <stdexcept>
#ifndef BOOST_MATH_STANDALONE
#include <boost/core/demangle.hpp>
#endif
namespace boost::math::tools {
@@ -74,7 +77,11 @@ public:
if (b_[i] <= 0) {
std::ostringstream oss;
oss << "Found a negative partial denominator: b[" << i << "] = " << b_[i] << "."
#ifndef BOOST_MATH_STANDALONE
<< " This means the integer type '" << boost::core::demangle(typeid(Z).name())
#else
<< " This means the integer type '" << typeid(Z).name()
#endif
<< "' has overflowed and you need to use a wider type,"
<< " or there is a bug.";
throw std::overflow_error(oss.str());

View File

@@ -27,7 +27,7 @@
// Macro BOOST_MATH_INSTRUMENT_CREATE_TEST_VALUE provides a global diagnostic value for create_type.
#include <boost/cstdfloat.hpp> // For float_64_t, float128_t. Must be first include!
#include <boost/lexical_cast.hpp>
#include <boost/math/tools/lexical_cast.hpp>
#include <limits>
#include <type_traits>
@@ -83,6 +83,8 @@ inline T create_test_value(largest_float, const char* str, const std::false_type
// (This is case T1 = false_type and T2 == false_type).
#ifdef BOOST_MATH_INSTRUMENT_CREATE_TEST_VALUE
create_type = 3;
#elif defined(BOOST_MATH_STANDALONE)
static_assert(sizeof(T) == 0, "Can not create a test value using lexical cast of string in standalone mode");
#endif
return boost::lexical_cast<T>(str);
}

View File

@@ -14,10 +14,13 @@
#include <string>
#include <list>
#include <random>
#include <limits>
#include <stdexcept>
#include <boost/math/tools/condition_numbers.hpp>
#include <boost/random/uniform_real_distribution.hpp>
#ifndef BOOST_MATH_STANDALONE
#include <boost/random/uniform_real_distribution.hpp>
#endif
// Design of this function comes from:
// https://blogs.mathworks.com/cleve/2017/01/23/ulps-plots-reveal-math-function-accurary/
@@ -496,8 +499,16 @@ ulps_plot<F, PreciseReal, CoarseReal>::ulps_plot(F hi_acc_impl, CoarseReal a, Co
std::random_device rd;
gen.seed(rd());
}
// Boost's uniform_real_distribution can generate quad and multiprecision random numbers; std's cannot:
#ifndef BOOST_MATH_STANDALONE
boost::random::uniform_real_distribution<PreciseReal> dis(static_cast<PreciseReal>(a), static_cast<PreciseReal>(b));
#else
// Use std::random in standalone mode if it is a type that the standard library can support (float, double, or long double)
static_assert(std::numeric_limits<PreciseReal>::digits10 <= std::numeric_limits<long double>::digits10, "Standalone mode does not support types with precision that exceeds long double");
std::uniform_real_distribution<PreciseReal> dis(static_cast<PreciseReal>(a), static_cast<PreciseReal>(b));
#endif
precise_abscissas_.resize(samples);
coarse_abscissas_.resize(samples);

View File

@@ -109,7 +109,7 @@ namespace boost{ namespace math{ namespace tr1{ extern "C"{
#error Auto linking not supported in standalone mode.
#endif // BOOST_MATH_STANDALONE
#if !(defined(BOOST_INTEL) && defined(__APPLE__)) && !(defined(__FLT_EVAL_METHOD__) && !defined(__cplusplus))
#if !(defined(__INTEL_COMPILER) && defined(__APPLE__)) && !(defined(__FLT_EVAL_METHOD__) && !defined(__cplusplus))
#if !defined(FLT_EVAL_METHOD)
typedef float float_t;
typedef double double_t;

View File

@@ -3,6 +3,9 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_MATH_STANDALONE
#include <boost/math/concepts/std_real_concept.hpp>
#include <boost/math/interpolators/barycentric_rational.hpp>
@@ -13,3 +16,5 @@ void compile_and_link_test()
boost::math::barycentric_rational<boost::math::concepts::std_real_concept> s(x, y, 3, 3);
s(1.0);
}
#endif

View File

@@ -3,6 +3,9 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_MATH_STANDALONE
#include <boost/math/concepts/std_real_concept.hpp>
#include <boost/math/interpolators/catmull_rom.hpp>
@@ -19,3 +22,5 @@ void compile_and_link_test()
cat(0.0);
cat.prime(0.0);
}
#endif

View File

@@ -3,6 +3,8 @@
// 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_STANDALONE
#define BOOST_MATH_ASSERT_UNDEFINED_POLICY false
#include <boost/cstdfloat.hpp>
@@ -21,3 +23,4 @@ int main(int
#endif
}
#endif

View File

@@ -3,13 +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_STANDALONE
#define BOOST_MATH_ASSERT_UNDEFINED_POLICY false
#include <boost/cstdfloat.hpp>
#include "poison.hpp"
#include "instantiate.hpp"
int main(int
#ifdef BOOST_FLOAT80_C
argc
@@ -22,3 +23,4 @@ int main(int
#endif
}
#endif

View File

@@ -3,6 +3,8 @@
// 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_STANDALONE
#define BOOST_MATH_ASSERT_UNDEFINED_POLICY false
#include <boost/cstdfloat.hpp>
@@ -22,3 +24,4 @@ int main(int
#endif
}
#endif

View File

@@ -3,6 +3,8 @@
// 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_STANDALONE
#define BOOST_MATH_ASSERT_UNDEFINED_POLICY false
#include <boost/cstdfloat.hpp>
@@ -22,3 +24,4 @@ int main(int
#endif
}
#endif

View File

@@ -3,6 +3,9 @@
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_MATH_STANDALONE
#include <boost/math/concepts/std_real_concept.hpp>
#include <boost/math/interpolators/cardinal_cubic_b_spline.hpp>
@@ -13,3 +16,5 @@ void compile_and_link_test()
s(1.0);
s.prime(1.0);
}
#endif

View File

@@ -3,10 +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)
//
// Test requires the use of lexical cast in tools/big_constant.hpp
#ifndef BOOST_MATH_STANDALONE
#include <boost/math/concepts/std_real_concept.hpp>
#include <boost/math/quadrature/exp_sinh.hpp>
void compile_and_link_test()
{
boost::math::concepts::std_real_concept a = 0;
@@ -14,3 +17,5 @@ void compile_and_link_test()
boost::math::quadrature::exp_sinh<boost::math::concepts::std_real_concept> integrator;
integrator.integrate(f, a);
}
#endif

View File

@@ -3,10 +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)
//
// Test requires the use of lexical cast in tools/big_constant.hpp
#ifndef BOOST_MATH_STANDALONE
#include <boost/math/concepts/std_real_concept.hpp>
#include <boost/math/quadrature/gauss.hpp>
void compile_and_link_test()
{
boost::math::concepts::std_real_concept a = 0;
@@ -15,3 +18,5 @@ void compile_and_link_test()
boost::math::quadrature::gauss<boost::math::concepts::std_real_concept, 7> integrator;
integrator.integrate(f, a, b);
}
#endif

View File

@@ -3,10 +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)
//
// Test requires the use of lexical cast in tools/big_constant.hpp
#ifndef BOOST_MATH_STANDALONE
#include <boost/math/concepts/std_real_concept.hpp>
#include <boost/math/quadrature/gauss_kronrod.hpp>
void compile_and_link_test()
{
boost::math::concepts::std_real_concept a = 0;
@@ -15,3 +18,5 @@ void compile_and_link_test()
boost::math::quadrature::gauss_kronrod<boost::math::concepts::std_real_concept, 7> integrator;
integrator.integrate(f, a, b);
}
#endif

View File

@@ -5,7 +5,7 @@
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#if !defined(_MSC_VER) || (_MSC_VER >= 1900)
#if !defined(BOOST_MATH_STANDALONE) && (!defined(_MSC_VER) || (_MSC_VER >= 1900))
#include <boost/math/concepts/std_real_concept.hpp>
#include <boost/math/quadrature/naive_monte_carlo.hpp>

View File

@@ -3,13 +3,17 @@
// 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_STANDALONE
#include <boost/math/concepts/std_real_concept.hpp>
#include <boost/math/differentiation/finite_difference.hpp>
void compile_and_link_test()
{
boost::math::concepts::std_real_concept x = 0;
auto f = [](boost::math::concepts::std_real_concept x) { return x; };
boost::math::differentiation::finite_difference_derivative(f, x);
}
#endif

View File

@@ -14,7 +14,6 @@
// we basically need to include every std lib header we use, otherwise
// our poisoned macros can break legit std lib code.
//
#include <boost/config.hpp>
#include <valarray>
#include <complex>
#include <iosfwd>
@@ -39,18 +38,10 @@
#include <memory>
#include <cerrno>
#include <functional>
#ifndef BOOST_NO_CXX11_HDR_FUTURE
#include <future>
#endif
#ifndef BOOST_NO_CXX11_HDR_THREAD
#include <thread>
#endif
#ifndef BOOST_NO_CXX11_HDR_RANDOM
#include <random>
#endif
#ifndef BOOST_NO_CXX11_HDR_CHRONO
#include <chrono>
#endif
#include <map>
//
@@ -61,7 +52,9 @@
//
// lexical_cast uses macro unsafe isinf etc, so we have to include this as well:
//
#ifndef BOOST_MATH_STANDALONE
#include <boost/lexical_cast.hpp>
#endif
//
// Poison all the function-like macros in C99 so if we accidentally call them

View File

@@ -7,7 +7,11 @@
// #includes all the files that it needs to.
//
#ifndef BOOST_MATH_STANDALONE
#include <boost/math/concepts/std_real_concept.hpp>
#include <boost/math/special_functions/legendre_stieltjes.hpp>
template class boost::math::legendre_stieltjes<boost::math::concepts::std_real_concept>;
#endif

View File

@@ -3,13 +3,17 @@
// 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_STANDALONE
#include <boost/math/concepts/std_real_concept.hpp>
#include <boost/math/quadrature/sinh_sinh.hpp>
void compile_and_link_test()
{
auto f = [](boost::math::concepts::std_real_concept x) { return x; };
boost::math::quadrature::sinh_sinh<boost::math::concepts::std_real_concept> integrator;
integrator.integrate(f);
}
#endif

View File

@@ -0,0 +1,9 @@
// Copyright Matt Borland 2021.
// 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)
//
// Basic sanity check that header
// #includes all the files that it needs to.
//
#include <boost/math/statistics/anderson_darling.hpp>

View File

@@ -0,0 +1,9 @@
// Copyright Matt Borland 2021.
// 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)
//
// Basic sanity check that header
// #includes all the files that it needs to.
//
#include <boost/math/statistics/bivariate_statistics.hpp>

View File

@@ -0,0 +1,9 @@
// Copyright Matt Borland 2021.
// 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)
//
// Basic sanity check that header
// #includes all the files that it needs to.
//
#include <boost/math/statistics/linear_regression.hpp>

View File

@@ -0,0 +1,9 @@
// Copyright Matt Borland 2021.
// 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)
//
// Basic sanity check that header
// #includes all the files that it needs to.
//
#include <boost/math/statistics/ljung_box.hpp>

View File

@@ -0,0 +1,9 @@
// Copyright Matt Borland 2021.
// 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)
//
// Basic sanity check that header
// #includes all the files that it needs to.
//
#include <boost/math/statistics/runs_test.hpp>

View File

@@ -0,0 +1,9 @@
// Copyright Matt Borland 2021.
// 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)
//
// Basic sanity check that header
// #includes all the files that it needs to.
//
#include <boost/math/statistics/signal_statistics.hpp>

View File

@@ -0,0 +1,9 @@
// Copyright Matt Borland 2021.
// 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)
//
// Basic sanity check that header
// #includes all the files that it needs to.
//
#include <boost/math/statistics/t_test.hpp>

View File

@@ -0,0 +1,9 @@
// Copyright Matt Borland 2021.
// 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)
//
// Basic sanity check that header
// #includes all the files that it needs to.
//
#include <boost/math/statistics/univariate_statistics.hpp>

View File

@@ -0,0 +1,9 @@
// Copyright Matt Borland 2021.
// 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)
//
// Basic sanity check that header
// #includes all the files that it needs to.
//
#include <boost/math/statistics/z_test.hpp>

View File

@@ -3,10 +3,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_STANDALONE
#include <boost/math/concepts/std_real_concept.hpp>
#include <boost/math/quadrature/tanh_sinh.hpp>
void compile_and_link_test()
{
boost::math::concepts::std_real_concept a = 0;
@@ -15,3 +17,5 @@ void compile_and_link_test()
boost::math::quadrature::tanh_sinh<boost::math::concepts::std_real_concept> integrator;
integrator.integrate(f, a, b);
}
#endif

View File

@@ -23,9 +23,7 @@ inline void check_result_imp(double, double){}
inline void check_result_imp(long double, long double){}
inline void check_result_imp(int, int){}
inline void check_result_imp(long, long){}
#ifdef BOOST_HAS_LONG_LONG
inline void check_result_imp(boost::long_long_type, boost::long_long_type){}
#endif
inline void check_result_imp(long long, long long){}
inline void check_result_imp(bool, bool){}
//
@@ -78,9 +76,7 @@ union max_align_type
long l;
double d;
long double ld;
#ifdef BOOST_HAS_LONG_LONG
long long ll;
#endif
};
template <class Distribution>

View File

@@ -3,10 +3,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_STANDALONE
#include <boost/math/concepts/std_real_concept.hpp>
#include <boost/math/quadrature/trapezoidal.hpp>
boost::math::concepts::std_real_concept func(boost::math::concepts::std_real_concept x)
{
return x;
@@ -18,3 +20,5 @@ void compile_and_link_test()
boost::math::concepts::std_real_concept b = 1;
boost::math::quadrature::trapezoidal(func, a, b);
}
#endif

View File

@@ -14,7 +14,7 @@
#include <iostream>
#include <iomanip>
#if defined(BOOST_INTEL)
#if defined(__INTEL_COMPILER)
# pragma warning(disable:239)
# pragma warning(disable:264)
#endif

View File

@@ -75,10 +75,10 @@ void sanity_check_##the_digits##_func()
{ \
typedef boost::float##the_digits##_t float_type; \
\
BOOST_CONSTEXPR_OR_CONST int my_digits10 = std::numeric_limits<float_type>::digits10; \
constexpr int my_digits10 = std::numeric_limits<float_type>::digits10; \
\
{ \
BOOST_CONSTEXPR_OR_CONST float_type x = \
constexpr float_type x = \
BOOST_FLOAT##the_digits##_C(0.33333333333333333333333333333333333333333); \
std::stringstream ss; \
ss << std::setprecision(my_digits10 - 1) \
@@ -88,7 +88,7 @@ void sanity_check_##the_digits##_func()
BOOST_CHECK_EQUAL( ss.str(), str ); \
} \
{ \
BOOST_CONSTEXPR_OR_CONST float_type x = \
constexpr float_type x = \
BOOST_FLOAT##the_digits##_C(0.66666666666666666666666666666666666666666); \
std::stringstream ss; \
ss << std::setprecision(my_digits10 - 1) \
@@ -499,9 +499,9 @@ namespace test_cstdfloat
int minus_one;
#if defined(BOOST_FLOATMAX_C)
BOOST_CONSTEXPR_OR_CONST int has_floatmax_t = 1;
constexpr int has_floatmax_t = 1;
#else
BOOST_CONSTEXPR_OR_CONST int has_floatmax_t = 0;
constexpr int has_floatmax_t = 0;
#endif
#if defined(BOOST_FLOAT16_C)

View File

@@ -76,7 +76,7 @@ void test_spots(RealType /*T*/, const char* /*type_name*/)
BOOST_CHECK_EQUAL((boost::math::copysign)(c, a), RealType(-1));
BOOST_CHECK_EQUAL((boost::math::changesign)(a), -a);
}
#if !defined(__SUNPRO_CC) && !defined(BOOST_INTEL)
#if !defined(__SUNPRO_CC) && !defined(__INTEL_COMPILER)
if(std::numeric_limits<RealType>::has_quiet_NaN)
{
a = std::numeric_limits<RealType>::quiet_NaN();

View File

@@ -22,7 +22,7 @@ struct hypergeometric_1f1_gen
{
mp_t operator()(mp_t a1, mp_t a2, mp_t z)
{
int scaling = 0;
long long scaling = 0;
std::cout << a1 << " " << a2 << " " << z << std::endl;
mp_t result = boost::math::detail::hypergeometric_1F1_generic_series(a1, a2, z, boost::math::policies::policy<>(), scaling, "");
std::cout << a1 << " " << a2 << " " << z << " " << result << std::endl;
@@ -34,7 +34,7 @@ struct hypergeometric_1f1_gen_2
{
mp_t operator()(mp_t a1, mp_t a2, mp_t z)
{
int scaling = 0;
long long scaling = 0;
mp_t result = boost::math::detail::hypergeometric_1F1_generic_series(a1, a2, z, boost::math::policies::policy<>(), scaling, "");
result = ldexp(result, scaling);
std::cout << a1 << " " << a2 << " " << z << " " << result << std::endl;