OPENF4
Library for Gröebner basis computations over finite fields.
 All Classes Namespaces Files Functions Variables Friends Pages
avl-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 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_CRITICAL_PAIR_H
27 #define OPENF4_AVL_CRITICAL_PAIR_H
28 
30 #include "global.h"
31 #include <iostream>
32 #include <cassert>
33 #include <iomanip>
35 #include "critical-pair.h"
36 #include "dynamic-array.h"
37 
41 namespace F4
42 {
47  template<typename Element>
49  {
50  public:
51 
52  /* Constructor */
53 
58 
59  /* Attributes */
60 
62  signed char _bf;
66  };
67 
72  template<typename Element>
73  void printNode(NodeAvlCriticalPair<Element> * p, int indent=0);
74 
75 
80  template<typename Element>
82  {
83  public:
84 
85  /* Constructor */
86 
91 
92 
93  /* Miscellaneous */
94 
99  void printAvlCriticalPair(std::ostream & stream) const;
100 
104  void reset();
105 
110  size_t size() const;
111 
117  bool isEmpty() const;
118 
122  void testAVL();
123 
124  /* Insertion */
125 
133 
134 
135  /* Deletion */
136 
144 
145 
146  /* Search */
147 
153 
158  NodeAvlCriticalPair<Element> const * findBiggest () const;
159 
166 
173 
179 
185 
192 
199 
200  private:
204  size_t _size;
206  };
207 
212  template <typename Element>
213  std::ostream & operator<<(std::ostream & stream, AvlCriticalPair<Element> const & avlCriticalPair);
214 }
215 
217 #include "../src/avl-critical-pair.inl"
220 #endif // OPENF4_AVL_CRITICAL_PAIR_H
void testAVL()
Test if the AVL is consistent.
NodeAvlCriticalPair< Element > * findSmallest()
Find the smallest NodeAvlCriticalPair of the AVL.
Represent an avl of critical pair.
Declaration of class DynamicArray.
int insert(CriticalPair< Element > cp)
Insert the critical pair cp in the AVL.
void printNode(NodeAvlPolynomial *p, int indent=0)
Print the AVL of root p.
bool isEmpty() const
Test if the AVL is empty.
NodeAvlCriticalPair * _right
Represent a critical pair.
Definition: critical-pair.h:44
NodeAvlCriticalPair< Element > * _it
void reset()
Reset the AVL for a new usage, memory is not clear.
NodeAvlCriticalPair< Element > * findNextBiggest(NodeAvlCriticalPair< Element > *node)
Find the next biggest NodeAvlCriticalPair after node.
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< NodeAvlCriticalPair< Element > > _array
NodeAvlCriticalPair< Element > * findBiggest()
Find the biggest NodeAvlCriticalPair of the AVL.
AvlCriticalPair()
Constructor.
NodeAvlCriticalPair< Element > * findNextSmallest(NodeAvlCriticalPair< Element > *node)
Find the next smallest NodeAvlCriticalPair after node.
NodeAvlCriticalPair< Element > * erase(NodeAvlCriticalPair< Element > *node)
Delete the node pointed by node from the AVL.
NodeAvlCriticalPair * _left
void printAvlCriticalPair(std::ostream &stream) const
Print the AVL.
NodeAvlCriticalPair()
Constructor.
Declaration of class CriticalPair.
size_t size() const
Get the number of element in the AVL.
NodeAvlCriticalPair * _parent
Represent a node of the AVL of critical pairs.
CriticalPair< Element > _cp
NodeAvlCriticalPair< Element > * _root