=================================================================== RCS file: /home/cvs/OpenXM/src/kan96xx/Kan/ecart.c,v retrieving revision 1.20 retrieving revision 1.23 diff -u -p -r1.20 -r1.23 --- OpenXM/src/kan96xx/Kan/ecart.c 2003/09/21 02:19:43 1.20 +++ OpenXM/src/kan96xx/Kan/ecart.c 2020/10/06 11:33:46 1.23 @@ -1,10 +1,15 @@ -/* $OpenXM: OpenXM/src/kan96xx/Kan/ecart.c,v 1.19 2003/09/20 09:57:29 takayama Exp $ */ +/* $OpenXM: OpenXM/src/kan96xx/Kan/ecart.c,v 1.22 2005/07/03 11:08:53 ohara Exp $ */ #include +#include #include "datatype.h" +// #include "extern.h" #include "extern2.h" #include "gradedset.h" #define outofmemory(a) if (a == NULL) {fprintf(stderr,"ecart.c: out of memory.\n"); exit(10);} + +int errorKan1(char *s,char *m); /* defined in extern.h */ + /* Local structures */ struct ecartReducer { int ell; /* s^\ell */ @@ -26,6 +31,7 @@ static int ecartCheckPoly(POLY f); /* check if it doe static int ecartCheckEnv(); /* check if the environment is OK for ecart div*/ static struct ecartPolyArray *ecartPutPolyInG(POLY g,struct ecartPolyArray *eparray,POLY cf, POLY syz); static int ecartGetEll(POLY r,POLY g); +static int ecartGetEllPartial(POLY r,POLY g); static POLY ecartDivideSv(POLY r,int *d); /* No automatic homogenization and s is used as a standart var. */ static POLY reduction_ecart0(POLY r,struct gradedPolySet *gset, @@ -42,9 +48,9 @@ static void ecartCheckSyz0_printinfo(POLY cf,POLY r_0 extern int DebugReductionRed; extern int TraceLift; struct ring *TraceLift_ringmod; -extern DoCancel; +extern int DoCancel; int DebugReductionEcart = 0; -extern DebugContentReduction; +extern int DebugContentReduction; extern int Sugar; /* This is used for goHomogenization */ @@ -117,7 +123,42 @@ static int ecartGetEll(POLY f,POLY g) { else return(-p); } +static int ecartGetEllPartial(POLY f,POLY g) { + int n,i,p; + MONOMIAL tf; + MONOMIAL tg; + int nglob; int *glob; int k; + + if (f ISZERO) return(-1); + if (g ISZERO) return(-1); + checkRingIsR(f,g); + + if (!isSameComponent_x(f,g)) return(-1); + tf = f->m; tg = g->m; n = tf->ringp->n; + for (i=1; ie[i].x < tg->e[i].x) return(-1); + if (tf->e[i].D < tg->e[i].D) return(-1); + } + if (tf->e[0].D < tg->e[0].D) return(-1); /* h */ + + /* Find u and ell s.t. s^\ell f = u g. + When u contains variables in glob (index x var), then returns -1. + x' = glob, x'' = complement of glob. Division in Q(x'')[x']. + */ + nglob = tf->ringp->partialEcart; + glob = tf->ringp->partialEcartGlobalVarX; + for (i=0; ie[k].x > tg->e[k].x) return(-1); + } + + p = tf->e[0].x - tg->e[0].x; /* H, s */ + if (p >=0 ) return 0; + else return(-p); +} + + #define EP_SIZE 10 static struct ecartPolyArray *ecartPutPolyInG(POLY g,struct ecartPolyArray *eparray,POLY cf,POLY syz) { @@ -203,7 +244,7 @@ static struct ecartReducer ecartFindReducer(POLY r,str if (epa != NULL) { /* Try to find in the second group. */ for (i=0; i< epa->size; i++) { - ell = ecartGetEll(r,(epa->pa)[i]); + ell = ecartGetEllPartial(r,(epa->pa)[i]); if ((ell>=0) && (ell < ell2)) { ell2 = ell; minGgi = i; @@ -522,7 +563,7 @@ static POLY reduction_ecart1(r,gset,needSyz,syzp) ells = ecartFindReducer(r,gset,gg); ell = ells.ell; if (ell > 0) { - if (DebugReductionEcart & 2) printf("%"); + if (DebugReductionEcart & 2) printf("%%"); if (needSyz) { gg = ecartPutPolyInG(r,gg,cf,syz); }else{ @@ -701,7 +742,7 @@ static struct ecartReducer ecartFindReducer_mod(POLY r if (epa != NULL) { /* Try to find in the second group. */ for (i=0; i< epa->size; i++) { - ell = ecartGetEll(r,(epa->pa)[i]); + ell = ecartGetEllPartial(r,(epa->pa)[i]); if ((ell>=0) && (ell < ell2)) { ell2 = ell; minGgi = i; @@ -777,7 +818,7 @@ static POLY reduction_ecart1_mod(r,gset) ells = ecartFindReducer_mod(r,gset,gg); ell = ells.ell; if (ell > 0) { - if (DebugReductionEcart & 2) printf("%"); + if (DebugReductionEcart & 2) printf("%%"); gg = ecartPutPolyInG(r,gg,POLYNULL,POLYNULL); } if (ell >= 0) {