Annotation of OpenXM/src/kan96xx/Kan/datatype.h, Revision 1.12
1.12 ! takayama 1: /* $OpenXM: OpenXM/src/kan96xx/Kan/datatype.h,v 1.11 2005/06/16 06:54:55 takayama Exp $ */
1.1 maekawa 2: #include "gmp.h"
3:
4: /* GC */
5: void *GC_malloc(size_t size);
6: void *GC_realloc(void *p,size_t new);
7: void *sGC_malloc(size_t size);
8: void *sGC_realloc2(void *p,size_t old,size_t new);
9: void sGC_free2(void *p,size_t size);
10: void sGC_free(void *p);
11: /* six function for kan/protocol/0 */
12: int KSexecuteString(char *s);
13: char *KSpopString(void);
14: int KSset(char *name);
15: int KSpushBinary(int size,char *data);
16: char *KSpopBinary(int *size);
17: void KSstart();
18: void KSstop();
19:
20: /*********** You may modify these system constants below **********************/
21: #define N0 100 /* maximal number of variables. !-VARS=N0 */
22:
23: /*******************************************************************/
24:
25: #define INPUTLIMIT 600 /* used for input data */ /* 300 */
26: #define AGLIMIT 110 /* dbm3.c */ /* 100, 300 */
27: /* NEWSIZE, NEWLIMIET in dbm3.c
28: and OB_ARRAY_MAX, ARGV_WORK_MAX in stackmachine.c
29: must be larger than AGLIMIT. They are automatically
30: determined by the value of AGLIMIT. */
31:
1.6 takayama 32: #define LARGE_NEGATIVE_NUMBER (-0x7fffffff) /* for 32 bit */
1.1 maekawa 33:
34: typedef struct listPoly * POLY;
35: typedef struct monomial * MONOMIAL;
36: typedef enum {UNKNOWN,INTEGER,MP_INTEGER,POLY_COEFF} coeffType;
37:
38: /************** definition for the coeff ****************/
39: union number {
40: int i;
41: MP_INT *bigp;
42: MP_RAT *ratp;
43: POLY f;
44: };
45:
46: struct coeff {
47: coeffType tag;
48: int p; /* characteristic */
49: union number val;
50: };
51:
52: /******************************************************/
53:
54: struct ring {
55: int p;
56: int n;
57: int nn;
58: int m;
59: int mm;
60: int l;
61: int ll;
62: int c; /* c must be larger than or equal 1. D[0] is homog. var.
63: cf. mmLarger*/
64: int cc;
65: char **x;
66: char **D;
1.12 ! takayama 67: char **Dsmall;
1.1 maekawa 68: int *order; /* [i][j] ---> [i*2*N+j] */
69: int orderMatrixSize;
70: int *from;
71: int *to;
72: struct ring *next;
73: POLY (*multiplication)();
74: int schreyer;
75: void *gbListTower;
76: int *outputOrder;
77: char *name;
1.3 takayama 78: int weightedHomogenization;
1.4 takayama 79: int degreeShiftSize;
1.5 takayama 80: int degreeShiftN;
1.4 takayama 81: int *degreeShift;
1.10 takayama 82: int partialEcart;
83: int *partialEcartGlobalVarX;
84:
85: /* To be used. */
86: void *ringInInputForm;
1.1 maekawa 87: };
88:
89:
90: /* exponents */
91: struct exps {
92: int x;
93: int D;
94: };
95:
96: struct expl {
97: int x;
98: };
99: /* linear access to exponent vector */
100: /* Example: (struct monomial *) f; ((struct expl)f->exps).x[i] */
101:
102: struct monomial {
103: struct ring *ringp;
104: struct exps e[N0];
105: };
106:
107: struct monomialDummy {
108: struct ring *ringp;
109: struct exps e[N0-1];
110: };
111:
112: struct smallMonomial {
113: struct ring *ringp;
114: struct exps e[1];
115: };
116:
117: struct listPoly {
118: struct listPoly *next;
119: struct coeff *coeffp;
120: MONOMIAL m;
121: };
122:
123:
124: #define MNULL (MONOMIAL)NULL
125: #define POLYNULL (POLY)NULL
126: #define ISZERO == POLYNULL
127: #define ZERO POLYNULL
128:
129: struct pairOfPOLY {
130: POLY first;
131: POLY second;
132: };
133:
134: /* n
135: ----------------------------
136: m | |
137: | |
138: ----------------------------
139:
140: c.f. matrix.h, mat[i,j] = mat[ i*n + j ]
141: */
142: struct matrixOfPOLY {
143: int m;
144: int n;
145: POLY *mat;
146: };
147:
148: struct arrayOfPOLY {
149: int n;
150: POLY *array;
151: };
152:
153:
154:
155: /* gradedSet */
156: struct syz0 {
157: POLY cf; /* cf*f + \sum syz(grade,i)*g(grade,i) */
158: POLY syz; /* syz is the element of R[x,y] where R is the current ring. */
159: /* cf is the element of R. syz(grade,i) is the coefficient of
160: x^{grade} y^{i}. */
161: };
162:
163: struct polySet {
164: POLY *g; /* g[0], g[1], ... are the elements of the set of poly*/
165: int *del; /* del[i] == 1 ---> redundant element. */
166: struct syz0 **syz; /* syz[i] is the syzygy to get g[i]. */
167: int *mark; /* if (mark[i]), then syz[i] is simplified. */
168: int *serial; /* serial[i]=k ===> g[i] is input[k] */
169: int size; /* size of this set. i.e., g[0], g[1], ..., g[size-1] */
1.7 takayama 170: int lim;
171: POLY *gh; /* gh[i] = homogenize(g[i]) for ecart division */
1.8 takayama 172: int *gen; /* gen[i] == 1 --> given generators */
1.9 takayama 173: POLY *gmod; /* gmod = g mod p for TraceLift. */
1.1 maekawa 174: };
175:
176: struct pair {
177: POLY lcm; /* lcm of i and j */
178: int ig; int ii; /* grade and index of i. */
179: int jg; int ji; /* grade and index of j. */
180: int del;
181: int grade; /* grade of lcm */
182: struct pair *next;
183: struct pair *prev;
184: POLY syz; /* if the sp(i,j)-->0, the division process is stored. */
185: };
186:
187: struct gradedPolySet {
188: struct polySet **polys; /* polys[0]: grade=0, polys[1]:grade=1, ... */
189: int maxGrade; /* maximal grade in this set */
190: int lim;
1.11 takayama 191: int gb; /* it is gb or not. */
192: int reduced; /* it is reduced gb or not. */
1.1 maekawa 193: };
194:
195: struct gradedPairs {
196: struct pair **pairs; /* pairs[0]: grade=0, .... */
197: int maxGrade;
198: int lim;
199: };
200:
201: struct spValue {
202: /* POLY sp; sp(i,j) = a*i+b*j */
203: POLY a;
204: POLY b;
205: };
206:
207: struct monomialSyz {
208: int i;
209: int j;
210: int deleted;
211: POLY a;
212: POLY b;
213: };
214:
215: struct arrayOfMonomialSyz {
216: int size;
217: int limit;
218: struct monomialSyz **p;
219: };
220:
221:
222:
223:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>