=================================================================== RCS file: /home/cvs/OpenXM/src/kan96xx/Kan/kanExport1.c,v retrieving revision 1.12 retrieving revision 1.18 diff -u -p -r1.12 -r1.18 --- OpenXM/src/kan96xx/Kan/kanExport1.c 2004/07/30 11:21:55 1.12 +++ OpenXM/src/kan96xx/Kan/kanExport1.c 2005/06/16 05:07:23 1.18 @@ -1,4 +1,4 @@ -/* $OpenXM: OpenXM/src/kan96xx/Kan/kanExport1.c,v 1.11 2004/02/23 09:03:42 takayama Exp $ */ +/* $OpenXM: OpenXM/src/kan96xx/Kan/kanExport1.c,v 1.17 2005/06/09 04:09:22 takayama Exp $ */ #include #include "datatype.h" #include "stackm.h" @@ -12,10 +12,10 @@ static int Message = 1; extern int KanGBmessage; -struct object DegreeShifto; +struct object DegreeShifto = OINIT; int DegreeShifto_size = 0; int *DegreeShifto_vec = NULL; -struct object DegreeShiftD; +struct object DegreeShiftD = OINIT; int DegreeShiftD_size = 0; int *DegreeShiftD_vec = NULL; @@ -27,7 +27,7 @@ struct object Kreduction(f,set) POLY r; struct gradedPolySet *grG; struct syz0 syz; - struct object rob; + struct object rob = OINIT; int flag; extern int ReduceLowerTerms; @@ -70,36 +70,39 @@ struct object Kgroebner(ob) int needInput = 0; int countDown = 0; int cdflag = 0; - struct object ob1,ob2,ob2c; + struct object ob1 = OINIT; + struct object ob2 = OINIT; + struct object ob2c = OINIT; int i; struct gradedPolySet *grG; struct pair *grP; struct arrayOfPOLY *a; - struct object rob; + struct object rob = OINIT; struct gradedPolySet *grBases; struct matrixOfPOLY *mp; struct matrixOfPOLY *backwardMat; - struct object ob1New; + struct object ob1New = OINIT; extern char *F_groebner; extern int CheckHomogenization; extern int StopDegree; int sdflag = 0; int forceReduction = 0; + int reduceOnly = 0; int ob1Size, ob2Size, noZeroEntry; int *ob1ToOb2; int *ob1ZeroPos; int method; int j,k; - struct object rob2; - struct object rob3; - struct object rob4; + struct object rob2 = OINIT; + struct object rob3 = OINIT; + struct object rob4 = OINIT; struct ring *myring; POLY f; - struct object orgB; - struct object newB; - struct object orgC; - struct object newC; + struct object orgB = OINIT; + struct object newB = OINIT; + struct object orgC = OINIT; + struct object newC = OINIT; static struct object paddingVector(struct object ob, int table[], int m); static struct object unitVector(int pos, int size,struct ring *r); extern struct ring *CurrentRingp; @@ -130,6 +133,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 +256,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."); @@ -342,7 +347,7 @@ struct object Kgroebner(ob) static struct object paddingVector(struct object ob, int table[], int m) { - struct object rob; + struct object rob = OINIT; int i; rob = newObjectArray(m); for (i=0; imaxGrade +1); @@ -456,7 +462,8 @@ struct object gradedPolySetToArray(gps,keepRedundant) struct gradedPolySet *gps; int keepRedundant; { - struct object ob,vec; + struct object ob = OINIT; + struct object vec = OINIT; struct polySet *ps; int k; int i,j; @@ -495,7 +502,7 @@ struct object syzPolyToArray(size,f,grG) POLY f; struct gradedPolySet *grG; { - struct object ob; + struct object ob = OINIT; int i,g0,i0,serial; ob = newObjectArray(size); @@ -525,7 +532,7 @@ struct object getBackwardArray(grG) /* use serial, del. cf. getBackwardTransformation(). */ int inputSize,outputSize; int i,j,k; - struct object ob; + struct object ob = OINIT; struct polySet *ps; inputSize = 0; outputSize = 0; @@ -556,7 +563,7 @@ POLY arrayToPOLY(ob) struct object ob; { int size,i; - struct object f; + struct object f = OINIT; POLY r; static int nn,mm,ll,cc,n,m,l,c; static struct ring *cr = (struct ring *)NULL; @@ -605,7 +612,7 @@ struct object POLYToArray(ff) int k,i,matn,size; struct matrixOfPOLY *mat; POLY ex,sizep; - struct object ob; + struct object ob = OINIT; if (ff != ZERO) { tf = ff->m; @@ -665,7 +672,8 @@ struct object homogenizeObject(ob,gradep) struct object ob; int *gradep; { - struct object rob,ob1; + struct object rob = OINIT; + struct object ob1 = OINIT; int maxg; int gr,flag,i,d,size; struct ring *rp; @@ -731,7 +739,8 @@ struct object homogenizeObject_vec(ob,gradep) struct object ob; int *gradep; { - struct object rob,ob1; + struct object rob = OINIT; + struct object ob1 = OINIT; int maxg; int gr,i,size; POLY f; @@ -786,12 +795,12 @@ void KresetDegreeShift() { struct object homogenizeObject_go(struct object ob,int *gradep) { int size,i,dssize,j; - struct object ob0; - struct object ob1; - struct object ob2; - struct object rob; - struct object tob; - struct object ob1t; + struct object ob0 = OINIT; + struct object ob1 = OINIT; + struct object ob2 = OINIT; + struct object rob = OINIT; + struct object tob = OINIT; + struct object ob1t = OINIT; int *ds; POLY f; int onlyS; @@ -965,7 +974,7 @@ struct object oPrincipalPart(ob) struct object ob; { POLY f; - struct object rob; + struct object rob = OINIT; switch(ob.tag) { case Spoly: @@ -982,12 +991,12 @@ struct object oInitW(ob,oWeight) struct object oWeight; { POLY f; - struct object rob; + struct object rob = OINIT; int w[2*N0]; int n,i; - struct object ow; + struct object ow = OINIT; int shiftvec; - struct object oShift; + struct object oShift = OINIT; int *s; int ssize,m; @@ -997,6 +1006,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); @@ -1100,7 +1110,7 @@ POLY objArrayToPOLY(struct object ob) { } struct object POLYtoObjArray(POLY f,int size) { - struct object rob; + struct object rob = OINIT; POLY *pa; int d,n,i; POLY t; @@ -1136,12 +1146,12 @@ struct object KordWsAll(ob,oWeight) struct object oWeight; { POLY f; - struct object rob; + struct object rob = OINIT; int w[2*N0]; int n,i; - struct object ow; + struct object ow = OINIT; int shiftvec; - struct object oShift; + struct object oShift = OINIT; int *s; int ssize,m; @@ -1151,6 +1161,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); @@ -1250,8 +1261,8 @@ int validOutputOrder(int ord[],int n) { struct object KsetOutputOrder(struct object ob, struct ring *rp) { int n,i; - struct object ox; - struct object otmp; + struct object ox = OINIT; + struct object otmp = OINIT; int *xxx; int *ddd; if (ob.tag != Sarray) { @@ -1282,10 +1293,10 @@ struct object KsetOutputOrder(struct object ob, struct struct object KschreyerSkelton(struct object g) { - struct object rob; - struct object ij; - struct object ab; - struct object tt; + struct object rob = OINIT; + struct object ij = OINIT; + struct object ab = OINIT; + struct object tt = OINIT; struct arrayOfPOLY *ap; struct arrayOfMonomialSyz ans; int k; @@ -1331,7 +1342,7 @@ struct object KvectorToSchreyer_es(struct object obarr int nn; POLY f; POLY g; - struct object ob; + struct object ob = OINIT; struct ring *rp; if (obarray.tag != Sarray) { errorKan1("%s\n","KvectorToSchreyer_es(): argument must be an array of polynomials."); @@ -1373,8 +1384,8 @@ struct object KgetExponents(struct object obPoly,struc POLY f; POLY ff; MONOMIAL tf; - struct object rob; - struct object tob; + struct object rob = OINIT; + struct object tob = OINIT; static int nn,mm,ll,cc,n,m,l,c; static struct ring *cr = (struct ring *)NULL; extern struct ring *CurrentRingp; @@ -1397,12 +1408,13 @@ struct object KgetExponents(struct object obPoly,struc tob = KgetExponents(getoa(obPoly,i),otype); putoa(rob,i,tob); } + return rob; }else{ errorKan1("%s\n","KgetExponents(): argument must be a polynomial."); } /* type == 0 x,y,Dx,Dy (no commutative, no vector) - type == 1 x,y,h,Dx,Dy,H (commutative & no vector) + type == 1 x,y,Dx,Dy,h,H (commutative & no vector) type == 2 x,y,Dx,Dy,h (commutative & no vector) */ if (f ISZERO) { @@ -1441,7 +1453,11 @@ struct object KgetExponents(struct object obPoly,struc }else{ errorKan1("%s\n","KgetExponent, unknown type."); } - hsize = size/2; + if (type == 1 || type == 2) { + hsize = (size-cc)/2; + }else{ + hsize = size/2; + } if (f ISZERO) { tob = newObjectArray(size); for (i=0; i=0; i--) { + putoa(tob,hsize+r,KpoInteger(tf->e[i].D)); + r++; putoa(tob,hsize+r,KpoInteger(tf->e[i].x)); - putoa(tob,r,KpoInteger(tf->e[i].D)); r++; } }else if (type == 2) {