comparison rDiff/src/locfit/Source/lfstruc.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 * Structures, typedefs etc used in Locfit
3 */
4
5 typedef struct {
6 double *wk, *coef, *xbar, *f;
7 jacobian xtwx;
8 int lwk, haspc;
9 } paramcomp;
10 #define haspc(pc) ((pc)->haspc)
11
12 typedef struct {
13 double *x[MXDIM];
14 double *y;
15 double *w;
16 double *b;
17 double *c;
18 double sca[MXDIM];
19 double xl[2*MXDIM];
20 int n, d, ord;
21 int sty[MXDIM];
22 varname yname, xname[MXDIM], wname, bname, cname;
23 } lfdata;
24 #define resp(lfd,i) (((lfd)->y==NULL) ? 0.0 : (lfd)->y[i])
25 #define base(lfd,i) (((lfd)->b==NULL) ? 0.0 : (lfd)->b[i])
26 #define prwt(lfd,i) (((lfd)->w==NULL) ? 1.0 : (lfd)->w[i])
27 #define cens(lfd,i) (((lfd)->c==NULL) ? 0 : (int)(lfd)->c[i])
28 #define datum(lfd,i,j) ((lfd)->x[i][j])
29 #define dvari(lfd,i) ((lfd)->x[i])
30
31 typedef struct {
32 int deflink, canlink, quasi, robust;
33 int (*vallink)(), (*family)(), (*initial)(), (*like)(), (*pcheck)();
34 } family;
35 #define isquasi(fam) ((fam)->quasi)
36 #define isrobust(fam) ((fam)->robust)
37 extern int inllmix; /* flag needed to ensure correct behavior in llmix. */
38
39 typedef struct {
40 double nn, fixh, adpen;
41 int ker, kt;
42 int deg, deg0, p;
43 int acri;
44 int fam, lin;
45 family fami;
46 int ubas;
47 double (*vb)();
48 void (*vbasis)();
49 } smpar;
50 #define nn(sp) ((sp)->nn)
51 #define fixh(sp) ((sp)->fixh)
52 #define pen(sp) ((sp)->adpen)
53 #define ker(sp) ((sp)->ker)
54 #define kt(sp) ((sp)->kt)
55 #define deg(sp) ((sp)->deg)
56 #define deg0(sp) ((sp)->deg0)
57 #define npar(sp) ((sp)->p)
58 #define acri(sp) ((sp)->acri)
59 #define ubas(sp) ((sp)->ubas)
60 #define fam(sp) ((sp)->fam)
61 #define fami(sp) (&(sp)->fami)
62 #define link(sp) ((sp)->lin)
63
64 typedef struct {
65 int deriv[MXDEG+2];
66 int nd;
67 } deriv;
68
69 typedef struct {
70 int ev;
71 double *sv;
72 double cut;
73 double fl[2*MXDIM];
74 Sint *iwk, *ce, *s, *lo, *hi;
75 int liw, nce, ncm, maxk;
76 int mg[MXDIM];
77 void (*espec)();
78 } evstruc;
79 #define ev(evs) ((evs)->ev)
80 #define cut(evs) ((evs)->cut)
81 #define mk(evs) ((evs)->maxk)
82 #define mg(evs) ((evs)->mg)
83
84 typedef struct {
85 double *xev, *coef, *nlx, *t0, *lik, *h, *deg, *kap;
86 int lev, lwk;
87 int d, dcor, geth, hasd;
88 int nv, nvm;
89 } fitpt;
90 #define evp(fp) ((fp)->xev)
91 #define evpt(fp,i) (&(fp)->xev[(i)*(fp)->d])
92 #define evptx(fp,i,k) ((fp)->xev[(i)*(fp)->d+(k)])
93 #define llk(fp) ((fp)->kap[0])
94 #define df0(fp) ((fp)->kap[1])
95 #define df1(fp) ((fp)->kap[2])
96 #define rv(fp) ((fp)->kap[3])
97 #define rsc(fp) ((fp)->kap[5])
98 #define dc(fp) ((fp)->dcor)
99 #define geth(fp) ((fp)->geth)
100
101 typedef struct {
102 int (*procv)(), keepv, keepc, nopc, isset;
103 void (*alloc)(), (*pp)();
104 } module;
105
106 typedef struct {
107 int lf_init_id;
108 lfdata lfd;
109 smpar sp;
110 evstruc evs;
111 fitpt fp;
112 deriv dv;
113 paramcomp pc;
114 module mdl;
115 } lfit;
116 #define LF_INIT_ID 34897239