10 #define FMAX(a,b) (maxarg1=(a),maxarg2=(b),(maxarg1)>(maxarg2)?(maxarg1):(maxarg2))
11 #define SIGN(a,b) ((b)>0.0?fabs(a):-fabs(a))
14 extern void nrerror(char error_txt[]);
15 extern float* vector(long nl, long nh);
16 extern void free_vector(float* v, long nl, long nh);
17 extern int* ivector(long nl, long nh);
18 extern void free_ivector(int* v, long nl, long nh);
19 extern void nrerror(char error_txt[]);
20 extern float** matrix(long nrl, long nrh, long ncl, long nch);
21 extern void free_matrix(float** m, long nrl, long nrh, long ncl, long nch);
24 extern void gaussj(float **a, int n, float **b, int m);
26 /* 2.3.c LU Decomposition and Its Applications */
27 extern void ludcmp(float** a, int n, int* indx, float* d);
28 extern void lubksb(float** a, int n, int* indx, float b[]);
32 extern float gammln(float xx);
35 extern float gammp(float a, float x);
36 extern float gammq(float a, float x);
37 extern void gser(float* gamser, float a, float x, float* gln);
38 extern void gcf (float* gammcf, float a, float x, float* gln);
39 extern float erff(float x);
40 extern float erffc(float x);
43 extern float betai(float a, float b, float x);
44 extern float betacf(float a, float b, float x);
48 extern void sort(unsigned long n, float arr[]);
51 extern float select(unsigned long k, unsigned long n, float arr[]);
53 extern float nrselect(unsigned long k, unsigned long n, float arr[]);
57 extern void jacobi(float** a, int n, float d[], float** v, int* nrot);
58 extern void eigsrt(float d[], float** v, int n);
60 /* 13.10.c Wavelet Transforms */
61 extern void wt1(float a[], unsigned long n, int isign, void (*wtstep)(float[], unsigned long, int));
62 extern void daub4(float a[], unsigned long n, int isign);
63 extern void pwtset(int n);
64 extern void pwt(float a[], unsigned long n, int isign);
65 extern void wtn(float a[], unsigned long nn[], int ndim, int isign, void (*wtstep)(float[], unsigned long, int));
68 extern void mnbrak(float* ax, float *bx, float* cx, float* fa, float* fb, float* fc, float (*func)(float));
71 extern float brent(float ax, float bx, float cx, float (*f)(float), float tol, float* xmin);
74 extern void linmin(float p[], float xi[], int n, float *fret, float (*func)(float[]));
76 /* 10.6.c ConjugateGradientMethods */
78 void frprmn() Polak-Ribiere
79 void frprmn2() Fletcher-Reeeves
81 extern void frprmn(float p[], int n, float ftol, int *iter, float* fret,
82 float (*func)(float[]), void (*dfunc)(float[], float []));
83 extern void frprmn2(float p[], int n, float ftol, int *iter, float* fret,
84 float (*func)(float[]), void (*dfunc)(float[], float []));
86 extern void fit(float x[], float y[], int ndata, float sig[], int mwt, float* a, float* b, float* siga, float* sigb, float* chi2, float* q);
89 extern void mrqmin(float x[], float y[], float sig[], int n, float a[], int ia[], int ma, float** covar, float** alpha, float* chisq, void (*func)(float x, float p[], float* y, float dyda[], int na), float *alamda);
92 extern void medfit(float x[], float y[], int ndata, float* a, float* b, float* abdev);
93 extern float rofunc(float b);