Annotation of OpenXM/src/kan96xx/Kan/datatype.h, Revision 1.3
1.3 ! takayama 1: /* $OpenXM: OpenXM/src/kan96xx/Kan/datatype.h,v 1.2 2000/01/16 07:55:38 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:
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;
1.3 ! takayama 76: int weightedHomogenization;
1.1 maekawa 77: };
78:
79:
80: /* exponents */
81: struct exps {
82: int x;
83: int D;
84: };
85:
86: struct expl {
87: int x;
88: };
89: /* linear access to exponent vector */
90: /* Example: (struct monomial *) f; ((struct expl)f->exps).x[i] */
91:
92: struct monomial {
93: struct ring *ringp;
94: struct exps e[N0];
95: };
96:
97: struct monomialDummy {
98: struct ring *ringp;
99: struct exps e[N0-1];
100: };
101:
102: struct smallMonomial {
103: struct ring *ringp;
104: struct exps e[1];
105: };
106:
107: struct listPoly {
108: struct listPoly *next;
109: struct coeff *coeffp;
110: MONOMIAL m;
111: };
112:
113:
114: #define MNULL (MONOMIAL)NULL
115: #define POLYNULL (POLY)NULL
116: #define ISZERO == POLYNULL
117: #define ZERO POLYNULL
118:
119: struct pairOfPOLY {
120: POLY first;
121: POLY second;
122: };
123:
124: /* n
125: ----------------------------
126: m | |
127: | |
128: ----------------------------
129:
130: c.f. matrix.h, mat[i,j] = mat[ i*n + j ]
131: */
132: struct matrixOfPOLY {
133: int m;
134: int n;
135: POLY *mat;
136: };
137:
138: struct arrayOfPOLY {
139: int n;
140: POLY *array;
141: };
142:
143:
144:
145: /* gradedSet */
146: struct syz0 {
147: POLY cf; /* cf*f + \sum syz(grade,i)*g(grade,i) */
148: POLY syz; /* syz is the element of R[x,y] where R is the current ring. */
149: /* cf is the element of R. syz(grade,i) is the coefficient of
150: x^{grade} y^{i}. */
151: };
152:
153: struct polySet {
154: POLY *g; /* g[0], g[1], ... are the elements of the set of poly*/
155: int *del; /* del[i] == 1 ---> redundant element. */
156: struct syz0 **syz; /* syz[i] is the syzygy to get g[i]. */
157: int *mark; /* if (mark[i]), then syz[i] is simplified. */
158: int *serial; /* serial[i]=k ===> g[i] is input[k] */
159: int size; /* size of this set. i.e., g[0], g[1], ..., g[size-1] */
160: int lim;
161: };
162:
163: struct pair {
164: POLY lcm; /* lcm of i and j */
165: int ig; int ii; /* grade and index of i. */
166: int jg; int ji; /* grade and index of j. */
167: int del;
168: int grade; /* grade of lcm */
169: struct pair *next;
170: struct pair *prev;
171: POLY syz; /* if the sp(i,j)-->0, the division process is stored. */
172: };
173:
174: struct gradedPolySet {
175: struct polySet **polys; /* polys[0]: grade=0, polys[1]:grade=1, ... */
176: int maxGrade; /* maximal grade in this set */
177: int lim;
178: };
179:
180: struct gradedPairs {
181: struct pair **pairs; /* pairs[0]: grade=0, .... */
182: int maxGrade;
183: int lim;
184: };
185:
186: struct spValue {
187: /* POLY sp; sp(i,j) = a*i+b*j */
188: POLY a;
189: POLY b;
190: };
191:
192: struct monomialSyz {
193: int i;
194: int j;
195: int deleted;
196: POLY a;
197: POLY b;
198: };
199:
200: struct arrayOfMonomialSyz {
201: int size;
202: int limit;
203: struct monomialSyz **p;
204: };
205:
206:
207:
208:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>