Object-oriented Scientific Computing Library: Version 0.910
Data Structures | Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes
deriv< func_t > Class Template Reference

Numerical differentiation base [abstract base]. More...

#include <deriv.h>

Inheritance diagram for deriv< func_t >:
cern_deriv< func_t > eqi_deriv< func_t, vec_t > gsl_deriv< func_t >

Detailed Description

template<class func_t = funct>
class deriv< func_t >

This base class does not perform any actual differentiation. Use one of the children cern_deriv, gsl_deriv, or eqi_deriv instead.

This base class contains some code to automatically apply the first derivative routines to compute second or third derivatives. The error estimates for these will likely be underestimated.

Note:
Because this class template aims to automatically provide second and third derivatives, one must overload either both calc() and calc_int() or both calc_err() and calc_err_int().
Idea for Future:
Improve the methods for second and third derivatives

Definition at line 51 of file deriv.h.

Data Structures

struct  dpars
 A structure for passing the function to second and third derivatives [protected]. More...

Public Member Functions

virtual double calc (double x, func_t &func)
 Calculate the first derivative of func w.r.t. x.
virtual double calc2 (double x, func_t &func)
 Calculate the second derivative of func w.r.t. x.
virtual double calc3 (double x, func_t &func)
 Calculate the third derivative of func w.r.t. x.
virtual double get_err ()
 Get uncertainty of last calculation.
virtual int calc_err (double x, func_t &func, double &dfdx, double &err)=0
 Calculate the first derivative of func w.r.t. x and the uncertainty.
virtual int calc2_err (double x, func_t &func, double &d2fdx2, double &err)
 Calculate the second derivative of func w.r.t. x and the uncertainty.
virtual int calc3_err (double x, func_t &func, double &d3fdx3, double &err)
 Calculate the third derivative of func w.r.t. x and the uncertainty.
virtual const char * type ()
 Return string denoting type ("deriv")

Data Fields

bool err_nonconv
 If true, call the error handler if the routine does not "converge".
int verbose
 Output control.

Protected Member Functions

virtual double calc_int (double x, funct &func)
 Calculate the first derivative of func w.r.t. x.
virtual int calc_err_int (double x, funct &func, double &dfdx, double &err)=0
 Calculate the first derivative of func w.r.t. x and the uncertainty.
double derivfun (double x, dpars &dp)
 The function for the second derivative.
double derivfun2 (double x, dpars &dp)
 The function for the third derivative.

Protected Attributes

bool from_calc
 Avoids infinite loops in case the user calls the base class version.
double derr
 The uncertainity in the most recent derivative computation.

Member Function Documentation

template<class func_t = funct>
virtual double deriv< func_t >::calc ( double  x,
func_t &  func 
) [inline, virtual]

After calling calc(), the error may be obtained from get_err().

Definition at line 92 of file deriv.h.

template<class func_t = funct>
virtual double deriv< func_t >::calc_int ( double  x,
funct func 
) [inline, protected, virtual]

This is an internal version of calc() which is used in computing second and third derivatives

Definition at line 180 of file deriv.h.

template<class func_t = funct>
virtual int deriv< func_t >::calc_err_int ( double  x,
funct func,
double &  dfdx,
double &  err 
) [protected, pure virtual]

This is an internal version of calc_err() which is used in computing second and third derivatives

Implemented in cern_deriv< func_t >, gsl_deriv< func_t >, and gsl_deriv< funct >.


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.