OPENF4
Library for Gröebner basis computations over finite fields.
 All Classes Namespaces Files Functions Variables Friends Pages
avl-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_AVL_POLYNOMIAL_H
27 #define OPENF4_AVL_POLYNOMIAL_H
28 
30 #include "global.h"
31 #include <iostream>
32 #include <cassert>
33 #include <iomanip>
35 #include "dynamic-array.h"
36 
40 namespace F4
41 {
47  {
48  public:
49 
50  /* Constructor */
51 
56 
57  /* Attributes */
58 
61  int _nbTerms;
62  signed char _bf;
66  };
67 
72  void printNode(NodeAvlPolynomial * p, int indent=0);
73 
74 
80  {
81  public:
82 
83  /* Constructor */
84 
88  AvlPolynomial();
89 
90 
91  /* Miscellaneous */
92 
97  void printAvlPolynomial(std::ostream & stream) const;
98 
102  void reset();
103 
108  size_t size() const;
109 
110  /* Insertion */
111 
120  int insert(int numPol, int numMon, int nbTerms);
121 
122 
123  /* Search */
124 
130 
135  NodeAvlPolynomial const * findBiggest () const;
136 
143 
149  NodeAvlPolynomial const * findNextBiggest(NodeAvlPolynomial const * node) const;
150 
151  private:
155  size_t _size;
156  };
157 
158 
159  /* External operators */
160 
165  template <typename dataType>
166  std::ostream & operator<<(std::ostream & stream, AvlPolynomial const & AvlPolynomial);
167 }
168 
170 #include "../src/avl-polynomial.inl"
173 #endif // OPENF4_AVL_POLYNOMIAL_H
AvlPolynomial()
Constructor.
Declaration of class DynamicArray.
NodeAvlPolynomial * _it
void printNode(NodeAvlPolynomial *p, int indent=0)
Print the AVL of root p.
Wrapper for config.h in order to avoid multiple definitions.
Represent a dynamic array whose the width is fixed, the memory is allocated by blocs.
Definition: dynamic-array.h:45
DynamicArray< NodeAvlPolynomial > _array
NodeAvlPolynomial * _parent
int insert(int numPol, int numMon, int nbTerms)
Insert a new polynomial into the AVL.
void reset()
Reset the AVL for a new usage, memory is not clear.
NodeAvlPolynomial * _left
NodeAvlPolynomial * _root
NodeAvlPolynomial * findBiggest()
Find the biggest node of the AVL.
NodeAvlPolynomial * findNextBiggest(NodeAvlPolynomial *node)
Find the next biggest node after node.
Represent an avl of triple (number of a polynomial, number of its leading monomial, number of terms).
NodeAvlPolynomial * _right
Represent a node of the AVL of polynomial.
NodeAvlPolynomial()
Constructor.
size_t size() const
Get the number of element in the AVL.
void printAvlPolynomial(std::ostream &stream) const
Print the AVL.
std::ostream & operator<<(std::ostream &stream, Term< Element > const &term)
Overload the operator <<.