=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/builtin/dp-supp.c,v retrieving revision 1.9 retrieving revision 1.12 diff -u -p -r1.9 -r1.12 --- OpenXM_contrib2/asir2000/builtin/dp-supp.c 2000/12/08 08:26:08 1.9 +++ OpenXM_contrib2/asir2000/builtin/dp-supp.c 2001/02/21 07:10:17 1.12 @@ -45,7 +45,7 @@ * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. * - * $OpenXM: OpenXM_contrib2/asir2000/builtin/dp-supp.c,v 1.8 2000/12/08 06:43:09 noro Exp $ + * $OpenXM: OpenXM_contrib2/asir2000/builtin/dp-supp.c,v 1.11 2000/12/13 05:37:29 noro Exp $ */ #include "ca.h" #include "base.h" @@ -722,7 +722,7 @@ P *dnp; divsmp(CO,mod,c1,c2,&u); c1 = u; c2 = (P)ONEM; } NEWMP(m); m->dl = d; chsgnmp(mod,(P)c1,&m->c); NEXT(m) = 0; - MKDP(n,m,s); s->sugar = d->td; mulmd(CO,mod,p2,s,&t); + MKDP(n,m,s); s->sugar = d->td; mulmd(CO,mod,s,p2,&t); if ( NUM(c2) ) { addmd(CO,mod,p1,t,&r); h = p0; } else { @@ -731,6 +731,8 @@ P *dnp; *head = h; *rest = r; *dnp = c2; } +struct oEGT eg_red_mod; + void _dp_red_mod_destructive(p1,p2,mod,rp) DP p1,p2; int mod; @@ -741,6 +743,7 @@ DP *rp; MP m; DP t,s; int c,c1; +struct oEGT t0,t1; n = p1->nv; d1 = BDY(p1)->dl; d2 = BDY(p2)->dl; _NEWDL(d,n); d->td = d1->td - d2->td; @@ -750,7 +753,9 @@ DP *rp; _NEWMP(m); m->dl = d; m->c = STOI(mod-c1); NEXT(m) = 0; _MKDP(n,m,s); s->sugar = d->td; _mulmd_dup(mod,s,p2,&t); _free_dp(s); +/* get_eg(&t0); */ _addmd_destructive(mod,p1,t,rp); +/* get_eg(&t1); add_eg(&eg_red_mod,&t0,&t1); */ } /* @@ -834,6 +839,7 @@ DP *rp; int *wb; int hmag; int sugar,psugar; + int fcoef; if ( !g ) { *rp = 0; return; @@ -842,8 +848,21 @@ DP *rp; wb = (int *)ALLOCA(n*sizeof(int)); for ( i = 0, l = b; i < n; l = NEXT(l), i++ ) wb[i] = QTOS((Q)BDY(l)); - hmag = multiple*HMAG(g); + + /* check whether polys have coeffs in finite fields */ + fcoef = 0; + for ( i = 0; i < n; i++ ) + if ( has_fcoef(ps[wb[i]]) ) { + fcoef = 1; + break; + } + if ( has_fcoef(g) ) + fcoef = 1; + + if ( !fcoef ) + hmag = multiple*HMAG(g); sugar = g->sugar; + for ( d = 0; g; ) { for ( u = 0, i = 0; i < n; i++ ) { if ( dp_redble(g,p = ps[wb[i]]) ) { @@ -862,12 +881,12 @@ DP *rp; if ( u ) { g = u; if ( d ) { - if ( multiple && HMAG(d) > hmag ) { + if ( !fcoef && multiple && HMAG(d) > hmag ) { dp_ptozp2(d,g,&t,&u); d = t; g = u; hmag = multiple*HMAG(d); } } else { - if ( multiple && HMAG(g) > hmag ) { + if ( !fcoef && multiple && HMAG(g) > hmag ) { dp_ptozp(g,&t); g = t; hmag = multiple*HMAG(g); }