=================================================================== RCS file: /home/cvs/OpenXM/src/kan96xx/Kan/gb.c,v retrieving revision 1.9 retrieving revision 1.13 diff -u -p -r1.9 -r1.13 --- OpenXM/src/kan96xx/Kan/gb.c 2005/06/09 04:09:22 1.9 +++ OpenXM/src/kan96xx/Kan/gb.c 2005/07/07 02:59:47 1.13 @@ -1,4 +1,4 @@ -/* $OpenXM: OpenXM/src/kan96xx/Kan/gb.c,v 1.8 2003/08/19 08:02:09 takayama Exp $ */ +/* $OpenXM: OpenXM/src/kan96xx/Kan/gb.c,v 1.12 2005/06/30 08:35:07 takayama Exp $ */ /* untabify on May 4, 2001 */ #include #include "datatype.h" @@ -162,7 +162,7 @@ struct gradedPairs *updatePairs(grD,gt,gtGrade,t,grG) return(grD); } -struct gradedPolySet *groebner_gen(f,needBack,needSyz,grP,countDown,forceReduction,reduceOnly) +struct gradedPolySet *groebner_gen(f,needBack,needSyz,grP,countDown,forceReduction,reduceOnly,gbCheck) struct arrayOfPOLY *f; int needBack; int needSyz; @@ -170,6 +170,7 @@ struct gradedPolySet *groebner_gen(f,needBack,needSyz, int countDown; int forceReduction; int reduceOnly; + int gbCheck; { int r; struct gradedPolySet *g; @@ -194,11 +195,15 @@ struct gradedPolySet *groebner_gen(f,needBack,needSyz, extern int StopDegree; extern struct ring *CurrentRingp; extern char *F_mpMult; + extern int Homogenize; struct ring *rp; int first; int statisticsPL, statisticsCount; - + if (KanGBmessage) { + printf("Homogenize=%d, countDown=%d, forceReduction=%d, reduceOnly=%d, gbCheck=%d\n", + Homogenize,countDown, forceReduction, reduceOnly, gbCheck); + } 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); @@ -317,6 +323,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 */ @@ -356,6 +371,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; } } @@ -377,6 +393,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; } } @@ -509,6 +526,7 @@ void toReducedBasis(struct gradedPolySet *grP,int need if (KanGBmessage) { printf("Done(reduced basis)\n"); } + grP->reduced = 1; }