]> henry.ined.fr Git - .git/commitdiff
(Module): Now imach stops if date of birth, at least year of birth, is not given...
authorN. Brouard <brouard@ined.fr>
Thu, 29 Oct 2009 15:33:14 +0000 (15:33 +0000)
committerN. Brouard <brouard@ined.fr>
Thu, 29 Oct 2009 15:33:14 +0000 (15:33 +0000)
src/imach.c

index da7d6974ebc514d414f13cb972754fb6871722eb..d6ca1828f86f3a1774bedf3f38564b0184e18596 100644 (file)
@@ -1,6 +1,9 @@
 /* $Id$
   $State$
   $Log$
+  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.
+
   Revision 1.133  2009/07/06 10:21:25  brouard
   just nforces
 
@@ -3482,6 +3485,13 @@ To be simple, these graphs help to understand the significativity of each parame
                  /* 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 */