=================================================================== RCS file: /home/cvs/OpenXM/src/kan96xx/Kan/kanExport1.c,v retrieving revision 1.11 retrieving revision 1.17 diff -u -p -r1.11 -r1.17 --- OpenXM/src/kan96xx/Kan/kanExport1.c 2004/02/23 09:03:42 1.11 +++ OpenXM/src/kan96xx/Kan/kanExport1.c 2005/06/09 04:09:22 1.17 @@ -1,4 +1,4 @@ -/* $OpenXM: OpenXM/src/kan96xx/Kan/kanExport1.c,v 1.10 2003/08/27 03:11:12 takayama Exp $ */ +/* $OpenXM: OpenXM/src/kan96xx/Kan/kanExport1.c,v 1.16 2004/09/05 07:42:43 takayama Exp $ */ #include #include "datatype.h" #include "stackm.h" @@ -85,6 +85,7 @@ struct object Kgroebner(ob) extern int StopDegree; int sdflag = 0; int forceReduction = 0; + int reduceOnly = 0; int ob1Size, ob2Size, noZeroEntry; int *ob1ToOb2; @@ -130,6 +131,8 @@ struct object Kgroebner(ob) needSyz = needBack = 1; }else if (strcmp(ob2c.lc.str,"forceReduction")==0) { forceReduction = 1; + }else if (strcmp(ob2c.lc.str,"reduceOnly")==0) { + reduceOnly = 1; }else if (strcmp(ob2c.lc.str,"countDown")==0) { countDown = 1; cdflag = 1; if (needSyz) { @@ -251,7 +254,7 @@ struct object Kgroebner(ob) } a = arrayToArrayOfPOLY(ob2); - grG = (*groebner)(a,needBack,needSyz,&grP,countDown,forceReduction); + grG = (*groebner)(a,needBack,needSyz,&grP,countDown,forceReduction,reduceOnly); if (strcmp(F_groebner,"gm") == 0 && (needBack || needSyz)) { warningKan("The options needBack and needSyz are ignored."); @@ -997,6 +1000,7 @@ struct object oInitW(ob,oWeight) if (oWeight.tag != Sarray) { errorKan1("%s\n","oInitW(): the second argument must be array."); } + oWeight = Kto_int32(oWeight); n = getoaSize(oWeight); if (n == 0) { m = getoaSize(ob); @@ -1151,6 +1155,7 @@ struct object KordWsAll(ob,oWeight) if (oWeight.tag != Sarray) { errorKan1("%s\n","ordWsAll(): the second argument must be array."); } + oWeight = Kto_int32(oWeight); n = getoaSize(oWeight); if (n == 0) { m = getoaSize(ob); @@ -1366,4 +1371,142 @@ int objToInteger(struct object ob) { }else { errorKan1("%s\n","objToInteger(): invalid argument."); } +} + +struct object KgetExponents(struct object obPoly,struct object otype) { + int type,asize,i; + POLY f; + POLY ff; + MONOMIAL tf; + struct object rob; + struct object tob; + static int nn,mm,ll,cc,n,m,l,c; + static struct ring *cr = (struct ring *)NULL; + extern struct ring *CurrentRingp; + int size,hsize,fsize,p,r; + + if (otype.tag == Sinteger) { + type = KopInteger(otype); + }else if (otype.tag == SuniversalNumber) { + type = coeffToInt(KopUniversalNumber(otype)); + }else { + errorKan1("%s\n","KgetExponents(): invalid translation type."); + } + + if (obPoly.tag == Spoly) { + f = KopPOLY(obPoly); + }else if (obPoly.tag == Sarray) { + asize = getoaSize(obPoly); + rob = newObjectArray(asize); + for (i=0; im; + } + if (tf->ringp != cr) { + n = tf->ringp->n; + m = tf->ringp->m; + l = tf->ringp->l; + c = tf->ringp->c; + nn = tf->ringp->nn; + mm = tf->ringp->mm; + ll = tf->ringp->ll; + cc = tf->ringp->cc; + cr = tf->ringp; + } + if (type == 0) { + size = 0; + for (i=c; inext; + } + rob = newObjectArray(fsize); + + ff = f; + p = 0; + while (ff != POLYNULL) { + r = 0; + tob = newObjectArray(size); + tf = ff->m; + for (i=ll-1; i>=c; i--) { + putoa(tob,r,KpoInteger(tf->e[i].x)); + putoa(tob,hsize+r,KpoInteger(tf->e[i].D)); + r++; + } + for (i=mm-1; i>=l; i--) { + putoa(tob,r,KpoInteger(tf->e[i].x)); + putoa(tob,hsize+r,KpoInteger(tf->e[i].D)); + r++; + } + for (i=nn-1; i>=m; i--) { + putoa(tob,r,KpoInteger(tf->e[i].x)); + putoa(tob,hsize+r,KpoInteger(tf->e[i].D)); + r++; + } + if (type == 1) { + for (i=cc-1; i>=0; i--) { + putoa(tob,hsize+r,KpoInteger(tf->e[i].D)); + r++; + putoa(tob,hsize+r,KpoInteger(tf->e[i].x)); + r++; + } + }else if (type == 2) { + for (i=cc-1; i>=0; i--) { + putoa(tob,hsize+r,KpoInteger(tf->e[i].D)); + r++; + } + } + + putoa(rob,p,tob); + p++; + ff = ff->next; + } + return rob; }