/* pa.h Header file for definitions of functions used in the computation of piece-wise analytic fits based on sample data. Ramses van Zon, December 5, 2009 Reference: [] Ramses van Zon and Jeremy Schofield, "Constructing smooth potentials of mean force, radial distribution functions and probability densities from sampled data", arxiv.0912.0465 [cond-mat.stat-mech]. */ #ifndef _PAH_ #define _PAH_ #include /* structure to hold the information on a piece-wise analytic fit. */ struct Pafit { int k; double *a; double *b; double *c; double **d; double *f; double *g; }; /* perform a weighted resampling of data. */ double pabias( int n, const double *r, double (*w)(double), void *s, double *x ); /* perform a weighted resampling of data for use with a jackknife. */ double pajbias( int j, int m, int n, const double *r, double (*w)(double), void *s, double*x ); /* perform a resampling of data for use with a bootstrap estimator. */ void paboot( int n, const double *r, void *s, double *x ); /* perform a simple block-jackknife. */ void pajack( int j, int m, int n, const double *r, double *x ); /* perform a resampling of data for use with a block-jackknife. */ void pajackboot( int j, int m, int n, const double *r, void *s, double *x ); /* allocate memory for the arrays used by pafit. */ struct Pafit* paalloc( int km, int mm ); /* release the memory allocated by paalloc. */ void pafree( struct Pafit *pa ); /* computes the parameters of the piecewise analytic fit to a probability distribution from data. */ double pafit( int n, const double *r, double qm, int km, int mm, int nodiscont, struct Pafit *pa ); /* evaluate the piecewise analytic probability distribution at a */ double papd( double r, struct Pafit *pa ); /* evaluate the piecewise analytic cumulative distribution. */ double pacd( double r, struct Pafit *pa ); /* write the fit parameters found by pafit to a file. */ void pawrite( FILE *file, struct Pafit *pa ); /* sorting routine for an array of doubles */ void pasort( int n, double *x ); /* read a binary data file of a specific format into an array. */ double* readbinfile( const char *s, double *y1, double *y2, int *m, int *n ); #endif