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

pdf.h File Reference

Routine collection for estimating probability density functions. More...

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <float.h>

Include dependency graph for pdf.h:

Include dependency graph

Go to the source code of this file.

Compounds

struct  Pdfrec_
 Pdfrec_ : this structure holds the variables for estimating a PDF. More...


Functions

int init_pdf (int Binno, double Binwidth, double Low, double Up, Pdfrec_ *Pdf)
 init_pdf(Binno, Binwidth, Low, Up, Pdf): initialises Pdf to collect data between Low and Up into Binno bins, each Binwidth wide. More...

int add_pdf (double Value, Pdfrec_ *Pdf)
 add_pdf(Value, Pdf): enters the value Value into Pdf. More...

int eval_pdf (Pdfrec_ *Pdf)
 eval_pdf(Pdf): calculates the PDF and puts the estimated values in Pdf->Y[] (a normalisation). More...

void remove_pdf (Pdfrec_ *Pdf)
 remove_pdf(Pdf): frees up the 3 arrays in Pdfrec_ and resets all variables to 0. More...


Detailed Description

Routine collection for estimating probability density functions.

Definition in file pdf.h.


Function Documentation

int init_pdf ( int Binno,
double Binwidth,
double Low,
double Up,
Pdfrec_ * Pdf )
 

init_pdf(Binno, Binwidth, Low, Up, Pdf): initialises Pdf to collect data between Low and Up into Binno bins, each Binwidth wide.

X[] is initialised to uniform sampling but the user can overwrite it after the call to init_pdf(), the only rule being that if i<j then X[i]<=X[j]. If Low>Up, they are silently swapped. In C++ this would be a constructor. Return value: 0 if OK, -1 if some of the parameters were silly, -2 if no more memory could be allocated.

Referenced by Pdfrec_::N().

int add_pdf ( double Value,
Pdfrec_ * Pdf )
 

add_pdf(Value, Pdf): enters the value Value into Pdf.

All bins in Pdf->Yint[] which lie closer to Value than the half of the bin width get incremented by 1 (the "sliding bin" idea by Willie) and the total data count Pdf->N is incremented by 1. Return value: 0 if OK, -1 if Value is too small, 1 if it is too large.

Referenced by Pdfrec_::N().

int eval_pdf ( Pdfrec_ * Pdf )
 

eval_pdf(Pdf): calculates the PDF and puts the estimated values in Pdf->Y[] (a normalisation).

Return value: 0 if OK, -1 if no data were in Pdf.

Referenced by Pdfrec_::N().

void remove_pdf ( Pdfrec_ * Pdf )
 

remove_pdf(Pdf): frees up the 3 arrays in Pdfrec_ and resets all variables to 0.

Does not remove Pdf itself! This would be a C++ destructor.

Referenced by Pdfrec_::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