]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/math/test/test_numerical_differentiation.cpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / math / test / test_numerical_differentiation.cpp
index 047dd28750db8d0e6519e95833606b0b32c78fdf..1b2f539624e300c76efa2e002f8f5c3543656758 100644 (file)
 #include <iostream>
 #include <boost/type_index.hpp>
 #include <boost/test/included/unit_test.hpp>
-#include <boost/test/floating_point_comparison.hpp>
-#include <boost/multiprecision/cpp_bin_float.hpp>
-#include <boost/multiprecision/cpp_dec_float.hpp>
+#include <boost/test/tools/floating_point_comparison.hpp>
 #include <boost/math/special_functions/bessel.hpp>
 #include <boost/math/special_functions/bessel_prime.hpp>
 #include <boost/math/special_functions/next.hpp>
-#include <boost/math/tools/numerical_differentiation.hpp>
+#include <boost/math/differentiation/finite_difference.hpp>
 
 using std::abs;
 using std::pow;
-using boost::math::tools::finite_difference_derivative;
-using boost::math::tools::complex_step_derivative;
+using boost::math::differentiation::finite_difference_derivative;
+using boost::math::differentiation::complex_step_derivative;
 using boost::math::cyl_bessel_j;
 using boost::math::cyl_bessel_j_prime;
 using boost::math::constants::half;
-using boost::multiprecision::cpp_dec_float_100;
-using boost::multiprecision::cpp_bin_float_50;
-using boost::multiprecision::cpp_bin_float_100;
-using boost::multiprecision::cpp_bin_float_quad;
-
 
 template<class Real, size_t order>
 void test_order(size_t points_to_test)
@@ -37,7 +30,7 @@ void test_order(size_t points_to_test)
     std::cout << "Testing order " <<  order  << " derivative error estimate on type " << boost::typeindex::type_id<Real>().pretty_name() << "\n";
     std::cout << std::setprecision(std::numeric_limits<Real>::digits10);
     //std::cout << std::fixed << std::scientific;
-    auto f = [](Real t) { return cyl_bessel_j<Real>(1, t); };
+    auto f = [](Real t) { return boost::math::cyl_bessel_j<Real>(1, t); };
     Real min = -100000.0;
     Real max = -min;
     Real x = min;
@@ -98,7 +91,7 @@ void test_bessel()
 
     Real eps = std::numeric_limits<Real>::epsilon();
     Real x = static_cast<Real>(25.1);
-    auto f = [](Real t) { return cyl_bessel_j(12, t); };
+    auto f = [](Real t) { return boost::math::cyl_bessel_j(12, t); };
 
     Real computed = finite_difference_derivative<decltype(f), Real, 1>(f, x);
     Real expected = cyl_bessel_j_prime(12, x);
@@ -227,46 +220,26 @@ BOOST_AUTO_TEST_CASE(numerical_differentiation_test)
 {
     test_complex_step<float>();
     test_complex_step<double>();
-#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
-    test_complex_step<long double>();
-#endif
+
     test_bessel<float>();
     test_bessel<double>();
-#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
-    test_bessel<long double>();
-#endif
-    test_bessel<cpp_bin_float_50>();
+
 
     size_t points_to_test = 1000;
     test_order<float, 1>(points_to_test);
     test_order<double, 1>(points_to_test);
-#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
-    test_order<long double, 1>(points_to_test);
-#endif
-    test_order<cpp_bin_float_50, 1>(points_to_test);
+
 
     test_order<float, 2>(points_to_test);
     test_order<double, 2>(points_to_test);
-#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
-    test_order<long double, 2>(points_to_test);
-#endif
-    test_order<cpp_bin_float_50, 2>(points_to_test);
 
     test_order<float, 4>(points_to_test);
     test_order<double, 4>(points_to_test);
-#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
-    test_order<long double, 4>(points_to_test);
-#endif
 
     test_order<float, 6>(points_to_test);
     test_order<double, 6>(points_to_test);
-#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
-    test_order<long double, 6>(points_to_test);
-#endif
 
     test_order<float, 8>(points_to_test);
     test_order<double, 8>(points_to_test);
-#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
-    test_order<long double, 8>(points_to_test);
-#endif
+
 }