Object-oriented Scientific Computing Library: Version 0.910
Public Member Functions | Data Fields
root< func_t, dfunc_t > Class Template Reference

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

#include <root.h>

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

Detailed Description

template<class func_t = funct, class dfunc_t = func_t>
class root< func_t, dfunc_t >

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

Definition at line 40 of file root.h.

Public Member Functions

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

Data Fields

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 routine does not "converge".
int last_conv
 Zero if last call to solve(), solve_bkt(), or solve_de() converged.
int last_ntrial
 The number of iterations for in the most recent minimization.

Member Function Documentation

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

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 101 of file root.h.


Field Documentation

template<class func_t = funct, class dfunc_t = func_t>
int root< func_t, dfunc_t >::last_conv

This is particularly useful if err_nonconv is false to test if the last call to solve(), solve_bkt(), or solve_de() converged.

Definition at line 82 of file root.h.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

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

Get Object-oriented Scientific Computing
Lib at SourceForge.net. Fast, secure and Free Open Source software
downloads.