Public Member Functions | Public Attributes | Protected Attributes | List of all members
o2scl::root_brent_gsl< func_t > Class Template Reference

One-dimensional root-finding (GSL) More...

#include <root_brent_gsl.h>

Inheritance diagram for o2scl::root_brent_gsl< func_t >:
o2scl::root_bkt< func_t > o2scl::root< func_t, func_t >

Public Member Functions

virtual const char * type ()
 Return the type, "root_brent_gsl".
int iterate (func_t &f)
 Perform an iteration. More...
virtual int solve_bkt (double &x1, double x2, func_t &f)
 Solve func in region $ x_1<x<x_2 $ returning $ x_1 $.
double get_root ()
 Get the most recent value of the root.
double get_lower ()
 Get the lower limit.
double get_upper ()
 Get the upper limit.
int set (func_t &ff, double lower, double upper)
 Set the information for the solver. More...
- Public Member Functions inherited from o2scl::root_bkt< func_t >
virtual int solve (double &x, func_t &func)
 Solve func using x as an initial guess. More...
virtual int solve_de (double &x, func_t &func, func_t &df)
 Solve func using x as an initial guess using derivatives df.
- Public Member Functions inherited from o2scl::root< func_t, func_t >
virtual int print_iter (double x, double y, int iter, double value=0.0, double limit=0.0, std::string comment="")
 Print out iteration information. More...

Public Attributes

int test_form
 The type of convergence test applied: 0, 1, or 2 (default 0)
- Public Attributes inherited from o2scl::root_bkt< func_t >
double bracket_step
 The relative stepsize for automatic bracketing (default value is zero) More...
double bracket_min
 The minimum stepsize for automatic bracketing (default zero)
size_t bracket_iters
 The number of iterations in attempt to bracket root (default 10)
- Public Attributes inherited from o2scl::root< func_t, func_t >
double tol_rel
 The maximum value of the functions for success (default $ 10^{-8} $ )
double tol_abs
 The minimum allowable stepsize (default $ 10^{-12} $ )
int verbose
 Output control (default 0)
int ntrial
 Maximum number of iterations (default 100)
bool err_nonconv
 If true, call the error handler if the solver does not converge (default true)
int last_ntrial
 The number of iterations used in the most recent solve.

Protected Attributes

double root
 The present solution estimate.
double x_lower
 The present lower limit.
double x_upper
 The present upper limit.
Storage for solver state
double a
double b
double c
double d
double e
double fa
double fb
double fc

Detailed Description

template<class func_t = funct11>
class o2scl::root_brent_gsl< func_t >

This class finds the root of a user-specified function. If test_form is 0, 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 Function object example .

Idea for Future:
There is some duplication in the variables x_lower, x_upper, a, and b, which could be removed. Some better variable names would also be helpful.
Idea for Future:
Create a meaningful enum list for o2scl::root_brent_gsl::test_form.

Definition at line 92 of file root_brent_gsl.h.

Member Function Documentation

◆ iterate()

template<class func_t = funct11>
int o2scl::root_brent_gsl< func_t >::iterate ( func_t &  f)

This function currently always returns success.

Definition at line 108 of file root_brent_gsl.h.

◆ set()

template<class func_t = funct11>
int o2scl::root_brent_gsl< func_t >::set ( func_t &  ff,
double  lower,
double  upper 

This function currently always returns success.

Definition at line 338 of file root_brent_gsl.h.

The documentation for this class was generated from the following file:

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).