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 // 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 // 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
00147 const_iterator begin() const;
00148
00150 const_iterator end() const;
00151
00152
00153 protected:
00155 std::vector<Row> rows;
00156
00158 dimension_type row_size;
00159
00161 dimension_type row_capacity;
00162
00163 public:
00165 void swap(Matrix& y);
00166
00168
00179 void add_zero_rows(dimension_type n, Row::Flags row_flags);
00180
00182
00190 void add_zero_columns(dimension_type n);
00191
00193
00208 void add_zero_rows_and_columns(dimension_type n, dimension_type m,
00209 Row::Flags row_flags);
00210
00212
00222 void add_row(const Row& y);
00223
00225
00235 void add_recycled_row(Row& y);
00236
00238 void remove_trailing_columns(dimension_type n);
00239
00241
00255 void resize_no_copy(dimension_type new_n_rows, dimension_type new_n_columns,
00256 Row::Flags row_flags);
00257
00259 void swap_columns(dimension_type i, dimension_type j);
00260
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277 void permute_columns(const std::vector<dimension_type>& cycles);
00278
00280
00281
00283 dimension_type num_columns() const;
00284
00286 dimension_type num_rows() const;
00288
00290
00291
00292 Row& operator[](dimension_type k);
00293
00295 const Row& operator[](dimension_type k) const;
00297
00299 void clear();
00300
00301 PPL_OUTPUT_DECLARATIONS;
00302
00308 bool ascii_load(std::istream& s);
00309
00311 memory_size_type total_memory_in_bytes() const;
00312
00314 memory_size_type external_memory_in_bytes() const;
00315
00320 void erase_to_end(dimension_type first_to_erase);
00321
00323 bool OK() const;
00324 };
00325
00326 namespace std {
00327
00328 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00330
00331 #endif // PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00332 void swap(Parma_Polyhedra_Library::Matrix& x,
00333 Parma_Polyhedra_Library::Matrix& y);
00334
00335 }
00336
00337
00338 namespace Parma_Polyhedra_Library {
00339
00340 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00342
00343 #endif // PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00344 bool operator==(const Matrix& x, const Matrix& y);
00345
00346 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00348
00349 #endif // PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00350 bool operator!=(const Matrix& x, const Matrix& y);
00351
00352 }
00353
00354 #include "Matrix.inlines.hh"
00355
00356 #endif // !defined(PPL_Matrix_defs_hh)