#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <float.h>
Include dependency graph for pdf.h:
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... |
Definition in file pdf.h.
|
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(). |
|
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(). |
|
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(). |
|
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(). |