=================================================================== RCS file: /home/cvs/OpenXM/src/kan96xx/Kan/kanExport1.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -p -r1.7 -r1.8 --- OpenXM/src/kan96xx/Kan/kanExport1.c 2003/08/22 11:47:03 1.7 +++ OpenXM/src/kan96xx/Kan/kanExport1.c 2003/08/23 02:28:38 1.8 @@ -1,4 +1,4 @@ -/* $OpenXM: OpenXM/src/kan96xx/Kan/kanExport1.c,v 1.6 2003/08/21 12:28:57 takayama Exp $ */ +/* $OpenXM: OpenXM/src/kan96xx/Kan/kanExport1.c,v 1.7 2003/08/22 11:47:03 takayama Exp $ */ #include #include "datatype.h" #include "stackm.h" @@ -936,7 +936,12 @@ struct object oInitW(ob,oWeight) errorKan1("%s\n","oInitW(): the second argument must be array."); } n = getoaSize(oWeight); - if (n == 0) errorKan1("%s\n","oInitW(): the size of the second argument is invalid."); + if (n == 0) { + m = getoaSize(ob); + f = objArrayToPOLY(ob); + f = head(f); + return POLYtoObjArray(f,m); + } if (getoa(oWeight,0).tag == Sarray) { if (n != 2) errorKan1("%s\n","oInitW(): the size of the second argument should be 2."); shiftvec = 1; @@ -1023,6 +1028,7 @@ POLY objArrayToPOLY(struct object ob) { if (ringp == NULL) { ringp = t->m->ringp; n = ringp->n; + if (n - ringp->nn <= 0) errorKan1("%s\n","Graduation variable in D is not given."); } t = (*mpMult)(cxx(1,n-1,i,ringp),t); f = ppAddv(f,t); @@ -1051,7 +1057,7 @@ struct object POLYtoObjArray(POLY f,int size) { while (f != POLYNULL) { d = f->m->e[n-1].x; if (d >= size) errorKan1("%s\n","POLYtoObjArray() size is too small."); - t = newCell(f->coeffp,monomialCopy(f->m)); + t = newCell(coeffCopy(f->coeffp),monomialCopy(f->m)); i = t->m->e[n-1].x; t->m->e[n-1].x = 0; pa[i] = ppAddv(pa[i],t); /* slow to add from the top. */ @@ -1063,6 +1069,98 @@ struct object POLYtoObjArray(POLY f,int size) { return rob; } +struct object KordWsAll(ob,oWeight) + struct object ob; + struct object oWeight; +{ + POLY f; + struct object rob; + int w[2*N0]; + int n,i; + struct object ow; + int shiftvec; + struct object oShift; + int *s; + int ssize,m; + + shiftvec = 0; + s = NULL; + + if (oWeight.tag != Sarray) { + errorKan1("%s\n","ordWsAll(): the second argument must be array."); + } + n = getoaSize(oWeight); + if (n == 0) { + m = getoaSize(ob); + f = objArrayToPOLY(ob); + f = head(f); + return POLYtoObjArray(f,m); + } + if (getoa(oWeight,0).tag == Sarray) { + if (n != 2) errorKan1("%s\n","ordWsAll(): the size of the second argument should be 2."); + shiftvec = 1; + oShift = getoa(oWeight,1); + oWeight = getoa(oWeight,0); + if (oWeight.tag != Sarray) { + errorKan1("%s\n","ordWsAll(): the weight vector must be array."); + } + n = getoaSize(oWeight); + if (oShift.tag != Sarray) { + errorKan1("%s\n","ordWsAll(): the shift vector must be array."); + } + } + /* oWeight = Ksm1WeightExpressionToVec(oWeight); */ + if (n >= 2*N0) errorKan1("%s\n","ordWsAll(): the size of the second argument is invalid."); + for (i=0; i