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