source: git/libpolys/polys/monomials/ring.h @ 7ee1907

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