--- imach/src/imach.c 2009/10/29 13:18:53 1.134 +++ imach/src/imach.c 2009/10/29 15:33:14 1.135 @@ -1,6 +1,9 @@ -/* $Id: imach.c,v 1.134 2009/10/29 13:18:53 brouard Exp $ +/* $Id: imach.c,v 1.135 2009/10/29 15:33:14 brouard Exp $ $State: Exp $ $Log: imach.c,v $ + Revision 1.135 2009/10/29 15:33:14 brouard + (Module): Now imach stops if date of birth, at least year of birth, is not given. Some cleaning of the code. + Revision 1.134 2009/10/29 13:18:53 brouard (Module): Now imach stops if date of birth, at least year of birth, is not given. Some cleaning of the code. @@ -406,11 +409,11 @@ extern int errno; #define ODIRSEPARATOR '/' #endif -/* $Id: imach.c,v 1.134 2009/10/29 13:18:53 brouard Exp $ */ +/* $Id: imach.c,v 1.135 2009/10/29 15:33:14 brouard Exp $ */ /* $State: Exp $ */ char version[]="Imach version 0.98l, October 2009, INED-EUROREVES-Institut de longevite "; -char fullversion[]="$Revision: 1.134 $ $Date: 2009/10/29 13:18:53 $"; +char fullversion[]="$Revision: 1.135 $ $Date: 2009/10/29 15:33:14 $"; char strstart[80]; char optionfilext[10], optionfilefiname[FILENAMELENGTH]; int erreur=0, nberr=0, nbwarn=0; /* Error number, number of errors number of warnings */ @@ -3485,6 +3488,13 @@ To be simple, these graphs help to under /* Computing eigen value of matrix of covariance */ lc1=((v1+v2)+sqrt((v1+v2)*(v1+v2) - 4*(v1*v2-cv12*cv12)))/2.; lc2=((v1+v2)-sqrt((v1+v2)*(v1+v2) - 4*(v1*v2-cv12*cv12)))/2.; + if ((lc2 <0) || (lc1 <0) ){ + printf("Error: One eigen value of 2x2 matrix of covariance is negative, lc1=%11.3e, lc2=%11.3e, v1=%11.3e, v2=%11.3e, cv12=%11.3e.\n It means that the matrix was not well estimated (varpij), for i=%2d, j=%2d, age=%4d .\n See files %s and %s. Continuing by making them positive: WRONG RESULTS.\n", lc1, lc2, v1, v2, cv12, i, j, (int)age,fileresprobcov, fileresprobcor); + fprintf(ficlog,"Error: One eigen value of 2x2 matrix of covariance is negative, lc1=%11.3e, lc2=%11.3e, v1=%11.3e, v2=%11.3e, cv12=%11.3e\n", lc1, lc2, v1, v2, cv12);fflush(ficlog); + lc1=fabs(lc1); + lc2=fabs(lc2); + } + /* Eigen vectors */ v11=(1./sqrt(1+(v1-lc1)*(v1-lc1)/cv12/cv12)); /*v21=sqrt(1.-v11*v11); *//* error */