=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/engine/nd.c,v retrieving revision 1.184 retrieving revision 1.190 diff -u -p -r1.184 -r1.190 --- OpenXM_contrib2/asir2000/engine/nd.c 2010/04/16 07:13:42 1.184 +++ OpenXM_contrib2/asir2000/engine/nd.c 2010/07/14 04:36:59 1.190 @@ -1,4 +1,4 @@ -/* $OpenXM: OpenXM_contrib2/asir2000/engine/nd.c,v 1.183 2010/02/22 05:27:53 noro Exp $ */ +/* $OpenXM: OpenXM_contrib2/asir2000/engine/nd.c,v 1.189 2010/05/06 09:22:09 noro Exp $ */ #include "nd.h" @@ -50,6 +50,7 @@ static int nd_module,nd_ispot,nd_mpos,nd_pot_nelim; static NODE nd_tracelist; static NODE nd_alltracelist; static int nd_gentrace,nd_gensyz,nd_nora; +static int *nd_gbblock; NumberField get_numberfield(); UINT *nd_det_compute_bound(NDV **dm,int n,int j); @@ -2300,7 +2301,7 @@ ND_pairs nd_newpairs( NODE g, int t ) { NODE h; UINT *dl; - int ts,s; + int ts,s,i,t0,min,max; ND_pairs r,r0; dl = DL(nd_psh[t]); @@ -2308,6 +2309,16 @@ ND_pairs nd_newpairs( NODE g, int t ) for ( r0 = 0, h = g; h; h = NEXT(h) ) { if ( nd_module && (MPOS(DL(nd_psh[(long)BDY(h)])) != MPOS(dl)) ) continue; + if ( nd_gbblock ) { + t0 = (long)BDY(h); + for ( i = 0; nd_gbblock[i] >= 0; i += 2 ) { + min = nd_gbblock[i]; max = nd_gbblock[i+1]; + if ( t0 >= min && t0 <= max && t >= min && t <= max ) + break; + } + if ( nd_gbblock[i] >= 0 ) + continue; + } NEXTND_pairs(r0,r); r->i1 = (long)BDY(h); r->i2 = t; @@ -2894,11 +2905,11 @@ void nd_gr(LIST f,LIST v,int m,int homo,int f4,struct ndv_homogenize((NDV)BDY(t),obpe,oadv,oepos,ompos); } - ndv_setup(m,0,fd0,0,0); + ndv_setup(m,0,fd0,nd_gbblock?1:0,0); if ( nd_gentrace ) { MKLIST(l1,nd_tracelist); MKNODE(nd_alltracelist,l1,0); } - x = f4?nd_f4(m,&perm):nd_gb(m,ishomo,0,0,&perm); + x = f4?nd_f4(m,&perm):nd_gb(m,ishomo || homo,0,0,&perm); if ( !ishomo && homo ) { /* dehomogenization */ for ( t = x; t; t = NEXT(t) ) ndv_dehomogenize((NDV)BDY(t),ord); @@ -3161,7 +3172,7 @@ void nd_gr_trace(LIST f,LIST v,int trace,int homo,int tl1 = tl2 = tl3 = tl4 = 0; if ( Demand ) nd_demand = 1; - ret = ndv_setup(m,1,fd0,0,0); + ret = ndv_setup(m,1,fd0,nd_gbblock?1:0,0); if ( nd_gentrace ) { MKLIST(l1,nd_tracelist); MKNODE(nd_alltracelist,l1,0); } @@ -6589,24 +6600,16 @@ void nd_det(int mod,MAT f,P *rp) bucket = create_pbucket(); if ( mi[k] ) { nmv = BDY(mjj); len = LEN(mjj); - fprintf(stderr,"len=%d\n",len); for ( a = 0; a < len; a++, NMV_ADV(nmv) ) { - fprintf(stderr,"."); u = ndv_mul_nmv_trunc(mod,nmv,mi[k],DL(BDY(d))); add_pbucket(mod,bucket,u); - if ( !(a%1000) ) - fprintf(stderr,"%d\n",a); } } if ( mj[k] && mij ) { nmv = BDY(mij); len = LEN(mij); - fprintf(stderr,"len=%d\n",len); for ( a = 0; a < len; a++, NMV_ADV(nmv) ) { - fprintf(stderr,"."); u = ndv_mul_nmv_trunc(mod,nmv,mj[k],DL(BDY(d))); add_pbucket(mod,bucket,u); - if ( !(a%1000) ) - fprintf(stderr,"%d\n",a); } } u = nd_quo(mod,bucket,d); @@ -6936,11 +6939,12 @@ void conv_ilist(int demand,int trace,NODE g,int **indp void parse_nd_option(NODE opt) { - NODE t,p; + NODE t,p,u; + int i,s; char *key; Obj value; - nd_gentrace = 0; nd_gensyz = 0; nd_nora = 0; + nd_gentrace = 0; nd_gensyz = 0; nd_nora = 0; nd_gbblock = 0; for ( t = opt; t; t = NEXT(t) ) { p = BDY((LIST)BDY(t)); key = BDY((STRING)BDY(p)); @@ -6951,5 +6955,17 @@ void parse_nd_option(NODE opt) nd_gensyz = value?1:0; else if ( !strcmp(key,"nora") ) nd_nora = value?1:0; + else if ( !strcmp(key,"gbblock") ) { + if ( !value || OID(value) != O_LIST ) + error("nd_* : invalid value for gbblock option"); + u = BDY((LIST)value); + nd_gbblock = MALLOC((2*length(u)+1)*sizeof(int)); + for ( i = 0; u; u = NEXT(u) ) { + p = BDY((LIST)BDY(u)); + s = nd_gbblock[i++] = QTOS((Q)BDY(p)); + nd_gbblock[i++] = s+QTOS((Q)BDY(NEXT(p)))-1; + } + nd_gbblock[i] = -1; + } } }