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