--- imach/src/imach.c 2017/05/24 05:45:29 1.270 +++ imach/src/imach.c 2017/06/27 10:17:50 1.271 @@ -1,6 +1,9 @@ -/* $Id: imach.c,v 1.270 2017/05/24 05:45:29 brouard Exp $ +/* $Id: imach.c,v 1.271 2017/06/27 10:17:50 brouard Exp $ $State: Exp $ $Log: imach.c,v $ + Revision 1.271 2017/06/27 10:17:50 brouard + Summary: Some bug with rint + Revision 1.270 2017/05/24 05:45:29 brouard *** empty log message *** @@ -1013,12 +1016,12 @@ typedef struct { #define ODIRSEPARATOR '\\' #endif -/* $Id: imach.c,v 1.270 2017/05/24 05:45:29 brouard Exp $ */ +/* $Id: imach.c,v 1.271 2017/06/27 10:17:50 brouard Exp $ */ /* $State: Exp $ */ #include "version.h" char version[]=__IMACH_VERSION__; char copyright[]="February 2016,INED-EUROREVES-Institut de longevite-Japan Society for the Promotion of Science (Grant-in-Aid for Scientific Research 25293121), Intel Software 2015-2018"; -char fullversion[]="$Revision: 1.270 $ $Date: 2017/05/24 05:45:29 $"; +char fullversion[]="$Revision: 1.271 $ $Date: 2017/06/27 10:17:50 $"; char strstart[80]; char optionfilext[10], optionfilefiname[FILENAMELENGTH]; int erreur=0, nberr=0, nbwarn=0; /* Error number, number of errors number of warnings */ @@ -3243,7 +3246,7 @@ double ***hbxij(double ***po, int nhstep newm=savm; /* Covariates have to be included here again */ cov[1]=1.; - agexact=age-((h-1)*hstepm + (d))*stepm/YEARM; /* age just before transition, d or d-1? */ + agexact=age-( (h-1)*hstepm + (d) )*stepm/YEARM; /* age just before transition, d or d-1? */ /* agexact=age+((h-1)*hstepm + (d-1))*stepm/YEARM; /\* age just before transition *\/ */ cov[2]=agexact; if(nagesqr==1) @@ -7042,7 +7045,7 @@ void printinggnuplot(char fileresu[], ch fprintf(ficgp,"\" t\"\" w l lt 1,\"%s\" u 1:((",subdirf2(fileresu,"P_")); if(cptcoveff ==0){ - fprintf(ficgp,"$%d)) t 'Observed prevalence in state %d' with line lt 3", 2+(cpt-1), cpt ); + fprintf(ficgp,"$%d)) t 'Observed prevalence in state %d' with line lt 3", 2+3*(cpt-1), cpt ); }else{ kl=0; for (k=1; k<=cptcoveff; k++){ /* For each combination of covariate */ @@ -7100,17 +7103,17 @@ void printinggnuplot(char fileresu[], ch if (i==cpt) fprintf(ficgp," %%lf (%%lf)"); else fprintf(ficgp," %%*lf (%%*lf)"); } - fprintf(ficgp,"\" t\"Backward (stable) prevalence\" w l lt 0,\"%s\" every :::%d::%d u 1:($2==%d ? $3+1.96*$4 : 1/0) \"%%lf %%lf",subdirf2(fileresu,"VBL_"),nres-1,nres-1,nres); + fprintf(ficgp,"\" t\"Backward (stable) prevalence\" w l lt 6 dt 3,\"%s\" every :::%d::%d u 1:($2==%d ? $3+1.96*$4 : 1/0) \"%%lf %%lf",subdirf2(fileresu,"VBL_"),nres-1,nres-1,nres); for (i=1; i<= nlstate ; i ++) { if (i==cpt) fprintf(ficgp," %%lf (%%lf)"); else fprintf(ficgp," %%*lf (%%*lf)"); } - fprintf(ficgp,"\" t\"95%% CI\" w l lt 1,\"%s\" every :::%d::%d u 1:($2==%d ? $3-1.96*$4 : 1/0) \"%%lf %%lf",subdirf2(fileresu,"VBL_"),nres-1,nres-1,nres); + fprintf(ficgp,"\" t\"95%% CI\" w l lt 6,\"%s\" every :::%d::%d u 1:($2==%d ? $3-1.96*$4 : 1/0) \"%%lf %%lf",subdirf2(fileresu,"VBL_"),nres-1,nres-1,nres); for (i=1; i<= nlstate ; i ++) { if (i==cpt) fprintf(ficgp," %%lf (%%lf)"); else fprintf(ficgp," %%*lf (%%*lf)"); } - fprintf(ficgp,"\" t\"\" w l lt 1"); + fprintf(ficgp,"\" t\"\" w l lt 6"); } /* end if backprojcast */ } /* end if backcast */ fprintf(ficgp,"\nset out ;unset label;\n"); @@ -8345,15 +8348,16 @@ set ter svg size 640, 480\nunset log y\n /* for (yearp=0; yearp<=(anproj2-anproj1);yearp +=stepsize) { */ fprintf(ficresfb,"\n"); fprintf(ficresfb,"\n# Back Forecasting at date %.lf/%.lf/%.lf ",jback1,mback1,anback1+yearp); - /* printf("\n# Back Forecasting at date %.lf/%.lf/%.lf ",jback1,mback1,anback1+yearp); */ + printf("\n# Back Forecasting at date %.lf/%.lf/%.lf ",jback1,mback1,anback1+yearp); /* for (agec=bage; agec<=agemax-1; agec++){ /\* testing *\/ */ for (agec=bage; agec<=fage; agec++){ /* testing */ /* We compute bij at age agec over nhstepm, nhstepm decreases when agec increases because of agemax;*/ - nhstepm=(int) rint((agec-agelim)*YEARM/stepm); + nhstepm=(int) (agec-agelim) *YEARM/stepm;/* nhstepm=(int) rint((agec-agelim)*YEARM/stepm);*/ nhstepm = nhstepm/hstepm; p3mat=ma3x(1,nlstate+ndeath,1, nlstate+ndeath, 0,nhstepm); oldm=oldms;savm=savms; /* computes hbxij at age agec over 1 to nhstepm */ + /* printf("####prevbackforecast debug agec=%.2f nhstepm=%d\n",agec, nhstepm);fflush(stdout); */ hbxij(p3mat,nhstepm,agec,hstepm,p,prevacurrent,nlstate,stepm, k, nres); /* hpxij(p3mat,nhstepm,agec,hstepm,p, nlstate,stepm,oldm,savm, k,nres); */ /* Then we print p3mat for h corresponding to the right agec+h*stepms=yearp */