OPENF4
Library for Gröebner basis computations over finite fields.
 All Classes Namespaces Files Functions Variables Friends Pages
monomial-array.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_MONOMIAL_ARRAY_H
27 #define OPENF4_MONOMIAL_ARRAY_H
28 
30 #include "global.h"
31 #include <iostream>
32 #include <string>
33 #include <cassert>
34 #include <chrono>
35 #include <stdexcept>
36 #ifdef USE_OPENMP
37 #include <omp.h>
38 #endif
39 
40 #include "monomial.h"
41 
42 
46 namespace F4
47 {
53  {
54  public:
55 
56  /* Constructor */
57 
63  MonomialArray(int nbVariable, int capacity);
64 
71  MonomialArray(int nbVariable, int capacity, int degree);
72 
73 
74  /* Destructor */
75 
80 
81 
82  /* Miscellaneous */
83 
88  void setMonomialArray();
89 
95  void setTabulatedProduct(int degree);
96 
101  void freeTabulatedProduct();
102 
109  uint8_t getNumVarlist(int numMon, int index);
110 
117  int multNumMonomial(int numMon1, int numMon2);
118 
119 
120  /* Access */
121 
126  Monomial const & getNumMonomial(int index);
127 
132  Monomial const & operator[](int index);
133 
134 
135 
136  private:
137  std::vector<Monomial> _monomialArray ;
138  vector<int> * _tabulatedProduct;
140  size_t _size;
141  uint8_t * _varlistArray[128];
147  };
148 }
149 
151 #include "../src/monomial-array.inl"
154 #endif // OPENF4_MONOMIAL_ARRAY_H
uint8_t * _varlistArray[128]
Represent a monomial.
Definition: monomial.h:46
void setTabulatedProduct(int degree)
Modify the static 2D array TABULATED_PRODUCT.
int multNumMonomial(int numMon1, int numMon2)
Multiply two monomials, using _tabulatedProduct if possible. Prefer numMon1<numMon2.
Wrapper for config.h in order to avoid multiple definitions.
Monomial const & operator[](int index)
Overload the operator [].
vector< int > * _tabulatedProduct
void freeTabulatedProduct()
Free the static 2D array NB_MONOMIAL.
Represent a array of monomials.
std::vector< Monomial > _monomialArray
~MonomialArray()
Destructor.
uint8_t getNumVarlist(int numMon, int index)
Get _monomialArray[numMon]._varlist[index].
Declaration of class Monomial.
void setMonomialArray()
Modify the dynamic array _monomialArray.
Monomial const & getNumMonomial(int index)
Overload the operator [].
MonomialArray(int nbVariable, int capacity)
Constructor.