2
0
mirror of https://github.com/boostorg/math.git synced 2026-02-22 03:22:28 +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

@@ -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();