mirror of
https://github.com/boostorg/math.git
synced 2026-01-19 04:22:09 +00:00
Begin adding interpolator tests
This commit is contained in:
@@ -17,6 +17,10 @@
|
||||
using boost::multiprecision::float128;
|
||||
#endif
|
||||
|
||||
#if __has_include(<stdfloat>)
|
||||
# include <stdfloat>
|
||||
#endif
|
||||
|
||||
using std::abs;
|
||||
using boost::math::gegenbauer;
|
||||
using boost::math::gegenbauer_derivative;
|
||||
@@ -26,7 +30,7 @@ void test_parity()
|
||||
{
|
||||
std::mt19937 gen(323723);
|
||||
std::uniform_real_distribution<Real> xdis(-1, +1);
|
||||
std::uniform_real_distribution<Real> lambdadis(-0.5, 1);
|
||||
std::uniform_real_distribution<Real> lambdadis(Real(-0.5), 1);
|
||||
|
||||
for(unsigned n = 0; n < 50; ++n) {
|
||||
unsigned calls = 50;
|
||||
@@ -79,7 +83,7 @@ void test_cubic()
|
||||
template<class Real>
|
||||
void test_derivative()
|
||||
{
|
||||
Real lambda = 0.5;
|
||||
Real lambda = Real(0.5);
|
||||
auto c3_prime = [&](Real x) { return 2*lambda*(lambda+1)*(-1 + 2*(lambda+2)*x*x); };
|
||||
auto c3_double_prime = [&](Real x) { return 8*lambda*(lambda+1)*(lambda+2)*x; };
|
||||
Real x = -1;
|
||||
@@ -102,33 +106,51 @@ void test_derivative()
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifdef __STDCPP_FLOAT32_T__
|
||||
|
||||
test_parity<std::float32_t>();
|
||||
test_quadratic<std::float32_t>();
|
||||
test_derivative<std::float32_t>();
|
||||
|
||||
#else
|
||||
|
||||
test_parity<float>();
|
||||
test_parity<double>();
|
||||
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
|
||||
test_parity<long double>();
|
||||
#endif
|
||||
|
||||
test_quadratic<float>();
|
||||
test_quadratic<double>();
|
||||
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
|
||||
test_quadratic<long double>();
|
||||
#endif
|
||||
|
||||
test_cubic<double>();
|
||||
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
|
||||
test_cubic<long double>();
|
||||
#endif
|
||||
|
||||
test_derivative<float>();
|
||||
test_derivative<double>();
|
||||
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
|
||||
test_derivative<long double>();
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_HAS_FLOAT128
|
||||
#endif
|
||||
|
||||
#ifdef __STDCPP_FLOAT64_T__
|
||||
|
||||
test_parity<std::float64_t>();
|
||||
test_quadratic<std::float64_t>();
|
||||
test_cubic<std::float64_t>();
|
||||
test_derivative<std::float64_t>();
|
||||
|
||||
#else
|
||||
|
||||
test_parity<double>();
|
||||
test_quadratic<double>();
|
||||
test_cubic<double>();
|
||||
test_derivative<double>();
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
|
||||
|
||||
test_parity<long double>();
|
||||
test_quadratic<long double>();
|
||||
test_cubic<long double>();
|
||||
test_derivative<long double>();
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_HAS_FLOAT128
|
||||
|
||||
test_quadratic<boost::multiprecision::float128>();
|
||||
test_cubic<boost::multiprecision::float128>();
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
return boost::math::test::report_errors();
|
||||
}
|
||||
|
||||
@@ -16,6 +16,10 @@
|
||||
using boost::multiprecision::float128;
|
||||
#endif
|
||||
|
||||
#if __has_include(<stdfloat>)
|
||||
# include <stdfloat>
|
||||
#endif
|
||||
|
||||
using std::abs;
|
||||
using boost::math::jacobi;
|
||||
using boost::math::jacobi_derivative;
|
||||
@@ -95,28 +99,47 @@ void test_derivative()
|
||||
|
||||
int main()
|
||||
{
|
||||
test_to_quadratic<double>();
|
||||
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
|
||||
test_to_quadratic<long double>();
|
||||
#endif
|
||||
#ifdef __STDCPP_FLOAT32_T__
|
||||
|
||||
test_symmetry<std::float32_t>();
|
||||
test_derivative<std::float32_t>();
|
||||
|
||||
#else
|
||||
|
||||
test_symmetry<float>();
|
||||
test_symmetry<double>();
|
||||
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
|
||||
test_symmetry<long double>();
|
||||
#endif
|
||||
|
||||
test_derivative<float>();
|
||||
test_derivative<double>();
|
||||
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
|
||||
test_derivative<long double>();
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_HAS_FLOAT128
|
||||
#endif
|
||||
|
||||
#ifdef __STDCPP_FLOAT64_T__
|
||||
|
||||
test_to_quadratic<std::float64_t>();
|
||||
test_symmetry<std::float64_t>();
|
||||
test_derivative<std::float64_t>();
|
||||
|
||||
#else
|
||||
|
||||
test_to_quadratic<double>();
|
||||
test_symmetry<double>();
|
||||
test_derivative<double>();
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
|
||||
|
||||
test_to_quadratic<long double>();
|
||||
test_symmetry<long double>();
|
||||
test_derivative<long double>();
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_HAS_FLOAT128
|
||||
|
||||
test_to_quadratic<boost::multiprecision::float128>();
|
||||
test_symmetry<boost::multiprecision::float128>();
|
||||
test_derivative<boost::multiprecision::float128>();
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
return boost::math::test::report_errors();
|
||||
}
|
||||
|
||||
@@ -19,6 +19,10 @@
|
||||
#include <boost/multiprecision/float128.hpp>
|
||||
#endif
|
||||
|
||||
#if __has_include(<stdfloat>)
|
||||
# include <stdfloat>
|
||||
#endif
|
||||
|
||||
using std::sqrt;
|
||||
using std::abs;
|
||||
using std::numeric_limits;
|
||||
@@ -258,30 +262,53 @@ BOOST_AUTO_TEST_CASE(barycentric_rational)
|
||||
// The tests took too long at the higher precisions.
|
||||
// They still pass, but the CI system is starting to time out,
|
||||
// so I figured it'd be polite to comment out the most expensive tests.
|
||||
test_weights<double>();
|
||||
|
||||
|
||||
#ifdef __STDCPP_FLOAT32_T__
|
||||
|
||||
test_constant<std::float32_t>();
|
||||
//test_constant_high_order<std::float32_t>();
|
||||
test_interpolation_condition<std::float32_t>();
|
||||
//test_interpolation_condition_high_order<std::float32_t>();
|
||||
|
||||
#else
|
||||
|
||||
test_constant<float>();
|
||||
//test_constant<double>();
|
||||
test_constant<long double>();
|
||||
//test_constant<cpp_bin_float_50>();
|
||||
|
||||
//test_constant_high_order<float>();
|
||||
test_constant_high_order<double>();
|
||||
//test_constant_high_order<long double>();
|
||||
//test_constant_high_order<cpp_bin_float_50>();
|
||||
|
||||
test_interpolation_condition<float>();
|
||||
test_interpolation_condition<double>();
|
||||
//test_interpolation_condition<long double>();
|
||||
//test_interpolation_condition<cpp_bin_float_50>();
|
||||
|
||||
//test_interpolation_condition_high_order<float>();
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __STDCPP_FLOAT64_T__
|
||||
|
||||
test_weights<std::float64_t>();
|
||||
//test_constant<std::float64_t>();
|
||||
test_constant_high_order<std::float64_t>();
|
||||
test_interpolation_condition<std::float64_t>();
|
||||
test_interpolation_condition_high_order<std::float64_t>();
|
||||
test_runge<std::float64_t>();
|
||||
|
||||
#else
|
||||
|
||||
test_weights<double>();
|
||||
//test_constant<double>();
|
||||
test_constant_high_order<double>();
|
||||
test_interpolation_condition<double>();
|
||||
test_interpolation_condition_high_order<double>();
|
||||
//test_interpolation_condition_high_order<long double>();
|
||||
//test_interpolation_condition_high_order<cpp_bin_float_50>();
|
||||
|
||||
test_runge<double>();
|
||||
|
||||
#endif
|
||||
|
||||
test_constant<long double>();
|
||||
//test_constant_high_order<long double>();
|
||||
//test_interpolation_condition<long double>();
|
||||
//test_interpolation_condition_high_order<long double>();
|
||||
//test_runge<long double>();
|
||||
|
||||
//test_constant<cpp_bin_float_50>();
|
||||
//test_constant_high_order<cpp_bin_float_50>();
|
||||
//test_interpolation_condition<cpp_bin_float_50>();
|
||||
//test_interpolation_condition_high_order<cpp_bin_float_50>();
|
||||
//test_runge<cpp_bin_float_50>();
|
||||
|
||||
#ifdef BOOST_HAS_FLOAT128
|
||||
|
||||
@@ -18,6 +18,10 @@
|
||||
#include <boost/math/interpolators/barycentric_rational.hpp>
|
||||
#include <boost/math/interpolators/vector_barycentric_rational.hpp>
|
||||
|
||||
#if __has_include(<stdfloat>)
|
||||
# include <stdfloat>
|
||||
#endif
|
||||
|
||||
using std::sqrt;
|
||||
using std::abs;
|
||||
using std::numeric_limits;
|
||||
@@ -373,6 +377,20 @@ void test_weights()
|
||||
|
||||
BOOST_AUTO_TEST_CASE(vector_barycentric_rational)
|
||||
{
|
||||
#ifdef __STDCPP_FLOAT64_T__
|
||||
|
||||
test_weights<std::float64_t>();
|
||||
test_constant_eigen<std::float64_t>();
|
||||
test_constant_std_array<std::float64_t>();
|
||||
test_constant_high_order<std::float64_t>();
|
||||
test_interpolation_condition_eigen<std::float64_t>();
|
||||
test_interpolation_condition_ublas<std::float64_t>();
|
||||
test_interpolation_condition_std_array<std::float64_t>();
|
||||
test_interpolation_condition_high_order<std::float64_t>();
|
||||
test_agreement_with_1d<std::float64_t>();
|
||||
|
||||
#else
|
||||
|
||||
test_weights<double>();
|
||||
test_constant_eigen<double>();
|
||||
test_constant_std_array<double>();
|
||||
@@ -382,4 +400,6 @@ BOOST_AUTO_TEST_CASE(vector_barycentric_rational)
|
||||
test_interpolation_condition_std_array<double>();
|
||||
test_interpolation_condition_high_order<double>();
|
||||
test_agreement_with_1d<double>();
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user