cern_root Class Template Reference

#include <cern_root.h>

Inheritance diagram for cern_root:

root< param_t, func_t >

Detailed Description

template<class param_t, class func_t = funct<param_t>>
class cern_root< param_t, func_t >

One-dimensional root-finding routine (CERNLIB).

This class attempts to find $ x_0 $ and $ x_1 $ in $ [a,b] $ such that $ f(x_0) f(x_1) \leq 0 $, $ |f(x_0)| \leq|f(x_1)| $, and $ | x_0-x_1| \leq 2~\mathrm{tolx}~(1+|x_0|) $.

The variable cern_root::tolx defaults to $ 10^{-8} $ and cern_root::ntrial defaults to 200.

solve_bkt() returns 0 for success, gsl_einval if the root is not initially bracketed, and gsl_emaxiter if the number of function evaluations is greater than cern_root::ntrial.

Based on CERNLIB routine DZEROX which is based on Bus75.

Definition at line 57 of file cern_root.h.


Public Member Functions

 cern_root ()
int set_mode (int m)
 Set mode of solution (1 or 2).
virtual const char * type ()
 Return the type, "cern_root".
virtual int solve_bkt (double &x1, double x2, param_t &pa, func_t &func)
 Solve func in region $ x_1<x<x_2 $ returning $ x_1 $.

Protected Member Functions

double sign (double a, double b)
 FORTRAN-like function for sign.

Protected Attributes

int mode
 Internal storage for the mode.

Member Function Documentation

int set_mode ( int  m  )  [inline]

Set mode of solution (1 or 2).

If an integer other than 1 or 2 is specified, 1 is assumed.

Definition at line 107 of file cern_root.h.


Field Documentation

int mode [protected]

Internal storage for the mode.

This internal variable is actually defined to be smaller by 1 than the "mode" as it is defined in the CERNLIB documentation in order to avoid needless subtraction in solve_bkt().

Definition at line 72 of file cern_root.h.


The documentation for this class was generated from the following file:
Documentation generated with Doxygen and provided under the GNU Free Documentation License. See License Information for details.