Debian Codegraph @

easel/esl_hyperexp.h

raw symbols SCIP
1 /* Hyperexponential (mixture exponential) distributions.
2 */
3 #ifndef eslHYPEREXP_INCLUDED
4 #define eslHYPEREXP_INCLUDED
5 #include <esl_config.h>
6
7 #include "esl_fileparser.h"
8 #include "esl_histogram.h"
9 #include "esl_random.h"
10
11 typedef struct {
12 double *q; /* mixture coefficients [0..K-1]*/
13 double *lambda; /* scale params [0..K-1]*/
14 double *wrk; /* tmp K-vector, for logpdf calc */
15 double mu; /* location (x offset) parameter */
16 int K; /* # of components */
17 char *fixlambda; /* TRUE to constrain a lambda val */
18 int fixmix; /* TRUE to constrain the q's */
19 } ESL_HYPEREXP;
20
21
22 extern ESL_HYPEREXP *esl_hyperexp_Create(int K);
23 extern void esl_hyperexp_Destroy(ESL_HYPEREXP *h);
24 extern int esl_hyperexp_Copy(ESL_HYPEREXP *src, ESL_HYPEREXP *dest);
25 extern int esl_hyperexp_FixedUniformMixture(ESL_HYPEREXP *h);
26 extern int esl_hyperexp_SortComponents(ESL_HYPEREXP *h);
27 extern int esl_hyperexp_Write(FILE *fp, ESL_HYPEREXP *hxp);
28 extern int esl_hyperexp_Dump(FILE *fp, ESL_HYPEREXP *hxp);
29
30 extern int esl_hyperexp_Read(ESL_FILEPARSER *ef, ESL_HYPEREXP **ret_hxp);
31 extern int esl_hyperexp_ReadFile(char *filename, ESL_HYPEREXP **ret_hxp);
32
33
34 extern double esl_hxp_pdf (double x, ESL_HYPEREXP *h);
35 extern double esl_hxp_logpdf (double x, ESL_HYPEREXP *h);
36 extern double esl_hxp_cdf (double x, ESL_HYPEREXP *h);
37 extern double esl_hxp_logcdf (double x, ESL_HYPEREXP *h);
38 extern double esl_hxp_surv (double x, ESL_HYPEREXP *h);
39 extern double esl_hxp_logsurv(double x, ESL_HYPEREXP *h);
40 extern double esl_hxp_invcdf (double p, ESL_HYPEREXP *h);
41
42 extern double esl_hxp_generic_pdf (double x, void *params);
43 extern double esl_hxp_generic_cdf (double x, void *params);
44 extern double esl_hxp_generic_surv (double x, void *params);
45 extern double esl_hxp_generic_invcdf(double x, void *params);
46
47 extern int esl_hxp_Plot(FILE *fp, ESL_HYPEREXP *h,
48 double (*func)(double x, ESL_HYPEREXP *h),
49 double xmin, double xmax, double xstep);
50
51
52 extern double esl_hxp_Sample(ESL_RANDOMNESS *r, ESL_HYPEREXP *h);
53
54 extern int esl_hxp_FitGuess (double *x, int n, ESL_HYPEREXP *h);
55 extern int esl_hxp_FitComplete(double *x, int n, ESL_HYPEREXP *h);
56
57 extern int esl_hxp_FitGuessBinned (ESL_HISTOGRAM *g, ESL_HYPEREXP *h);
58 extern int esl_hxp_FitCompleteBinned(ESL_HISTOGRAM *g, ESL_HYPEREXP *h);
59
60
61 #endif /*eslHYPEREXP_INCLUDED*/
62