=================================================================== RCS file: /home/cvs/OpenXM/src/kan96xx/Kan/gb.c,v retrieving revision 1.8 retrieving revision 1.11 diff -u -p -r1.8 -r1.11 --- OpenXM/src/kan96xx/Kan/gb.c 2003/08/19 08:02:09 1.8 +++ OpenXM/src/kan96xx/Kan/gb.c 2005/06/16 08:40:04 1.11 @@ -1,4 +1,4 @@ -/* $OpenXM: OpenXM/src/kan96xx/Kan/gb.c,v 1.7 2003/07/30 09:00:52 takayama Exp $ */ +/* $OpenXM: OpenXM/src/kan96xx/Kan/gb.c,v 1.10 2005/06/16 06:54:55 takayama Exp $ */ /* untabify on May 4, 2001 */ #include #include "datatype.h" @@ -162,13 +162,15 @@ struct gradedPairs *updatePairs(grD,gt,gtGrade,t,grG) return(grD); } -struct gradedPolySet *groebner_gen(f,needBack,needSyz,grP,countDown,forceReduction) +struct gradedPolySet *groebner_gen(f,needBack,needSyz,grP,countDown,forceReduction,reduceOnly,gbCheck) struct arrayOfPOLY *f; int needBack; int needSyz; struct pair **grP; /* if (needSyz), it is set. */ int countDown; int forceReduction; + int reduceOnly; + int gbCheck; { int r; struct gradedPolySet *g; @@ -197,6 +199,7 @@ struct gradedPolySet *groebner_gen(f,needBack,needSyz, int first; int statisticsPL, statisticsCount; + if (Statistics) { for (i=0; igb = 1; + if (reduceOnly) g->gb = 2; /* unknown */ d = newGradedPairs(INITGRADE*2); for (i=0; ilim; i++) { g->polys[i] = newPolySet(INITSIZE); @@ -269,7 +273,8 @@ struct gradedPolySet *groebner_gen(f,needBack,needSyz, gj = g->polys[jg]->g[ji]; Spairs++; - h = (*sp)(gi,gj); + if (reduceOnly && (!needSyz) && (!needBack)) h = spZero(); /* rd = 0 */ + else h = (*sp)(gi,gj); rd = ppAddv(ppMult(h.a,gi),ppMult(h.b,gj)); if (Statistics) { @@ -314,6 +319,15 @@ struct gradedPolySet *groebner_gen(f,needBack,needSyz, } if (!(rd ISZERO)) { + if (gbCheck) { + /* Abort the calculation. */ + g->gb = 0; + if (KanGBmessage) { + printf("gbCheck failed. \n"); + printf("Note that the result is NOT groebner basis.\n"); + } + break; + } if (needBack || needSyz) { syzp = newSyz0(); syzp->cf = syzCf; /* no meaning */ @@ -353,6 +367,7 @@ struct gradedPolySet *groebner_gen(f,needBack,needSyz, if (countDown == 0) { printf("\nThe computation of the Groebner basis is suspended because of countDown==0.\n"); printf("Note that the result is NOT groebner basis.\n"); + g->gb = 0; break; } } @@ -374,6 +389,7 @@ struct gradedPolySet *groebner_gen(f,needBack,needSyz, printf("Computation of the Groebner basis is suspended bacause of StopDegree < computing grade.\n"); printf("Note that the result is NOT groebner basis.\n"); } + g->gb = 0; break; } } @@ -409,7 +425,7 @@ struct gradedPolySet *groebner_gen(f,needBack,needSyz, printf("\n"); } - if (AutoReduce) { + if (AutoReduce || reduceOnly) { toReducedBasis(g,needBack,needSyz); } @@ -506,6 +522,7 @@ void toReducedBasis(struct gradedPolySet *grP,int need if (KanGBmessage) { printf("Done(reduced basis)\n"); } + grP->reduced = 1; }