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

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