24 #include "ppl-config.h"
30 #include "assertions.hh"
44 if (
sys.topology() != new_topology) {
59 if (gs[i].is_closure_point()) {
60 sys.remove_row(i,
false);
66 sys.set_necessarily_closed();
73 sys.set_space_dimension(new_space_dim);
86 PPL_ASSERT(!sys.is_necessarily_closed());
112 PPL_ASSERT(!sys.is_necessarily_closed());
132 if (sys.is_necessarily_closed()) {
137 this_end = end(); i != this_end; ++i) {
138 if (i->is_closure_point()) {
153 sys.set_not_necessarily_closed();
162 PPL_ASSERT(sys.OK());
169 if (sys.is_necessarily_closed()) {
171 if (!gs[i].is_line_or_ray()) {
179 if (gs[i].epsilon_coefficient() != 0) {
193 if (i_next != gsp_end) {
221 PPL_ASSERT(sys.num_pending_rows() == 0);
222 if (sys.topology() == g.
topology()) {
227 if (sys.is_necessarily_closed()) {
228 convert_into_non_necessarily_closed();
255 if (sys.topology() == g.
topology()) {
260 if (sys.is_necessarily_closed()) {
261 convert_into_non_necessarily_closed();
291 PPL_ASSERT(sys.num_pending_rows() == 0);
296 if (sys.is_sorted()) {
304 if (gs[i].is_line()) {
316 PPL_ASSERT(sys.num_pending_rows() == 0);
322 if (sys.is_sorted()) {
324 i != 0 && gs[--i].is_ray_or_point(); ) {
325 if (gs[i].is_line_or_ray()) {
332 if (gs[i].is_ray()) {
349 PPL_ASSERT(n_rows > 0);
367 int first_point_or_nonsaturating_ray_sign = 2;
377 if (first_point_or_nonsaturating_ray_sign == 2) {
380 first_point_or_nonsaturating_ray_sign = 0;
384 if (first_point_or_nonsaturating_ray_sign != 0) {
401 if (first_point_or_nonsaturating_ray_sign == 2) {
404 first_point_or_nonsaturating_ray_sign = sp_sign;
409 if (sp_sign != first_point_or_nonsaturating_ray_sign) {
418 if (first_point_or_nonsaturating_ray_sign == 2) {
421 first_point_or_nonsaturating_ray_sign = sp_sign;
426 if (sp_sign != first_point_or_nonsaturating_ray_sign) {
444 bool first_point_or_nonsaturating_ray =
true;
454 if (first_point_or_nonsaturating_ray) {
457 first_point_or_nonsaturating_ray =
false;
480 if (first_point_or_nonsaturating_ray) {
483 first_point_or_nonsaturating_ray =
false;
484 result = (sp_sign > 0)
485 ? Poly_Con_Relation::is_included()
493 && result.
implies(Poly_Con_Relation::is_included()))) {
514 if (first_point_or_nonsaturating_ray) {
523 first_point_or_nonsaturating_ray =
false;
527 else if (sp_sign < 0) {
536 && result.
implies(Poly_Con_Relation::is_included()))) {
566 bool first_point_or_nonsaturating_ray =
true;
577 if (first_point_or_nonsaturating_ray) {
580 first_point_or_nonsaturating_ray =
false;
601 if (first_point_or_nonsaturating_ray) {
604 first_point_or_nonsaturating_ray =
false;
605 result = (sp_sign > 0)
612 && result.
implies(Poly_Con_Relation::is_disjoint()))
629 if (first_point_or_nonsaturating_ray) {
638 first_point_or_nonsaturating_ray =
false;
642 else if (sp_sign < 0) {
649 && result.
implies(Poly_Con_Relation::is_disjoint()))
688 if (sps(c, gs[i]) != 0) {
698 const int sp_sign = sps(c, g);
716 const int sp_sign = sps(c, g);
747 Coefficient_traits::const_reference denominator) {
751 PPL_ASSERT(denominator > 0);
761 if (denominator != 1) {
767 row.
expr *= denominator;
778 if (not_invertible) {
784 x.
sys.strong_normalize();
790 PPL_ASSERT(x.
sys[i].OK());
794 PPL_ASSERT(sys.OK());
806 if (!sys.ascii_load(s)) {
826 sys.remove_row(i,
false);
839 PPL_ASSERT(zero_dim_univ_p == 0);
846 PPL_ASSERT(zero_dim_univ_p != 0);
847 delete zero_dim_univ_p;
Scalar product sign function object depending on topology.
static Poly_Con_Relation is_disjoint()
The polyhedron and the set of points satisfying the constraint are disjoint.
A linear equality or inequality.
An iterator over a system of generators.
bool adjust_topology_and_space_dimension(Topology new_topology, dimension_type new_space_dim)
Adjusts *this so that it matches the new_topology and new_space_dim (adding or removing columns if ne...
static bool implies(flags_t x, flags_t y)
True if and only if the conjunction x implies the conjunction y.
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.
Linear_Expression expr
The linear expression encoding *this.
bool is_line_or_ray() const
Returns true if and only if *this is a line or a ray.
Coefficient_traits::const_reference inhomogeneous_term() const
Returns the inhomogeneous term of *this.
#define PPL_DIRTY_TEMP_COEFFICIENT(id)
Declare a local variable named id, of type Coefficient, and containing an unknown initial value...
void skip_forward()
*this skips to the next generator, skipping those closure points that are immediately followed by a m...
static const Generator & zero_dim_point()
Returns the origin of the zero-dimensional space .
std::ostream & operator<<(std::ostream &s, const Ask_Tell< D > &x)
dimension_type space_dimension() const
Returns the dimension of the vector space enclosing *this.
static Poly_Con_Relation is_included()
The polyhedron is included in the set of points satisfying the constraint.
The standard C++ namespace.
bool has_points() const
Returns true if and only if *this contains one or more points.
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.
static Poly_Con_Relation saturates()
The polyhedron is included in the set of points saturating the constraint.
bool is_matching_closure_point(const Generator &p) const
Returns true if and only if the closure point *this has the same coordinates of the point p...
static void initialize()
Initializes the class.
void set_topology(Topology x)
Sets to x the topological kind of *this row.
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 satisfied_by_all_generators(const Constraint &c) const
Returns true if all the generators satisfy c.
void remove_invalid_lines_and_rays()
Removes all the invalid lines and rays.
void ascii_dump() const
Writes to std::cerr an ASCII representation of *this.
static int reduced_sign(const Linear_Expression &x, const Linear_Expression &y)
Returns the sign of the reduced scalar product of x and y, where the coefficient of x is ignored...
Type type() const
Returns the generator type of *this.
dimension_type space_dimension() const
Returns the dimension of the vector space enclosing *this.
void insert_pending(const Generator_System &r)
Adds a copy of the rows of `y' to the pending part of `*this'.
void set_not_necessarily_closed()
Sets to NOT_NECESSARILY_CLOSED the topological kind of *this row.
Enable_If< Is_Native_Or_Checked< T >::value, bool >::type ascii_load(std::istream &s, T &t)
Parma_Polyhedra_Library::Poly_Con_Relation relation_with(const Constraint &c) const
Returns the relations holding between the generator system and the constraint c.
bool all_homogeneous_terms_are_zero() const
Returns true if and only if all the homogeneous terms of *this are .
Swapping_Vector< Row >::const_iterator const_iterator
bool is_point() const
Returns true if and only if *this is a point.
dimension_type num_rays() const
Returns the number of rays of the system.
void convert_into_non_necessarily_closed()
void set_space_dimension(dimension_type space_dim)
void add_corresponding_closure_points()
For each unmatched point in *this, adds the corresponding closure point.
static const Generator_System * zero_dim_univ_p
Holds (between class initialization and finalization) a pointer to the singleton system containing on...
#define PPL_OUTPUT_DEFINITIONS(class_name)
The entire library is confined to this namespace.
static void finalize()
Finalizes the class.
void set_epsilon_coefficient(Coefficient_traits::const_reference n)
Sets the epsilon coefficient to n. The generator must be NNC.
dimension_type space_dimension() const
Returns the dimension of the vector space enclosing *this.
Topology topology() const
Returns the topological kind of *this.
const_iterator end() const
Returns the past-the-end const_iterator.
const_iterator begin() const
Returns the const_iterator pointing to the first generator, if *this is not empty; otherwise...
Linear_System< Generator > sys
Coefficient_traits::const_reference epsilon_coefficient() const
Returns the epsilon coefficient. The generator must be NNC.
dimension_type num_lines() const
Returns the number of lines of the system.
static int sign(const Linear_Expression &x, const Linear_Expression &y)
Returns the sign of the scalar product between x and y.
bool OK() const
Checks if all the invariants are satisfied.
static void assign(Coefficient &z, const Linear_Expression &x, const Linear_Expression &y)
Computes the scalar product of x and y and assigns it to z.
dimension_type num_rows() const
void insert(const Generator &g)
Inserts in *this a copy of the generator g, increasing the number of space dimensions if needed...
void add_corresponding_points()
For each unmatched closure point in *this, adds the corresponding point.
bool has_closure_points() const
Returns true if and only if *this contains one or more closure points.
bool is_line() const
Returns true if and only if *this is a line.
static Poly_Con_Relation strictly_intersects()
The polyhedron intersects the set of points satisfying the constraint, but it is not included in it...
Topology
Kinds of polyhedra domains.
The relation between a polyhedron and a constraint.
void affine_image(Variable v, const Linear_Expression &expr, Coefficient_traits::const_reference denominator)
Assigns to a given variable an affine expression.
bool is_closure_point() const
Returns true if and only if *this is a closure point.