lfev.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. #ifndef I_LFEV_H
  2. #define I_LFEV_H
  3. #include "locf.h"
  4. #include "tube.h"
  5. /* uncomment the following line to allow plug-in modules. */
  6. /*#define ALLOW_MODULES*/
  7. #define DALP 0
  8. #define DFXH 1
  9. typedef struct {
  10. int ev;
  11. double *sv;
  12. double cut;
  13. double fl[2*MXDIM];
  14. int *iwk, *ce, *s, *lo, *hi;
  15. int liw, nce, ncm, maxk;
  16. int mg[MXDIM];
  17. void (*espec)();
  18. } evstruc;
  19. #define ev(evs) ((evs)->ev)
  20. #define cut(evs) ((evs)->cut)
  21. #define mk(evs) ((evs)->maxk)
  22. #define mg(evs) ((evs)->mg)
  23. typedef struct {
  24. double *xev, *wk, *coef, *nlx, *t0, *lik, *h, *deg, *kap;
  25. int lev, lwk;
  26. int d, dcor, geth, hasd;
  27. int nv, nvm;
  28. } fitpt;
  29. #define evp(fp) ((fp)->xev)
  30. #define evpt(fp,i) (&(fp)->xev[(i)*(fp)->d])
  31. #define evptx(fp,i,k) ((fp)->xev[(i)*(fp)->d+(k)])
  32. #define llk(fp) ((fp)->kap[0])
  33. #define df0(fp) ((fp)->kap[1])
  34. #define df1(fp) ((fp)->kap[2])
  35. #define rv(fp) ((fp)->kap[3])
  36. #define rsc(fp) ((fp)->kap[5])
  37. #define dc(fp) ((fp)->dcor)
  38. #define geth(fp) ((fp)->geth)
  39. typedef struct {
  40. int (*procv)(), keepv, keepc, nopc, isset, np;
  41. void (*alloc)();
  42. void (*pproc)();
  43. double *params;
  44. } module;
  45. #define PROC_VERTEX(des,lf,i) (lf)->mdl.procv((des),(lf),(i))
  46. #define MODPARAMS(lf) ((lf)->mdl.params)
  47. #define MODPARAM(lf,i) ((lf)->mdl.params[i])
  48. #define MODNPARAMS(lf) ((lf)->mdl.np)
  49. #define PROCV(lf) (lf)->mdl.procv
  50. #define ALLOC(lf) (lf)->mdl.alloc
  51. #define PPROC(lf) (lf)->mdl.pproc
  52. #define KEEPC(lf) (lf)->mdl.keepc
  53. #define KEEPV(lf) (lf)->mdl.keepv
  54. #define NOPC(lf) (lf)->mdl.nopc
  55. typedef struct {
  56. int lf_init_id;
  57. lfdata lfd;
  58. smpar sp;
  59. evstruc evs;
  60. fitpt fp;
  61. deriv dv;
  62. paramcomp pc;
  63. module mdl;
  64. } lfit;
  65. #define LF_INIT_ID 34897239
  66. #define NOBS(lf) ((lf)->lfd.n)
  67. #define NVAR(lf) ((lf)->lfd.d)
  68. #define NPAR(lf) ((lf)->sp.p)
  69. /*
  70. * VVEC(lf,i) is storage vector for the i'th item.
  71. * VVAL(lf,v,i) is the storage point for the i'th item when fitting at vertex v.
  72. * should have 0 <= i < keepv; keepv defined when initializing module.
  73. */
  74. #define VVEC(lf,i) (&(lf)->fp.wk[(i)*(lf)->fp.nvm])
  75. #define VVAL(lf,v,i) ((lf)->fp.wk[(i)*(lf)->fp.nvm+(v)])
  76. #define VECR(lf) ((lf)->kap)
  77. /*
  78. * mi[MGETH] codes
  79. * scb(), pointwise codes are 71,...,75.
  80. * add 10 for simultaneous codes.
  81. */
  82. #define GSTD 0
  83. #define GHAT 1
  84. #define GKAP 2
  85. #define GRBD 3
  86. #define GAMF 4
  87. #define GAMP 5
  88. #define GLSC 6
  89. #define GSMP 7
  90. #define GMIX 8
  91. #define GLM1 71
  92. #define GLM2 72
  93. #define GLM3 73
  94. #define GLM4 74
  95. #define GLDN 75
  96. /* bandwidth criteria */
  97. #define BGCV 1
  98. #define BCP 2
  99. #define BIND 3
  100. /*
  101. * Evaluation structures
  102. * EFITP special for `interpolation' at fit points
  103. */
  104. #define ENULL 0
  105. #define ETREE 1
  106. #define EPHULL 2
  107. #define EDATA 3
  108. #define EGRID 4
  109. #define EKDTR 5
  110. #define EKDCE 6
  111. #define ECROS 7
  112. #define EPRES 8
  113. #define EXBAR 9
  114. #define ENONE 10
  115. #define ESPHR 11
  116. #define EFITP 50
  117. #define ESPEC 100
  118. /*
  119. * For prediction functions, what to predict?
  120. * PCOEF -- coefficients PT0 -- influence function
  121. * PNLX -- ||l(x)|| PBAND -- bandwidth h(x)
  122. * PDEGR -- local poly. degree PLIK -- max. local likelihood
  123. * PRDF -- local res. d.f. PVARI -- ||l(x)||^2
  124. */
  125. #define PCOEF 1
  126. #define PT0 2
  127. #define PNLX 3
  128. #define PBAND 4
  129. #define PDEGR 5
  130. #define PLIK 6
  131. #define PRDF 7
  132. #define PVARI 8
  133. /*
  134. * Residual Types
  135. */
  136. #define RDEV 1
  137. #define RPEAR 2
  138. #define RRAW 3
  139. #define RLDOT 4
  140. #define RDEV2 5
  141. #define RLDDT 6
  142. #define RFIT 7
  143. #define RMEAN 8
  144. /* band.c */
  145. extern void band(), kdeselect(), kdecri(), bselect();
  146. /* dens_int.c */
  147. extern double dens_integrate();
  148. extern void dens_renorm(), lforder();
  149. /* ev_atree.c */
  150. extern void atree_start(), atree_grow(), atree_guessnv();
  151. extern double atree_int();
  152. /* ev_interp.c */
  153. extern double dointpoint(), cubintd();
  154. extern double linear_interp(), cubic_interp(), rectcell_interp();
  155. extern int exvval();
  156. extern void exvvalpv(), hermite2();
  157. /* ev_kdtre.c */
  158. extern void kdtre_start(), kdtre_guessnv();
  159. extern double kdtre_int();
  160. /* ev_sphere.c */
  161. extern void sphere_start(), sphere_guessnv();
  162. extern double sphere_int();
  163. /* ev_main.c */
  164. extern void trchck(), guessnv(), lfit_alloc(), evstruc_alloc(), evstruc_init();
  165. extern void dataf(), gridf(), crossf(), xbarf(), preset();
  166. extern int findpt(), newsplit(), lfit_reqd(), evstruc_reqi();
  167. extern int lfevstr();
  168. /* ev_trian.c */
  169. extern void triang_start(), triang_grow(), triang_guessnv();
  170. extern double triang_int();
  171. /* fitted.c */
  172. extern void fitted();
  173. extern double resid();
  174. extern int restyp();
  175. /* frend.c */
  176. extern void ressumm();
  177. extern double rss();
  178. /* lf_dercor.c */
  179. extern void dercor();
  180. /* pcomp.c */
  181. extern double addparcomp();
  182. extern void compparcomp(), subparcomp(), subparcomp2(), pcchk();
  183. extern int pc_reqd(), noparcomp();
  184. /* preplot.c */
  185. extern void preplot(), cpreplot();
  186. extern int setpppoints(), ppwhat();
  187. /* procv.c */
  188. extern int procv_nov(), procv_var();
  189. /* startlf.c */
  190. extern void set_flim(), set_scales(), nstartlf(), startlf(), lfit_init();
  191. extern void fitoptions(), clocfit(), endfit(), startmodule();
  192. extern int nofit(), initmodule();
  193. extern void initsimple(), initstd(), inithatm(), initgam(), initallcf();
  194. extern void initlscv(), initrband(), initscb(), initkappa(), initvord();
  195. /* modkappa.c */
  196. extern int constants();
  197. /* modrband.c */
  198. extern void rband();
  199. /* modstd.c */
  200. extern int procvstd();
  201. #endif /* define I_LFEV_H */