1 | /* Tracy-2 |
---|
2 | |
---|
3 | J. Bengtsson, CBP, LBL 1990 - 1994 Pascal version |
---|
4 | SLS, PSI 1995 - 1997 |
---|
5 | M. Boege SLS, PSI 1998 C translation |
---|
6 | L. Nadolski SOLEIL 2002 Link to NAFF, Radia field maps |
---|
7 | J. Bengtsson NSLS-II, BNL 2004 - |
---|
8 | |
---|
9 | */ |
---|
10 | |
---|
11 | |
---|
12 | extern "C" { |
---|
13 | // Interface to Numerical Recipes. |
---|
14 | |
---|
15 | // nrutil.h |
---|
16 | |
---|
17 | static float sqrarg __attribute__((unused)); |
---|
18 | #define SQR(a) ((sqrarg=(a)) == 0.0 ? 0.0 : sqrarg*sqrarg) |
---|
19 | |
---|
20 | static double dsqrarg __attribute__((unused)); |
---|
21 | #define DSQR(a) ((dsqrarg=(a)) == 0.0 ? 0.0 : dsqrarg*dsqrarg) |
---|
22 | |
---|
23 | static double dmaxarg1 __attribute__((unused)); |
---|
24 | static double dmaxarg2 __attribute__((unused)); |
---|
25 | #define DMAX(a,b) (dmaxarg1=(a),dmaxarg2=(b),(dmaxarg1) > (dmaxarg2) ?\ |
---|
26 | (dmaxarg1) : (dmaxarg2)) |
---|
27 | |
---|
28 | static double dminarg1 __attribute__((unused)); |
---|
29 | static double dminarg2 __attribute__((unused)); |
---|
30 | #define DMIN(a,b) (dminarg1=(a),dminarg2=(b),(dminarg1) < (dminarg2) ?\ |
---|
31 | (dminarg1) : (dminarg2)) |
---|
32 | |
---|
33 | static float maxarg1 __attribute__((unused)); |
---|
34 | static double maxarg2 __attribute__((unused)); |
---|
35 | #define FMAX(a,b) (maxarg1=(a),maxarg2=(b),(maxarg1) > (maxarg2) ?\ |
---|
36 | (maxarg1) : (maxarg2)) |
---|
37 | |
---|
38 | static float minarg1 __attribute__((unused)); |
---|
39 | static double minarg2 __attribute__((unused)); |
---|
40 | #define FMIN(a,b) (minarg1=(a),minarg2=(b),(minarg1) < (minarg2) ?\ |
---|
41 | (minarg1) : (minarg2)) |
---|
42 | |
---|
43 | static long lmaxarg1 __attribute__((unused)); |
---|
44 | static double lmaxarg2 __attribute__((unused)); |
---|
45 | #define LMAX(a,b) (lmaxarg1=(a),lmaxarg2=(b),(lmaxarg1) > (lmaxarg2) ?\ |
---|
46 | (lmaxarg1) : (lmaxarg2)) |
---|
47 | |
---|
48 | static long lminarg1 __attribute__((unused)); |
---|
49 | static double lminarg2 __attribute__((unused)); |
---|
50 | #define LMIN(a,b) (lminarg1=(a),lminarg2=(b),(lminarg1) < (lminarg2) ?\ |
---|
51 | (lminarg1) : (lminarg2)) |
---|
52 | |
---|
53 | static int imaxarg1 __attribute__((unused)); |
---|
54 | static double imaxarg2 __attribute__((unused)); |
---|
55 | #define IMAX(a,b) (imaxarg1=(a),imaxarg2=(b),(imaxarg1) > (imaxarg2) ?\ |
---|
56 | (imaxarg1) : (imaxarg2)) |
---|
57 | |
---|
58 | static int iminarg1 __attribute__((unused)); |
---|
59 | static double iminarg2 __attribute__((unused)); |
---|
60 | #define IMIN(a,b) (iminarg1=(a),iminarg2=(b),(iminarg1) < (iminarg2) ?\ |
---|
61 | (iminarg1) : (iminarg2)) |
---|
62 | |
---|
63 | #define SIGN(a,b) ((b) >= 0.0 ? fabs(a) : -fabs(a)) |
---|
64 | |
---|
65 | void nrerror(const char error_text[]); |
---|
66 | float *vector(long nl, long nh); |
---|
67 | int *ivector(long nl, long nh); |
---|
68 | unsigned char *cvector(long nl, long nh); |
---|
69 | unsigned long *lvector(long nl, long nh); |
---|
70 | double *dvector(long nl, long nh); |
---|
71 | float **matrix(long nrl, long nrh, long ncl, long nch); |
---|
72 | double **dmatrix(long nrl, long nrh, long ncl, long nch); |
---|
73 | int **imatrix(long nrl, long nrh, long ncl, long nch); |
---|
74 | float **submatrix(float **a, long oldrl, long oldrh, long oldcl, long oldch, |
---|
75 | long newrl, long newcl); |
---|
76 | float **convert_matrix(float *a, long nrl, long nrh, long ncl, long nch); |
---|
77 | float ***f3tensor(long nrl, long nrh, long ncl, long nch, |
---|
78 | long ndl, long ndh); |
---|
79 | void free_vector(float *v, long nl, long nh); |
---|
80 | void free_ivector(int *v, long nl, long nh); |
---|
81 | void free_cvector(unsigned char *v, long nl, long nh); |
---|
82 | void free_lvector(unsigned long *v, long nl, long nh); |
---|
83 | void free_dvector(double *v, long nl, long nh); |
---|
84 | void free_matrix(float **m, long nrl, long nrh, long ncl, long nch); |
---|
85 | void free_dmatrix(double **m, long nrl, long nrh, long ncl, long nch); |
---|
86 | void free_imatrix(int **m, long nrl, long nrh, long ncl, long nch); |
---|
87 | void free_submatrix(float **b, long nrl, long nrh, long ncl, long nch); |
---|
88 | void free_convert_matrix(float **b, long nrl, long nrh, long ncl, long nch); |
---|
89 | void free_f3tensor(float ***t, long nrl, long nrh, long ncl, long nch, |
---|
90 | long ndl, long ndh); |
---|
91 | |
---|
92 | void dmmult( double **a, int a_rows, int a_cols, |
---|
93 | double **b, int b_rows, int b_cols, double **y); |
---|
94 | void dmvmult( double **a, int a_rows, int a_cols, double *b, int b_els, |
---|
95 | double *y); |
---|
96 | void dmadd( double **a, int a_rows, int a_cols, double **b, double **y); |
---|
97 | void dmsub( double **a, int a_rows, int a_cols, double **b, double **y); |
---|
98 | void dmsmy( double **a, int a_rows, int a_cols, double r, double **y); |
---|
99 | void dmtranspose( double **a, int a_rows, int a_cols, double **y); |
---|
100 | void dmfillUT( double **a, int a_rows, int a_cols); |
---|
101 | |
---|
102 | void dmdump( FILE *outf, char *text, double **a, int a_rows, int a_cols, |
---|
103 | char *format); |
---|
104 | void dvdump( FILE *outf, char *text, double *a, int a_els, char *format); |
---|
105 | void dvadd( double *a, int a_els, double *b, double *y); |
---|
106 | void dvsub( double *a, int a_els, double *b, double *y); |
---|
107 | double dvdot( double *a, int a_els, double *b); |
---|
108 | double dvmag( double *a, int a_els); |
---|
109 | double dvmnorm( double *a, int a_els); |
---|
110 | void dvsmy( double *a, int a_els, double r, double *y); |
---|
111 | void dvpiv( double *a, int a_els, double r, double *b, double *y); |
---|
112 | void dReadMatrix(FILE *datafile, double **y, int *rows, int *cols, |
---|
113 | int *error); |
---|
114 | void dReadVector(FILE *datafile, double *y, int *els, int *error); |
---|
115 | double dReadScalar(FILE *datafile, int *error); |
---|
116 | void dWriteMatrix( FILE *outf, char *text, double **a, int a_rows, |
---|
117 | int a_cols, char *format); |
---|
118 | void dWriteVector( FILE *outf, char *text, double *a, int a_els, |
---|
119 | char *format); |
---|
120 | void dWriteScalar( FILE *outf, char *text, double a, char *format); |
---|
121 | |
---|
122 | /* copy a matrix */ |
---|
123 | void dmcopy( double **a, int a_rows, int a_cols, double **b); |
---|
124 | /* copy a vector */ |
---|
125 | void dvcopy( double *a, int a_els, double *b); |
---|
126 | /* compare two vectors */ |
---|
127 | double dvcomp( double *a, int a_els, double *b); |
---|
128 | /* get a column from a matrix */ |
---|
129 | void dgetcolumn(double **G, int col, double *v, int nels); |
---|
130 | /* put a column into a matrix */ |
---|
131 | void dputcolumn(double *v, int nels, double **G, int col); |
---|
132 | |
---|
133 | void dinverse( double **a, int n, double **y ); |
---|
134 | void dinverse_mult( double **a, int a_rows, double **b, int b_cols, |
---|
135 | double **y ); |
---|
136 | void dPDSinverse( double **a, int n, double **y ); |
---|
137 | void dPDS_L_inverse( double **a, int n, double **y ); |
---|
138 | |
---|
139 | // nr.h |
---|
140 | |
---|
141 | #ifndef _FCOMPLEX_DECLARE_T_ |
---|
142 | typedef struct FCOMPLEX {float r,i;} fcomplex; |
---|
143 | #define _FCOMPLEX_DECLARE_T_ |
---|
144 | #endif /* _FCOMPLEX_DECLARE_T_ */ |
---|
145 | |
---|
146 | #ifndef _ARITHCODE_DECLARE_T_ |
---|
147 | typedef struct { |
---|
148 | unsigned long *ilob,*iupb,*ncumfq,jdif,nc,minint,nch,ncum,nrad; |
---|
149 | } arithcode; |
---|
150 | #define _ARITHCODE_DECLARE_T_ |
---|
151 | #endif /* _ARITHCODE_DECLARE_T_ */ |
---|
152 | |
---|
153 | #ifndef _HUFFCODE_DECLARE_T_ |
---|
154 | typedef struct { |
---|
155 | unsigned long *icod,*ncod,*left,*right,nch,nodemax; |
---|
156 | } huffcode; |
---|
157 | #define _HUFFCODE_DECLARE_T_ |
---|
158 | #endif /* _HUFFCODE_DECLARE_T_ */ |
---|
159 | |
---|
160 | void addint(double **uf, double **uc, double **res, int nf); |
---|
161 | void airy(float x, float *ai, float *bi, float *aip, float *bip); |
---|
162 | void amebsa(float **p, float y[], int ndim, float pb[], float *yb, |
---|
163 | float ftol, float (*funk)(float []), int *iter, float temptr); |
---|
164 | void amoeba(float **p, float y[], int ndim, float ftol, |
---|
165 | float (*funk)(float []), int *iter); |
---|
166 | float amotry(float **p, float y[], float psum[], int ndim, |
---|
167 | float (*funk)(float []), int ihi, float fac); |
---|
168 | float amotsa(float **p, float y[], float psum[], int ndim, float pb[], |
---|
169 | float *yb, float (*funk)(float []), int ihi, float *yhi, |
---|
170 | float fac); |
---|
171 | void anneal(float x[], float y[], int iorder[], int ncity); |
---|
172 | double anorm2(double **a, int n); |
---|
173 | void arcmak(unsigned long nfreq[], unsigned long nchh, unsigned long nradd, |
---|
174 | arithcode *acode); |
---|
175 | void arcode(unsigned long *ich, unsigned char **codep, unsigned long *lcode, |
---|
176 | unsigned long *lcd, int isign, arithcode *acode); |
---|
177 | void arcsum(unsigned long iin[], unsigned long iout[], unsigned long ja, |
---|
178 | int nwk, unsigned long nrad, unsigned long nc); |
---|
179 | void asolve(unsigned long n, double b[], double x[], int itrnsp); |
---|
180 | void atimes(unsigned long n, double x[], double r[], int itrnsp); |
---|
181 | void avevar(float data[], unsigned long n, float *ave, float *var); |
---|
182 | void balanc(float **a, int n); |
---|
183 | void banbks(float **a, unsigned long n, int m1, int m2, float **al, |
---|
184 | unsigned long indx[], float b[]); |
---|
185 | void bandec(float **a, unsigned long n, int m1, int m2, float **al, |
---|
186 | unsigned long indx[], float *d); |
---|
187 | void banmul(float **a, unsigned long n, int m1, int m2, float x[], |
---|
188 | float b[]); |
---|
189 | void bcucof(float y[], float y1[], float y2[], float y12[], float d1, |
---|
190 | float d2, float **c); |
---|
191 | void bcuint(float y[], float y1[], float y2[], float y12[], |
---|
192 | float x1l, float x1u, float x2l, float x2u, float x1, |
---|
193 | float x2, float *ansy, float *ansy1, float *ansy2); |
---|
194 | void beschb(double x, double *gam1, double *gam2, double *gampl, |
---|
195 | double *gammi); |
---|
196 | float bessi(int n, float x); |
---|
197 | float bessi0(float x); |
---|
198 | float bessi1(float x); |
---|
199 | void bessik(float x, float xnu, float *ri, float *rk, float *rip, |
---|
200 | float *rkp); |
---|
201 | float bessj(int n, float x); |
---|
202 | float bessj0(float x); |
---|
203 | float bessj1(float x); |
---|
204 | void bessjy(float x, float xnu, float *rj, float *ry, float *rjp, |
---|
205 | float *ryp); |
---|
206 | float bessk(int n, float x); |
---|
207 | float bessk0(float x); |
---|
208 | float bessk1(float x); |
---|
209 | float bessy(int n, float x); |
---|
210 | float bessy0(float x); |
---|
211 | float bessy1(float x); |
---|
212 | float beta(float z, float w); |
---|
213 | float betacf(float a, float b, float x); |
---|
214 | float betai(float a, float b, float x); |
---|
215 | float bico(int n, int k); |
---|
216 | void bksub(int ne, int nb, int jf, int k1, int k2, float ***c); |
---|
217 | float bnldev(float pp, int n, long *idum); |
---|
218 | float brent(float ax, float bx, float cx, |
---|
219 | float (*f)(float), float tol, float *xmin); |
---|
220 | void broydn(float x[], int n, int *check, |
---|
221 | void (*vecfunc)(int, float [], float [])); |
---|
222 | void bsstep(float y[], float dydx[], int nv, float *xx, float htry, |
---|
223 | float eps, float yscal[], float *hdid, float *hnext, |
---|
224 | void (*derivs)(float, float [], float [])); |
---|
225 | void caldat(long julian, int *mm, int *id, int *iyyy); |
---|
226 | void chder(float a, float b, float c[], float cder[], int n); |
---|
227 | float chebev(float a, float b, float c[], int m, float x); |
---|
228 | void chebft(float a, float b, float c[], int n, float (*func)(float)); |
---|
229 | void chebpc(float c[], float d[], int n); |
---|
230 | void chint(float a, float b, float c[], float cint[], int n); |
---|
231 | float chixy(float bang); |
---|
232 | void choldc(float **a, int n, float p[]); |
---|
233 | void cholsl(float **a, int n, float p[], float b[], float x[]); |
---|
234 | void chsone(float bins[], float ebins[], int nbins, int knstrn, |
---|
235 | float *df, float *chsq, float *prob); |
---|
236 | void chstwo(float bins1[], float bins2[], int nbins, int knstrn, |
---|
237 | float *df, float *chsq, float *prob); |
---|
238 | void cisi(float x, float *ci, float *si); |
---|
239 | void cntab1(int **nn, int ni, int nj, float *chisq, |
---|
240 | float *df, float *prob, float *cramrv, float *ccc); |
---|
241 | void cntab2(int **nn, int ni, int nj, float *h, float *hx, float *hy, |
---|
242 | float *hygx, float *hxgy, float *uygx, float *uxgy, float *uxy); |
---|
243 | void convlv(float data[], unsigned long n, float respns[], unsigned long m, |
---|
244 | int isign, float ans[]); |
---|
245 | void copy(double **aout, double **ain, int n); |
---|
246 | void correl(float data1[], float data2[], unsigned long n, float ans[]); |
---|
247 | void cosft(float y[], int n, int isign); |
---|
248 | void cosft1(float y[], int n); |
---|
249 | void cosft2(float y[], int n, int isign); |
---|
250 | void covsrt(float **covar, int ma, int ia[], int mfit); |
---|
251 | void crank(unsigned long n, float w[], float *s); |
---|
252 | void cyclic(float a[], float b[], float c[], float alpha, float beta, |
---|
253 | float r[], float x[], unsigned long n); |
---|
254 | void daub4(float a[], unsigned long n, int isign); |
---|
255 | float dawson(float x); |
---|
256 | float dbrent(float ax, float bx, float cx, |
---|
257 | float (*f)(float), float (*df)(float), float tol, float *xmin); |
---|
258 | void ddpoly(float c[], int nc, float x, float pd[], int nd); |
---|
259 | int decchk(char string[], int n, char *ch); |
---|
260 | void derivs(float x, float y[], float dydx[]); |
---|
261 | float df1dim(float x); |
---|
262 | void dfour1(double data[], unsigned long nn, int isign); |
---|
263 | void dfpmin(float p[], int n, float gtol, int *iter, float *fret, |
---|
264 | float (*func)(float []), void (*dfunc)(float [], float [])); |
---|
265 | float dfridr(float (*func)(float), float x, float h, float *err); |
---|
266 | void dftcor(float w, float delta, float a, float b, float endpts[], |
---|
267 | float *corre, float *corim, float *corfac); |
---|
268 | void dftint(float (*func)(float), float a, float b, float w, |
---|
269 | float *cosint, float *sinint); |
---|
270 | void difeq(int k, int k1, int k2, int jsf, int is1, int isf, |
---|
271 | int indexv[], int ne, float **s, float **y); |
---|
272 | void dlinmin(float p[], float xi[], int n, float *fret, |
---|
273 | float (*func)(float []), void (*dfunc)(float [], float[])); |
---|
274 | double dpythag(double a, double b); |
---|
275 | void drealft(double data[], unsigned long n, int isign); |
---|
276 | void dsprsax(double sa[], unsigned long ija[], double x[], double b[], |
---|
277 | unsigned long n); |
---|
278 | void dsprstx(double sa[], unsigned long ija[], double x[], double b[], |
---|
279 | unsigned long n); |
---|
280 | void dsvbksb(double **u, double w[], double **v, int m, int n, double b[], |
---|
281 | double x[]); |
---|
282 | void dsvdcmp(double **a, int m, int n, double w[], double **v); |
---|
283 | void eclass(int nf[], int n, int lista[], int listb[], int m); |
---|
284 | void eclazz(int nf[], int n, int (*equiv)(int, int)); |
---|
285 | float ei(float x); |
---|
286 | void eigsrt(float d[], float **v, int n); |
---|
287 | float elle(float phi, float ak); |
---|
288 | float ellf(float phi, float ak); |
---|
289 | float ellpi(float phi, float en, float ak); |
---|
290 | void elmhes(float **a, int n); |
---|
291 | float erfcc(float x); |
---|
292 | float erff(float x); |
---|
293 | float erffc(float x); |
---|
294 | void eulsum(float *sum, float term, int jterm, float wksp[]); |
---|
295 | float evlmem(float fdt, float d[], int m, float xms); |
---|
296 | float expdev(long *idum); |
---|
297 | float expint(int n, float x); |
---|
298 | float f1(float x); |
---|
299 | float f1dim(float x); |
---|
300 | float f2(float y); |
---|
301 | float f3(float z); |
---|
302 | float factln(int n); |
---|
303 | float factrl(int n); |
---|
304 | void fasper(float x[], float y[], unsigned long n, float ofac, float hifac, |
---|
305 | float wk1[], float wk2[], unsigned long nwk, unsigned long *nout, |
---|
306 | unsigned long *jmax, float *prob); |
---|
307 | void fdjac(int n, float x[], float fvec[], float **df, |
---|
308 | void (*vecfunc)(int, float [], float [])); |
---|
309 | void fgauss(float x, float a[], float *y, float dyda[], int na); |
---|
310 | void fill0(double **u, int n); |
---|
311 | void fit(float x[], float y[], int ndata, float sig[], int mwt, |
---|
312 | float *a, float *b, float *siga, float *sigb, float *chi2, |
---|
313 | float *q); |
---|
314 | void fitexy(float x[], float y[], int ndat, float sigx[], float sigy[], |
---|
315 | float *a, float *b, float *siga, float *sigb, float *chi2, |
---|
316 | float *q); |
---|
317 | void fixrts(float d[], int m); |
---|
318 | void fleg(float x, float pl[], int nl); |
---|
319 | void flmoon(int n, int nph, long *jd, float *frac); |
---|
320 | float fmin_(float x[]); |
---|
321 | void four1(float data[], unsigned long nn, int isign); |
---|
322 | void fourew(FILE *file[5], int *na, int *nb, int *nc, int *nd); |
---|
323 | void fourfs(FILE *file[5], unsigned long nn[], int ndim, int isign); |
---|
324 | void fourn(float data[], unsigned long nn[], int ndim, int isign); |
---|
325 | void fpoly(float x, float p[], int np); |
---|
326 | void fred2(int n, float a, float b, float t[], float f[], float w[], |
---|
327 | float (*g)(float), float (*ak)(float, float)); |
---|
328 | float fredin(float x, int n, float a, float b, float t[], float f[], |
---|
329 | float w[], |
---|
330 | float (*g)(float), float (*ak)(float, float)); |
---|
331 | void frenel(float x, float *s, float *c); |
---|
332 | void frprmn(float p[], int n, float ftol, int *iter, float *fret, |
---|
333 | float (*func)(float []), void (*dfunc)(float [], float [])); |
---|
334 | void ftest(float data1[], unsigned long n1, float data2[], unsigned long n2, |
---|
335 | float *f, float *prob); |
---|
336 | float gamdev(int ia, long *idum); |
---|
337 | float gammln(float xx); |
---|
338 | float gammp(float a, float x); |
---|
339 | float gammq(float a, float x); |
---|
340 | float gasdev(long *idum); |
---|
341 | void gaucof(int n, float a[], float b[], float amu0, float x[], float w[]); |
---|
342 | void gauher(float x[], float w[], int n); |
---|
343 | void gaujac(float x[], float w[], int n, float alf, float bet); |
---|
344 | void gaulag(float x[], float w[], int n, float alf); |
---|
345 | void gauleg(float x1, float x2, float x[], float w[], int n); |
---|
346 | void gaussj(float **a, int n, float **b, int m); |
---|
347 | void gcf(float *gammcf, float a, float x, float *gln); |
---|
348 | float golden(float ax, float bx, float cx, float (*f)(float), float tol, |
---|
349 | float *xmin); |
---|
350 | void gser(float *gamser, float a, float x, float *gln); |
---|
351 | void hpsel(unsigned long m, unsigned long n, float arr[], float heap[]); |
---|
352 | void hpsort(unsigned long n, float ra[]); |
---|
353 | void hqr(float **a, int n, float wr[], float wi[]); |
---|
354 | void hufapp(unsigned long index[], unsigned long nprob[], unsigned long n, |
---|
355 | unsigned long i); |
---|
356 | void hufdec(unsigned long *ich, unsigned char *code, unsigned long lcode, |
---|
357 | unsigned long *nb, huffcode *hcode); |
---|
358 | void hufenc(unsigned long ich, unsigned char **codep, unsigned long *lcode, |
---|
359 | unsigned long *nb, huffcode *hcode); |
---|
360 | void hufmak(unsigned long nfreq[], unsigned long nchin, unsigned long *ilong, |
---|
361 | unsigned long *nlong, huffcode *hcode); |
---|
362 | void hunt(float xx[], unsigned long n, float x, unsigned long *jlo); |
---|
363 | void hypdrv(float s, float yy[], float dyyds[]); |
---|
364 | fcomplex hypgeo(fcomplex a, fcomplex b, fcomplex c, fcomplex z); |
---|
365 | void hypser(fcomplex a, fcomplex b, fcomplex c, fcomplex z, |
---|
366 | fcomplex *series, fcomplex *deriv); |
---|
367 | unsigned short icrc(unsigned short crc, unsigned char *bufptr, |
---|
368 | unsigned long len, short jinit, int jrev); |
---|
369 | unsigned short icrc1(unsigned short crc, unsigned char onech); |
---|
370 | unsigned long igray(unsigned long n, int is); |
---|
371 | void iindexx(unsigned long n, long arr[], unsigned long indx[]); |
---|
372 | void indexx(unsigned long n, float arr[], unsigned long indx[]); |
---|
373 | void interp(double **uf, double **uc, int nf); |
---|
374 | int irbit1(unsigned long *iseed); |
---|
375 | int irbit2(unsigned long *iseed); |
---|
376 | void jacobi(float **a, int n, float d[], float **v, int *nrot); |
---|
377 | void jacobn(float x, float y[], float dfdx[], float **dfdy, int n); |
---|
378 | long julday(int mm, int id, int iyyy); |
---|
379 | void kendl1(float data1[], float data2[], unsigned long n, float *tau, |
---|
380 | float *z, |
---|
381 | float *prob); |
---|
382 | void kendl2(float **tab, int i, int j, float *tau, float *z, float *prob); |
---|
383 | void kermom(double w[], double y, int m); |
---|
384 | void ks2d1s(float x1[], float y1[], unsigned long n1, |
---|
385 | void (*quadvl)(float, float, float *, float *, float *, float *), |
---|
386 | float *d1, float *prob); |
---|
387 | void ks2d2s(float x1[], float y1[], unsigned long n1, float x2[], float y2[], |
---|
388 | unsigned long n2, float *d, float *prob); |
---|
389 | void ksone(float data[], unsigned long n, float (*func)(float), float *d, |
---|
390 | float *prob); |
---|
391 | void kstwo(float data1[], unsigned long n1, float data2[], unsigned long n2, |
---|
392 | float *d, float *prob); |
---|
393 | void laguer(fcomplex a[], int m, fcomplex *x, int *its); |
---|
394 | void lfit(float x[], float y[], float sig[], int ndat, float a[], int ia[], |
---|
395 | int ma, float **covar, float *chisq, |
---|
396 | void (*funcs)(float, float [], int)); |
---|
397 | void linbcg(unsigned long n, double b[], double x[], int itol, double tol, |
---|
398 | int itmax, int *iter, double *err); |
---|
399 | void linmin(float p[], float xi[], int n, float *fret, |
---|
400 | float (*func)(float [])); |
---|
401 | void lnsrch(int n, float xold[], float fold, float g[], float p[], float x[], |
---|
402 | float *f, float stpmax, int *check, float (*func)(float [])); |
---|
403 | void load(float x1, float v[], float y[]); |
---|
404 | void load1(float x1, float v1[], float y[]); |
---|
405 | void load2(float x2, float v2[], float y[]); |
---|
406 | void locate(float xx[], unsigned long n, float x, unsigned long *j); |
---|
407 | void lop(double **out, double **u, int n); |
---|
408 | void dlubksb(double **a, int n, int *indx, double b[]); |
---|
409 | void dludcmp(double **a, int n, int *indx, double *d); |
---|
410 | void machar(int *ibeta, int *it, int *irnd, int *ngrd, |
---|
411 | int *machep, int *negep, int *iexp, int *minexp, int *maxexp, |
---|
412 | float *eps, float *epsneg, float *xmin, float *xmax); |
---|
413 | void matadd(double **a, double **b, double **c, int n); |
---|
414 | void matsub(double **a, double **b, double **c, int n); |
---|
415 | void medfit(float x[], float y[], int ndata, float *a, float *b, |
---|
416 | float *abdev); |
---|
417 | void memcof(float data[], int n, int m, float *xms, float d[]); |
---|
418 | int metrop(float de, float t); |
---|
419 | void mgfas(double **u, int n, int maxcyc); |
---|
420 | void mglin(double **u, int n, int ncycle); |
---|
421 | float midexp(float (*funk)(float), float aa, float bb, int n); |
---|
422 | float midinf(float (*funk)(float), float aa, float bb, int n); |
---|
423 | float midpnt(float (*func)(float), float a, float b, int n); |
---|
424 | float midsql(float (*funk)(float), float aa, float bb, int n); |
---|
425 | float midsqu(float (*funk)(float), float aa, float bb, int n); |
---|
426 | void miser(float (*func)(float []), float regn[], int ndim, |
---|
427 | unsigned long npts, |
---|
428 | float dith, float *ave, float *var); |
---|
429 | void mmid(float y[], float dydx[], int nvar, float xs, float htot, |
---|
430 | int nstep, float yout[], void (*derivs)(float, float[], float[])); |
---|
431 | void mnbrak(float *ax, float *bx, float *cx, float *fa, float *fb, |
---|
432 | float *fc, float (*func)(float)); |
---|
433 | void mnewt(int ntrial, float x[], int n, float tolx, float tolf); |
---|
434 | void moment(float data[], int n, float *ave, float *adev, float *sdev, |
---|
435 | float *var, float *skew, float *curt); |
---|
436 | void mp2dfr(unsigned char a[], unsigned char s[], int n, int *m); |
---|
437 | void mpadd(unsigned char w[], unsigned char u[], unsigned char v[], int n); |
---|
438 | void mpdiv(unsigned char q[], unsigned char r[], unsigned char u[], |
---|
439 | unsigned char v[], int n, int m); |
---|
440 | void mpinv(unsigned char u[], unsigned char v[], int n, int m); |
---|
441 | void mplsh(unsigned char u[], int n); |
---|
442 | void mpmov(unsigned char u[], unsigned char v[], int n); |
---|
443 | void mpmul(unsigned char w[], unsigned char u[], unsigned char v[], int n, |
---|
444 | int m); |
---|
445 | void mpneg(unsigned char u[], int n); |
---|
446 | void mppi(int n); |
---|
447 | void mprove(float **a, float **alud, int n, int indx[], float b[], |
---|
448 | float x[]); |
---|
449 | void mpsad(unsigned char w[], unsigned char u[], int n, int iv); |
---|
450 | void mpsdv(unsigned char w[], unsigned char u[], int n, int iv, int *ir); |
---|
451 | void mpsmu(unsigned char w[], unsigned char u[], int n, int iv); |
---|
452 | void mpsqrt(unsigned char w[], unsigned char u[], unsigned char v[], int n, |
---|
453 | int m); |
---|
454 | void mpsub(int *is, unsigned char w[], unsigned char u[], unsigned char v[], |
---|
455 | int n); |
---|
456 | void mrqcof(float x[], float y[], float sig[], int ndata, float a[], |
---|
457 | int ia[], int ma, float **alpha, float beta[], float *chisq, |
---|
458 | void (*funcs)(float, float [], float *, float [], int)); |
---|
459 | void mrqmin(float x[], float y[], float sig[], int ndata, float a[], |
---|
460 | int ia[], int ma, float **covar, float **alpha, float *chisq, |
---|
461 | void (*funcs)(float, float [], float *, float [], int), |
---|
462 | float *alamda); |
---|
463 | void newt(float x[], int n, int *check, |
---|
464 | void (*vecfunc)(int, float [], float [])); |
---|
465 | void odeint(float ystart[], int nvar, float x1, float x2, |
---|
466 | float eps, float h1, float hmin, int *nok, int *nbad, |
---|
467 | void (*derivs)(float, float [], float []), |
---|
468 | void (*rkqs)(float [], float [], int, float *, float, float, |
---|
469 | float [], float *, float *, |
---|
470 | void (*)(float, float [], float []))); |
---|
471 | void orthog(int n, float anu[], float alpha[], float beta[], float a[], |
---|
472 | float b[]); |
---|
473 | void pade(double cof[], int n, float *resid); |
---|
474 | void pccheb(float d[], float c[], int n); |
---|
475 | void pcshft(float a, float b, float d[], int n); |
---|
476 | void pearsn(float x[], float y[], unsigned long n, float *r, float *prob, |
---|
477 | float *z); |
---|
478 | void period(float x[], float y[], int n, float ofac, float hifac, |
---|
479 | float px[], float py[], int np, int *nout, int *jmax, |
---|
480 | float *prob); |
---|
481 | void piksr2(int n, float arr[], float brr[]); |
---|
482 | void piksrt(int n, float arr[]); |
---|
483 | void pinvs(int ie1, int ie2, int je1, int jsf, int jc1, int k, |
---|
484 | float ***c, float **s); |
---|
485 | float plgndr(int l, int m, float x); |
---|
486 | float poidev(float xm, long *idum); |
---|
487 | void polcoe(float x[], float y[], int n, float cof[]); |
---|
488 | void polcof(float xa[], float ya[], int n, float cof[]); |
---|
489 | void poldiv(float u[], int n, float v[], int nv, float q[], float r[]); |
---|
490 | void polin2(float x1a[], float x2a[], float **ya, int m, int n, |
---|
491 | float x1, float x2, float *y, float *dy); |
---|
492 | void polint(float xa[], float ya[], int n, float x, float *y, float *dy); |
---|
493 | void powell(float p[], float **xi, int n, float ftol, int *iter, float *fret, |
---|
494 | float (*func)(float [])); |
---|
495 | void predic(float data[], int ndata, float d[], int m, float future[], |
---|
496 | int nfut); |
---|
497 | float probks(float alam); |
---|
498 | void psdes(unsigned long *lword, unsigned long *irword); |
---|
499 | void pwt(float a[], unsigned long n, int isign); |
---|
500 | void pwtset(int n); |
---|
501 | float pythag(float a, float b); |
---|
502 | void pzextr(int iest, float xest, float yest[], float yz[], float dy[], |
---|
503 | int nv); |
---|
504 | float qgaus(float (*func)(float), float a, float b); |
---|
505 | void qrdcmp(float **a, int n, float *c, float *d, int *sing); |
---|
506 | float qromb(float (*func)(float), float a, float b); |
---|
507 | float qromo(float (*func)(float), float a, float b, |
---|
508 | float (*choose)(float (*)(float), float, float, int)); |
---|
509 | void qroot(float p[], int n, float *b, float *c, float eps); |
---|
510 | void qrsolv(float **a, int n, float c[], float d[], float b[]); |
---|
511 | void qrupdt(float **r, float **qt, int n, float u[], float v[]); |
---|
512 | float qsimp(float (*func)(float), float a, float b); |
---|
513 | float qtrap(float (*func)(float), float a, float b); |
---|
514 | float quad3d(float (*func)(float, float, float), float x1, float x2); |
---|
515 | void quadct(float x, float y, float xx[], float yy[], unsigned long nn, |
---|
516 | float *fa, float *fb, float *fc, float *fd); |
---|
517 | void quadmx(float **a, int n); |
---|
518 | void quadvl(float x, float y, float *fa, float *fb, float *fc, float *fd); |
---|
519 | float ran0(long *idum); |
---|
520 | float ran1(long *idum); |
---|
521 | float ran2(long *idum); |
---|
522 | float ran3(long *idum); |
---|
523 | float ran4(long *idum); |
---|
524 | void rank(unsigned long n, unsigned long indx[], unsigned long irank[]); |
---|
525 | void ranpt(float pt[], float regn[], int n); |
---|
526 | void ratint(float xa[], float ya[], int n, float x, float *y, float *dy); |
---|
527 | void ratlsq(double (*fn)(double), double a, double b, int mm, int kk, |
---|
528 | double cof[], double *dev); |
---|
529 | double ratval(double x, double cof[], int mm, int kk); |
---|
530 | float rc(float x, float y); |
---|
531 | float rd(float x, float y, float z); |
---|
532 | void realft(float data[], unsigned long n, int isign); |
---|
533 | void rebin(float rc, int nd, float r[], float xin[], float xi[]); |
---|
534 | void red(int iz1, int iz2, int jz1, int jz2, int jm1, int jm2, int jmf, |
---|
535 | int ic1, int jc1, int jcf, int kc, float ***c, float **s); |
---|
536 | void relax(double **u, double **rhs, int n); |
---|
537 | void relax2(double **u, double **rhs, int n); |
---|
538 | void resid(double **res, double **u, double **rhs, int n); |
---|
539 | float revcst(float x[], float y[], int iorder[], int ncity, int n[]); |
---|
540 | void reverse(int iorder[], int ncity, int n[]); |
---|
541 | float rf(float x, float y, float z); |
---|
542 | float rj(float x, float y, float z, float p); |
---|
543 | void rk4(float y[], float dydx[], int n, float x, float h, float yout[], |
---|
544 | void (*derivs)(float, float [], float [])); |
---|
545 | void rkck(float y[], float dydx[], int n, float x, float h, |
---|
546 | float yout[], float yerr[], |
---|
547 | void (*derivs)(float, float [], float [])); |
---|
548 | void rkdumb(float vstart[], int nvar, float x1, float x2, int nstep, |
---|
549 | void (*derivs)(float, float [], float [])); |
---|
550 | void rkqs(float y[], float dydx[], int n, float *x, |
---|
551 | float htry, float eps, float yscal[], float *hdid, float *hnext, |
---|
552 | void (*derivs)(float, float [], float [])); |
---|
553 | void rlft3(float ***data, float **speq, unsigned long nn1, |
---|
554 | unsigned long nn2, unsigned long nn3, int isign); |
---|
555 | float rofunc(float b); |
---|
556 | void rotate(float **r, float **qt, int n, int i, float a, float b); |
---|
557 | void rsolv(float **a, int n, float d[], float b[]); |
---|
558 | void rstrct(double **uc, double **uf, int nc); |
---|
559 | float rtbis(float (*func)(float), float x1, float x2, float xacc); |
---|
560 | float rtflsp(float (*func)(float), float x1, float x2, float xacc); |
---|
561 | float rtnewt(void (*funcd)(float, float *, float *), float x1, float x2, |
---|
562 | float xacc); |
---|
563 | float rtsafe(void (*funcd)(float, float *, float *), float x1, float x2, |
---|
564 | float xacc); |
---|
565 | float rtsec(float (*func)(float), float x1, float x2, float xacc); |
---|
566 | void rzextr(int iest, float xest, float yest[], float yz[], float dy[], |
---|
567 | int nv); |
---|
568 | void savgol(float c[], int np, int nl, int nr, int ld, int m); |
---|
569 | void score(float xf, float y[], float f[]); |
---|
570 | void scrsho(float (*fx)(float)); |
---|
571 | float select1(unsigned long k, unsigned long n, float arr[]); |
---|
572 | float selip(unsigned long k, unsigned long n, float arr[]); |
---|
573 | void shell(unsigned long n, float a[]); |
---|
574 | void shoot(int n, float v[], float f[]); |
---|
575 | void shootf(int n, float v[], float f[]); |
---|
576 | void simp1(float **a, int mm, int ll[], int nll, int iabf, int *kp, |
---|
577 | float *bmax); |
---|
578 | void simp2(float **a, int m, int n, int *ip, int kp); |
---|
579 | void simp3(float **a, int i1, int k1, int ip, int kp); |
---|
580 | void simplx(float **a, int m, int n, int m1, int m2, int m3, int *icase, |
---|
581 | int izrov[], int iposv[]); |
---|
582 | void simpr(float y[], float dydx[], float dfdx[], float **dfdy, |
---|
583 | int n, float xs, float htot, int nstep, float yout[], |
---|
584 | void (*derivs)(float, float [], float [])); |
---|
585 | void sinft(float y[], int n); |
---|
586 | void slvsm2(double **u, double **rhs); |
---|
587 | void slvsml(double **u, double **rhs); |
---|
588 | void sncndn(float uu, float emmc, float *sn, float *cn, float *dn); |
---|
589 | double snrm(unsigned long n, double sx[], int itol); |
---|
590 | void sobseq(int *n, float x[]); |
---|
591 | void solvde(int itmax, float conv, float slowc, float scalv[], |
---|
592 | int indexv[], int ne, int nb, int m, float **y, float ***c, |
---|
593 | float **s); |
---|
594 | void sor(double **a, double **b, double **c, double **d, double **e, |
---|
595 | double **f, double **u, int jmax, double rjac); |
---|
596 | void sort(unsigned long n, float arr[]); |
---|
597 | void sort2(unsigned long n, float arr[], float brr[]); |
---|
598 | void sort3(unsigned long n, float ra[], float rb[], float rc[]); |
---|
599 | void spctrm(FILE *fp, float p[], int m, int k, int ovrlap); |
---|
600 | void spear(float data1[], float data2[], unsigned long n, float *d, |
---|
601 | float *zd, |
---|
602 | float *probd, float *rs, float *probrs); |
---|
603 | void sphbes(int n, float x, float *sj, float *sy, float *sjp, float *syp); |
---|
604 | void splie2(float x1a[], float x2a[], float **ya, int m, int n, float **y2a); |
---|
605 | void splin2(float x1a[], float x2a[], float **ya, float **y2a, int m, int n, |
---|
606 | float x1, float x2, float *y); |
---|
607 | void spline(float x[], float y[], int n, float yp1, float ypn, float y2[]); |
---|
608 | void splint(float xa[], float ya[], float y2a[], int n, float x, float *y); |
---|
609 | void spread(float y, float yy[], unsigned long n, float x, int m); |
---|
610 | void sprsax(float sa[], unsigned long ija[], float x[], float b[], |
---|
611 | unsigned long n); |
---|
612 | void sprsin(float **a, int n, float thresh, unsigned long nmax, float sa[], |
---|
613 | unsigned long ija[]); |
---|
614 | void sprspm(float sa[], unsigned long ija[], float sb[], unsigned long ijb[], |
---|
615 | float sc[], unsigned long ijc[]); |
---|
616 | void sprstm(float sa[], unsigned long ija[], float sb[], unsigned long ijb[], |
---|
617 | float thresh, unsigned long nmax, float sc[], |
---|
618 | unsigned long ijc[]); |
---|
619 | void sprstp(float sa[], unsigned long ija[], float sb[], |
---|
620 | unsigned long ijb[]); |
---|
621 | void sprstx(float sa[], unsigned long ija[], float x[], float b[], |
---|
622 | unsigned long n); |
---|
623 | void stifbs(float y[], float dydx[], int nv, float *xx, |
---|
624 | float htry, float eps, float yscal[], float *hdid, float *hnext, |
---|
625 | void (*derivs)(float, float [], float [])); |
---|
626 | void stiff(float y[], float dydx[], int n, float *x, |
---|
627 | float htry, float eps, float yscal[], float *hdid, float *hnext, |
---|
628 | void (*derivs)(float, float [], float [])); |
---|
629 | void stoerm(float y[], float d2y[], int nv, float xs, |
---|
630 | float htot, int nstep, float yout[], |
---|
631 | void (*derivs)(float, float [], float [])); |
---|
632 | void svbksb(float **u, float w[], float **v, int m, int n, float b[], |
---|
633 | float x[]); |
---|
634 | void svdcmp(float **a, int m, int n, float w[], float **v); |
---|
635 | void svdfit(float x[], float y[], float sig[], int ndata, float a[], |
---|
636 | int ma, float **u, float **v, float w[], float *chisq, |
---|
637 | void (*funcs)(float, float [], int)); |
---|
638 | void svdvar(float **v, int ma, float w[], float **cvm); |
---|
639 | void toeplz(float r[], float x[], float y[], int n); |
---|
640 | void tptest(float data1[], float data2[], unsigned long n, float *t, |
---|
641 | float *prob); |
---|
642 | void tqli(float d[], float e[], int n, float **z); |
---|
643 | float trapzd(float (*func)(float), float a, float b, int n); |
---|
644 | void tred2(float **a, int n, float d[], float e[]); |
---|
645 | void tridag(float a[], float b[], float c[], float r[], float u[], |
---|
646 | unsigned long n); |
---|
647 | float trncst(float x[], float y[], int iorder[], int ncity, int n[]); |
---|
648 | void trnspt(int iorder[], int ncity, int n[]); |
---|
649 | void ttest(float data1[], unsigned long n1, float data2[], unsigned long n2, |
---|
650 | float *t, float *prob); |
---|
651 | void tutest(float data1[], unsigned long n1, float data2[], unsigned long n2, |
---|
652 | float *t, float *prob); |
---|
653 | void twofft(float data1[], float data2[], float fft1[], float fft2[], |
---|
654 | unsigned long n); |
---|
655 | void vander(double x[], double w[], double q[], int n); |
---|
656 | void vegas(float regn[], int ndim, float (*fxn)(float [], float), int init, |
---|
657 | unsigned long ncall, int itmx, int nprn, float *tgral, float *sd, |
---|
658 | float *chi2a); |
---|
659 | void voltra(int n, int m, float t0, float h, float *t, float **f, |
---|
660 | float (*g)(int, float), float (*ak)(int, int, float, float)); |
---|
661 | void wt1(float a[], unsigned long n, int isign, |
---|
662 | void (*wtstep)(float [], unsigned long, int)); |
---|
663 | void wtn(float a[], unsigned long nn[], int ndim, int isign, |
---|
664 | void (*wtstep)(float [], unsigned long, int)); |
---|
665 | void wwghts(float wghts[], int n, float h, |
---|
666 | void (*kermom)(double [], double ,int)); |
---|
667 | int zbrac(float (*func)(float), float *x1, float *x2); |
---|
668 | void zbrak(float (*fx)(float), float x1, float x2, int n, float xb1[], |
---|
669 | float xb2[], int *nb); |
---|
670 | float zbrent(float (*func)(float), float x1, float x2, float tol); |
---|
671 | void zrhqr(float a[], int m, float rtr[], float rti[]); |
---|
672 | float zriddr(float (*func)(float), float x1, float x2, float xacc); |
---|
673 | void zroots(fcomplex a[], int m, fcomplex roots[], int polish); |
---|
674 | } |
---|