F4
Library for Gröebner basis computations over finite fields.
 All Classes Namespaces Files Functions Variables Friends Pages
avl-monomial.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_AVL_MONOMIAL_H
27 #define F4_AVL_MONOMIAL_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 
60  bool _lt;
61  signed char _bf;
65  };
66 
71  void printNode(NodeAvlMonomial * p, int indent=0);
72 
73 
79  {
80  public:
81 
82  /* Constructor */
83 
87  AvlMonomial();
88 
89 
90  /* Miscellaneous */
91 
96  void printAvlMonomial(std::ostream & stream) const;
97 
101  void reset();
102 
107  size_t size() const;
108 
109  /* Insertion */
110 
119  int insert(int numMon, bool lt);
120 
121 
122  /* Search */
123 
129 
134  NodeAvlMonomial const * findBiggest () const;
135 
142 
148  NodeAvlMonomial const * findNextBiggest(NodeAvlMonomial const * node) const;
149 
150  private:
154  size_t _size;
157  };
158 
159 
160  /* External operators */
161 
166  template <typename dataType>
167  std::ostream & operator<<(std::ostream & stream, AvlMonomial const & avlMonomial);
168 }
169 
171 #include "../src/avl-monomial.inl"
174 #endif // F4_AVL_MONOMIAL_H
DynamicArray< NodeAvlMonomial > _array
Definition: avl-monomial.h:151
int insert(int numMon, bool lt)
If numMon if already in the AVL, update its lt flag, otherwise insert a new node. ...
NodeAvlMonomial * findNextBiggest(NodeAvlMonomial *node)
Find the next biggest NodeAvlMonomial after node.
Represent an avl of pair (number of a monomial, is leading monomial).
Definition: avl-monomial.h:78
std::ostream & operator<<(std::ostream &stream, AvlCriticalPair< Element > const &avlCriticalPair)
Overload the operator <<.
Declaration of class DynamicArray.
NodeAvlMonomial * _right
Definition: avl-monomial.h:64
void printAvlMonomial(std::ostream &stream) const
Print the AVL.
NodeAvlMonomial * _left
Definition: avl-monomial.h:63
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
NodeAvlMonomial()
Constructor.
Represent a node of the AVL of monomials.
Definition: avl-monomial.h:46
NodeAvlMonomial * _parent
Definition: avl-monomial.h:62
size_t size() const
Get the number of element in the AVL.
void reset()
Reset the AVL for a new usage, memory is not clear.
NodeAvlMonomial * _it
Definition: avl-monomial.h:152
NodeAvlMonomial * _root
Definition: avl-monomial.h:153
void printNode(NodeAvlCriticalPair< Element > *p, int indent=0)
Print the AVL of root p.
AvlMonomial()
Constructor.
NodeAvlMonomial * findBiggest()
Find the biggest NodeAvlMonomial of the AVL.