source: git/libpolys/polys/monomials/ring.h @ a374b8

spielwiese
Last change on this file since a374b8 was a374b8, checked in by Oleksandr Motsak <motsak@…>, 13 years ago
FIX: rCompose and rDecompose are only used in iparith (and declared there)
  • Property mode set to 100644
File size: 22.3 KB
Line 
1#ifndef RING_H
2#define RING_H
3/****************************************
4*  Computer Algebra System SINGULAR     *
5****************************************/
6/*
7* ABSTRACT - the interpreter related ring operations
8*/
9
10/* includes */
11#include <omalloc/omalloc.h>
12#include <misc/auxiliary.h>
13#include <coeffs/coeffs.h>
14//#include <polys/monomials/polys-impl.h>
15//
16
17/* constants */
18#define SHORT_REAL_LENGTH 6 // use short reals for real <= 6 digits
19
20/* forward declaration of types */
21class idrec;
22typedef idrec *   idhdl;
23struct  spolyrec;
24typedef struct spolyrec    polyrec;
25typedef polyrec *          poly;
26struct ip_sring;
27typedef struct ip_sring *         ring;
28class intvec;
29class int64vec;
30struct p_Procs_s;
31typedef struct p_Procs_s p_Procs_s;
32//class slists;
33//typedef slists *           lists;
34class kBucket;
35typedef kBucket*           kBucket_pt;
36
37struct sip_sideal;
38typedef struct sip_sideal *       ideal;
39
40struct sip_smap;
41typedef struct sip_smap *         map;
42
43
44#if SIZEOF_LONG == 4
45typedef long long int64;
46#elif SIZEOF_LONG == 8
47typedef long int64;
48#else
49#error int64 undefined
50#endif
51
52/* the function pointer types */
53
54typedef long     (*pLDegProc)(poly p, int *length, ring r);
55typedef long     (*pFDegProc)(poly p, ring r);
56typedef void     (*p_SetmProc)(poly p, const ring r);
57
58
59/// returns a poly from dest_r which is a ShallowCopy of s_p from source_r
60/// assumes that source_r->N == dest_r->N and that orderings are the same
61typedef poly (*pShallowCopyDeleteProc)(poly s_p, ring source_r, ring dest_r, 
62                                       omBin dest_bin);
63
64
65typedef enum
66{
67  ro_dp, // ordering is a degree ordering
68  ro_wp, // ordering is a weighted degree ordering
69  ro_wp64, // ordering is a weighted64 degree ordering
70  ro_wp_neg, // ordering is a weighted degree ordering
71             // with possibly negative weights
72  ro_cp,    // ordering duplicates variables
73  ro_syzcomp, // ordering indicates "subset" of component number (ringorder_S)
74  ro_syz, // ordering  with component number >syzcomp is lower (ringorder_s)
75  ro_isTemp, ro_is, // Induced Syzygy (Schreyer) ordering (and prefix data placeholder dummy) (ringorder_IS)
76  ro_none
77}
78ro_typ;
79
80// ordering is a degree ordering
81struct sro_dp
82{
83  short place;  // where degree is stored (in L):
84  short start;  // bounds of ordering (in E):
85  short end;
86};
87typedef struct sro_dp sro_dp;
88
89// ordering is a weighted degree ordering
90struct sro_wp
91{
92  short place;  // where weighted degree is stored (in L)
93  short start;  // bounds of ordering (in E)
94  short end;
95  int *weights; // pointers into wvhdl field
96};
97typedef struct sro_wp sro_wp;
98
99// ordering is a weighted degree ordering
100struct sro_wp64
101{
102    short place;  // where weighted degree is stored (in L)
103    short start;  // bounds of ordering (in E)
104    short end;
105    int64 *weights64; // pointers into wvhdl field
106};
107typedef struct sro_wp64 sro_wp64;
108
109// ordering duplicates variables
110struct sro_cp
111{
112  short place;  // where start is copied to (in E)
113  short start;  // bounds of sources of copied variables (in E)
114  short end;
115};
116typedef struct sro_cp sro_cp;
117
118// ordering indicates "subset" of component number
119struct sro_syzcomp
120{
121  short place;  // where the index is stored (in L)
122  long *ShiftedComponents; // pointer into index field
123  int* Components;
124#ifdef PDEBUG
125  long length;
126#endif
127};
128typedef struct sro_syzcomp sro_syzcomp;
129
130// ordering  with component number >syzcomp is lower
131struct sro_syz
132{
133  short place;       // where the index is stored (in L)
134  int limit;         // syzcomp
135  int* syz_index;    // mapping Component -> SyzIndex for Comp <= limit
136  int  curr_index;   // SyzIndex for Component > limit
137};
138
139typedef struct sro_syz sro_syz;
140// Induced Syzygy (Schreyer) ordering is built inductively as follows:
141// we look for changes made by ordering blocks which are between prefix/suffix markers:
142// that is: which variables where placed by them and where (judging by v)
143
144// due to prefix/suffix nature we need some placeholder:
145// prefix stores here initial state
146// suffix cleares this up
147struct sro_ISTemp
148{
149  short start; // 1st member SHOULD be short "place"
150  int   suffixpos;
151  int*  pVarOffset; // copy!
152};
153
154// So this is the actuall thing!
155// suffix uses last sro_ISTemp (cleares it up afterwards) and
156// creates this block
157struct sro_IS
158{
159  short start, end;  // which part of L we want to want to update...
160  int*  pVarOffset; // same as prefix!
161
162  int limit; // first referenced component
163
164  // reference poly set?? // Should it be owned by ring?!!!
165  ideal F; // reference leading (module)-monomials set. owned by ring...
166  const intvec* componentWeights; // component weights! owned by ring...
167};
168
169typedef struct sro_IS sro_IS;
170typedef struct sro_ISTemp sro_ISTemp;
171
172struct sro_ord
173{
174  ro_typ  ord_typ;
175  int     order_index; // comes from r->order[order_index]
176  union
177  {
178     sro_dp dp;
179     sro_wp wp;
180     sro_wp64 wp64;
181     sro_cp cp;
182     sro_syzcomp syzcomp;
183     sro_syz syz;
184     sro_IS is;
185     sro_ISTemp isTemp;
186  } data;
187};
188
189#ifdef HAVE_PLURAL
190struct nc_struct;
191typedef struct nc_struct   nc_struct;
192#endif
193
194struct ip_sring
195{
196// each entry must have a description and a procedure defining it,
197// general ordering: pointer/structs, long, int, short, BOOLEAN/char/enum
198// general defining procedures: rInit, rComplete, interpreter, ??
199  idhdl      idroot; /* local objects , interpreter*/
200  int*       order;  /* array of orderings, rInit/rSleftvOrdering2Ordering */
201  int*       block0; /* starting pos., rInit/rSleftvOrdering2Ordering*/
202  int*       block1; /* ending pos., rInit/rSleftvOrdering2Ordering*/
203//  char**     parameter; /* names of parameters, rInit */
204//  number     minpoly;  /* replaced by minideal->m[0] */
205  ideal      minideal;   /* for Q_a/Zp_a, rInit;
206                            for a start, we assume that there is either no
207                            or exactly one generator in minideal, playing
208                            the role of the former minpoly; minideal may
209                            also be NULL which coincides with the
210                            no-generator-case */
211  int**      wvhdl;  /* array of weight vectors, rInit/rSleftvOrdering2Ordering */
212  char **    names;  /* array of variable names, rInit */
213
214  // what follows below here should be set by rComplete, _only_
215  long      *ordsgn;  /* array of +/- 1 (or 0) for comparing monomials */
216                       /*  ExpL_Size entries*/
217
218  // is NULL for lp or N == 1, otherwise non-NULL (with OrdSize > 0 entries) */
219  sro_ord*   typ;   /* array of orderings + sizes, OrdSize entries */
220  /* if NegWeightL_Size > 0, then NegWeightL_Offset[0..size_1] is index of longs
221  in ExpVector whose values need an offset due to negative weights */
222  /* array of NegWeigtL_Size indicies */
223  int*      NegWeightL_Offset;
224
225  int*     VarOffset;
226
227  ideal      qideal; /* extension to the ring structure: qring, rInit */
228
229  int*     firstwv;
230
231  omBin    PolyBin; /* Bin from where monoms are allocated */
232  intvec * pModW;   /* std: module weights */
233  poly      ppNoether; /*  variables, set by procedures from hecke/kstd1:
234
235                            the highest monomial below pHEdge */
236// #ifdef HAVE_RINGS
237//   unsigned int  cf->ringtype;  /* cring = 0 => coefficient field, cring = 1 => coeffs from Z/2^m */
238//   int_number    cf->modBase; /* Z/(ringflag^cf->modExponent)=Z/cf->modNumber*/
239//   unsigned long cf->modExponent;
240//   unsigned long cf->modNumber;  /* Z/cf->modNumber */
241//   int_number    cf->modNumber;
242// #endif
243 
244  unsigned long options; /* ring dependent options */
245
246//  int        ch;  /* characteristic, rInit */
247  int        ref; /* reference counter to the ring, interpreter */
248
249  short      float_len; /* additional char-flags, rInit */
250  short      float_len2; /* additional char-flags, rInit */
251
252  short      N;      /* number of vars, rInit */
253
254  short      OrdSgn; /* 1 for polynomial rings, -1 otherwise, rInit */
255
256  short     firstBlockEnds;
257#ifdef HAVE_PLURAL
258  short     real_var_start, real_var_end;
259#endif
260
261#ifdef HAVE_SHIFTBBA
262  short          isLPring; /* 0 for non-letterplace rings, otherwise the number of LP blocks, at least 1, known also as lV */
263#endif
264
265  BOOLEAN   VectorOut;
266  BOOLEAN   ShortOut;
267  BOOLEAN   CanShortOut;
268  BOOLEAN   LexOrder; // TRUE if the monomial ordering has polynomial and power series blocks
269  BOOLEAN   MixedOrder; // TRUE for global/local mixed orderings, FALSE otherwise
270  BOOLEAN   pLexOrder; /* TRUE if the monomial ordering is not compatible with pFDeg */
271
272  BOOLEAN   ComponentOrder; // ???
273
274  // what follows below here should be set by rComplete, _only_
275  // contains component, but no weight fields in E */
276  short      ExpL_Size; // size of exponent vector in long
277  short      CmpL_Size; // portions which need to be compared
278  /* number of long vars in exp vector:
279     long vars are those longs in the exponent vector which are
280     occupied by variables, only */
281  short      VarL_Size;
282  short      BitsPerExp; /* number of bits per exponent */
283  short      ExpPerLong; /* maximal number of Exponents per long */
284  short      pCompIndex; /* p->exp.e[pCompIndex] is the component */
285  short      pOrdIndex; /* p->exp[pOrdIndex] is pGetOrd(p) */
286  short      OrdSize; /* size of ord vector (in sro_ord) */
287
288  /* if >= 0, long vars in exp vector are consecutive and start there
289     if <  0, long vars in exp vector are not consecutive */
290  short     VarL_LowIndex;
291  // number of exponents in r->VarL_Offset[0]
292  // is minimal number of exponents in a long var
293  short     MinExpPerLong;
294
295  short     NegWeightL_Size;
296  /* array of size VarL_Size,
297     VarL_Offset[i] gets i-th long var in exp vector */
298  int*      VarL_Offset;
299
300  /* mask for getting single exponents */
301  unsigned long bitmask;
302  /* mask used for divisiblity tests */
303  unsigned long divmask; // rComplete
304
305  p_Procs_s*    p_Procs; // rComplete/p_ProcsSet
306
307  /* FDeg and LDeg */
308  pFDegProc     pFDeg; // rComplete/rSetDegStuff
309  pLDegProc     pLDeg; // rComplete/rSetDegStuff
310
311  /* as it was determined by rComplete */
312  pFDegProc     pFDegOrig;
313  /* and as it was determined before rOptimizeLDeg */
314  pLDegProc     pLDegOrig;
315
316  p_SetmProc    p_Setm;
317  n_Procs_s*    cf;
318#ifdef HAVE_PLURAL
319  private:
320    nc_struct*    _nc; // private
321  public:
322    inline const nc_struct* GetNC() const { return _nc; }; // public!!!
323    inline nc_struct*& GetNC() { return _nc; }; // public!!!
324#endif
325 public:
326  operator coeffs() const { return cf; }
327};
328
329enum tHomog
330{
331   isNotHomog = FALSE,
332   isHomog    = TRUE,
333   testHomog
334};
335
336////////// DEPRECATED
337/////// void   rChangeCurrRing(ring r);
338//void   rSetHdl(idhdl h);
339//ring   rInit(sleftv* pn, sleftv* rv, sleftv* ord);
340idhdl  rDefault(const char *s);
341ring   rDefault(int ch, int N, char **n);
342ring   rDefault(const coeffs cf, int N, char **n);
343ring rDefault(int ch, int N, char **n,int ord_size, int *ord, int *block0, int *block1);
344ring rDefault(const coeffs cf, int N, char **n,int ord_size, int *ord, int *block0, int *block1);
345
346// #define rIsRingVar(A) r_IsRingVar(A,currRing)
347int    r_IsRingVar(const char *n, ring r);
348void   rWrite(ring r);
349//void   rKill(idhdl h);
350void   rKill(ring r);
351ring   rCopy(ring r);
352ring   rCopy0(const ring r, BOOLEAN copy_qideal = TRUE, BOOLEAN copy_ordering = TRUE);
353ring rCopy0AndAddA(ring r, int64vec *wv64, BOOLEAN copy_qideal = TRUE,
354                   BOOLEAN copy_ordering = TRUE);
355ring   rOpposite(ring r);
356ring   rEnvelope(ring r);
357
358/// we must always have this test!
359static inline bool rIsPluralRing(const ring r)
360{
361  assume(r != NULL);   
362#ifdef HAVE_PLURAL
363  nc_struct *n;
364  return (r != NULL) && ((n=r->GetNC()) != NULL) /*&& (n->type != nc_error)*/;
365#else
366  return false;
367#endif
368}
369
370static inline bool rIsRatGRing(const ring r)
371{
372  assume(r != NULL);
373#ifdef HAVE_PLURAL
374  /* nc_struct *n; */
375  return (r != NULL) /* && ((n=r->GetNC()) != NULL) */
376          && (r->real_var_start>1);
377#else
378  return false;
379#endif
380}
381
382
383
384
385// The following are for LaScala3 only!
386void rChangeSComps(int* currComponents, long* currShiftedComponents, int length, ring r);
387void rGetSComps(int** currComponents, long** currShiftedComponents, int *length, ring r);
388
389
390
391//idhdl  rFindHdl(ring r, idhdl n, idhdl w);
392//idhdl rSimpleFindHdl(ring r, idhdl root, idhdl n);
393const char * rSimpleOrdStr(int ord);
394int rOrderName(char * ordername);
395char * rOrdStr(ring r);
396char * rVarStr(ring r);
397char * rCharStr(ring r);
398char * rString(ring r);
399int    rChar(ring r);
400
401char * rParStr(ring r);
402
403int    rSum(ring r1, ring r2, ring &sum);
404int rSumInternal(ring r1, ring r2, ring &sum, BOOLEAN vartest, BOOLEAN dp_dp);
405
406BOOLEAN rEqual(ring r1, ring r2, BOOLEAN qr = 1);
407BOOLEAN rSamePolyRep(ring r1, ring r2);
408void   rUnComplete(ring r);
409
410BOOLEAN rRing_is_Homog(ring r);
411BOOLEAN rRing_has_CompLastBlock(ring r);
412
413#ifdef HAVE_RINGS
414static inline BOOLEAN rField_is_Ring_2toM(const ring r)
415{ assume(r != NULL); return ( getCoeffType(r->cf) == n_Z2m && nCoeff_is_Ring_2toM(r->cf) ); }
416
417static inline BOOLEAN rField_is_Ring_ModN(const ring r)
418{ assume(r != NULL); return ( getCoeffType(r->cf) == n_Zn && nCoeff_is_Ring_ModN(r->cf) ); }
419
420static inline BOOLEAN rField_is_Ring_PtoM(const ring r)
421{ assume(r != NULL); return (getCoeffType(r->cf) == n_Zpn && nCoeff_is_Ring_PtoM(r->cf) ); }
422
423static inline BOOLEAN rField_is_Ring_Z(const ring r)
424{ assume(r != NULL); return (getCoeffType(r->cf) == n_Z && nCoeff_is_Ring_Z(r->cf) ); }
425
426static inline BOOLEAN rField_is_Ring(const ring r)
427{ assume(r != NULL); return nCoeff_is_Ring(r->cf); }
428
429static inline BOOLEAN rField_is_Domain(const ring r)
430{ assume(r != NULL); return nCoeff_is_Domain(r->cf); }
431
432static inline BOOLEAN rField_has_Units(const ring r)
433{ assume(r != NULL); return nCoeff_has_Units(r->cf); }
434#else
435#define rField_is_Ring(A) (0)
436#define rField_is_Ring_2toM(A) (0)
437#define rField_is_Ring_ModN(A) (0)
438#define rField_is_Ring_PtoM(A) (0)
439#define rField_is_Ring_Z(A) (0)
440#define rField_is_Domain(A) (1)
441#define rField_has_Units(A) (1)
442#endif
443
444static inline BOOLEAN rField_is_Zp(const ring r)
445{ assume(r != NULL); return (getCoeffType(r->cf) == n_Zp); }
446
447static inline BOOLEAN rField_is_Zp(const ring r, int p)
448{ assume(r != NULL); return (getCoeffType(r->cf) == n_Zp) && (r->cf->ch == p); }
449
450static inline BOOLEAN rField_is_Q(const ring r)
451{ assume(r != NULL); return nCoeff_is_Q(r->cf); }
452
453static inline BOOLEAN rField_is_numeric(const ring r) /* R, long R, long C */
454{ assume(r != NULL); return nCoeff_is_numeric(r->cf); }
455
456static inline BOOLEAN rField_is_R(const ring r)
457{ assume(r != NULL); return nCoeff_is_R(r->cf); }
458
459static inline BOOLEAN rField_is_GF(const ring r)
460{ assume(r != NULL); return nCoeff_is_GF(r->cf); }
461
462static inline BOOLEAN rField_is_GF(const ring r, int q)
463{ assume(r != NULL); return nCoeff_is_GF(r->cf, q); }
464
465/* DO NOT USE; just here for compatibility reasons towards
466   the SINGULAR svn trunk */
467static inline BOOLEAN rField_is_Zp_a(const ring r)
468{ assume(r != NULL); return nCoeff_is_Zp_a(r->cf); }
469
470/* DO NOT USE; just here for compatibility reasons towards
471   the SINGULAR svn trunk */
472static inline BOOLEAN rField_is_Zp_a(const ring r, int p)
473{ assume(r != NULL); return nCoeff_is_Zp_a(r->cf, p); }
474
475/* DO NOT USE; just here for compatibility reasons towards
476   the SINGULAR svn trunk */
477static inline BOOLEAN rField_is_Q_a(const ring r)
478{ assume(r != NULL); return nCoeff_is_Q_a(r->cf); }
479   
480static inline BOOLEAN rField_is_long_R(const ring r)
481{ assume(r != NULL); return nCoeff_is_long_R(r->cf); }
482
483static inline BOOLEAN rField_is_long_C(const ring r)
484{ assume(r != NULL); return nCoeff_is_long_C(r->cf); }
485
486static inline BOOLEAN rField_has_simple_inverse(const ring r)
487{ assume(r != NULL); return nCoeff_has_simple_inverse(r->cf); }
488
489static inline BOOLEAN rField_has_simple_Alloc(const ring r)
490{ assume(r != NULL); return nCoeff_has_simple_Alloc(r->cf); }
491
492/* Z/p, GF(p,n), R: nCopy, nNew, nDelete are dummies*/
493static inline BOOLEAN rField_is_Extension(const ring r)
494{ assume(r != NULL); return nCoeff_is_Extension(r->cf); } /* Z/p(a) and Q(a)*/
495
496n_coeffType rFieldType(const ring r);
497
498/// this needs to be called whenever a new ring is created: new fields
499/// in ring are created (like VarOffset), unless they already exist
500/// with force == 1, new fields are _always_ created (overwritten),
501/// even if they exist
502BOOLEAN rComplete(ring r, int force = 0);
503// use this to free fields created by rComplete //?
504
505static inline int rBlocks(ring r)
506{
507  assume(r != NULL);
508  int i=0;
509  while (r->order[i]!=0) i++;
510  return i+1;
511}
512
513// misc things
514static inline char* rRingVar(short i, const ring r)
515{
516  assume(r != NULL); return r->names[i];
517}
518static inline BOOLEAN rShortOut(const ring r)
519{
520  assume(r != NULL); return (r->ShortOut);
521}
522
523/// #define rVar(r) (r->N)
524static inline short rVar(const ring r)
525{
526  assume(r != NULL);
527  return r->N;
528}
529
530/// (r->cf->P)
531static inline short rPar(const ring r)
532{
533  assume(r != NULL);
534  const coeffs C = r->cf;
535  assume(C != NULL);
536
537  if( rField_is_Extension(r) )
538  {
539    const ring R = C->extRing;
540    assume( R != NULL );
541    return rVar( R );
542  }
543  return 0;
544}
545
546
547/// (r->cf->parameter)
548static inline char** rParameter(const ring r)
549{
550  assume(r != NULL);
551  const coeffs C = r->cf;
552  assume(C != NULL);
553
554  if( rField_is_Extension(r) )
555  {
556    const ring R = C->extRing;
557    assume( R != NULL );
558    return R->names;
559  }
560  return NULL;
561}
562
563/// return the specified parameter as a (new!) number in the given
564/// polynomial ring, or NULL if invalid
565number n_Param(const short iParameter, const ring r);
566
567   
568/* R, Q, Fp: FALSE */
569static inline BOOLEAN rIsExtension(const ring r)
570{
571  assume( (rParameter(r)!=NULL) == rField_is_Extension(r) ); // ?
572  return rField_is_Extension(r);
573}
574
575/// Tests whether '(r->cf->minpoly) == NULL'
576BOOLEAN rMinpolyIsNULL(const ring r);
577
578
579/// order stuff
580typedef enum rRingOrder_t
581{
582  ringorder_no = 0,
583  ringorder_a,
584  ringorder_a64, ///< for int64 weights
585  ringorder_c,
586  ringorder_C,
587  ringorder_M,
588  ringorder_S, ///< S?
589  ringorder_s, ///< s?
590  ringorder_lp,
591  ringorder_dp,
592  ringorder_rp,
593  ringorder_Dp,
594  ringorder_wp,
595  ringorder_Wp,
596  ringorder_ls,
597  ringorder_ds,
598  ringorder_Ds,
599  ringorder_ws,
600  ringorder_Ws,
601  ringorder_L,
602  // the following are only used internally
603  ringorder_aa, ///< for idElimination, like a, except pFDeg, pWeigths ignore it
604  ringorder_rs, ///< ???
605  ringorder_IS, ///< Induced (Schreyer) ordering
606  ringorder_unspec
607} rRingOrder_t;
608
609typedef enum rOrderType_t
610{
611  rOrderType_General = 0, ///< non-simple ordering as specified by currRing
612  rOrderType_CompExp,     ///< simple ordering, component has priority
613  rOrderType_ExpComp,     ///< simple ordering, exponent vector has priority
614                          ///< component not compatible with exp-vector order
615  rOrderType_Exp,         ///< simple ordering, exponent vector has priority
616                          ///< component is compatible with exp-vector order
617  rOrderType_Syz,         ///< syzygy ordering
618  rOrderType_Schreyer,    ///< Schreyer ordering
619  rOrderType_Syz2dpc,     ///< syzcomp2dpc
620  rOrderType_ExpNoComp    ///< simple ordering, differences in component are
621                          ///< not considered
622} rOrderType_t;
623
624static inline BOOLEAN rIsSyzIndexRing(const ring r)
625{ assume(r != NULL); return r->order[0] == ringorder_s;}
626
627static inline int rGetCurrSyzLimit(const ring r)
628{ assume(r != NULL); return (rIsSyzIndexRing(r)? r->typ[0].data.syz.limit : 0);}
629
630void   rSetSyzComp(int k, const ring r);
631
632// Ring Manipulations
633ring   rAssure_HasComp(const ring r, BOOLEAN complete = TRUE);
634ring   rAssure_SyzComp(const ring r, BOOLEAN complete = TRUE);
635ring   rAssure_dp_S(const ring r, BOOLEAN complete = TRUE);
636ring   rAssure_dp_C(const ring r, BOOLEAN complete = TRUE);
637ring   rAssure_C_dp(const ring r, BOOLEAN complete = TRUE);
638/// makes sure that c/C ordering is last ordering
639ring   rAssure_CompLastBlock(const ring r, BOOLEAN complete = TRUE);
640
641/// makes sure that c/C ordering is last ordering and SyzIndex is first
642ring   rAssure_SyzComp_CompLastBlock(const ring r, BOOLEAN complete = TRUE);
643ring   rAssure_TDeg(const ring r, int start_var, int end_var, int &pos);
644
645/// return the max-comonent wchich has syzIndex i
646/// Assume: i<= syzIndex_limit
647int rGetMaxSyzComp(int i, const ring r);
648
649BOOLEAN rHasSimpleOrder(const ring r);
650
651/// returns TRUE, if simple lp or ls ordering
652BOOLEAN rHasSimpleLexOrder(const ring r);
653
654//???? return TRUE if p->exp[r->pOrdIndex] holds total degree of p ???
655
656
657inline BOOLEAN rHasGlobalOrdering(const ring r){ return (r->OrdSgn==1); }
658inline BOOLEAN rHasLocalOrMixedOrdering(const ring r){ return (r->OrdSgn==-1); }
659
660// #define rHasGlobalOrdering(R) ((R)->OrdSgn==1)
661// #define rHasLocalOrMixedOrdering(R) ((R)->OrdSgn==-1)
662
663#define rHasGlobalOrdering_currRing() rHasGlobalOrdering(currRing)
664#define rHasLocalOrMixedOrdering_currRing() rHasLocalOrMixedOrdering(currRing)
665
666BOOLEAN rOrd_is_Totaldegree_Ordering(ring r );
667
668/// return TRUE if p_SetComp requires p_Setm
669BOOLEAN rOrd_SetCompRequiresSetm(ring r);
670rOrderType_t    rGetOrderType(ring r);
671
672/// returns TRUE if var(i) belongs to p-block
673BOOLEAN rIsPolyVar(int i, ring r);
674
675static inline BOOLEAN rOrd_is_Comp_dp(ring r)
676{
677  assume(r != NULL);
678  return ((r->order[0] == ringorder_c || r->order[0] == ringorder_C) &&
679          r->order[1] == ringorder_dp &&
680          r->order[2] == 0);
681}
682
683#ifdef RDEBUG
684#define rTest(r)    rDBTest(r, __FILE__, __LINE__)
685extern BOOLEAN rDBTest(ring r, const char* fn, const int l);
686#else
687#define rTest(r)
688#endif
689
690ring rModifyRing(ring r, BOOLEAN omit_degree,
691                         BOOLEAN omit_comp,
692                         unsigned long exp_limit);
693
694/// construct Wp, C ring
695ring rModifyRing_Wp(ring r, int* weights);
696void rModify_a_to_A(ring r);
697
698void rKillModifiedRing(ring r);
699// also frees weights
700void rKillModified_Wp_Ring(ring r);
701
702ring rModifyRing_Simple(ring r, BOOLEAN omit_degree, BOOLEAN omit_comp, unsigned long exp_limit, BOOLEAN &simple);
703void rKillModifiedRing_Simple(ring r);
704
705#ifdef RDEBUG
706void rDebugPrint(ring r);
707void pDebugPrint(poly p);
708void p_DebugPrint(poly p, const ring r);
709#endif
710
711#ifndef NDEBUG
712/// debug-print at most nTerms (2 by default) terms from poly/vector p,
713/// assuming that lt(p) lives in lmRing and tail(p) lives in tailRing.
714void p_DebugPrint(const poly p, const ring lmRing, const ring tailRing, const int nTerms = 2);
715#endif
716
717int64 * rGetWeightVec(ring r);
718void rSetWeightVec(ring r, int64 *wv);
719
720/////////////////////////////
721// Auxillary functions
722//
723
724/* return the varIndex-th ring variable as a poly;
725   varIndex starts at index 1 */
726poly rGetVar(const int varIndex, const ring r);
727
728BOOLEAN rSetISReference(const ring r, const ideal F, const int i = 0, const int p = 0, const intvec * componentWeights = NULL);
729
730BOOLEAN rCheckIV(intvec *iv);
731int rTypeOfMatrixOrder(intvec * order);
732void rDelete(ring r);
733
734extern omBin sip_sring_bin;
735#endif
Note: See TracBrowser for help on using the repository browser.