24 #include "ppl-config.h"
32 #include "assertions.hh"
44 cgs_end = cgs.
end(); i != cgs_end; ++i) {
45 if (i->is_equality()) {
57 PPL_ASSERT(space_dimension() <= new_space_dim);
64 if (has_strict_inequalities()) {
73 const bool was_sorted = sys.is_sorted();
78 if (sys[i].epsilon_coefficient() != 0) {
79 sys.remove_row(i,
false);
92 sys.set_topology(new_topology);
93 sys.set_space_dimension(new_space_dim);
104 if (sys[i].is_equality()) {
113 if (sys.is_necessarily_closed()) {
141 PPL_ASSERT(sys.num_pending_rows() == 0);
143 if (sys.topology() != c.
topology()) {
165 if (sys.topology() != c.
topology()) {
182 PPL_ASSERT(sys.num_pending_rows() == 0);
187 if (sys.is_sorted()) {
189 i > 0 && cs[--i].is_inequality(); ) {
195 if (cs[i].is_inequality()) {
207 PPL_ASSERT(sys.num_pending_rows() == 0);
208 return sys.num_rows() - num_inequalities();
214 while (i != csp_end && (*this)->is_tautological()) {
228 if (sys.is_necessarily_closed()) {
232 if (sps(g, sys[i]) != 0) {
241 const int sp_sign = sps(g, c);
265 if (sps(g, sys[i]) != 0) {
277 const int sp_sign = sps(g, c);
303 const int sp_sign = sps(g, c);
329 Coefficient_traits::const_reference denominator) {
332 PPL_ASSERT(denominator > 0);
334 Coefficient_traits::const_reference expr_v = expr.
coefficient(v);
342 Coefficient_traits::const_reference row_v = row.
coefficient(v);
345 if (denominator != 1) {
346 row.
expr *= denominator;
349 if (not_invertible) {
356 PPL_ASSERT(row.
OK());
361 sys.strong_normalize();
363 PPL_ASSERT(sys.OK());
375 if (!sys.ascii_load(s)) {
387 PPL_ASSERT(zero_dim_empty_p == 0);
394 PPL_ASSERT(zero_dim_empty_p != 0);
395 delete zero_dim_empty_p;
396 zero_dim_empty_p = 0;
413 while (i != cs_end) {
Scalar product sign function object depending on topology.
An iterator over a system of constraints.
bool is_tautological() const
Returns true if and only if *this is a tautology (i.e., an always true constraint).
A linear equality or inequality.
void insert_pending(const Constraint &c)
Inserts in *this a copy of the constraint c, increasing the number of space dimensions if needed...
size_t dimension_type
An unsigned integral type for representing space dimensions.
Type type() const
Returns the constraint type of *this.
A line, ray, point or closure point.
std::ostream & operator<<(std::ostream &s, const Ask_Tell< D > &x)
static const Constraint & zero_dim_false()
The unsatisfiable (zero-dimension space) constraint .
void insert(const Constraint &c)
Inserts in *this a copy of the constraint c, increasing the number of space dimensions if needed...
const_iterator end() const
Returns the past-the-end const_iterator.
The standard C++ namespace.
dimension_type space_dimension() const
Returns the dimension of the vector space enclosing *this.
void set_coefficient(Variable v, Coefficient_traits::const_reference n)
Sets the coefficient of v in *this to n.
void ascii_dump() const
Writes to std::cerr an ASCII representation of *this.
const_iterator begin() const
Returns the const_iterator pointing to the first constraint, if *this is not empty; otherwise...
Coefficient_traits::const_reference coefficient(Variable v) const
Returns the coefficient of v in *this.
Coefficient_traits::const_reference coefficient(Variable v) const
Returns the coefficient of v in *this.
A dimension of the vector space.
dimension_type space_dimension() const
Returns the dimension of the vector space enclosing *this.
bool is_inequality() const
Returns true if and only if *this is an inequality constraint (either strict or non-strict).
void skip_forward()
*this skips to the next non-trivial constraint.
dimension_type num_equalities() const
Returns the number of equality constraints.
Type type() const
Returns the generator type of *this.
dimension_type space_dimension() const
Returns the dimension of the vector space enclosing *this.
bool OK() const
Checks if all the invariants are satisfied.
const_iterator end() const
Returns the past-the-end const_iterator.
Enable_If< Is_Native_Or_Checked< T >::value, bool >::type ascii_load(std::istream &s, T &t)
static const Constraint_System * zero_dim_empty_p
Holds (between class initialization and finalization) a pointer to the singleton system containing on...
const_iterator begin() const
Returns the const_iterator pointing to the first congruence, if this is not empty; otherwise...
PPL_COEFFICIENT_TYPE Coefficient
An alias for easily naming the type of PPL coefficients.
Swapping_Vector< Row >::const_iterator const_iterator
bool has_equalities() const
Returns true if and only if *this contains one or more equality constraints.
Coefficient_traits::const_reference Coefficient_zero()
Returns a const reference to a Coefficient with value 0.
#define PPL_OUTPUT_DEFINITIONS(class_name)
The entire library is confined to this namespace.
An iterator over a system of congruences.
Coefficient_traits::const_reference epsilon_coefficient() const
Returns the epsilon coefficient. The constraint must be NNC.
void set_topology(Topology x)
Sets to x the topological kind of *this row.
Constraint_System(Representation r=default_representation)
Default constructor: builds an empty system of constraints.
void strong_normalize()
Strong normalization: ensures that different Constraint objects represent different hyperplanes or hy...
void affine_preimage(Variable v, const Linear_Expression &expr, Coefficient_traits::const_reference denominator)
Substitutes a given column of coefficients by a given affine expression.
bool OK() const
Checks if all the invariants are satisfied.
static void finalize()
Finalizes the class.
dimension_type num_inequalities() const
Returns the number of inequality constraints.
void linear_combine(const Linear_Expression &y, Variable v)
static void initialize()
Initializes the class.
Topology topology() const
Returns the topological kind of *this.
bool is_line() const
Returns true if and only if *this is a line.
bool adjust_topology_and_space_dimension(Topology new_topology, dimension_type new_space_dim)
Adjusts *this so that it matches new_topology and new_space_dim (adding or removing columns if needed...
Topology
Kinds of polyhedra domains.
bool satisfies_all_constraints(const Generator &g) const
Returns true if g satisfies all the constraints.
bool has_strict_inequalities() const
Returns true if and only if *this contains one or more strict inequality constraints.