00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef PPL_Matrix_defs_hh
00025 #define PPL_Matrix_defs_hh 1
00026
00027 #include "Matrix.types.hh"
00028 #include "Row.defs.hh"
00029 #include "Constraint_System.types.hh"
00030 #include "Generator_System.types.hh"
00031 #include "Coefficient.types.hh"
00032 #include <vector>
00033 #include <cstddef>
00034
00035 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00036
00037
00044 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00045
00046 class Parma_Polyhedra_Library::Matrix {
00047 public:
00049 static dimension_type max_num_rows();
00050
00052 static dimension_type max_num_columns();
00053
00055
00058 Matrix();
00059
00061
00072 Matrix(dimension_type n_rows, dimension_type n_columns,
00073 Row::Flags row_flags = Row::Flags());
00074
00076 Matrix(const Matrix& y);
00077
00079 ~Matrix();
00080
00082 Matrix& operator=(const Matrix& y);
00083
00084 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00085
00086
00090 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00091 class const_iterator {
00092 private:
00093 typedef std::vector<Row>::const_iterator Iter;
00095 Iter i;
00096
00097 public:
00098 typedef std::forward_iterator_tag iterator_category;
00099 typedef std::iterator_traits<Iter>::value_type value_type;
00100 typedef std::iterator_traits<Iter>::difference_type difference_type;
00101 typedef std::iterator_traits<Iter>::pointer pointer;
00102 typedef std::iterator_traits<Iter>::reference reference;
00103
00105 const_iterator();
00106
00111 explicit const_iterator(const Iter& b);
00112
00114 const_iterator(const const_iterator& y);
00115
00117 const_iterator& operator=(const const_iterator& y);
00118
00120 reference operator*() const;
00121
00123 pointer operator->() const;
00124
00126 const_iterator& operator++();
00127
00129 const_iterator operator++(int);
00130
00135 bool operator==(const const_iterator& y) const;
00136
00141 bool operator!=(const const_iterator& y) const;
00142 };
00143
00144
00146
00154 bool has_no_rows() const;
00155
00160 const_iterator begin() const;
00161
00163 const_iterator end() const;
00164
00165
00166 protected:
00168 std::vector<Row> rows;
00169
00171 dimension_type row_size;
00172
00174 dimension_type row_capacity;
00175
00176 public:
00178 void swap(Matrix& y);
00179
00181
00192 void add_zero_rows(dimension_type n, Row::Flags row_flags);
00193
00195
00203 void add_zero_columns(dimension_type n);
00204
00206
00221 void add_zero_rows_and_columns(dimension_type n, dimension_type m,
00222 Row::Flags row_flags);
00223
00225
00235 void add_row(const Row& y);
00236
00238
00249 void add_recycled_row(Row& y);
00250
00252 void remove_trailing_columns(dimension_type n);
00253
00255
00269 void resize_no_copy(dimension_type new_n_rows, dimension_type new_n_columns,
00270 Row::Flags row_flags);
00271
00273 void swap_columns(dimension_type i, dimension_type j);
00274
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295 void permute_columns(const std::vector<dimension_type>& cycles);
00296
00298
00299
00301 dimension_type num_columns() const;
00302
00304 dimension_type num_rows() const;
00306
00308
00309
00310 Row& operator[](dimension_type k);
00311
00313 const Row& operator[](dimension_type k) const;
00315
00317 void clear();
00318
00319 PPL_OUTPUT_DECLARATIONS
00320
00326 bool ascii_load(std::istream& s);
00327
00329 memory_size_type total_memory_in_bytes() const;
00330
00332 memory_size_type external_memory_in_bytes() const;
00333
00338 void erase_to_end(dimension_type first_to_erase);
00339
00341 bool OK() const;
00342 };
00343
00344 namespace std {
00345
00346 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00347
00348
00349 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00350 void swap(Parma_Polyhedra_Library::Matrix& x,
00351 Parma_Polyhedra_Library::Matrix& y);
00352
00353 }
00354
00355
00356 namespace Parma_Polyhedra_Library {
00357
00358 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00359
00360
00361 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00362 bool operator==(const Matrix& x, const Matrix& y);
00363
00364 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00365
00366
00367 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00368 bool operator!=(const Matrix& x, const Matrix& y);
00369
00370 }
00371
00372 #include "Matrix.inlines.hh"
00373
00374 #endif // !defined(PPL_Matrix_defs_hh)