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