carl  24.04
Computer ARithmetic Library
PolynomialSorts.h
Go to the documentation of this file.
1 /*
2  * File: PolynomialSorts.h
3  * Author: Sebastian Junges
4  *
5  */
6 
7 #pragma once
8 
9 /**
10  * Sorts generators of an ideal by their leading terms.
11  * @param generators
12  */
13 template<class Polynomial>
15 {
16 public:
17 
18  explicit sortByLeadingTerm(const std::vector<Polynomial>& generators): mGenerators(generators) {
19  }
20 
21  bool operator()(std::size_t a, std::size_t b) const
22  {
23  assert(a < mGenerators.size());
24  assert(b < mGenerators.size());
25  return Polynomial::compareByLeadingTerm(mGenerators[a], mGenerators[b]);
26  }
27 private:
28  const std::vector<Polynomial>& mGenerators;
29 };
30 
31 /**
32  * Sorts generators of an ideal by their number of terms.
33  * @param generators
34  */
35 template<class Polynomial>
37 {
38 public:
39 
40  explicit sortByPolSize(const std::vector<Polynomial>& generators): mGenerators(generators) {
41  }
42 
43  bool operator()(std::size_t a, std::size_t b) const {
44  return Polynomial::compareByNrTerms(mGenerators[a], mGenerators[b]);
45  }
46 private:
47  const std::vector<Polynomial>& mGenerators;
48 };
Sorts generators of an ideal by their leading terms.
sortByLeadingTerm(const std::vector< Polynomial > &generators)
const std::vector< Polynomial > & mGenerators
bool operator()(std::size_t a, std::size_t b) const
Sorts generators of an ideal by their number of terms.
sortByPolSize(const std::vector< Polynomial > &generators)
const std::vector< Polynomial > & mGenerators
bool operator()(std::size_t a, std::size_t b) const