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