A line, ray, point or closure point. More...
#include <Generator.defs.hh>


Public Types | |
| enum | Type { LINE, RAY, POINT, CLOSURE_POINT } |
The generator type. More... | |
Public Member Functions | |
| Generator (const Generator &g) | |
| Ordinary copy constructor. | |
| ~Generator () | |
| Destructor. | |
| Generator & | operator= (const Generator &g) |
| Assignment operator. | |
| dimension_type | space_dimension () const |
Returns the dimension of the vector space enclosing *this. | |
| Type | type () const |
Returns the generator type of *this. | |
| bool | is_line () const |
Returns true if and only if *this is a line. | |
| bool | is_ray () const |
Returns true if and only if *this is a ray. | |
| bool | is_line_or_ray () const |
Returns true if and only if *this is a line or a ray. | |
| bool | is_point () const |
Returns true if and only if *this is a point. | |
| bool | is_closure_point () const |
Returns true if and only if *this is a closure point. | |
| Coefficient_traits::const_reference | coefficient (Variable v) const |
Returns the coefficient of v in *this. | |
| Coefficient_traits::const_reference | divisor () const |
If *this is either a point or a closure point, returns its divisor. | |
| memory_size_type | total_memory_in_bytes () const |
Returns a lower bound to the total size in bytes of the memory occupied by *this. | |
| memory_size_type | external_memory_in_bytes () const |
Returns the size in bytes of the memory managed by *this. | |
| bool | is_equivalent_to (const Generator &y) const |
Returns true if and only if *this and y are equivalent generators. | |
| void | ascii_dump () const |
Writes to std::cerr an ASCII representation of *this. | |
| void | ascii_dump (std::ostream &s) const |
Writes to s an ASCII representation of *this. | |
| void | print () const |
Prints *this to std::cerr using operator<<. | |
| bool | ascii_load (std::istream &s) |
Loads from s an ASCII representation (as produced by ascii_dump(std::ostream&) const) and sets *this accordingly. Returns true if successful, false otherwise. | |
| bool | OK () const |
| Checks if all the invariants are satisfied. | |
| void | swap (Generator &y) |
Swaps *this with y. | |
Static Public Member Functions | |
| static Generator | line (const Linear_Expression &e) |
Returns the line of direction e. | |
| static Generator | ray (const Linear_Expression &e) |
Returns the ray of direction e. | |
| static Generator | point (const Linear_Expression &e=Linear_Expression::zero(), Coefficient_traits::const_reference d=Coefficient_one()) |
Returns the point at e / d. | |
| static Generator | closure_point (const Linear_Expression &e=Linear_Expression::zero(), Coefficient_traits::const_reference d=Coefficient_one()) |
Returns the closure point at e / d. | |
| static dimension_type | max_space_dimension () |
| Returns the maximum space dimension a Generator can handle. | |
| static void | initialize () |
| Initializes the class. | |
| static void | finalize () |
| Finalizes the class. | |
| static const Generator & | zero_dim_point () |
Returns the origin of the zero-dimensional space . | |
| static const Generator & | zero_dim_closure_point () |
Returns, as a closure point, the origin of the zero-dimensional space . | |
Private Member Functions | |
| Generator (Linear_Expression &e, Type type, Topology topology) | |
Builds a generator of type type and topology topology, stealing the coefficients from e. | |
| void | throw_dimension_incompatible (const char *method, const char *name_var, Variable v) const |
Throw a std::invalid_argument exception containing the appropriate error message. | |
| void | throw_invalid_argument (const char *method, const char *reason) const |
Throw a std::invalid_argument exception containing the appropriate error message. | |
| friend | Parma_Polyhedra_Library::Linear_Expression::Linear_Expression (const Generator &g) |
| Generator (const Generator &g, dimension_type dimension) | |
| Copy constructor with given space dimension. | |
| bool | is_ray_or_point () const |
Returns true if and only if *this is not a line. | |
| void | set_is_line () |
Sets the Linear_Row kind to LINE_OR_EQUALITY. | |
| void | set_is_ray_or_point () |
Sets the Linear_Row kind to RAY_OR_POINT_OR_INEQUALITY. | |
| 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. | |
| Generator () | |
| Default constructor: private and not implemented. | |
Static Private Attributes | |
| static const Generator * | zero_dim_point_p = 0 |
Holds (between class initialization and finalization) a pointer to the origin of the zero-dimensional space . | |
| static const Generator * | zero_dim_closure_point_p = 0 |
Holds (between class initialization and finalization) a pointer to the origin of the zero-dimensional space , as a closure point. | |
Friends | |
| class | Parma_Polyhedra_Library::Scalar_Products |
| class | Parma_Polyhedra_Library::Topology_Adjusted_Scalar_Product_Sign |
| class | Parma_Polyhedra_Library::Topology_Adjusted_Scalar_Product_Assign |
| class | Parma_Polyhedra_Library::Generator_System |
| class | Parma_Polyhedra_Library::Generator_System::const_iterator |
| class | Parma_Polyhedra_Library::Polyhedron |
| class | Parma_Polyhedra_Library::Grid_Generator |
| class | Parma_Polyhedra_Library::Grid_Generator_System |
| std::ostream & | Parma_Polyhedra_Library::IO_Operators::operator<< (std::ostream &s, const Generator &g) |
Related Functions | |
(Note that these are not member functions.) | |
| std::ostream & | operator<< (std::ostream &s, const Generator &g) |
| Output operator. | |
| void | swap (Parma_Polyhedra_Library::Generator &x, Parma_Polyhedra_Library::Generator &y) |
Specializes std::swap. | |
| bool | operator== (const Generator &x, const Generator &y) |
Returns true if and only if x is equivalent to y. | |
| bool | operator!= (const Generator &x, const Generator &y) |
Returns true if and only if x is not equivalent to y. | |
| template<typename To > | |
| bool | rectilinear_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const Generator &x, const Generator &y, Rounding_Dir dir) |
Computes the rectilinear (or Manhattan) distance between x and y. | |
| template<typename Temp , typename To > | |
| bool | rectilinear_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const Generator &x, const Generator &y, Rounding_Dir dir, Temp &tmp0, Temp &tmp1, Temp &tmp2) |
Computes the rectilinear (or Manhattan) distance between x and y. | |
| template<typename To > | |
| bool | euclidean_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const Generator &x, const Generator &y, Rounding_Dir dir) |
Computes the euclidean distance between x and y. | |
| template<typename Temp , typename To > | |
| bool | euclidean_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const Generator &x, const Generator &y, Rounding_Dir dir, Temp &tmp0, Temp &tmp1, Temp &tmp2) |
Computes the euclidean distance between x and y. | |
| template<typename To > | |
| bool | l_infinity_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const Generator &x, const Generator &y, Rounding_Dir dir) |
Computes the distance between x and y. | |
| template<typename Temp , typename To > | |
| bool | l_infinity_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const Generator &x, const Generator &y, Rounding_Dir dir, Temp &tmp0, Temp &tmp1, Temp &tmp2) |
Computes the distance between x and y. | |
| std::ostream & | operator<< (std::ostream &s, const Generator::Type &t) |
| Output operator. | |
| template<typename Specialization , typename Temp , typename To > | |
| 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) |
A line, ray, point or closure point.
An object of the class Generator is one of the following:
;
;
;
;where
is the dimension of the space and, for points and closure points,
is the divisor.
using the generator system
, we need to include in the finite set
even points of
that are not vertices of
. This situation is even more frequent when working with NNC polyhedra and it is the reason why we prefer to use the word `point' where other libraries use the word `vertex'.line, ray, point or closure_point) to a linear expression, representing a direction in the space; the space dimension of the generator is defined as the space dimension of the corresponding linear expression. Linear expressions used to define a generator should be homogeneous (any constant term will be simply ignored). When defining points and closure points, an optional Coefficient argument can be used as a common divisor for all the coefficients occurring in the provided linear expression; the default value for this argument is 1.x, y and z are defined as follows: Variable x(0); Variable y(1); Variable z(2);
and having space dimension
: As mentioned above, the constant term of the linear expression is not relevant. Thus, the following code has the same effect: By definition, the origin of the space is not a line, so that the following code throws an exception:
: The same effect can be obtained by using the following code: Similarly, the origin
can be defined using either one of the following lines of code: Note however that the following code would have defined a different point, namely
: The following two lines of code both define the only point having space dimension zero, namely
. In the second case we exploit the fact that the first argument of the function point is optional. Generator origin0 = Generator::zero_dim_point(); Generator origin0_alt = point();
specified in Example 3 above can also be obtained with the following code, where we provide a non-default value for the second argument of the function point (the divisor): Obviously, the divisor can be usefully exploited to specify points having some non-integer (but rational) coordinates. For instance, the point
can be specified by the following code: If a zero divisor is provided, an exception is thrown.
is defined by Generator c = closure_point(1*x + 0*y + 2*z);
Generator closure_origin0 = Generator::zero_dim_closure_point(); Generator closure_origin0_alt = closure_point();
g1 is a point having coordinates
, we construct the closure point g2 having coordinates
. if (g1.is_point()) { cout << "Point g1: " << g1 << endl; Linear_Expression e; for (dimension_type i = g1.space_dimension(); i-- > 0; ) e += (i + 1) * g1.coefficient(Variable(i)) * Variable(i); Generator g2 = closure_point(e, g1.divisor()); cout << "Closure point g2: " << g2 << endl; } else cout << "Generator g1 is not a point." << endl;
Point g1: p((2*A - B + 3*C)/2) Closure point g2: cp((2*A - 2*B + 9*C)/2)
Definition at line 244 of file Generator.defs.hh.
The generator type.
| LINE |
The generator is a line. |
| RAY |
The generator is a ray. |
| POINT |
The generator is a point. |
| CLOSURE_POINT |
The generator is a closure point. |
Reimplemented in Parma_Polyhedra_Library::Grid_Generator.
Definition at line 303 of file Generator.defs.hh.
00303 { 00305 LINE, 00307 RAY, 00309 POINT, 00311 CLOSURE_POINT 00312 };
| Parma_Polyhedra_Library::Generator::Generator | ( | const Generator & | g | ) | [inline] |
Ordinary copy constructor.
Definition at line 39 of file Generator.inlines.hh.
00040 : Linear_Row(g) { 00041 }
| Parma_Polyhedra_Library::Generator::~Generator | ( | ) | [inline] |
| Parma_Polyhedra_Library::Generator::Generator | ( | Linear_Expression & | e, | |
| Type | type, | |||
| Topology | topology | |||
| ) | [inline, private] |
Builds a generator of type type and topology topology, stealing the coefficients from e.
Definition at line 30 of file Generator.inlines.hh.
References CLOSURE_POINT, Parma_Polyhedra_Library::Linear_Row::flags(), LINE, Parma_Polyhedra_Library::Linear_Row::LINE_OR_EQUALITY, Parma_Polyhedra_Library::NOT_NECESSARILY_CLOSED, Parma_Polyhedra_Library::Linear_Row::RAY_OR_POINT_OR_INEQUALITY, and swap().
00030 { 00031 PPL_ASSERT(type != CLOSURE_POINT || topology == NOT_NECESSARILY_CLOSED); 00032 Linear_Row::swap(e); 00033 flags() = Flags(topology, (type == LINE 00034 ? LINE_OR_EQUALITY 00035 : RAY_OR_POINT_OR_INEQUALITY)); 00036 }
| Parma_Polyhedra_Library::Generator::Generator | ( | const Generator & | g, | |
| dimension_type | dimension | |||
| ) | [inline, private] |
Copy constructor with given space dimension.
Definition at line 44 of file Generator.inlines.hh.
00045 : Linear_Row(g, dimension, dimension) { 00046 }
| Parma_Polyhedra_Library::Generator::Generator | ( | ) | [private] |
Default constructor: private and not implemented.
Referenced by initialize().
| void Parma_Polyhedra_Library::Generator::ascii_dump | ( | std::ostream & | s | ) | const [inline] |
Writes to s an ASCII representation of *this.
Reimplemented from Parma_Polyhedra_Library::Linear_Row.
Reimplemented in Parma_Polyhedra_Library::Grid_Generator.
Definition at line 199 of file Generator.inlines.hh.
References ascii_dump().
00199 { 00200 Linear_Row::ascii_dump(s); 00201 }
| void Parma_Polyhedra_Library::Generator::ascii_dump | ( | ) | const |
Writes to std::cerr an ASCII representation of *this.
Reimplemented from Parma_Polyhedra_Library::Linear_Row.
Reimplemented in Parma_Polyhedra_Library::Grid_Generator.
Referenced by Parma_Polyhedra_Library::MIP_Problem::ascii_dump(), and ascii_dump().
| bool Parma_Polyhedra_Library::Generator::ascii_load | ( | std::istream & | s | ) | [inline] |
Loads from s an ASCII representation (as produced by ascii_dump(std::ostream&) const) and sets *this accordingly. Returns true if successful, false otherwise.
Reimplemented from Parma_Polyhedra_Library::Linear_Row.
Reimplemented in Parma_Polyhedra_Library::Grid_Generator.
Definition at line 204 of file Generator.inlines.hh.
00204 { 00205 return Linear_Row::ascii_load(s); 00206 }
| PPL::Generator Parma_Polyhedra_Library::Generator::closure_point | ( | const Linear_Expression & | e = Linear_Expression::zero(), |
|
| Coefficient_traits::const_reference | d = Coefficient_one() | |||
| ) | [inline, static] |
Returns the closure point at e / d.
Shorthand for Generator Generator::closure_point(const Linear_Expression& e, Coefficient_traits::const_reference d).
Both e and d are optional arguments, with default values Linear_Expression::zero() and Coefficient_one(), respectively.
| std::invalid_argument | Thrown if d is zero. |
Definition at line 181 of file Generator.inlines.hh.
Referenced by initialize().
00182 { 00183 return Generator::closure_point(e, d); 00184 }
| Coefficient_traits::const_reference Parma_Polyhedra_Library::Generator::coefficient | ( | Variable | v | ) | const [inline] |
Returns the coefficient of v in *this.
| std::invalid_argument | Thrown if the index of v is greater than or equal to the space dimension of *this. |
Reimplemented in Parma_Polyhedra_Library::Grid_Generator.
Definition at line 124 of file Generator.inlines.hh.
References Parma_Polyhedra_Library::Variable::id(), space_dimension(), Parma_Polyhedra_Library::Variable::space_dimension(), and throw_dimension_incompatible().
Referenced by Parma_Polyhedra_Library::BD_Shape< T >::BD_Shape(), Parma_Polyhedra_Library::BHRZ03_Certificate::BHRZ03_Certificate(), Parma_Polyhedra_Library::Box< ITV >::Box(), Parma_Polyhedra_Library::MIP_Problem::choose_branching_variable(), Parma_Polyhedra_Library::BHRZ03_Certificate::compare(), Parma_Polyhedra_Library::MIP_Problem::evaluate_objective_function(), Parma_Polyhedra_Library::MIP_Problem::is_mip_satisfiable(), l_m_distance_assign(), Parma_Polyhedra_Library::Polyhedron::map_space_dimensions(), Parma_Polyhedra_Library::Octagonal_Shape< T >::Octagonal_Shape(), Parma_Polyhedra_Library::MIP_Problem::OK(), Parma_Polyhedra_Library::Octagonal_Shape< T >::relation_with(), Parma_Polyhedra_Library::Grid::relation_with(), Parma_Polyhedra_Library::Box< ITV >::relation_with(), Parma_Polyhedra_Library::BD_Shape< T >::relation_with(), and Parma_Polyhedra_Library::MIP_Problem::solve_mip().
00124 { 00125 if (v.space_dimension() > space_dimension()) 00126 throw_dimension_incompatible("coefficient(v)", "v", v); 00127 return Linear_Row::coefficient(v.id()); 00128 }
| Coefficient_traits::const_reference Parma_Polyhedra_Library::Generator::divisor | ( | ) | const [inline] |
If *this is either a point or a closure point, returns its divisor.
| std::invalid_argument | Thrown if *this is neither a point nor a closure point. |
Reimplemented in Parma_Polyhedra_Library::Grid_Generator.
Definition at line 131 of file Generator.inlines.hh.
References Parma_Polyhedra_Library::Linear_Row::inhomogeneous_term(), is_ray_or_point(), and throw_invalid_argument().
Referenced by Parma_Polyhedra_Library::Polyhedron::add_generator(), Parma_Polyhedra_Library::BD_Shape< T >::BD_Shape(), Parma_Polyhedra_Library::Box< ITV >::Box(), Parma_Polyhedra_Library::MIP_Problem::choose_branching_variable(), Parma_Polyhedra_Library::MIP_Problem::evaluate_objective_function(), Parma_Polyhedra_Library::MIP_Problem::is_mip_satisfiable(), l_m_distance_assign(), Parma_Polyhedra_Library::Polyhedron::map_space_dimensions(), Parma_Polyhedra_Library::Octagonal_Shape< T >::Octagonal_Shape(), Parma_Polyhedra_Library::MIP_Problem::OK(), Parma_Polyhedra_Library::Octagonal_Shape< T >::relation_with(), Parma_Polyhedra_Library::Grid::relation_with(), Parma_Polyhedra_Library::Box< ITV >::relation_with(), Parma_Polyhedra_Library::BD_Shape< T >::relation_with(), and Parma_Polyhedra_Library::MIP_Problem::solve_mip().
00131 { 00132 Coefficient_traits::const_reference d = Linear_Row::inhomogeneous_term(); 00133 if (!is_ray_or_point() || d == 0) 00134 throw_invalid_argument("divisor()", 00135 "*this is neither a point nor a closure point"); 00136 return d; 00137 }
| memory_size_type Parma_Polyhedra_Library::Generator::external_memory_in_bytes | ( | ) | const [inline] |
Returns the size in bytes of the memory managed by *this.
Reimplemented from Parma_Polyhedra_Library::Row.
Reimplemented in Parma_Polyhedra_Library::Grid_Generator.
Definition at line 140 of file Generator.inlines.hh.
Referenced by Parma_Polyhedra_Library::MIP_Problem::external_memory_in_bytes().
00140 { 00141 return Linear_Row::external_memory_in_bytes(); 00142 }
| void Parma_Polyhedra_Library::Generator::finalize | ( | ) | [static] |
Finalizes the class.
Reimplemented in Parma_Polyhedra_Library::Grid_Generator.
Definition at line 176 of file Generator.cc.
References zero_dim_closure_point_p, and zero_dim_point_p.
00176 { 00177 PPL_ASSERT(zero_dim_point_p != 0); 00178 delete zero_dim_point_p; 00179 zero_dim_point_p = 0; 00180 00181 PPL_ASSERT(zero_dim_closure_point_p != 0); 00182 delete zero_dim_closure_point_p; 00183 zero_dim_closure_point_p = 0; 00184 }
| void Parma_Polyhedra_Library::Generator::initialize | ( | ) | [static] |
Initializes the class.
Reimplemented in Parma_Polyhedra_Library::Grid_Generator.
Definition at line 165 of file Generator.cc.
References closure_point(), Generator(), point(), zero_dim_closure_point_p, and zero_dim_point_p.
00165 { 00166 PPL_ASSERT(zero_dim_point_p == 0); 00167 zero_dim_point_p 00168 = new Generator(point()); 00169 00170 PPL_ASSERT(zero_dim_closure_point_p == 0); 00171 zero_dim_closure_point_p 00172 = new Generator(closure_point()); 00173 }
| bool Parma_Polyhedra_Library::Generator::is_closure_point | ( | ) | const [inline] |
Returns true if and only if *this is a closure point.
Definition at line 109 of file Generator.inlines.hh.
References CLOSURE_POINT, and type().
Referenced by Parma_Polyhedra_Library::Polyhedron::add_generator(), Parma_Polyhedra_Library::Polyhedron::BHRZ03_combining_constraints(), Parma_Polyhedra_Library::Polyhedron::BHRZ03_evolving_points(), Parma_Polyhedra_Library::Polyhedron::BHZ09_NNC_poly_hull_assign_if_exact(), Parma_Polyhedra_Library::Polyhedron::frequency(), Parma_Polyhedra_Library::Polyhedron::is_topologically_closed(), Parma_Polyhedra_Library::Polyhedron::max_min(), Parma_Polyhedra_Library::Grid::relation_with(), and Parma_Polyhedra_Library::Generator_System::const_iterator::skip_forward().
00109 { 00110 return type() == CLOSURE_POINT; 00111 }
| bool Parma_Polyhedra_Library::Generator::is_equivalent_to | ( | const Generator & | y | ) | const |
Returns true if and only if *this and y are equivalent generators.
Generators having different space dimensions are not equivalent.
Definition at line 126 of file Generator.cc.
References Parma_Polyhedra_Library::Linear_Row::is_necessarily_closed(), Parma_Polyhedra_Library::Row::normalize(), POINT, space_dimension(), and type().
Referenced by operator!=(), and operator==().
00126 { 00127 const Generator& x = *this; 00128 const dimension_type x_space_dim = x.space_dimension(); 00129 if (x_space_dim != y.space_dimension()) 00130 return false; 00131 00132 const Type x_type = x.type(); 00133 if (x_type != y.type()) 00134 return false; 00135 00136 if (x_type == POINT 00137 && !(x.is_necessarily_closed() && y.is_necessarily_closed())) { 00138 // Due to the presence of epsilon-coefficients, syntactically 00139 // different points may actually encode the same generator. 00140 // First, drop the epsilon-coefficient ... 00141 Linear_Expression x_expr(x); 00142 Linear_Expression y_expr(y); 00143 // ... second, re-normalize ... 00144 x_expr.normalize(); 00145 y_expr.normalize(); 00146 // ... and finally check for syntactic equality. 00147 for (dimension_type i = x_space_dim + 1; i-- > 0; ) 00148 if (x_expr[i] != y_expr[i]) 00149 return false; 00150 return true; 00151 } 00152 00153 // Here the epsilon-coefficient, if present, is zero. 00154 // It is sufficient to check for syntactic equality. 00155 for (dimension_type i = x_space_dim + 1; i-- > 0; ) 00156 if (x[i] != y[i]) 00157 return false; 00158 return true; 00159 }
| bool Parma_Polyhedra_Library::Generator::is_line | ( | ) | const [inline] |
Returns true if and only if *this is a line.
Reimplemented in Parma_Polyhedra_Library::Grid_Generator.
Definition at line 69 of file Generator.inlines.hh.
References Parma_Polyhedra_Library::Linear_Row::is_line_or_equality().
Referenced by Parma_Polyhedra_Library::Polyhedron::add_recycled_generators(), Parma_Polyhedra_Library::Polyhedron::bounds(), Parma_Polyhedra_Library::Polyhedron::constrains(), Parma_Polyhedra_Library::Polyhedron::is_included_in(), Parma_Polyhedra_Library::Polyhedron::max_min(), Parma_Polyhedra_Library::Octagonal_Shape< T >::relation_with(), Parma_Polyhedra_Library::Box< ITV >::relation_with(), Parma_Polyhedra_Library::BD_Shape< T >::relation_with(), Parma_Polyhedra_Library::Generator_System::satisfied_by_all_generators(), Parma_Polyhedra_Library::Constraint_System::satisfies_all_constraints(), Parma_Polyhedra_Library::Polyhedron::simplify_using_context_assign(), and type().
00069 { 00070 return is_line_or_equality(); 00071 }
| bool Parma_Polyhedra_Library::Generator::is_line_or_ray | ( | ) | const [inline] |
Returns true if and only if *this is a line or a ray.
Definition at line 79 of file Generator.inlines.hh.
Referenced by Parma_Polyhedra_Library::Generator_System::add_corresponding_points(), Parma_Polyhedra_Library::Polyhedron::bounds(), Parma_Polyhedra_Library::Polyhedron::constrains(), Parma_Polyhedra_Library::Polyhedron::frequency(), Parma_Polyhedra_Library::Generator_System::insert(), Parma_Polyhedra_Library::Generator_System::insert_pending(), Parma_Polyhedra_Library::Grid_Generator::is_line_or_parameter(), is_ray(), l_m_distance_assign(), Parma_Polyhedra_Library::Polyhedron::max_min(), Parma_Polyhedra_Library::Octagonal_Shape< T >::relation_with(), Parma_Polyhedra_Library::Box< ITV >::relation_with(), Parma_Polyhedra_Library::BD_Shape< T >::relation_with(), Parma_Polyhedra_Library::Generator_System::remove_invalid_lines_and_rays(), and type().
| bool Parma_Polyhedra_Library::Generator::is_matching_closure_point | ( | const Generator & | p | ) | const [private] |
Returns true if and only if the closure point *this has the same coordinates of the point p.
It is assumed that *this is a closure point, p is a point and both topologies and space dimensions agree.
Definition at line 276 of file Generator.cc.
References CLOSURE_POINT, Parma_Polyhedra_Library::exact_div_assign(), Parma_Polyhedra_Library::gcd_assign(), POINT, PPL_DIRTY_TEMP_COEFFICIENT, space_dimension(), Parma_Polyhedra_Library::Linear_Row::topology(), and type().
Referenced by Parma_Polyhedra_Library::Polyhedron::is_topologically_closed(), and Parma_Polyhedra_Library::Generator_System::const_iterator::skip_forward().
00276 { 00277 PPL_ASSERT(topology() == p.topology() 00278 && space_dimension() == p.space_dimension() 00279 && type() == CLOSURE_POINT 00280 && p.type() == POINT); 00281 const Generator& cp = *this; 00282 if (cp[0] == p[0]) { 00283 // Divisors are equal: we can simply compare coefficients 00284 // (disregarding the epsilon coefficient). 00285 for (dimension_type i = cp.size() - 2; i > 0; --i) 00286 if (cp[i] != p[i]) 00287 return false; 00288 return true; 00289 } 00290 else { 00291 // Divisors are different: divide them by their GCD 00292 // to simplify the following computation. 00293 PPL_DIRTY_TEMP_COEFFICIENT(gcd); 00294 gcd_assign(gcd, cp[0], p[0]); 00295 const bool rel_prime = (gcd == 1); 00296 PPL_DIRTY_TEMP_COEFFICIENT(cp_0_scaled); 00297 PPL_DIRTY_TEMP_COEFFICIENT(p_0_scaled); 00298 if (!rel_prime) { 00299 exact_div_assign(cp_0_scaled, cp[0], gcd); 00300 exact_div_assign(p_0_scaled, p[0], gcd); 00301 } 00302 const Coefficient& cp_div = rel_prime ? cp[0] : cp_0_scaled; 00303 const Coefficient& p_div = rel_prime ? p[0] : p_0_scaled; 00304 PPL_DIRTY_TEMP_COEFFICIENT(prod1); 00305 PPL_DIRTY_TEMP_COEFFICIENT(prod2); 00306 for (dimension_type i = cp.size() - 2; i > 0; --i) { 00307 prod1 = cp[i] * p_div; 00308 prod2 = p[i] * cp_div; 00309 if (prod1 != prod2) 00310 return false; 00311 } 00312 return true; 00313 } 00314 }
| bool Parma_Polyhedra_Library::Generator::is_point | ( | ) | const [inline] |
Returns true if and only if *this is a point.
Reimplemented in Parma_Polyhedra_Library::Grid_Generator.
Definition at line 104 of file Generator.inlines.hh.
Referenced by Parma_Polyhedra_Library::Polyhedron::add_generator(), Parma_Polyhedra_Library::Polyhedron::BHRZ03_combining_constraints(), Parma_Polyhedra_Library::Polyhedron::BHRZ03_evolving_points(), Parma_Polyhedra_Library::Polyhedron::BHZ09_NNC_poly_hull_assign_if_exact(), Parma_Polyhedra_Library::Box< ITV >::Box(), Parma_Polyhedra_Library::MIP_Problem::evaluate_objective_function(), Parma_Polyhedra_Library::Polyhedron::frequency(), Parma_Polyhedra_Library::Polyhedron::is_topologically_closed(), Parma_Polyhedra_Library::Polyhedron::max_min(), Parma_Polyhedra_Library::Grid::relation_with(), Parma_Polyhedra_Library::Generator_System::relation_with(), Parma_Polyhedra_Library::Box< ITV >::relation_with(), and Parma_Polyhedra_Library::Generator_System::const_iterator::skip_forward().
| bool Parma_Polyhedra_Library::Generator::is_ray | ( | ) | const [inline] |
Returns true if and only if *this is a ray.
Definition at line 84 of file Generator.inlines.hh.
References is_line_or_ray(), and is_ray_or_point().
Referenced by Parma_Polyhedra_Library::Polyhedron::BHRZ03_evolving_rays(), Parma_Polyhedra_Library::Grid_Generator::is_parameter(), and Parma_Polyhedra_Library::Box< ITV >::relation_with().
00084 { 00085 return is_ray_or_point() && is_line_or_ray(); 00086 }
| bool Parma_Polyhedra_Library::Generator::is_ray_or_point | ( | ) | const [inline, private] |
Returns true if and only if *this is not a line.
Definition at line 74 of file Generator.inlines.hh.
References Parma_Polyhedra_Library::Linear_Row::is_ray_or_point_or_inequality().
Referenced by divisor(), and is_ray().
00074 { 00075 return is_ray_or_point_or_inequality(); 00076 }
| PPL::Generator Parma_Polyhedra_Library::Generator::line | ( | const Linear_Expression & | e | ) | [inline, static] |
Returns the line of direction e.
Shorthand for Generator Generator::line(const Linear_Expression& e).
| std::invalid_argument | Thrown if the homogeneous part of e represents the origin of the vector space. |
Definition at line 163 of file Generator.inlines.hh.
Referenced by Parma_Polyhedra_Library::Polyhedron::add_generator(), and Parma_Polyhedra_Library::Polyhedron::unconstrain().
00163 { 00164 return Generator::line(e); 00165 }
| dimension_type Parma_Polyhedra_Library::Generator::max_space_dimension | ( | ) | [inline, static] |
Returns the maximum space dimension a Generator can handle.
Reimplemented from Parma_Polyhedra_Library::Linear_Row.
Reimplemented in Parma_Polyhedra_Library::Grid_Generator.
Definition at line 59 of file Generator.inlines.hh.
00059 { 00060 return Linear_Row::max_space_dimension(); 00061 }
| bool Parma_Polyhedra_Library::Generator::OK | ( | ) | const |
Checks if all the invariants are satisfied.
Reimplemented from Parma_Polyhedra_Library::Linear_Row.
Reimplemented in Parma_Polyhedra_Library::Grid_Generator.
Definition at line 319 of file Generator.cc.
References Parma_Polyhedra_Library::Linear_Row::all_homogeneous_terms_are_zero(), Parma_Polyhedra_Library::Linear_Row::is_necessarily_closed(), Parma_Polyhedra_Library::Linear_Row::OK(), Parma_Polyhedra_Library::Linear_Row::strong_normalize(), and type().
Referenced by Parma_Polyhedra_Library::MIP_Problem::OK().
00319 { 00320 // Check the underlying Linear_Row object. 00321 if (!Linear_Row::OK()) 00322 return false; 00323 00324 // Topology consistency check. 00325 const dimension_type min_size = is_necessarily_closed() ? 1 : 2; 00326 if (size() < min_size) { 00327 #ifndef NDEBUG 00328 std::cerr << "Generator has fewer coefficients than the minimum " 00329 << "allowed by its topology:" 00330 << std::endl 00331 << "size is " << size() 00332 << ", minimum is " << min_size << "." 00333 << std::endl; 00334 #endif 00335 return false; 00336 } 00337 00338 // Normalization check. 00339 const Generator& g = *this; 00340 Generator tmp = g; 00341 tmp.strong_normalize(); 00342 if (tmp != g) { 00343 #ifndef NDEBUG 00344 std::cerr << "Generators should be strongly normalized!" 00345 << std::endl; 00346 #endif 00347 return false; 00348 } 00349 00350 switch (g.type()) { 00351 case LINE: 00352 // Intentionally fall through. 00353 case RAY: 00354 if (g[0] != 0) { 00355 #ifndef NDEBUG 00356 std::cerr << "Lines must have a zero inhomogeneous term!" 00357 << std::endl; 00358 #endif 00359 return false; 00360 } 00361 if (!g.is_necessarily_closed() && g[size() - 1] != 0) { 00362 #ifndef NDEBUG 00363 std::cerr << "Lines and rays must have a zero coefficient " 00364 << "for the epsilon dimension!" 00365 << std::endl; 00366 #endif 00367 return false; 00368 } 00369 // The following test is correct, since we already checked 00370 // that the epsilon coordinate is zero. 00371 if (g.all_homogeneous_terms_are_zero()) { 00372 #ifndef NDEBUG 00373 std::cerr << "The origin of the vector space cannot be a line or a ray!" 00374 << std::endl; 00375 #endif 00376 return false; 00377 } 00378 break; 00379 00380 case POINT: 00381 if (g[0] <= 0) { 00382 #ifndef NDEBUG 00383 std::cerr << "Points must have a positive divisor!" 00384 << std::endl; 00385 #endif 00386 return false; 00387 } 00388 if (!g.is_necessarily_closed()) 00389 if (g[size() - 1] <= 0) { 00390 #ifndef NDEBUG 00391 std::cerr << "In the NNC topology, points must have epsilon > 0" 00392 << std::endl; 00393 #endif 00394 return false; 00395 } 00396 break; 00397 00398 case CLOSURE_POINT: 00399 if (g[0] <= 0) { 00400 #ifndef NDEBUG 00401 std::cerr << "Closure points must have a positive divisor!" 00402 << std::endl; 00403 #endif 00404 return false; 00405 } 00406 break; 00407 } 00408 00409 // All tests passed. 00410 return true; 00411 }
Assignment operator.
Reimplemented in Parma_Polyhedra_Library::Grid_Generator.
Definition at line 53 of file Generator.inlines.hh.
00053 { 00054 Linear_Row::operator=(g); 00055 return *this; 00056 }
| Parma_Polyhedra_Library::Generator::Parma_Polyhedra_Library::Linear_Expression::Linear_Expression | ( | const Generator & | g | ) | [private] |
| PPL::Generator Parma_Polyhedra_Library::Generator::point | ( | const Linear_Expression & | e = Linear_Expression::zero(), |
|
| Coefficient_traits::const_reference | d = Coefficient_one() | |||
| ) | [inline, static] |
Returns the point at e / d.
Shorthand for Generator Generator::point(const Linear_Expression& e, Coefficient_traits::const_reference d).
Both e and d are optional arguments, with default values Linear_Expression::zero() and Coefficient_one(), respectively.
| std::invalid_argument | Thrown if d is zero. |
Definition at line 175 of file Generator.inlines.hh.
Referenced by Parma_Polyhedra_Library::Polyhedron::add_generator(), initialize(), Parma_Polyhedra_Library::Grid::max_min(), and Parma_Polyhedra_Library::Box< ITV >::max_min().
00175 { 00176 return Generator::point(e, d); 00177 }
| void Parma_Polyhedra_Library::Generator::print | ( | ) | const |
Prints *this to std::cerr using operator<<.
Reimplemented from Parma_Polyhedra_Library::Linear_Row.
Reimplemented in Parma_Polyhedra_Library::Grid_Generator.
| PPL::Generator Parma_Polyhedra_Library::Generator::ray | ( | const Linear_Expression & | e | ) | [inline, static] |
Returns the ray of direction e.
Shorthand for Generator Generator::ray(const Linear_Expression& e).
| std::invalid_argument | Thrown if the homogeneous part of e represents the origin of the vector space. |
Definition at line 169 of file Generator.inlines.hh.
Referenced by Parma_Polyhedra_Library::Polyhedron::add_generator().
00169 { 00170 return Generator::ray(e); 00171 }
| void Parma_Polyhedra_Library::Generator::set_is_line | ( | ) | [inline, private] |
Sets the Linear_Row kind to LINE_OR_EQUALITY.
Reimplemented in Parma_Polyhedra_Library::Grid_Generator.
Definition at line 114 of file Generator.inlines.hh.
References Parma_Polyhedra_Library::Linear_Row::set_is_line_or_equality().
Referenced by Parma_Polyhedra_Library::Polyhedron::add_recycled_generators().
00114 { 00115 set_is_line_or_equality(); 00116 }
| void Parma_Polyhedra_Library::Generator::set_is_ray_or_point | ( | ) | [inline, private] |
Sets the Linear_Row kind to RAY_OR_POINT_OR_INEQUALITY.
Definition at line 119 of file Generator.inlines.hh.
References Parma_Polyhedra_Library::Linear_Row::set_is_ray_or_point_or_inequality().
Referenced by Parma_Polyhedra_Library::Grid_Generator::coefficient_swap(), and Parma_Polyhedra_Library::Grid_Generator::set_is_parameter_or_point().
00119 { 00120 set_is_ray_or_point_or_inequality(); 00121 }
| dimension_type Parma_Polyhedra_Library::Generator::space_dimension | ( | ) | const [inline] |
Returns the dimension of the vector space enclosing *this.
Reimplemented from Parma_Polyhedra_Library::Linear_Row.
Reimplemented in Parma_Polyhedra_Library::Grid_Generator.
Definition at line 64 of file Generator.inlines.hh.
Referenced by Parma_Polyhedra_Library::Polyhedron::add_generator(), coefficient(), Parma_Polyhedra_Library::MIP_Problem::evaluate_objective_function(), Parma_Polyhedra_Library::Generator_System::insert(), Parma_Polyhedra_Library::Generator_System::insert_pending(), is_equivalent_to(), is_matching_closure_point(), Parma_Polyhedra_Library::MIP_Problem::is_satisfied(), Parma_Polyhedra_Library::MIP_Problem::is_saturated(), l_m_distance_assign(), Parma_Polyhedra_Library::MIP_Problem::OK(), Parma_Polyhedra_Library::Topology_Adjusted_Scalar_Product_Sign::operator()(), operator<<(), Parma_Polyhedra_Library::Polyhedron::relation_with(), Parma_Polyhedra_Library::Octagonal_Shape< T >::relation_with(), Parma_Polyhedra_Library::Grid::relation_with(), Parma_Polyhedra_Library::Box< ITV >::relation_with(), Parma_Polyhedra_Library::BD_Shape< T >::relation_with(), Parma_Polyhedra_Library::Constraint_System::satisfies_all_constraints(), Parma_Polyhedra_Library::Polyhedron::throw_dimension_incompatible(), Parma_Polyhedra_Library::Octagonal_Shape< T >::throw_dimension_incompatible(), Parma_Polyhedra_Library::Grid::throw_dimension_incompatible(), throw_dimension_incompatible(), Parma_Polyhedra_Library::Box< ITV >::throw_dimension_incompatible(), and Parma_Polyhedra_Library::BD_Shape< T >::throw_dimension_incompatible().
00064 { 00065 return Linear_Row::space_dimension(); 00066 }
| void Parma_Polyhedra_Library::Generator::swap | ( | Generator & | y | ) | [inline] |
Swaps *this with y.
Definition at line 209 of file Generator.inlines.hh.
Referenced by Generator(), and swap().
00209 { 00210 Linear_Row::swap(y); 00211 }
| void Parma_Polyhedra_Library::Generator::throw_dimension_incompatible | ( | const char * | method, | |
| const char * | name_var, | |||
| Variable | v | |||
| ) | const [private] |
Throw a std::invalid_argument exception containing the appropriate error message.
Definition at line 36 of file Generator.cc.
References Parma_Polyhedra_Library::Variable::space_dimension(), and space_dimension().
Referenced by Parma_Polyhedra_Library::Grid_Generator::coefficient(), and coefficient().
00038 { 00039 std::ostringstream s; 00040 s << "PPL::Generator::" << method << ":" << std::endl 00041 << "this->space_dimension() == " << space_dimension() << ", " 00042 << name_var << ".space_dimension() == " << v.space_dimension() << "."; 00043 throw std::invalid_argument(s.str()); 00044 }
| void Parma_Polyhedra_Library::Generator::throw_invalid_argument | ( | const char * | method, | |
| const char * | reason | |||
| ) | const [private] |
Throw a std::invalid_argument exception containing the appropriate error message.
Reimplemented in Parma_Polyhedra_Library::Grid_Generator.
Definition at line 47 of file Generator.cc.
Referenced by divisor().
| memory_size_type Parma_Polyhedra_Library::Generator::total_memory_in_bytes | ( | ) | const [inline] |
Returns a lower bound to the total size in bytes of the memory occupied by *this.
Reimplemented from Parma_Polyhedra_Library::Row.
Reimplemented in Parma_Polyhedra_Library::Grid_Generator.
Definition at line 145 of file Generator.inlines.hh.
00145 { 00146 return Linear_Row::total_memory_in_bytes(); 00147 }
| Generator::Type Parma_Polyhedra_Library::Generator::type | ( | ) | const [inline] |
Returns the generator type of *this.
Reimplemented in Parma_Polyhedra_Library::Grid_Generator.
Definition at line 89 of file Generator.inlines.hh.
References CLOSURE_POINT, is_line(), is_line_or_ray(), Parma_Polyhedra_Library::Linear_Row::is_necessarily_closed(), LINE, POINT, RAY, and Parma_Polyhedra_Library::Row::size().
Referenced by Parma_Polyhedra_Library::Polyhedron::add_generator(), Parma_Polyhedra_Library::Generator_System::ascii_dump(), Parma_Polyhedra_Library::BD_Shape< T >::BD_Shape(), Parma_Polyhedra_Library::Box< ITV >::Box(), is_closure_point(), is_equivalent_to(), Parma_Polyhedra_Library::Polyhedron::is_included_in(), is_matching_closure_point(), is_point(), Parma_Polyhedra_Library::Polyhedron::map_space_dimensions(), Parma_Polyhedra_Library::Octagonal_Shape< T >::Octagonal_Shape(), OK(), operator<<(), Parma_Polyhedra_Library::Generator_System::relation_with(), Parma_Polyhedra_Library::Generator_System::satisfied_by_all_generators(), Parma_Polyhedra_Library::Constraint_System::satisfies_all_constraints(), Parma_Polyhedra_Library::Polyhedron::simplify_using_context_assign(), and Parma_Polyhedra_Library::Grid_Generator::type().
00089 { 00090 if (is_line()) 00091 return LINE; 00092 if (is_line_or_ray()) 00093 return RAY; 00094 if (is_necessarily_closed()) 00095 return POINT; 00096 else { 00097 // Checking the value of the epsilon coefficient. 00098 const Generator& g = *this; 00099 return (g[size() - 1] == 0) ? CLOSURE_POINT : POINT; 00100 } 00101 }
| const Generator & Parma_Polyhedra_Library::Generator::zero_dim_closure_point | ( | ) | [inline, static] |
Returns, as a closure point, the origin of the zero-dimensional space
.
Definition at line 156 of file Generator.inlines.hh.
References zero_dim_closure_point_p.
Referenced by Parma_Polyhedra_Library::Polyhedron::add_space_dimensions_and_project().
00156 { 00157 PPL_ASSERT(zero_dim_closure_point_p != 0); 00158 return *zero_dim_closure_point_p; 00159 }
| const Generator & Parma_Polyhedra_Library::Generator::zero_dim_point | ( | ) | [inline, static] |
Returns the origin of the zero-dimensional space
.
Reimplemented in Parma_Polyhedra_Library::Grid_Generator.
Definition at line 150 of file Generator.inlines.hh.
References zero_dim_point_p.
Referenced by Parma_Polyhedra_Library::Polyhedron::add_space_dimensions_and_project(), and Parma_Polyhedra_Library::Generator_System::initialize().
00150 { 00151 PPL_ASSERT(zero_dim_point_p != 0); 00152 return *zero_dim_point_p; 00153 }
| bool euclidean_distance_assign | ( | Checked_Number< To, Extended_Number_Policy > & | r, | |
| const Generator & | x, | |||
| const Generator & | y, | |||
| Rounding_Dir | dir, | |||
| Temp & | tmp0, | |||
| Temp & | tmp1, | |||
| Temp & | tmp2 | |||
| ) | [related] |
Computes the euclidean distance between x and y.
If the euclidean distance between x and y is defined, stores an approximation of it into r and returns true; returns false otherwise.
The direction of the approximation is specified by dir.
All computations are performed using the temporary variables tmp0, tmp1 and tmp2.
false is returned.Definition at line 314 of file Generator.inlines.hh.
| bool euclidean_distance_assign | ( | Checked_Number< To, Extended_Number_Policy > & | r, | |
| const Generator & | x, | |||
| const Generator & | y, | |||
| Rounding_Dir | dir | |||
| ) | [related] |
Computes the euclidean distance between x and y.
If the euclidean distance between x and y is defined, stores an approximation of it into r and returns true; returns false otherwise.
The direction of the approximation is specified by dir.
All computations are performed using variables of type Checked_Number<To, Extended_Number_Policy>.
false is returned.Definition at line 328 of file Generator.inlines.hh.
00331 { 00332 typedef Checked_Number<Temp, Extended_Number_Policy> Checked_Temp; 00333 PPL_DIRTY_TEMP(Checked_Temp, tmp0); 00334 PPL_DIRTY_TEMP(Checked_Temp, tmp1); 00335 PPL_DIRTY_TEMP(Checked_Temp, tmp2); 00336 return euclidean_distance_assign(r, x, y, dir, tmp0, tmp1, tmp2); 00337 }
| bool l_infinity_distance_assign | ( | Checked_Number< To, Extended_Number_Policy > & | r, | |
| const Generator & | x, | |||
| const Generator & | y, | |||
| Rounding_Dir | dir, | |||
| Temp & | tmp0, | |||
| Temp & | tmp1, | |||
| Temp & | tmp2 | |||
| ) | [related] |
Computes the
distance between x and y.
If the
distance between x and y is defined, stores an approximation of it into r and returns true; returns false otherwise.
The direction of the approximation is specified by dir.
All computations are performed using the temporary variables tmp0, tmp1 and tmp2.
false is returned.Definition at line 352 of file Generator.inlines.hh.
| bool l_infinity_distance_assign | ( | Checked_Number< To, Extended_Number_Policy > & | r, | |
| const Generator & | x, | |||
| const Generator & | y, | |||
| Rounding_Dir | dir | |||
| ) | [related] |
Computes the
distance between x and y.
If the
distance between x and y is defined, stores an approximation of it into r and returns true; returns false otherwise.
The direction of the approximation is specified by dir.
All computations are performed using variables of type Checked_Number<To, Extended_Number_Policy>.
false is returned.If the
distance between x and y is defined, stores an approximation of it into r and returns true; returns false otherwise.
The direction of the approximation is specified by dir.
All computations are performed using variables of type Checked_Number<Temp, Extended_Number_Policy>.
false is returned.Definition at line 366 of file Generator.inlines.hh.
00369 { 00370 typedef Checked_Number<Temp, Extended_Number_Policy> Checked_Temp; 00371 PPL_DIRTY_TEMP(Checked_Temp, tmp0); 00372 PPL_DIRTY_TEMP(Checked_Temp, tmp1); 00373 PPL_DIRTY_TEMP(Checked_Temp, tmp2); 00374 return l_infinity_distance_assign(r, x, y, dir, tmp0, tmp1, tmp2); 00375 }
| 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 | |||
| ) | [related] |
Definition at line 218 of file Generator.inlines.hh.
References Parma_Polyhedra_Library::assign_r(), coefficient(), Parma_Polyhedra_Library::combine(), divisor(), Parma_Polyhedra_Library::finalize(), is_line_or_ray(), Parma_Polyhedra_Library::maybe_assign(), and space_dimension().
00224 { 00225 // Generator kind compatibility check: we only compute distances 00226 // between (closure) points. 00227 if (x.is_line_or_ray() || y.is_line_or_ray()) 00228 return false; 00229 const dimension_type x_space_dim = x.space_dimension(); 00230 // Dimension-compatibility check. 00231 if (x_space_dim != y.space_dimension()) 00232 return false; 00233 00234 // All zero-dim generators have distance zero. 00235 if (x_space_dim == 0) { 00236 assign_r(r, 0, ROUND_NOT_NEEDED); 00237 return true; 00238 } 00239 00240 PPL_DIRTY_TEMP0(mpq_class, x_coord); 00241 PPL_DIRTY_TEMP0(mpq_class, y_coord); 00242 PPL_DIRTY_TEMP0(mpq_class, x_div); 00243 PPL_DIRTY_TEMP0(mpq_class, y_div); 00244 assign_r(x_div, x.divisor(), ROUND_NOT_NEEDED); 00245 assign_r(y_div, y.divisor(), ROUND_NOT_NEEDED); 00246 00247 assign_r(tmp0, 0, ROUND_NOT_NEEDED); 00248 for (dimension_type i = x_space_dim; i-- > 0; ) { 00249 assign_r(x_coord, x.coefficient(Variable(i)), ROUND_NOT_NEEDED); 00250 div_assign_r(x_coord, x_coord, x_div, ROUND_NOT_NEEDED); 00251 assign_r(y_coord, y.coefficient(Variable(i)), ROUND_NOT_NEEDED); 00252 div_assign_r(y_coord, y_coord, y_div, ROUND_NOT_NEEDED); 00253 const Temp* tmp1p; 00254 const Temp* tmp2p; 00255 00256 if (x_coord > y_coord) { 00257 maybe_assign(tmp1p, tmp1, x_coord, dir); 00258 maybe_assign(tmp2p, tmp2, y_coord, inverse(dir)); 00259 } 00260 else { 00261 maybe_assign(tmp1p, tmp1, y_coord, dir); 00262 maybe_assign(tmp2p, tmp2, x_coord, inverse(dir)); 00263 } 00264 sub_assign_r(tmp1, *tmp1p, *tmp2p, dir); 00265 PPL_ASSERT(sgn(tmp1) >= 0); 00266 Specialization::combine(tmp0, tmp1, dir); 00267 } 00268 Specialization::finalize(tmp0, dir); 00269 assign_r(r, tmp0, dir); 00270 return true; 00271 }
Returns true if and only if x is not equivalent to y.
Definition at line 194 of file Generator.inlines.hh.
References is_equivalent_to().
| std::ostream & operator<< | ( | std::ostream & | s, | |
| const Generator::Type & | t | |||
| ) | [related] |
Output operator.
Definition at line 255 of file Generator.cc.
References CLOSURE_POINT, LINE, POINT, and RAY.
00255 { 00256 const char* n = 0; 00257 switch (t) { 00258 case Generator::LINE: 00259 n = "LINE"; 00260 break; 00261 case Generator::RAY: 00262 n = "RAY"; 00263 break; 00264 case Generator::POINT: 00265 n = "POINT"; 00266 break; 00267 case Generator::CLOSURE_POINT: 00268 n = "CLOSURE_POINT"; 00269 break; 00270 } 00271 s << n; 00272 return s; 00273 }
| std::ostream & operator<< | ( | std::ostream & | s, | |
| const Generator & | g | |||
| ) | [related] |
Output operator.
Definition at line 188 of file Generator.cc.
References CLOSURE_POINT, LINE, Parma_Polyhedra_Library::neg_assign(), POINT, PPL_DIRTY_TEMP_COEFFICIENT, RAY, space_dimension(), and type().
00188 { 00189 bool needed_divisor = false; 00190 bool extra_parentheses = false; 00191 const dimension_type num_variables = g.space_dimension(); 00192 Generator::Type t = g.type(); 00193 switch (t) { 00194 case Generator::LINE: 00195 s << "l("; 00196 break; 00197 case Generator::RAY: 00198 s << "r("; 00199 break; 00200 case Generator::POINT: 00201 s << "p("; 00202 goto any_point; 00203 case Generator::CLOSURE_POINT: 00204 s << "c("; 00205 any_point: 00206 if (g[0] != 1) { 00207 needed_divisor = true; 00208 dimension_type num_non_zero_coefficients = 0; 00209 for (dimension_type v = 0; v < num_variables; ++v) 00210 if (g[v+1] != 0) 00211 if (++num_non_zero_coefficients > 1) { 00212 extra_parentheses = true; 00213 s << "("; 00214 break; 00215 } 00216 } 00217 break; 00218 } 00219 00220 PPL_DIRTY_TEMP_COEFFICIENT(gv); 00221 bool first = true; 00222 for (dimension_type v = 0; v < num_variables; ++v) { 00223 gv = g[v+1]; 00224 if (gv != 0) { 00225 if (!first) { 00226 if (gv > 0) 00227 s << " + "; 00228 else { 00229 s << " - "; 00230 neg_assign(gv); 00231 } 00232 } 00233 else 00234 first = false; 00235 if (gv == -1) 00236 s << "-"; 00237 else if (gv != 1) 00238 s << gv << "*"; 00239 s << PPL::Variable(v); 00240 } 00241 } 00242 if (first) 00243 // A point or closure point in the origin. 00244 s << 0; 00245 if (extra_parentheses) 00246 s << ")"; 00247 if (needed_divisor) 00248 s << "/" << g[0]; 00249 s << ")"; 00250 return s; 00251 }
Returns true if and only if x is equivalent to y.
Definition at line 188 of file Generator.inlines.hh.
References is_equivalent_to().
friend class Parma_Polyhedra_Library::Generator_System [friend] |
Definition at line 434 of file Generator.defs.hh.
friend class Parma_Polyhedra_Library::Generator_System::const_iterator [friend] |
Definition at line 435 of file Generator.defs.hh.
friend class Parma_Polyhedra_Library::Grid_Generator [friend] |
Definition at line 438 of file Generator.defs.hh.
friend class Parma_Polyhedra_Library::Grid_Generator_System [friend] |
Definition at line 440 of file Generator.defs.hh.
| std::ostream& Parma_Polyhedra_Library::IO_Operators::operator<< | ( | std::ostream & | s, | |
| const Generator & | g | |||
| ) | [friend] |
friend class Parma_Polyhedra_Library::Polyhedron [friend] |
Definition at line 437 of file Generator.defs.hh.
friend class Parma_Polyhedra_Library::Scalar_Products [friend] |
Definition at line 431 of file Generator.defs.hh.
friend class Parma_Polyhedra_Library::Topology_Adjusted_Scalar_Product_Assign [friend] |
Definition at line 433 of file Generator.defs.hh.
friend class Parma_Polyhedra_Library::Topology_Adjusted_Scalar_Product_Sign [friend] |
Definition at line 432 of file Generator.defs.hh.
| bool rectilinear_distance_assign | ( | Checked_Number< To, Extended_Number_Policy > & | r, | |
| const Generator & | x, | |||
| const Generator & | y, | |||
| Rounding_Dir | dir, | |||
| Temp & | tmp0, | |||
| Temp & | tmp1, | |||
| Temp & | tmp2 | |||
| ) | [related] |
Computes the rectilinear (or Manhattan) distance between x and y.
If the rectilinear distance between x and y is defined, stores an approximation of it into r and returns true; returns false otherwise.
The direction of the approximation is specified by dir.
All computations are performed using the temporary variables tmp0, tmp1 and tmp2.
false is returned.Definition at line 276 of file Generator.inlines.hh.
| bool rectilinear_distance_assign | ( | Checked_Number< To, Extended_Number_Policy > & | r, | |
| const Generator & | x, | |||
| const Generator & | y, | |||
| Rounding_Dir | dir | |||
| ) | [related] |
Computes the rectilinear (or Manhattan) distance between x and y.
Computes the euclidean distance between x and y.
If the rectilinear distance between x and y is defined, stores an approximation of it into r and returns true; returns false otherwise.
The direction of the approximation is specified by dir.
All computations are performed using variables of type Checked_Number<To, Extended_Number_Policy>.
false is returned.If the rectilinear distance between x and y is defined, stores an approximation of it into r and returns true; returns false otherwise.
The direction of the approximation is specified by dir.
All computations are performed using variables of type Checked_Number<Temp, Extended_Number_Policy>.
false is returned.If the euclidean distance between x and y is defined, stores an approximation of it into r and returns true; returns false otherwise.
The direction of the approximation is specified by dir.
All computations are performed using variables of type Checked_Number<Temp, Extended_Number_Policy>.
false is returned.Definition at line 290 of file Generator.inlines.hh.
00293 { 00294 typedef Checked_Number<Temp, Extended_Number_Policy> Checked_Temp; 00295 PPL_DIRTY_TEMP(Checked_Temp, tmp0); 00296 PPL_DIRTY_TEMP(Checked_Temp, tmp1); 00297 PPL_DIRTY_TEMP(Checked_Temp, tmp2); 00298 return rectilinear_distance_assign(r, x, y, dir, tmp0, tmp1, tmp2); 00299 }
| void swap | ( | Parma_Polyhedra_Library::Generator & | x, | |
| Parma_Polyhedra_Library::Generator & | y | |||
| ) | [related] |
Specializes std::swap.
Definition at line 393 of file Generator.inlines.hh.
References swap().
00394 { 00395 x.swap(y); 00396 }
const PPL::Generator * Parma_Polyhedra_Library::Generator::zero_dim_closure_point_p = 0 [static, private] |
Holds (between class initialization and finalization) a pointer to the origin of the zero-dimensional space
, as a closure point.
Definition at line 407 of file Generator.defs.hh.
Referenced by finalize(), initialize(), and zero_dim_closure_point().
const PPL::Generator * Parma_Polyhedra_Library::Generator::zero_dim_point_p = 0 [static, private] |
Holds (between class initialization and finalization) a pointer to the origin of the zero-dimensional space
.
Reimplemented in Parma_Polyhedra_Library::Grid_Generator.
Definition at line 401 of file Generator.defs.hh.
Referenced by finalize(), initialize(), and zero_dim_point().
1.6.3