Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

RazorBack::Spl_ Class Reference

Class Spl_ : implements third-order splines. More...

#include <Spl.hh>

Inheritance diagram for RazorBack::Spl_:

Inheritance graph
[legend]
Collaboration diagram for RazorBack::Spl_:

Collaboration graph
[legend]
List of all members.

Public Methods

 Spl_ (unsigned int N=2)
 Inits to work on N data points (default 2).

unsigned int len () const
 Returns the current length of the data vectors.

unsigned int len (unsigned int L)
 Sets the data vector length to L. More...

void reset ()
 Zeroes all data vectors and prepares for a new fit.

void add (unsigned int Idx, double x, double y)
 add(Idx, x, y): adds a pair of independent (x) and dependent (y) variable points to the Idx-th [0..len()-1] position of the calling object. More...

void fit_spl (double yp1, bool Nat1, double ypn, bool Natn)
 fit_spl(yp1, Nat1, ypn, Natn): fits a cubic spline to a series of data points already stored in the calling object. More...

double eval_spl (double xi, double *Der1=NULL, double *Der2=NULL, double *Der3=NULL, double *Integ=NULL) const
 eval_spl(xi, Der1, Der2, Der3, Integ): evaluates a spline at a point xi. More...

double integ_spl (double Low, double Up) const
 integ_spl(Low, Up): returns the definite integral of the spline Spl between Low and Up. More...


Private Methods

bool check_data ()
double int_0x (double xi) const
double smallest_interval (double xi, unsigned int &kl, unsigned int &kh) const

Detailed Description

Class Spl_ : implements third-order splines.

Can be queried for interpolated values, 1st..3rd derivatives and integrals.

Definition at line 114 of file Spl.hh.


Constructor & Destructor Documentation

RazorBack::Spl_::Spl_ ( unsigned int N = 2 ) [inline, explicit]
 

Inits to work on N data points (default 2).

Definition at line 121 of file Spl.hh.


Member Function Documentation

unsigned int RazorBack::Spl_::len ( ) const [inline]
 

Returns the current length of the data vectors.

Definition at line 125 of file Spl.hh.

unsigned int RazorBack::Spl_::len ( unsigned int L )
 

Sets the data vector length to L.

Does nothing if L==0 or if L==len(). Returns the old length.

void RazorBack::Spl_::reset ( ) [inline]
 

Zeroes all data vectors and prepares for a new fit.

Definition at line 135 of file Spl.hh.

void RazorBack::Spl_::add ( unsigned int Idx,
double x,
double y )
 

add(Idx, x, y): adds a pair of independent (x) and dependent (y) variable points to the Idx-th [0..len()-1] position of the calling object.

Indexrangexc_ will be thrown if Idx is illegal. Use this method to "fill" up the spline object before fitting.

void RazorBack::Spl_::fit_spl ( double yp1,
bool Nat1,
double ypn,
bool Natn )
 

fit_spl(yp1, Nat1, ypn, Natn): fits a cubic spline to a series of data points already stored in the calling object.

Does not do anything if the fit has already been done. Throws Emptyexc if the calling object was empty. Throws Generalexc_ if there were duplicate data points. yp1: user-supplied first derivative at the 1st point. If Nat1 is true, then the value of yp1 is ignored and instead a zero 2nd derivative is assumed (natural spline). ypn, Natn: the same for the last point.

double RazorBack::Spl_::eval_spl ( double xi,
double * Der1 = NULL,
double * Der2 = NULL,
double * Der3 = NULL,
double * Integ = NULL ) const
 

eval_spl(xi, Der1, Der2, Der3, Integ): evaluates a spline at a point xi.

If xi is out of range then 0.0 is returned. Otherwise the return value is y(xi). Adapted from Numerical Recipes. The derivatives and the integral are returned only if they are not NULL: this way, the user can calc any combination of the first three derivatives and the integral. xi: interpolation point Der1..3: 1st..3rd derivative of y at xi Integ: definite integral of y(x) between X[0] and xi. The derivative and integral ptrs are NULL by default. Prints a warning and returns 0.0 if the values were modified. Throws Emptyexc_ if the calling object was empty. Throws Argexc_ if xi was out of range.

double RazorBack::Spl_::integ_spl ( double Low,
double Up ) const
 

integ_spl(Low, Up): returns the definite integral of the spline Spl between Low and Up.

Prints a warning and returns 0.0 if spl_fit() was not invoked before calling this method. Throws Argexc_ if Low or Up are out of the fitted interval.

bool RazorBack::Spl_::check_data ( ) [private]
 

double RazorBack::Spl_::int_0x ( double xi ) const [private]
 

double RazorBack::Spl_::smallest_interval ( double xi,
unsigned int & kl,
unsigned int & kh ) const [private]
 


The documentation for this class was generated from the following file:
Generated at Wed Aug 21 09:33:19 2002 for The Razorback C++ Library: Statistics by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001