User Documentation
Centre for Vision, Speech & Signal Processing
DEVELOP IN NAMESPACE AMMA TREE ROOT AMMA SEARCH AMMA HOME
 

  PUBLIC
GNumIntegC::GNumIntegC(void)
GNumIntegC::GNumIntegC(T &,double,double,int)
GNumIntegC::GNumIntegC(const GNumIntegC &)
GNumIntegC::operator=(const GNumIntegC &)
GNumIntegC::~GNumIntegC(void)
GNumIntegC::SetMaxDiff(double)
GNumIntegC::Step(DerivFuncT,double)
GNumIntegC::QC_Step(DerivFuncT,double,double &,double &)
GNumIntegC::QC_Step(DerivFuncT)
GNumIntegC::operator=(const GNumIntegC &)
GNumIntegC::Step(ScopePath (*)(FuncArgList),double)
GNumIntegC::QC_Step(ScopePath (*)(FuncArgList))
GNumIntegC::QC_Step(ScopePath (*)(FuncArgList),double,double &,double &)
GNumIntegC<class T>
 
Numerical intergration
 
include "amma/GNumInteg.hh"
User Level:Default
Library:diffeq
Example:exEndPoint.cc
Section:default.Andrew Stoddart
In Scope:std

Comments:
GNumIntegC is a numerical integration routine which solves dq -- = f(q) = - GRAD E dt It uses Eulers method, i.e. q(t+h)=q(t) + h*f(q) There is quality controlled stepsize selector so that the error on any step does not exceed maxerror as specified in the constructor. The derivative is supplied by a class derived from BaseDerivC. The error is defined as max abs[ q(t+h+h) - q(t+2h) ]. ------------------------------------------------------------------------- The intention is to use this routine as follows: GNumIntegC ni(q, 0.001, 1.0, 1); ni.Step(testderiv,h); and for the final result to still be in q. For this reason q must be a refence counted class so that q is a handle. In this way the result will be stored in q after integration. To ensure that this is the case always q.Assign(q1) inside GNumIntegC, never q=q1 to update the state variable. This means that the routine DOESNT WORK for plain variables SMALL OBJECTS. ------------------------------------------------------------------------- In order to use this function type T must have T operator+(const T & v); T operator*(const double & d); double MaxDiff(const T & v); T Copy(void); ------------------------------------------------------------------------- -------------------------------------------------------------------------

Typedefs:
typedef ScopePath (*)(FuncArgList) DerivFuncT;

Variables:
Methods:
GNumIntegC()
Constructor, integration not possible from this constructor

GNumIntegC(T & q_in,double maxerror_in,double hn = 1.0,int it = 0)
Constructor A reference to the state vector q is kept in the class. Copies of the state vector are made for internal usage. The max_error is the maximum allowable error as computed by Diff a member function of q. It is absolute not relative. hn is the first guess at a step size. it switches (it=1) on and (it=0) off the print out.

GNumIntegC(const GNumIntegC<T> & ni)
Copy constructor

GNumIntegC & operator=(const GNumIntegC<T> & ni)

~GNumIntegC()
Destructor Set parameters --------------

void SetMaxDiff(double max)
Reset the value of maxdiff General operations ------------------

void Step(DerivFuncT deriv,double h)
step forward by h

double QC_Step(DerivFuncT deriv,double htry,double & hdid,double & xhnext)
Make a quality controlled step forward, i.e. a step for which the error cannot exceed maxerror. The error is returned. Try htry first, reset hdid and hnext on exit, hnext is a good guess for the next step, hdid is the actual step taken.

double QC_Step(DerivFuncT deriv)
Make a quality controlled step forward, i.e. a step for which the error cannot exceed maxerror. The error is returned. Uses hnext stored internally, and set to 1.0 by default on construction

GNumIntegC<T> & operator=(const GNumIntegC & ni)
-------------------------------------------------------------------------

void Step(ScopePath (*)(FuncArgList) deriv,double h)
------------------------------------------------------------------------- -------------------------------------------------------------------------

double QC_Step(ScopePath (*)(FuncArgList) deriv)
------------------------------------------------------------------------- ------------------------------------------------------------------------- A quality controlled Euler stepping method based on an algorithm presented in Num Recipes in C

double QC_Step(ScopePath (*)(FuncArgList) deriv,double htry,double & hdid,double & xhnext)
------------------------------------------------------------------------- End of include file GNumInteg.hh -------------------------------------------------------------------------


Programmer:Andrew Stoddart, Documentation by CxxDoc: Tue Mar 20 10:48:08 2001