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

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

#include <root.h>

Detailed Description

template<class func_t = funct, class dfunc_t = func_t, class fp_t = double>
class o2scl::root< func_t, dfunc_t, fp_t >

See the One-dimensional solvers section of the User's guide for general information about O2scl solvers.

Idea for Future:
Maybe consider allowing the user to specify the stream to which 'verbose' information is sent.

Definition at line 48 of file root.h.

Public Member Functions

virtual const char * type ()
 Return the type, "root".
 
virtual int print_iter (fp_t x, fp_t y, int iter, fp_t value=0.0, fp_t limit=0.0, std::string comment="")
 Print out iteration information. More...
 
virtual int solve (fp_t &x, func_t &func)=0
 Solve func using x as an initial guess.
 
virtual int solve_bkt (fp_t &x1, fp_t x2, func_t &func)
 Solve func in region $ x_1<x<x_2 $
returning $ x_1 $ .
 
virtual int solve_de (fp_t &x, func_t &func, dfunc_t &df)
 Solve func using x as an initial guess using derivatives df.
 

Public Attributes

fp_t tol_rel
 The maximum value of the functions for success (default $ 10^{-8} $ )
 
fp_t 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.
 

Member Function Documentation

◆ print_iter()

template<class func_t = funct, class dfunc_t = func_t, class fp_t = double>
virtual int o2scl::root< func_t, dfunc_t, fp_t >::print_iter ( fp_t  x,
fp_t  y,
int  iter,
fp_t  value = 0.0,
fp_t  limit = 0.0,
std::string  comment = "" 
)
inlinevirtual

Depending on the value of the variable verbose, this prints out the iteration information. If verbose=0, then no information is printed, while if verbose>1, then after each iteration, the present values of x and y are output to std::cout along with the iteration number. If verbose>=2 then each iteration waits for a character before continuing.

Definition at line 100 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).