Diff for /imach/src/imach.c between versions 1.365 and 1.366

version 1.365, 2024/06/28 13:53:38 version 1.366, 2024/07/02 09:42:10
Line 1 Line 1
 /* $Id$  /* $Id$
   $State$    $State$
   $Log$    $Log$
     Revision 1.366  2024/07/02 09:42:10  brouard
     Summary: trying clang on Linux
   
   Revision 1.365  2024/06/28 13:53:38  brouard    Revision 1.365  2024/06/28 13:53:38  brouard
   * imach.c (Module): fixing some bugs in gnuplot and quantitative variables, but not completely solved    * imach.c (Module): fixing some bugs in gnuplot and quantitative variables, but not completely solved
   
Line 1483  int countcallfunc=0;  /* Count the numbe Line 1486  int countcallfunc=0;  /* Count the numbe
 int selected(int kvar); /* Is covariate kvar selected for printing results */  int selected(int kvar); /* Is covariate kvar selected for printing results */
   
 double jmean=1; /* Mean space between 2 waves */  double jmean=1; /* Mean space between 2 waves */
 double **matprod2(); /* test */  double **matprod2(double **out, double **in,int nrl, int nrh, int ncl, int nch, int ncolol, int ncoloh, double **b); /* test */
   /* double **matprod2();  *//* test */
 double **oldm, **newm, **savm; /* Working pointers to matrices */  double **oldm, **newm, **savm; /* Working pointers to matrices */
 double **oldms, **newms, **savms; /* Fixed working pointers to matrices */  double **oldms, **newms, **savms; /* Fixed working pointers to matrices */
 double   **ddnewms, **ddoldms, **ddsavms; /* for freeing later */  double   **ddnewms, **ddoldms, **ddsavms; /* for freeing later */
Line 1530  char optionfilegnuplot[FILENAMELENGTH], Line 1534  char optionfilegnuplot[FILENAMELENGTH],
 /* struct timeval start_time, end_time, curr_time, last_time, forecast_time; */  /* struct timeval start_time, end_time, curr_time, last_time, forecast_time; */
 /* struct timezone tzp; */  /* struct timezone tzp; */
 /* extern int gettimeofday(); */  /* extern int gettimeofday(); */
 struct tm tml, *gmtime(), *localtime();  
   
 extern time_t time();  /* extern time_t time(); */ /* Commented out for clang */
   /* struct tm tml, *gmtime(), *localtime(); */
   
   
 struct tm start_time, end_time, curr_time, last_time, forecast_time;  struct tm start_time, end_time, curr_time, last_time, forecast_time;
 time_t  rstart_time, rend_time, rcurr_time, rlast_time, rforecast_time; /* raw time */  time_t  rstart_time, rend_time, rcurr_time, rlast_time, rforecast_time; /* raw time */
 time_t   rlast_btime; /* raw time */  time_t   rlast_btime; /* raw time */
 struct tm tm;  /* struct tm tm; */
   struct tm tm, tml;
   
 char strcurr[80], strfor[80];  char strcurr[80], strfor[80];
   
Line 2001  int nboccstr(char *textin, char *chain) Line 2007  int nboccstr(char *textin, char *chain)
   /*  in="+V7*V4+age*V2+age*V3+age*V4"  chain="age" */    /*  in="+V7*V4+age*V2+age*V3+age*V4"  chain="age" */
   char *strloc;    char *strloc;
       
   int i,j=0;    int j=0;
   
   i=0;  
   
   strloc=textin; /* strloc points to "^+V7*V4+age+..." in textin */    strloc=textin; /* strloc points to "^+V7*V4+age+..." in textin */
   for(;;) {    for(;;) {
Line 2137  int **imatrix(long nrl, long nrh, long n Line 2141  int **imatrix(long nrl, long nrh, long n
 }   } 
   
 /****************** free_imatrix *************************/  /****************** free_imatrix *************************/
 void free_imatrix(m,nrl,nrh,ncl,nch)  /* void free_imatrix(m,nrl,nrh,ncl,nch); */
       int **m;  /*       int **m; */
       long nch,ncl,nrh,nrl;   /*       long nch,ncl,nrh,nrl; */
      /* free an int matrix allocated by imatrix() */   void free_imatrix(int **m,long nrl, long nrh, long ncl, long nch)
 {        /* free an int matrix allocated by imatrix() */
   free((FREE_ARG) (m[nrl]+ncl-NR_END));   {
   free((FREE_ARG) (m+nrl-NR_END));     free((FREE_ARG) (m[nrl]+ncl-NR_END));
 }     free((FREE_ARG) (m+nrl-NR_END));
   }
   
 /******************* matrix *******************************/  /******************* matrix *******************************/
 double **matrix(long nrl, long nrh, long ncl, long nch)  double **matrix(long nrl, long nrh, long ncl, long nch)
Line 2404  values at the three points, fa, fb , and Line 2409  values at the three points, fa, fb , and
   double ulim,u,r,q, dum;    double ulim,u,r,q, dum;
   double fu;     double fu; 
   
   double scale=10.;    /* double scale=10.; */
   int iterscale=0;    /* int iterscale=0; */
   
   *fa=(*func)(*ax); /*  xta[j]=pcom[j]+(*ax)*xicom[j]; fa=f(xta[j])*/    *fa=(*func)(*ax); /*  xta[j]=pcom[j]+(*ax)*xicom[j]; fa=f(xta[j])*/
   *fb=(*func)(*bx); /*  xtb[j]=pcom[j]+(*bx)*xicom[j]; fb=f(xtb[j]) */    *fb=(*func)(*bx); /*  xtb[j]=pcom[j]+(*bx)*xicom[j]; fb=f(xtb[j]) */
Line 2795  double *e; /* used in minfit, don't konw Line 2800  double *e; /* used in minfit, don't konw
 static int prin; /* added */  static int prin; /* added */
 static int n;  static int n;
 static double *x;  static double *x;
 static double (*fun)();  static double (*fun)(double *x); /* New for clang */
   /* static double (*fun)(); */
 /* static double (*fun)(double *x, int n); */  /* static double (*fun)(double *x, int n); */
   
 /* these will be set by praxis to the global control parameters */  /* these will be set by praxis to the global control parameters */
Line 3020  static void print()  /* print a line of Line 3026  static void print()  /* print a line of
 /* static void print2(int n, double *x, int prin, double fx, int nf, int nl) */ /* print a line of traces */  /* static void print2(int n, double *x, int prin, double fx, int nf, int nl) */ /* print a line of traces */
 static void print2() /* print a line of traces */  static void print2() /* print a line of traces */
 {  {
   int i; double fmin=0.;    int i; /* double fmin=0.; */
   
    /* printf("\n"); */     /* printf("\n"); */
    /* printf("... chi square reduced to ... %20.10e\n", fx); */     /* printf("... chi square reduced to ... %20.10e\n", fx); */
Line 3799  next: Line 3805  next:
 #ifdef NR_SHIFT  #ifdef NR_SHIFT
           fx = (*fun)((x-1), n);            fx = (*fun)((x-1), n);
 #else  #else
           fx = (*fun)(x, n);            fx = (*fun)(x);
 #endif  #endif
           /* fx = (*func) ( (x-1) ); *//* This for func which is computed from x[1] and not from x[0] xm1=(x-1)*/            /* fx = (*func) ( (x-1) ); *//* This for func which is computed from x[1] and not from x[0] xm1=(x-1)*/
           nf++;            nf++;
Line 4593  void powell(double p[], double **xi, int Line 4599  void powell(double p[], double **xi, int
           
     int i, ii,j,k, k1;      int i, ii,j,k, k1;
   double *min, *max, *meandiff, maxmax,sumnew=0.;    double *min, *max, *meandiff, maxmax,sumnew=0.;
   /* double **matprod2(); */ /* test */    double **matprod2(double **out, double **in,int nrl, int nrh, int ncl, int nch, int ncolol, int ncoloh, double **b); /* test */ /* for clang */
   double **out, cov[NCOVMAX+1], **pmij(); /* **pmmij is a global variable feeded with oldms etc */  /* double **matprod2(); */ /* test */
     /* double **out, cov[NCOVMAX+1], **pmij(); */ /* **pmmij is a global variable feeded with oldms etc */
     double **out, cov[NCOVMAX+1], **pmij(double **ps, double *cov, int ncovmodel, double *x, int nlstate); /* **pmmij is a global variable feeded with oldms etc */
   double **newm;    double **newm;
   double agefin, delaymax=200. ; /* 100 Max number of years to converge */    double agefin, delaymax=200. ; /* 100 Max number of years to converge */
   int ncvloop=0;    int ncvloop=0;
Line 4800  void powell(double p[], double **xi, int Line 4808  void powell(double p[], double **xi, int
   int first=0;    int first=0;
   double *min, *max, *meandiff, maxmax,sumnew=0.;    double *min, *max, *meandiff, maxmax,sumnew=0.;
   /* double **matprod2(); */ /* test */    /* double **matprod2(); */ /* test */
   double **out, cov[NCOVMAX+1], **bmij();    double **out, cov[NCOVMAX+1], **bmij(double **ps, double *cov, int ncovmodel, double *x, int nlstate,  double ***prevacurrent, int ij);
     /* double **out, cov[NCOVMAX+1], **bmij(); */ /* Deprecated in clang */
   double **newm;    double **newm;
   double         **dnewm, **doldm, **dsavm;  /* for use */    double         **dnewm, **doldm, **dsavm;  /* for use */
   double         **oldm, **savm;  /* for use */    double         **oldm, **savm;  /* for use */
Line 5065  double **pmij(double **ps, double *cov, Line 5074  double **pmij(double **ps, double *cov,
    */     */
   int ii, j;    int ii, j;
       
   double  **pmij();    double  **pmij(double **ps, double *cov, int ncovmodel, double *x, int nlstate);
     /* double  **pmij(); */ /* No more for clang */
   double sumnew=0.;    double sumnew=0.;
   double agefin;    double agefin;
   double k3=0.; /* constant of the w_x diagonal matrix (in order for B to sum to 1 even for death state) */    double k3=0.; /* constant of the w_x diagonal matrix (in order for B to sum to 1 even for death state) */
Line 5460  double ***hbxij(double ***po, int nhstep Line 5470  double ***hbxij(double ***po, int nhstep
   */    */
   
   int i, j, d, h, k1;    int i, j, d, h, k1;
   double **out, cov[NCOVMAX+1], **bmij();    double **out, cov[NCOVMAX+1], **bmij(double **ps, double *cov, int ncovmodel, double *x, int nlstate,  double ***prevacurrent, int ij);
     /* double **out, cov[NCOVMAX+1], **bmij(); */ /* No more for clang */
   double **newm, ***newmm;    double **newm, ***newmm;
   double agexact;    double agexact;
   /*double agebegin, ageend;*/    /*double agebegin, ageend;*/

Removed from v.1.365  
changed lines
  Added in v.1.366


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