Diff for /imach/src/imach.c between versions 1.187 and 1.189

version 1.187, 2015/04/29 09:11:15 version 1.189, 2015/04/30 14:45:16
Line 1 Line 1
 /* $Id$  /* $Id$
   $State$    $State$
   $Log$    $Log$
     Revision 1.189  2015/04/30 14:45:16  brouard
     Summary: 0.98q2
   
     Revision 1.188  2015/04/30 08:27:53  brouard
     *** empty log message ***
   
   Revision 1.187  2015/04/29 09:11:15  brouard    Revision 1.187  2015/04/29 09:11:15  brouard
   *** empty log message ***    *** empty log message ***
   
Line 678  typedef struct { Line 684  typedef struct {
 /* $Id$ */  /* $Id$ */
 /* $State$ */  /* $State$ */
   
 char version[]="Imach version 0.98q1, April 2015,INED-EUROREVES-Institut de longevite-Japan Society for the Promotion of Science (Grant-in-Aid for Scientific Research 25293121), Intel Software 2015";  char version[]="Imach version 0.98q2, April 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$ $Date$";   char fullversion[]="$Revision$ $Date$"; 
 char strstart[80];  char strstart[80];
 char optionfilext[10], optionfilefiname[FILENAMELENGTH];  char optionfilext[10], optionfilefiname[FILENAMELENGTH];
Line 1563  void linmin(double p[], double xi[], int Line 1569  void linmin(double p[], double xi[], int
   printf("retour brent fret=%.12e xmin=%.12e\n",*fret,xmin);    printf("retour brent fret=%.12e xmin=%.12e\n",*fret,xmin);
   fprintf(ficlog,"retour brent fret=%.12e xmin=%.12e\n",*fret,xmin);    fprintf(ficlog,"retour brent fret=%.12e xmin=%.12e\n",*fret,xmin);
 #endif  #endif
   printf("linmin end ");    /* printf("linmin end "); */
   for (j=1;j<=n;j++) {     for (j=1;j<=n;j++) { 
     printf(" before xi[%d]=%12.8f", j,xi[j]);      /* printf(" before xi[%d]=%12.8f", j,xi[j]); */
     xi[j] *= xmin; /* xi rescaled by xmin: if xmin=-1.237 and xi=(1,0,...,0) xi=(-1.237,0,...,0) */      xi[j] *= xmin; /* xi rescaled by xmin: if xmin=-1.237 and xi=(1,0,...,0) xi=(-1.237,0,...,0) */
     if(xxs <1.0)      /* if(xxs <1.0) */
       printf(" after xi[%d]=%12.8f, xmin=%12.8f, ax=%12.8f, xx=%12.8f, bx=%12.8f, xxs=%12.8f", j,xi[j], xmin, ax, xx, bx,xxs );      /*   printf(" after xi[%d]=%12.8f, xmin=%12.8f, ax=%12.8f, xx=%12.8f, bx=%12.8f, xxs=%12.8f", j,xi[j], xmin, ax, xx, bx,xxs ); */
     p[j] += xi[j]; /* Parameters values are updated accordingly */      p[j] += xi[j]; /* Parameters values are updated accordingly */
   }     } 
   printf("\n");    /* printf("\n"); */
     /* printf("Comparing last *frec(xmin)=%12.8f from Brent and frec(0.)=%12.8f \n", *fret, (*func)(p)); */
   free_vector(xicom,1,n);     free_vector(xicom,1,n); 
   free_vector(pcom,1,n);     free_vector(pcom,1,n); 
 }   } 
Line 1653  void powell(double p[], double **xi, int Line 1660  void powell(double p[], double **xi, int
 #endif  #endif
           printf("%d",i);fflush(stdout); /* print direction (parameter) i */            printf("%d",i);fflush(stdout); /* print direction (parameter) i */
       fprintf(ficlog,"%d",i);fflush(ficlog);        fprintf(ficlog,"%d",i);fflush(ficlog);
       linmin(p,xit,n,fret,func); /* Point p[n]. xit[n] has been loaded for direction i as input. Outputs are fret(new point p) p is updated and xit rescaled */        linmin(p,xit,n,fret,func); /* Point p[n]. xit[n] has been loaded for direction i as input.*/
       if (fabs(fptt-(*fret)) > del) { /* We are keeping the max gain on each of the n directions                                       /* Outputs are fret(new point p) p is updated and xit rescaled */
                                        because that direction will be replaced unless the gain del is small        if (fabs(fptt-(*fret)) > del) { /* We are keeping the max gain on each of the n directions */
                                       in comparison with the 'probable' gain, mu^2, with the last average direction.          /* because that direction will be replaced unless the gain del is small */
                                       Unless the n directions are conjugate some gain in the determinant may be obtained          /* in comparison with the 'probable' gain, mu^2, with the last average direction. */
                                       with the new direction.          /* Unless the n directions are conjugate some gain in the determinant may be obtained */
                                       */          /* with the new direction. */
         del=fabs(fptt-(*fret));           del=fabs(fptt-(*fret)); 
         ibig=i;           ibig=i; 
       }         } 
Line 1680  void powell(double p[], double **xi, int Line 1687  void powell(double p[], double **xi, int
 #endif  #endif
     } /* end loop on each direction i */      } /* end loop on each direction i */
     /* Convergence test will use last linmin estimation (fret) and compare former iteration (fp) */       /* Convergence test will use last linmin estimation (fret) and compare former iteration (fp) */ 
     /* But p and xit have been updated at the end of linmin and do not produce *fret any more! */      /* But p and xit have been updated at the end of linmin, *fret corresponds to new p, xit  */
     /* New value of last point Pn is not computed, P(n-1) */      /* New value of last point Pn is not computed, P(n-1) */
     if (2.0*fabs(fp-(*fret)) <= ftol*(fabs(fp)+fabs(*fret))) { /* Did we reach enough precision? */      if (2.0*fabs(fp-(*fret)) <= ftol*(fabs(fp)+fabs(*fret))) { /* Did we reach enough precision? */
         /* We could compare with a chi^2. chisquare(0.95,ddl=1)=3.84 */
         /* By adding age*age in a model, the new -2LL should be lower and the difference follows a */
         /* a chisquare statistics with 1 degree. To be significant at the 95% level, it should have */
         /* decreased of more than 3.84  */
         /* By adding age*age and V1*age the gain (-2LL) should be more than 5.99 (ddl=2) */
         /* By using V1+V2+V3, the gain should be  7.82, compared with basic 1+age. */
         /* By adding 10 parameters more the gain should be 18.31 */
   
         /* Starting the program with initial values given by a former maximization will simply change */
         /* the scales of the directions and the directions, because the are reset to canonical directions */
         /* Thus the first calls to linmin will give new points and better maximizations until fp-(*fret) is */
         /* under the tolerance value. If the tolerance is very small 1.e-9, it could last long.  */
 #ifdef DEBUG  #ifdef DEBUG
       int k[2],l;        int k[2],l;
       k[0]=1;        k[0]=1;

Removed from v.1.187  
changed lines
  Added in v.1.189


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>