F4
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 F4.
5  *
6  * F4 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  * F4 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 F4. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
26 #ifndef F4_CRITICAL_PAIR_H
27 #define F4_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  /* Get / Set */
104 
109  int getP1() const;
110 
115  int getP2() const;
116 
121  Monomial const & getLcm() const;
122 
127  Monomial const & getU1() const;
128 
133  Monomial const & getU2() const;
134 
139  int getDegree() const;
140 
149  bool setCriticalPair(int p1, int p2);
150 
151 
152  /* Miscellaneous */
153 
157  void printCriticalPair (std::ostream & stream = std::cout) const;
158 
166  int compareCriticalPair (CriticalPair const & criticalPair) const;
167 
168 
169  /* Internal operator */
170 
176  CriticalPair & operator=(CriticalPair const & criticalPair);
177 
178  private:
181  int _p1;
183  int _p2;
185  static std::vector<TaggedPolynomial<Element>> * TAGGEG_POLYNOMIAL_ARRAY;
188  };
189 
190 
191  /* External operator */
196  template <typename Element>
197  std::ostream & operator<<(std::ostream & stream, CriticalPair<Element> const & criticalPair);
198 
204  template <typename Element>
205  bool operator==(CriticalPair<Element> const & criticalPair1, CriticalPair<Element> const & criticalPair2);
206 
212  template <typename Element>
213  bool operator>(CriticalPair<Element> const & criticalPair1, CriticalPair<Element> const & criticalPair2);
214 
220  template <typename Element>
221  bool operator>=(CriticalPair<Element> const & criticalPair1, CriticalPair<Element> const & criticalPair2);
222 
228  template <typename Element>
229  bool operator<(CriticalPair<Element> const & criticalPair1, CriticalPair<Element> const & criticalPair2);
230 
236  template <typename Element>
237  bool operator<=(CriticalPair<Element> const & criticalPair1, CriticalPair<Element> const & criticalPair2);
238 }
239 
241 #include "../src/critical-pair.inl"
244 #endif // F4_CRITICAL_PAIR_H
bool operator>=(CriticalPair< Element > const &criticalPair1, CriticalPair< Element > const &criticalPair2)
Overload the operator >=.
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.
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>(CriticalPair< Element > const &criticalPair1, CriticalPair< Element > const &criticalPair2)
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.
bool operator==(CriticalPair< Element > const &criticalPair1, CriticalPair< Element > const &criticalPair2)
Overload the operator ==.
int getP2() const
Get the index of the second tagged polynomial.
static MonomialArray * MONOMIAL_ARRAY
Monomial const & getU2() const
Get the number of the monomial u2.