source: git/libpolys/polys/monomials/ring.h @ 5fe834

spielwiese
Last change on this file since 5fe834 was 5fe834, checked in by Oleksandr Motsak <motsak@…>, 13 years ago
FIX: libpolys and kernel should use rDelete instead of rKill!
  • Property mode set to 100644
File size: 22.5 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
339ring   rDefault(int ch, int N, char **n);
340ring   rDefault(const coeffs cf, int N, char **n);
341ring   rDefault(int ch, int N, char **n,int ord_size, int *ord, int *block0, int *block1);
342ring   rDefault(const coeffs cf, int N, char **n,int ord_size, int *ord, int *block0, int *block1);
343
344// #define rIsRingVar(A) r_IsRingVar(A,currRing)
345int    r_IsRingVar(const char *n, ring r);
346void   rWrite(ring r);
347// void   rKill(idhdl h);
348// void   rKill(ring r);
349ring   rCopy(ring r);
350ring   rCopy0(const ring r, BOOLEAN copy_qideal = TRUE, BOOLEAN copy_ordering = TRUE);
351ring rCopy0AndAddA(ring r, int64vec *wv64, BOOLEAN copy_qideal = TRUE,
352                   BOOLEAN copy_ordering = TRUE);
353ring   rOpposite(ring r);
354ring   rEnvelope(ring r);
355
356/// we must always have this test!
357static inline bool rIsPluralRing(const ring r)
358{
359  assume(r != NULL);   
360#ifdef HAVE_PLURAL
361  nc_struct *n;
362  return (r != NULL) && ((n=r->GetNC()) != NULL) /*&& (n->type != nc_error)*/;
363#else
364  return false;
365#endif
366}
367
368static inline bool rIsRatGRing(const ring r)
369{
370  assume(r != NULL);
371#ifdef HAVE_PLURAL
372  /* nc_struct *n; */
373  return (r != NULL) /* && ((n=r->GetNC()) != NULL) */
374          && (r->real_var_start>1);
375#else
376  return false;
377#endif
378}
379
380
381
382
383// The following are for LaScala3 only!
384void rChangeSComps(int* currComponents, long* currShiftedComponents, int length, ring r);
385void rGetSComps(int** currComponents, long** currShiftedComponents, int *length, ring r);
386
387
388
389//idhdl  rFindHdl(ring r, idhdl n, idhdl w);
390//idhdl rSimpleFindHdl(ring r, idhdl root, idhdl n);
391const char * rSimpleOrdStr(int ord);
392int rOrderName(char * ordername);
393char * rOrdStr(ring r);
394char * rVarStr(ring r);
395char * rCharStr(ring r);
396char * rString(ring r);
397int    rChar(ring r);
398
399char * rParStr(ring r);
400
401int    rSum(ring r1, ring r2, ring &sum);
402int rSumInternal(ring r1, ring r2, ring &sum, BOOLEAN vartest, BOOLEAN dp_dp);
403
404BOOLEAN rEqual(ring r1, ring r2, BOOLEAN qr = 1);
405BOOLEAN rSamePolyRep(ring r1, ring r2);
406void   rUnComplete(ring r);
407
408BOOLEAN rRing_is_Homog(ring r);
409BOOLEAN rRing_has_CompLastBlock(ring r);
410
411#ifdef HAVE_RINGS
412static inline BOOLEAN rField_is_Ring_2toM(const ring r)
413{ assume(r != NULL); return ( getCoeffType(r->cf) == n_Z2m && nCoeff_is_Ring_2toM(r->cf) ); }
414
415static inline BOOLEAN rField_is_Ring_ModN(const ring r)
416{ assume(r != NULL); return ( getCoeffType(r->cf) == n_Zn && nCoeff_is_Ring_ModN(r->cf) ); }
417
418static inline BOOLEAN rField_is_Ring_PtoM(const ring r)
419{ assume(r != NULL); return (getCoeffType(r->cf) == n_Zpn && nCoeff_is_Ring_PtoM(r->cf) ); }
420
421static inline BOOLEAN rField_is_Ring_Z(const ring r)
422{ assume(r != NULL); return (getCoeffType(r->cf) == n_Z && nCoeff_is_Ring_Z(r->cf) ); }
423
424static inline BOOLEAN rField_is_Ring(const ring r)
425{ assume(r != NULL); return nCoeff_is_Ring(r->cf); }
426
427static inline BOOLEAN rField_is_Domain(const ring r)
428{ assume(r != NULL); return nCoeff_is_Domain(r->cf); }
429
430static inline BOOLEAN rField_has_Units(const ring r)
431{ assume(r != NULL); return nCoeff_has_Units(r->cf); }
432#else
433#define rField_is_Ring(A) (0)
434#define rField_is_Ring_2toM(A) (0)
435#define rField_is_Ring_ModN(A) (0)
436#define rField_is_Ring_PtoM(A) (0)
437#define rField_is_Ring_Z(A) (0)
438#define rField_is_Domain(A) (1)
439#define rField_has_Units(A) (1)
440#endif
441
442static inline BOOLEAN rField_is_Zp(const ring r)
443{ assume(r != NULL); return (getCoeffType(r->cf) == n_Zp); }
444
445static inline BOOLEAN rField_is_Zp(const ring r, int p)
446{ assume(r != NULL); return (getCoeffType(r->cf) == n_Zp) && (r->cf->ch == p); }
447
448static inline BOOLEAN rField_is_Q(const ring r)
449{ assume(r != NULL); return nCoeff_is_Q(r->cf); }
450
451static inline BOOLEAN rField_is_numeric(const ring r) /* R, long R, long C */
452{ assume(r != NULL); return nCoeff_is_numeric(r->cf); }
453
454static inline BOOLEAN rField_is_R(const ring r)
455{ assume(r != NULL); return nCoeff_is_R(r->cf); }
456
457static inline BOOLEAN rField_is_GF(const ring r)
458{ assume(r != NULL); return nCoeff_is_GF(r->cf); }
459
460static inline BOOLEAN rField_is_GF(const ring r, int q)
461{ assume(r != NULL); return nCoeff_is_GF(r->cf, q); }
462
463/* DO NOT USE; just here for compatibility reasons towards
464   the SINGULAR svn trunk */
465static inline BOOLEAN rField_is_Zp_a(const ring r)
466{ assume(r != NULL); return nCoeff_is_Zp_a(r->cf); }
467
468/* DO NOT USE; just here for compatibility reasons towards
469   the SINGULAR svn trunk */
470static inline BOOLEAN rField_is_Zp_a(const ring r, int p)
471{ assume(r != NULL); return nCoeff_is_Zp_a(r->cf, p); }
472
473/* DO NOT USE; just here for compatibility reasons towards
474   the SINGULAR svn trunk */
475static inline BOOLEAN rField_is_Q_a(const ring r)
476{ assume(r != NULL); return nCoeff_is_Q_a(r->cf); }
477   
478static inline BOOLEAN rField_is_long_R(const ring r)
479{ assume(r != NULL); return nCoeff_is_long_R(r->cf); }
480
481static inline BOOLEAN rField_is_long_C(const ring r)
482{ assume(r != NULL); return nCoeff_is_long_C(r->cf); }
483
484static inline BOOLEAN rField_has_simple_inverse(const ring r)
485{ assume(r != NULL); return nCoeff_has_simple_inverse(r->cf); }
486
487static inline BOOLEAN rField_has_simple_Alloc(const ring r)
488{ assume(r != NULL); return nCoeff_has_simple_Alloc(r->cf); }
489
490/* Z/p, GF(p,n), R: nCopy, nNew, nDelete are dummies*/
491static inline BOOLEAN rField_is_Extension(const ring r)
492{ assume(r != NULL); return nCoeff_is_Extension(r->cf); } /* Z/p(a) and Q(a)*/
493
494n_coeffType rFieldType(const ring r);
495
496/// this needs to be called whenever a new ring is created: new fields
497/// in ring are created (like VarOffset), unless they already exist
498/// with force == 1, new fields are _always_ created (overwritten),
499/// even if they exist
500BOOLEAN rComplete(ring r, int force = 0);
501// use this to free fields created by rComplete //?
502
503static inline int rBlocks(ring r)
504{
505  assume(r != NULL);
506  int i=0;
507  while (r->order[i]!=0) i++;
508  return i+1;
509}
510
511// misc things
512static inline char* rRingVar(short i, const ring r)
513{
514  assume(r != NULL); return r->names[i];
515}
516static inline BOOLEAN rShortOut(const ring r)
517{
518  assume(r != NULL); return (r->ShortOut);
519}
520
521/// #define rVar(r) (r->N)
522static inline short rVar(const ring r)
523{
524  assume(r != NULL);
525  return r->N;
526}
527
528/// (r->cf->P)
529static inline short rPar(const ring r)
530{
531  assume(r != NULL);
532  const coeffs C = r->cf;
533  assume(C != NULL);
534
535  if( rField_is_Extension(r) )
536  {
537    const ring R = C->extRing;
538    assume( R != NULL );
539    return rVar( R );
540  }
541  return 0;
542}
543
544
545/// (r->cf->parameter)
546static inline char** rParameter(const ring r)
547{
548  assume(r != NULL);
549  const coeffs C = r->cf;
550  assume(C != NULL);
551
552  if( rField_is_Extension(r) )
553  {
554    const ring R = C->extRing;
555    assume( R != NULL );
556    return R->names;
557  }
558  return NULL;
559}
560
561/// return the specified parameter as a (new!) number in the given
562/// polynomial ring, or NULL if invalid
563/// parameters (as variables) begin with 1!
564number n_Param(const short iParameter, const ring r);
565
566/// if m == var(i)/1 => return i,
567int n_IsParam(number m, const ring r);
568
569//#define  rInternalChar(r) ((r)->cf->ch)
570static inline int rInternalChar(const ring r)
571{
572  assume(r != NULL);
573  const coeffs C = r->cf;
574  assume(C != NULL);
575  return C->ch;
576}
577
578   
579/* R, Q, Fp: FALSE */
580static inline BOOLEAN rIsExtension(const ring r)
581{
582  assume( (rParameter(r)!=NULL) == rField_is_Extension(r) ); // ?
583  return rField_is_Extension(r);
584}
585
586/// Tests whether '(r->cf->minpoly) == NULL'
587BOOLEAN rMinpolyIsNULL(const ring r);
588
589
590/// order stuff
591typedef enum rRingOrder_t
592{
593  ringorder_no = 0,
594  ringorder_a,
595  ringorder_a64, ///< for int64 weights
596  ringorder_c,
597  ringorder_C,
598  ringorder_M,
599  ringorder_S, ///< S?
600  ringorder_s, ///< s?
601  ringorder_lp,
602  ringorder_dp,
603  ringorder_rp,
604  ringorder_Dp,
605  ringorder_wp,
606  ringorder_Wp,
607  ringorder_ls,
608  ringorder_ds,
609  ringorder_Ds,
610  ringorder_ws,
611  ringorder_Ws,
612  ringorder_L,
613  // the following are only used internally
614  ringorder_aa, ///< for idElimination, like a, except pFDeg, pWeigths ignore it
615  ringorder_rs, ///< ???
616  ringorder_IS, ///< Induced (Schreyer) ordering
617  ringorder_unspec
618} rRingOrder_t;
619
620typedef enum rOrderType_t
621{
622  rOrderType_General = 0, ///< non-simple ordering as specified by currRing
623  rOrderType_CompExp,     ///< simple ordering, component has priority
624  rOrderType_ExpComp,     ///< simple ordering, exponent vector has priority
625                          ///< component not compatible with exp-vector order
626  rOrderType_Exp,         ///< simple ordering, exponent vector has priority
627                          ///< component is compatible with exp-vector order
628  rOrderType_Syz,         ///< syzygy ordering
629  rOrderType_Schreyer,    ///< Schreyer ordering
630  rOrderType_Syz2dpc,     ///< syzcomp2dpc
631  rOrderType_ExpNoComp    ///< simple ordering, differences in component are
632                          ///< not considered
633} rOrderType_t;
634
635static inline BOOLEAN rIsSyzIndexRing(const ring r)
636{ assume(r != NULL); return r->order[0] == ringorder_s;}
637
638static inline int rGetCurrSyzLimit(const ring r)
639{ assume(r != NULL); return (rIsSyzIndexRing(r)? r->typ[0].data.syz.limit : 0);}
640
641void   rSetSyzComp(int k, const ring r);
642
643// Ring Manipulations
644ring   rAssure_HasComp(const ring r, BOOLEAN complete = TRUE);
645ring   rAssure_SyzComp(const ring r, BOOLEAN complete = TRUE);
646ring   rAssure_dp_S(const ring r, BOOLEAN complete = TRUE);
647ring   rAssure_dp_C(const ring r, BOOLEAN complete = TRUE);
648ring   rAssure_C_dp(const ring r, BOOLEAN complete = TRUE);
649/// makes sure that c/C ordering is last ordering
650ring   rAssure_CompLastBlock(const ring r, BOOLEAN complete = TRUE);
651
652/// makes sure that c/C ordering is last ordering and SyzIndex is first
653ring   rAssure_SyzComp_CompLastBlock(const ring r, BOOLEAN complete = TRUE);
654ring   rAssure_TDeg(const ring r, int start_var, int end_var, int &pos);
655
656/// return the max-comonent wchich has syzIndex i
657/// Assume: i<= syzIndex_limit
658int rGetMaxSyzComp(int i, const ring r);
659
660BOOLEAN rHasSimpleOrder(const ring r);
661
662/// returns TRUE, if simple lp or ls ordering
663BOOLEAN rHasSimpleLexOrder(const ring r);
664
665//???? return TRUE if p->exp[r->pOrdIndex] holds total degree of p ???
666
667
668inline BOOLEAN rHasGlobalOrdering(const ring r){ return (r->OrdSgn==1); }
669inline BOOLEAN rHasLocalOrMixedOrdering(const ring r){ return (r->OrdSgn==-1); }
670
671// #define rHasGlobalOrdering(R) ((R)->OrdSgn==1)
672// #define rHasLocalOrMixedOrdering(R) ((R)->OrdSgn==-1)
673
674#define rHasGlobalOrdering_currRing() rHasGlobalOrdering(currRing)
675#define rHasLocalOrMixedOrdering_currRing() rHasLocalOrMixedOrdering(currRing)
676
677BOOLEAN rOrd_is_Totaldegree_Ordering(ring r );
678
679/// return TRUE if p_SetComp requires p_Setm
680BOOLEAN rOrd_SetCompRequiresSetm(ring r);
681rOrderType_t    rGetOrderType(ring r);
682
683/// returns TRUE if var(i) belongs to p-block
684BOOLEAN rIsPolyVar(int i, ring r);
685
686static inline BOOLEAN rOrd_is_Comp_dp(ring r)
687{
688  assume(r != NULL);
689  return ((r->order[0] == ringorder_c || r->order[0] == ringorder_C) &&
690          r->order[1] == ringorder_dp &&
691          r->order[2] == 0);
692}
693
694#ifdef RDEBUG
695#define rTest(r)    rDBTest(r, __FILE__, __LINE__)
696extern BOOLEAN rDBTest(ring r, const char* fn, const int l);
697#else
698#define rTest(r)
699#endif
700
701ring rModifyRing(ring r, BOOLEAN omit_degree,
702                         BOOLEAN omit_comp,
703                         unsigned long exp_limit);
704
705/// construct Wp, C ring
706ring rModifyRing_Wp(ring r, int* weights);
707void rModify_a_to_A(ring r);
708
709void rKillModifiedRing(ring r);
710// also frees weights
711void rKillModified_Wp_Ring(ring r);
712
713ring rModifyRing_Simple(ring r, BOOLEAN omit_degree, BOOLEAN omit_comp, unsigned long exp_limit, BOOLEAN &simple);
714void rKillModifiedRing_Simple(ring r);
715
716#ifdef RDEBUG
717void rDebugPrint(ring r);
718void pDebugPrint(poly p);
719void p_DebugPrint(poly p, const ring r);
720#endif
721
722#ifndef NDEBUG
723/// debug-print at most nTerms (2 by default) terms from poly/vector p,
724/// assuming that lt(p) lives in lmRing and tail(p) lives in tailRing.
725void p_DebugPrint(const poly p, const ring lmRing, const ring tailRing, const int nTerms = 2);
726#endif
727
728int64 * rGetWeightVec(ring r);
729void rSetWeightVec(ring r, int64 *wv);
730
731/////////////////////////////
732// Auxillary functions
733//
734
735/* return the varIndex-th ring variable as a poly;
736   varIndex starts at index 1 */
737poly rGetVar(const int varIndex, const ring r);
738
739BOOLEAN rSetISReference(const ring r, const ideal F, const int i = 0, const int p = 0, const intvec * componentWeights = NULL);
740
741BOOLEAN rCheckIV(intvec *iv);
742int rTypeOfMatrixOrder(intvec * order);
743
744void rDelete(ring r); // To be used instead of rKill!
745
746extern omBin sip_sring_bin;
747#endif
Note: See TracBrowser for help on using the repository browser.