=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/builtin/array.c,v retrieving revision 1.37 retrieving revision 1.42 diff -u -p -r1.37 -r1.42 --- OpenXM_contrib2/asir2000/builtin/array.c 2004/09/15 01:43:32 1.37 +++ OpenXM_contrib2/asir2000/builtin/array.c 2004/12/13 23:04:16 1.42 @@ -45,13 +45,15 @@ * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. * - * $OpenXM: OpenXM_contrib2/asir2000/builtin/array.c,v 1.36 2004/09/14 07:23:34 noro Exp $ + * $OpenXM: OpenXM_contrib2/asir2000/builtin/array.c,v 1.41 2004/12/04 09:39:27 noro Exp $ */ #include "ca.h" #include "base.h" #include "parse.h" #include "inline.h" +#define F4_INTRAT_PERIOD 8 + #if 0 #undef DMAR #define DMAR(a1,a2,a3,d,r) (r)=dmar(a1,a2,a3,d); @@ -1118,7 +1120,7 @@ RESET: add_eg(&eg_chrem_split,&tmp0,&tmp1); get_eg(&tmp0); - if ( ind % 16 ) + if ( ind % F4_INTRAT_PERIOD ) ret = 0; else ret = intmtoratm(crmat,m1,*nm,dn); @@ -1169,7 +1171,9 @@ int generic_gauss_elim_hensel(MAT mat,MAT *nmmat,Q *dn int *cinfo,*rinfo; int *rind,*cind; int count; - struct oEGT eg_mul,eg_inv,tmp0,tmp1; + int ret; + struct oEGT eg_mul,eg_inv,eg_intrat,eg_check,tmp0,tmp1; + int period; a0 = (Q **)mat->body; row = mat->row; col = mat->col; @@ -1217,8 +1221,11 @@ int generic_gauss_elim_hensel(MAT mat,MAT *nmmat,Q *dn *cindp = cind = (int *)MALLOC_ATOMIC((ri)*sizeof(int)); init_eg(&eg_mul); init_eg(&eg_inv); + init_eg(&eg_check); init_eg(&eg_intrat); + period = F4_INTRAT_PERIOD; for ( q = ONE, count = 0; ; count++ ) { - fprintf(stderr,"."); + if ( DP_Print > 3 ) + fprintf(stderr,"o"); /* wc = -b mod md */ for ( i = 0; i < rank; i++ ) for ( j = 0, bi = b[i], wi = wc[i]; j < ri; j++ ) @@ -1257,19 +1264,32 @@ int generic_gauss_elim_hensel(MAT mat,MAT *nmmat,Q *dn add_eg(&eg_mul,&tmp0,&tmp1); /* q = q*md */ mulq(q,mdq,&u); q = u; - if ( !(count % 16) && intmtoratm_q(xmat,NM(q),*nmmat,dn) ) { - for ( j = k = l = 0; j < col; j++ ) - if ( cinfo[j] ) - rind[k++] = j; - else - cind[l++] = j; - if ( gensolve_check(mat,*nmmat,*dn,rind,cind) ) { - fprintf(stderr,"\n"); - print_eg("INV",&eg_inv); - print_eg("MUL",&eg_mul); - fflush(asir_out); - return rank; - } + if ( !(count % period) ) { + get_eg(&tmp0); + ret = intmtoratm_q(xmat,NM(q),*nmmat,dn); + get_eg(&tmp1); add_eg(&eg_intrat,&tmp0,&tmp1); + if ( ret ) { + for ( j = k = l = 0; j < col; j++ ) + if ( cinfo[j] ) + rind[k++] = j; + else + cind[l++] = j; + get_eg(&tmp0); + ret = gensolve_check(mat,*nmmat,*dn,rind,cind); + get_eg(&tmp1); add_eg(&eg_check,&tmp0,&tmp1); + if ( ret ) { + if ( DP_Print > 3 ) { + fprintf(stderr,"\n"); + print_eg("INV",&eg_inv); + print_eg("MUL",&eg_mul); + print_eg("INTRAT",&eg_intrat); + print_eg("CHECK",&eg_check); + fflush(asir_out); + } + return rank; + } + } else + period *=2; } } }