comparison rDiff/src/locfit/Source/mutil.h @ 0:0f80a5141704

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