PPL  1.2
Bit_Matrix_defs.hh
Go to the documentation of this file.
1 /* Bit_Matrix class declaration.
2  Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it>
3  Copyright (C) 2010-2016 BUGSENG srl (http://bugseng.com)
4 
5 This file is part of the Parma Polyhedra Library (PPL).
6 
7 The PPL is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 The PPL is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software Foundation,
19 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA.
20 
21 For the most up-to-date information see the Parma Polyhedra Library
22 site: http://bugseng.com/products/ppl/ . */
23 
24 #ifndef PPL_Bit_Matrix_defs_hh
25 #define PPL_Bit_Matrix_defs_hh 1
26 
27 #include "Bit_Matrix_types.hh"
28 #include "Linear_System_types.hh"
29 #include "Bit_Row_defs.hh"
30 #include <vector>
31 #include <iosfwd>
32 
33 namespace Parma_Polyhedra_Library {
34 
35 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
36 
38 void swap(Bit_Matrix& x, Bit_Matrix& y);
39 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
40 
41 } // namespace Parma_Polyhedra_Library
42 
43 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
44 
46 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
48 public:
50  Bit_Matrix();
51 
53  Bit_Matrix(dimension_type n_rows, dimension_type n_columns);
54 
56  Bit_Matrix(const Bit_Matrix& y);
57 
59  ~Bit_Matrix();
60 
62  Bit_Matrix& operator=(const Bit_Matrix& y);
63 
65  void m_swap(Bit_Matrix& y);
66 
69 
71  const Bit_Row& operator[](dimension_type k) const;
72 
74  void clear();
75 
77  void transpose();
78 
80  void transpose_assign(const Bit_Matrix& y);
81 
84 
87 
89  dimension_type num_rows() const;
90 
92  void sort_rows();
93 
95 
105  bool sorted_contains(const Bit_Row& row) const;
106 
108 
114  void add_recycled_row(Bit_Row& row);
115 
118 
120 
125 
127  void resize(dimension_type new_n_rows, dimension_type new_n_columns);
128 
130  bool OK() const;
131 
133 
139  bool ascii_load(std::istream& s);
140 
143 
146 
147 #ifndef NDEBUG
148  bool check_sorted() const;
150 #endif
151 
152 private:
154  std::vector<Bit_Row> rows;
155 
158 
160 
162  bool operator()(const Bit_Row& x, const Bit_Row& y) const;
163  };
164 
165  template <typename Row>
167 };
168 
169 namespace Parma_Polyhedra_Library {
170 
171 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
172 
174 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
175 bool operator==(const Bit_Matrix& x, const Bit_Matrix& y);
176 
177 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
178 
180 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
181 bool operator!=(const Bit_Matrix& x, const Bit_Matrix& y);
182 
183 } // namespace Parma_Polyhedra_Library
184 
185 #include "Bit_Matrix_inlines.hh"
186 
187 #endif // !defined(PPL_Bit_Matrix_defs_hh)
bool ascii_load(std::istream &s)
Loads from s an ASCII representation (as produced by ascii_dump(std::ostream&) const) and sets *this ...
Definition: Bit_Matrix.cc:189
bool operator!=(const Box< ITV > &x, const Box< ITV > &y)
Definition: Box_inlines.hh:264
void swap(CO_Tree &x, CO_Tree &y)
bool operator()(const Bit_Row &x, const Bit_Row &y) const
The base class for systems of constraints and generators.
size_t dimension_type
An unsigned integral type for representing space dimensions.
void resize(dimension_type new_n_rows, dimension_type new_n_columns)
Resizes the matrix copying the old contents.
Definition: Bit_Matrix.cc:132
dimension_type num_rows() const
Returns the number of rows of *this.
void add_recycled_row(Bit_Row &row)
Adds row to *this.
Definition: Bit_Matrix.cc:74
A row in a matrix of bits.
void transpose()
Transposes the matrix.
Definition: Bit_Matrix.cc:101
#define PPL_OUTPUT_DECLARATIONS
void remove_trailing_columns(dimension_type n)
Removes the last n columns.
memory_size_type total_memory_in_bytes() const
Returns the total size in bytes of the memory occupied by *this.
void clear()
Clears the matrix deallocating all its rows.
Ordering predicate (used when implementing the sort algorithm).
void remove_trailing_rows(dimension_type n)
Removes the last n rows.
memory_size_type external_memory_in_bytes() const
Returns the size in bytes of the memory managed by *this.
Definition: Bit_Matrix.cc:225
Bit_Matrix & operator=(const Bit_Matrix &y)
Assignment operator.
Definition: Bit_Matrix.cc:36
void m_swap(Bit_Matrix &y)
Swaps *this with y.
bool check_sorted() const
Checks whether *this is sorted. It does NOT check for duplicates.
Definition: Bit_Matrix.cc:263
bool OK() const
Checks if all the invariants are satisfied.
Definition: Bit_Matrix.cc:234
dimension_type num_columns() const
Returns the number of columns of *this.
The entire library is confined to this namespace.
Definition: version.hh:61
static dimension_type max_num_rows()
Returns the maximum number of rows of a Bit_Matrix.
dimension_type row_size
Size of the initialized part of each row.
void sort_rows()
Sorts the rows and removes duplicates.
Definition: Bit_Matrix.cc:44
std::vector< Bit_Row > rows
Contains the rows of the matrix.
bool operator==(const Box< ITV > &x, const Box< ITV > &y)
bool sorted_contains(const Bit_Row &row) const
Looks for row in *this, which is assumed to be sorted.
size_t memory_size_type
An unsigned integral type for representing memory size in bytes.
Bit_Row & operator[](dimension_type k)
Subscript operator.
void transpose_assign(const Bit_Matrix &y)
Makes *this a transposed copy of y.
Definition: Bit_Matrix.cc:117