1 | #ifndef STRUCTS_H |
---|
2 | #define STRUCTS_H |
---|
3 | /**************************************** |
---|
4 | * Computer Algebra System SINGULAR * |
---|
5 | ****************************************/ |
---|
6 | /* $Id$ */ |
---|
7 | /* |
---|
8 | * ABSTRACT |
---|
9 | */ |
---|
10 | |
---|
11 | /* for memset: */ |
---|
12 | #include <string.h> |
---|
13 | /* for omBin */ |
---|
14 | #include <omalloc/omalloc.h> |
---|
15 | #ifdef HAVE_RINGS |
---|
16 | #include <kernel/si_gmp.h> |
---|
17 | #endif |
---|
18 | |
---|
19 | |
---|
20 | /* standard types */ |
---|
21 | #ifdef HAVE_RINGS |
---|
22 | typedef unsigned long NATNUMBER; |
---|
23 | typedef mpz_ptr int_number; |
---|
24 | #endif |
---|
25 | #if (SIZEOF_LONG == 8) |
---|
26 | typedef int BOOLEAN; |
---|
27 | /* testet on x86_64, gcc 3.4.6: 2 % */ |
---|
28 | /* testet on IA64, gcc 3.4.6: 1 % */ |
---|
29 | #else |
---|
30 | /* testet on athlon, gcc 2.95.4: 1 % */ |
---|
31 | typedef short BOOLEAN; |
---|
32 | #endif |
---|
33 | |
---|
34 | typedef void * ADDRESS; |
---|
35 | #define BITSET unsigned int |
---|
36 | |
---|
37 | #if defined(SI_CPU_I386) || defined(SI_CPU_X86_64) |
---|
38 | // the following settings seems to be better on i386 and x86_64 processors |
---|
39 | // define if a*b is with mod instead of tables |
---|
40 | #define HAVE_MULT_MOD |
---|
41 | // #define HAVE_GENERIC_ADD |
---|
42 | // #ifdef HAVE_MULT_MOD |
---|
43 | // #define HAVE_DIV_MOD |
---|
44 | // #endif |
---|
45 | #elif defined(SI_CPU_IA64) |
---|
46 | // the following settings seems to be better on itanium processors |
---|
47 | // #define HAVE_MULT_MOD |
---|
48 | #define HAVE_GENERIC_ADD |
---|
49 | // #ifdef HAVE_MULT_MOD |
---|
50 | // #define HAVE_DIV_MOD |
---|
51 | // #endif |
---|
52 | #elif defined(SI_CPU_SPARC) |
---|
53 | // #define HAVE_GENERIC_ADD |
---|
54 | #define HAVE_MULT_MOD |
---|
55 | #ifdef HAVE_MULT_MOD |
---|
56 | #define HAVE_DIV_MOD |
---|
57 | #endif |
---|
58 | #elif defined(SI_CPU_PPC) |
---|
59 | // the following settings seems to be better on ppc processors |
---|
60 | // testet on: ppc_Linux, 740/750 PowerMac G3, 512k L2 cache |
---|
61 | #define HAVE_MULT_MOD |
---|
62 | // #ifdef HAVE_MULT_MOD |
---|
63 | // #define HAVE_DIV_MOD |
---|
64 | // #endif |
---|
65 | #endif |
---|
66 | |
---|
67 | #if SIZEOF_LONG == 4 |
---|
68 | typedef long long int64; |
---|
69 | #elif SIZEOF_LONG == 8 |
---|
70 | typedef long int64; |
---|
71 | #else |
---|
72 | #error int64 undefined |
---|
73 | #endif |
---|
74 | |
---|
75 | |
---|
76 | enum n_coeffType |
---|
77 | { |
---|
78 | n_unknown=0, |
---|
79 | n_Zp, |
---|
80 | n_Q, |
---|
81 | n_R, |
---|
82 | n_GF, |
---|
83 | n_long_R, |
---|
84 | n_Zp_a, |
---|
85 | n_Q_a, |
---|
86 | n_long_C |
---|
87 | #ifdef HAVE_RINGS |
---|
88 | ,n_Z, |
---|
89 | n_Zm, |
---|
90 | n_Zpn, |
---|
91 | n_Z2n |
---|
92 | #endif |
---|
93 | }; |
---|
94 | |
---|
95 | // #ifdef HAVE_PLURAL |
---|
96 | enum nc_type |
---|
97 | { |
---|
98 | nc_error = -1, // Something's gone wrong! |
---|
99 | nc_general = 0, /* yx=q xy+... */ |
---|
100 | nc_skew, /*1*/ /* yx=q xy */ |
---|
101 | nc_comm, /*2*/ /* yx= xy */ |
---|
102 | nc_lie, /*3*/ /* yx=xy+... */ |
---|
103 | nc_undef, /*4*/ /* for internal reasons */ |
---|
104 | |
---|
105 | nc_exterior /*5*/ // Exterior Algebra(SCA): yx= -xy & (!:) x^2 = 0 |
---|
106 | }; |
---|
107 | // #endif |
---|
108 | |
---|
109 | struct snumber; |
---|
110 | typedef struct snumber * number; |
---|
111 | typedef number (*numberfunc)(number a,number b); |
---|
112 | typedef number (*nMapFunc)(number a); |
---|
113 | |
---|
114 | /* C++-part */ |
---|
115 | #ifdef __cplusplus |
---|
116 | class ip_smatrix; |
---|
117 | class intvec; |
---|
118 | class sleftv; |
---|
119 | class slists; |
---|
120 | class sattr; |
---|
121 | class skStrategy; |
---|
122 | class ssyStrategy; |
---|
123 | class procinfo; |
---|
124 | class kBucket; |
---|
125 | class sBucket; |
---|
126 | class CPolynomialSummator; |
---|
127 | class CGlobalMultiplier; |
---|
128 | class CFormulaPowerMultiplier; |
---|
129 | #endif |
---|
130 | |
---|
131 | struct n_Procs_s; |
---|
132 | struct sip_sring; |
---|
133 | struct sip_link; |
---|
134 | struct spolynom; |
---|
135 | |
---|
136 | struct sip_package; |
---|
137 | typedef struct sip_package ip_package; |
---|
138 | typedef ip_package * package; |
---|
139 | |
---|
140 | // forward for ideals.h: |
---|
141 | struct sip_sideal; |
---|
142 | struct sip_smap; |
---|
143 | typedef struct sip_smap * map; |
---|
144 | typedef struct sip_sideal * ideal; |
---|
145 | |
---|
146 | |
---|
147 | typedef struct n_Procs_s n_Procs_s; |
---|
148 | |
---|
149 | // #ifdef HAVE_PLURAL |
---|
150 | struct nc_struct; |
---|
151 | typedef struct nc_struct nc_struct; |
---|
152 | // #endif |
---|
153 | |
---|
154 | typedef struct spolyrec polyrec; |
---|
155 | typedef struct sip_sring ip_sring; |
---|
156 | typedef struct sip_link ip_link; |
---|
157 | |
---|
158 | /* the pointer types */ |
---|
159 | typedef char * char_ptr; |
---|
160 | typedef int * int_ptr; |
---|
161 | typedef ip_sring * ring; |
---|
162 | typedef polyrec * poly; |
---|
163 | typedef poly * polyset; |
---|
164 | |
---|
165 | #ifdef __cplusplus |
---|
166 | typedef ip_smatrix * matrix; |
---|
167 | typedef ip_link * si_link; |
---|
168 | typedef sleftv * leftv; |
---|
169 | typedef slists * lists; |
---|
170 | typedef sattr * attr; |
---|
171 | typedef skStrategy * kStrategy; |
---|
172 | typedef ssyStrategy * syStrategy; |
---|
173 | typedef procinfo * procinfov; |
---|
174 | typedef kBucket* kBucket_pt; |
---|
175 | typedef sBucket* sBucket_pt; |
---|
176 | typedef struct p_Procs_s p_Procs_s; |
---|
177 | |
---|
178 | struct n_Procs_s |
---|
179 | { |
---|
180 | n_Procs_s* next; |
---|
181 | // the union stuff |
---|
182 | // Zp: |
---|
183 | int npPrimeM; |
---|
184 | int npPminus1M; |
---|
185 | #ifdef HAVE_DIV_MOD |
---|
186 | unsigned short *npInvTable; |
---|
187 | #endif |
---|
188 | #if !defined(HAVE_DIV_MOD) || !defined(HAVE_MULT_MOD) |
---|
189 | unsigned short *npExpTable; |
---|
190 | unsigned short *npLogTable; |
---|
191 | #endif |
---|
192 | // Zp_a, Q_a |
---|
193 | |
---|
194 | // general stuff |
---|
195 | numberfunc nMult, nSub ,nAdd ,nDiv, nIntDiv, nIntMod, nExactDiv; |
---|
196 | number (*cfInit)(int i,const ring r); |
---|
197 | number (*nPar)(int i); |
---|
198 | int (*nParDeg)(number n); |
---|
199 | int (*nSize)(number n); |
---|
200 | int (*n_Int)(number &n, const ring r); |
---|
201 | #ifdef HAVE_RINGS |
---|
202 | int (*nDivComp)(number a,number b); |
---|
203 | BOOLEAN (*nIsUnit)(number a); |
---|
204 | number (*nGetUnit)(number a); |
---|
205 | number (*nExtGcd)(number a, number b, number *s, number *t); |
---|
206 | #endif |
---|
207 | number (*nNeg)(number a); |
---|
208 | number (*nInvers)(number a); |
---|
209 | number (*nCopy)(number a); |
---|
210 | number (*cfCopy)(number a, const ring r); |
---|
211 | number (*nRePart)(number a); |
---|
212 | number (*nImPart)(number a); |
---|
213 | void (*cfWrite)(number &a, const ring r); |
---|
214 | const char * (*nRead)(const char * s, number * a); |
---|
215 | void (*nNormalize)(number &a); |
---|
216 | BOOLEAN (*nGreater)(number a,number b), |
---|
217 | #ifdef HAVE_RINGS |
---|
218 | (*nDivBy)(number a, number b), |
---|
219 | #endif |
---|
220 | (*nEqual)(number a,number b), |
---|
221 | (*nIsZero)(number a), |
---|
222 | (*nIsOne)(number a), |
---|
223 | (*nIsMOne)(number a), |
---|
224 | (*nGreaterZero)(number a); |
---|
225 | void (*nPower)(number a, int i, number * result); |
---|
226 | number (*cfGetDenom)(number &n, const ring r); |
---|
227 | number (*cfGetNumerator)(number &n, const ring r); |
---|
228 | number (*nGcd)(number a, number b, const ring r); |
---|
229 | number (*nLcm)(number a, number b, const ring r); |
---|
230 | void (*cfDelete)(number * a, const ring r); |
---|
231 | nMapFunc (*cfSetMap)(const ring src, const ring dst); |
---|
232 | char * (*nName)(number n); |
---|
233 | void (*nInpMult)(number &a, number b, ring r); |
---|
234 | #ifdef LDEBUG |
---|
235 | BOOLEAN (*nDBTest)(number a, const char *f,const int l); |
---|
236 | #endif |
---|
237 | |
---|
238 | number nNULL; /* the 0 as constant */ |
---|
239 | int char_flag; |
---|
240 | int ref; |
---|
241 | n_coeffType type; |
---|
242 | short nChar; |
---|
243 | }; |
---|
244 | |
---|
245 | /* the function pointer types */ |
---|
246 | |
---|
247 | typedef long (*pLDegProc)(poly p, int *length, ring r); |
---|
248 | typedef long (*pFDegProc)(poly p, ring r); |
---|
249 | typedef void (*p_SetmProc)(poly p, const ring r); |
---|
250 | |
---|
251 | typedef enum |
---|
252 | { |
---|
253 | ro_dp, // ordering is a degree ordering |
---|
254 | ro_wp, // ordering is a weighted degree ordering |
---|
255 | ro_wp64, // ordering is a weighted64 degree ordering |
---|
256 | ro_wp_neg, // ordering is a weighted degree ordering |
---|
257 | // with possibly negative weights |
---|
258 | ro_cp, // ordering duplicates variables |
---|
259 | ro_syzcomp, // ordering indicates "subset" of component number (ringorder_S) |
---|
260 | ro_syz, // ordering with component number >syzcomp is lower (ringorder_s) |
---|
261 | ro_isTemp, ro_is, // Induced Syzygy (Schreyer) ordering (and prefix data placeholder dummy) (ringorder_IS) |
---|
262 | ro_none |
---|
263 | } |
---|
264 | ro_typ; |
---|
265 | |
---|
266 | // ordering is a degree ordering |
---|
267 | struct sro_dp |
---|
268 | { |
---|
269 | short place; // where degree is stored (in L): |
---|
270 | short start; // bounds of ordering (in E): |
---|
271 | short end; |
---|
272 | }; |
---|
273 | typedef struct sro_dp sro_dp; |
---|
274 | |
---|
275 | // ordering is a weighted degree ordering |
---|
276 | struct sro_wp |
---|
277 | { |
---|
278 | short place; // where weighted degree is stored (in L) |
---|
279 | short start; // bounds of ordering (in E) |
---|
280 | short end; |
---|
281 | int *weights; // pointers into wvhdl field |
---|
282 | }; |
---|
283 | typedef struct sro_wp sro_wp; |
---|
284 | |
---|
285 | // ordering is a weighted degree ordering |
---|
286 | struct sro_wp64 |
---|
287 | { |
---|
288 | short place; // where weighted degree is stored (in L) |
---|
289 | short start; // bounds of ordering (in E) |
---|
290 | short end; |
---|
291 | int64 *weights64; // pointers into wvhdl field |
---|
292 | }; |
---|
293 | typedef struct sro_wp64 sro_wp64; |
---|
294 | |
---|
295 | // ordering duplicates variables |
---|
296 | struct sro_cp |
---|
297 | { |
---|
298 | short place; // where start is copied to (in E) |
---|
299 | short start; // bounds of sources of copied variables (in E) |
---|
300 | short end; |
---|
301 | }; |
---|
302 | typedef struct sro_cp sro_cp; |
---|
303 | |
---|
304 | // ordering indicates "subset" of component number |
---|
305 | struct sro_syzcomp |
---|
306 | { |
---|
307 | short place; // where the index is stored (in L) |
---|
308 | long *ShiftedComponents; // pointer into index field |
---|
309 | int* Components; |
---|
310 | #ifdef PDEBUG |
---|
311 | long length; |
---|
312 | #endif |
---|
313 | }; |
---|
314 | typedef struct sro_syzcomp sro_syzcomp; |
---|
315 | |
---|
316 | // ordering with component number >syzcomp is lower |
---|
317 | struct sro_syz |
---|
318 | { |
---|
319 | short place; // where the index is stored (in L) |
---|
320 | int limit; // syzcomp |
---|
321 | int* syz_index; // mapping Component -> SyzIndex for Comp <= limit |
---|
322 | int curr_index; // SyzIndex for Component > limit |
---|
323 | }; |
---|
324 | |
---|
325 | typedef struct sro_syz sro_syz; |
---|
326 | // Induced Syzygy (Schreyer) ordering is built inductively as follows: |
---|
327 | // we look for changes made by ordering blocks which are between prefix/suffix markers: |
---|
328 | // that is: which variables where placed by them and where (judging by v) |
---|
329 | |
---|
330 | // due to prefix/suffix nature we need some placeholder: |
---|
331 | // prefix stores here initial state |
---|
332 | // suffix cleares this up |
---|
333 | struct sro_ISTemp |
---|
334 | { |
---|
335 | short start; // 1st member SHOULD be short "place" |
---|
336 | int suffixpos; |
---|
337 | int* pVarOffset; // copy! |
---|
338 | }; |
---|
339 | |
---|
340 | // So this is the actuall thing! |
---|
341 | // suffix uses last sro_ISTemp (cleares it up afterwards) and |
---|
342 | // creates this block |
---|
343 | struct sro_IS |
---|
344 | { |
---|
345 | short start, end; // which part of L we want to want to update... |
---|
346 | int* pVarOffset; // same as prefix! |
---|
347 | |
---|
348 | int limit; // first referenced component |
---|
349 | |
---|
350 | // reference poly set?? // Should it be owned by ring?!!! |
---|
351 | ideal F; // reference leading (module)-monomials set. owned by ring... |
---|
352 | const intvec* componentWeights; // component weights! owned by ring... |
---|
353 | }; |
---|
354 | |
---|
355 | typedef struct sro_IS sro_IS; |
---|
356 | typedef struct sro_ISTemp sro_ISTemp; |
---|
357 | |
---|
358 | struct sro_ord |
---|
359 | { |
---|
360 | ro_typ ord_typ; |
---|
361 | int order_index; // comes from r->order[order_index] |
---|
362 | union |
---|
363 | { |
---|
364 | sro_dp dp; |
---|
365 | sro_wp wp; |
---|
366 | sro_wp64 wp64; |
---|
367 | sro_cp cp; |
---|
368 | sro_syzcomp syzcomp; |
---|
369 | sro_syz syz; |
---|
370 | sro_IS is; |
---|
371 | sro_ISTemp isTemp; |
---|
372 | } data; |
---|
373 | }; |
---|
374 | |
---|
375 | #ifdef HAVE_PLURAL |
---|
376 | // NC pProcs: |
---|
377 | typedef poly (*mm_Mult_p_Proc_Ptr)(const poly m, poly p, const ring r); |
---|
378 | typedef poly (*mm_Mult_pp_Proc_Ptr)(const poly m, const poly p, const ring r); |
---|
379 | |
---|
380 | typedef ideal (*GB_Proc_Ptr)(const ideal F, const ideal Q, const intvec *w, const intvec *hilb, kStrategy strat); |
---|
381 | |
---|
382 | typedef poly (*SPoly_Proc_Ptr)(const poly p1, const poly p2, const ring r); |
---|
383 | typedef poly (*SPolyReduce_Proc_Ptr)(const poly p1, poly p2, const ring r); |
---|
384 | |
---|
385 | typedef void (*bucket_Proc_Ptr)(kBucket_pt b, poly p, number *c); |
---|
386 | |
---|
387 | struct nc_pProcs |
---|
388 | { |
---|
389 | public: |
---|
390 | mm_Mult_p_Proc_Ptr mm_Mult_p; |
---|
391 | mm_Mult_pp_Proc_Ptr mm_Mult_pp; |
---|
392 | |
---|
393 | bucket_Proc_Ptr BucketPolyRed; |
---|
394 | bucket_Proc_Ptr BucketPolyRed_Z; |
---|
395 | |
---|
396 | SPoly_Proc_Ptr SPoly; |
---|
397 | SPolyReduce_Proc_Ptr ReduceSPoly; |
---|
398 | |
---|
399 | GB_Proc_Ptr GB; |
---|
400 | // GlobalGB, // BBA |
---|
401 | // LocalGB; // MORA |
---|
402 | }; |
---|
403 | |
---|
404 | |
---|
405 | struct nc_struct |
---|
406 | { |
---|
407 | nc_type type; |
---|
408 | //ring basering; // the ring C,D,.. live in (commutative ring with this NC structure!) |
---|
409 | |
---|
410 | // initial data: square matrices rVar() x rVar() |
---|
411 | // logically: upper triangular!!! |
---|
412 | // TODO: eliminate this waste of memory!!!! |
---|
413 | matrix C; |
---|
414 | matrix D; |
---|
415 | |
---|
416 | // computed data: |
---|
417 | matrix *MT; // size 0.. (rVar()*rVar()-1)/2 |
---|
418 | matrix COM; |
---|
419 | int *MTsize; // size 0.. (rVar()*rVar()-1)/2 |
---|
420 | |
---|
421 | // IsSkewConstant indicates whethere coeffs C_ij are all equal, |
---|
422 | // effective together with nc_type=nc_skew |
---|
423 | int IsSkewConstant; |
---|
424 | |
---|
425 | private: |
---|
426 | // internal data for different implementations |
---|
427 | // if dynamic => must be deallocated in destructor (nc_rKill!) |
---|
428 | union |
---|
429 | { |
---|
430 | struct |
---|
431 | { |
---|
432 | // treat variables from iAltVarsStart till iAltVarsEnd as alternating vars. |
---|
433 | // these variables should have odd degree, though that will not be checked |
---|
434 | // iAltVarsStart, iAltVarsEnd are only used together with nc_type=nc_exterior |
---|
435 | // 1 <= iAltVarsStart <= iAltVarsEnd <= r->N |
---|
436 | unsigned int iFirstAltVar, iLastAltVar; // = 0 by default |
---|
437 | |
---|
438 | // for factors of super-commutative algebras we need |
---|
439 | // the part of general quotient ideal modulo squares! |
---|
440 | ideal idSCAQuotient; // = NULL by default. // must be deleted in Kill! |
---|
441 | } sca; |
---|
442 | } data; |
---|
443 | |
---|
444 | CGlobalMultiplier* m_Multiplier; |
---|
445 | CFormulaPowerMultiplier* m_PowerMultiplier; |
---|
446 | |
---|
447 | public: |
---|
448 | |
---|
449 | inline nc_type& ncRingType() { return (type); }; |
---|
450 | inline nc_type ncRingType() const { return (type); }; |
---|
451 | |
---|
452 | inline unsigned int& FirstAltVar() |
---|
453 | { assume(ncRingType() == nc_exterior); return (data.sca.iFirstAltVar); }; |
---|
454 | inline unsigned int& LastAltVar () |
---|
455 | { assume(ncRingType() == nc_exterior); return (data.sca.iLastAltVar ); }; |
---|
456 | |
---|
457 | inline unsigned int FirstAltVar() const |
---|
458 | { assume(ncRingType() == nc_exterior); return (data.sca.iFirstAltVar); }; |
---|
459 | inline unsigned int LastAltVar () const |
---|
460 | { assume(ncRingType() == nc_exterior); return (data.sca.iLastAltVar ); }; |
---|
461 | |
---|
462 | inline ideal& SCAQuotient() |
---|
463 | { assume(ncRingType() == nc_exterior); return (data.sca.idSCAQuotient); }; |
---|
464 | |
---|
465 | inline CGlobalMultiplier* GetGlobalMultiplier() const |
---|
466 | { assume(ncRingType() != nc_exterior); return (m_Multiplier); }; |
---|
467 | |
---|
468 | inline CGlobalMultiplier*& GetGlobalMultiplier() |
---|
469 | { assume(ncRingType() != nc_exterior); return (m_Multiplier); }; |
---|
470 | |
---|
471 | |
---|
472 | inline CFormulaPowerMultiplier* GetFormulaPowerMultiplier() const |
---|
473 | { assume(ncRingType() != nc_exterior); return (m_PowerMultiplier); }; |
---|
474 | |
---|
475 | inline CFormulaPowerMultiplier*& GetFormulaPowerMultiplier() |
---|
476 | { assume(ncRingType() != nc_exterior); return (m_PowerMultiplier); }; |
---|
477 | |
---|
478 | public: |
---|
479 | nc_pProcs p_Procs; // NC procedures. |
---|
480 | |
---|
481 | }; |
---|
482 | #endif |
---|
483 | |
---|
484 | class idrec; |
---|
485 | typedef idrec * idhdl; |
---|
486 | |
---|
487 | struct sip_sring |
---|
488 | { |
---|
489 | // each entry must have a description and a procedure defining it, |
---|
490 | // general ordering: pointer/structs, long, int, short, BOOLEAN/char/enum |
---|
491 | // general defining procedures: rInit, rComplete, interpreter, ?? |
---|
492 | idhdl idroot; /* local objects , interpreter*/ |
---|
493 | int* order; /* array of orderings, rInit/rSleftvOrdering2Ordering */ |
---|
494 | int* block0; /* starting pos., rInit/rSleftvOrdering2Ordering*/ |
---|
495 | int* block1; /* ending pos., rInit/rSleftvOrdering2Ordering*/ |
---|
496 | char** parameter; /* names of parameters, rInit */ |
---|
497 | number minpoly; /* for Q_a/Zp_a, rInit */ |
---|
498 | ideal minideal; |
---|
499 | int** wvhdl; /* array of weight vectors, rInit/rSleftvOrdering2Ordering */ |
---|
500 | char ** names; /* array of variable names, rInit */ |
---|
501 | |
---|
502 | // what follows below here should be set by rComplete, _only_ |
---|
503 | long *ordsgn; /* array of +/- 1 (or 0) for comparing monomials */ |
---|
504 | /* ExpL_Size entries*/ |
---|
505 | |
---|
506 | // is NULL for lp or N == 1, otherwise non-NULL (with OrdSize > 0 entries) */ |
---|
507 | sro_ord* typ; /* array of orderings + sizes, OrdSize entries */ |
---|
508 | /* if NegWeightL_Size > 0, then NegWeightL_Offset[0..size_1] is index of longs |
---|
509 | in ExpVector whose values need an offset due to negative weights */ |
---|
510 | /* array of NegWeigtL_Size indicies */ |
---|
511 | int* NegWeightL_Offset; |
---|
512 | |
---|
513 | int* VarOffset; |
---|
514 | |
---|
515 | ideal qideal; /* extension to the ring structure: qring, rInit */ |
---|
516 | |
---|
517 | int* firstwv; |
---|
518 | |
---|
519 | omBin PolyBin; /* Bin from where monoms are allocated */ |
---|
520 | #ifdef HAVE_RINGS |
---|
521 | unsigned int ringtype; /* cring = 0 => coefficient field, cring = 1 => coeffs from Z/2^m */ |
---|
522 | int_number ringflaga; /* Z/(ringflag^ringflagb)=Z/nrnModul*/ |
---|
523 | unsigned long ringflagb; |
---|
524 | unsigned long nr2mModul; /* Z/nr2mModul */ |
---|
525 | int_number nrnModul; |
---|
526 | #endif |
---|
527 | unsigned long options; /* ring dependent options */ |
---|
528 | |
---|
529 | int ch; /* characteristic, rInit */ |
---|
530 | int ref; /* reference counter to the ring, interpreter */ |
---|
531 | |
---|
532 | short float_len; /* additional char-flags, rInit */ |
---|
533 | short float_len2; /* additional char-flags, rInit */ |
---|
534 | |
---|
535 | short N; /* number of vars, rInit */ |
---|
536 | |
---|
537 | short P; /* number of pars, rInit */ |
---|
538 | short OrdSgn; /* 1 for polynomial rings, -1 otherwise, rInit */ |
---|
539 | |
---|
540 | short firstBlockEnds; |
---|
541 | #ifdef HAVE_PLURAL |
---|
542 | short real_var_start, real_var_end; |
---|
543 | #endif |
---|
544 | |
---|
545 | #ifdef HAVE_SHIFTBBA |
---|
546 | short isLPring; /* 0 for non-letterplace rings, otherwise the number of LP blocks, at least 1, known also as lV */ |
---|
547 | #endif |
---|
548 | |
---|
549 | BOOLEAN VectorOut; |
---|
550 | BOOLEAN ShortOut; |
---|
551 | BOOLEAN CanShortOut; |
---|
552 | BOOLEAN LexOrder; // TRUE if the monomial ordering has polynomial and power series blocks |
---|
553 | BOOLEAN MixedOrder; // TRUE for global/local mixed orderings, FALSE otherwise |
---|
554 | |
---|
555 | BOOLEAN ComponentOrder; // ??? |
---|
556 | |
---|
557 | // what follows below here should be set by rComplete, _only_ |
---|
558 | // contains component, but no weight fields in E */ |
---|
559 | short ExpL_Size; // size of exponent vector in long |
---|
560 | short CmpL_Size; // portions which need to be compared |
---|
561 | /* number of long vars in exp vector: |
---|
562 | long vars are those longs in the exponent vector which are |
---|
563 | occupied by variables, only */ |
---|
564 | short VarL_Size; |
---|
565 | short BitsPerExp; /* number of bits per exponent */ |
---|
566 | short ExpPerLong; /* maximal number of Exponents per long */ |
---|
567 | short pCompIndex; /* p->exp.e[pCompIndex] is the component */ |
---|
568 | short pOrdIndex; /* p->exp[pOrdIndex] is pGetOrd(p) */ |
---|
569 | short OrdSize; /* size of ord vector (in sro_ord) */ |
---|
570 | |
---|
571 | /* if >= 0, long vars in exp vector are consecutive and start there |
---|
572 | if < 0, long vars in exp vector are not consecutive */ |
---|
573 | short VarL_LowIndex; |
---|
574 | // number of exponents in r->VarL_Offset[0] |
---|
575 | // is minimal number of exponents in a long var |
---|
576 | short MinExpPerLong; |
---|
577 | |
---|
578 | short NegWeightL_Size; |
---|
579 | /* array of size VarL_Size, |
---|
580 | VarL_Offset[i] gets i-th long var in exp vector */ |
---|
581 | int* VarL_Offset; |
---|
582 | |
---|
583 | /* mask for getting single exponents */ |
---|
584 | unsigned long bitmask; |
---|
585 | /* mask used for divisiblity tests */ |
---|
586 | unsigned long divmask; // rComplete |
---|
587 | |
---|
588 | p_Procs_s* p_Procs; // rComplete/p_ProcsSet |
---|
589 | |
---|
590 | /* FDeg and LDeg */ |
---|
591 | pFDegProc pFDeg; // rComplete/rSetDegStuff |
---|
592 | pLDegProc pLDeg; // rComplete/rSetDegStuff |
---|
593 | |
---|
594 | /* as it was determined by rComplete */ |
---|
595 | pFDegProc pFDegOrig; |
---|
596 | /* and as it was determined before rOptimizeLDeg */ |
---|
597 | pLDegProc pLDegOrig; |
---|
598 | |
---|
599 | p_SetmProc p_Setm; |
---|
600 | n_Procs_s* cf; |
---|
601 | ring algring; |
---|
602 | #ifdef HAVE_PLURAL |
---|
603 | private: |
---|
604 | nc_struct* _nc; // private |
---|
605 | public: |
---|
606 | inline const nc_struct* GetNC() const { return _nc; }; // public!!! |
---|
607 | inline nc_struct*& GetNC() { return _nc; }; // public!!! |
---|
608 | #endif |
---|
609 | }; |
---|
610 | |
---|
611 | #endif /* __cplusplus */ |
---|
612 | |
---|
613 | |
---|
614 | |
---|
615 | /* |
---|
616 | ** 7. runtime procedures/global data |
---|
617 | */ |
---|
618 | |
---|
619 | /* 7.1 C-routines : */ |
---|
620 | |
---|
621 | |
---|
622 | #ifdef __cplusplus |
---|
623 | extern "C" { |
---|
624 | #endif |
---|
625 | void m2_end(int i) __attribute__((noreturn)); |
---|
626 | #ifdef __cplusplus |
---|
627 | } |
---|
628 | #endif |
---|
629 | |
---|
630 | /* 7.2 C++-routines : */ |
---|
631 | |
---|
632 | #ifdef __cplusplus |
---|
633 | int inits(void); |
---|
634 | int IsPrime(int i); |
---|
635 | extern int siSeed; |
---|
636 | int siRand(); |
---|
637 | #endif |
---|
638 | |
---|
639 | #define loop for(;;) |
---|
640 | |
---|
641 | #ifndef ABS |
---|
642 | #define ABS(x) ((x)<0?(-(x)):(x)) |
---|
643 | #endif |
---|
644 | |
---|
645 | #if defined(__cplusplus) |
---|
646 | static inline int si_max(const int a, const int b) { return (a>b) ? a : b; } |
---|
647 | static inline int si_min(const int a, const int b) { return (a<b) ? a : b; } |
---|
648 | static inline long si_max(const long a, const long b) { return (a>b) ? a : b; } |
---|
649 | static inline unsigned long si_max(const unsigned long a, const unsigned long b) { return (a>b) ? a : b; } |
---|
650 | static inline long si_min(const long a, const long b) { return (a<b) ? a : b; } |
---|
651 | static inline unsigned long si_min(const unsigned long a, const unsigned long b) { return (a<b) ? a : b; } |
---|
652 | #else |
---|
653 | #define si_max(A,B) ((A) > (B) ? (A) : (B)) |
---|
654 | #define si_min(A,B) ((A) < (B) ? (A) : (B)) |
---|
655 | #endif |
---|
656 | |
---|
657 | extern omBin char_ptr_bin; |
---|
658 | extern omBin sleftv_bin; |
---|
659 | |
---|
660 | #endif |
---|
661 | |
---|