version 1.12, 2004/07/30 11:21:55 |
version 1.18, 2005/06/16 05:07:23 |
|
|
/* $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 <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 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 133 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,"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 256 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); |
|
|
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 342 struct object Kgroebner(ob) |
|
Line 347 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 362 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 417 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 443 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 462 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 502 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 532 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 563 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 612 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 672 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 739 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 795 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 974 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 991 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 1006 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 1110 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 1146 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 1161 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 1261 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 1293 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 1342 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 1384 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 1397 struct object KgetExponents(struct object obPoly,struc |
|
Line 1408 struct object KgetExponents(struct object obPoly,struc |
|
tob = KgetExponents(getoa(obPoly,i),otype); |
tob = KgetExponents(getoa(obPoly,i),otype); |
putoa(rob,i,tob); |
putoa(rob,i,tob); |
} |
} |
|
return rob; |
}else{ |
}else{ |
errorKan1("%s\n","KgetExponents(): argument must be a polynomial."); |
errorKan1("%s\n","KgetExponents(): argument must be a polynomial."); |
} |
} |
|
|
/* 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 1441 struct object KgetExponents(struct object obPoly,struc |
|
Line 1453 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 1482 struct object KgetExponents(struct object obPoly,struc |
|
Line 1498 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) { |