]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/math/test/test_root_finding_concepts.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / math / test / test_root_finding_concepts.cpp
index 60543f92a5f56ce9dfca62715ed4fbe8a4ba0f62..c48c2c575c21759bde3718bc8701689e1bddf7b8 100644 (file)
@@ -13,9 +13,8 @@
 #include <boost/tuple/tuple.hpp>
 #include <boost/fusion/include/tuple.hpp>
 #include <boost/fusion/include/std_pair.hpp>
-#ifndef BOOST_NO_CXX11_HDR_TUPLE
+#include <boost/math/tools/toms748_solve.hpp>
 #include <tuple>
-#endif
 
 #include <iostream>
 #include <iomanip>
@@ -49,7 +48,7 @@ struct cbtr_functor_2a
 private:
    double m_target;
 };
-#ifndef BOOST_NO_CXX11_HDR_TUPLE
+
 struct cbtr_functor_2b
 {
    cbtr_functor_2b(double x) : m_target(x) {}
@@ -60,7 +59,6 @@ struct cbtr_functor_2b
 private:
    double m_target;
 };
-#endif
 struct cbtr_functor_2c
 {
    cbtr_functor_2c(double x) : m_target(x) {}
@@ -82,7 +80,6 @@ private:
    double m_target;
 };
 
-#ifndef BOOST_NO_CXX11_HDR_TUPLE
 struct cbtr_functor_3b
 {
    cbtr_functor_3b(double x) : m_target(x) {}
@@ -93,7 +90,7 @@ struct cbtr_functor_3b
 private:
    double m_target;
 };
-#endif
+
 struct cbtr_functor_3c
 {
    cbtr_functor_3c(double x) : m_target(x) {}
@@ -134,7 +131,7 @@ BOOST_AUTO_TEST_CASE( test_main )
    //
    // bracket_and_solve_root:
    //
-   boost::uintmax_t max_iter = boost::math::policies::get_max_root_iterations<boost::math::policies::policy<> >();
+   std::uintmax_t max_iter = boost::math::policies::get_max_root_iterations<boost::math::policies::policy<> >();
    p = boost::math::tools::bracket_and_solve_root(f1, x, 2.0, true, t, max_iter);
    result = (p.first + p.second) / 2;
    BOOST_CHECK_CLOSE_FRACTION(expected, result, tolerance);
@@ -146,7 +143,6 @@ BOOST_AUTO_TEST_CASE( test_main )
    result = (p.first + p.second) / 2;
    BOOST_CHECK_CLOSE_FRACTION(expected, result, tolerance);
 
-#ifndef BOOST_NO_CXX11_LAMBDAS
    //
    // Now try again with C++11 lambda's
    //
@@ -167,24 +163,19 @@ BOOST_AUTO_TEST_CASE( test_main )
    p = boost::math::tools::toms748_solve([x](double z){ return z * z * z - x; }, 0.0, x, t, max_iter);
    result = (p.first + p.second) / 2;
    BOOST_CHECK_CLOSE_FRACTION(expected, result, tolerance);
-#endif
 
    cbtr_functor_2a f2(x);
-#ifndef BOOST_NO_CXX11_HDR_TUPLE
    cbtr_functor_2b f3(x);
-#endif
    cbtr_functor_2c f4(x);
    cbtr_functor_2d f5(x);
 
    //
    // Binary Functors - newton_raphson_iterate - test each possible tuple type:
    //
-#ifndef BOOST_NO_CXX11_HDR_TUPLE
    result = boost::math::tools::newton_raphson_iterate(f2, x, 0.0, x, std::numeric_limits<double>::digits - 1);
    BOOST_CHECK_CLOSE_FRACTION(expected, result, tolerance);
    result = boost::math::tools::newton_raphson_iterate(f3, x, 0.0, x, std::numeric_limits<double>::digits - 1);
    BOOST_CHECK_CLOSE_FRACTION(expected, result, tolerance);
-#endif
    result = boost::math::tools::newton_raphson_iterate(f4, x, 0.0, x, std::numeric_limits<double>::digits - 1);
    BOOST_CHECK_CLOSE_FRACTION(expected, result, tolerance);
    result = boost::math::tools::newton_raphson_iterate(f5, x, 0.0, x, std::numeric_limits<double>::digits - 1);
@@ -192,63 +183,44 @@ BOOST_AUTO_TEST_CASE( test_main )
    //
    // And again but with lambdas:
    //
-#ifndef BOOST_NO_CXX11_LAMBDAS
    result = boost::math::tools::newton_raphson_iterate([x](double z){ return std::make_pair(z * z * z - x, 3 * z * z); }, x, 0.0, x, std::numeric_limits<double>::digits - 1);
    BOOST_CHECK_CLOSE_FRACTION(expected, result, tolerance);
-#ifndef BOOST_NO_CXX11_HDR_TUPLE
    result = boost::math::tools::newton_raphson_iterate([x](double z){ return std::make_tuple(z * z * z - x, 3 * z * z); }, x, 0.0, x, std::numeric_limits<double>::digits - 1);
    BOOST_CHECK_CLOSE_FRACTION(expected, result, tolerance);
-#endif
    result = boost::math::tools::newton_raphson_iterate([x](double z){ return boost::tuple<double, double>(z * z * z - x, 3 * z * z); }, x, 0.0, x, std::numeric_limits<double>::digits - 1);
    BOOST_CHECK_CLOSE_FRACTION(expected, result, tolerance);
    result = boost::math::tools::newton_raphson_iterate([x](double z){ return boost::fusion::tuple<double, double>(z * z * z - x, 3 * z * z); }, x, 0.0, x, std::numeric_limits<double>::digits - 1);
    BOOST_CHECK_CLOSE_FRACTION(expected, result, tolerance);
-#endif
-
-#ifndef BOOST_NO_CXX11_HDR_TUPLE
    cbtr_functor_3b f6(x);
-#endif
    cbtr_functor_3c f7(x);
    cbtr_functor_3d f8(x);
 
    //
    // Ternary functors:
    //
-#ifndef BOOST_NO_CXX11_HDR_TUPLE
    result = boost::math::tools::halley_iterate(f6, x, 0.0, x, std::numeric_limits<double>::digits - 1);
    BOOST_CHECK_CLOSE_FRACTION(expected, result, tolerance);
-#endif
    result = boost::math::tools::halley_iterate(f7, x, 0.0, x, std::numeric_limits<double>::digits - 1);
    BOOST_CHECK_CLOSE_FRACTION(expected, result, tolerance);
    result = boost::math::tools::halley_iterate(f8, x, 0.0, x, std::numeric_limits<double>::digits - 1);
    BOOST_CHECK_CLOSE_FRACTION(expected, result, tolerance);
-#ifndef BOOST_NO_CXX11_LAMBDAS
-#ifndef BOOST_NO_CXX11_HDR_TUPLE
    result = boost::math::tools::halley_iterate([x](double z){ return std::make_tuple(z * z * z - x, 3 * z * z, 6 * z); }, x, 0.0, x, std::numeric_limits<double>::digits - 1);
    BOOST_CHECK_CLOSE_FRACTION(expected, result, tolerance);
-#endif
    result = boost::math::tools::halley_iterate([x](double z){ return boost::tuple<double, double, double>(z * z * z - x, 3 * z * z, 6 * z); }, x, 0.0, x, std::numeric_limits<double>::digits - 1);
    BOOST_CHECK_CLOSE_FRACTION(expected, result, tolerance);
    result = boost::math::tools::halley_iterate([x](double z){ return boost::fusion::tuple<double, double, double>(z * z * z - x, 3 * z * z, 6 * z); }, x, 0.0, x, std::numeric_limits<double>::digits - 1);
    BOOST_CHECK_CLOSE_FRACTION(expected, result, tolerance);
-#endif
-#ifndef BOOST_NO_CXX11_HDR_TUPLE
    result = boost::math::tools::schroder_iterate(f6, x, 0.0, x, std::numeric_limits<double>::digits - 1);
    BOOST_CHECK_CLOSE_FRACTION(expected, result, tolerance);
-#endif
    result = boost::math::tools::schroder_iterate(f7, x, 0.0, x, std::numeric_limits<double>::digits - 1);
    BOOST_CHECK_CLOSE_FRACTION(expected, result, tolerance);
    result = boost::math::tools::schroder_iterate(f8, x, 0.0, x, std::numeric_limits<double>::digits - 1);
    BOOST_CHECK_CLOSE_FRACTION(expected, result, tolerance);
-#ifndef BOOST_NO_CXX11_LAMBDAS
-#ifndef BOOST_NO_CXX11_HDR_TUPLE
    result = boost::math::tools::schroder_iterate([x](double z){ return std::make_tuple(z * z * z - x, 3 * z * z, 6 * z); }, x, 0.0, x, std::numeric_limits<double>::digits - 1);
    BOOST_CHECK_CLOSE_FRACTION(expected, result, tolerance);
-#endif
    result = boost::math::tools::schroder_iterate([x](double z){ return boost::tuple<double, double, double>(z * z * z - x, 3 * z * z, 6 * z); }, x, 0.0, x, std::numeric_limits<double>::digits - 1);
    BOOST_CHECK_CLOSE_FRACTION(expected, result, tolerance);
    result = boost::math::tools::schroder_iterate([x](double z){ return boost::fusion::tuple<double, double, double>(z * z * z - x, 3 * z * z, 6 * z); }, x, 0.0, x, std::numeric_limits<double>::digits - 1);
    BOOST_CHECK_CLOSE_FRACTION(expected, result, tolerance);
-#endif
 } // BOOST_AUTO_TEST_CASE( test_main )