OPENF4
Library for Gröebner basis computations over finite fields.
 All Classes Namespaces Files Functions Variables Friends Pages
critical-pair.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_CRITICAL_PAIR_H
27 #define OPENF4_CRITICAL_PAIR_H
28 
30 #include "global.h"
32 #include "tagged-polynomial.h"
33 
37 namespace F4
38 {
43  template <typename Element>
45  {
46  public:
47 
48  /* Static methods */
49 
54  static void setTaggedPolynomialArray(vector<TaggedPolynomial<Element>> * taggedPolynomialArray);
55 
60  static TaggedPolynomial<Element> const & getTaggedPolynomialArray(int numTaggedPolynomial);
61 
65  static int getSizeTaggedPolynomialArray();
66 
71  static void setMonomialArray(MonomialArray * monomialArray);
72 
73 
74 
75  /* Constructor */
76 
80  CriticalPair();
81 
88  CriticalPair(int p1, int p2);
89 
93  CriticalPair(CriticalPair const & cp);
94 
95 
96  /* Destructor */
97 
101  ~CriticalPair();
102 
103 
104  /* Get / Set */
105 
110  int getP1() const;
111 
116  int getP2() const;
117 
122  Monomial const & getLcm() const;
123 
128  Monomial const & getU1() const;
129 
134  Monomial const & getU2() const;
135 
140  int getDegree() const;
141 
150  bool setCriticalPair(int p1, int p2);
151 
152 
153  /* Miscellaneous */
154 
158  void printCriticalPair (std::ostream & stream = std::cout) const;
159 
167  int compareCriticalPair (CriticalPair const & criticalPair) const;
168 
169 
170  /* Internal operator */
171 
177  CriticalPair & operator=(CriticalPair const & criticalPair);
178 
179  private:
182  int _p1;
184  int _p2;
186  static std::vector<TaggedPolynomial<Element>> * TAGGEG_POLYNOMIAL_ARRAY;
189  };
190 
191 
192  /* External operator */
197  template <typename Element>
198  std::ostream & operator<<(std::ostream & stream, CriticalPair<Element> const & criticalPair);
199 
205  template <typename Element>
206  bool operator==(CriticalPair<Element> const & criticalPair1, CriticalPair<Element> const & criticalPair2);
207 
213  template <typename Element>
214  bool operator>(CriticalPair<Element> const & criticalPair1, CriticalPair<Element> const & criticalPair2);
215 
221  template <typename Element>
222  bool operator>=(CriticalPair<Element> const & criticalPair1, CriticalPair<Element> const & criticalPair2);
223 
229  template <typename Element>
230  bool operator<(CriticalPair<Element> const & criticalPair1, CriticalPair<Element> const & criticalPair2);
231 
237  template <typename Element>
238  bool operator<=(CriticalPair<Element> const & criticalPair1, CriticalPair<Element> const & criticalPair2);
239 }
240 
242 #include "../src/critical-pair.inl"
245 #endif // OPENF4_CRITICAL_PAIR_H
bool setCriticalPair(int p1, int p2)
Modify an already created critical pair.
Represent a monomial.
Definition: monomial.h:46
Represent a tagged polynomial.
~CriticalPair()
Destructor.
Monomial const & getLcm() const
Get _lcm.
int getDegree() const
Get the degree of this.
static int getSizeTaggedPolynomialArray()
Get the size of the array pointed by TAGGEG_POLYNOMIAL_ARRAY.
void printCriticalPair(std::ostream &stream=std::cout) const
Print the critical pair.
static void setTaggedPolynomialArray(vector< TaggedPolynomial< Element >> *taggedPolynomialArray)
Set the array of tagged polynomial to use.
Represent a critical pair.
Definition: critical-pair.h:44
Wrapper for config.h in order to avoid multiple definitions.
static std::vector< TaggedPolynomial< Element > > * TAGGEG_POLYNOMIAL_ARRAY
Represent a array of monomials.
Declaration of class TaggedPolynomial.
CriticalPair()
Constructor.
bool operator==(TaggedPolynomial< Element > const &taggedPolynomial1, TaggedPolynomial< Element > const &taggedPolynomial2)
Overload the operator ==.
static TaggedPolynomial< Element > const & getTaggedPolynomialArray(int numTaggedPolynomial)
Get a tagged polynomial from the array of tagged polynomial.
CriticalPair & operator=(CriticalPair const &criticalPair)
Overload the operator =.
Monomial const & getU1() const
Get the number of the monomial u1.
int compareCriticalPair(CriticalPair const &criticalPair) const
Compare this with criticalPair.
bool operator>=(TaggedPolynomial< Element > const &taggedPolynomial1, TaggedPolynomial< Element > const &taggedPolynomial2)
Overload the operator >=.
static void setMonomialArray(MonomialArray *monomialArray)
Set the monomial array to use.
int getP1() const
Get the index of the first tagged polynomial.
int getP2() const
Get the index of the second tagged polynomial.
static MonomialArray * MONOMIAL_ARRAY
bool operator>(Term< Element > const &term1, Term< Element > const &term2)
Overload the operator >.
Monomial const & getU2() const
Get the number of the monomial u2.