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