carl  24.04
Computer ARithmetic Library
GroebnerBase.h
Go to the documentation of this file.
1 /*
2  * File: GroebnerBase.h
3  * Author: tobias
4  *
5  * Created on 8. August 2016, 14:53
6  */
7 
8 #pragma once
9 
11 
12 namespace carl {
13 
14 
15 
16 /*
17  * A class representing a groebner base for an ideal I.
18  * Provides several routines needed in order to compute in the factor ring modulo I.
19  */
20 template<typename Number>
21 class GroebnerBase {
22 
23 public:
25 
26 private:
28 
29  std::shared_ptr<Ideal<Polynomial>> mBase;
30 
31 public:
33 
34  template<typename InputIt>
35  GroebnerBase(InputIt first, InputIt last) {
37  while(first != last) {
38  gbobject.addPolynomial(*first);
39  first++;
40  }
41  gbobject.reduceInput();
42  gbobject.calculate();
43  mBase = std::make_shared<Ideal<Polynomial>>(gbobject.getIdeal());
44  }
45 
46  Polynomial reduce(const Polynomial& p) const {
48  return r.fullReduce();
49  }
50 
51  inline const std::vector<Polynomial>& get() const {
52  return mBase->getGenerators();
53  }
54 
55  // means that this gb contains only 1
56  inline bool isTrivialBase() const {
57  return this->get().size() == 1 && is_one(this->get().front());
58  }
59 
60  bool hasFiniteMon() const;
61 
62  std::vector<Monomial> cor() const;
63  std::vector<Monomial> mon() const;
64  std::vector<Monomial> bor() const;
65 
66 
67  std::set<Variable> gatherVariables() const;
68 };
69 
70 }
71 
72 #include "GroebnerBase.tpp"
carl is the main namespace for the library.
bool is_one(const Interval< Number > &i)
Check if this interval is a point-interval containing 1.
Definition: Interval.h:1462
A general class for Groebner Basis calculation.
Definition: GBProcedure.h:46
std::list< std::pair< BitVector, BitVector > > reduceInput()
Reduce the input polynomials using the other input polynomials and the current Groebner basis.
Definition: GBProcedure.h:216
void calculate()
Calculate the Groebner basis of the current GB union the scheduled polynomials.
Definition: GBProcedure.h:194
void addPolynomial(const Polynomial &p)
Add a polynmomial which is added to the groebner basis during the next calculate call.
Definition: GBProcedure.h:116
const Ideal< Polynomial > & getIdeal() const
Get the ideal which encodes the GB.
Definition: GBProcedure.h:186
A dedicated algorithm for calculating the remainder of a polynomial modulo a set of other polynomials...
Definition: Reductor.h:69
InputPolynomial fullReduce()
Uses the ideal to reduce a polynomial as far as possible.
Definition: Reductor.h:181
Represents a single term, that is a numeric coefficient and a monomial.
Definition: Term.h:23
bool isTrivialBase() const
Definition: GroebnerBase.h:56
GroebnerBase(InputIt first, InputIt last)
Definition: GroebnerBase.h:35
std::shared_ptr< Ideal< Polynomial > > mBase
Definition: GroebnerBase.h:29
std::set< Variable > gatherVariables() const
bool hasFiniteMon() const
std::vector< Monomial > bor() const
std::vector< Monomial > cor() const
std::vector< Monomial > mon() const
const std::vector< Polynomial > & get() const
Definition: GroebnerBase.h:51
Polynomial reduce(const Polynomial &p) const
Definition: GroebnerBase.h:46