--- imach/src/imach.c 2019/05/09 14:17:20 1.292 +++ imach/src/imach.c 2019/05/09 15:17:34 1.293 @@ -1,6 +1,9 @@ -/* $Id: imach.c,v 1.292 2019/05/09 14:17:20 brouard Exp $ +/* $Id: imach.c,v 1.293 2019/05/09 15:17:34 brouard Exp $ $State: Exp $ $Log: imach.c,v $ + Revision 1.293 2019/05/09 15:17:34 brouard + *** empty log message *** + Revision 1.292 2019/05/09 14:17:20 brouard Summary: Some updates @@ -1084,12 +1087,12 @@ typedef struct { #define ODIRSEPARATOR '\\' #endif -/* $Id: imach.c,v 1.292 2019/05/09 14:17:20 brouard Exp $ */ +/* $Id: imach.c,v 1.293 2019/05/09 15:17:34 brouard Exp $ */ /* $State: Exp $ */ #include "version.h" char version[]=__IMACH_VERSION__; char copyright[]="April 2018,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.292 $ $Date: 2019/05/09 14:17:20 $"; +char fullversion[]="$Revision: 1.293 $ $Date: 2019/05/09 15:17:34 $"; char strstart[80]; char optionfilext[10], optionfilefiname[FILENAMELENGTH]; int erreur=0, nberr=0, nbwarn=0; /* Error number, number of errors number of warnings */ @@ -2966,8 +2969,24 @@ double **pmij(double **ps, double *cov, ps[ii][ii]=1; } } - - + /* Added for backcast */ /* Transposed matrix too */ + for(jj=1; jj<= nlstate+ndeath; jj++){ + s1=0.; + for(ii=1; ii<= nlstate+ndeath; ii++){ + s1+=ps[ii][jj]; + } + for(ii=1; ii<= nlstate; ii++){ + ps[ii][jj]=ps[ii][jj]/s1; + } + } + /* Transposition */ + for(jj=1; jj<= nlstate+ndeath; jj++){ + for(ii=jj; ii<= nlstate+ndeath; ii++){ + s1=ps[ii][jj]; + ps[ii][jj]=ps[jj][ii]; + ps[jj][ii]=s1; + } + } /* for(ii=1; ii<= nlstate+ndeath; ii++){ */ /* for(jj=1; jj<= nlstate+ndeath; jj++){ */ /* printf(" pmij ps[%d][%d]=%lf ",ii,jj,ps[ii][jj]); */ @@ -10787,7 +10806,7 @@ int main(int argc, char *argv[]) int *tab; int mobilavproj=0 , prevfcast=0 ; /* moving average of prev, If prevfcast=1 prevalence projection */ - /* int backcast=0; */ /* defined as global for mlikeli and mle */ + int backcast=0; /* defined as global for mlikeli and mle*/ int mobilav=0,popforecast=0; int hstepm=0, nhstepm=0; int agemortsup;