version 1.6, 2003/08/21 02:30:23 |
version 1.8, 2003/09/12 02:52:50 |
|
|
/* $OpenXM: OpenXM/src/kan96xx/Kan/red.c,v 1.5 2003/07/30 09:00:52 takayama Exp $ */ |
/* $OpenXM: OpenXM/src/kan96xx/Kan/red.c,v 1.7 2003/08/21 04:45:40 takayama Exp $ */ |
#include <stdio.h> |
#include <stdio.h> |
#include "datatype.h" |
#include "datatype.h" |
#include "extern2.h" |
#include "extern2.h" |
Line 152 POLY reduction1_gen_debug(f,g,needSyz,c,h) |
|
Line 152 POLY reduction1_gen_debug(f,g,needSyz,c,h) |
|
getchar(); |
getchar(); |
getchar(); |
getchar(); |
} |
} |
if (DebugReductionRed) { |
if (DebugReductionRed & 1) { |
printf("%s --> %s\n",POLYToString(f,'*',1),POLYToString(f2,'*',1)); |
printf("%s --> %s\n",POLYToString(f,'*',1),POLYToString(f2,'*',1)); |
|
}else if (DebugReductionRed & 2) { |
|
printf("(head) %s --> %s\n",POLYToString(head(f),'*',1),POLYToString(head(f2),'*',1)); |
} |
} |
|
|
f = f2; |
f = f2; |
if (needSyz) { |
if (needSyz) { |
*c = ppMult(sv.a,*c); |
*c = ppMult(sv.a,*c); |
Line 164 POLY reduction1_gen_debug(f,g,needSyz,c,h) |
|
Line 167 POLY reduction1_gen_debug(f,g,needSyz,c,h) |
|
while ((*isReducible)(f,g)) { |
while ((*isReducible)(f,g)) { |
sv = (*sp)(f,g); |
sv = (*sp)(f,g); |
f2 = ppAddv(cpMult((sv.a)->coeffp,f),ppMult(sv.b,g)); |
f2 = ppAddv(cpMult((sv.a)->coeffp,f),ppMult(sv.b,g)); |
if (DebugReductionRed) { |
if (DebugReductionRed & 1) { |
printf("%s --> %s\n",POLYToString(f,'*',1),POLYToString(f2,'*',1)); |
printf("%s --> %s\n",POLYToString(f,'*',1),POLYToString(f2,'*',1)); |
|
}else if (DebugReductionRed & 2) { |
|
printf("(head) %s --> %s\n",POLYToString(head(f),'*',1),POLYToString(head(f2),'*',1)); |
} |
} |
if (showLength) {printf(" [%d] ",pLength(f)); fflush(stdout);} |
if (showLength) {printf(" [%d] ",pLength(f)); fflush(stdout);} |
if (!isOrdered(f2) || !isOrdered(f)) { |
if (!isOrdered(f2) || !isOrdered(f)) { |
Line 194 POLY reduction1_gen_debug(f,g,needSyz,c,h) |
|
Line 199 POLY reduction1_gen_debug(f,g,needSyz,c,h) |
|
*h = ppAdd(ppMult(sv.a,*h),sv.b); |
*h = ppAdd(ppMult(sv.a,*h),sv.b); |
} |
} |
} |
} |
|
if (DebugReductionRed & 2) printf("----------- end of reduction_gen_debug\n"); |
return(f); |
return(f); |
} |
} |
|
|
Line 209 POLY reduction1_gen(f,g,needSyz,c,h) |
|
Line 215 POLY reduction1_gen(f,g,needSyz,c,h) |
|
struct ring *rp; |
struct ring *rp; |
struct spValue sv; |
struct spValue sv; |
POLY f2; |
POLY f2; |
|
extern DoCancel; |
|
static int crcount=0; |
|
|
if (needSyz) { |
if (needSyz) { |
if (f ISZERO) { rp = CurrentRingp; } else {rp = f->m->ringp; } |
if (f ISZERO) { rp = CurrentRingp; } else {rp = f->m->ringp; } |
*c = cxx(1,0,0,rp); |
*c = cxx(1,0,0,rp); |
*h = ZERO; |
*h = ZERO; |
} |
} |
|
if ((DoCancel&4) && (f != POLYNULL)) shouldReduceContent(f,1); |
|
|
sv = (*sp)(f,g); |
sv = (*sp)(f,g); |
f2 = ppAddv(cpMult((sv.a)->coeffp,f),ppMult(sv.b,g)); |
f2 = ppAddv(cpMult((sv.a)->coeffp,f),ppMult(sv.b,g)); |
Line 230 POLY reduction1_gen(f,g,needSyz,c,h) |
|
Line 238 POLY reduction1_gen(f,g,needSyz,c,h) |
|
*h = ppAdd(ppMult(sv.a,*h),sv.b); |
*h = ppAdd(ppMult(sv.a,*h),sv.b); |
} |
} |
|
|
|
|
|
|
while ((*isReducible)(f,g)) { |
while ((*isReducible)(f,g)) { |
sv = (*sp)(f,g); |
sv = (*sp)(f,g); |
f2 = ppAddv(cpMult((sv.a)->coeffp,f),ppMult(sv.b,g)); |
f2 = ppAddv(cpMult((sv.a)->coeffp,f),ppMult(sv.b,g)); |
Line 243 POLY reduction1_gen(f,g,needSyz,c,h) |
|
Line 253 POLY reduction1_gen(f,g,needSyz,c,h) |
|
*c = ppMult(sv.a,*c); |
*c = ppMult(sv.a,*c); |
*h = ppAdd(ppMult(sv.a,*h),sv.b); |
*h = ppAdd(ppMult(sv.a,*h),sv.b); |
} |
} |
|
|
|
if ((DoCancel&4) && (f != POLYNULL)) { |
|
if (shouldReduceContent(f,0)) { |
|
struct coeff *cont; |
|
f = reduceContentOfPoly(f,&cont); |
|
shouldReduceContent(f,1); |
|
if (DebugContentReduction) { |
|
printf("CoNT=%s ",coeffToString(cont)); |
|
if (crcount % 10 == 0) fflush(NULL); |
|
crcount++; |
|
} |
|
} |
|
} |
|
|
} |
} |
return(f); |
return(f); |
} |
} |