=================================================================== RCS file: /home/cvs/OpenXM/src/kan96xx/Kan/poly3.c,v retrieving revision 1.1.1.1 retrieving revision 1.6 diff -u -p -r1.1.1.1 -r1.6 --- OpenXM/src/kan96xx/Kan/poly3.c 1999/10/08 02:12:02 1.1.1.1 +++ OpenXM/src/kan96xx/Kan/poly3.c 2002/09/08 10:49:50 1.6 @@ -1,3 +1,4 @@ +/* $OpenXM: OpenXM/src/kan96xx/Kan/poly3.c,v 1.5 2002/02/09 06:21:02 takayama Exp $ */ #include #include "datatype.h" #include "extern2.h" @@ -18,7 +19,7 @@ static int Maxv; static POLY *RList; static POLY *RListRoot; static struct coeff *Tc = (struct coeff *)NULL; - /* It is initialized in mpMult_diff() */ +/* It is initialized in mpMult_diff() */ void initT(void) { int i; @@ -27,8 +28,8 @@ void initT(void) { EList = (int *)sGC_malloc(sizeof(int)*Lsize); Mark = (int *)sGC_malloc(sizeof(int)*Lsize); /* The following line causes the warning 'needed to allocate blacklisted..' - DList = (int *)sGC_malloc(sizeof(int)*Lsize*N0); - MList = (int *)sGC_malloc(sizeof(int)*Lsize*N0); + DList = (int *)sGC_malloc(sizeof(int)*Lsize*N0); + MList = (int *)sGC_malloc(sizeof(int)*Lsize*N0); */ DList = (int *)malloc(sizeof(int)*Lsize*N0); MList = (int *)malloc(sizeof(int)*Lsize*N0); @@ -40,9 +41,9 @@ void initT(void) { } void makeTable(c,e,ringp) -struct coeff *c; /* read only */ -struct exps e[]; -struct ring *ringp; + struct coeff *c; /* read only */ + struct exps e[]; + struct ring *ringp; { int i,j,k,p,q,deg,m,n; m = ringp->m; n = ringp->n; @@ -65,26 +66,26 @@ struct ring *ringp; /* Copy j-th row to k-th row and modify it. */ for (j=0; jval.bigp is read only. */ - CList[k] = coeffCopy(Tc); - Cmult(CList[k],CList[k],CList[j]); - /*CList[k] = normalize(CList[j]*BiiComb(DList[I(j,i)],q));*/ - - EList[k] = EList[j]-2*q; - Mark[k] = 0; - k++; - if (k>= Lsize) { - errorPoly("makeTable(): Lsize is not large enough.\n"); - } + CiiComb(Tc,DList[I(j,i)],q); + /* Tc->val.bigp is read only. */ + CList[k] = coeffCopy(Tc); + Cmult(CList[k],CList[k],CList[j]); + /*CList[k] = normalize(CList[j]*BiiComb(DList[I(j,i)],q));*/ + + EList[k] = EList[j]-2*q; + Mark[k] = 0; + k++; + if (k>= Lsize) { + errorPoly("makeTable(): Lsize is not large enough.\n"); + } } } Plist = k; @@ -92,12 +93,12 @@ struct ring *ringp; } void monomialMult_diff(e,f) -struct exps e[]; -POLY f; -/* (e) * f = [Plist] monomials */ + struct exps e[]; + POLY f; + /* (e) * f = [Plist] monomials */ { - int n,k,c,l,q,i,m; + int n,k,c,l,q,i,m, weightedHomogenization; struct coeff *a; struct monomial tmp; struct ring *ringp; @@ -105,6 +106,7 @@ POLY f; tmp.ringp = ringp = f->m->ringp; n = ringp->n; c = ringp->c; l = ringp->l; m = ringp->m; + weightedHomogenization = ringp->weightedHomogenization; for (k=Plist-1; k>=0; k--) { /* coeff */ a = coeffCopy(CList[k]); @@ -114,10 +116,13 @@ POLY f; for (i=0; im->e[i]; } - if (Homogenize) { + if ((!weightedHomogenization) && Homogenize) { tmp.e[0].D += EList[k]; /* homogenization. - e[0].D will be added later. */ - } + e[0].D will be added later. */ + }else if (weightedHomogenization && Homogenize) { + tmp.e[0].D += EList[k]/2 ; /* homogenization. Weight is (1,0) (special). + */ + } /* from m to n: Differential variables. */ for (i=0; i 0) { q =0; for (i=c; inext == (struct ring *)NULL) { - tmp.e[0].x += q; + tmp.e[0].x += q; }else{ - Cmult(a,a,polyToCoeff(cxx(1,0,q,ringp->next),ringp)); - /* x[0]^q */ + Cmult(a,a,polyToCoeff(cxx(1,0,q,ringp->next),ringp)); + /* x[0]^q */ } } @@ -213,7 +218,7 @@ POLY mpMult_diff(POLY f,POLY g) return(r); } -POLY mpMult_difference(POLY f,POLY g) +POLY mpMult_difference_org(POLY f,POLY g) { POLY r; int m,l; @@ -236,12 +241,12 @@ POLY mpMult_difference(POLY f,POLY g) if (f->m->e[i].D) { lRule[size] = cxx(1,i,1,f->m->ringp); if (Homogenize) { - rRule[size] = ppAdd(cxx(1,i,1,f->m->ringp),cdd(f->m->e[i].D,0,1,f->m->ringp)); - /* x_i + e[i].D h */ + rRule[size] = ppAdd(cxx(1,i,1,f->m->ringp),cdd(f->m->e[i].D,0,1,f->m->ringp)); + /* x_i + e[i].D h */ }else{ - rRule[size] = ppAdd(cxx(1,i,1,f->m->ringp),cdd(f->m->e[i].D,0,0,f->m->ringp)); - /* x_i + e[i].D */ - } + rRule[size] = ppAdd(cxx(1,i,1,f->m->ringp),cdd(f->m->e[i].D,0,0,f->m->ringp)); + /* x_i + e[i].D */ + } size++; } }