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