--- imach/src/imach.c 2016/08/26 14:23:35 1.238 +++ imach/src/imach.c 2016/08/26 15:51:03 1.239 @@ -1,6 +1,11 @@ -/* $Id: imach.c,v 1.238 2016/08/26 14:23:35 brouard Exp $ +/* $Id: imach.c,v 1.239 2016/08/26 15:51:03 brouard Exp $ $State: Exp $ $Log: imach.c,v $ + Revision 1.239 2016/08/26 15:51:03 brouard + Summary: Improvement in Powell output in order to copy and paste + + Author: + Revision 1.238 2016/08/26 14:23:35 brouard Summary: Starting tests of 0.99 @@ -914,12 +919,12 @@ typedef struct { #define ODIRSEPARATOR '\\' #endif -/* $Id: imach.c,v 1.238 2016/08/26 14:23:35 brouard Exp $ */ +/* $Id: imach.c,v 1.239 2016/08/26 15:51:03 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.238 $ $Date: 2016/08/26 14:23:35 $"; +char fullversion[]="$Revision: 1.239 $ $Date: 2016/08/26 15:51:03 $"; char strstart[80]; char optionfilext[10], optionfilefiname[FILENAMELENGTH]; int erreur=0, nberr=0, nbwarn=0; /* Error number, number of errors number of warnings */ @@ -2064,7 +2069,7 @@ void powell(double p[], double **xi, int void linmin(double p[], double xi[], int n, double *fret, double (*func)(double []),int *flat); #endif - int i,ibig,j; + int i,ibig,j,jk,k; double del,t,*pt,*ptt,*xit; double directest; double fp,fptt; @@ -2096,13 +2101,49 @@ void powell(double p[], double **xi, int fprintf(ficlog,"\nPowell iter=%d -2*LL=%.12f %ld sec. %ld sec.",*iter,*fret,rcurr_time-rlast_time, rcurr_time-rstart_time); fflush(ficlog); /* fprintf(ficrespow,"%d %.12f %ld",*iter,*fret,curr_time.tm_sec-start_time.tm_sec); */ for (i=1;i<=n;i++) { - printf(" %d %.12f",i, p[i]); - fprintf(ficlog," %d %.12lf",i, p[i]); fprintf(ficrespow," %.12lf", p[i]); } + fprintf(ficrespow,"\n");fflush(ficrespow); + printf("\n#model= 1 + age "); + fprintf(ficlog,"\n#model= 1 + age "); + if(nagesqr==1){ + printf(" + age*age ",Tvar[j]); + fprintf(ficlog," + age*age ",Tvar[j]); + } + for(j=1;j <=ncovmodel-2;j++){ + if(Typevar[j]==0) { + printf(" + V%d ",Tvar[j]); + fprintf(ficlog," + V%d ",Tvar[j]); + }else if(Typevar[j]==1) { + printf(" + V%d*age ",Tvar[j]); + fprintf(ficlog," + V%d*age ",Tvar[j]); + }else if(Typevar[j]==2) { + printf(" + V%d*V%d ",Tvard[Tposprod[j]][1],Tvard[Tposprod[j]][2]); + fprintf(ficlog," + V%d*V%d ",Tvard[Tposprod[j]][1],Tvard[Tposprod[j]][2]); + } + } printf("\n"); +/* printf("12 47.0114589 0.0154322 33.2424412 0.3279905 2.3731903 */ +/* 13 -21.5392400 0.1118147 1.2680506 1.2973408 -1.0663662 */ fprintf(ficlog,"\n"); - fprintf(ficrespow,"\n");fflush(ficrespow); + for(i=1,jk=1; i <=nlstate; i++){ + for(k=1; k <=(nlstate+ndeath); k++){ + if (k != i) { + printf("%d%d ",i,k); + fprintf(ficlog,"%d%d ",i,k); + fprintf(ficres,"%1d%1d ",i,k); + for(j=1; j <=ncovmodel; j++){ + printf("%12.7f ",p[jk]); + fprintf(ficlog,"%12.7f ",p[jk]); + fprintf(ficres,"%12.7f ",p[jk]); + jk++; + } + printf("\n"); + fprintf(ficlog,"\n"); + fprintf(ficres,"\n"); + } + } + } if(*iter <=3){ tml = *localtime(&rcurr_time); strcpy(strcurr,asctime(&tml));