=================================================================== RCS file: /home/cvs/OpenXM/src/kan96xx/Kan/gradedset.c,v retrieving revision 1.3 retrieving revision 1.7 diff -u -p -r1.3 -r1.7 --- OpenXM/src/kan96xx/Kan/gradedset.c 2001/05/04 01:06:23 1.3 +++ OpenXM/src/kan96xx/Kan/gradedset.c 2005/06/16 06:54:55 1.7 @@ -1,4 +1,4 @@ -/* $OpenXM: OpenXM/src/kan96xx/Kan/gradedset.c,v 1.2 2000/01/16 07:55:38 takayama Exp $ */ +/* $OpenXM: OpenXM/src/kan96xx/Kan/gradedset.c,v 1.6 2003/08/19 08:02:09 takayama Exp $ */ #include #include "datatype.h" #include "extern2.h" @@ -14,11 +14,16 @@ struct polySet *newPolySet(n) int i; g = (struct polySet *)sGC_malloc(sizeof(struct polySet)); g->g = (POLY *)sGC_malloc(sizeof(POLY)*(n+1)); + g->gh = (POLY *)sGC_malloc(sizeof(POLY)*(n+1)); + g->gmod = (POLY *)sGC_malloc(sizeof(POLY)*(n+1)); + g->gen = (int *)sGC_malloc(sizeof(int)*(n+1)); g->del = (int *)sGC_malloc(sizeof(int)*(n+1)); g->syz = (struct syz0 **)sGC_malloc(sizeof(struct syz0 *)*(n+1)); g->mark = (int *)sGC_malloc(sizeof(int)*(n+1)); g->serial = (int *)sGC_malloc(sizeof(int)*(n+1)); if (g->g == (POLY *)NULL || g->del == (int *)NULL || + g->gh == (POLY *)NULL || g->gen == (int *)NULL || + g->gmod == (POLY *)NULL || g->syz == (struct syz0 **)NULL || g->mark == (int *)NULL || g->serial == (int *)NULL) { errorGradedSet("No more memory."); @@ -57,6 +62,8 @@ struct gradedPolySet *newGradedPolySet(n) errorGradedSet("No more memory."); g->maxGrade = 0; g->lim = n; + g->gb = 0; + g->reduced = 0; return(g); } @@ -184,6 +191,7 @@ struct pair *getPair(grD) return((struct pair *)NULL); } + void whereInG(g,fi,gradep,indexp,sugar) struct gradedPolySet *g; POLY fi; @@ -254,6 +262,9 @@ struct gradedPolySet *putPolyInG(g,fi,grade,index,syz, polysNew = newPolySet(index*2+1); for (i=0; ipolys[grade]->lim; i++) { polysNew->g[i] = g->polys[grade]->g[i]; + polysNew->gh[i] = g->polys[grade]->gh[i]; + polysNew->gmod[i] = g->polys[grade]->gmod[i]; + polysNew->gen[i] = g->polys[grade]->gen[i]; polysNew->del[i] = g->polys[grade]->del[i]; polysNew->syz[i] = g->polys[grade]->syz[i]; polysNew->mark[i] = g->polys[grade]->mark[i]; @@ -265,6 +276,9 @@ struct gradedPolySet *putPolyInG(g,fi,grade,index,syz, g->polys[grade]->size = index+1; g->polys[grade]->g[index] = fi; + g->polys[grade]->gh[index] = POLYNULL; + g->polys[grade]->gmod[index] = POLYNULL; + g->polys[grade]->gen[index] = 0; g->polys[grade]->del[index] = 0; g->polys[grade]->syz[index] = syz; g->polys[grade]->mark[index] = mark; @@ -293,7 +307,7 @@ void markRedundant(g,fi,grade,index,sugar) for (j=0; jsize; j++) { if (i == grade && j == index) { }else if ((*isReducible)(ps->g[j],fi)) { - ps->del[j] = 1; + if (! ps->gen[j]) ps->del[j] = 1; /*?*/ } } } @@ -314,9 +328,9 @@ void markRedundant0(g,grade,index) for (j=0; jsize; j++) { if (i == grade && j == index) { }else if ((*isReducible)(ps->g[j],fi)) { - ps->del[j] = 1; + if (! ps->gen[j] ) ps->del[j] = 1; /*?*/ }else if ((*isReducible)(fi,ps->g[j])) { - g->polys[grade]->del[index] = 1; + if (! g->polys[grade]->gen[index] ) g->polys[grade]->del[index] = 1; /*?*/ return; } } @@ -357,6 +371,7 @@ void outputGradedPolySet(grG,needSyz) { int i,j; struct polySet *set; + extern Ecart; printf("======== gradedPolySet ==========\n"); printf("maxGrade=%d\n",grG->maxGrade); for (i=0; imaxGrade; i++) { @@ -364,6 +379,7 @@ void outputGradedPolySet(grG,needSyz) printf("grade=%d, size=%d\n",i,set->size); for (j=0; jsize; j++) { printf("j=%d, del=%d, g=%s\n",j,set->del[j],POLYToString(set->g[j],'*',1)); + if (Ecart) printf(" gh=%s\n",POLYToString(set->gh[j],'*',1)); if (needSyz) { printf("mark=%d,serial=%d, syz.cf=%s, syz.syz=%s\n",set->mark[j], set->serial[j],POLYToString(set->syz[j]->cf,'*',1), @@ -509,4 +525,21 @@ int deletePairByCriterion2B(struct gradedPairs *grD,PO } } return(count); +} + +int markGeneratorInG(struct gradedPolySet *g,int grade,int index) +{ + g->polys[grade]->gen[index] = 1; + return 1; +} + +int clearGmod(struct gradedPolySet *gset) { + int grd,i; + struct polySet *set; + for (grd=0; grd < gset->maxGrade; grd++) { + set = gset->polys[grd]; + for (i = 0; isize; i++) { + set->gmod[i] = POLYNULL; + } + } }