1 // -*- c++ -*-
2 //*****************************************************************************
3 /** @file LexOrder.h
4  *
5  * @author Alexander Dreyer
6  * @date 2006-05-18
7  *
8  * Defining lexicographical ordering.
9  *
10  * @par Copyright:
11  *   (c) 2006-2010 by The PolyBoRi Team
12  *
13 **/
14 //*****************************************************************************
15 
16 #ifndef polybori_LexOrder_h_
17 #define polybori_LexOrder_h_
18 
19 // include basic definitions
20 #include <polybori/pbori_defs.h>
21 
22 // include base order definitions
23 #include <polybori/orderings/COrderingFacade.h>
24 #include <polybori/orderings/COrderingTags.h>
25 
26 BEGIN_NAMESPACE_PBORI
27 
28 /** @class LexOrder
29  * @brief This class defines ordering related functions.
30  *
31  *
32  **/
33 class LexOrder:
34   public COrderingFacade<LexOrder, lex_tag> {
35 
36   /// generic access to current type
37   typedef LexOrder self;
38 
39  public:
40 
41   /// Define binary predicate for index comparision
42   typedef std::less<idx_type> idx_comparer_type;
43 
44   /// Default Constructor
LexOrder()45   LexOrder(): base() {};
46 
47   /// Copy Constructor
LexOrder(const self & rhs)48   LexOrder(const self& rhs): base(rhs) {};
49 
50   /// Destructor
~LexOrder()51   ~LexOrder() {};
52 
53   /// Comparison of indices corresponding to variables
54   comp_type compare(idx_type, idx_type) const;
55 
56   /// Comparison of monomials
57   comp_type compare(const monom_type&, const monom_type&) const;
58 
59   /// Comparison of exponent vectors
60   comp_type compare(const exp_type&, const exp_type&) const;
61 
62   /// Get leading term
63   monom_type lead(const poly_type&) const;
64 
65   /// Leading monomial with bound (just the ordinary leading monomial)
66   /// @note falls back to @c leadExp, ignores second argument
lead(const poly_type & poly,deg_type)67   monom_type lead(const poly_type& poly, deg_type) const {
68     return lead(poly);
69   }
70 
71   /// Get leading exponent
72   exp_type leadExp(const poly_type&) const;
73 
74   /// Leading exponent with bound (just the ordinary leading monomial)
75   /// @note falls back to @c leadExp, ignores second argument
leadExp(const poly_type & poly,deg_type)76   exp_type leadExp(const poly_type& poly, deg_type) const {
77     return leadExp(poly);
78   }
79 };
80 
81 
82 END_NAMESPACE_PBORI
83 
84 #endif // polybori_LexOrder_h_
85