klArbitraryPrecisionSolver
kl_arbitrary_precision_root.h File Reference
#include <boost/math/tools/roots.hpp>
#include <limits>
Include dependency graph for kl_arbitrary_precision_root.h:

Go to the source code of this file.

Data Structures

struct  cbrt_functor< T >
 

Namespaces

 boost
 
 boost::math
 
 boost::math::tools
 

Functions

template<class F , class T >
boost::math::tools::newton_raphson_iterate (F f, T guess, T min, T max, int digits)
 
template<class F , class T >
boost::math::tools::newton_raphson_iterate (F f, T guess, T min, T max, int digits, boost::uintmax_t &max_iter)
 
template<class F , class T >
boost::math::tools::halley_iterate (F f, T guess, T min, T max, int digits)
 
template<class F , class T >
boost::math::tools::halley_iterate (F f, T guess, T min, T max, int digits, boost::uintmax_t &max_iter)
 
template<class F , class T >
boost::math::tools::schroeder_iterate (F f, T guess, T min, T max, int digits)
 
template<class F , class T >
boost::math::tools::schroeder_iterate (F f, T guess, T min, T max, int digits, boost::uintmax_t &max_iter)
 
template<class T >
kl_arbitrary_precision_root (T z, unsigned int precision)
 

Function Documentation

template<class T >
T kl_arbitrary_precision_root ( z,
unsigned int  precision 
)

Definition at line 183 of file kl_arbitrary_precision_root.h.

References boost::math::tools::halley_iterate().

184 {
185  using namespace std;
186  int exp;
187  frexp(z, &exp);
188  T min = ldexp(0.5, exp/3);
189  T max = ldexp(2.0, exp/3);
190  T guess = ldexp(1.0, exp/3);
191  int digits = std::numeric_limits<T>::digits / 2;
192 
193  cout<<"The typeid for this datatype is : "<<typeid(z).name();
194 
195  string zType =typeid(z).name();
196  int usingArb = zType.compare(typeid(boost::math::ntl::RR).name());
197  if (usingArb==0)
198  {
199  cout<<"We're using arb precision"<<endl;
200  digits = precision /2;
201  }
202 
203  T ans =boost::math::tools::halley_iterate(cbrt_functor<T>(z), guess, min, max, digits);
204  return ans;
205  //return tools::halley_iterate(detail::cbrt_functor<T>(z), guess, min, max, digits);
206 }
T halley_iterate(F f, T guess, T min, T max, int digits)

Here is the call graph for this function: