00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef PPL_Matrix_defs_hh
00024 #define PPL_Matrix_defs_hh 1
00025
00026 #include "Matrix.types.hh"
00027 #include "Row.defs.hh"
00028 #include "Constraint_System.types.hh"
00029 #include "Generator_System.types.hh"
00030 #include "Coefficient.types.hh"
00031 #include <vector>
00032 #include <cstddef>
00033
00034 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00036
00043 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00044
00045 class Parma_Polyhedra_Library::Matrix {
00046 public:
00048 static dimension_type max_num_rows();
00049
00051 static dimension_type max_num_columns();
00052
00054
00057 Matrix();
00058
00060
00071 Matrix(dimension_type n_rows, dimension_type n_columns,
00072 Row::Flags row_flags = Row::Flags());
00073
00075 Matrix(const Matrix& y);
00076
00078 ~Matrix();
00079
00081 Matrix& operator=(const Matrix& y);
00082
00083 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00085
00089 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00090 class const_iterator {
00091 private:
00092 typedef std::vector<Row>::const_iterator Iter;
00094 Iter i;
00095
00096 public:
00097 typedef std::forward_iterator_tag iterator_category;
00098 typedef std::iterator_traits<Iter>::value_type value_type;
00099 typedef std::iterator_traits<Iter>::difference_type difference_type;
00100 typedef std::iterator_traits<Iter>::pointer pointer;
00101 typedef std::iterator_traits<Iter>::reference reference;
00102
00104 const_iterator();
00105
00110 explicit const_iterator(const Iter& b);
00111
00113 const_iterator(const const_iterator& y);
00114
00116 const_iterator& operator=(const const_iterator& y);
00117
00119 reference operator*() const;
00120
00122 pointer operator->() const;
00123
00125 const_iterator& operator++();
00126
00128 const_iterator operator++(int);
00129
00134 bool operator==(const const_iterator& y) const;
00135
00140 bool operator!=(const const_iterator& y) const;
00141 };
00142
00144
00152 bool has_no_rows() const;
00153
00158 const_iterator begin() const;
00159
00161 const_iterator end() const;
00162
00163
00164 protected:
00166 std::vector<Row> rows;
00167
00169 dimension_type row_size;
00170
00172 dimension_type row_capacity;
00173
00174 public:
00176 void swap(Matrix& y);
00177
00179
00190 void add_zero_rows(dimension_type n, Row::Flags row_flags);
00191
00193
00201 void add_zero_columns(dimension_type n);
00202
00204
00219 void add_zero_rows_and_columns(dimension_type n, dimension_type m,
00220 Row::Flags row_flags);
00221
00223
00233 void add_row(const Row& y);
00234
00236
00246 void add_recycled_row(Row& y);
00247
00249 void remove_trailing_columns(dimension_type n);
00250
00252
00266 void resize_no_copy(dimension_type new_n_rows, dimension_type new_n_columns,
00267 Row::Flags row_flags);
00268
00270 void swap_columns(dimension_type i, dimension_type j);
00271
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288 void permute_columns(const std::vector<dimension_type>& cycles);
00289
00291
00292
00294 dimension_type num_columns() const;
00295
00297 dimension_type num_rows() const;
00299
00301
00302
00303 Row& operator[](dimension_type k);
00304
00306 const Row& operator[](dimension_type k) const;
00308
00310 void clear();
00311
00312 PPL_OUTPUT_DECLARATIONS
00313
00319 bool ascii_load(std::istream& s);
00320
00322 memory_size_type total_memory_in_bytes() const;
00323
00325 memory_size_type external_memory_in_bytes() const;
00326
00331 void erase_to_end(dimension_type first_to_erase);
00332
00334 bool OK() const;
00335 };
00336
00337 namespace std {
00338
00339 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00341
00342 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00343 void swap(Parma_Polyhedra_Library::Matrix& x,
00344 Parma_Polyhedra_Library::Matrix& y);
00345
00346 }
00347
00348
00349 namespace Parma_Polyhedra_Library {
00350
00351 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00353
00354 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00355 bool operator==(const Matrix& x, const Matrix& y);
00356
00357 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00359
00360 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00361 bool operator!=(const Matrix& x, const Matrix& y);
00362
00363 }
00364
00365 #include "Matrix.inlines.hh"
00366
00367 #endif // !defined(PPL_Matrix_defs_hh)