[BACK]Return to wmain.c CVS log [TXT][DIR] Up to [local] / OpenXM / src / hgm / mh / src

Diff for /OpenXM/src/hgm/mh/src/wmain.c between version 1.28 and 1.35

version 1.28, 2016/02/13 02:19:00 version 1.35, 2016/06/04 07:52:14
Line 1 
Line 1 
 /*  /*
   $OpenXM: OpenXM/src/hgm/mh/src/wmain.c,v 1.27 2016/02/04 06:56:05 takayama Exp $    $OpenXM: OpenXM/src/hgm/mh/src/wmain.c,v 1.34 2016/03/02 00:27:02 takayama Exp $
   License: LGPL    License: LGPL
 */  */
 #include <stdio.h>  #include <stdio.h>
Line 179  struct MH_RESULT *mh_main(int argc,char *argv[]) {
Line 179  struct MH_RESULT *mh_main(int argc,char *argv[]) {
   if (MH_strategy) {    if (MH_strategy) {
     if (MH_abserr > SIGDIGIT_DEFAULT*myabs(y0[0])) {      if (MH_abserr > SIGDIGIT_DEFAULT*myabs(y0[0])) {
       MH_success = 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, e.g., err=c(1e-20,1e-10)\n",MH_abserr,y0[0]);
     }else{      }else{
       MH_success = 1;        MH_success = 1;
     }      }
Line 198  int mh_usage() {
Line 198  int mh_usage() {
   
 #include "usage-w-n.h"  #include "usage-w-n.h"
   
     return(0);
 }  }
   
 static int setParamTest() {  static int setParamTest() {
Line 241  static int setParamDefault() {
Line 242  static int setParamDefault() {
   Ef = 0.01034957388338225707;    Ef = 0.01034957388338225707;
   MH_X0g = 0.3;    MH_X0g = 0.3;
   MH_Hg = 0.001;    MH_Hg = 0.001;
   MH_Dp = 1;    MH_Dp = 1000;
   Xng = 10.0; return(0);    Xng = 10.0; return(0);
 }  }
   #ifdef STANDALONE
   /* may remove */
 static int next_old1(struct SFILE *sfp,char *s,char *msg) {  static int next_old1(struct SFILE *sfp,char *s,char *msg) {
   s[0] = '%';    s[0] = '%';
   while (s[0] == '%') {    while (s[0] == '%') {
Line 255  static int next_old1(struct SFILE *sfp,char *s,char *m
Line 257  static int next_old1(struct SFILE *sfp,char *s,char *m
     if (s[0] != '%') return(0);      if (s[0] != '%') return(0);
   } return(0);    } return(0);
 }  }
   #endif
 static int next(struct SFILE *sfp,char *s,char *msg) {  static int next(struct SFILE *sfp,char *s,char *msg) {
   static int check=1;    static int check=1;
   char *ng="%%Ng=";    char *ng="%%Ng=";
Line 313  static int setParam(char *fname) {
Line 316  static int setParam(char *fname) {
   Ef=1.0;    /* exponential factor */    Ef=1.0;    /* exponential factor */
   MH_Ef_type=1;    MH_Ef_type=1;
   MH_Hg=0.01;   /* step size for RK */    MH_Hg=0.01;   /* step size for RK */
   MH_Dp = 1;   /* sampling rate */    MH_Dp = -1;   /* sampling rate */
   Xng = 10.0; /* terminal point for RK */    Xng = 10.0; /* terminal point for RK */
   
   /* Parser for the old style (version <2.0) input */    /* Parser for the old style (version <2.0) input */
Line 370  static int setParam(char *fname) {
Line 373  static int setParam(char *fname) {
       if (mh_getoken(s,SMAX-1,fp).type != MH_TOKEN_EQ) {        if (mh_getoken(s,SMAX-1,fp).type != MH_TOKEN_EQ) {
         oxprintfe("Syntax error at %s\n",s); mh_exit(-1);          oxprintfe("Syntax error at %s\n",s); mh_exit(-1);
       }        }
       if ((tk=mh_getoken(s,SMAX-1,fp)).type != MH_TOKEN_DOUBLE) {        if ((tk=mh_getoken(s,SMAX-1,fp)).type == MH_TOKEN_DOUBLE) {
           MH_abserr = tk.dval;
         }else if (tk.type == MH_TOKEN_INT) {
           MH_abserr = tk.ival;
         }else{
         oxprintfe("Syntax error at %s\n",s); mh_exit(-1);          oxprintfe("Syntax error at %s\n",s); mh_exit(-1);
       }        }
       MH_abserr = tk.dval;  
       continue;        continue;
     }      }
     if ((strcmp(s,"relerr")==0) || (strcmp(s,"relerror")==0)) {      if ((strcmp(s,"relerr")==0) || (strcmp(s,"relerror")==0)) {
       if (mh_getoken(s,SMAX-1,fp).type != MH_TOKEN_EQ) {        if (mh_getoken(s,SMAX-1,fp).type != MH_TOKEN_EQ) {
         oxprintfe("Syntax error at %s\n",s); mh_exit(-1);          oxprintfe("Syntax error at %s\n",s); mh_exit(-1);
       }        }
       if ((tk=mh_getoken(s,SMAX-1,fp)).type != MH_TOKEN_DOUBLE) {        if ((tk=mh_getoken(s,SMAX-1,fp)).type == MH_TOKEN_DOUBLE) {
           MH_relerr = tk.dval;
         }else if (tk.type == MH_TOKEN_INT) {
           MH_relerr = tk.dval;
         }else{
         oxprintfe("Syntax error at %s\n",s); mh_exit(-1);          oxprintfe("Syntax error at %s\n",s); mh_exit(-1);
       }        }
       MH_relerr = tk.dval;  
       continue;        continue;
     }      }
     if (strcmp(s,"strategy")==0) {      if (strcmp(s,"strategy")==0) {
Line 585  static int setParam(char *fname) {
Line 594  static int setParam(char *fname) {
   }    }
   if ((MH_M < 0) || (MH_A_pFq==NULL)) {    if ((MH_M < 0) || (MH_A_pFq==NULL)) {
         oxprintfe("MH_M and p_pFq, q_pFq are compulsory parameters.\n"); mh_exit(-1);          oxprintfe("MH_M and p_pFq, q_pFq are compulsory parameters.\n"); mh_exit(-1);
     }
     if (MH_Dp < 0) MH_Dp = (int) floor(1/MH_Hg);
     if (MH_P95 && (MH_Dp*MH_Hg < 2.0)) {
           oxprintfe("%%%%Warning, the resolution to find 95 percent point is less than 2.0. Decrease Dp\n");
   }    }
   
   mh_fclose(fp); return(0);    mh_fclose(fp); return(0);

Legend:
Removed from v.1.28  
changed lines
  Added in v.1.35

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>