=================================================================== RCS file: /home/cvs/OpenXM/src/kan96xx/Kan/kanExport1.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -p -r1.6 -r1.7 --- OpenXM/src/kan96xx/Kan/kanExport1.c 2003/08/21 12:28:57 1.6 +++ OpenXM/src/kan96xx/Kan/kanExport1.c 2003/08/22 11:47:03 1.7 @@ -1,4 +1,4 @@ -/* $OpenXM: OpenXM/src/kan96xx/Kan/kanExport1.c,v 1.5 2003/07/17 07:33:03 takayama Exp $ */ +/* $OpenXM: OpenXM/src/kan96xx/Kan/kanExport1.c,v 1.6 2003/08/21 12:28:57 takayama Exp $ */ #include #include "datatype.h" #include "stackm.h" @@ -924,29 +924,145 @@ struct object oInitW(ob,oWeight) 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","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 (getoa(oWeight,0).tag == Sarray) { + if (n != 2) errorKan1("%s\n","oInitW(): 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","oInitW(): the weight vector must be array."); + } + n = getoaSize(oWeight); + if (oShift.tag != Sarray) { + errorKan1("%s\n","oInitW(): the shift vector must be array."); + } + } + /* oWeight = Ksm1WeightExpressionToVec(oWeight); */ if (n >= 2*N0) errorKan1("%s\n","oInitW(): the size of the second argument is invalid."); for (i=0; im->ringp; + n = ringp->n; + } + t = (*mpMult)(cxx(1,n-1,i,ringp),t); + f = ppAddv(f,t); + } + } + return f; +} + +struct object POLYtoObjArray(POLY f,int size) { + struct object rob; + POLY *pa; + int d,n,i; + POLY t; + if (size < 0) errorKan1("%s\n","POLYtoObjArray() invalid size."); + rob = newObjectArray(size); + pa = (POLY *) sGC_malloc(sizeof(POLY)*(size+1)); + if (pa == NULL) errorKan1("%s\n","POLYtoObjArray() no more memory."); + for (i=0; im->ringp->n; + 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)); + 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. */ + f = f->next; + } + for (i=0; i