/* GaussFit - A System for Least Squares and Robust Estimation Source Code Copyright (C) 1987 by William H. Jefferys, Michael J. Fitzpatrick and Barbara E. McArthur All Rights Reserved. */ #include #include "defines.h" #include "house.h" #include "array.h" #include "datum.h" #include "simpledefs.h" #include "files.h" #include "prototypes.p" #include "symboltable.h" #include "alloc.h" extern int tracelevel; /* trace if this falg is on */ extern FILE *fp; /* result file */ static int valueptr=0; /* pinter to value stack */ long exportstack[MATSIZE]; /* stack to save values pending export */ int exportptr=0; /* export stack pointer */ saveexport(list) /* save item on export stack */ long list; { if(exportptr < MATSIZE) /* see if there is room */ { exportstack[exportptr] = list; /* yew, put on stack and increment pointer */ exportptr++; return 0; } else fatalerror("Export Stack Overflow\n",""); /* stack overflow */ } unsaveexport() /* drop everything from export stack */ { int i; for (i=0; i0) { /* only export if there are pending equations */ exportn(exportptr,exportstack); /* export all items in export stack */ unsaveexport(); /* discard items from stack */ in1 = popval(); /* pop top of stack */ FreeNodeList(in1); } } export() /* export equation of condition found on top of stack */ { long in1; in1 = popval(); saveexport(in1); PushTrue(); /* push true as result of export */ } export2() /* export top two equations of condition. To be DISCARDED eventually */ { long in1, in2; in1 = popval(); in2 = popval(); saveexport(in1); saveexport(in2); PushTrue(); } exportn(m,k) /* actually send pending equations of condition to least squares routine */ int m; long k[MATSIZE]; { long list; double rhs[MATSIZE]; double wt[MATSIZE][MATSIZE]; int i,j; short iz[5]; iz[0] = iz[1] = iz[2] = iz[3] = iz[4] = 0; pushcopy(k[0]); /* push something on top of stack (to be popped later) */ computewt(m,k,rhs,wt); /* compute weight matrix and right hand side vector*/ for(i=0;i