=================================================================== RCS file: /home/cvs/OpenXM/src/kan96xx/Kan/kanExport1.c,v retrieving revision 1.1.1.1 retrieving revision 1.4 diff -u -p -r1.1.1.1 -r1.4 --- OpenXM/src/kan96xx/Kan/kanExport1.c 1999/10/08 02:12:02 1.1.1.1 +++ OpenXM/src/kan96xx/Kan/kanExport1.c 2003/07/13 07:53:17 1.4 @@ -1,3 +1,4 @@ +/* $OpenXM$ */ #include #include "datatype.h" #include "stackm.h" @@ -13,8 +14,8 @@ extern int KanGBmessage; /** :kan, :ring */ struct object Kreduction(f,set) -struct object f; -struct object set; + struct object f; + struct object set; { POLY r; struct gradedPolySet *grG; @@ -54,7 +55,7 @@ struct object set; } struct object Kgroebner(ob) -struct object ob; + struct object ob; { int needSyz = 0; int needBack = 0; @@ -112,45 +113,45 @@ struct object ob; for (i=0; isize; }else{ for (j=0; jsize; j++) { - if (ps->del[j] == 0) ++size; + if (ps->del[j] == 0) ++size; } } } @@ -470,8 +471,8 @@ int keepRedundant; ps = gps->polys[i]; for (j=0; jsize; j++) { if (keepRedundant || (ps->del[j] == 0)) { - putoa(ob,k,KpoPOLY(ps->g[j])); - k++; + putoa(ob,k,KpoPOLY(ps->g[j])); + k++; } } } @@ -481,9 +482,9 @@ int keepRedundant; /* serial == -1 : It's not in the marix input. */ struct object syzPolyToArray(size,f,grG) -int size; -POLY f; -struct gradedPolySet *grG; + int size; + POLY f; + struct gradedPolySet *grG; { struct object ob; int i,g0,i0,serial; @@ -510,7 +511,7 @@ struct gradedPolySet *grG; } struct object getBackwardArray(grG) -struct gradedPolySet *grG; + struct gradedPolySet *grG; { /* use serial, del. cf. getBackwardTransformation(). */ int inputSize,outputSize; @@ -533,8 +534,8 @@ struct gradedPolySet *grG; ps = grG->polys[i]; for (j=0; jsize; j++) { if (ps->del[j] == 0) { - putoa(ob,k,syzPolyToArray(inputSize,ps->syz[j]->syz,grG)); - k++; + putoa(ob,k,syzPolyToArray(inputSize,ps->syz[j]->syz,grG)); + k++; } } } @@ -543,7 +544,7 @@ struct gradedPolySet *grG; POLY arrayToPOLY(ob) -struct object ob; + struct object ob; { int size,i; struct object f; @@ -563,15 +564,15 @@ struct object ob; if (ff != ZERO) { tf = ff->m; 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; + 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 (n-nn >0) ee = cxx(1,n-1,i,tf->ringp); else if (m-mm >0) ee = cxx(1,m-1,i,tf->ringp); @@ -585,7 +586,7 @@ struct object ob; } struct object POLYToArray(ff) -POLY ff; + POLY ff; { static int nn,mm,ll,cc,n,m,l,c; @@ -639,7 +640,7 @@ POLY ff; } static int isThereh(f) -POLY f; + POLY f; { POLY t; if (f == 0) return(0); @@ -652,8 +653,8 @@ POLY f; } struct object homogenizeObject(ob,gradep) -struct object ob; -int *gradep; + struct object ob; + int *gradep; { struct object rob,ob1; int maxg; @@ -683,6 +684,7 @@ int *gradep; rob = newObjectArray(size); flag = 0; ob1 = getoa(ob,0); + if (ob1.tag == Sdollar) return(homogenizeObject_go(ob,gradep)); ob1 = homogenizeObject(ob1,&gr); maxg = gr; getoa(rob,0) = ob1; @@ -690,7 +692,7 @@ int *gradep; ob1 = getoa(ob,i); ob1 = homogenizeObject(ob1,&gr); if (gr > maxg) { - maxg = gr; + maxg = gr; } getoa(rob,i) = ob1; } @@ -699,12 +701,12 @@ int *gradep; rp = oRingp(rob); if (rp == (struct ring *)NULL) rp = CurrentRingp; for (i=0; i gr) { - f = cdd(1,0,maxg-gr-i,rp); /* h^{maxg-gr-i} */ - getoa(rob,i) = KooMult(KpoPOLY(f),getoa(rob,i)); - } + gr = oGrade(getoa(rob,i)); + /**printf("maxg=%d, gr=%d(i=%d) ",maxg,gr,i); fflush(stdout);**/ + if (maxg > gr) { + f = cdd(1,0,maxg-gr-i,rp); /* h^{maxg-gr-i} */ + getoa(rob,i) = KooMult(KpoPOLY(f),getoa(rob,i)); + } } } *gradep = maxg; @@ -717,8 +719,8 @@ int *gradep; } struct object homogenizeObject_vec(ob,gradep) -struct object ob; -int *gradep; + struct object ob; + int *gradep; { struct object rob,ob1; int maxg; @@ -744,13 +746,14 @@ int *gradep; if (size == 0) { errorKan1("%s\n","homogenizeObject_vec() is called for the empty array."); } + if (getoa(ob,0).tag == Sdollar) return(homogenizeObject_go(ob,gradep)); rob = newObjectArray(size); for (i=0; i gr? maxg: gr); + maxg = (maxg > gr? maxg: gr); } putoa(rob,i,ob1); } @@ -763,8 +766,65 @@ int *gradep; } } +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; + int *ds; + POLY f; + rob = NullObject; + if (ob.tag != Sarray) errorKan1("%s\n","homogenizeObject_go(): Invalid argument data type."); + + size = getoaSize(ob); + if (size == 0) errorKan1("%s\n","homogenizeObject_go(): the first argument must be a string."); + ob0 = getoa(ob,0); + if (ob0.tag != Sdollar) { + errorKan1("%s\n","homogenizeObject_go(): the first argument must be a string."); + } + if (strcmp(KopString(ob0),"degreeShift") == 0) { + if (size != 3) + errorKan1("%s\n","homogenizeObject_go(): [(degreeShift) shift-vector obj]"); + ob1 = getoa(ob,1); ob2 = getoa(ob,2); + dssize = getoaSize(ob1); + ds = (int *)sGC_malloc(sizeof(int)*(dssize>0?dssize:1)); + for (i=0; i