annotate rDiff/src/locfit/Source/mutil.h @ 1:08d3a6143873

Deleted selected files
author vipints
date Tue, 08 Oct 2013 06:54:25 -0400
parents 0f80a5141704
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
1 /*
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
2 * Headers for math utility functions.
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
3 */
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
4
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
5 #ifndef I_MUT_H
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
6 #define I_MUT_H
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
7
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
8 #include <math.h>
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
9 #include <stdio.h>
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
10 #include <stdlib.h>
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
11 #include <string.h>
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
12
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
13 /* use the following #define's for local versions. */
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
14 #ifdef DOS
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
15 #define erf mut_erf
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
16 #define erfc mut_erfc
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
17 #define lgamma mut_lgamma
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
18 #endif
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
19 #define daws(x) mut_daws(x)
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
20
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
21 typedef struct {
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
22 double *Z; /* jacobian matrix, length p*p */
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
23 double *Q; /* eigenvalue matrix, length p*p */
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
24 double *wk; /* work vector in eig_solve, length p */
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
25 double *dg; /* diag vector in eigd, length p */
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
26 int p; /* dimension */
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
27 int st; /* status */
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
28 int sm; /* requested decomposition */
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
29 } jacobian;
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
30
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
31 /* m_jacob.c */
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
32 extern int jac_reqd();
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
33 extern double *jac_alloc();
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
34 extern void jacob_dec(), chol_dec(), eig_dec();
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
35 extern int jacob_solve(), chol_solve(), eig_solve();
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
36 extern int jacob_hsolve(),chol_hsolve(),eig_hsolve();
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
37 extern int jacob_isolve(),chol_isolve(),eig_isolve();
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
38 extern double jacob_qf(), chol_qf(), eig_qf();
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
39
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
40 /* m_max.c */
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
41 extern double max_grid(), max_golden(), max_quad(), max_nr();
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
42
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
43 /* maxbv.c */
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
44 extern double maxbvgrid(), maxbvstep(), maxquadstep(), maxbv(), maxbvq();
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
45
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
46 /* quadmin.c */
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
47 extern void quadmin(), project(), resproj(), conquadmin();
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
48
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
49 /* m_qr.c */
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
50 extern void qr(), qrinvx(), qrtinvx(), qrsolv();
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
51
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
52 /* m_svd.c */
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
53 extern void svd(), hsvdsolve();
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
54 extern int svdsolve();
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
55
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
56 /* m_solve.c */
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
57 extern double solve_secant(), solve_nr(), solve_fp();
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
58
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
59 /* m_vector.c */
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
60 extern void setzero(), unitvec(), addouter();
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
61 extern void matrixmultiply(), multmatscal(), transpose();
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
62 extern double innerprod(), m_trace();
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
63
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
64 /* math.c */
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
65 extern double mut_gamma(), mut_erf(), mut_erfc(), mut_daws(), mut_exp();
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
66 extern double ptail(), logit(), expit();
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
67 extern int factorial();
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
68
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
69 #define BDF_NONE 0
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
70 #define BDF_EXPLEFT 1
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
71 #define BDF_EXPRIGHT 2
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
72
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
73 /* return codes for functions optimized by max_nr */
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
74 #define NR_OK 0
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
75 #define NR_INVALID 1
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
76 #define NR_BREAK 2
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
77 #define NR_REDUCE 3
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
78 #define NR_NCON 10
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
79 #define NR_NDIV 11
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
80
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
81
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
82 /* jacobian status definitions */
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
83 #define JAC_RAW 0
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
84 #define JAC_CHOL 1
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
85 #define JAC_EIG 2
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
86 #define JAC_EIGD 3
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
87
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
88 /* Numerical Integration Stuff
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
89 */
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
90 #define MXRESULT 5
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
91 #define MXIDIM 10 /* max. dimension */
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
92 extern void simpsonm(), simpson4(), integ_disc(), integ_circ();
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
93 extern void integ_sphere(), monte(), rn3();
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
94 extern double simpson(), sptarea();
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
95
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
96 /* Density, distribution stuff
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
97 */
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
98
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
99 #ifndef PI
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
100 #define PI 3.141592653589793238462643
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
101 #endif
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
102 #define PIx2 6.283185307179586476925286 /* 2*pi */
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
103 #define HF_LG_PIx2 0.918938533204672741780329736406 /* 0.5*log(2*pi) */
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
104 #define SQRT2 1.4142135623730950488
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
105
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
106 #define LOG_ZERO -1e100
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
107 #define D_0 ((give_log) ? LOG_ZERO : 0.0)
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
108 #define D_1 ((give_log) ? 0.0 : 1.0)
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
109 #define DEXP(x) ((give_log) ? (x) : exp(x))
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
110 #define FEXP(f,x) ((give_log) ? -0.5*log(f)+(x) : exp(x)/sqrt(f))
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
111
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
112 #define INVALID_PARAMS 0.0
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
113
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
114 extern double stirlerr(), bd0();
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
115 extern double dbinom_raw(), dpois_raw();
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
116 extern double dbinom(), dpois(), dnbinom(), dbeta(), dgamma(), dt(), df(), dhyper();
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
117 extern double dchisq();
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
118
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
119 extern double igamma(), ibeta();
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
120 extern double pf(), pchisq(), mut_pnorm();
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
121 #define pchisq(x,df) igamma((x)/2.0,(df)/2.0)
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
122
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
123 #endif /* define I_MUT_H */