=================================================================== RCS file: /home/cvs/OpenXM/src/kan96xx/Kan/ecart.c,v retrieving revision 1.12 retrieving revision 1.15 diff -u -p -r1.12 -r1.15 --- OpenXM/src/kan96xx/Kan/ecart.c 2003/08/21 12:28:57 1.12 +++ OpenXM/src/kan96xx/Kan/ecart.c 2003/08/26 05:52:43 1.15 @@ -1,4 +1,4 @@ -/* $OpenXM: OpenXM/src/kan96xx/Kan/ecart.c,v 1.11 2003/08/21 02:30:23 takayama Exp $ */ +/* $OpenXM: OpenXM/src/kan96xx/Kan/ecart.c,v 1.14 2003/08/26 05:06:01 takayama Exp $ */ #include #include "datatype.h" #include "extern2.h" @@ -297,6 +297,8 @@ static POLY reduction_ecart0(r,gset,needSyz,syzp) POLY cf_o; POLY syz_o; POLY r_0; + int se; + struct coeff *cont; extern struct ring *CurrentRingp; struct ring *rp; @@ -316,6 +318,8 @@ static POLY reduction_ecart0(r,gset,needSyz,syzp) } } + if (DoCancel && (r != POLYNULL)) shouldReduceContent(r,1); + if (DebugReductionEcart&1) printf("--------------------------------------\n"); do { if (DebugReductionRed) printf("r=%s\n",POLYToString(r,'*',1)); @@ -339,6 +343,16 @@ static POLY reduction_ecart0(r,gset,needSyz,syzp) } 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)) { + 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) { if (ell >0) cc = ppMult(cc,cxx(1,0,ell,rp)); @@ -368,7 +382,16 @@ static POLY reduction_ecart0(r,gset,needSyz,syzp) } } if (r ISZERO) goto ss; - /*r = ecartDivideSv(r,&se); r = r/s^? Don't do this. */ + + /* r = r/s^? Don't do this?? */ + r = ecartDivideSv(r,&se); + if (needSyz && (se > 0)) { + POLY tt; + tt = cxx(1,0,-se,rp); + cf = mpMult(tt,cf); + syz = cpMult(toSyzCoeff(tt),syz); + } + } }while (ell >= 0); @@ -378,6 +401,13 @@ static POLY reduction_ecart0(r,gset,needSyz,syzp) syzp->syz = syz; /* syz is in the SyzRingp */ } + if (DoCancel && (r != POLYNULL)) { + if (r->m->ringp->p == 0) { + r = reduceContentOfPoly(r,&cont); + if (DebugReductionEcart || DebugReductionRed || DebugContentReduction) printf("cont=%s ",coeffToString(cont)); + } + } + return(r); } @@ -499,6 +529,15 @@ static POLY reduction_ecart1(r,gset,needSyz,syzp) if (r ISZERO) goto ss1; r = ecartDivideSv(r,&se); /* r = r/s^? */ + + if (needSyz && (se > 0)) { /* It may not necessary because of dehomo*/ + POLY tt; + /*printf("!1/H!"); fflush(NULL);*/ /* misc-2003/ecart/t1.sm1 foo4 */ + tt = cxx(1,0,-se,rp); + cf = mpMult(tt,cf); + syz = cpMult(toSyzCoeff(tt),syz); + } + } }while (ell >= 0); @@ -507,8 +546,8 @@ static POLY reduction_ecart1(r,gset,needSyz,syzp) /* dehomogenize the syzygy. BUG, this may be inefficient. */ cf = goDeHomogenizeS(cf); syz = goDeHomogenizeS(syz); - printf("cf=%s\n",POLYToString(cf,'*',1)); - printf("syz=%s\n",POLYToString(syz,'*',1)); + /*printf("cf=%s\n",POLYToString(cf,'*',1)); + printf("syz=%s\n",POLYToString(syz,'*',1));*/ syzp->cf = cf; /* cf is in the CurrentRingp */ syzp->syz = syz; /* syz is in the SyzRingp */ }