carl  24.04
Computer ARithmetic Library
MonomialOrdering.h
Go to the documentation of this file.
1 /**
2  * @file MonomialOrdering.h
3  * @ingroup multirp
4  */
5 #pragma once
6 
8 #include "Monomial.h"
9 #include "Term.h"
10 
11 namespace carl
12 {
13 
15 
16 /**
17  * A class for term orderings.
18  * @ingroup multirp
19  */
20 template<MonomialOrderingFunction f, bool degreeOrdered>
22 {
23  static CompareResult compare(const Monomial::Arg& m1, const Monomial::Arg& m2) {
24  return f(m1, m2);
25  }
26 
27  template<typename Coeff>
28  static CompareResult compare(const Term<Coeff>& t1, const Term<Coeff>& t2) {
29  return compare(t1.monomial(), t2.monomial());
30  }
31 
32  template<typename Coeff>
33  static bool less(const Term<Coeff>& t1, const Term<Coeff>& t2) {
34  return (compare(t1, t2) == CompareResult::LESS );
35  }
36 
37  static bool less(const Monomial::Arg& m1, const Monomial::Arg& m2) {
38  return (compare(m1, m2) == CompareResult::LESS );
39  }
40 
41  template<typename Coeff>
42  static bool equal(const Term<Coeff>& t1, const Term<Coeff>& t2) {
43  return (compare(t1, t2) == CompareResult::EQUAL );
44  }
45 
46  static bool equal(const Monomial::Arg& m1, const Monomial::Arg& m2) {
47  return (compare(m1, m2) == CompareResult::EQUAL );
48  }
49 
50  bool operator()(const Monomial::Arg& m1, const Monomial::Arg& m2) const {
51  return less(m1, m2);
52  }
53  template<typename Coeff>
54  bool operator()(const Term<Coeff>& t1, const Term<Coeff>& t2) const {
55  return less(t1, t2);
56  }
57 
58  static const bool degreeOrder = degreeOrdered;
59 };
60 
61 
64 //using GrRevLexOrdering = MonomialComparator<Monomial::GrRevLexCompare, true >;
65 }
carl is the main namespace for the library.
CompareResult
Definition: CompareResult.h:12
CompareResult(*)(const Monomial::Arg &, const Monomial::Arg &) MonomialOrderingFunction
std::shared_ptr< const Monomial > Arg
Definition: Monomial.h:62
A class for term orderings.
static const bool degreeOrder
static bool less(const Term< Coeff > &t1, const Term< Coeff > &t2)
static bool equal(const Term< Coeff > &t1, const Term< Coeff > &t2)
bool operator()(const Monomial::Arg &m1, const Monomial::Arg &m2) const
static CompareResult compare(const Term< Coeff > &t1, const Term< Coeff > &t2)
static CompareResult compare(const Monomial::Arg &m1, const Monomial::Arg &m2)
static bool less(const Monomial::Arg &m1, const Monomial::Arg &m2)
bool operator()(const Term< Coeff > &t1, const Term< Coeff > &t2) const
static bool equal(const Monomial::Arg &m1, const Monomial::Arg &m2)
Monomial::Arg & monomial()
Get the monomial.
Definition: Term.h:91