Public Member Functions | Public Attributes | List of all members
o2scl::root_bkt< func_t, dfunc_t > Class Template Referenceabstract

One-dimensional bracketing solver [abstract base]. More...

#include <root.h>

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

Public Member Functions

virtual const char * type ()
 Return the type, "root_bkt".
 
virtual int solve_bkt (double &x1, double x2, func_t &func)=0
 Solve func in region $ x_1<x<x_2 $ returning $ x_1 $ .
 
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, dfunc_t &df)
 Solve func using x as an initial guess using derivatives df.
 
- Public Member Functions inherited from o2scl::root< func_t, dfunc_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

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, dfunc_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.
 

Detailed Description

template<class func_t = funct11, class dfunc_t = func_t>
class o2scl::root_bkt< func_t, dfunc_t >

Definition at line 145 of file root.h.

Member Function Documentation

◆ solve()

template<class func_t = funct11, class dfunc_t = func_t>
virtual int o2scl::root_bkt< func_t, dfunc_t >::solve ( double &  x,
func_t &  func 
)
inlinevirtual

This has been updated to automatically bracket functions which are undefined away from the initial guess, but there are still various ways in which the bracketing algorithm can fail.

Idea for Future:
Return early if the bracketing procedure finds a root early?

Implements o2scl::root< func_t, dfunc_t >.

Definition at line 192 of file root.h.

Member Data Documentation

◆ bracket_step

template<class func_t = funct11, class dfunc_t = func_t>
double o2scl::root_bkt< func_t, dfunc_t >::bracket_step

If this is less than or equal to zero, then $ 10^{-4} $, will be used.

Definition at line 164 of file root.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).