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_Congruence_System_defs_hh
00025 #define PPL_Congruence_System_defs_hh 1
00026
00027 #include "Congruence_System.types.hh"
00028 #include "Linear_Expression.types.hh"
00029 #include "Constraint.types.hh"
00030 #include "Congruence.types.hh"
00031 #include "Grid_Generator.types.hh"
00032 #include "Matrix.defs.hh"
00033 #include "Grid.types.hh"
00034 #include "Grid_Certificate.types.hh"
00035 #include <iosfwd>
00036
00037 namespace Parma_Polyhedra_Library {
00038
00039 namespace IO_Operators {
00040
00042
00047 std::ostream&
00048 operator<<(std::ostream& s, const Congruence_System& cgs);
00049
00050 }
00051
00052 }
00053
00054
00055 namespace std {
00056
00058
00059 void
00060 swap(Parma_Polyhedra_Library::Congruence_System& x,
00061 Parma_Polyhedra_Library::Congruence_System& y);
00062
00063 }
00064
00066
00122 class Parma_Polyhedra_Library::Congruence_System : private Matrix {
00123 public:
00125 Congruence_System();
00126
00128 explicit Congruence_System(const Congruence& cg);
00129
00138 explicit Congruence_System(const Constraint& c);
00139
00141 explicit Congruence_System(const Constraint_System& cs);
00142
00144 Congruence_System(const Congruence_System& cgs);
00145
00147 ~Congruence_System();
00148
00150 Congruence_System& operator=(const Congruence_System& cgs);
00151
00153 static dimension_type max_space_dimension();
00154
00156 dimension_type space_dimension() const;
00157
00162 bool is_equal_to(const Congruence_System& cgs) const;
00163
00168 bool has_linear_equalities() const;
00169
00171 void clear();
00172
00180 void insert(const Congruence& cg);
00181
00193 void insert(const Constraint& c);
00194
00195
00196
00203 void insert(const Congruence_System& cgs);
00204
00209 void recycling_insert(Congruence_System& cgs);
00210
00212 static void initialize();
00213
00215 static void finalize();
00216
00218 static const Congruence_System& zero_dim_empty();
00219
00221
00235 class const_iterator
00236 : public std::iterator<std::forward_iterator_tag,
00237 Congruence,
00238 ptrdiff_t,
00239 const Congruence*,
00240 const Congruence&> {
00241 public:
00243 const_iterator();
00244
00246 const_iterator(const const_iterator& y);
00247
00249 ~const_iterator();
00250
00252 const_iterator& operator=(const const_iterator& y);
00253
00255 const Congruence& operator*() const;
00256
00258 const Congruence* operator->() const;
00259
00261 const_iterator& operator++();
00262
00264 const_iterator operator++(int);
00265
00270 bool operator==(const const_iterator& y) const;
00271
00276 bool operator!=(const const_iterator& y) const;
00277
00278 private:
00279 friend class Congruence_System;
00280
00282 Matrix::const_iterator i;
00283
00285 const Matrix* csp;
00286
00288 const_iterator(const Matrix::const_iterator& iter,
00289 const Congruence_System& cgs);
00290
00292 void skip_forward();
00293 };
00294
00296 bool empty() const;
00297
00303 const_iterator begin() const;
00304
00306 const_iterator end() const;
00307
00309 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00310
00315 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00316 bool OK() const;
00317
00318 PPL_OUTPUT_DECLARATIONS
00319
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)