version 1.2, 2001/05/04 01:06:24 |
version 1.5, 2003/07/17 07:33:03 |
|
|
|
/* $OpenXM: OpenXM/src/kan96xx/Kan/kanExport1.c,v 1.4 2003/07/13 07:53:17 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; |
|
int DegreeShifto_size = 0; |
|
int *DegreeShifto_vec = NULL; |
|
|
/** :kan, :ring */ |
/** :kan, :ring */ |
struct object Kreduction(f,set) |
struct object Kreduction(f,set) |
struct object f; |
struct object f; |
Line 683 struct object homogenizeObject(ob,gradep) |
|
Line 688 struct object homogenizeObject(ob,gradep) |
|
rob = newObjectArray(size); |
rob = newObjectArray(size); |
flag = 0; |
flag = 0; |
ob1 = getoa(ob,0); |
ob1 = getoa(ob,0); |
|
if (ob1.tag == Sdollar) return(homogenizeObject_go(ob,gradep)); |
ob1 = homogenizeObject(ob1,&gr); |
ob1 = homogenizeObject(ob1,&gr); |
maxg = gr; |
maxg = gr; |
getoa(rob,0) = ob1; |
getoa(rob,0) = ob1; |
Line 744 struct object homogenizeObject_vec(ob,gradep) |
|
Line 750 struct object homogenizeObject_vec(ob,gradep) |
|
if (size == 0) { |
if (size == 0) { |
errorKan1("%s\n","homogenizeObject_vec() is called for the empty array."); |
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); |
rob = newObjectArray(size); |
for (i=0; i<size; i++) { |
for (i=0; i<size; i++) { |
ob1 = getoa(ob,i); |
ob1 = getoa(ob,i); |
Line 763 struct object homogenizeObject_vec(ob,gradep) |
|
Line 770 struct object homogenizeObject_vec(ob,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 < 2) |
|
errorKan1("%s\n","homogenizeObject_go(): [(degreeShift) shift-vector obj] or [(degreeShift) shift-vector] or [(degreeShift) (value)] homogenize"); |
|
ob1 = getoa(ob,1); |
|
if (ob1.tag != Sarray) { |
|
if (DegreeShifto_size != 0) { |
|
return DegreeShifto; |
|
}else{ |
|
rob = NullObject; |
|
return rob; |
|
} |
|
} |
|
dssize = getoaSize(ob1); |
|
ds = (int *)sGC_malloc(sizeof(int)*(dssize>0?dssize:1)); |
|
for (i=0; i<dssize; i++) { |
|
ds[i] = objToInteger(getoa(ob1,i)); |
|
} |
|
if (size == 2) { |
|
DegreeShifto = ob1; |
|
DegreeShifto_size = dssize; |
|
DegreeShifto_vec = ds; |
|
rob = ob1; |
|
}else{ |
|
ob2 = getoa(ob,2); |
|
if (ob2.tag == Spoly) { |
|
f = goHomogenize11(KopPOLY(ob2),ds,dssize,-1,0); |
|
rob = KpoPOLY(f); |
|
}else if (ob2.tag == SuniversalNumber) { |
|
rob = ob2; |
|
}else if (ob2.tag == Sarray) { |
|
rob = newObjectArray(getoaSize(ob2)); |
|
for (i=0; i<getoaSize(ob2); i++) { |
|
tob = newObjectArray(3); |
|
ob1t = newObjectArray(dssize); |
|
if (getoa(ob2,i).tag == Spoly) { |
|
for (j=0; j<dssize; j++) getoa(ob1t,j) = KpoInteger(0); |
|
for (j=0; j<dssize-i; j++) getoa(ob1t,j) = getoa(ob1,j+i); |
|
}else{ |
|
ob1t = ob1; |
|
} |
|
getoa(tob,0) = ob0; getoa(tob,1) = ob1t; getoa(tob,2) = getoa(ob2,i); |
|
getoa(rob,i) = homogenizeObject_go(tob,gradep); |
|
} |
|
}else{ |
|
errorKan1("%s\n","homogenizeObject_go(): invalid object for the third element."); |
|
} |
|
} |
|
}else{ |
|
errorKan1("%s\n","homogenizeObject_go(): unknown key word."); |
|
} |
|
return( rob ); |
|
} |
|
|
|
|
struct ring *oRingp(ob) |
struct ring *oRingp(ob) |
struct object ob; |
struct object ob; |
{ |
{ |
Line 999 struct object KvectorToSchreyer_es(struct object obarr |
|
Line 1079 struct object KvectorToSchreyer_es(struct object obarr |
|
} |
} |
} |
} |
return(KpoPOLY(f)); |
return(KpoPOLY(f)); |
|
} |
|
|
|
int objToInteger(struct object ob) { |
|
if (ob.tag == Sinteger) { |
|
return KopInteger(ob); |
|
}else if (ob.tag == SuniversalNumber) { |
|
return(coeffToInt(KopUniversalNumber(ob))); |
|
}else { |
|
errorKan1("%s\n","objToInteger(): invalid argument."); |
|
} |
} |
} |