=================================================================== RCS file: /home/cvs/OpenXM/src/kan96xx/Kan/gbGM.c,v retrieving revision 1.1.1.1 retrieving revision 1.6 diff -u -p -r1.1.1.1 -r1.6 --- OpenXM/src/kan96xx/Kan/gbGM.c 1999/10/08 02:12:02 1.1.1.1 +++ OpenXM/src/kan96xx/Kan/gbGM.c 2005/07/03 11:08:53 1.6 @@ -1,7 +1,9 @@ +/* $OpenXM: OpenXM/src/kan96xx/Kan/gbGM.c,v 1.5 2005/06/16 06:54:55 takayama Exp $ */ /* gbGM.c GM=Gebauer and Moller -*/ + */ #include +#include #include "datatype.h" #include "extern2.h" #include "matrix.h" @@ -41,12 +43,12 @@ struct polySet_gm enlargePolySet_gm(struct polySet_gm struct pairSet deletePair_gm(struct pairSet d,int index); int minPair_gm(struct pairSet d); struct pairSet updatePair_gm(struct pairSet d,int t, - struct polySet_gm g,POLY gt); + struct polySet_gm g,POLY gt); struct polySet_gm markRedundant_gm(struct polySet_gm g,int j); /* -struct gradedPolySet *groebner_gm(struct arrayOfPOLY f, - int needBack, - int needSyz, struct pair **grP); + struct gradedPolySet *groebner_gm(struct arrayOfPOLY f, + int needBack, + int needSyz, struct pair **grP); */ void outputPairSet(struct pairSet d); void outputPolySet_gm(struct polySet_gm g); @@ -70,7 +72,7 @@ int CountI[2*N0]; #endif struct polySet_gm newPolySet_gm(n) -int n; + int n; { struct polySet_gm g; int i; @@ -86,7 +88,7 @@ int n; } struct pairSet newPairSet(n) -int n; + int n; { struct pairSet g; int i; @@ -102,7 +104,7 @@ int n; } int pairSetSize(d) -struct pairSet d; + struct pairSet d; { int s,i; s = 0; @@ -113,7 +115,7 @@ struct pairSet d; } struct pairSet pairSetJoin(a,b) -struct pairSet a,b; + struct pairSet a,b; { int m,n,k,i; struct pairSet ans; @@ -137,7 +139,7 @@ struct pairSet a,b; } struct polySet_gm enlargePolySet_gm(g) -struct polySet_gm g; + struct polySet_gm g; { int i; struct polySet_gm ans; @@ -153,9 +155,9 @@ struct polySet_gm g; } struct pairSet deletePair_gm(d,index) -struct pairSet d; -int index; -/* delete d[index] */ + struct pairSet d; + int index; + /* delete d[index] */ { int i; d.del[index] = 0; @@ -167,7 +169,7 @@ int index; } int minPair_gm(d) -struct pairSet d; + struct pairSet d; { POLY min; int index,i; @@ -183,10 +185,10 @@ struct pairSet d; } struct pairSet updatePair_gm(d,t,g,gt) -struct pairSet d; -int t; -struct polySet_gm g; -POLY gt; + struct pairSet d; + int t; + struct polySet_gm g; + POLY gt; { int i,j,k; struct pairSet new; @@ -216,7 +218,7 @@ POLY gt; } #ifdef DEBUG /*printf("\nnew is ..."); - outputPairSet(new);*/ + outputPairSet(new);*/ #endif /* Candel in D=d all (i,j) such that B_t(i,j) */ @@ -226,21 +228,21 @@ POLY gt; /* check T(it) != T(i,j) != T(j,t) */ i = d.p[k].i; j = d.p[k].j; if ((new.del[i] == 1) || (new.del[j] == 1)) { - /* fprintf(stderr,"Warning in updatepair_gm(): i=%d, j=%d; rewriting new.\n",i,j); */ - if (new.del[i] == 1) { - new.p[i].lcm = (*lcm)(g.g[i],gt); - } - if (new.del[j] == 1) { - new.p[j].lcm = (*lcm)(g.g[j],gt); - } + /* fprintf(stderr,"Warning in updatepair_gm(): i=%d, j=%d; rewriting new.\n",i,j); */ + if (new.del[i] == 1) { + new.p[i].lcm = (*lcm)(g.g[i],gt); + } + if (new.del[j] == 1) { + new.p[j].lcm = (*lcm)(g.g[j],gt); + } } if (((*mmLarger)((new.p[i].lcm),(new.p[j].lcm)) != 2) && - ((*mmLarger)((new.p[i].lcm),(d.p[k].lcm)) != 2) && - ((*mmLarger)((new.p[j].lcm),(d.p[k].lcm)) != 2)) { - /* delete T(i,j) in d */ - d.del[k] = 1; - if (Verbose >= 2) printf("B%d(%d,%d) ",t,i,j); - Criterion2B++; + ((*mmLarger)((new.p[i].lcm),(d.p[k].lcm)) != 2) && + ((*mmLarger)((new.p[j].lcm),(d.p[k].lcm)) != 2)) { + /* delete T(i,j) in d */ + d.del[k] = 1; + if (Verbose >= 2) printf("B%d(%d,%d) ",t,i,j); + Criterion2B++; } } } @@ -250,32 +252,32 @@ POLY gt; for (i=0; i= 2) printf("F%d(%d,%d) ",i,j,t); - Criterion2F++; - break; - case 1: - /* g[i] > g[j], M(i,t) */ - if ((*isReducible)(it,jt)) { - new.del[i] = 1; - if (Verbose >=2) printf("M%d(%d,%d) ",j,i,t); - Criterion2M++; - } - break; - case 0: /* M(j,t) */ - if ((*isReducible)(jt,it)) { - new.del[j] = 1; - if (Verbose >=2) printf("M%d(%d,%d) ",i,j,t); - Criterion2M++; - } - break; + it = new.p[i].lcm; + jt = new.p[j].lcm; + switch ( (*mmLarger)(it,jt)) { + case 2: + /* F(j,t), i= 2) printf("F%d(%d,%d) ",i,j,t); + Criterion2F++; + break; + case 1: + /* g[i] > g[j], M(i,t) */ + if ((*isReducible)(it,jt)) { + new.del[i] = 1; + if (Verbose >=2) printf("M%d(%d,%d) ",j,i,t); + Criterion2M++; + } + break; + case 0: /* M(j,t) */ + if ((*isReducible)(jt,it)) { + new.del[j] = 1; + if (Verbose >=2) printf("M%d(%d,%d) ",i,j,t); + Criterion2M++; + } + break; - } + } } } } @@ -284,11 +286,11 @@ POLY gt; if (UseCriterion1) { for (i=0; i=2) printf("1(%d,%d) ",i,t); - Criterion1++; - } + if (criterion1(g.g[i],gt,new.p[i].lcm)) { + new.del[i] = 1; + if (Verbose >=2) printf("1(%d,%d) ",i,t); + Criterion1++; + } } } } @@ -304,48 +306,50 @@ POLY gt; struct polySet_gm markRedundant_gm(g,j) -struct polySet_gm g; -int j; -/* compare only with g[j] */ + struct polySet_gm g; + int j; + /* compare only with g[j] */ { int i; for (i=0; igb = 1; for (i=0; ilim; i++) { ans->polys[i] = newPolySet(1); } @@ -459,32 +467,32 @@ int forceReduction; void outputPairSet(d) -struct pairSet d; + struct pairSet d; { int i; - printf("\nOutput struct pairSet. "); - printf(".size=%d, .lim=%d :\n",d.size,d.lim); - for (i=0; i