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