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_Congruence_System_defs_hh
00024 #define PPL_Congruence_System_defs_hh 1
00025
00026 #include "Congruence_System.types.hh"
00027 #include "Linear_Expression.types.hh"
00028 #include "Constraint.types.hh"
00029 #include "Congruence.types.hh"
00030 #include "Grid_Generator.types.hh"
00031 #include "Matrix.defs.hh"
00032 #include "Grid_Certificate.types.hh"
00033 #include <iosfwd>
00034
00035 namespace Parma_Polyhedra_Library {
00036
00037 namespace IO_Operators {
00038
00040
00045 std::ostream&
00046 operator<<(std::ostream& s, const Congruence_System& cgs);
00047
00048 }
00049
00050 }
00051
00052
00053 namespace std {
00054
00056
00057 void
00058 swap(Parma_Polyhedra_Library::Congruence_System& x,
00059 Parma_Polyhedra_Library::Congruence_System& y);
00060
00061 }
00062
00064
00120 class Parma_Polyhedra_Library::Congruence_System : private Matrix {
00121 public:
00123 Congruence_System();
00124
00126 explicit Congruence_System(const Congruence& cg);
00127
00136 explicit Congruence_System(const Constraint& c);
00137
00139 explicit Congruence_System(const Constraint_System& cs);
00140
00142 Congruence_System(const Congruence_System& cgs);
00143
00145 ~Congruence_System();
00146
00148 Congruence_System& operator=(const Congruence_System& cgs);
00149
00151 static dimension_type max_space_dimension();
00152
00154 dimension_type space_dimension() const;
00155
00160 bool is_equal_to(const Congruence_System& cgs) const;
00161
00166 bool has_linear_equalities() const;
00167
00169 void clear();
00170
00178 void insert(const Congruence& cg);
00179
00191 void insert(const Constraint& c);
00192
00193
00194
00201 void insert(const Congruence_System& cgs);
00202
00207 void recycling_insert(Congruence_System& cgs);
00208
00210 static void initialize();
00211
00213 static void finalize();
00214
00216 static const Congruence_System& zero_dim_empty();
00217
00219
00233 class const_iterator
00234 : public std::iterator<std::forward_iterator_tag,
00235 Congruence,
00236 ptrdiff_t,
00237 const Congruence*,
00238 const Congruence&> {
00239 public:
00241 const_iterator();
00242
00244 const_iterator(const const_iterator& y);
00245
00247 ~const_iterator();
00248
00250 const_iterator& operator=(const const_iterator& y);
00251
00253 const Congruence& operator*() const;
00254
00256 const Congruence* operator->() const;
00257
00259 const_iterator& operator++();
00260
00262 const_iterator operator++(int);
00263
00268 bool operator==(const const_iterator& y) const;
00269
00274 bool operator!=(const const_iterator& y) const;
00275
00276 private:
00277 friend class Congruence_System;
00278
00280 Matrix::const_iterator i;
00281
00283 const Matrix* csp;
00284
00286 const_iterator(const Matrix::const_iterator& iter,
00287 const Congruence_System& cgs);
00288
00290 void skip_forward();
00291 };
00292
00294 bool empty() const;
00295
00301 const_iterator begin() const;
00302
00304 const_iterator end() const;
00305
00307 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00308
00313 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00314 bool OK() const;
00315
00316 PPL_OUTPUT_DECLARATIONS
00317
00318 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00319
00324 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00325 bool ascii_load(std::istream& s);
00326
00328 memory_size_type total_memory_in_bytes() const;
00329
00331 memory_size_type external_memory_in_bytes() const;
00332
00334 dimension_type num_equalities() const;
00335
00337 dimension_type num_proper_congruences() const;
00338
00340 void swap(Congruence_System& cgs);
00341
00357 void add_unit_rows_and_columns(dimension_type dims);
00358
00359 protected:
00360
00362 bool satisfies_all_congruences(const Grid_Generator& g) const;
00363
00364 private:
00369 static const Congruence_System* zero_dim_empty_p;
00370
00372 explicit Congruence_System(dimension_type d);
00373
00386 void concatenate(const Congruence_System& cgs);
00387
00389 void normalize_moduli();
00390
00392
00396 bool increase_space_dimension(dimension_type new_space_dim);
00397
00405 void insert_verbatim(const Congruence& cg);
00406
00407 friend class const_iterator;
00408 friend class Grid;
00409 friend class Grid_Certificate;
00410
00411 friend void std::swap(Parma_Polyhedra_Library::Congruence_System& x,
00412 Parma_Polyhedra_Library::Congruence_System& y);
00413
00414 friend bool
00415 operator==(const Congruence_System& x, const Congruence_System& y);
00416
00418 Congruence& operator[](dimension_type k);
00419
00421 const Congruence& operator[](dimension_type k) const;
00422
00432 bool has_a_free_dimension() const;
00433
00472 void affine_preimage(dimension_type v,
00473 const Linear_Expression& expr,
00474 Coefficient_traits::const_reference denominator);
00475
00483 void remove_higher_space_dimensions(dimension_type new_dimension);
00484
00486
00497 void resize_no_copy(dimension_type new_num_rows,
00498 dimension_type new_num_columns);
00499 };
00500
00501
00502
00503 #endif // !defined(PPL_Congruence_System_defs_hh)