=================================================================== RCS file: /home/cvs/OpenXM/src/hgm/mh/src/wmain.c,v retrieving revision 1.26 retrieving revision 1.32 diff -u -p -r1.26 -r1.32 --- OpenXM/src/hgm/mh/src/wmain.c 2016/02/01 11:37:14 1.26 +++ OpenXM/src/hgm/mh/src/wmain.c 2016/02/16 02:17:00 1.32 @@ -1,5 +1,5 @@ /* - $OpenXM: OpenXM/src/hgm/mh/src/wmain.c,v 1.25 2015/04/02 01:31:18 takayama Exp $ + $OpenXM: OpenXM/src/hgm/mh/src/wmain.c,v 1.31 2016/02/13 22:56:50 takayama Exp $ License: LGPL */ #include @@ -10,10 +10,13 @@ #include "mh.h" #define SMAX 4096 #define inci(i) { i++; if (i >= argc) { oxprintfe("Option argument is not given.\n"); return(NULL); }} +#define VSTRING "%!version2.0" int MH_deallocate=0; /* changelog + 2016.02.13 code-n.c and code-n-2f1.c are linked together. New idata format. + 2016.02.04 MH_Ef_type exponential or scalar factor 2016.02.01 C_2F1 2014.03.15 --strategy 1 is default. A new parser in setParam() */ @@ -50,17 +53,13 @@ double MH_coeff_max; */ double MH_estimated_start_step; -#ifdef C_2F1 -int MH_P_pFq=2; -int MH_Q_pFq=1; -double MH_A_pFq[2]; -double MH_B_pFq[1]; -#else int MH_P_pFq=1; int MH_Q_pFq=1; -double MH_A_pFq[1]; -double MH_B_pFq[1]; -#endif +double *MH_A_pFq=NULL; +double *MH_B_pFq=NULL; +int MH_Ef_type=1; +MH_RF mh_rf=NULL; /* function pointer to mh_rf */ + extern int MH_Verbose; extern int MH_strategy; extern double MH_abserr; @@ -75,9 +74,7 @@ static int showParam(void); static int next(struct SFILE *fp,char *s, char *msg); static double estimateHg(int m, double beta[],double x0); -#ifdef C_2F1 -void mh_setabc(double a,double b,double c); -#endif + /* #define DEBUG */ #ifdef DEBUG char *MH_Dfname; char *MH_Gfname; double MH_Hg; @@ -91,7 +88,7 @@ void mh_freeWorkArea(void) { mh_main(0,NULL); setParam(NULL); mh_rkmain(0.0, NULL, 0.0); - mh_rf(0.0, NULL, 0, NULL, 0); + if (mh_rf) (*mh_rf)(0.0, NULL, 0, NULL, 0); MH_deallocate=0; /* switch to the normal mode. */ } static int mypower(int x,int n) { @@ -121,6 +118,8 @@ struct MH_RESULT *mh_main(int argc,char *argv[]) { struct MH_RESULT *rp=NULL; extern int MH_deallocate; extern int MH_byFile; + extern double Ef; + Ef = 1; MH_byFile=1; if (MH_deallocate) { if (y0) mh_free(y0); return(rp); } setParam(NULL); MH_Gfname = MH_Dfname = NULL; MH_Verbose=1; @@ -180,7 +179,7 @@ struct MH_RESULT *mh_main(int argc,char *argv[]) { if (MH_strategy) { if (MH_abserr > SIGDIGIT_DEFAULT*myabs(y0[0])) { MH_success = 0; - oxprintfe("%%%%Warning, abserr seems not to be small enough, abserr=%lg, y[0]=%lg\n",MH_abserr,y0[0]); + oxprintfe("%%%%Warning, abserr seems not to be small enough, abserr=%lg, y[0]=%lg. Increasing the starting point (q0 or X0g(standalone case)) may or making abserr (err[1] or abserror(standalone case)) smaller will help.\n",MH_abserr,y0[0]); }else{ MH_success = 1; } @@ -191,53 +190,15 @@ struct MH_RESULT *mh_main(int argc,char *argv[]) { if (MH_Verbose) showParam(); if (MH_Verbose) {for (i=0; it.txt\n"); - oxprintfe(" ./hgm_w-n --idata t.txt --gnuplotf test-g --verbose\n"); - oxprintfe(" gnuplot -persist