| version 1.5, 2001/05/04 01:06:23 |
version 1.7, 2003/07/30 09:00:52 |
|
|
| /* $OpenXM: OpenXM/src/kan96xx/Kan/gb.c,v 1.4 2000/03/15 01:31:17 takayama Exp $ */ |
/* $OpenXM: OpenXM/src/kan96xx/Kan/gb.c,v 1.6 2002/02/10 08:22:56 takayama Exp $ */ |
| /* untabify on May 4, 2001 */ |
/* untabify on May 4, 2001 */ |
| #include <stdio.h> |
#include <stdio.h> |
| #include "datatype.h" |
#include "datatype.h" |
|
|
| |
|
| #define INITGRADE 4 |
#define INITGRADE 4 |
| #define INITSIZE 2 |
#define INITSIZE 2 |
| |
#define DMAX 100 |
| |
|
| int KanGBmessage = 1; |
int KanGBmessage = 1; |
| |
|
| Line 22 extern int UseCriterion2B; |
|
| Line 23 extern int UseCriterion2B; |
|
| extern int Spairs; |
extern int Spairs; |
| extern int Criterion2B, Criterion2F, Criterion2M; |
extern int Criterion2B, Criterion2F, Criterion2M; |
| extern int AutoReduce; |
extern int AutoReduce; |
| |
static int MaxLength[DMAX]; |
| |
static int SpNumber[DMAX]; |
| |
|
| |
|
| struct gradedPairs *updatePairs(grD,gt,gtGrade,t,grG) |
struct gradedPairs *updatePairs(grD,gt,gtGrade,t,grG) |
| struct gradedPairs *grD; /* set of pairs */ |
struct gradedPairs *grD; /* set of pairs */ |
| POLY gt; /* new polynomial */ |
POLY gt; /* new polynomial */ |
| Line 190 struct gradedPolySet *groebner_gen(f,needBack,needSyz, |
|
| Line 192 struct gradedPolySet *groebner_gen(f,needBack,needSyz, |
|
| extern struct ring *CurrentRingp; |
extern struct ring *CurrentRingp; |
| extern char *F_mpMult; |
extern char *F_mpMult; |
| struct ring *rp; |
struct ring *rp; |
| |
int statisticsPL, statisticsCount; |
| |
|
| |
if (Statistics) { |
| |
for (i=0; i<DMAX; i++) MaxLength[i] = SpNumber[i] = 0; |
| |
} |
| r = f->n; |
r = f->n; |
| if (r<=0) return((struct gradedPolySet *)NULL); |
if (r<=0) return((struct gradedPolySet *)NULL); |
| if (UseCriterion1) { |
if (UseCriterion1) { |
| Line 230 struct gradedPolySet *groebner_gen(f,needBack,needSyz, |
|
| Line 236 struct gradedPolySet *groebner_gen(f,needBack,needSyz, |
|
| g = putPolyInG(g,gt,grade,indx,syzp,1,serial); |
g = putPolyInG(g,gt,grade,indx,syzp,1,serial); |
| } |
} |
| |
|
| markRedundant0(g,grade,indx); |
/* markRedundant0(g,grade,indx); ?*/ |
| |
markGeneratorInG(g,grade,indx); /*?*/ |
| if (Debug) { |
if (Debug) { |
| outputGradedPairs(d); outputGradedPolySet(g,needSyz); |
outputGradedPairs(d); outputGradedPolySet(g,needSyz); |
| } |
} |
| Line 243 struct gradedPolySet *groebner_gen(f,needBack,needSyz, |
|
| Line 250 struct gradedPolySet *groebner_gen(f,needBack,needSyz, |
|
| while ((top = getPair(d)) != (struct pair *)NULL) { |
while ((top = getPair(d)) != (struct pair *)NULL) { |
| ig = top->ig; ii = top->ii; /* [ig,ii] */ |
ig = top->ig; ii = top->ii; /* [ig,ii] */ |
| jg = top->jg; ji = top->ji; /* [jg,ji] */ |
jg = top->jg; ji = top->ji; /* [jg,ji] */ |
| |
/* |
| |
if (g->polys[ig]->del[ii] || g->polys[jg]->del[ji]) { |
| |
if (KanGBmessage) printf("p"); |
| |
continue; |
| |
} Don't do this. |
| |
*/ |
| gi = g->polys[ig]->g[ii]; |
gi = g->polys[ig]->g[ii]; |
| gj = g->polys[jg]->g[ji]; |
gj = g->polys[jg]->g[ji]; |
| |
|
| Spairs++; |
Spairs++; |
| h = (*sp)(gi,gj); |
h = (*sp)(gi,gj); |
| rd = ppAddv(ppMult(h.a,gi),ppMult(h.b,gj)); |
rd = ppAddv(ppMult(h.a,gi),ppMult(h.b,gj)); |
| |
|
| |
if (Statistics) { |
| |
if (top->grade >=0 && top->grade < DMAX) { |
| |
statisticsPL = pLength(rd); |
| |
SpNumber[top->grade]++; |
| |
if (MaxLength[top->grade] < statisticsPL) { |
| |
MaxLength[top->grade] = statisticsPL; |
| |
} |
| |
} |
| |
} |
| |
|
| if (!Sugar || forceReduction) { |
if (!Sugar || forceReduction) { |
| rd = (*reduction)(rd,g,needBack,&syz); |
rd = (*reduction)(rd,g,needBack,&syz); |
| }else{ |
}else{ |
| Line 361 struct gradedPolySet *groebner_gen(f,needBack,needSyz, |
|
| Line 385 struct gradedPolySet *groebner_gen(f,needBack,needSyz, |
|
| printf("Criterion1 is applied %d times.\n",Criterion1); |
printf("Criterion1 is applied %d times.\n",Criterion1); |
| printf("Criterions M,F and B are applied M=%d, F=%d, B=%d times.\n",Criterion2M,Criterion2F,Criterion2B); |
printf("Criterions M,F and B are applied M=%d, F=%d, B=%d times.\n",Criterion2M,Criterion2F,Criterion2B); |
| Spairs = Criterion1 = Criterion2M = Criterion2F = Criterion2B = 0; |
Spairs = Criterion1 = Criterion2M = Criterion2F = Criterion2B = 0; |
| |
|
| |
printf("degree(number of spolys): maximal polynomial size\n"); |
| |
statisticsCount = 0; |
| |
for (i=0; i<DMAX; i++) { |
| |
if (SpNumber[i] > 0) { |
| |
printf("%3d(%3d): %5d, ",i,SpNumber[i],MaxLength[i]); |
| |
if (statisticsCount % 4 == 3) { |
| |
printf("\n"); |
| |
statisticsCount = 0; |
| |
}else{ statisticsCount++; } |
| |
} |
| |
} |
| |
printf("\n"); |
| } |
} |
| |
|
| if (AutoReduce) { |
if (AutoReduce) { |