OPENF4
Library for Gröebner basis computations over finite fields.
 All Classes Namespaces Files Functions Variables Friends Pages
element-givaro.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_ELEMENT_GIVARO_H
27 #define OPENF4_ELEMENT_GIVARO_H
28 
29 #ifdef HAVE_GIVARO
30 
32 #include "global.h"
33 #include <iostream>
34 #include <string.h>
35 #include <cassert>
36 #include <cmath>
37 #include "givaro/modular-log16.h"
38 #include "givaro/modular-integer.h"
39 #include "givaro/gfq.h"
45 namespace F4
46 {
51  template <class Field>
52  class ElementGivaro
53  {
54  public:
55 
56  /* static methods */
57 
62  static void setField(Field & field);
63 
68  static void setVariableName(std::string var);
69 
70 
71  /* No constructor because POD */
72 
73  /* No Destructor because POD */
74 
75 
76  /* Miscellaneous */
77 
84  ElementGivaro<Field> & addMult(ElementGivaro<Field> const & element, ElementGivaro<Field> const & mult);
85 
91  ElementGivaro<Field> & inverse();
92 
96  void printElementGivaro (std::ostream & stream) const;
97 
103  bool isZero() const;
104 
110  bool isOne() const;
111 
115  void setZero();
116 
120  void setOne();
121 
122 
123  /* Internal operators */
124 
131  ElementGivaro & operator=(typename Field::Element element);
132 
139  ElementGivaro & operator=(std::string element);
140 
147  ElementGivaro & operator*=(ElementGivaro const & mult);
148 
156  ElementGivaro & operator-=(ElementGivaro const & element);
157 
158 
159  /* Public attribute because POD */
160 
161  typename Field::Element _element;
163  static Field F;
164  static std::string VARIABLE_NAME;
165  };
166 
167 
168  /* External operators */
169 
174  template <class Field>
175  std::ostream & operator<<(std::ostream & stream, ElementGivaro<Field> const & element);
176 
181  template <class Field>
182  ElementGivaro<Field> operator * (ElementGivaro<Field> const & element1, ElementGivaro<Field> const & element2);
183 
188  template <class Field>
189  ElementGivaro<Field> operator - (ElementGivaro<Field> const & element);
190 }
191 
193 #include "../src/element-givaro.inl"
196 #endif // HAVE_GIVARO
197 #endif // OPENF4_ELEMENT_GIVARO_H
ElementPrime< baseType > operator-(ElementPrime< baseType > const &element)
Overload the operator -.
Wrapper for config.h in order to avoid multiple definitions.
Term< Element > operator*(Monomial const &mon, Term< Element > const &term)
Overload the operator *.