version 1.4, 2003/07/17 07:33:03 |
version 1.7, 2005/06/16 06:54:55 |
|
|
/* $OpenXM: OpenXM/src/kan96xx/Kan/gradedset.c,v 1.3 2001/05/04 01:06:23 takayama Exp $ */ |
/* $OpenXM: OpenXM/src/kan96xx/Kan/gradedset.c,v 1.6 2003/08/19 08:02:09 takayama Exp $ */ |
#include <stdio.h> |
#include <stdio.h> |
#include "datatype.h" |
#include "datatype.h" |
#include "extern2.h" |
#include "extern2.h" |
Line 15 struct polySet *newPolySet(n) |
|
Line 15 struct polySet *newPolySet(n) |
|
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->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->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 59 struct gradedPolySet *newGradedPolySet(n) |
|
Line 62 struct gradedPolySet *newGradedPolySet(n) |
|
errorGradedSet("No more memory."); |
errorGradedSet("No more memory."); |
g->maxGrade = 0; |
g->maxGrade = 0; |
g->lim = n; |
g->lim = n; |
|
g->gb = 0; |
|
g->reduced = 0; |
return(g); |
return(g); |
} |
} |
|
|
Line 186 struct pair *getPair(grD) |
|
Line 191 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 257 struct gradedPolySet *putPolyInG(g,fi,grade,index,syz, |
|
Line 263 struct gradedPolySet *putPolyInG(g,fi,grade,index,syz, |
|
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->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 269 struct gradedPolySet *putPolyInG(g,fi,grade,index,syz, |
|
Line 277 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]->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 297 void markRedundant(g,fi,grade,index,sugar) |
|
Line 307 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 318 void markRedundant0(g,grade,index) |
|
Line 328 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 515 int deletePairByCriterion2B(struct gradedPairs *grD,PO |
|
Line 525 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; |
|
} |
|
} |
} |
} |