OPENF4
Library for Gröebner basis computations over finite fields.
 All Classes Namespaces Files Functions Variables Friends Pages
tagged-polynomial.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Antoine Joux, Vanessa Vitse and Titouan Coladon
3  *
4  * This file is part of openf4.
5  *
6  * openf4 is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * openf4 is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with openf4. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
26 #ifndef OPENF4_TAGGED_POLYNOMIAL_H
27 #define OPENF4_TAGGED_POLYNOMIAL_H
28 
30 #include "global.h"
32 #include "polynomial.h"
33 
37 namespace F4
38 {
43  template <typename Element>
45  {
46  public:
47 
48  /* Static methods */
49 
54  static void setMonomialArray(MonomialArray * monomialArray);
55 
56 
57  /* Constructor */
58 
63 
68  TaggedPolynomial(Polynomial<Element> const & polynomial);
69 
74  TaggedPolynomial(TaggedPolynomial const & taggedPolynomial);
75 
80  TaggedPolynomial(TaggedPolynomial && taggedPolynomial);
81 
82 
83  /* Destructor */
84 
86 
87 
88  /* Get / Set */
89 
95 
101 
106  void setPolynomial(Polynomial<Element> && polynomial);
107 
113  const Term<Element> & getLT() const;
114 
120  int getLM() const;
121 
127  Element getLC() const;
128 
133  int getNbTerm() const;
134 
140  int getSimplyrule(int index) const;
141 
148  void setSimplyrule(int index, int numPol);
149 
155 
161 
162 
163  /* Miscellaneous */
164 
168  void printTaggedPolynomial (std::ostream & stream) const;
169 
177  int compareTaggedPolynomial (TaggedPolynomial const & taggedPolynomial) const;
178 
184  bool isEmpty();
185 
189  void resetSimplyrules();
190 
196  void setTaggedPolynomial(TaggedPolynomial const & taggedPolynomial, uint8_t const * varlist);
197 
198 
199  /* Internal operators */
200 
206  TaggedPolynomial & operator=(TaggedPolynomial const & taggedPolynomial);
207 
213  TaggedPolynomial & operator=(TaggedPolynomial && taggedPolynomial);
214 
220  TaggedPolynomial & operator=(Polynomial<Element> const & polynomial);
221 
228 
234  TaggedPolynomial & operator*=(Monomial const & monomial);
235 
241  TaggedPolynomial & operator*=(Element element);
242 
248  TaggedPolynomial & operator*=(Term<Element> const & term);
249 
250  private:
251 
253  int * _simplyrules;
256  };
257 
258 
259  /* External operators */
260 
265  template <typename Element>
266  std::ostream & operator<<(std::ostream & stream, TaggedPolynomial<Element> const & taggedPolynomial);
267 
273  template <typename Element>
274  bool operator==(TaggedPolynomial<Element> const & taggedPolynomial1, TaggedPolynomial<Element> const & taggedPolynomial2);
275 
281  template <typename Element>
282  bool operator>(TaggedPolynomial<Element> const & taggedPolynomial1, TaggedPolynomial<Element> const & taggedPolynomial2);
283 
289  template <typename Element>
290  bool operator>=(TaggedPolynomial<Element> const & taggedPolynomial1, TaggedPolynomial<Element> const & taggedPolynomial2);
291 
297  template <typename Element>
298  bool operator<(TaggedPolynomial<Element> const & taggedPolynomial1, TaggedPolynomial<Element> const & taggedPolynomial2);
299 
305  template <typename Element>
306  bool operator<=(TaggedPolynomial<Element> const & taggedPolynomial1, TaggedPolynomial<Element> const & taggedPolynomial2);
307 
314  template <typename Element>
315  TaggedPolynomial<Element> operator * (Monomial const & monomial, TaggedPolynomial<Element> const & taggedPolynomial);
316 
323  template <typename Element>
324  TaggedPolynomial<Element> operator * (TaggedPolynomial<Element> const & taggedPolynomial, Monomial const & monomial);
325 
332  template <typename Element>
333  TaggedPolynomial<Element> operator * (Element element, TaggedPolynomial<Element> const & taggedPolynomial);
334 
341  template <typename Element>
342  TaggedPolynomial<Element> operator * (TaggedPolynomial<Element> const & taggedPolynomial, Element element);
343 
350  template <typename Element>
351  TaggedPolynomial<Element> operator * (Term<Element> const & term, TaggedPolynomial<Element> const & taggedPolynomial);
352 
359  template <typename Element>
360  TaggedPolynomial<Element> operator * (TaggedPolynomial<Element> const & taggedPolynomial, Term<Element> const & term);
361 }
362 
364 #include "../src/tagged-polynomial.inl"
367 #endif // OPENF4_TAGGED_POLYNOMIAL_H
TaggedPolynomial & operator*=(Monomial const &monomial)
Overload the operator *= to multiply this with a monomial.
static MonomialArray * MONOMIAL_ARRAY
Represent a monomial.
Definition: monomial.h:46
Represent a tagged polynomial.
void resetSimplyrules()
Reset the simplyrules of this.
int getNbTerm() const
Get the number of terms of this.
Represent a term.
Definition: term.h:50
TaggedPolynomial()
Constructor.
Wrapper for config.h in order to avoid multiple definitions.
Declaration of class Polynomial.
NodeList< Element > const * getPolynomialBeginConst() const
Get a constant iterator on the beginning of the polynomial.
Represent a array of monomials.
void printTaggedPolynomial(std::ostream &stream) const
Print the polynomial and the _simplyrules of this.
int getSimplyrule(int index) const
Get _simplyrules[i].
bool isEmpty()
Test if the polynomial is empty or not.
Term< Element > operator*(Monomial const &mon, Term< Element > const &term)
Overload the operator *.
Element getLC() const
Get the leading coefficient of this.
bool operator==(TaggedPolynomial< Element > const &taggedPolynomial1, TaggedPolynomial< Element > const &taggedPolynomial2)
Overload the operator ==.
Polynomial< Element > _polynomial
void setPolynomial(Polynomial< Element > &&polynomial)
Set the polynomial of this, but do not modify the simplyrules.
TaggedPolynomial & operator=(TaggedPolynomial const &taggedPolynomial)
Overload the operator =.
Represent a polynomial.
Definition: polynomial.h:47
bool operator>=(TaggedPolynomial< Element > const &taggedPolynomial1, TaggedPolynomial< Element > const &taggedPolynomial2)
Overload the operator >=.
static void setMonomialArray(MonomialArray *monomialArray)
Set the monomial array to use.
void setTaggedPolynomial(TaggedPolynomial const &taggedPolynomial, uint8_t const *varlist)
Set this = taggedPolynomial * monomial. Do not modify the simplyrules.
int compareTaggedPolynomial(TaggedPolynomial const &taggedPolynomial) const
Compare this with taggedPolynomial.
const Term< Element > & getLT() const
Get the leading term of this.
NodeList< Element > * getPolynomialBegin()
Get an iterator on the beginning of the polynomial.
Polynomial< Element > & getPolynomial()
Get the polynomial of this.
Represent a node of the single chained list.
Definition: single-list.h:47
bool operator>(Term< Element > const &term1, Term< Element > const &term2)
Overload the operator >.
void setSimplyrule(int index, int numPol)
Set _simplyrules[i].
Polynomial< Element > const & getPolynomialConst() const
Get the polynomial of this.
int getLM() const
Get the number of the leading monomial of this.