#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 & | operator<< (std::ostream &s, const Generator &g) |
| Output operator. | |
Related Functions | |
| (Note that these are not member functions.) | |
| 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) |
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 243 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 302 of file Generator.defs.hh.
00302 { 00304 LINE, 00306 RAY, 00308 POINT, 00310 CLOSURE_POINT 00311 };
| Parma_Polyhedra_Library::Generator::Generator | ( | const Generator & | g | ) | [inline] |
Ordinary copy-constructor.
Definition at line 38 of file Generator.inlines.hh.
00039 : Linear_Row(g) { 00040 }
| 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 29 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 Parma_Polyhedra_Library::swap().
00029 { 00030 assert(type != CLOSURE_POINT || topology == NOT_NECESSARILY_CLOSED); 00031 Linear_Row::swap(e); 00032 flags() = Flags(topology, (type == LINE 00033 ? LINE_OR_EQUALITY 00034 : RAY_OR_POINT_OR_INEQUALITY)); 00035 }
| Parma_Polyhedra_Library::Generator::Generator | ( | const Generator & | g, | |
| dimension_type | dimension | |||
| ) | [inline, private] |
Copy-constructor with given space dimension.
Definition at line 43 of file Generator.inlines.hh.
00044 : Linear_Row(g, dimension, dimension) { 00045 }
| Parma_Polyhedra_Library::Generator::Generator | ( | ) | [private] |
| 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 162 of file Generator.inlines.hh.
Referenced by Parma_Polyhedra_Library::Polyhedron::add_generator(), and Parma_Polyhedra_Library::Polyhedron::unconstrain().
00162 { 00163 return Generator::line(e); 00164 }
| 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 168 of file Generator.inlines.hh.
Referenced by Parma_Polyhedra_Library::Polyhedron::add_generator().
00168 { 00169 return Generator::ray(e); 00170 }
| 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 174 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().
00174 { 00175 return Generator::point(e, d); 00176 }
| 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 180 of file Generator.inlines.hh.
Referenced by initialize().
00181 { 00182 return Generator::closure_point(e, d); 00183 }
Assignment operator.
Reimplemented in Parma_Polyhedra_Library::Grid_Generator.
Definition at line 52 of file Generator.inlines.hh.
References Parma_Polyhedra_Library::Row::operator=().
Referenced by Parma_Polyhedra_Library::Grid_Generator::operator=().
00052 { 00053 Linear_Row::operator=(g); 00054 return *this; 00055 }
| 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 58 of file Generator.inlines.hh.
References Parma_Polyhedra_Library::Linear_Row::max_space_dimension().
Referenced by Parma_Polyhedra_Library::Grid_Generator::max_space_dimension().
00058 { 00059 return Linear_Row::max_space_dimension(); 00060 }
| 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 63 of file Generator.inlines.hh.
References Parma_Polyhedra_Library::Linear_Row::space_dimension().
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()(), 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::Grid_Generator::space_dimension(), 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().
00063 { 00064 return Linear_Row::space_dimension(); 00065 }
| 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 88 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(), 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().
00088 { 00089 if (is_line()) 00090 return LINE; 00091 if (is_line_or_ray()) 00092 return RAY; 00093 if (is_necessarily_closed()) 00094 return POINT; 00095 else { 00096 // Checking the value of the epsilon coefficient. 00097 const Generator& g = *this; 00098 return (g[size() - 1] == 0) ? CLOSURE_POINT : POINT; 00099 } 00100 }
| 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 68 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::Grid_Generator::is_line(), 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().
00068 { 00069 return is_line_or_equality(); 00070 }
| bool Parma_Polyhedra_Library::Generator::is_ray | ( | ) | const [inline] |
Returns true if and only if *this is a ray.
Definition at line 83 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().
00083 { 00084 return is_ray_or_point() && is_line_or_ray(); 00085 }
| 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 78 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::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_point | ( | ) | const [inline] |
Returns true if and only if *this is a point.
Reimplemented in Parma_Polyhedra_Library::Grid_Generator.
Definition at line 103 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::Box< ITV >::Box(), Parma_Polyhedra_Library::MIP_Problem::evaluate_objective_function(), Parma_Polyhedra_Library::Grid_Generator::is_point(), 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_closure_point | ( | ) | const [inline] |
Returns true if and only if *this is a closure point.
Definition at line 108 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::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().
00108 { 00109 return type() == CLOSURE_POINT; 00110 }
| 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 123 of file Generator.inlines.hh.
References Parma_Polyhedra_Library::Linear_Row::coefficient(), 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::Grid_Generator::coefficient(), 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().
00123 { 00124 if (v.space_dimension() > space_dimension()) 00125 throw_dimension_incompatible("coefficient(v)", "v", v); 00126 return Linear_Row::coefficient(v.id()); 00127 }
| 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 130 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().
00130 { 00131 Coefficient_traits::const_reference d = Linear_Row::inhomogeneous_term(); 00132 if (!is_ray_or_point() || d == 0) 00133 throw_invalid_argument("divisor()", 00134 "*this is neither a point nor a closure point"); 00135 return d; 00136 }
| void Parma_Polyhedra_Library::Generator::initialize | ( | ) | [static] |
Initializes the class.
Reimplemented in Parma_Polyhedra_Library::Grid_Generator.
Definition at line 164 of file Generator.cc.
References closure_point(), Generator(), point(), zero_dim_closure_point_p, and zero_dim_point_p.
00164 { 00165 assert(zero_dim_point_p == 0); 00166 zero_dim_point_p 00167 = new Generator(point()); 00168 00169 assert(zero_dim_closure_point_p == 0); 00170 zero_dim_closure_point_p 00171 = new Generator(closure_point()); 00172 }
| void Parma_Polyhedra_Library::Generator::finalize | ( | ) | [static] |
Finalizes the class.
Reimplemented in Parma_Polyhedra_Library::Grid_Generator.
Definition at line 175 of file Generator.cc.
References zero_dim_closure_point_p, and zero_dim_point_p.
00175 { 00176 assert(zero_dim_point_p != 0); 00177 delete zero_dim_point_p; 00178 zero_dim_point_p = 0; 00179 00180 assert(zero_dim_closure_point_p != 0); 00181 delete zero_dim_closure_point_p; 00182 zero_dim_closure_point_p = 0; 00183 }
| 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 149 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().
00149 { 00150 assert(zero_dim_point_p != 0); 00151 return *zero_dim_point_p; 00152 }
| 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 155 of file Generator.inlines.hh.
References zero_dim_closure_point_p.
Referenced by Parma_Polyhedra_Library::Polyhedron::add_space_dimensions_and_project().
00155 { 00156 assert(zero_dim_closure_point_p != 0); 00157 return *zero_dim_closure_point_p; 00158 }
| 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 144 of file Generator.inlines.hh.
References Parma_Polyhedra_Library::total_memory_in_bytes().
00144 { 00145 return Linear_Row::total_memory_in_bytes(); 00146 }
| 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 139 of file Generator.inlines.hh.
References Parma_Polyhedra_Library::external_memory_in_bytes().
Referenced by Parma_Polyhedra_Library::MIP_Problem::external_memory_in_bytes().
00139 { 00140 return Linear_Row::external_memory_in_bytes(); 00141 }
| 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 125 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==().
00125 { 00126 const Generator& x = *this; 00127 const dimension_type x_space_dim = x.space_dimension(); 00128 if (x_space_dim != y.space_dimension()) 00129 return false; 00130 00131 const Type x_type = x.type(); 00132 if (x_type != y.type()) 00133 return false; 00134 00135 if (x_type == POINT 00136 && !(x.is_necessarily_closed() && y.is_necessarily_closed())) { 00137 // Due to the presence of epsilon-coefficients, syntactically 00138 // different points may actually encode the same generator. 00139 // First, drop the epsilon-coefficient ... 00140 Linear_Expression x_expr(x); 00141 Linear_Expression y_expr(y); 00142 // ... second, re-normalize ... 00143 x_expr.normalize(); 00144 y_expr.normalize(); 00145 // ... and finally check for syntactic equality. 00146 for (dimension_type i = x_space_dim + 1; i-- > 0; ) 00147 if (x_expr[i] != y_expr[i]) 00148 return false; 00149 return true; 00150 } 00151 00152 // Here the epsilon-coefficient, if present, is zero. 00153 // It is sufficient to check for syntactic equality. 00154 for (dimension_type i = x_space_dim + 1; i-- > 0; ) 00155 if (x[i] != y[i]) 00156 return false; 00157 return true; 00158 }
| 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().
| 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 198 of file Generator.inlines.hh.
References Parma_Polyhedra_Library::ascii_dump().
00198 { 00199 Linear_Row::ascii_dump(s); 00200 }
| 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.
| 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 203 of file Generator.inlines.hh.
References Parma_Polyhedra_Library::ascii_load().
Referenced by Parma_Polyhedra_Library::MIP_Problem::ascii_load().
00203 { 00204 return Linear_Row::ascii_load(s); 00205 }
| 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 318 of file Generator.cc.
References Parma_Polyhedra_Library::Linear_Row::all_homogeneous_terms_are_zero(), CLOSURE_POINT, Parma_Polyhedra_Library::Linear_Row::is_necessarily_closed(), LINE, Parma_Polyhedra_Library::Linear_Row::OK(), POINT, RAY, Parma_Polyhedra_Library::Row::size(), Parma_Polyhedra_Library::Linear_Row::strong_normalize(), and type().
Referenced by Parma_Polyhedra_Library::MIP_Problem::OK().
00318 { 00319 // Check the underlying Linear_Row object. 00320 if (!Linear_Row::OK()) 00321 return false; 00322 00323 // Topology consistency check. 00324 const dimension_type min_size = is_necessarily_closed() ? 1 : 2; 00325 if (size() < min_size) { 00326 #ifndef NDEBUG 00327 std::cerr << "Generator has fewer coefficients than the minimum " 00328 << "allowed by its topology:" 00329 << std::endl 00330 << "size is " << size() 00331 << ", minimum is " << min_size << "." 00332 << std::endl; 00333 #endif 00334 return false; 00335 } 00336 00337 // Normalization check. 00338 const Generator& g = *this; 00339 Generator tmp = g; 00340 tmp.strong_normalize(); 00341 if (tmp != g) { 00342 #ifndef NDEBUG 00343 std::cerr << "Generators should be strongly normalized!" 00344 << std::endl; 00345 #endif 00346 return false; 00347 } 00348 00349 switch (g.type()) { 00350 case LINE: 00351 // Intentionally fall through. 00352 case RAY: 00353 if (g[0] != 0) { 00354 #ifndef NDEBUG 00355 std::cerr << "Lines must have a zero inhomogeneous term!" 00356 << std::endl; 00357 #endif 00358 return false; 00359 } 00360 if (!g.is_necessarily_closed() && g[size() - 1] != 0) { 00361 #ifndef NDEBUG 00362 std::cerr << "Lines and rays must have a zero coefficient " 00363 << "for the epsilon dimension!" 00364 << std::endl; 00365 #endif 00366 return false; 00367 } 00368 // The following test is correct, since we already checked 00369 // that the epsilon coordinate is zero. 00370 if (g.all_homogeneous_terms_are_zero()) { 00371 #ifndef NDEBUG 00372 std::cerr << "The origin of the vector space cannot be a line or a ray!" 00373 << std::endl; 00374 #endif 00375 return false; 00376 } 00377 break; 00378 00379 case POINT: 00380 if (g[0] <= 0) { 00381 #ifndef NDEBUG 00382 std::cerr << "Points must have a positive divisor!" 00383 << std::endl; 00384 #endif 00385 return false; 00386 } 00387 if (!g.is_necessarily_closed()) 00388 if (g[size() - 1] <= 0) { 00389 #ifndef NDEBUG 00390 std::cerr << "In the NNC topology, points must have epsilon > 0" 00391 << std::endl; 00392 #endif 00393 return false; 00394 } 00395 break; 00396 00397 case CLOSURE_POINT: 00398 if (g[0] <= 0) { 00399 #ifndef NDEBUG 00400 std::cerr << "Closure points must have a positive divisor!" 00401 << std::endl; 00402 #endif 00403 return false; 00404 } 00405 break; 00406 } 00407 00408 // All tests passed. 00409 return true; 00410 }
| void Parma_Polyhedra_Library::Generator::swap | ( | Generator & | y | ) | [inline] |
Swaps *this with y.
Definition at line 208 of file Generator.inlines.hh.
References Parma_Polyhedra_Library::swap().
Referenced by swap().
00208 { 00209 Linear_Row::swap(y); 00210 }
| 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 35 of file Generator.cc.
References Parma_Polyhedra_Library::Variable::space_dimension(), and space_dimension().
Referenced by Parma_Polyhedra_Library::Grid_Generator::coefficient(), and coefficient().
00037 { 00038 std::ostringstream s; 00039 s << "PPL::Generator::" << method << ":" << std::endl 00040 << "this->space_dimension() == " << space_dimension() << ", " 00041 << name_var << ".space_dimension() == " << v.space_dimension() << "."; 00042 throw std::invalid_argument(s.str()); 00043 }
| 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 46 of file Generator.cc.
Referenced by divisor().
00047 { 00048 std::ostringstream s; 00049 s << "PPL::Generator::" << method << ":" << std::endl 00050 << reason << "."; 00051 throw std::invalid_argument(s.str()); 00052 }
| Parma_Polyhedra_Library::Generator::Parma_Polyhedra_Library::Linear_Expression::Linear_Expression | ( | const Generator & | g | ) | [private] |
| 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 73 of file Generator.inlines.hh.
References Parma_Polyhedra_Library::Linear_Row::is_ray_or_point_or_inequality().
Referenced by divisor(), and is_ray().
00073 { 00074 return is_ray_or_point_or_inequality(); 00075 }
| 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 113 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(), and Parma_Polyhedra_Library::Grid_Generator::set_is_line().
00113 { 00114 set_is_line_or_equality(); 00115 }
| 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 118 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::ascii_load(), Parma_Polyhedra_Library::Grid_Generator::coefficient_swap(), and Parma_Polyhedra_Library::Grid_Generator::set_is_parameter_or_point().
00118 { 00119 set_is_ray_or_point_or_inequality(); 00120 }
| 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 275 of file Generator.cc.
References CLOSURE_POINT, Parma_Polyhedra_Library::exact_div_assign(), Parma_Polyhedra_Library::gcd_assign(), POINT, space_dimension(), TEMP_INTEGER, 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().
00275 { 00276 assert(topology() == p.topology() 00277 && space_dimension() == p.space_dimension() 00278 && type() == CLOSURE_POINT 00279 && p.type() == POINT); 00280 const Generator& cp = *this; 00281 if (cp[0] == p[0]) { 00282 // Divisors are equal: we can simply compare coefficients 00283 // (disregarding the epsilon coefficient). 00284 for (dimension_type i = cp.size() - 2; i > 0; --i) 00285 if (cp[i] != p[i]) 00286 return false; 00287 return true; 00288 } 00289 else { 00290 // Divisors are different: divide them by their GCD 00291 // to simplify the following computation. 00292 TEMP_INTEGER(gcd); 00293 gcd_assign(gcd, cp[0], p[0]); 00294 const bool rel_prime = (gcd == 1); 00295 TEMP_INTEGER(cp_0_scaled); 00296 TEMP_INTEGER(p_0_scaled); 00297 if (!rel_prime) { 00298 exact_div_assign(cp_0_scaled, cp[0], gcd); 00299 exact_div_assign(p_0_scaled, p[0], gcd); 00300 } 00301 const Coefficient& cp_div = rel_prime ? cp[0] : cp_0_scaled; 00302 const Coefficient& p_div = rel_prime ? p[0] : p_0_scaled; 00303 TEMP_INTEGER(prod1); 00304 TEMP_INTEGER(prod2); 00305 for (dimension_type i = cp.size() - 2; i > 0; --i) { 00306 prod1 = cp[i] * p_div; 00307 prod2 = p[i] * cp_div; 00308 if (prod1 != prod2) 00309 return false; 00310 } 00311 return true; 00312 } 00313 }
friend class Parma_Polyhedra_Library::Scalar_Products [friend] |
Definition at line 432 of file Generator.defs.hh.
friend class Parma_Polyhedra_Library::Topology_Adjusted_Scalar_Product_Sign [friend] |
Definition at line 433 of file Generator.defs.hh.
friend class Parma_Polyhedra_Library::Topology_Adjusted_Scalar_Product_Assign [friend] |
Definition at line 434 of file Generator.defs.hh.
friend class Parma_Polyhedra_Library::Generator_System [friend] |
Definition at line 435 of file Generator.defs.hh.
friend class Parma_Polyhedra_Library::Generator_System::const_iterator [friend] |
Definition at line 436 of file Generator.defs.hh.
friend class Parma_Polyhedra_Library::Polyhedron [friend] |
Definition at line 438 of file Generator.defs.hh.
friend class Parma_Polyhedra_Library::Grid_Generator [friend] |
Definition at line 439 of file Generator.defs.hh.
friend class Parma_Polyhedra_Library::Grid_Generator_System [friend] |
Definition at line 441 of file Generator.defs.hh.
| std::ostream & operator<< | ( | std::ostream & | s, | |
| const Generator & | g | |||
| ) | [friend] |
Output operator.
Definition at line 187 of file Generator.cc.
00187 { 00188 bool needed_divisor = false; 00189 bool extra_parentheses = false; 00190 const dimension_type num_variables = g.space_dimension(); 00191 Generator::Type t = g.type(); 00192 switch (t) { 00193 case Generator::LINE: 00194 s << "l("; 00195 break; 00196 case Generator::RAY: 00197 s << "r("; 00198 break; 00199 case Generator::POINT: 00200 s << "p("; 00201 goto any_point; 00202 case Generator::CLOSURE_POINT: 00203 s << "c("; 00204 any_point: 00205 if (g[0] != 1) { 00206 needed_divisor = true; 00207 dimension_type num_non_zero_coefficients = 0; 00208 for (dimension_type v = 0; v < num_variables; ++v) 00209 if (g[v+1] != 0) 00210 if (++num_non_zero_coefficients > 1) { 00211 extra_parentheses = true; 00212 s << "("; 00213 break; 00214 } 00215 } 00216 break; 00217 } 00218 00219 TEMP_INTEGER(gv); 00220 bool first = true; 00221 for (dimension_type v = 0; v < num_variables; ++v) { 00222 gv = g[v+1]; 00223 if (gv != 0) { 00224 if (!first) { 00225 if (gv > 0) 00226 s << " + "; 00227 else { 00228 s << " - "; 00229 neg_assign(gv); 00230 } 00231 } 00232 else 00233 first = false; 00234 if (gv == -1) 00235 s << "-"; 00236 else if (gv != 1) 00237 s << gv << "*"; 00238 s << PPL::Variable(v); 00239 } 00240 } 00241 if (first) 00242 // A point or closure point in the origin. 00243 s << 0; 00244 if (extra_parentheses) 00245 s << ")"; 00246 if (needed_divisor) 00247 s << "/" << g[0]; 00248 s << ")"; 00249 return s; 00250 }
| void swap | ( | Parma_Polyhedra_Library::Generator & | x, | |
| Parma_Polyhedra_Library::Generator & | y | |||
| ) | [related] |
Specializes std::swap.
Definition at line 392 of file Generator.inlines.hh.
References swap().
00393 { 00394 x.swap(y); 00395 }
Returns true if and only if x is equivalent to y.
Definition at line 187 of file Generator.inlines.hh.
References is_equivalent_to().
Returns true if and only if x is not equivalent to y.
Definition at line 193 of file Generator.inlines.hh.
References is_equivalent_to().
| 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.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.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 289 of file Generator.inlines.hh.
00292 { 00293 typedef Checked_Number<Temp, Extended_Number_Policy> Checked_Temp; 00294 DIRTY_TEMP(Checked_Temp, tmp0); 00295 DIRTY_TEMP(Checked_Temp, tmp1); 00296 DIRTY_TEMP(Checked_Temp, tmp2); 00297 return rectilinear_distance_assign(r, x, y, dir, tmp0, tmp1, tmp2); 00298 }
| 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 275 of file Generator.inlines.hh.
00281 { 00282 return l_m_distance_assign<Rectilinear_Distance_Specialization<Temp> > 00283 (r, x, y, dir, tmp0, tmp1, tmp2); 00284 }
| 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 327 of file Generator.inlines.hh.
00330 { 00331 typedef Checked_Number<Temp, Extended_Number_Policy> Checked_Temp; 00332 DIRTY_TEMP(Checked_Temp, tmp0); 00333 DIRTY_TEMP(Checked_Temp, tmp1); 00334 DIRTY_TEMP(Checked_Temp, tmp2); 00335 return euclidean_distance_assign(r, x, y, dir, tmp0, tmp1, tmp2); 00336 }
| 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 313 of file Generator.inlines.hh.
00319 { 00320 return l_m_distance_assign<Euclidean_Distance_Specialization<Temp> > 00321 (r, x, y, dir, tmp0, tmp1, tmp2); 00322 }
| 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.
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 365 of file Generator.inlines.hh.
00368 { 00369 typedef Checked_Number<Temp, Extended_Number_Policy> Checked_Temp; 00370 DIRTY_TEMP(Checked_Temp, tmp0); 00371 DIRTY_TEMP(Checked_Temp, tmp1); 00372 DIRTY_TEMP(Checked_Temp, tmp2); 00373 return l_infinity_distance_assign(r, x, y, dir, tmp0, tmp1, tmp2); 00374 }
| 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 351 of file Generator.inlines.hh.
00357 { 00358 return l_m_distance_assign<L_Infinity_Distance_Specialization<Temp> > 00359 (r, x, y, dir, tmp0, tmp1, tmp2); 00360 }
| std::ostream & operator<< | ( | std::ostream & | s, | |
| const Generator::Type & | t | |||
| ) | [related] |
Output operator.
Definition at line 254 of file Generator.cc.
References CLOSURE_POINT, LINE, POINT, and RAY.
00254 { 00255 const char* n = 0; 00256 switch (t) { 00257 case Generator::LINE: 00258 n = "LINE"; 00259 break; 00260 case Generator::RAY: 00261 n = "RAY"; 00262 break; 00263 case Generator::POINT: 00264 n = "POINT"; 00265 break; 00266 case Generator::CLOSURE_POINT: 00267 n = "CLOSURE_POINT"; 00268 break; 00269 } 00270 s << n; 00271 return s; 00272 }
| 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 217 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().
00223 { 00224 // Generator kind compatibility check: we only compute distances 00225 // between (closure) points. 00226 if (x.is_line_or_ray() || y.is_line_or_ray()) 00227 return false; 00228 const dimension_type x_space_dim = x.space_dimension(); 00229 // Dimension-compatibility check. 00230 if (x_space_dim != y.space_dimension()) 00231 return false; 00232 00233 // All zero-dim generators have distance zero. 00234 if (x_space_dim == 0) { 00235 assign_r(r, 0, ROUND_NOT_NEEDED); 00236 return true; 00237 } 00238 00239 DIRTY_TEMP0(mpq_class, x_coord); 00240 DIRTY_TEMP0(mpq_class, y_coord); 00241 DIRTY_TEMP0(mpq_class, x_div); 00242 DIRTY_TEMP0(mpq_class, y_div); 00243 assign_r(x_div, x.divisor(), ROUND_NOT_NEEDED); 00244 assign_r(y_div, y.divisor(), ROUND_NOT_NEEDED); 00245 00246 assign_r(tmp0, 0, ROUND_NOT_NEEDED); 00247 for (dimension_type i = x_space_dim; i-- > 0; ) { 00248 assign_r(x_coord, x.coefficient(Variable(i)), ROUND_NOT_NEEDED); 00249 div_assign_r(x_coord, x_coord, x_div, ROUND_NOT_NEEDED); 00250 assign_r(y_coord, y.coefficient(Variable(i)), ROUND_NOT_NEEDED); 00251 div_assign_r(y_coord, y_coord, y_div, ROUND_NOT_NEEDED); 00252 const Temp* tmp1p; 00253 const Temp* tmp2p; 00254 00255 if (x_coord > y_coord) { 00256 maybe_assign(tmp1p, tmp1, x_coord, dir); 00257 maybe_assign(tmp2p, tmp2, y_coord, inverse(dir)); 00258 } 00259 else { 00260 maybe_assign(tmp1p, tmp1, y_coord, dir); 00261 maybe_assign(tmp2p, tmp2, x_coord, inverse(dir)); 00262 } 00263 sub_assign_r(tmp1, *tmp1p, *tmp2p, dir); 00264 assert(sgn(tmp1) >= 0); 00265 Specialization::combine(tmp0, tmp1, dir); 00266 } 00267 Specialization::finalize(tmp0, dir); 00268 assign_r(r, tmp0, dir); 00269 return true; 00270 }
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 402 of file Generator.defs.hh.
Referenced by finalize(), initialize(), and zero_dim_point().
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 408 of file Generator.defs.hh.
Referenced by finalize(), initialize(), and zero_dim_closure_point().
1.5.6