--- imach/src/imach.c 2015/10/23 15:50:53 1.205 +++ imach/src/imach.c 2015/10/24 07:14:11 1.206 @@ -1,6 +1,9 @@ -/* $Id: imach.c,v 1.205 2015/10/23 15:50:53 brouard Exp $ +/* $Id: imach.c,v 1.206 2015/10/24 07:14:11 brouard Exp $ $State: Exp $ $Log: imach.c,v $ + Revision 1.206 2015/10/24 07:14:11 brouard + *** empty log message *** + Revision 1.205 2015/10/23 15:50:53 brouard Summary: 0.98r3 some clarification for graphs on likelihood contributions @@ -751,12 +754,12 @@ typedef struct { #define ODIRSEPARATOR '\\' #endif -/* $Id: imach.c,v 1.205 2015/10/23 15:50:53 brouard Exp $ */ +/* $Id: imach.c,v 1.206 2015/10/24 07:14:11 brouard Exp $ */ /* $State: Exp $ */ #include "version.h" char version[]=__IMACH_VERSION__; char copyright[]="October 2015,INED-EUROREVES-Institut de longevite-Japan Society for the Promotion of Science (Grant-in-Aid for Scientific Research 25293121), Intel Software 2015"; -char fullversion[]="$Revision: 1.205 $ $Date: 2015/10/23 15:50:53 $"; +char fullversion[]="$Revision: 1.206 $ $Date: 2015/10/24 07:14:11 $"; char strstart[80]; char optionfilext[10], optionfilefiname[FILENAMELENGTH]; int erreur=0, nberr=0, nbwarn=0; /* Error number, number of errors number of warnings */ @@ -1960,7 +1963,24 @@ double **prevalim(double **prlim, int nl { /* Computes the prevalence limit in each live state at age x by left multiplying the unit matrix by transitions matrix until convergence is reached with precision ftolpl */ - + /* Wx= Wx-1 Px-1= Wx-2 Px-2 Px-1 = Wx-n Px-n ... Px-2 Px-1 I */ + /* Wx is row vector: population in state 1, population in state 2, population dead */ + /* or prevalence in state 1, prevalence in state 2, 0 */ + /* newm is the matrix after multiplications, its rows are identical at a factor */ + /* Initial matrix pimij */ + /* {0.85204250825084937, 0.13044499163996345, 0.017512500109187184, */ + /* 0.090851990222114765, 0.88271245433047185, 0.026435555447413338, */ + /* 0, 0 , 1} */ + /* + * and after some iteration: */ + /* {0.45504275246439968, 0.42731458730878791, 0.11764266022681241, */ + /* 0.45201005341706885, 0.42865420071559901, 0.11933574586733192, */ + /* 0, 0 , 1} */ + /* And prevalence by suppressing the deaths are close to identical rows in prlim: */ + /* {0.51571254859325999, 0.4842874514067399, */ + /* 0.51326036147820708, 0.48673963852179264} */ + /* If we start from prlim again, prlim tends to a constant matrix */ + int i, ii,j,k; double min, max, maxmin, maxmax,sumnew=0.; /* double **matprod2(); */ /* test */ @@ -2016,13 +2036,13 @@ double **prevalim(double **prlim, int nl prlim[i][j]= newm[i][j]/(1-sumnew); max=FMAX(max,prlim[i][j]); min=FMIN(min,prlim[i][j]); - /* printf(" age= %d prevalim i=%d, j=%d, prmlim[%d][%d]=%f, agefin=%d max=%f min=%f\n", (int)age, i, j, i, j, prlim[i][j],(int)agefin, max, min); */ + printf(" age= %d prevalim i=%d, j=%d, prmlim[%d][%d]=%f, agefin=%d max=%f min=%f\n", (int)age, i, j, i, j, prlim[i][j],(int)agefin, max, min); } maxmin=(max-min)/(max+min)*2; maxmax=FMAX(maxmax,maxmin); } /* j loop */ *ncvyear= (int)age- (int)agefin; - /* printf("maxmax=%lf maxmin=%lf ncvloop=%ld, age=%d, agefin=%d ncvyear=%d \n", maxmax, maxmin, ncvloop, (int)age, (int)agefin, *ncvyear); */ + printf("maxmax=%lf maxmin=%lf ncvloop=%ld, age=%d, agefin=%d ncvyear=%d \n", maxmax, maxmin, ncvloop, (int)age, (int)agefin, *ncvyear); if(maxmax < ftolpl){ /* printf("maxmax=%lf maxmin=%lf ncvloop=%ld, age=%d, agefin=%d ncvyear=%d \n", maxmax, maxmin, ncvloop, (int)age, (int)agefin, *ncvyear); */ return prlim;