lfstruc.h 2.7 KB

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