]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/math/example/root_finding_algorithms.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / math / example / root_finding_algorithms.cpp
index df2e68acc6cddfde4d48775152189e28a6dff73d..389d335102f672d9e6834efab9ae1ee9e33fe540 100644 (file)
@@ -15,9 +15,6 @@
 #include <boost/cstdlib.hpp>
 #include <boost/config.hpp>
 #include <boost/array.hpp>
-#include <boost/type_traits/is_floating_point.hpp>
-#include <boost/type_traits/is_fundamental.hpp>
-
 #include "table_type.hpp"
 // Copy of i:\modular-boost\libs\math\test\table_type.hpp
 // #include "handle_test_result.hpp"
@@ -55,6 +52,7 @@ using boost::multiprecision::cpp_bin_float_50;
 #include <fstream> // std::ofstream
 #include <cmath>
 #include <typeinfo> // for type name using typid(thingy).name();
+#include <type_traits>
 
 #ifndef BOOST_ROOT
 # define BOOST_ROOT i:/modular-boost/
@@ -143,11 +141,11 @@ struct root_info
   int get_digits; // fraction of maximum possible accuracy required.
   // = digits * digits_accuracy
   // Vector of values for each algorithm, std::cbrt, boost::math::cbrt, TOMS748, Newton, Halley.
-  //std::vector< boost::int_least64_t> times;  converted to int.
+  //std::vector< std::int_least64_t> times;  converted to int.
   std::vector<int> times;
-  //boost::int_least64_t min_time = std::numeric_limits<boost::int_least64_t>::max(); // Used to normalize times (as int).
+  //std::int_least64_t min_time = std::numeric_limits<std::int_least64_t>::max(); // Used to normalize times (as int).
   std::vector<double> normed_times;
-  boost::int_least64_t min_time = (std::numeric_limits<boost::int_least64_t>::max)(); // Used to normalize times.
+  std::int_least64_t min_time = (std::numeric_limits<std::int_least64_t>::max)(); // Used to normalize times.
   std::vector<uintmax_t> iterations;
   std::vector<long int> distances;
   std::vector<cpp_bin_float_100> full_results;
@@ -203,7 +201,7 @@ T cbrt_noderiv(T x)
 
   // Maybe guess should be double, or use enable_if to avoid warning about conversion double to float here?
   T guess;
-  if (boost::is_fundamental<T>::value)
+  if (std::is_fundamental<T>::value)
   { 
     int exponent;
     frexp(x, &exponent); // Get exponent of z (ignore mantissa).
@@ -217,8 +215,8 @@ T cbrt_noderiv(T x)
   
   T factor = 2; // How big steps to take when searching.
 
-  const boost::uintmax_t maxit = 50; // Limit to maximum iterations.
-  boost::uintmax_t it = maxit; // Initially our chosen max iterations, but updated with actual.
+  const std::uintmax_t maxit = 50; // Limit to maximum iterations.
+  std::uintmax_t it = maxit; // Initially our chosen max iterations, but updated with actual.
   bool is_rising = true; // So if result if guess^3 is too low, then try increasing guess.
   // Some fraction of digits is used to control how accurate to try to make the result.
   int get_digits = static_cast<int>(std::numeric_limits<T>::digits - 2);
@@ -257,7 +255,7 @@ T cbrt_deriv(T x)
   using namespace boost::math::tools;
   int exponent;
   T guess;
-  if(boost::is_fundamental<T>::value)
+  if(std::is_fundamental<T>::value)
   {
      frexp(x, &exponent); // Get exponent of z (ignore mantissa).
      guess = ldexp(static_cast<T>(1), exponent / 3); // Rough guess is to divide the exponent by three.
@@ -267,8 +265,8 @@ T cbrt_deriv(T x)
   T min = guess / 2; // Minimum possible value is half our guess.
   T max = 2 * guess; // Maximum possible value is twice our guess.
   int get_digits = static_cast<int>(std::numeric_limits<T>::digits * 0.6);
-  const boost::uintmax_t maxit = 20;
-  boost::uintmax_t it = maxit;
+  const std::uintmax_t maxit = 20;
+  std::uintmax_t it = maxit;
   T result = newton_raphson_iterate(cbrt_functor_deriv<T>(x), guess, min, max, get_digits, it);
   iters = it;
   return result;
@@ -301,7 +299,7 @@ T cbrt_2deriv(T x)
   using namespace boost::math::tools;
   int exponent;
   T guess;
-  if(boost::is_fundamental<T>::value)
+  if(std::is_fundamental<T>::value)
   {
      frexp(x, &exponent); // Get exponent of z (ignore mantissa).
      guess = ldexp(static_cast<T>(1), exponent / 3); // Rough guess is to divide the exponent by three.
@@ -312,8 +310,8 @@ T cbrt_2deriv(T x)
   T max = 2 * guess; // Maximum possible value is twice our guess.
   // digits used to control how accurate to try to make the result.
   int get_digits = static_cast<int>(std::numeric_limits<T>::digits * 0.4);
-  boost::uintmax_t maxit = 20;
-  boost::uintmax_t it = maxit;
+  std::uintmax_t maxit = 20;
+  std::uintmax_t it = maxit;
   T result = halley_iterate(cbrt_functor_2deriv<T>(x), guess, min, max, get_digits, it);
   iters = it;
   return result;
@@ -328,7 +326,7 @@ T cbrt_2deriv_s(T x)
   using namespace boost::math::tools;
   int exponent;
   T guess;
-  if(boost::is_fundamental<T>::value)
+  if(std::is_fundamental<T>::value)
   {
      frexp(x, &exponent); // Get exponent of z (ignore mantissa).
      guess = ldexp(static_cast<T>(1), exponent / 3); // Rough guess is to divide the exponent by three.
@@ -339,8 +337,8 @@ T cbrt_2deriv_s(T x)
   T max = 2 * guess; // Maximum possible value is twice our guess.
   // digits used to control how accurate to try to make the result.
   int get_digits = static_cast<int>(std::numeric_limits<T>::digits * 0.4);
-  const boost::uintmax_t maxit = 20;
-  boost::uintmax_t it = maxit;
+  const std::uintmax_t maxit = 20;
+  std::uintmax_t it = maxit;
   T result = schroder_iterate(cbrt_functor_2deriv<T>(x), guess, min, max, get_digits, it);
   iters = it;
   return result;