--- imach/src/imach.c 2014/12/16 10:30:11 1.163 +++ imach/src/imach.c 2014/12/16 10:52:11 1.164 @@ -1,6 +1,11 @@ -/* $Id: imach.c,v 1.163 2014/12/16 10:30:11 brouard Exp $ +/* $Id: imach.c,v 1.164 2014/12/16 10:52:11 brouard Exp $ $State: Exp $ $Log: imach.c,v $ + Revision 1.164 2014/12/16 10:52:11 brouard + Summary: Merging with Visual C after suppressing some warnings for unused variables. Also fixing Saito's bug 0.98Xn + + * imach.c (Module): Merging 1.61 to 1.162 + Revision 1.163 2014/12/16 10:30:11 brouard * imach.c (Module): Merging 1.61 to 1.162 @@ -557,7 +562,7 @@ typedef struct { #define YEARM 12. /**< Number of months per year */ #define AGESUP 130 #define AGEBASE 40 -#define AGEGOMP 10. /**< Minimal age for Gompertz adjustment */ +#define AGEGOMP 10 /**< Minimal age for Gompertz adjustment */ #ifdef _WIN32 #define DIRSEPARATOR '\\' #define CHARSEPARATOR "\\" @@ -568,11 +573,11 @@ typedef struct { #define ODIRSEPARATOR '\\' #endif -/* $Id: imach.c,v 1.163 2014/12/16 10:30:11 brouard Exp $ */ +/* $Id: imach.c,v 1.164 2014/12/16 10:52:11 brouard Exp $ */ /* $State: Exp $ */ char version[]="Imach version 0.99, September 2014,INED-EUROREVES-Institut de longevite-Japan Society for the Promotion of Science (Grant-in-Aid for Scientific Research 25293121)"; -char fullversion[]="$Revision: 1.163 $ $Date: 2014/12/16 10:30:11 $"; +char fullversion[]="$Revision: 1.164 $ $Date: 2014/12/16 10:52:11 $"; char strstart[80]; char optionfilext[10], optionfilefiname[FILENAMELENGTH]; int erreur=0, nberr=0, nbwarn=0; /* Error number, number of errors number of warnings */ @@ -1149,7 +1154,7 @@ double brent(double ax, double bx, doubl int iter; double a,b,d,etemp; double fu=0,fv,fw,fx; - double ftemp; + double ftemp=0.; double p,q,r,tol1,tol2,u,v,w,x,xm; double e=0.0; @@ -1383,8 +1388,8 @@ void powell(double p[], double **xi, int for (j=1;j<=n;j++) xit[j]=xi[j][i]; fptt=(*fret); #ifdef DEBUG - printf("fret=%lf \n",*fret); - fprintf(ficlog,"fret=%lf \n",*fret); + printf("fret=%lf, %lf, %lf \n", *fret, *fret, *fret); + fprintf(ficlog, "fret=%lf, %lf, %lf \n", *fret, *fret, *fret); #endif printf("%d",i);fflush(stdout); fprintf(ficlog,"%d",i);fflush(ficlog); @@ -1481,6 +1486,8 @@ void powell(double p[], double **xi, int fprintf(ficlog,"Gaining to use average direction of P0 P%d instead of biggest increase direction :\n",n,ibig); #ifdef DEBUG + printf("Direction changed last moved %d in place of ibig=%d, new last is the average:\n",n,ibig); + fprintf(ficlog,"Direction changed last moved %d in place of ibig=%d, new last is the average:\n",n,ibig); for(j=1;j<=n;j++){ printf(" %.12e",xit[j]); fprintf(ficlog," %.12e",xit[j]); @@ -1577,7 +1584,7 @@ double **pmij(double **ps, double *cov, */ double s1, lnpijopii; /*double t34;*/ - int i,j,j1, nc, ii, jj; + int i,j, nc, ii, jj; for(i=1; i<= nlstate; i++){ for(j=1; jkhi/nkhif) || (k2 >khi/nkhif)){ /* Keeps lastvalue before 3.84/2 KHI2 5% 1d.f. */ - k=kmax; l=lmax*10.; + k=kmax; l=lmax*10; } else if((k1 >khi/nkhi) || (k2 >khi/nkhi)){ delts=delt; @@ -2365,7 +2372,7 @@ double hessii(double x[], double delta, double hessij( double x[], double delti[], int thetai,int thetaj,double (*func)(double []),int npar) { int i; - int l=1, l1, lmax=20; + int l=1, lmax=20; double k1,k2,k3,k4,res,fx; double p2[MAXPARM+1]; int k; @@ -2480,7 +2487,7 @@ void pstamp(FILE *fichier) void freqsummary(char fileres[], int iagemin, int iagemax, int **s, double **agev, int nlstate, int imx, int *Tvaraff, int **nbcode, int *ncodemax,double **mint,double **anint, char strstart[]) { /* Some frequencies */ - int i, m, jk, k1,i1, j1, bool, z1,j; + int i, m, jk, j1, bool, z1,j; int first; double ***freq; /* Frequencies */ double *pp, **prop; @@ -2661,10 +2668,10 @@ void prevalence(double ***probs, double We still use firstpass and lastpass as another selection. */ - int i, m, jk, k1, i1, j1, bool, z1,j; - double ***freq; /* Frequencies */ - double *pp, **prop; - double pos,posprop; + int i, m, jk, j1, bool, z1,j; + + double **prop; + double posprop; double y2; /* in fractional years */ int iagemin, iagemax; int first; /** to stop verbosity which is redirected to log file */ @@ -2755,7 +2762,7 @@ void concatwav(int wav[], int **dh, int int j, k=0,jk, ju, jl; double sum=0.; first=0; - jmin=1e+5; + jmin=100000; jmax=-1; jmean=0.; for(i=1; i<=imx; i++){ @@ -2995,7 +3002,7 @@ void evsij(double ***eij, double x[], in { /* Health expectancies, no variances */ - int i, j, nhstepm, hstepm, h, nstepm, k, cptj, cptj2, i2, j2; + int i, j, nhstepm, hstepm, h, nstepm; int nhstepma, nstepma; /* Decreasing with age */ double age, agelim, hf; double ***p3mat; @@ -3317,7 +3324,7 @@ void varevsij(char optionfilefiname[], d double **dnewm,**doldm; double **dnewmp,**doldmp; int i, j, nhstepm, hstepm, h, nstepm ; - int k, cptcode; + int k; double *xp; double **gp, **gm; /* for var eij */ double ***gradg, ***trgradg; /*for var eij */ @@ -3617,10 +3624,9 @@ void varprevlim(char fileres[], double * { /* Variance of prevalence limit */ /* double **prevalim(double **prlim, int nlstate, double *xp, double age, double **oldm, double **savm,double ftolpl);*/ - double **newm; + double **dnewm,**doldm; int i, j, nhstepm, hstepm; - int k, cptcode; double *xp; double *gp, *gm; double **gradg, **trgradg; @@ -3699,9 +3705,9 @@ void varprevlim(char fileres[], double * /************ Variance of one-step probabilities ******************/ void varprob(char optionfilefiname[], double **matcov, double x[], double delti[], int nlstate, double bage, double fage, int ij, int *Tvar, int **nbcode, int *ncodemax, char strstart[]) { - int i, j=0, i1, k1, l1, t, tj; + int i, j=0, k1, l1, tj; int k2, l2, j1, z1; - int k=0,l, cptcode; + int k=0, l; int first=1, first1, first2; double cv12, mu1, mu2, lc1, lc2, v12, v21, v11, v22,v1,v2, c12, tnalp; double **dnewm,**doldm; @@ -3709,7 +3715,7 @@ void varprob(char optionfilefiname[], do double *gp, *gm; double **gradg, **trgradg; double **mu; - double age,agelim, cov[NCOVMAX+1]; + double age, cov[NCOVMAX+1]; double std=2.0; /* Number of standard deviation wide of confidence ellipsoids */ int theta; char fileresprob[FILENAMELENGTH]; @@ -4081,7 +4087,7 @@ fprintf(fichtm," \n