version 1.3, 2001/05/04 01:06:23 |
version 1.6, 2003/08/19 08:02:09 |
|
|
/* $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.5 2003/07/30 09:00:52 takayama Exp $ */ |
#include <stdio.h> |
#include <stdio.h> |
#include "datatype.h" |
#include "datatype.h" |
#include "extern2.h" |
#include "extern2.h" |
Line 14 struct polySet *newPolySet(n) |
|
Line 14 struct polySet *newPolySet(n) |
|
int i; |
int i; |
g = (struct polySet *)sGC_malloc(sizeof(struct polySet)); |
g = (struct polySet *)sGC_malloc(sizeof(struct polySet)); |
g->g = (POLY *)sGC_malloc(sizeof(POLY)*(n+1)); |
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->del = (int *)sGC_malloc(sizeof(int)*(n+1)); |
g->syz = (struct syz0 **)sGC_malloc(sizeof(struct syz0 *)*(n+1)); |
g->syz = (struct syz0 **)sGC_malloc(sizeof(struct syz0 *)*(n+1)); |
g->mark = (int *)sGC_malloc(sizeof(int)*(n+1)); |
g->mark = (int *)sGC_malloc(sizeof(int)*(n+1)); |
g->serial = (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 || |
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->syz == (struct syz0 **)NULL || g->mark == (int *)NULL || |
g->serial == (int *)NULL) { |
g->serial == (int *)NULL) { |
errorGradedSet("No more memory."); |
errorGradedSet("No more memory."); |
Line 184 struct pair *getPair(grD) |
|
Line 189 struct pair *getPair(grD) |
|
return((struct pair *)NULL); |
return((struct pair *)NULL); |
} |
} |
|
|
|
|
void whereInG(g,fi,gradep,indexp,sugar) |
void whereInG(g,fi,gradep,indexp,sugar) |
struct gradedPolySet *g; |
struct gradedPolySet *g; |
POLY fi; |
POLY fi; |
Line 254 struct gradedPolySet *putPolyInG(g,fi,grade,index,syz, |
|
Line 260 struct gradedPolySet *putPolyInG(g,fi,grade,index,syz, |
|
polysNew = newPolySet(index*2+1); |
polysNew = newPolySet(index*2+1); |
for (i=0; i<g->polys[grade]->lim; i++) { |
for (i=0; i<g->polys[grade]->lim; i++) { |
polysNew->g[i] = g->polys[grade]->g[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->del[i] = g->polys[grade]->del[i]; |
polysNew->syz[i] = g->polys[grade]->syz[i]; |
polysNew->syz[i] = g->polys[grade]->syz[i]; |
polysNew->mark[i] = g->polys[grade]->mark[i]; |
polysNew->mark[i] = g->polys[grade]->mark[i]; |
Line 265 struct gradedPolySet *putPolyInG(g,fi,grade,index,syz, |
|
Line 274 struct gradedPolySet *putPolyInG(g,fi,grade,index,syz, |
|
|
|
g->polys[grade]->size = index+1; |
g->polys[grade]->size = index+1; |
g->polys[grade]->g[index] = fi; |
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]->del[index] = 0; |
g->polys[grade]->syz[index] = syz; |
g->polys[grade]->syz[index] = syz; |
g->polys[grade]->mark[index] = mark; |
g->polys[grade]->mark[index] = mark; |
Line 293 void markRedundant(g,fi,grade,index,sugar) |
|
Line 305 void markRedundant(g,fi,grade,index,sugar) |
|
for (j=0; j<ps->size; j++) { |
for (j=0; j<ps->size; j++) { |
if (i == grade && j == index) { |
if (i == grade && j == index) { |
}else if ((*isReducible)(ps->g[j],fi)) { |
}else if ((*isReducible)(ps->g[j],fi)) { |
ps->del[j] = 1; |
if (! ps->gen[j]) ps->del[j] = 1; /*?*/ |
} |
} |
} |
} |
} |
} |
Line 314 void markRedundant0(g,grade,index) |
|
Line 326 void markRedundant0(g,grade,index) |
|
for (j=0; j<ps->size; j++) { |
for (j=0; j<ps->size; j++) { |
if (i == grade && j == index) { |
if (i == grade && j == index) { |
}else if ((*isReducible)(ps->g[j],fi)) { |
}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])) { |
}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; |
return; |
} |
} |
} |
} |
Line 357 void outputGradedPolySet(grG,needSyz) |
|
Line 369 void outputGradedPolySet(grG,needSyz) |
|
{ |
{ |
int i,j; |
int i,j; |
struct polySet *set; |
struct polySet *set; |
|
extern Ecart; |
printf("======== gradedPolySet ==========\n"); |
printf("======== gradedPolySet ==========\n"); |
printf("maxGrade=%d\n",grG->maxGrade); |
printf("maxGrade=%d\n",grG->maxGrade); |
for (i=0; i<grG->maxGrade; i++) { |
for (i=0; i<grG->maxGrade; i++) { |
Line 364 void outputGradedPolySet(grG,needSyz) |
|
Line 377 void outputGradedPolySet(grG,needSyz) |
|
printf("grade=%d, size=%d\n",i,set->size); |
printf("grade=%d, size=%d\n",i,set->size); |
for (j=0; j<set->size; j++) { |
for (j=0; j<set->size; j++) { |
printf("j=%d, del=%d, g=%s\n",j,set->del[j],POLYToString(set->g[j],'*',1)); |
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) { |
if (needSyz) { |
printf("mark=%d,serial=%d, syz.cf=%s, syz.syz=%s\n",set->mark[j], |
printf("mark=%d,serial=%d, syz.cf=%s, syz.syz=%s\n",set->mark[j], |
set->serial[j],POLYToString(set->syz[j]->cf,'*',1), |
set->serial[j],POLYToString(set->syz[j]->cf,'*',1), |
Line 509 int deletePairByCriterion2B(struct gradedPairs *grD,PO |
|
Line 523 int deletePairByCriterion2B(struct gradedPairs *grD,PO |
|
} |
} |
} |
} |
return(count); |
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; i<set->size; i++) { |
|
set->gmod[i] = POLYNULL; |
|
} |
|
} |
} |
} |