=================================================================== RCS file: /home/cvs/OpenXM/src/kan96xx/Kan/gbGM.c,v retrieving revision 1.1.1.1 retrieving revision 1.3 diff -u -p -r1.1.1.1 -r1.3 --- OpenXM/src/kan96xx/Kan/gbGM.c 1999/10/08 02:12:02 1.1.1.1 +++ OpenXM/src/kan96xx/Kan/gbGM.c 2001/05/04 01:06:23 1.3 @@ -1,5 +1,6 @@ +/* $OpenXM: OpenXM/src/kan96xx/Kan/gbGM.c,v 1.2 2000/01/16 07:55:38 takayama Exp $ */ /* gbGM.c GM=Gebauer and Moller -*/ + */ #include #include "datatype.h" @@ -41,12 +42,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 +71,7 @@ int CountI[2*N0]; #endif struct polySet_gm newPolySet_gm(n) -int n; + int n; { struct polySet_gm g; int i; @@ -86,7 +87,7 @@ int n; } struct pairSet newPairSet(n) -int n; + int n; { struct pairSet g; int i; @@ -102,7 +103,7 @@ int n; } int pairSetSize(d) -struct pairSet d; + struct pairSet d; { int s,i; s = 0; @@ -113,7 +114,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 +138,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 +154,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 +168,7 @@ int index; } int minPair_gm(d) -struct pairSet d; + struct pairSet d; { POLY min; int index,i; @@ -183,10 +184,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 +217,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 +227,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 +251,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 +285,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,35 +305,35 @@ 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; i