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_defs_hh
00024 #define PPL_Congruence_defs_hh 1
00025
00026 #include "Congruence.types.hh"
00027 #include "Scalar_Products.types.hh"
00028 #include "Row.defs.hh"
00029 #include "Grid.types.hh"
00030 #include "Polyhedron.types.hh"
00031 #include "Variable.defs.hh"
00032 #include "Constraint.types.hh"
00033 #include "Linear_Expression.types.hh"
00034 #include "Linear_Row.types.hh"
00035 #include "Congruence_System.defs.hh"
00036 #include <iosfwd>
00037
00038 namespace PPL = Parma_Polyhedra_Library;
00039
00040 namespace Parma_Polyhedra_Library {
00041
00042 namespace IO_Operators {
00043
00045
00047 std::ostream&
00048 operator<<(std::ostream& s, const Congruence& c);
00049
00050
00051
00053 std::ostream&
00054 operator<<(std::ostream& s, const Congruence_System& cgs);
00055
00056
00057 }
00058
00059
00060
00062
00063 bool
00064 operator==(const Congruence& x, const Congruence& y);
00065
00067
00068 bool
00069 operator!=(const Congruence& x, const Congruence& y);
00070
00072
00073 Congruence
00074 operator%=(const Linear_Expression& e1, const Linear_Expression& e2);
00075
00077
00078 Congruence
00079 operator%=(const Linear_Expression& e,
00080 const Coefficient_traits::const_reference n);
00081
00083
00089 Congruence
00090 operator/(const Congruence& cg,
00091 const Coefficient_traits::const_reference k);
00092
00094
00095 Congruence
00096 operator/(const Constraint& c,
00097 const Coefficient_traits::const_reference m);
00098
00099 }
00100
00101 namespace std {
00102
00104
00105 void
00106 swap(Parma_Polyhedra_Library::Congruence& x,
00107 Parma_Polyhedra_Library::Congruence& y);
00108
00109 }
00110
00112
00215 class Parma_Polyhedra_Library::Congruence : private Row {
00216 public:
00218 Congruence(const Congruence& cg);
00219
00221
00225 explicit Congruence(const Constraint& c);
00226
00228 ~Congruence();
00229
00231 Congruence& operator=(const Congruence& cg);
00232
00234 static dimension_type max_space_dimension();
00235
00237 dimension_type space_dimension() const;
00238
00240
00244 Coefficient_traits::const_reference coefficient(Variable v) const;
00245
00247 Coefficient_traits::const_reference inhomogeneous_term() const;
00248
00250 Coefficient_traits::const_reference modulus() const;
00251
00253
00258 Congruence&
00259 operator/=(const Coefficient_traits::const_reference k);
00260
00270 bool is_trivial_true() const;
00271
00282 bool is_trivial_false() const;
00283
00285
00288 bool is_proper_congruence() const;
00289
00291
00294 bool is_equality() const;
00295
00300 bool is_equal_at_dimension(dimension_type dim,
00301 const Congruence& cg) const;
00302
00308 static const Congruence& zero_dim_integrality();
00309
00314 static const Congruence& zero_dim_false();
00315
00320 memory_size_type total_memory_in_bytes() const;
00321
00323 memory_size_type external_memory_in_bytes() const;
00324
00325 PPL_OUTPUT_DECLARATIONS;
00326
00327 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00328
00332 #endif // PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00333 bool ascii_load(std::istream& s);
00334
00336 bool OK() const;
00337
00338 protected:
00339
00341
00346 void sign_normalize();
00347
00349
00353 void normalize();
00354
00356
00360 void strong_normalize();
00361
00362 private:
00363
00365 Coefficient& modulus();
00366
00368 void set_is_equality();
00369
00371 void negate(dimension_type start, dimension_type end);
00372
00374 Congruence();
00375
00377 Congruence(const Congruence& cg,
00378 dimension_type sz,
00379 dimension_type capacity);
00380
00382 Congruence(const Constraint& c,
00383 dimension_type sz,
00384 dimension_type capacity);
00385
00387
00392 Congruence(const Congruence& cg, Coefficient_traits::const_reference k);
00393
00395
00412 Congruence(Linear_Expression& le,
00413 Coefficient_traits::const_reference m,
00414 bool capacity = true);
00415
00417 void swap(Congruence& y);
00418
00423 void
00424 throw_invalid_argument(const char* method, const char* message) const;
00425
00430 void
00431 throw_dimension_incompatible(const char* method,
00432 const char* v_name,
00433 Variable v) const;
00434
00435 friend Congruence
00436 PPL::operator%=(const Linear_Expression& e1, const Linear_Expression& e2);
00437
00438 friend Congruence
00439 PPL::operator%=(const Linear_Expression& e,
00440 const Coefficient_traits::const_reference n);
00441
00442 friend Congruence
00443 PPL::operator/(const Congruence& cg,
00444 const Coefficient_traits::const_reference k);
00445
00446 friend Congruence
00447 PPL::operator/(const Constraint& c,
00448 const Coefficient_traits::const_reference m);
00449
00450 friend bool
00451 PPL::operator==(const Congruence& x, const Congruence& y);
00452
00453 friend bool
00454 PPL::operator!=(const Congruence& x, const Congruence& y);
00455
00456 friend std::ostream&
00457 PPL::IO_Operators::operator<<(std::ostream& s,
00458 const Congruence_System& cgs);
00459
00460 friend class PPL::Scalar_Products;
00461 friend class PPL::Congruence_System;
00462 friend class PPL::Congruence_System::const_iterator;
00463
00464
00465 friend class PPL::Grid;
00466 friend class PPL::Linear_Expression;
00467
00468 friend void
00469 std::swap(PPL::Congruence& x, PPL::Congruence& y);
00470 };
00471
00472 #include "Congruence.inlines.hh"
00473
00474 #endif // !defined(PPL_Congruence_defs_hh)