F4
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 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_CRITICAL_PAIR_H
27 #define F4_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 
134 
135 
136  /* Deletion */
137 
145 
146 
147  /* Search */
148 
154 
159  NodeAvlCriticalPair<Element> const * findBiggest () const;
160 
167 
174 
180 
186 
193 
200 
201  private:
205  size_t _size;
208  };
209 
214  template <typename Element>
215  std::ostream & operator<<(std::ostream & stream, AvlCriticalPair<Element> const & avlCriticalPair);
216 }
217 
219 #include "../src/avl-critical-pair.inl"
222 #endif // F4_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.
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
void printNode(NodeAvlCriticalPair< Element > *p, int indent=0)
Print the AVL of root p.
Represent a node of the AVL of critical pairs.
CriticalPair< Element > _cp
NodeAvlCriticalPair< Element > * _root