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