Class root_brent_gsl (o2scl)¶
-
template<class func_t = funct, class fp_t = double>
class root_brent_gsl : public o2scl::root_bkt<funct, funct, double>¶ One-dimensional root-finding (GSL)
This class finds the root of a user-specified function. If test_form is 0 (the default), then solve_bkt() stops when the size of the bracket is smaller than root::tol_abs. If test_form is 1, then the function stops when the residual is less than root::tol_rel. If test_form is 2, then both tests are applied.
See the One-dimensional solvers section of the User’s guide for general information about O2scl solvers. An example demonstrating the usage of this class is given in
examples/ex_fptr.cpp
and the First function object example.Todo
class root_brent_gsl
Future:
There is some duplication in the variables c x_lower,
c x_upper, c a, and c b, which could be removed. Some better variable names would also be helpful. - Create a meaningful enum list for ref o2scl::root_brent_gsl::test_form. - There is code duplication between the test_interval here and in root_toms748.
Public Functions
-
inline root_brent_gsl()¶
-
inline virtual const char *type()¶
Return the type,
"root_brent_gsl"
.
-
inline int iterate(func_t &f)¶
Perform an iteration.
This function currently always returns success.
-
template<typename func2_t, class fp2_t>
inline int iterate_multip(func2_t &f, double func_tol, fp2_t storage[11])¶ Perform an iteration (adaptive multiprecision version)
-
inline virtual int solve_bkt(fp_t &x1, fp_t x2, func_t &f)¶
Solve
func
in region \( x_1<x<x_2 \) returning \( x_1 \).
-
template<typename func2_t, class fp2_t>
inline int solve_bkt_multip(fp2_t &x1, fp2_t x2, func2_t &&f, fp2_t &err, double tol_loc = -1.0)¶ Solve
func
in region \( x_1<x<x_2 \) returning \( x_1 \) (adaptive multiprecision version)
Public Members
-
double pow_tol_func¶
Power for tolerance of function evaluations with adaptive multiprecision (default 1.33)
-
bool store_funcs¶
If true, store function evaluations.
-
int test_form¶
The type of convergence test applied: 0, 1, or 2 (default 0)