version 1.13, 2004/07/31 02:23:02 |
version 1.19, 2005/06/16 06:54:55 |
|
|
/* $OpenXM: OpenXM/src/kan96xx/Kan/kanExport1.c,v 1.12 2004/07/30 11:21:55 takayama Exp $ */ |
/* $OpenXM: OpenXM/src/kan96xx/Kan/kanExport1.c,v 1.18 2005/06/16 05:07:23 takayama Exp $ */ |
#include <stdio.h> |
#include <stdio.h> |
#include "datatype.h" |
#include "datatype.h" |
#include "stackm.h" |
#include "stackm.h" |
|
|
static int Message = 1; |
static int Message = 1; |
extern int KanGBmessage; |
extern int KanGBmessage; |
|
|
struct object DegreeShifto; |
struct object DegreeShifto = OINIT; |
int DegreeShifto_size = 0; |
int DegreeShifto_size = 0; |
int *DegreeShifto_vec = NULL; |
int *DegreeShifto_vec = NULL; |
struct object DegreeShiftD; |
struct object DegreeShiftD = OINIT; |
int DegreeShiftD_size = 0; |
int DegreeShiftD_size = 0; |
int *DegreeShiftD_vec = NULL; |
int *DegreeShiftD_vec = NULL; |
|
|
Line 27 struct object Kreduction(f,set) |
|
Line 27 struct object Kreduction(f,set) |
|
POLY r; |
POLY r; |
struct gradedPolySet *grG; |
struct gradedPolySet *grG; |
struct syz0 syz; |
struct syz0 syz; |
struct object rob; |
struct object rob = OINIT; |
int flag; |
int flag; |
extern int ReduceLowerTerms; |
extern int ReduceLowerTerms; |
|
|
Line 70 struct object Kgroebner(ob) |
|
Line 70 struct object Kgroebner(ob) |
|
int needInput = 0; |
int needInput = 0; |
int countDown = 0; |
int countDown = 0; |
int cdflag = 0; |
int cdflag = 0; |
struct object ob1,ob2,ob2c; |
struct object ob1 = OINIT; |
|
struct object ob2 = OINIT; |
|
struct object ob2c = OINIT; |
int i; |
int i; |
struct gradedPolySet *grG; |
struct gradedPolySet *grG; |
struct pair *grP; |
struct pair *grP; |
struct arrayOfPOLY *a; |
struct arrayOfPOLY *a; |
struct object rob; |
struct object rob = OINIT; |
struct gradedPolySet *grBases; |
struct gradedPolySet *grBases; |
struct matrixOfPOLY *mp; |
struct matrixOfPOLY *mp; |
struct matrixOfPOLY *backwardMat; |
struct matrixOfPOLY *backwardMat; |
struct object ob1New; |
struct object ob1New = OINIT; |
extern char *F_groebner; |
extern char *F_groebner; |
extern int CheckHomogenization; |
extern int CheckHomogenization; |
extern int StopDegree; |
extern int StopDegree; |
int sdflag = 0; |
int sdflag = 0; |
int forceReduction = 0; |
int forceReduction = 0; |
|
int reduceOnly = 0; |
|
int gbCheck = 0; |
|
|
int ob1Size, ob2Size, noZeroEntry; |
int ob1Size, ob2Size, noZeroEntry; |
int *ob1ToOb2; |
int *ob1ToOb2; |
int *ob1ZeroPos; |
int *ob1ZeroPos; |
int method; |
int method; |
int j,k; |
int j,k; |
struct object rob2; |
struct object rob2 = OINIT; |
struct object rob3; |
struct object rob3 = OINIT; |
struct object rob4; |
struct object rob4 = OINIT; |
struct ring *myring; |
struct ring *myring; |
POLY f; |
POLY f; |
struct object orgB; |
struct object orgB = OINIT; |
struct object newB; |
struct object newB = OINIT; |
struct object orgC; |
struct object orgC = OINIT; |
struct object newC; |
struct object newC = OINIT; |
static struct object paddingVector(struct object ob, int table[], int m); |
static struct object paddingVector(struct object ob, int table[], int m); |
static struct object unitVector(int pos, int size,struct ring *r); |
static struct object unitVector(int pos, int size,struct ring *r); |
extern struct ring *CurrentRingp; |
extern struct ring *CurrentRingp; |
Line 130 struct object Kgroebner(ob) |
|
Line 134 struct object Kgroebner(ob) |
|
needSyz = needBack = 1; |
needSyz = needBack = 1; |
}else if (strcmp(ob2c.lc.str,"forceReduction")==0) { |
}else if (strcmp(ob2c.lc.str,"forceReduction")==0) { |
forceReduction = 1; |
forceReduction = 1; |
|
}else if (strcmp(ob2c.lc.str,"reduceOnly")==0) { |
|
reduceOnly = 1; |
|
}else if (strcmp(ob2c.lc.str,"gbCheck")==0) { |
|
gbCheck = 1; |
}else if (strcmp(ob2c.lc.str,"countDown")==0) { |
}else if (strcmp(ob2c.lc.str,"countDown")==0) { |
countDown = 1; cdflag = 1; |
countDown = 1; cdflag = 1; |
if (needSyz) { |
if (needSyz) { |
Line 251 struct object Kgroebner(ob) |
|
Line 259 struct object Kgroebner(ob) |
|
} |
} |
|
|
a = arrayToArrayOfPOLY(ob2); |
a = arrayToArrayOfPOLY(ob2); |
grG = (*groebner)(a,needBack,needSyz,&grP,countDown,forceReduction); |
grG = (*groebner)(a,needBack,needSyz,&grP,countDown,forceReduction,reduceOnly,gbCheck); |
|
|
if (strcmp(F_groebner,"gm") == 0 && (needBack || needSyz)) { |
if (strcmp(F_groebner,"gm") == 0 && (needBack || needSyz)) { |
warningKan("The options needBack and needSyz are ignored."); |
warningKan("The options needBack and needSyz are ignored."); |
Line 297 struct object Kgroebner(ob) |
|
Line 305 struct object Kgroebner(ob) |
|
|
|
/* To handle zero entries in the input. */ |
/* To handle zero entries in the input. */ |
if (noZeroEntry) { |
if (noZeroEntry) { |
|
rob=KsetAttribute(rob,KpoString("gb"),KpoInteger(grG->gb)); |
return(rob); |
return(rob); |
} |
} |
method = getoaSize(rob); |
method = getoaSize(rob); |
switch(method) { |
switch(method) { |
case 1: |
case 1: |
|
rob=KsetAttribute(rob,KpoString("gb"),KpoInteger(grG->gb)); |
return(rob); |
return(rob); |
break; |
break; |
case 2: |
case 2: |
Line 313 struct object Kgroebner(ob) |
|
Line 323 struct object Kgroebner(ob) |
|
rob2 = newObjectArray(2); |
rob2 = newObjectArray(2); |
putoa(rob2,0,getoa(rob,0)); |
putoa(rob2,0,getoa(rob,0)); |
putoa(rob2,1,newB); |
putoa(rob2,1,newB); |
|
rob2=KsetAttribute(rob2,KpoString("gb"),KpoInteger(grG->gb)); |
return(rob2); |
return(rob2); |
break; |
break; |
case 3: |
case 3: |
Line 333 struct object Kgroebner(ob) |
|
Line 344 struct object Kgroebner(ob) |
|
putoa(rob2,0,getoa(rob,0)); |
putoa(rob2,0,getoa(rob,0)); |
putoa(rob2,1,newB); |
putoa(rob2,1,newB); |
putoa(rob2,2,newC); |
putoa(rob2,2,newC); |
|
rob2=KsetAttribute(rob2,KpoString("gb"),KpoInteger(grG->gb)); |
return(rob2); |
return(rob2); |
break; |
break; |
default: |
default: |
Line 342 struct object Kgroebner(ob) |
|
Line 354 struct object Kgroebner(ob) |
|
|
|
static struct object paddingVector(struct object ob, int table[], int m) |
static struct object paddingVector(struct object ob, int table[], int m) |
{ |
{ |
struct object rob; |
struct object rob = OINIT; |
int i; |
int i; |
rob = newObjectArray(m); |
rob = newObjectArray(m); |
for (i=0; i<m; i++) { |
for (i=0; i<m; i++) { |
Line 357 static struct object paddingVector(struct object ob, i |
|
Line 369 static struct object paddingVector(struct object ob, i |
|
|
|
static struct object unitVector(int pos, int size,struct ring *r) |
static struct object unitVector(int pos, int size,struct ring *r) |
{ |
{ |
struct object rob; |
struct object rob = OINIT; |
int i; |
int i; |
POLY one; |
POLY one; |
rob = newObjectArray(size); |
rob = newObjectArray(size); |
Line 412 struct object polySetToArray(ps,keepRedundant) |
|
Line 424 struct object polySetToArray(ps,keepRedundant) |
|
int keepRedundant; |
int keepRedundant; |
{ |
{ |
int n,i,j; |
int n,i,j; |
struct object ob; |
struct object ob = OINIT; |
if (ps == (struct polySet *)NULL) return(newObjectArray(0)); |
if (ps == (struct polySet *)NULL) return(newObjectArray(0)); |
n = 0; |
n = 0; |
if (keepRedundant) { |
if (keepRedundant) { |
Line 438 struct object gradedPolySetToGradedArray(gps,keepRedun |
|
Line 450 struct object gradedPolySetToGradedArray(gps,keepRedun |
|
struct gradedPolySet *gps; |
struct gradedPolySet *gps; |
int keepRedundant; |
int keepRedundant; |
{ |
{ |
struct object ob,vec; |
struct object ob = OINIT; |
|
struct object vec = OINIT; |
int i; |
int i; |
if (gps == (struct gradedPolySet *)NULL) return(NullObject); |
if (gps == (struct gradedPolySet *)NULL) return(NullObject); |
ob = newObjectArray(gps->maxGrade +1); |
ob = newObjectArray(gps->maxGrade +1); |
Line 456 struct object gradedPolySetToArray(gps,keepRedundant) |
|
Line 469 struct object gradedPolySetToArray(gps,keepRedundant) |
|
struct gradedPolySet *gps; |
struct gradedPolySet *gps; |
int keepRedundant; |
int keepRedundant; |
{ |
{ |
struct object ob,vec; |
struct object ob = OINIT; |
|
struct object vec = OINIT; |
struct polySet *ps; |
struct polySet *ps; |
int k; |
int k; |
int i,j; |
int i,j; |
Line 495 struct object syzPolyToArray(size,f,grG) |
|
Line 509 struct object syzPolyToArray(size,f,grG) |
|
POLY f; |
POLY f; |
struct gradedPolySet *grG; |
struct gradedPolySet *grG; |
{ |
{ |
struct object ob; |
struct object ob = OINIT; |
int i,g0,i0,serial; |
int i,g0,i0,serial; |
|
|
ob = newObjectArray(size); |
ob = newObjectArray(size); |
Line 525 struct object getBackwardArray(grG) |
|
Line 539 struct object getBackwardArray(grG) |
|
/* use serial, del. cf. getBackwardTransformation(). */ |
/* use serial, del. cf. getBackwardTransformation(). */ |
int inputSize,outputSize; |
int inputSize,outputSize; |
int i,j,k; |
int i,j,k; |
struct object ob; |
struct object ob = OINIT; |
struct polySet *ps; |
struct polySet *ps; |
|
|
inputSize = 0; outputSize = 0; |
inputSize = 0; outputSize = 0; |
Line 556 POLY arrayToPOLY(ob) |
|
Line 570 POLY arrayToPOLY(ob) |
|
struct object ob; |
struct object ob; |
{ |
{ |
int size,i; |
int size,i; |
struct object f; |
struct object f = OINIT; |
POLY r; |
POLY r; |
static int nn,mm,ll,cc,n,m,l,c; |
static int nn,mm,ll,cc,n,m,l,c; |
static struct ring *cr = (struct ring *)NULL; |
static struct ring *cr = (struct ring *)NULL; |
Line 605 struct object POLYToArray(ff) |
|
Line 619 struct object POLYToArray(ff) |
|
int k,i,matn,size; |
int k,i,matn,size; |
struct matrixOfPOLY *mat; |
struct matrixOfPOLY *mat; |
POLY ex,sizep; |
POLY ex,sizep; |
struct object ob; |
struct object ob = OINIT; |
|
|
if (ff != ZERO) { |
if (ff != ZERO) { |
tf = ff->m; |
tf = ff->m; |
Line 665 struct object homogenizeObject(ob,gradep) |
|
Line 679 struct object homogenizeObject(ob,gradep) |
|
struct object ob; |
struct object ob; |
int *gradep; |
int *gradep; |
{ |
{ |
struct object rob,ob1; |
struct object rob = OINIT; |
|
struct object ob1 = OINIT; |
int maxg; |
int maxg; |
int gr,flag,i,d,size; |
int gr,flag,i,d,size; |
struct ring *rp; |
struct ring *rp; |
Line 731 struct object homogenizeObject_vec(ob,gradep) |
|
Line 746 struct object homogenizeObject_vec(ob,gradep) |
|
struct object ob; |
struct object ob; |
int *gradep; |
int *gradep; |
{ |
{ |
struct object rob,ob1; |
struct object rob = OINIT; |
|
struct object ob1 = OINIT; |
int maxg; |
int maxg; |
int gr,i,size; |
int gr,i,size; |
POLY f; |
POLY f; |
Line 786 void KresetDegreeShift() { |
|
Line 802 void KresetDegreeShift() { |
|
|
|
struct object homogenizeObject_go(struct object ob,int *gradep) { |
struct object homogenizeObject_go(struct object ob,int *gradep) { |
int size,i,dssize,j; |
int size,i,dssize,j; |
struct object ob0; |
struct object ob0 = OINIT; |
struct object ob1; |
struct object ob1 = OINIT; |
struct object ob2; |
struct object ob2 = OINIT; |
struct object rob; |
struct object rob = OINIT; |
struct object tob; |
struct object tob = OINIT; |
struct object ob1t; |
struct object ob1t = OINIT; |
int *ds; |
int *ds; |
POLY f; |
POLY f; |
int onlyS; |
int onlyS; |
Line 965 struct object oPrincipalPart(ob) |
|
Line 981 struct object oPrincipalPart(ob) |
|
struct object ob; |
struct object ob; |
{ |
{ |
POLY f; |
POLY f; |
struct object rob; |
struct object rob = OINIT; |
|
|
switch(ob.tag) { |
switch(ob.tag) { |
case Spoly: |
case Spoly: |
Line 982 struct object oInitW(ob,oWeight) |
|
Line 998 struct object oInitW(ob,oWeight) |
|
struct object oWeight; |
struct object oWeight; |
{ |
{ |
POLY f; |
POLY f; |
struct object rob; |
struct object rob = OINIT; |
int w[2*N0]; |
int w[2*N0]; |
int n,i; |
int n,i; |
struct object ow; |
struct object ow = OINIT; |
int shiftvec; |
int shiftvec; |
struct object oShift; |
struct object oShift = OINIT; |
int *s; |
int *s; |
int ssize,m; |
int ssize,m; |
|
|
Line 997 struct object oInitW(ob,oWeight) |
|
Line 1013 struct object oInitW(ob,oWeight) |
|
if (oWeight.tag != Sarray) { |
if (oWeight.tag != Sarray) { |
errorKan1("%s\n","oInitW(): the second argument must be array."); |
errorKan1("%s\n","oInitW(): the second argument must be array."); |
} |
} |
|
oWeight = Kto_int32(oWeight); |
n = getoaSize(oWeight); |
n = getoaSize(oWeight); |
if (n == 0) { |
if (n == 0) { |
m = getoaSize(ob); |
m = getoaSize(ob); |
Line 1100 POLY objArrayToPOLY(struct object ob) { |
|
Line 1117 POLY objArrayToPOLY(struct object ob) { |
|
} |
} |
|
|
struct object POLYtoObjArray(POLY f,int size) { |
struct object POLYtoObjArray(POLY f,int size) { |
struct object rob; |
struct object rob = OINIT; |
POLY *pa; |
POLY *pa; |
int d,n,i; |
int d,n,i; |
POLY t; |
POLY t; |
Line 1136 struct object KordWsAll(ob,oWeight) |
|
Line 1153 struct object KordWsAll(ob,oWeight) |
|
struct object oWeight; |
struct object oWeight; |
{ |
{ |
POLY f; |
POLY f; |
struct object rob; |
struct object rob = OINIT; |
int w[2*N0]; |
int w[2*N0]; |
int n,i; |
int n,i; |
struct object ow; |
struct object ow = OINIT; |
int shiftvec; |
int shiftvec; |
struct object oShift; |
struct object oShift = OINIT; |
int *s; |
int *s; |
int ssize,m; |
int ssize,m; |
|
|
Line 1151 struct object KordWsAll(ob,oWeight) |
|
Line 1168 struct object KordWsAll(ob,oWeight) |
|
if (oWeight.tag != Sarray) { |
if (oWeight.tag != Sarray) { |
errorKan1("%s\n","ordWsAll(): the second argument must be array."); |
errorKan1("%s\n","ordWsAll(): the second argument must be array."); |
} |
} |
|
oWeight = Kto_int32(oWeight); |
n = getoaSize(oWeight); |
n = getoaSize(oWeight); |
if (n == 0) { |
if (n == 0) { |
m = getoaSize(ob); |
m = getoaSize(ob); |
Line 1250 int validOutputOrder(int ord[],int n) { |
|
Line 1268 int validOutputOrder(int ord[],int n) { |
|
struct object KsetOutputOrder(struct object ob, struct ring *rp) |
struct object KsetOutputOrder(struct object ob, struct ring *rp) |
{ |
{ |
int n,i; |
int n,i; |
struct object ox; |
struct object ox = OINIT; |
struct object otmp; |
struct object otmp = OINIT; |
int *xxx; |
int *xxx; |
int *ddd; |
int *ddd; |
if (ob.tag != Sarray) { |
if (ob.tag != Sarray) { |
Line 1282 struct object KsetOutputOrder(struct object ob, struct |
|
Line 1300 struct object KsetOutputOrder(struct object ob, struct |
|
|
|
struct object KschreyerSkelton(struct object g) |
struct object KschreyerSkelton(struct object g) |
{ |
{ |
struct object rob; |
struct object rob = OINIT; |
struct object ij; |
struct object ij = OINIT; |
struct object ab; |
struct object ab = OINIT; |
struct object tt; |
struct object tt = OINIT; |
struct arrayOfPOLY *ap; |
struct arrayOfPOLY *ap; |
struct arrayOfMonomialSyz ans; |
struct arrayOfMonomialSyz ans; |
int k; |
int k; |
Line 1331 struct object KvectorToSchreyer_es(struct object obarr |
|
Line 1349 struct object KvectorToSchreyer_es(struct object obarr |
|
int nn; |
int nn; |
POLY f; |
POLY f; |
POLY g; |
POLY g; |
struct object ob; |
struct object ob = OINIT; |
struct ring *rp; |
struct ring *rp; |
if (obarray.tag != Sarray) { |
if (obarray.tag != Sarray) { |
errorKan1("%s\n","KvectorToSchreyer_es(): argument must be an array of polynomials."); |
errorKan1("%s\n","KvectorToSchreyer_es(): argument must be an array of polynomials."); |
Line 1373 struct object KgetExponents(struct object obPoly,struc |
|
Line 1391 struct object KgetExponents(struct object obPoly,struc |
|
POLY f; |
POLY f; |
POLY ff; |
POLY ff; |
MONOMIAL tf; |
MONOMIAL tf; |
struct object rob; |
struct object rob = OINIT; |
struct object tob; |
struct object tob = OINIT; |
static int nn,mm,ll,cc,n,m,l,c; |
static int nn,mm,ll,cc,n,m,l,c; |
static struct ring *cr = (struct ring *)NULL; |
static struct ring *cr = (struct ring *)NULL; |
extern struct ring *CurrentRingp; |
extern struct ring *CurrentRingp; |
Line 1403 struct object KgetExponents(struct object obPoly,struc |
|
Line 1421 struct object KgetExponents(struct object obPoly,struc |
|
} |
} |
|
|
/* type == 0 x,y,Dx,Dy (no commutative, no vector) |
/* 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) |
type == 2 x,y,Dx,Dy,h (commutative & no vector) |
*/ |
*/ |
if (f ISZERO) { |
if (f ISZERO) { |
Line 1442 struct object KgetExponents(struct object obPoly,struc |
|
Line 1460 struct object KgetExponents(struct object obPoly,struc |
|
}else{ |
}else{ |
errorKan1("%s\n","KgetExponent, unknown type."); |
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) { |
if (f ISZERO) { |
tob = newObjectArray(size); |
tob = newObjectArray(size); |
for (i=0; i<size; i++) { |
for (i=0; i<size; i++) { |
Line 1483 struct object KgetExponents(struct object obPoly,struc |
|
Line 1505 struct object KgetExponents(struct object obPoly,struc |
|
} |
} |
if (type == 1) { |
if (type == 1) { |
for (i=cc-1; i>=0; i--) { |
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)); |
putoa(tob,hsize+r,KpoInteger(tf->e[i].x)); |
putoa(tob,r,KpoInteger(tf->e[i].D)); |
|
r++; |
r++; |
} |
} |
}else if (type == 2) { |
}else if (type == 2) { |