Main Page   Alphabetical List   Compound List   File List   Compound Members   File Members  

spl.h File Reference

Fit and evaluation of third-order splines. More...

#include <stdio.h>
#include <stdlib.h>
#include <memory.h>

Include dependency graph for spl.h:

Include dependency graph

Go to the source code of this file.

Compounds

struct  Splrec_
 Splrec_ : data structure for spline variables. More...


Functions

int init_spl (long n, Splrec_ *Spl)
 init_spl(n, Spl): initialises a Spl record to hold n>0 data points. More...

int fit_spl (double yp1, double ypn, Splrec_ *Spl)
 fit_spl(yp1, ypn, Spl): fits a cubic spline to a series of data points. More...

double eval_spl (const Splrec_ *Spl, double xi, double *Der1, double *Der2, double *Der3, double *Integ)
 eval_spl(Spl, xi, Der1, Der2, Der3, Integ): evaluates the spline *Spl at point xi. More...

double integ_spl (const Splrec_ *Spl, double Low, double Up)
 integ_spl(Spl, Low, Up): returns the definite integral of the spline Spl between Low and Up or 0.0 if range error.

void remove_spl (Splrec_ *Spl)
 remove_spl(Spl): frees up the arrays associated with Spl. More...


Detailed Description

Fit and evaluation of third-order splines.

Can calculate approximate derivatives up to third order and the definite integral of the approximated function.

Definition in file spl.h.


Function Documentation

int init_spl ( long n,
Splrec_ * Spl )
 

init_spl(n, Spl): initialises a Spl record to hold n>0 data points.

After this call, the user can fill up the arrays Spl.X and Spl.Y as he likes. NOTE: If called with a Spl record that has been used before, call remove_spl() to free up the arrays before calling init_spl(), otherwise memory leaks may occur. Return value: 0 if OK, -1 if n<=0, -2 if there was not enough memory left.

Referenced by Splrec_::N().

int fit_spl ( double yp1,
double ypn,
Splrec_ * Spl )
 

fit_spl(yp1, ypn, Spl): fits a cubic spline to a series of data points.

yp1,ypn: user-supplied first derivatives at the 1st and last points. If they are >1e30 then the second derivatives are assumed to be 0 (natural spline) Spl: is the spline record (assumed to be initialised by a call to init_spl() above and the arrays Spl->X[], Spl->Y[] are filled up by the user). Return value: 0 if OK, <0 if something went wrong.

Referenced by Splrec_::N().

double eval_spl ( const Splrec_ * Spl,
double xi,
double * Der1,
double * Der2,
double * Der3,
double * Integ )
 

eval_spl(Spl, xi, Der1, Der2, Der3, Integ): evaluates the spline *Spl at point xi.

If xi is out of range, it is silently replaced by the respective lower or upper limit. The derivatives are returned in *Der1..*Der3, the definite integral between Spl->X[0] and xi is returned in *Integ if the corresponding pointers are not NULL.

Referenced by Splrec_::N().

double integ_spl ( const Splrec_ * Spl,
double Low,
double Up )
 

integ_spl(Spl, Low, Up): returns the definite integral of the spline Spl between Low and Up or 0.0 if range error.

Referenced by Splrec_::N().

void remove_spl ( Splrec_ * Spl )
 

remove_spl(Spl): frees up the arrays associated with Spl.

Does not remove Spl itself!

Referenced by Splrec_::N().


Generated at Wed Aug 21 09:33:30 2002 for The Razorback C Library: Statistics by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001