stator
A math, geometry, and utility library
Namespaces | Functions
stator::numeric Namespace Reference

Numerical routines, such as root-finding, etc.

Namespaces

 detail
 

Functions

template<class F , class Real >
bool bisection (const F &f, Real &x, Real low_bound, Real high_bound, size_t iterations=0, int digits=std::numeric_limits< Real >::digits/2)
 
template<class F , size_t Derivatives, class Real >
int bisection_step (const F &f, std::array< Real, Derivatives > &curr_state, Real &x, Real &low_bound, Real &high_bound, Real x_precision)
 A single bisection step. More...
 
template<class F , size_t Derivatives, class Real >
int halley_step (const F &f, std::array< Real, Derivatives > &curr_state, Real &x, Real &low_bound, Real &high_bound, Real x_precision)
 A single step of Halley's method for finding roots. More...
 
template<class F , class Real >
bool halleys_method (const F &f, Real &x, Real low_bound=-HUGE_VAL, Real high_bound=+HUGE_VAL, size_t iterations=0, int digits=std::numeric_limits< Real >::digits/2)
 Safeguarded Halley's method for detecting a root. More...
 
template<class F , class Real >
bool newton_raphson (const F &f, Real &x, Real low_bound=-HUGE_VAL, Real high_bound=+HUGE_VAL, size_t iterations=0, int digits=std::numeric_limits< Real >::digits/2)
 Safeguarded newton_raphson method for detecting a root. More...
 
template<class F , size_t Derivatives, class Real >
int newton_raphson_step (const F &f, std::array< Real, Derivatives > &curr_state, Real &x, Real &low_bound, Real &high_bound, Real x_precision)
 A single step of the Newton-Raphson method for finding roots. More...
 
template<class F , size_t Derivatives, class Real >
int schroeder_step (const F &f, std::array< Real, Derivatives > &curr_state, Real &x, Real &low_bound, Real &high_bound, Real x_precision)
 A single step of Schroeder's method for finding roots. More...
 

Function Documentation

◆ bisection()

template<class F , class Real >
bool stator::numeric::bisection ( const F &  f,
Real &  x,
Real  low_bound,
Real  high_bound,
size_t  iterations = 0,
int  digits = std::numeric_limits<Real>::digits / 2 
)

Definition at line 272 of file numeric.hpp.

◆ bisection_step()

template<class F , size_t Derivatives, class Real >
int stator::numeric::bisection_step ( const F &  f,
std::array< Real, Derivatives > &  curr_state,
Real &  x,
Real &  low_bound,
Real &  high_bound,
Real  x_precision 
)
inline

Definition at line 149 of file numeric.hpp.

◆ halley_step()

template<class F , size_t Derivatives, class Real >
int stator::numeric::halley_step ( const F &  f,
std::array< Real, Derivatives > &  curr_state,
Real &  x,
Real &  low_bound,
Real &  high_bound,
Real  x_precision 
)
inline

Definition at line 102 of file numeric.hpp.

◆ halleys_method()

template<class F , class Real >
bool stator::numeric::halleys_method ( const F &  f,
Real &  x,
Real  low_bound = -HUGE_VAL,
Real  high_bound = +HUGE_VAL,
size_t  iterations = 0,
int  digits = std::numeric_limits<Real>::digits / 2 
)

This returns false if the method is not converging or if the number of iterations was exceeded.

Definition at line 240 of file numeric.hpp.

◆ newton_raphson()

template<class F , class Real >
bool stator::numeric::newton_raphson ( const F &  f,
Real &  x,
Real  low_bound = -HUGE_VAL,
Real  high_bound = +HUGE_VAL,
size_t  iterations = 0,
int  digits = std::numeric_limits<Real>::digits / 2 
)

This returns false if the method is not converging or if the number of iterations was exceeded.

Definition at line 207 of file numeric.hpp.

◆ newton_raphson_step()

template<class F , size_t Derivatives, class Real >
int stator::numeric::newton_raphson_step ( const F &  f,
std::array< Real, Derivatives > &  curr_state,
Real &  x,
Real &  low_bound,
Real &  high_bound,
Real  x_precision 
)
inline

Definition at line 85 of file numeric.hpp.

◆ schroeder_step()

template<class F , size_t Derivatives, class Real >
int stator::numeric::schroeder_step ( const F &  f,
std::array< Real, Derivatives > &  curr_state,
Real &  x,
Real &  low_bound,
Real &  high_bound,
Real  x_precision 
)
inline

Definition at line 136 of file numeric.hpp.