Monomials


They are defined by a coefficient and an exponent.



1  Implementation

mpoly/Monom.H

template < class C, class R>  struct Monom
Implementation of monomials. The monomial class has tow template parameters, C the arithmetic class of the coefficients and R a container of int to store the powers.
{

  // Type definitions 
  typedef int                    index_t;
  typedef typename R::exponent_t exponent_t; //typename R::coeff_t exponent_t;
  typedef C                      coeff_t;
  typedef Monom             self_t;
  
  // Constructors
  Monom():coeff(0),rep(){}
  Monom(const C & c, const R & r):coeff(c),rep(r){}
  Monom(const C & c):coeff(c),rep(){} // monome constant
  Monom(int i):coeff(i){}  
  Monom(int i, int d);                 // monome x_i^d
  Monom(const C & c, int i, int d =1); // monome c*x_i^d
  Monom(const C & c, int s, int *t):coeff(c), rep(s){ 
    for(int i=0;i(m);}
  template
  Monom(const VAL & M)  {assign(*this,M.rep);}

  // Destructor
  // not dynamic allocation at this level
  
  // Assignement
  self_t & operator = (const self_t & m);
  template
  self_t & operator = (const VAL & M)  
    {assign(*this,M.rep); return *this;}
  
  // Accessors
  //  int size() const {return rep.size;}
  C GetCoeff () const { return coeff; }
  void SetCoeff (const C & c) { coeff = c; }
  int Lvar() const { return lvar(rep); }

  exponent_t operator[] (int i) const { return rep[i]; }      
  exponent_t GetDegree  (int i) const { return rep[i]; }

  void setExponent (int i, int d) { rep.setExponent(i,d); }
  
  // boolean opeartors and functions
  bool operator==(int n) const;
  bool operator!=(int n) const {return !(*this==n);}

  friend bool operator == (const self_t & m1, const self_t & m2) {
    return m1.coeff == m2.coeff && m1.rep == m2.rep;
  }
  friend bool IsComparable (const self_t & m1, const self_t & m2){
    return m1.rep == m2.rep;
  } 
  

  // Arithmetic operators
  self_t   operator  - () const {return self_t(-coeff,rep);}
  self_t & operator += (const self_t &);
  self_t & operator -= (const self_t &);
  self_t & operator *= (const self_t &);
  self_t & operator *= (const C &);
  self_t & operator /= (const C &);

  //private:
  C coeff;
  R rep;
};


mpoly/Monom.C

template < class C, class R>  Monom< C,R> ::Monom(int i, int d):coeff(1)
Construction of the monomial xid.

template < class C, class R>  Monom< C,R> ::Monom(const C & c, int l, int d =1 ):coeff(c), rep(l+1)
Construction of the monomial c xld.



2  Containers for exponents

Possibilities are dynamicexp, numexp, ...

mpoly/dynamicexp.H

template< char X,class E=char>  struct dynamicexp
Dynamic exponent.

mpoly/numexp.H

template< char X, int D=2, class T=int>  struct numexp
Numeric exponent. To be used with caution for the moment.



3  Monomial orders

mpoly/Plex.H

template < class M>  struct Plex
Class specifying the lexicographic order on the monomials of type M.
{
  static bool less (const M &, const M &);
  bool operator() (const M &, const M &) const {return less(m1,m2);}
};


mpoly/Dlex.H

template < class M>  struct Dlex
Class specifying the degree inverse lexicographic order on the monomials of type M. m1 <  m2 if either the degree of degree(m1)< degree(m2) or degree(m1)= degree(m2) and m2 is greater than m1 for the inverse lexicographic ordering.
{
  static bool less (const M &, const M &);
  bool operator() (const M & m1, const M & m2) const {return less(m1,m2);}
};




mpoly/Vlex.H

template < class M>  struct Vlex
Class defining the following order on the monomials m1 and m2; m1 <  m2 if either the degree of degree(m1)> degree(m2) or degree(m1)= degree(m2), or they are equal and m1 is greater for the inverse lexicopgraphic ordering. In a sequence of decreasing monomial for this order, the degree are increasing.
{
  static bool less(const M &, const M &);
  bool operator() (const M & m1, const M & m2) const {return less(m1,m2);}
};


mpoly/SQVlex.H

template < class M>  struct SQVlex
Class defining the following order on the monomials m1 and m2; m1 <  m2 if either the maximal of the degrees of each variable is strictly greater in m1 than in m2, or they are equal and m1 is greater for the inverse lexicopgraphic ordering refined by the degree.
{
  static bool less (const M &, const M &);
  bool operator() (const M &, const M &);
};