/* $OpenXM: OpenXM/src/hgm/mh/src/wmain.c,v 1.14 2014/02/25 05:25:39 takayama Exp $ License: LGPL */ #include #include #include #include #include "sfile.h" #include "mh.h" #define SMAX 4096 #define inci(i) { i++; if (i >= argc) { fprintf(stderr,"Option argument is not given.\n"); return(NULL); }} int MH_deallocate=0; extern char *MH_Gfname; extern char *MH_Dfname; /* global variables. They are set in setParam() */ int MH_byFile=1; int MH_RANK; int MH_M; int MH_Mg; /* m */ double *MH_Beta; /* beta[0], ..., beta[m-1] */ double *MH_Ng; /* freedom n. c=(m+1)/2+n/2; Note that it is a pointer */ double MH_X0g; /* initial point */ static double *Iv; /* Initial values of mhg sorted by mhbase() in rd.rr at beta*x0 */ static double Ef; /* exponential factor at beta*x0 */ extern double MH_Hg; /* step size of rk defined in rk.c */ int MH_Dp; /* Data sampling period */ static double Xng=0.0; /* the last point */ int MH_RawName = 0; static int Testrank=0; extern int MH_Verbose; extern int MH_P95; /* 95 % points */ int mh_gopen_file(void); static int setParamTest(void); static int setParamDefault(void); static int setParam(char *fname); static int showParam(void); static int next(struct SFILE *fp,char *s, char *msg); /* #define DEBUG */ #ifdef DEBUG char *MH_Dfname; char *MH_Gfname; double MH_Hg; int mh_gopen_file(void) { } struct MH_RESULT mh_rkmain(double x0,double y0[],double xn) { } #endif void mh_freeWorkArea(void) { extern int MH_deallocate; MH_deallocate=1; /* switch to deallocation mode. */ mh_main(0,NULL); setParam(NULL); mh_rkmain(0.0, NULL, 0.0); mh_rf(0.0, NULL, 0, NULL, 0); MH_deallocate=0; /* switch to the normal mode. */ } static int mypower(int x,int n) { int a,i; a = 1; for (i=0; it.txt\n"); fprintf(stderr," ./hgm_w-n --idata t.txt --gnuplotf test-g\n"); fprintf(stderr," gnuplot -persist