24 #ifndef PPL_Generator_inlines_hh
25 #define PPL_Generator_inlines_hh 1
115 kind_(RAY_OR_POINT_OR_INEQUALITY),
127 topology_(topology) {
140 : topology_(topology) {
158 topology_(topology) {
170 topology_(g.topology_) {
177 topology_(g.topology_) {
184 : expr(g.expr, g.is_necessarily_closed() ? space_dim : (space_dim + 1)),
186 topology_(g.topology_) {
194 : expr(g.expr, g.is_necessarily_closed() ? space_dim : (space_dim + 1), r),
196 topology_(g.topology_) {
236 if (space_dim > old_space_dim) {
324 inline Coefficient_traits::const_reference
332 inline Coefficient_traits::const_reference
337 "*this is neither a point nor a closure point");
342 inline Coefficient_traits::const_reference
418 Coefficient_traits::const_reference d,
490 else if (str ==
"R" || str ==
"P" || str ==
"C") {
509 if (str2 ==
"(NNC)") {
555 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
557 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
558 template <
typename Specialization,
typename Temp,
typename To>
579 if (x_space_dim == 0) {
601 if (x_coord > y_coord) {
609 sub_assign_r(tmp1, *tmp1p, *tmp2p, dir);
610 PPL_ASSERT(
sgn(tmp1) >= 0);
619 template <
typename Temp,
typename To>
628 return l_m_distance_assign<Rectilinear_Distance_Specialization<Temp> >
629 (r, x, y, dir, tmp0, tmp1, tmp2);
633 template <
typename Temp,
typename To>
643 return rectilinear_distance_assign(r, x, y, dir, tmp0, tmp1, tmp2);
647 template <
typename To>
653 return rectilinear_distance_assign<To, To>(r, x, y, dir);
657 template <
typename Temp,
typename To>
666 return l_m_distance_assign<Euclidean_Distance_Specialization<Temp> >
667 (r, x, y, dir, tmp0, tmp1, tmp2);
671 template <
typename Temp,
typename To>
681 return euclidean_distance_assign(r, x, y, dir, tmp0, tmp1, tmp2);
685 template <
typename To>
691 return euclidean_distance_assign<To, To>(r, x, y, dir);
695 template <
typename Temp,
typename To>
704 return l_m_distance_assign<L_Infinity_Distance_Specialization<Temp> >
705 (r, x, y, dir, tmp0, tmp1, tmp2);
709 template <
typename Temp,
typename To>
719 return l_infinity_distance_assign(r, x, y, dir, tmp0, tmp1, tmp2);
723 template <
typename To>
729 return l_infinity_distance_assign<To, To>(r, x, y, dir);
740 #endif // !defined(PPL_Generator_inlines_hh)
bool is_not_necessarily_closed() const
Returns true if and only if the topology of *this row is not necessarily closed.
void m_swap(Generator &y)
Swaps *this with y.
Enable_If< Is_Native_Or_Checked< To >::value &&Is_Special< From >::value, Result >::type assign_r(To &to, const From &, Rounding_Dir dir)
bool euclidean_distance_assign(Checked_Number< To, Extended_Number_Policy > &r, const Generator &x, const Generator &y, const Rounding_Dir dir)
void set_necessarily_closed()
Sets to NECESSARILY_CLOSED the topological kind of *this row.
void swap(CO_Tree &x, CO_Tree &y)
void set_space_dimension(dimension_type n)
Sets the dimension of the vector space enclosing *this to n .
memory_size_type external_memory_in_bytes() const
Returns the size in bytes of the memory managed by *this.
void ascii_dump() const
Writes to std::cerr an ASCII representation of *this.
size_t dimension_type
An unsigned integral type for representing space dimensions.
void shift_space_dimensions(Variable v, dimension_type n)
void throw_invalid_argument(const char *method, const char *reason) const
Throw a std::invalid_argument exception containing the appropriate error message. ...
A line, ray, point or closure point.
Linear_Expression expr
The linear expression encoding *this.
memory_size_type total_memory_in_bytes() const
Returns a lower bound to the total size in bytes of the memory occupied by *this. ...
bool ascii_load(std::istream &s)
Loads from s an ASCII representation (as produced by ascii_dump(std::ostream&) const) and sets *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.
Rounding_Dir
Rounding directions for arithmetic computations.
Representation representation() const
Returns the current representation of *this.
static const Generator & zero_dim_point()
Returns the origin of the zero-dimensional space .
bool euclidean_distance_assign(Checked_Number< To, Extended_Number_Policy > &r, const Generator &x, const Generator &y, const Rounding_Dir dir, Temp &tmp0, Temp &tmp1, Temp &tmp2)
static Generator ray(const Linear_Expression &e, Representation r=default_representation)
Returns the ray of direction e.
bool is_ray_or_point() const
Returns true if and only if *this is not a line.
Generator point(const Linear_Expression &e, Representation r)
static const Generator * zero_dim_closure_point_p
Holds (between class initialization and finalization) a pointer to the origin of the zero-dimensional...
Expression_Hide_Last< Expression_Hide_Inhomo< Linear_Expression > > expr_type
The type of the (adapted) internal expression.
expr_type expression() const
Partial read access to the (adapted) internal expression.
void set_is_line_or_equality()
Sets to LINE_OR_EQUALITY the kind of *this row.
dimension_type space_dimension() const
Returns the dimension of the vector space enclosing *this.
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 swap(Generator &x, Generator &y)
Swaps x with y.
void set_inhomogeneous_term(Coefficient_traits::const_reference n)
Sets the inhomogeneous term of *this to n.
bool is_equivalent_to(const Generator &y) const
Returns true if and only if *this and y are equivalent generators.
bool operator!=(const Generator &x, const Generator &y)
static Generator closure_point(const Linear_Expression &e=Linear_Expression::zero(), Coefficient_traits::const_reference d=Coefficient_one(), Representation r=default_representation)
Returns the closure point at e / d.
void set_is_ray_or_point()
Sets the Generator kind to RAY_OR_POINT_OR_INEQUALITY.
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.
Kind kind_
The kind of *this.
static Generator line(const Linear_Expression &e, Representation r=default_representation)
Returns the line of direction e.
bool l_infinity_distance_assign(Checked_Number< To, Extended_Number_Policy > &r, const Generator &x, const Generator &y, const Rounding_Dir dir, Temp &tmp0, Temp &tmp1, Temp &tmp2)
void ascii_dump() const
Writes to std::cerr an ASCII representation of *this.
A dimension of the vector space.
Kind
The possible kinds of Generator objects.
void set_space_dimension_no_ok(dimension_type space_dim)
Rounding_Dir inverse(Rounding_Dir dir)
dimension_type space_dimension() const
Returns the dimension of the vector space enclosing *this.
bool ascii_load(std::istream &s)
Loads from s an ASCII representation (as produced by ascii_dump(std::ostream&) const) and sets *this ...
static dimension_type max_space_dimension()
Returns the maximum space dimension a Linear_Expression can handle.
A wrapper for numeric types implementing a given policy.
bool rectilinear_distance_assign(Checked_Number< To, Extended_Number_Policy > &r, const Generator &x, const Generator &y, const Rounding_Dir dir, Temp &tmp0, Temp &tmp1, Temp &tmp2)
Generator(Representation r=default_representation)
Constructs the point at the origin.
void set_representation(Representation r)
Converts *this to the specified representation.
void finalize()
Finalizes the library.
bool operator==(const Generator &x, const Generator &y)
Generator ray(const Linear_Expression &e, Representation r)
Type type() const
Returns the generator type of *this.
bool OK() const
Checks if all the invariants are satisfied.
dimension_type space_dimension() const
Returns the dimension of the vector space enclosing *this.
bool l_infinity_distance_assign(Checked_Number< To, Extended_Number_Policy > &r, const Generator &x, const Generator &y, const Rounding_Dir dir)
void sign_normalize()
Normalizes the sign of the coefficients so that the first non-zero (homogeneous) coefficient of a lin...
void set_not_necessarily_closed()
Sets to NOT_NECESSARILY_CLOSED the topological kind of *this row.
void swap_space_dimensions(Variable v1, Variable v2)
Swaps the coefficients of the variables v1 and v2 .
void mark_as_necessarily_closed()
Marks the epsilon dimension as a standard dimension.
bool is_point() const
Returns true if and only if *this is a point.
#define PPL_DIRTY_TEMP(T, id)
Generator closure_point(const Linear_Expression &e, Coefficient_traits::const_reference d, Representation r)
Generator point(const Linear_Expression &e, Coefficient_traits::const_reference d, Representation r)
static const Generator & zero_dim_closure_point()
Returns, as a closure point, the origin of the zero-dimensional space .
void mark_as_not_necessarily_closed()
Marks the last dimension as the epsilon dimension.
static Generator point(const Linear_Expression &e=Linear_Expression::zero(), Coefficient_traits::const_reference d=Coefficient_one(), Representation r=default_representation)
Returns the point at e / d.
static const Generator * zero_dim_point_p
Holds (between class initialization and finalization) a pointer to the origin of the zero-dimensional...
bool l_infinity_distance_assign(Checked_Number< To, Extended_Number_Policy > &r, const Generator &x, const Generator &y, const Rounding_Dir dir)
void set_space_dimension(dimension_type space_dim)
Generator closure_point(const Linear_Expression &e, Representation r)
Generator & operator=(const Generator &g)
Assignment operator.
Generator closure_point(Representation r)
void set_representation(Representation r)
Converts *this to the specified representation.
void set_is_ray_or_point_or_inequality()
Sets to RAY_OR_POINT_OR_INEQUALITY the kind of *this row.
void strong_normalize()
Strong normalization: ensures that different Generator objects represent different hyperplanes or hyp...
bool is_ray() const
Returns true if and only if *this is a ray.
The entire library is confined to this namespace.
Representation representation() const
Returns the current representation of *this.
void set_epsilon_coefficient(Coefficient_traits::const_reference n)
Sets the epsilon coefficient to n. The generator must be NNC.
void set_is_line()
Sets the Generator kind to LINE_OR_EQUALITY.
bool rectilinear_distance_assign(Checked_Number< To, Extended_Number_Policy > &r, const Generator &x, const Generator &y, const Rounding_Dir dir)
bool is_ray_or_point_or_inequality() const
Returns true if and only if *this row represents a ray, a point or an inequality. ...
Topology topology() const
Returns the topological kind of *this.
bool l_m_distance_assign(Checked_Number< To, Extended_Number_Policy > &r, const Generator &x, const Generator &y, const Rounding_Dir dir, Temp &tmp0, Temp &tmp1, Temp &tmp2)
Coefficient_traits::const_reference epsilon_coefficient() const
Returns the epsilon coefficient. The generator must be NNC.
I_Result combine(Result l, Result u)
Coefficient_traits::const_reference coefficient(Variable v) const
Returns the coefficient of v in *this.
int sgn(Boundary_Type type, const T &x, const Info &info)
bool euclidean_distance_assign(Checked_Number< To, Extended_Number_Policy > &r, const Generator &x, const Generator &y, const Rounding_Dir dir)
bool is_necessarily_closed() const
Returns true if and only if the topology of *this row is necessarily closed.
size_t memory_size_type
An unsigned integral type for representing memory size in bytes.
Coefficient_traits::const_reference divisor() const
If *this is either a point or a closure point, returns its divisor.
Generator point(Representation r)
Generator line(const Linear_Expression &e, Representation r)
bool rectilinear_distance_assign(Checked_Number< To, Extended_Number_Policy > &r, const Generator &x, const Generator &y, const Rounding_Dir dir)
Coefficient_traits::const_reference Coefficient_one()
Returns a const reference to a Coefficient with value 1.
bool is_line_or_equality() const
Returns true if and only if *this row represents a line or an equality.
memory_size_type external_memory_in_bytes() const
Returns the size in bytes of the memory managed by *this.
bool is_line() const
Returns true if and only if *this is a line.
An adapter for Linear_Expression that maybe hides the last coefficient.
void throw_dimension_incompatible(const char *method, const char *v_name, Variable v) const
Throw a std::invalid_argument exception containing the appropriate error message. ...
Topology
Kinds of polyhedra domains.
Result maybe_assign(const To *&top, To &tmp, const From &from, Rounding_Dir dir)
Assigns to top a pointer to a location that holds the conversion, according to dir, of from to type To. When necessary, and only when necessary, the variable tmp is used to hold the result of conversion.
static dimension_type max_space_dimension()
Returns the maximum space dimension a Generator can handle.
bool is_closure_point() const
Returns true if and only if *this is a closure point.
Topology topology_
The topology of *this.
void shift_space_dimensions(Variable v, dimension_type n)