--- imach/src/imach.c 2022/08/06 07:18:25 1.330 +++ imach/src/imach.c 2022/08/07 05:40:09 1.331 @@ -1,6 +1,9 @@ -/* $Id: imach.c,v 1.330 2022/08/06 07:18:25 brouard Exp $ +/* $Id: imach.c,v 1.331 2022/08/07 05:40:09 brouard Exp $ $State: Exp $ $Log: imach.c,v $ + Revision 1.331 2022/08/07 05:40:09 brouard + *** empty log message *** + Revision 1.330 2022/08/06 07:18:25 brouard Summary: last 0.99r31 @@ -1235,12 +1238,12 @@ typedef struct { #define ODIRSEPARATOR '\\' #endif -/* $Id: imach.c,v 1.330 2022/08/06 07:18:25 brouard Exp $ */ +/* $Id: imach.c,v 1.331 2022/08/07 05:40:09 brouard Exp $ */ /* $State: Exp $ */ #include "version.h" char version[]=__IMACH_VERSION__; char copyright[]="July 2022,INED-EUROREVES-Institut de longevite-Japan Society for the Promotion of Science (Grant-in-Aid for Scientific Research 25293121), Intel Software 2015-2020, Nihon University 2021-202, INED 2000-2022"; -char fullversion[]="$Revision: 1.330 $ $Date: 2022/08/06 07:18:25 $"; +char fullversion[]="$Revision: 1.331 $ $Date: 2022/08/07 05:40:09 $"; char strstart[80]; char optionfilext[10], optionfilefiname[FILENAMELENGTH]; int erreur=0, nberr=0, nbwarn=0; /* Error number, number of errors number of warnings */ @@ -3481,7 +3484,7 @@ double ***hpxij(double ***po, int nhstep /*Tvar[k]= 5 4 3 6 5 2 7 1 1 */ /*cptcovage=2 1 2 */ /*Tage[k]= 5 8 */ - }else if( Dummy[k1]==2 ){ /* For quant with age product */ + }else if( Dummy[k1]==3 ){ /* For quant with age product */ cov[2+nagesqr+k1]=Tresult[nres][resultmodel[nres][k1]]; printf("QhPxij Quant with age k1=%d resultmodel[nres][%d]=%d,Tqresult[%d][%d]=%f\n",k1,k1,resultmodel[nres][k1],nres,resultmodel[nres][k1],Tqresult[nres][resultmodel[nres][k1]]); /* if(Dummy[Tage[k]]== 2){ /\* dummy with age *\/ */ @@ -10206,14 +10209,17 @@ int decoderesult( char resultline[], int /* V5*age V5 known which value for nres? */ /* Tqinvresult[2]=8 Tqinvresult[1]=25.1 */ for(k1=1, k=0, k4=0, k4q=0; k1 <=cptcovt;k1++){ /* loop k1 on position in the model line (excluding product) */ - if( Dummy[k1]==0 && Typevar[k1]==0 ){ /* Single dummy */ - /* k4+1= position in the resultline V(Tvarsel)=Tvalsel=Tresult[nres][pos](value); V(Tvresult[nres][pos] (variable): V(variable)=value) */ + /* k counting number of combination of single dummies in the equation model */ + /* k4 counting single dummies in the equation model */ + /* k4q counting single quantitatives in the equation model */ + if( Dummy[k1]==0 && Typevar[k1]==0 ){ /* Dummy and Single */ + /* k4+1= position in the resultline V(Tvarsel)=Tvalsel=Tresult[nres][pos](value); V(Tvresult[nres][pos] (variable): V(variable)=value) */ /* modelresult[k3]=k1: k3th position in the result line correspond to the k1 position in the model line */ /* Value in the (current nres) resultline of the variable at the k1th position in the model equation resultmodel[nres][k1]= k3 */ /* resultmodel[nres][k1]=k3: k1th position in the model correspond to the k3 position in the resultline */ /* k3 is the position in the nres result line of the k1th variable of the model equation */ - /* Tvarsel: Name of the variable at the k3th position in the result line Tvarsel[k3]. */ - /* Tvalsel: Value of the variable at the k3th position in the result line Tvarsel[k3]. */ + /* Tvarsel[k3]: Name of the variable at the k3th position in the result line. */ + /* Tvalsel[k3]: Value of the variable at the k3th position in the result line. */ /* Tresult[nres][result_position]= value of the dummy variable at the result_position in the nres resultline */ /* Tvresult[nres][result_position]= id of the dummy variable at the result_position in the nres resultline */ /* Tinvresult[nres][Name of a dummy variable]= value of the variable in the result line */ @@ -10221,13 +10227,13 @@ int decoderesult( char resultline[], int k3= resultmodel[nres][k1]; /* nres=1 k1=2 resultmodel[2(V4)] = 1=k3 ; k1=3 resultmodel[3(V3)] = 2=k3*/ k2=(int)Tvarsel[k3]; /* nres=1 k1=2=>k3=1 Tvarsel[resultmodel[2]]= Tvarsel[1] = 4=k2 (V4); k1=3=>k3=2 Tvarsel[2]=3 (V3)*/ k+=Tvalsel[k3]*pow(2,k4); /* nres=1 k1=2 Tvalsel[1]=1 (V4=1); k1=3 k3=2 Tvalsel[2]=0 (V3=0) */ + TinvDoQresult[nres][(int)Tvarsel[k3]]=Tvalsel[k3]; /* Tinvresult[nres][4]=1 */ Tresult[nres][k4+1]=Tvalsel[k3];/* Tresult[nres=2][1]=1(V4=1) Tresult[nres=2][2]=0(V3=0) */ Tvresult[nres][k4+1]=(int)Tvarsel[k3];/* Tvresult[nres][1]=4 Tvresult[nres][3]=1 */ Tinvresult[nres][(int)Tvarsel[k3]]=Tvalsel[k3]; /* Tinvresult[nres][4]=1 */ - TinvDoQresult[nres][(int)Tvarsel[k3]]=Tvalsel[k3]; /* Tinvresult[nres][4]=1 */ printf("Decoderesult Dummy k=%d, V(k2=V%d)= Tvalsel[%d]=%d, 2**(%d)\n",k, k2, k3, (int)Tvalsel[k3], k4); k4++;; - } else if( Dummy[k1]==1 && Typevar[k1]==0 ){ /* Single quantitative */ + }else if( Dummy[k1]==1 && Typevar[k1]==0 ){ /* Quantitative and single */ /* Tqresult[nres][result_position]= value of the variable at the result_position in the nres resultline */ /* Tqvresult[nres][result_position]= id of the variable at the result_position in the nres resultline */ /* Tqinvresult[nres][Name of a quantitative variable]= value of the variable in the result line */ @@ -10239,9 +10245,22 @@ int decoderesult( char resultline[], int TinvDoQresult[nres][(int)Tvarsel[k3q]]=Tvalsel[k3q]; /* Tqinvresult[nres][5]=25.1 */ printf("Decoderesult Quantitative nres=%d, V(k2q=V%d)= Tvalsel[%d]=%d, Tvarsel[%d]=%f\n",nres, k2q, k3q, Tvarsel[k3q], k3q, Tvalsel[k3q]); k4q++;; + }else if( Dummy[k1]==2 ){ /* For dummy with age product */ + /* Tvar[k1]; */ /* Age variable */ + k3= resultmodel[nres][Tvar[k1]]; /* nres=1 k1=2 resultmodel[2(V4)] = 1=k3 ; k1=3 resultmodel[3(V3)] = 2=k3*/ + k2=(int)Tvarsel[k3]; /* nres=1 k1=2=>k3=1 Tvarsel[resultmodel[2]]= Tvarsel[1] = 4=k2 (V4); k1=3=>k3=2 Tvarsel[2]=3 (V3)*/ + TinvDoQresult[nres][(int)Tvarsel[k3]]=Tvalsel[k3]; /* Tinvresult[nres][4]=1 */ + printf("Decoderesult Dummy with age k=%d, k1=%d Tvar[%d]=V%d k2=Tvarsel[%d]=%d Tvalsel[%d]=%d\n",k, k1, k1, Tvar[k1], k3,(int)Tvarsel[k3], k3, (int)Tvalsel[k3]); + }else if( Dummy[k1]==3 ){ /* For quant with age product */ + k3q= resultmodel[nres][Tvar[k1]]; /* resultmodel[1(V5)] = 25.1=k3q */ + k2q=(int)Tvarsel[k3q]; /* Tvarsel[resultmodel[1]]= Tvarsel[1] = 4=k2 */ + TinvDoQresult[nres][(int)Tvarsel[k3q]]=Tvalsel[k3q]; /* Tqinvresult[nres][5]=25.1 */ + printf("Decoderesult Quantitative with age nres=%d, k1=%d, Tvar[%d]=V%d V(k2q=V%d)= Tvalsel[%d]=%d, Tvarsel[%d]=%f\n",nres, k1, k1, Tvar[k1], k2q, k3q, Tvarsel[k3q], k3q, Tvalsel[k3q]); + }else if(Typevar[k1]==2 ){ /* For product quant or dummy (not with age) */ + printf("Decoderesult Quantitative or Dummy (not with age) nres=%d k1=%d Tvar[%d]=%d \n",nres, k1, k1, Tvar[k1]); }else{ - printf("Decodemodel probably a product Dummy[%d]==%d && Typevar[%d]==%d\n", k1, Dummy[k1], k1, Typevar[k1]); - fprintf(ficlog,"Decodemodel probably a product Dummy[%d]==%d && Typevar[%d]==%d\n", k1, Dummy[k1], k1, Typevar[k1]); + printf("Error Decodemodel probably a product Dummy[%d]==%d && Typevar[%d]==%d\n", k1, Dummy[k1], k1, Typevar[k1]); + fprintf(ficlog,"Error Decodemodel probably a product Dummy[%d]==%d && Typevar[%d]==%d\n", k1, Dummy[k1], k1, Typevar[k1]); } }