TRIQS/triqs_modest 3.3.0
Brillouin zone summation
Loading...
Searching...
No Matches
Root finders

Detailed Description

Generic root finder methods for finding the roots of a scalar function \(f(x)\).

Functions

std::pair< double, double > triqs::bisection (std::function< double(double)> f, double x_low, double x_high, double y_target, double precision, long max_loops, std::string x_name, std::string y_name, bool verbosity)
 bisection algorithm
 
std::pair< double, double > triqs::dichotomy (std::function< double(double)> f, double x_low, double x_high, double y_target, double precision, long max_loops, std::string x_name, std::string y_name, bool verbosity)
 dichotomy algorithm
 
std::pair< double, double > triqs::find_bounds (std::function< double(double)> f, double x_init, double y_value, double delta_x, double precision, long max_loops=1000, bool verbosity=false)
 find upper and lower bounds of f(x)
 

Function Documentation

◆ bisection()

std::pair< double, double > triqs::bisection ( std::function< double(double)>  f,
double  x_low,
double  x_high,
double  y_target,
double  precision,
long  max_loops,
std::string  x_name,
std::string  y_name,
bool  verbosity 
)
inline

#include <triqs_modest/root_finder.hpp>

bisection algorithm

Parameters
ffunction f(x)
x_lowlower bound on f(x)
x_highupper bound on f(x)
y_targettarget value for f(x) = y_target
precisionf(x) - y_target < precision
max_loopsmaximum number of attempts
x_nameName of x variable
y_nameName of y variable
verbosityPrint progress
Returns
x, f(x) where f(x) = y_target

Definition at line 127 of file root_finder.hpp.

◆ dichotomy()

std::pair< double, double > triqs::dichotomy ( std::function< double(double)>  f,
double  x_low,
double  x_high,
double  y_target,
double  precision,
long  max_loops,
std::string  x_name,
std::string  y_name,
bool  verbosity 
)
inline

#include <triqs_modest/root_finder.hpp>

dichotomy algorithm

Parameters
ffunction f(x)
x_lowlower bound on x
x_highupper bound on x
y_targettarget value for f(x)
precisionf(x) - y_target < precision
max_loopsmaxmimum number of iterations
x_nameName of x variable
y_nameName of y variable
verbosityPrint progress
Returns
x, f(x) where f(x) = y_target

Definition at line 70 of file root_finder.hpp.

◆ find_bounds()

std::pair< double, double > triqs::find_bounds ( std::function< double(double)>  f,
double  x_init,
double  y_value,
double  delta_x,
double  precision,
long  max_loops = 1000,
bool  verbosity = false 
)
inline

#include <triqs_modest/root_finder.hpp>

find upper and lower bounds of f(x)

Parameters
ffunction of f(x)
x_initinitial guess x
y_valuetarget value y = f(x)
delta_xx increment
precisionf(x) - y_value < precision
max_loopsmaximum number of loops
verbosityverbosity of the algorithm
Returns
x1, x2 where f(x1) and f(x2) bound y_value

Definition at line 26 of file root_finder.hpp.