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

fieker-DuValspielwiese
Last change on this file since bfa04e was aec5c9, checked in by Frank Seelisch <seelisch@…>, 13 years ago
minpoly replaced by minideal->m[0]; prep for longalg/longtrans
  • Property mode set to 100644
File size: 21.7 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;
30struct p_Procs_s;
31typedef struct p_Procs_s p_Procs_s;
32class slists;
33typedef 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
60typedef enum
61{
62  ro_dp, // ordering is a degree ordering
63  ro_wp, // ordering is a weighted degree ordering
64  ro_wp64, // ordering is a weighted64 degree ordering
65  ro_wp_neg, // ordering is a weighted degree ordering
66             // with possibly negative weights
67  ro_cp,    // ordering duplicates variables
68  ro_syzcomp, // ordering indicates "subset" of component number (ringorder_S)
69  ro_syz, // ordering  with component number >syzcomp is lower (ringorder_s)
70  ro_isTemp, ro_is, // Induced Syzygy (Schreyer) ordering (and prefix data placeholder dummy) (ringorder_IS)
71  ro_none
72}
73ro_typ;
74
75// ordering is a degree ordering
76struct sro_dp
77{
78  short place;  // where degree is stored (in L):
79  short start;  // bounds of ordering (in E):
80  short end;
81};
82typedef struct sro_dp sro_dp;
83
84// ordering is a weighted degree ordering
85struct sro_wp
86{
87  short place;  // where weighted degree is stored (in L)
88  short start;  // bounds of ordering (in E)
89  short end;
90  int *weights; // pointers into wvhdl field
91};
92typedef struct sro_wp sro_wp;
93
94// ordering is a weighted degree ordering
95struct sro_wp64
96{
97    short place;  // where weighted degree is stored (in L)
98    short start;  // bounds of ordering (in E)
99    short end;
100    int64 *weights64; // pointers into wvhdl field
101};
102typedef struct sro_wp64 sro_wp64;
103
104// ordering duplicates variables
105struct sro_cp
106{
107  short place;  // where start is copied to (in E)
108  short start;  // bounds of sources of copied variables (in E)
109  short end;
110};
111typedef struct sro_cp sro_cp;
112
113// ordering indicates "subset" of component number
114struct sro_syzcomp
115{
116  short place;  // where the index is stored (in L)
117  long *ShiftedComponents; // pointer into index field
118  int* Components;
119#ifdef PDEBUG
120  long length;
121#endif
122};
123typedef struct sro_syzcomp sro_syzcomp;
124
125// ordering  with component number >syzcomp is lower
126struct sro_syz
127{
128  short place;       // where the index is stored (in L)
129  int limit;         // syzcomp
130  int* syz_index;    // mapping Component -> SyzIndex for Comp <= limit
131  int  curr_index;   // SyzIndex for Component > limit
132};
133
134typedef struct sro_syz sro_syz;
135// Induced Syzygy (Schreyer) ordering is built inductively as follows:
136// we look for changes made by ordering blocks which are between prefix/suffix markers:
137// that is: which variables where placed by them and where (judging by v)
138
139// due to prefix/suffix nature we need some placeholder:
140// prefix stores here initial state
141// suffix cleares this up
142struct sro_ISTemp
143{
144  short start; // 1st member SHOULD be short "place"
145  int   suffixpos;
146  int*  pVarOffset; // copy!
147};
148
149// So this is the actuall thing!
150// suffix uses last sro_ISTemp (cleares it up afterwards) and
151// creates this block
152struct sro_IS
153{
154  short start, end;  // which part of L we want to want to update...
155  int*  pVarOffset; // same as prefix!
156
157  int limit; // first referenced component
158
159  // reference poly set?? // Should it be owned by ring?!!!
160  ideal F; // reference leading (module)-monomials set. owned by ring...
161  const intvec* componentWeights; // component weights! owned by ring...
162};
163
164typedef struct sro_IS sro_IS;
165typedef struct sro_ISTemp sro_ISTemp;
166
167struct sro_ord
168{
169  ro_typ  ord_typ;
170  int     order_index; // comes from r->order[order_index]
171  union
172  {
173     sro_dp dp;
174     sro_wp wp;
175     sro_wp64 wp64;
176     sro_cp cp;
177     sro_syzcomp syzcomp;
178     sro_syz syz;
179     sro_IS is;
180     sro_ISTemp isTemp;
181  } data;
182};
183
184#ifdef HAVE_PLURAL
185struct nc_struct;
186typedef struct nc_struct   nc_struct;
187#endif
188
189struct ip_sring
190{
191// each entry must have a description and a procedure defining it,
192// general ordering: pointer/structs, long, int, short, BOOLEAN/char/enum
193// general defining procedures: rInit, rComplete, interpreter, ??
194  idhdl      idroot; /* local objects , interpreter*/
195  int*       order;  /* array of orderings, rInit/rSleftvOrdering2Ordering */
196  int*       block0; /* starting pos., rInit/rSleftvOrdering2Ordering*/
197  int*       block1; /* ending pos., rInit/rSleftvOrdering2Ordering*/
198//  char**     parameter; /* names of parameters, rInit */
199//  number     minpoly;  /* replaced by minideal->m[0] */
200  ideal      minideal;   /* for Q_a/Zp_a, rInit;
201                            for a start, we assume that there is either no
202                            or exactly one generator in minideal, playing
203                            the role of the former minpoly; minideal may
204                            also be NULL which coincides with the
205                            no-generator-case */
206  int**      wvhdl;  /* array of weight vectors, rInit/rSleftvOrdering2Ordering */
207  char **    names;  /* array of variable names, rInit */
208
209  // what follows below here should be set by rComplete, _only_
210  long      *ordsgn;  /* array of +/- 1 (or 0) for comparing monomials */
211                       /*  ExpL_Size entries*/
212
213  // is NULL for lp or N == 1, otherwise non-NULL (with OrdSize > 0 entries) */
214  sro_ord*   typ;   /* array of orderings + sizes, OrdSize entries */
215  /* if NegWeightL_Size > 0, then NegWeightL_Offset[0..size_1] is index of longs
216  in ExpVector whose values need an offset due to negative weights */
217  /* array of NegWeigtL_Size indicies */
218  int*      NegWeightL_Offset;
219
220  int*     VarOffset;
221
222  ideal      qideal; /* extension to the ring structure: qring, rInit */
223
224  int*     firstwv;
225
226  omBin    PolyBin; /* Bin from where monoms are allocated */
227  intvec * pModW;   /* std: module weights */
228  poly      ppNoether; /*  variables, set by procedures from hecke/kstd1:
229
230                            the highest monomial below pHEdge */
231// #ifdef HAVE_RINGS
232//   unsigned int  cf->ringtype;  /* cring = 0 => coefficient field, cring = 1 => coeffs from Z/2^m */
233//   int_number    cf->modBase; /* Z/(ringflag^cf->modExponent)=Z/cf->modNumber*/
234//   unsigned long cf->modExponent;
235//   unsigned long cf->modNumber;  /* Z/cf->modNumber */
236//   int_number    cf->modNumber;
237// #endif
238 
239  unsigned long options; /* ring dependent options */
240
241//  int        ch;  /* characteristic, rInit */
242  int        ref; /* reference counter to the ring, interpreter */
243
244  short      float_len; /* additional char-flags, rInit */
245  short      float_len2; /* additional char-flags, rInit */
246
247  short      N;      /* number of vars, rInit */
248
249  short      OrdSgn; /* 1 for polynomial rings, -1 otherwise, rInit */
250
251  short     firstBlockEnds;
252#ifdef HAVE_PLURAL
253  short     real_var_start, real_var_end;
254#endif
255
256#ifdef HAVE_SHIFTBBA
257  short          isLPring; /* 0 for non-letterplace rings, otherwise the number of LP blocks, at least 1, known also as lV */
258#endif
259
260  BOOLEAN   VectorOut;
261  BOOLEAN   ShortOut;
262  BOOLEAN   CanShortOut;
263  BOOLEAN   LexOrder; // TRUE if the monomial ordering has polynomial and power series blocks
264  BOOLEAN   MixedOrder; // TRUE for global/local mixed orderings, FALSE otherwise
265  BOOLEAN   pLexOrder; /* TRUE if the monomial ordering is not compatible with pFDeg */
266
267  BOOLEAN   ComponentOrder; // ???
268
269  // what follows below here should be set by rComplete, _only_
270  // contains component, but no weight fields in E */
271  short      ExpL_Size; // size of exponent vector in long
272  short      CmpL_Size; // portions which need to be compared
273  /* number of long vars in exp vector:
274     long vars are those longs in the exponent vector which are
275     occupied by variables, only */
276  short      VarL_Size;
277  short      BitsPerExp; /* number of bits per exponent */
278  short      ExpPerLong; /* maximal number of Exponents per long */
279  short      pCompIndex; /* p->exp.e[pCompIndex] is the component */
280  short      pOrdIndex; /* p->exp[pOrdIndex] is pGetOrd(p) */
281  short      OrdSize; /* size of ord vector (in sro_ord) */
282
283  /* if >= 0, long vars in exp vector are consecutive and start there
284     if <  0, long vars in exp vector are not consecutive */
285  short     VarL_LowIndex;
286  // number of exponents in r->VarL_Offset[0]
287  // is minimal number of exponents in a long var
288  short     MinExpPerLong;
289
290  short     NegWeightL_Size;
291  /* array of size VarL_Size,
292     VarL_Offset[i] gets i-th long var in exp vector */
293  int*      VarL_Offset;
294
295  /* mask for getting single exponents */
296  unsigned long bitmask;
297  /* mask used for divisiblity tests */
298  unsigned long divmask; // rComplete
299
300  p_Procs_s*    p_Procs; // rComplete/p_ProcsSet
301
302  /* FDeg and LDeg */
303  pFDegProc     pFDeg; // rComplete/rSetDegStuff
304  pLDegProc     pLDeg; // rComplete/rSetDegStuff
305
306  /* as it was determined by rComplete */
307  pFDegProc     pFDegOrig;
308  /* and as it was determined before rOptimizeLDeg */
309  pLDegProc     pLDegOrig;
310
311  p_SetmProc    p_Setm;
312  n_Procs_s*    cf;
313#ifdef HAVE_PLURAL
314  private:
315    nc_struct*    _nc; // private
316  public:
317    inline const nc_struct* GetNC() const { return _nc; }; // public!!!
318    inline nc_struct*& GetNC() { return _nc; }; // public!!!
319#endif
320 public:
321  operator coeffs() const { return cf; }
322};
323
324enum tHomog
325{
326   isNotHomog = FALSE,
327   isHomog    = TRUE,
328   testHomog
329};
330
331////////// DEPRECATED
332/////// void   rChangeCurrRing(ring r);
333//void   rSetHdl(idhdl h);
334//ring   rInit(sleftv* pn, sleftv* rv, sleftv* ord);
335idhdl  rDefault(const char *s);
336ring   rDefault(int ch, int N, char **n);
337ring   rDefault(coeffs cf, int N, char **n);
338ring rDefault(int ch, int N, char **n,int ord_size, int *ord, int *block0, int *block1);
339ring rDefault(coeffs cf, int N, char **n,int ord_size, int *ord, int *block0, int *block1);
340
341// #define rIsRingVar(A) r_IsRingVar(A,currRing)
342int    r_IsRingVar(const char *n, ring r);
343void   rWrite(ring r);
344//void   rKill(idhdl h);
345void   rKill(ring r);
346ring   rCopy(ring r);
347ring   rCopy0(const ring r, BOOLEAN copy_qideal = TRUE, BOOLEAN copy_ordering = TRUE);
348ring   rOpposite(ring r);
349ring   rEnvelope(ring r);
350
351/// we must always have this test!
352static inline bool rIsPluralRing(const ring r)
353{
354  assume(r != NULL);   
355#ifdef HAVE_PLURAL
356  nc_struct *n;
357  return (r != NULL) && ((n=r->GetNC()) != NULL) /*&& (n->type != nc_error)*/;
358#else
359  return false;
360#endif
361}
362
363static inline bool rIsRatGRing(const ring r)
364{
365  assume(r != NULL);
366#ifdef HAVE_PLURAL
367  /* nc_struct *n; */
368  return (r != NULL) /* && ((n=r->GetNC()) != NULL) */
369          && (r->real_var_start>1);
370#else
371  return false;
372#endif
373}
374
375
376
377
378// The following are for LaScala3 only!
379#ifdef PDEBUG
380#define rChangeSComps(c,s,l) rDBChangeSComps(c,s,l)
381#define rGetSComps(c,s,l) rDBGetSComps(c,s,l)
382void rDBChangeSComps(int* currComponents,
383                     long* currShiftedComponents,
384                     int length,
385                     ring r);
386void rDBGetSComps(int** currComponents,
387                  long** currShiftedComponents,
388                  int *length,
389                  ring r);
390#else
391#define rChangeSComps(c,s,l) rNChangeSComps(c,s)
392#define rGetSComps(c,s,l) rNGetSComps(c,s)
393#endif
394
395void rNChangeSComps(int* currComponents, long* currShiftedComponents, ring r);
396void rNGetSComps(int** currComponents, long** currShiftedComponents, ring r);
397
398//idhdl  rFindHdl(ring r, idhdl n, idhdl w);
399//idhdl rSimpleFindHdl(ring r, idhdl root, idhdl n);
400const char * rSimpleOrdStr(int ord);
401int rOrderName(char * ordername);
402char * rOrdStr(ring r);
403char * rVarStr(ring r);
404char * rCharStr(ring r);
405char * rString(ring r);
406int    rChar(ring r);
407
408char * rParStr(ring r);
409
410int    rSum(ring r1, ring r2, ring &sum);
411int rSumInternal(ring r1, ring r2, ring &sum, BOOLEAN vartest, BOOLEAN dp_dp);
412
413BOOLEAN rEqual(ring r1, ring r2, BOOLEAN qr = 1);
414BOOLEAN rSamePolyRep(ring r1, ring r2);
415void   rUnComplete(ring r);
416
417BOOLEAN rRing_is_Homog(ring r);
418BOOLEAN rRing_has_CompLastBlock(ring r);
419
420#ifdef HAVE_RINGS
421static inline BOOLEAN rField_is_Ring_2toM(const ring r)
422{ assume(r != NULL); return ( getCoeffType(r->cf) == n_Z2m && nCoeff_is_Ring_2toM(r->cf) ); }
423
424static inline BOOLEAN rField_is_Ring_ModN(const ring r)
425{ assume(r != NULL); return ( getCoeffType(r->cf) == n_Zn && nCoeff_is_Ring_ModN(r->cf) ); }
426
427static inline BOOLEAN rField_is_Ring_PtoM(const ring r)
428{ assume(r != NULL); return (getCoeffType(r->cf) == n_Zpn && nCoeff_is_Ring_PtoM(r->cf) ); }
429
430static inline BOOLEAN rField_is_Ring_Z(const ring r)
431{ assume(r != NULL); return (getCoeffType(r->cf) == n_Z && nCoeff_is_Ring_Z(r->cf) ); }
432
433static inline BOOLEAN rField_is_Ring(const ring r)
434{ assume(r != NULL); return nCoeff_is_Ring(r->cf); }
435
436static inline BOOLEAN rField_is_Domain(const ring r)
437{ assume(r != NULL); return nCoeff_is_Domain(r->cf); }
438
439static inline BOOLEAN rField_has_Units(const ring r)
440{ assume(r != NULL); return nCoeff_has_Units(r->cf); }
441#else
442#define rField_is_Ring(A) (0)
443#define rField_is_Ring_2toM(A) (0)
444#define rField_is_Ring_ModN(A) (0)
445#define rField_is_Ring_PtoM(A) (0)
446#define rField_is_Ring_Z(A) (0)
447#define rField_is_Domain(A) (1)
448#define rField_has_Units(A) (1)
449#endif
450
451static inline BOOLEAN rField_is_Zp(const ring r)
452{ assume(r != NULL); return (getCoeffType(r->cf) == n_Zp); }
453
454static inline BOOLEAN rField_is_Zp(const ring r, int p)
455{ assume(r != NULL); return (getCoeffType(r->cf) == n_Zp) && (r->cf->ch == p); }
456
457static inline BOOLEAN rField_is_Q(const ring r)
458{ assume(r != NULL); return nCoeff_is_Q(r->cf); }
459
460static inline BOOLEAN rField_is_numeric(const ring r) /* R, long R, long C */
461{ assume(r != NULL); return nCoeff_is_numeric(r->cf); }
462
463static inline BOOLEAN rField_is_R(const ring r)
464{ assume(r != NULL); return nCoeff_is_R(r->cf); }
465
466static inline BOOLEAN rField_is_GF(const ring r)
467{ assume(r != NULL); return nCoeff_is_GF(r->cf); }
468
469static inline BOOLEAN rField_is_GF(const ring r, int q)
470{ assume(r != NULL); return nCoeff_is_GF(r->cf, q); }
471
472static inline BOOLEAN rField_is_Zp_a(const ring r)
473{ assume(r != NULL); return nCoeff_is_Zp_a(r->cf); }
474
475static inline BOOLEAN rField_is_Zp_a(const ring r, int p)
476{ assume(r != NULL); return nCoeff_is_Zp_a(r->cf, p); }
477
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->algring;
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->algring;
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
626// Ring Manipulations
627ring   rAssure_HasComp(const ring r);
628ring   rAssure_SyzComp(const ring r, BOOLEAN complete = TRUE);
629void   rSetSyzComp(int k, const ring r);
630ring   rAssure_dp_S(const ring r);
631ring   rAssure_dp_C(const ring r);
632ring   rAssure_C_dp(const ring r);
633/// makes sure that c/C ordering is last ordering
634ring rAssure_CompLastBlock(const ring r);
635
636/// makes sure that c/C ordering is last ordering and SyzIndex is first
637ring   rAssure_SyzComp_CompLastBlock(const ring r);
638ring rAssure_TDeg(ring r, int start_var, int end_var, int &pos);
639
640/// return the max-comonent wchich has syzIndex i
641/// Assume: i<= syzIndex_limit
642int rGetMaxSyzComp(int i, const ring r);
643
644BOOLEAN rHasSimpleOrder(const ring r);
645
646/// returns TRUE, if simple lp or ls ordering
647BOOLEAN rHasSimpleLexOrder(const ring r);
648
649// return TRUE if p->exp[r->pOrdIndex] holds total degree of p */
650//inline BOOLEAN rHasGlobalOrdering(const ring r)
651//{ return (r->OrdSgn==1); }
652#define rHasGlobalOrdering(R) ((R)->OrdSgn==1)
653// #define rHasGlobalOrdering_currRing() (pOrdSgn==1)
654//inline BOOLEAN rHasLocalOrMixedOrdering(const ring r)
655//{ return (r->OrdSgn==-1); }
656#define rHasLocalOrMixedOrdering(R) ((R)->OrdSgn==-1)
657// #define rHasLocalOrMixedOrdering_currRing() (pOrdSgn==-1)
658BOOLEAN rOrd_is_Totaldegree_Ordering(ring r );
659
660/// return TRUE if p_SetComp requires p_Setm
661BOOLEAN rOrd_SetCompRequiresSetm(ring r);
662rOrderType_t    rGetOrderType(ring r);
663
664/// returns TRUE if var(i) belongs to p-block
665BOOLEAN rIsPolyVar(int i, ring r);
666
667static inline BOOLEAN rOrd_is_Comp_dp(ring r)
668{
669  assume(r != NULL);
670  return ((r->order[0] == ringorder_c || r->order[0] == ringorder_C) &&
671          r->order[1] == ringorder_dp &&
672          r->order[2] == 0);
673}
674
675#ifdef RDEBUG
676#define rTest(r)    rDBTest(r, __FILE__, __LINE__)
677extern BOOLEAN rDBTest(ring r, const char* fn, const int l);
678#else
679#define rTest(r)
680#endif
681
682ring rModifyRing(ring r, BOOLEAN omit_degree,
683                         BOOLEAN omit_comp,
684                         unsigned long exp_limit);
685
686/// construct Wp, C ring
687ring rModifyRing_Wp(ring r, int* weights);
688void rModify_a_to_A(ring r);
689
690void rKillModifiedRing(ring r);
691// also frees weights
692void rKillModified_Wp_Ring(ring r);
693
694ring rModifyRing_Simple(ring r, BOOLEAN omit_degree, BOOLEAN omit_comp, unsigned long exp_limit, BOOLEAN &simple);
695void rKillModifiedRing_Simple(ring r);
696
697#ifdef RDEBUG
698void rDebugPrint(ring r);
699void pDebugPrint(poly p);
700void p_DebugPrint(poly p, const ring r);
701#endif
702
703#ifndef NDEBUG
704/// debug-print at most nTerms (2 by default) terms from poly/vector p,
705/// assuming that lt(p) lives in lmRing and tail(p) lives in tailRing.
706void p_DebugPrint(const poly p, const ring lmRing, const ring tailRing, const int nTerms = 2);
707#endif
708
709int64 * rGetWeightVec(ring r);
710void rSetWeightVec(ring r, int64 *wv);
711
712lists rDecompose(const ring r);
713ring rCompose(const lists  L);
714/////////////////////////////
715// Auxillary functions
716//
717
718BOOLEAN rSetISReference(const ring r, const ideal F, const int i = 0, const int p = 0, const intvec * componentWeights = NULL);
719
720BOOLEAN rCheckIV(intvec *iv);
721int rTypeOfMatrixOrder(intvec * order);
722void rDelete(ring r);
723
724extern omBin sip_sring_bin;
725#endif
Note: See TracBrowser for help on using the repository browser.