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