=================================================================== RCS file: /home/cvs/OpenXM/src/kan96xx/Kan/ecart.c,v retrieving revision 1.8 retrieving revision 1.11 diff -u -p -r1.8 -r1.11 --- OpenXM/src/kan96xx/Kan/ecart.c 2003/08/19 08:02:09 1.8 +++ OpenXM/src/kan96xx/Kan/ecart.c 2003/08/21 02:30:23 1.11 @@ -1,4 +1,4 @@ -/* $OpenXM: OpenXM/src/kan96xx/Kan/ecart.c,v 1.7 2003/07/30 09:00:52 takayama Exp $ */ +/* $OpenXM: OpenXM/src/kan96xx/Kan/ecart.c,v 1.10 2003/08/20 05:18:35 takayama Exp $ */ #include #include "datatype.h" #include "extern2.h" @@ -40,7 +40,9 @@ static POLY ecartCheckSyz0(POLY cf,POLY r_0,POLY syz, extern int DebugReductionRed; extern int TraceLift; struct ring *TraceLift_ringmod; +extern DoCancel; int DebugReductionEcart = 0; +extern DebugContentReduction; /* This is used for goHomogenization */ extern int DegreeShifto_size; @@ -252,7 +254,7 @@ POLY reduction_ecart(r,gset,needSyz,syzp) warningPoly("reduction_ecart: TraceLift_ringmod is not set.\n"); return reduction_ecart1(r,gset,needSyz,syzp); } - rn = reduction_ecart1_mod(r,gset); + rn = reduction_ecart1_mod(r,gset); /* BUG: syzygy is not obtained. */ if (rn == POLYNULL) return rn; else return reduction_ecart1(r,gset,needSyz,syzp); }else{ @@ -399,9 +401,11 @@ static POLY reduction_ecart1(r,gset,needSyz,syzp) POLY pp; int ell; int se; + struct coeff *cont; extern struct ring *CurrentRingp; struct ring *rp; + extern struct ring *SmallRingp; gg = NULL; if (needSyz) { @@ -419,6 +423,7 @@ static POLY reduction_ecart1(r,gset,needSyz,syzp) r = goHomogenize11(r,DegreeShifto_vec,DegreeShifto_size,-1,1); /* 1 means homogenize only s */ + if (DoCancel && (r != POLYNULL)) shouldReduceContent(r,1); if (DebugReductionEcart&1) printf("=======================================\n"); do { @@ -435,11 +440,20 @@ static POLY reduction_ecart1(r,gset,needSyz,syzp) if (ells.first) { pp = ((gset->polys[ells.grade])->gh)[ells.gseti]; }else{ - if (DebugReductionEcart & 4) printf("+"); + if (DebugReductionEcart & 4) {printf("+"); fflush(NULL);} pp = (gg->pa)[ells.ggi]; } if (ell > 0) r = mpMult(cxx(1,0,ell,rp),r); /* r = s^ell r */ r = (*reduction1)(r,pp,needSyz,&cc,&cg); + + if (DoCancel && (r != POLYNULL)) { /* BUG: syzygy should be corrected. */ + if (shouldReduceContent(r,0)) { + r = reduceContentOfPoly(r,&cont); + shouldReduceContent(r,1); + if (DebugReductionEcart || DebugReductionRed || DebugContentReduction) printf("CONT=%s ",coeffToString(cont)); + } + } + if (needSyz) { if (ells.first) { cf = ppMult(cc,cf); @@ -466,6 +480,12 @@ static POLY reduction_ecart1(r,gset,needSyz,syzp) } r = goDeHomogenizeS(r); + if (DoCancel && (r != POLYNULL)) { /* BUG: syzygy should be corrected. */ + if (r->m->ringp->p == 0) { + r = reduceContentOfPoly(r,&cont); + if (DebugReductionEcart || DebugReductionRed || DebugContentReduction) printf("cont=%s ",coeffToString(cont)); + } + } return(r); } @@ -598,7 +618,7 @@ static POLY reduction_ecart1_mod(r,gset) if (ells.first) { pp = ((gset->polys[ells.grade])->gmod)[ells.gseti]; }else{ - if (DebugReductionEcart & 4) printf("+"); + if (DebugReductionEcart & 4) {printf("+"); fflush(NULL);} pp = (gg->pa)[ells.ggi]; } if (ell > 0) r = mpMult(cxx(1,0,ell,rp),r); /* r = s^ell r */ @@ -614,3 +634,4 @@ static POLY reduction_ecart1_mod(r,gset) return(r); } +