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