version 1.5, 2003/07/30 09:00:52 |
version 1.10, 2020/10/06 11:33:46 |
|
|
/* $OpenXM: OpenXM/src/kan96xx/Kan/gradedset.c,v 1.4 2003/07/17 07:33:03 takayama Exp $ */ |
/* $OpenXM: OpenXM/src/kan96xx/Kan/gradedset.c,v 1.9 2005/07/03 11:08:53 ohara Exp $ */ |
#include <stdio.h> |
#include <stdio.h> |
|
#include <stdlib.h> |
#include "datatype.h" |
#include "datatype.h" |
#include "extern2.h" |
#include "extern2.h" |
#include "gradedset.h" |
#include "gradedset.h" |
Line 15 struct polySet *newPolySet(n) |
|
Line 16 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->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)); |
Line 22 struct polySet *newPolySet(n) |
|
Line 24 struct polySet *newPolySet(n) |
|
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->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 60 struct gradedPolySet *newGradedPolySet(n) |
|
Line 63 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 249 struct gradedPolySet *putPolyInG(g,fi,grade,index,syz, |
|
Line 254 struct gradedPolySet *putPolyInG(g,fi,grade,index,syz, |
|
gnew->polys[i] = newPolySet(INITSIZE); |
gnew->polys[i] = newPolySet(INITSIZE); |
} |
} |
gnew->maxGrade = g->maxGrade; |
gnew->maxGrade = g->maxGrade; |
|
gnew->gb = g->gb; gnew->reduced = g->reduced; |
g = gnew; |
g = gnew; |
} |
} |
|
|
Line 259 struct gradedPolySet *putPolyInG(g,fi,grade,index,syz, |
|
Line 265 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->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]; |
Line 272 struct gradedPolySet *putPolyInG(g,fi,grade,index,syz, |
|
Line 279 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]->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; |
Line 365 void outputGradedPolySet(grG,needSyz) |
|
Line 373 void outputGradedPolySet(grG,needSyz) |
|
{ |
{ |
int i,j; |
int i,j; |
struct polySet *set; |
struct polySet *set; |
extern Ecart; |
extern int 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 525 int markGeneratorInG(struct gradedPolySet *g,int grade |
|
Line 533 int markGeneratorInG(struct gradedPolySet *g,int grade |
|
{ |
{ |
g->polys[grade]->gen[index] = 1; |
g->polys[grade]->gen[index] = 1; |
return 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; |
|
} |
|
} |
} |
} |