1 | /* This is EcfInternal.h, the header file for internal functions in |
---|
2 | the 2003 version of the ECF library. */ |
---|
3 | |
---|
4 | #ifndef _GCI_ECF_INTERNAL |
---|
5 | #define _GCI_ECF_INTERNAL |
---|
6 | |
---|
7 | #include "Ecf.h" /* in case there's anything we need from there */ |
---|
8 | |
---|
9 | #define MAXFIT 20 /* The maximum number of parameters we'll ever try |
---|
10 | to fit; saves dynamic allocation of small arrays. |
---|
11 | If this is increased, then the arrays chisq50 etc. |
---|
12 | in ecf.c will need to be extended. The values can |
---|
13 | be calculated by using the test function at the end |
---|
14 | of the file. */ |
---|
15 | |
---|
16 | #define MAXITERS 80 |
---|
17 | #define MAXREFITS 10 |
---|
18 | #define MAXBINS 1024 /* Maximum number of lifetime bins; saves dynamic allocation of small arrays */ |
---|
19 | |
---|
20 | /* Functions from EcfSingle.c */ |
---|
21 | |
---|
22 | int GCI_marquardt_compute_fn(float x[], float y[], int ndata, |
---|
23 | noise_type noise, float sig[], |
---|
24 | float param[], int paramfree[], int nparam, |
---|
25 | void (*fitfunc)(float, float [], float *, float [], int), |
---|
26 | float yfit[], float dy[], |
---|
27 | float **alpha, float beta[], float *chisq, float old_chisq, |
---|
28 | float alambda); |
---|
29 | int GCI_marquardt_compute_fn_instr(float xincr, float y[], int ndata, |
---|
30 | int fit_start, int fit_end, |
---|
31 | float instr[], int ninstr, |
---|
32 | noise_type noise, float sig[], |
---|
33 | float param[], int paramfree[], int nparam, |
---|
34 | void (*fitfunc)(float, float [], float *, float [], int), |
---|
35 | float yfit[], float dy[], |
---|
36 | float **alpha, float beta[], float *chisq, float old_chisq, |
---|
37 | float alambda, |
---|
38 | float **pfnvals, float ***pdy_dparam_pure, float ***pdy_dparam_conv, |
---|
39 | int *pfnvals_len, int *pdy_dparam_nparam_size); |
---|
40 | int GCI_marquardt_compute_fn_final(float x[], float y[], int ndata, |
---|
41 | noise_type noise, float sig[], |
---|
42 | float param[], int paramfree[], int nparam, |
---|
43 | void (*fitfunc)(float, float [], float *, float [], int), |
---|
44 | float yfit[], float dy[], float *chisq); |
---|
45 | int GCI_marquardt_compute_fn_final_instr(float xincr, float y[], int ndata, |
---|
46 | int fit_start, int fit_end, |
---|
47 | float instr[], int ninstr, |
---|
48 | noise_type noise, float sig[], |
---|
49 | float param[], int paramfree[], int nparam, |
---|
50 | void (*fitfunc)(float, float [], float *, float [], int), |
---|
51 | float yfit[], float dy[], float *chisq, |
---|
52 | float **pfnvals, float ***pdy_dparam_pure, float ***pdy_dparam_conv, |
---|
53 | int *pfnvals_len, int *pdy_dparam_nparam_size); |
---|
54 | |
---|
55 | /* Functions from EcfGlobal.c */ |
---|
56 | |
---|
57 | |
---|
58 | /* Functions from EcfUtil.c */ |
---|
59 | |
---|
60 | int GCI_solve(float **a, int, float *b); |
---|
61 | int GCI_invert(float **a, int); |
---|
62 | void GCI_covar_sort(float **covar, int nparam, int paramfree[], int mfit); |
---|
63 | float ***GCI_ecf_matrix_array(long nblocks, long nrows, long ncols); |
---|
64 | void GCI_ecf_free_matrix_array(float ***marr); |
---|
65 | int check_ecf_params (float param[], int nparam, |
---|
66 | void (*fitfunc)(float, float [], float *, float [], int)); |
---|
67 | int check_ecf_user_params (float param[], int nparam, |
---|
68 | void (*fitfunc)(float, float [], float *, float [], int)); |
---|
69 | int GCI_chisq(int nu, float chisq, float *root); |
---|
70 | int multiexp_lambda_array(float xincr, float param[], |
---|
71 | float *y, float **dy_dparam, int nx, int nparam); |
---|
72 | int multiexp_tau_array(float xincr, float param[], |
---|
73 | float *y, float **dy_dparam, int nx, int nparam); |
---|
74 | int stretchedexp_array(float xincr, float param[], |
---|
75 | float *y, float **dy_dparam, int nx, int nparam); |
---|
76 | int ECF_Find_Float_Max (float data[], int np, float *max_val); |
---|
77 | |
---|
78 | /* For debugging printing */ |
---|
79 | extern int ECF_debug; /* defined in EcfUtil.c */ |
---|
80 | int dbgprintf(int dbg_level, const char *format, ...); |
---|
81 | |
---|
82 | // Vars for the export of params at each iteration |
---|
83 | int ecf_exportParams; |
---|
84 | char ecf_exportParams_path[256]; |
---|
85 | |
---|
86 | void ecf_ExportParams_OpenFile (void); |
---|
87 | void ecf_ExportParams_CloseFile (void); |
---|
88 | void ecf_ExportParams (float param[], int nparam, float chisq); |
---|
89 | |
---|
90 | #endif /* _GCI_ECF_INTERNAL */ |
---|
91 | |
---|
92 | |
---|
93 | // Emacs settings: |
---|
94 | // Local variables: |
---|
95 | // mode: c |
---|
96 | // c-basic-offset: 4 |
---|
97 | // tab-width: 4 |
---|
98 | // End: |
---|