=================================================================== RCS file: /home/cvs/OpenXM/src/kan96xx/Kan/resol.c,v retrieving revision 1.1 retrieving revision 1.6 diff -u -p -r1.1 -r1.6 --- OpenXM/src/kan96xx/Kan/resol.c 1999/10/08 02:12:02 1.1 +++ OpenXM/src/kan96xx/Kan/resol.c 2001/05/04 01:06:25 1.6 @@ -1,3 +1,4 @@ +/* $OpenXM: OpenXM/src/kan96xx/Kan/resol.c,v 1.5 2000/07/26 02:21:30 takayama Exp $ */ /* resol.c */ #include #include "datatype.h" @@ -9,8 +10,10 @@ static void shellForMonomialSyz(struct monomialSyz **p,int size); static struct arrayOfMonomialSyz schreyerSkelton0(struct arrayOfPOLY g,int i); static struct arrayOfMonomialSyz putMonomialSyz(struct arrayOfMonomialSyz a, - struct monomialSyz *s); + struct monomialSyz *s); +static int RemoveRedundantInSchreyerSkelton = 1; + struct monomialSyz *newMonomialSyz(void) { struct monomialSyz *s; @@ -41,20 +44,22 @@ struct arrayOfMonomialSyz enlargeArrayOfMonomialSyz(st static struct arrayOfMonomialSyz schreyerSkelton0(struct arrayOfPOLY g,int i) -/* return value will be changed by the next call of this function. */ + /* return value will be changed by the next call of this function. */ { - int m,j,k; + int m,j,k,flag; static int s_ij_size = 0; static struct monomialSyz **s_ij = NULL; struct monomialSyz *s; struct spValue sv; struct arrayOfMonomialSyz ans; + extern int RemoveRedundantInSchreyerSkelton; + /* It was 1. */ m = g.n; if (m > s_ij_size) { s_ij_size = m+1; s_ij = (struct monomialSyz **)sGC_malloc(sizeof(struct monomialSyz *)* - s_ij_size); + s_ij_size); if (s_ij == NULL) errorGradedSet("schreyerSkelton(): no memory"); } for (j=i+1; jdeleted != 1) { - for (k=j+1; kdeleted != 1) { - if ((*isReducible)(s_ij[k]->a,s->a)) s_ij[k]->deleted = 1; - } + if (RemoveRedundantInSchreyerSkelton) { + do { + flag = 0; + for (j=0; jdeleted != 1) { + for (k=0; kdeleted != 1)) { + if ((*isReducible)(s_ij[k]->a,s_ij[j]->a)) { + s_ij[k]->deleted = 1; + flag = 1; + } + } + } + } } - } + }while (flag); } ans.size = m-i-1; ans.limit = s_ij_size; @@ -86,7 +98,7 @@ static struct arrayOfMonomialSyz schreyerSkelton0(stru } static struct arrayOfMonomialSyz putMonomialSyz(struct arrayOfMonomialSyz a, - struct monomialSyz *s) + struct monomialSyz *s) { if (a.limit <= a.size) { a = enlargeArrayOfMonomialSyz(a); @@ -112,7 +124,7 @@ struct arrayOfMonomialSyz schreyerSkelton(struct array ipart = schreyerSkelton0(g,i); for (k=0; k< ipart.size; k++) { if ((ipart.p)[k]->deleted != 1) { - ans = putMonomialSyz(ans,(ipart.p)[k]); + ans = putMonomialSyz(ans,(ipart.p)[k]); } } } @@ -127,11 +139,11 @@ static void shellForMonomialSyz(struct monomialSyz **p for (gap = n/2; gap > 0; gap /= 2) { for (i = gap; i < n; i++) { for (j = i - gap ; j >= 0; j -= gap) { - r = (*mmLarger)(p[j+gap]->a, p[j]->a); - if ( r >= 1) break; - temp = p[j]; - p[j] = p[j+gap]; - p[j+gap] = temp; + r = (*mmLarger)(p[j+gap]->a, p[j]->a); + if ( r >= 1) break; + temp = p[j]; + p[j] = p[j+gap]; + p[j+gap] = temp; } } }