A grid line, parameter or grid point. More...
#include <Grid_Generator.defs.hh>


Public Types | |
| enum | Type { LINE, PARAMETER, POINT } |
The generator type. More... | |
Public Member Functions | |
| Grid_Generator (const Grid_Generator &g) | |
| Ordinary copy constructor. | |
| ~Grid_Generator () | |
| Destructor. | |
| Grid_Generator & | operator= (const Grid_Generator &g) |
| Assignment operator. | |
| Grid_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_parameter () const |
Returns true if and only if *this is a parameter. | |
| bool | is_line_or_parameter () const |
Returns true if and only if *this is a line or a parameter. | |
| bool | is_point () const |
Returns true if and only if *this is a point. | |
| bool | is_parameter_or_point () const |
Returns true if and only if *this row represents a parameter or a point. | |
| Coefficient_traits::const_reference | coefficient (Variable v) const |
Returns the coefficient of v in *this. | |
| Coefficient_traits::const_reference | divisor () const |
Returns the divisor of *this. | |
| memory_size_type | total_memory_in_bytes () const |
Returns a lower bound to the total size in bytes of the memory occupied by *this. | |
| memory_size_type | external_memory_in_bytes () const |
Returns the size in bytes of the memory managed by *this. | |
| bool | is_equivalent_to (const Grid_Generator &y) const |
Returns true if and only if *this and y are equivalent generators. | |
| bool | is_equal_to (const Grid_Generator &y) const |
Returns true if *this is exactly equal to y. | |
| bool | is_equal_at_dimension (dimension_type dim, const Grid_Generator &gg) const |
Returns true if *this is equal to gg in dimension dim. | |
| bool | all_homogeneous_terms_are_zero () const |
Returns true if and only if all the homogeneous terms of *this are . | |
| 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 (Grid_Generator &y) |
Swaps *this with y. | |
| void | coefficient_swap (Grid_Generator &y) |
Swaps *this with y, leaving *this with the original capacity. | |
Static Public Member Functions | |
| static Grid_Generator | grid_line (const Linear_Expression &e) |
Returns the line of direction e. | |
| static Grid_Generator | parameter (const Linear_Expression &e=Linear_Expression::zero(), Coefficient_traits::const_reference d=Coefficient_one()) |
Returns the parameter of direction e and size e/d. | |
| static Grid_Generator | grid_point (const Linear_Expression &e=Linear_Expression::zero(), Coefficient_traits::const_reference d=Coefficient_one()) |
Returns the point at e / d. | |
| static dimension_type | max_space_dimension () |
| Returns the maximum space dimension a Grid_Generator can handle. | |
| static void | initialize () |
| Initializes the class. | |
| static void | finalize () |
| Finalizes the class. | |
| static const Grid_Generator & | zero_dim_point () |
Returns the origin of the zero-dimensional space . | |
Private Member Functions | |
| void | scale_to_divisor (Coefficient_traits::const_reference d) |
Scales *this to be represented with a divisor of d (if \*this is a parameter or point). | |
| Grid_Generator (Generator g) | |
Constructs from polyhedron generator g, stealing the underlying data structures from g. | |
| dimension_type | size () const |
Returns the actual size of this. | |
| void | negate (dimension_type start, dimension_type end) |
Negates the elements from index start to index end. | |
| void | set_divisor (Coefficient_traits::const_reference d) |
Sets the divisor of *this to d. | |
| void | set_is_line () |
Sets the Linear_Row kind to LINE_OR_EQUALITY. | |
| void | set_is_parameter_or_point () |
Sets the Linear_Row kind to RAY_OR_POINT_OR_INEQUALITY. | |
| void | set_is_parameter () |
| Converts the Grid_Generator into a parameter. | |
| void | strong_normalize () |
| Strong normalization: ensures that different Grid_Generator objects represent different hyperplanes or hyperspaces. | |
| Coefficient & | operator[] (dimension_type k) |
Returns a reference to the element of the row indexed by k. | |
| Coefficient_traits::const_reference | operator[] (dimension_type k) const |
Returns a constant reference to the element of the row indexed by k. | |
| void | throw_invalid_argument (const char *method, const char *reason) const |
Throw a std::invalid_argument exception containing the appropriate error message. | |
Static Private Attributes | |
| static const Grid_Generator * | zero_dim_point_p = 0 |
Holds (between class initialization and finalization) a pointer to the origin of the zero-dimensional space . | |
Friends | |
| class | Grid |
| class | Grid_Generator_System |
| class | Grid_Generator_System::const_iterator |
| class | Congruence_System |
| class | Scalar_Products |
| class | Topology_Adjusted_Scalar_Product_Sign |
| class | Linear_Expression |
| std::ostream & | IO_Operators::operator<< (std::ostream &s, const Grid_Generator &g) |
Related Functions | |
(Note that these are not member functions.) | |
| std::ostream & | operator<< (std::ostream &s, const Grid_Generator &g) |
| Output operator. | |
| void | swap (Parma_Polyhedra_Library::Grid_Generator &x, Parma_Polyhedra_Library::Grid_Generator &y) |
Specializes std::swap. | |
| bool | operator== (const Grid_Generator &x, const Grid_Generator &y) |
Returns true if and only if x is equivalent to y. | |
| bool | operator!= (const Grid_Generator &x, const Grid_Generator &y) |
Returns true if and only if x is not equivalent to y. | |
| std::ostream & | operator<< (std::ostream &s, const Grid_Generator::Type &t) |
| Output operator. | |
A grid line, parameter or grid point.
An object of the class Grid_Generator is one of the following:
;
;
;where
is the dimension of the space and, for grid_points and parameters,
is the divisor.
grid_line, parameter or grid_point) to a linear expression; 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 grid points and parameters, 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
: Grid_Generator l = grid_line(x - y - z);
Grid_Generator l = grid_line(0*x);
which has the same direction as the line in Example 1: Grid_Generator q = parameter(x - y - z);
q is not the same as the parameter q1 defined by Grid_Generator q1 = parameter(2x - 2y - 2z);
Grid_Generator q = parameter(0*x);
: Grid_Generator p = grid_point(1*x + 0*y + 2*z);
Grid_Generator p = grid_point(x + 2*z);
can be defined using either one of the following lines of code: Grid_Generator origin3 = grid_point(0*x + 0*y + 0*z); Grid_Generator origin3_alt = grid_point(0*z);
: Grid_Generator origin2 = grid_point(0*y);
. In the second case we exploit the fact that the first argument of the function point is optional. Grid_Generator origin0 = Generator::zero_dim_point(); Grid_Generator origin0_alt = grid_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 grid_point (the divisor): Grid_Generator p = grid_point(2*x + 0*y + 4*z, 2);
can be specified by the following code: Grid_Generator p1 = grid_point(-15*x + 32*y + 21*z, 10);
can be defined: Grid_Generator q = parameter(2*x + 0*y + 4*z, 2);
can be defined: Grid_Generator q = parameter(-15*x + 32*y + 21*z, 10);
g1 is a grid point having coordinates
, we construct the parameter g2 having coordinates
. if (g1.is_point()) { cout << "Grid 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); Grid_Generator g2 = parameter(e, g1.divisor()); cout << "Parameter g2: " << g2 << endl; } else cout << "Grid Generator g1 is not a grid point." << endl;
Grid_Generator g1 = grid_point(2*x - y + 3*z, 2);
Definition at line 228 of file Grid_Generator.defs.hh.
The generator type.
| LINE |
The generator is a grid line. |
| PARAMETER |
The generator is a parameter. |
| POINT |
The generator is a grid point. |
Reimplemented from Parma_Polyhedra_Library::Generator.
Definition at line 283 of file Grid_Generator.defs.hh.
| Parma_Polyhedra_Library::Grid_Generator::Grid_Generator | ( | const Grid_Generator & | g | ) | [inline] |
Ordinary copy constructor.
Definition at line 30 of file Grid_Generator.inlines.hh.
Referenced by initialize().
00031 : Generator(g) { 00032 }
| Parma_Polyhedra_Library::Grid_Generator::~Grid_Generator | ( | ) | [inline] |
| Parma_Polyhedra_Library::Grid_Generator::Grid_Generator | ( | Generator | g | ) | [inline, explicit, private] |
Constructs from polyhedron generator g, stealing the underlying data structures from g.
The last column in g becomes the parameter divisor column of the new Grid_Generator.
Definition at line 39 of file Grid_Generator.inlines.hh.
References swap().
00040 : Generator(Generator::point()) { 00041 Generator::swap(g); 00042 }
| bool Parma_Polyhedra_Library::Grid_Generator::all_homogeneous_terms_are_zero | ( | ) | const |
Returns true if and only if all the homogeneous terms of *this are
.
Reimplemented from Parma_Polyhedra_Library::Linear_Row.
Definition at line 241 of file Grid_Generator.cc.
References size().
Referenced by Parma_Polyhedra_Library::Grid_Generator_System::insert().
00241 { 00242 // Start at size() - 1 to avoid the extra grid generator column. 00243 for (dimension_type i = size() - 1; --i > 0; ) 00244 if (operator[](i) != 0) 00245 return false; 00246 return true; 00247 }
| void Parma_Polyhedra_Library::Grid_Generator::ascii_dump | ( | std::ostream & | s | ) | const |
Writes to s an ASCII representation of *this.
Reimplemented from Parma_Polyhedra_Library::Generator.
Definition at line 133 of file Grid_Generator.cc.
References Parma_Polyhedra_Library::Generator::LINE, Parma_Polyhedra_Library::Generator::POINT, Parma_Polyhedra_Library::Generator::RAY, size(), and type().
00133 { 00134 const Grid_Generator& x = *this; 00135 const dimension_type x_size = x.size(); 00136 s << "size " << x_size << " "; 00137 for (dimension_type i = 0; i < x_size; ++i) 00138 s << x[i] << ' '; 00139 switch (x.type()) { 00140 case Generator::LINE: 00141 s << "L"; 00142 break; 00143 case Generator::RAY: 00144 s << "Q"; 00145 break; 00146 case Generator::POINT: 00147 s << "P"; 00148 break; 00149 } 00150 s << "\n"; 00151 }
| void Parma_Polyhedra_Library::Grid_Generator::ascii_dump | ( | ) | const |
Writes to std::cerr an ASCII representation of *this.
Reimplemented from Parma_Polyhedra_Library::Generator.
| bool Parma_Polyhedra_Library::Grid_Generator::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.
Reimplemented from Parma_Polyhedra_Library::Generator.
Definition at line 156 of file Grid_Generator.cc.
References Parma_Polyhedra_Library::Row::shrink(), Parma_Polyhedra_Library::Row::size(), and Parma_Polyhedra_Library::Row::swap().
00156 { 00157 std::string str; 00158 if (!(s >> str) || str != "size") 00159 return false; 00160 dimension_type new_size; 00161 if (!(s >> new_size)) 00162 return false; 00163 00164 Row& x = *this; 00165 const dimension_type old_size = x.size(); 00166 if (new_size < old_size) 00167 x.shrink(new_size); 00168 else if (new_size > old_size) { 00169 Row y(new_size, Row::Flags()); 00170 x.swap(y); 00171 } 00172 00173 for (dimension_type col = 0; col < new_size; ++col) 00174 if (!(s >> x[col])) 00175 return false; 00176 00177 if (!(s >> str)) 00178 return false; 00179 if (str == "L") 00180 set_is_line(); 00181 else if (str == "P" || str == "Q") 00182 set_is_ray_or_point(); 00183 else 00184 return false; 00185 00186 return true; 00187 }
| Coefficient_traits::const_reference Parma_Polyhedra_Library::Grid_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 from Parma_Polyhedra_Library::Generator.
Definition at line 164 of file Grid_Generator.inlines.hh.
References space_dimension(), Parma_Polyhedra_Library::Variable::space_dimension(), and Parma_Polyhedra_Library::Generator::throw_dimension_incompatible().
Referenced by Parma_Polyhedra_Library::Grid::constrains(), Parma_Polyhedra_Library::Grid::map_space_dimensions(), Parma_Polyhedra_Library::Grid::max_min(), Parma_Polyhedra_Library::Grid::relation_with(), Parma_Polyhedra_Library::Grid::select_wider_generators(), and Parma_Polyhedra_Library::Grid::wrap_assign().
00164 { 00165 if (v.space_dimension() > space_dimension()) 00166 throw_dimension_incompatible("coefficient(v)", "v", v); 00167 return Generator::coefficient(v); 00168 }
| void Parma_Polyhedra_Library::Grid_Generator::coefficient_swap | ( | Grid_Generator & | y | ) |
Swaps *this with y, leaving *this with the original capacity.
All elements up to and including the last element of the smaller of *this and y are swapped. The parameter divisor element of y is swapped with the divisor element of *this.
Definition at line 114 of file Grid_Generator.cc.
References is_line(), set_is_line(), Parma_Polyhedra_Library::Generator::set_is_ray_or_point(), size(), Parma_Polyhedra_Library::swap(), and swap().
Referenced by Parma_Polyhedra_Library::Grid_Generator_System::recycling_insert().
00114 { 00115 // Swap one coefficient at a time into *this. Doing this instead of 00116 // swapping the entire row ensures that the row keeps the same 00117 // capacity. 00118 if (y.is_line()) 00119 set_is_line(); 00120 else 00121 set_is_ray_or_point(); 00122 PPL_ASSERT(size() > 0); 00123 PPL_ASSERT(y.size() > 0); 00124 dimension_type sz = size() - 1; 00125 dimension_type y_sz = y.size() - 1; 00126 // Swap parameter divisors. 00127 std::swap(operator[](sz), y[y_sz]); 00128 for (dimension_type j = (sz > y_sz ? y_sz : sz); j-- > 0; ) 00129 std::swap(operator[](j), y[j]); 00130 }
| Coefficient_traits::const_reference Parma_Polyhedra_Library::Grid_Generator::divisor | ( | ) | const [inline] |
Returns the divisor of *this.
| std::invalid_argument | Thrown if *this is a line. |
Reimplemented from Parma_Polyhedra_Library::Generator.
Definition at line 120 of file Grid_Generator.inlines.hh.
References is_line(), is_line_or_parameter(), operator[](), size(), and throw_invalid_argument().
Referenced by Parma_Polyhedra_Library::Grid::frequency_no_check(), Parma_Polyhedra_Library::Grid::Grid(), is_equal_at_dimension(), Parma_Polyhedra_Library::Grid::map_space_dimensions(), Parma_Polyhedra_Library::Grid::max_min(), Parma_Polyhedra_Library::Grid::normalize_divisors(), OK(), operator<<(), Parma_Polyhedra_Library::Congruence_System::satisfies_all_congruences(), scale_to_divisor(), Parma_Polyhedra_Library::Grid::simplify_using_context_assign(), and Parma_Polyhedra_Library::Grid::wrap_assign().
00120 { 00121 if (is_line()) 00122 throw_invalid_argument("divisor()", "*this is a line"); 00123 if (is_line_or_parameter()) 00124 return Generator::operator[](size() - 1); 00125 else 00126 return Generator::operator[](0); 00127 }
| memory_size_type Parma_Polyhedra_Library::Grid_Generator::external_memory_in_bytes | ( | ) | const [inline] |
Returns the size in bytes of the memory managed by *this.
Reimplemented from Parma_Polyhedra_Library::Generator.
Definition at line 176 of file Grid_Generator.inlines.hh.
00176 { 00177 return Generator::external_memory_in_bytes(); 00178 }
| void Parma_Polyhedra_Library::Grid_Generator::finalize | ( | ) | [static] |
Finalizes the class.
Reimplemented from Parma_Polyhedra_Library::Generator.
Definition at line 276 of file Grid_Generator.cc.
References zero_dim_point_p.
00276 { 00277 PPL_ASSERT(zero_dim_point_p != 0); 00278 delete zero_dim_point_p; 00279 zero_dim_point_p = 0; 00280 }
| PPL::Grid_Generator Parma_Polyhedra_Library::Grid_Generator::grid_line | ( | const Linear_Expression & | e | ) | [inline, static] |
Returns the line of direction e.
Shorthand for Grid_Generator Grid_Generator::grid_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 210 of file Grid_Generator.inlines.hh.
00210 { 00211 return Grid_Generator::grid_line(e); 00212 }
| PPL::Grid_Generator Parma_Polyhedra_Library::Grid_Generator::grid_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 Grid_Generator Grid_Generator::grid_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 223 of file Grid_Generator.inlines.hh.
Referenced by initialize().
00224 { 00225 return Grid_Generator::grid_point(e, d); 00226 }
| void Parma_Polyhedra_Library::Grid_Generator::initialize | ( | ) | [static] |
Initializes the class.
Reimplemented from Parma_Polyhedra_Library::Generator.
Definition at line 269 of file Grid_Generator.cc.
References Grid_Generator(), grid_point(), and zero_dim_point_p.
00269 { 00270 PPL_ASSERT(zero_dim_point_p == 0); 00271 zero_dim_point_p 00272 = new Grid_Generator(grid_point()); 00273 }
| bool Parma_Polyhedra_Library::Grid_Generator::is_equal_at_dimension | ( | dimension_type | dim, | |
| const Grid_Generator & | gg | |||
| ) | const [inline] |
Returns true if *this is equal to gg in dimension dim.
Definition at line 130 of file Grid_Generator.inlines.hh.
References divisor(), and operator[]().
Referenced by Parma_Polyhedra_Library::Grid::select_wider_generators().
00131 { 00132 return operator[](dim) * gg.divisor() == gg[dim] * divisor(); 00133 }
| bool Parma_Polyhedra_Library::Grid_Generator::is_equal_to | ( | const Grid_Generator & | y | ) | const |
Returns true if *this is exactly equal to y.
Definition at line 230 of file Grid_Generator.cc.
References is_parameter(), size(), and type().
Referenced by Parma_Polyhedra_Library::Grid::OK().
00230 { 00231 if (type() != y.type()) 00232 return false; 00233 for (dimension_type col = (is_parameter() ? size() : size() - 1); 00234 col-- > 0; ) 00235 if (Generator::operator[](col) != y.Generator::operator[](col)) 00236 return false; 00237 return true; 00238 }
| bool Parma_Polyhedra_Library::Grid_Generator::is_equivalent_to | ( | const Grid_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 201 of file Grid_Generator.cc.
References LINE, POINT, space_dimension(), and type().
Referenced by operator==().
00201 { 00202 const Grid_Generator& x = *this; 00203 dimension_type x_space_dim = x.space_dimension(); 00204 if (x_space_dim != y.space_dimension()) 00205 return false; 00206 00207 const Type x_type = x.type(); 00208 if (x_type != y.type()) 00209 return false; 00210 00211 Grid_Generator tmp = *this; 00212 Grid_Generator tmp_y = y; 00213 dimension_type& last = x_space_dim; 00214 ++last; 00215 if (x_type == POINT || x_type == LINE) { 00216 tmp[last] = 0; 00217 tmp_y[last] = 0; 00218 } 00219 // Normalize the copies, including the divisor column. 00220 tmp.Row::normalize(); 00221 tmp_y.Row::normalize(); 00222 // Check for equality. 00223 while (last-- > 0) 00224 if (tmp[last] != tmp_y[last]) 00225 return false; 00226 return true; 00227 }
| bool Parma_Polyhedra_Library::Grid_Generator::is_line | ( | ) | const [inline] |
Returns true if and only if *this is a line.
Reimplemented from Parma_Polyhedra_Library::Generator.
Definition at line 86 of file Grid_Generator.inlines.hh.
Referenced by coefficient_swap(), Parma_Polyhedra_Library::Grid::constrains(), divisor(), Parma_Polyhedra_Library::Grid::frequency_no_check(), Parma_Polyhedra_Library::Grid::multiply_grid(), Parma_Polyhedra_Library::Congruence_System::satisfies_all_congruences(), set_divisor(), set_is_parameter(), and Parma_Polyhedra_Library::Grid::simplify().
00086 { 00087 return Generator::is_line(); 00088 }
| bool Parma_Polyhedra_Library::Grid_Generator::is_line_or_parameter | ( | ) | const [inline] |
Returns true if and only if *this is a line or a parameter.
Definition at line 96 of file Grid_Generator.inlines.hh.
References Parma_Polyhedra_Library::Generator::is_line_or_ray().
Referenced by Parma_Polyhedra_Library::Grid::add_grid_generator(), Parma_Polyhedra_Library::Grid::bounds_no_check(), divisor(), Parma_Polyhedra_Library::Grid::is_bounded(), Parma_Polyhedra_Library::Grid::relation_with(), set_divisor(), and set_is_parameter().
00096 { 00097 return is_line_or_ray(); 00098 }
| bool Parma_Polyhedra_Library::Grid_Generator::is_parameter | ( | ) | const [inline] |
Returns true if and only if *this is a parameter.
Definition at line 91 of file Grid_Generator.inlines.hh.
References Parma_Polyhedra_Library::Generator::is_ray().
Referenced by Parma_Polyhedra_Library::Grid::add_grid_generator(), Parma_Polyhedra_Library::Grid::frequency_no_check(), Parma_Polyhedra_Library::Grid_Generator_System::insert(), is_equal_to(), and Parma_Polyhedra_Library::Grid::simplify_using_context_assign().
00091 { 00092 return is_ray(); 00093 }
| bool Parma_Polyhedra_Library::Grid_Generator::is_parameter_or_point | ( | ) | const [inline] |
Returns true if and only if *this row represents a parameter or a point.
Definition at line 106 of file Grid_Generator.inlines.hh.
References Parma_Polyhedra_Library::Linear_Row::is_ray_or_point_or_inequality().
Referenced by Parma_Polyhedra_Library::Grid::add_grid_generator(), Parma_Polyhedra_Library::Grid::multiply_grid(), Parma_Polyhedra_Library::Grid::normalize_divisors(), Parma_Polyhedra_Library::Grid::reduce_parameter_with_line(), scale_to_divisor(), and Parma_Polyhedra_Library::Grid::simplify().
00106 { 00107 return is_ray_or_point_or_inequality(); 00108 }
| bool Parma_Polyhedra_Library::Grid_Generator::is_point | ( | ) | const [inline] |
Returns true if and only if *this is a point.
Reimplemented from Parma_Polyhedra_Library::Generator.
Definition at line 101 of file Grid_Generator.inlines.hh.
Referenced by Parma_Polyhedra_Library::Grid::frequency_no_check(), Parma_Polyhedra_Library::Grid::simplify_using_context_assign(), and Parma_Polyhedra_Library::Grid::time_elapse_assign().
00101 { 00102 return Generator::is_point(); 00103 }
| dimension_type Parma_Polyhedra_Library::Grid_Generator::max_space_dimension | ( | ) | [inline, static] |
Returns the maximum space dimension a Grid_Generator can handle.
Reimplemented from Parma_Polyhedra_Library::Generator.
Definition at line 50 of file Grid_Generator.inlines.hh.
00050 { 00051 return Generator::max_space_dimension() - 1; 00052 }
| void Parma_Polyhedra_Library::Grid_Generator::negate | ( | dimension_type | start, | |
| dimension_type | end | |||
| ) | [inline, private] |
Negates the elements from index start to index end.
Definition at line 158 of file Grid_Generator.inlines.hh.
References Parma_Polyhedra_Library::neg_assign().
Referenced by Parma_Polyhedra_Library::Grid::simplify().
00158 { 00159 while (start <= end) 00160 neg_assign(operator[](start++)); 00161 }
| bool Parma_Polyhedra_Library::Grid_Generator::OK | ( | ) | const |
Checks if all the invariants are satisfied.
Reimplemented from Parma_Polyhedra_Library::Generator.
Definition at line 369 of file Grid_Generator.cc.
References divisor(), Parma_Polyhedra_Library::Linear_Row::is_necessarily_closed(), LINE, PARAMETER, POINT, size(), and type().
00369 { 00370 if (!is_necessarily_closed()) { 00371 #ifndef NDEBUG 00372 std::cerr << "Grid_Generator should be necessarily closed." 00373 << std::endl; 00374 #endif 00375 return false; 00376 } 00377 00378 // Topology consistency check. 00379 if (size() < 1) { 00380 #ifndef NDEBUG 00381 std::cerr << "Grid_Generator has fewer coefficients than the minimum " 00382 << "allowed:" << std::endl 00383 << "size is " << size() << ", minimum is 1." << std::endl; 00384 #endif 00385 return false; 00386 } 00387 00388 switch (type()) { 00389 case Grid_Generator::LINE: 00390 if (operator[](0) != 0) { 00391 #ifndef NDEBUG 00392 std::cerr << "Inhomogeneous terms of lines must be zero!" 00393 << std::endl; 00394 #endif 00395 return false; 00396 } 00397 break; 00398 00399 case Grid_Generator::PARAMETER: 00400 if (operator[](0) != 0) { 00401 #ifndef NDEBUG 00402 std::cerr << "Inhomogeneous terms of parameters must be zero!" 00403 << std::endl; 00404 #endif 00405 return false; 00406 } 00407 // Fall through. 00408 00409 case Grid_Generator::POINT: 00410 if (divisor() <= 0) { 00411 #ifndef NDEBUG 00412 std::cerr << "Points and parameters must have positive divisors!" 00413 << std::endl; 00414 #endif 00415 return false; 00416 } 00417 break; 00418 00419 } 00420 00421 // All tests passed. 00422 return true; 00423 }
| Grid_Generator & Parma_Polyhedra_Library::Grid_Generator::operator= | ( | const Generator & | g | ) | [inline] |
Assignment operator.
Reimplemented from Parma_Polyhedra_Library::Generator.
Definition at line 152 of file Grid_Generator.inlines.hh.
References operator=().
00152 { 00153 Generator::operator=(g); 00154 return *this; 00155 }
| Grid_Generator & Parma_Polyhedra_Library::Grid_Generator::operator= | ( | const Grid_Generator & | g | ) | [inline] |
Assignment operator.
Definition at line 146 of file Grid_Generator.inlines.hh.
Referenced by operator=().
00146 { 00147 Generator::operator=(g); 00148 return *this; 00149 }
| Coefficient_traits::const_reference Parma_Polyhedra_Library::Grid_Generator::operator[] | ( | dimension_type | k | ) | const [inline, private] |
Returns a constant reference to the element of the row indexed by k.
Reimplemented from Parma_Polyhedra_Library::Row.
Definition at line 60 of file Grid_Generator.inlines.hh.
References operator[]().
00060 { 00061 return Generator::operator[](k); 00062 }
| Coefficient & Parma_Polyhedra_Library::Grid_Generator::operator[] | ( | dimension_type | k | ) | [inline, private] |
Returns a reference to the element of the row indexed by k.
Reimplemented from Parma_Polyhedra_Library::Row.
Definition at line 55 of file Grid_Generator.inlines.hh.
Referenced by divisor(), is_equal_at_dimension(), operator[](), set_divisor(), and set_is_parameter().
00055 { 00056 return Generator::operator[](k); 00057 }
| PPL::Grid_Generator Parma_Polyhedra_Library::Grid_Generator::parameter | ( | const Linear_Expression & | e = Linear_Expression::zero(), |
|
| Coefficient_traits::const_reference | d = Coefficient_one() | |||
| ) | [inline, static] |
Returns the parameter of direction e and size e/d.
Shorthand for Grid_Generator Grid_Generator::parameter(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 216 of file Grid_Generator.inlines.hh.
00217 { 00218 return Grid_Generator::parameter(e, d); 00219 }
| void Parma_Polyhedra_Library::Grid_Generator::print | ( | ) | const |
Prints *this to std::cerr using operator<<.
Reimplemented from Parma_Polyhedra_Library::Generator.
| void Parma_Polyhedra_Library::Grid_Generator::scale_to_divisor | ( | Coefficient_traits::const_reference | d | ) | [private] |
Scales *this to be represented with a divisor of d (if \*this is a parameter or point).
It is assumed that d is a multiple of the current divisor.
| std::invalid_argument | Thrown if d is zero. |
Definition at line 250 of file Grid_Generator.cc.
References divisor(), Parma_Polyhedra_Library::exact_div_assign(), is_parameter_or_point(), PPL_DIRTY_TEMP_COEFFICIENT, set_divisor(), and size().
Referenced by Parma_Polyhedra_Library::Grid::Grid().
00250 { 00251 if (is_parameter_or_point()) { 00252 if (d == 0) 00253 throw std::invalid_argument("PPL::Grid_Generator::scale_to_divisor(d):\n" 00254 "d == 0."); 00255 00256 PPL_DIRTY_TEMP_COEFFICIENT(factor); 00257 exact_div_assign(factor, d, divisor()); 00258 set_divisor(d); 00259 PPL_ASSERT(factor > 0); 00260 if (factor > 1) 00261 for (dimension_type col = size() - 2; col >= 1; --col) 00262 Generator::operator[](col) *= factor; 00263 } 00264 }
| void Parma_Polyhedra_Library::Grid_Generator::set_divisor | ( | Coefficient_traits::const_reference | d | ) | [inline, private] |
Sets the divisor of *this to d.
| std::invalid_argument | Thrown if *this is a line. |
Definition at line 111 of file Grid_Generator.inlines.hh.
References is_line(), is_line_or_parameter(), operator[](), and size().
Referenced by scale_to_divisor().
00111 { 00112 PPL_ASSERT(!is_line()); 00113 if (is_line_or_parameter()) 00114 Generator::operator[](size() - 1) = d; 00115 else 00116 Generator::operator[](0) = d; 00117 }
| void Parma_Polyhedra_Library::Grid_Generator::set_is_line | ( | ) | [inline, private] |
Sets the Linear_Row kind to LINE_OR_EQUALITY.
Reimplemented from Parma_Polyhedra_Library::Generator.
Definition at line 136 of file Grid_Generator.inlines.hh.
Referenced by coefficient_swap(), and Parma_Polyhedra_Library::Grid::conversion().
00136 { 00137 Generator::set_is_line(); 00138 }
| void Parma_Polyhedra_Library::Grid_Generator::set_is_parameter | ( | ) | [private] |
Converts the Grid_Generator into a parameter.
Definition at line 190 of file Grid_Generator.cc.
References is_line(), is_line_or_parameter(), operator[](), set_is_parameter_or_point(), and size().
Referenced by Parma_Polyhedra_Library::Grid::relation_with(), and Parma_Polyhedra_Library::Grid::time_elapse_assign().
00190 { 00191 if (is_line()) 00192 set_is_parameter_or_point(); 00193 else if (!is_line_or_parameter()) { 00194 // The generator is a point. 00195 Generator::operator[](size() - 1) = Generator::operator[](0); 00196 Generator::operator[](0) = 0; 00197 } 00198 }
| void Parma_Polyhedra_Library::Grid_Generator::set_is_parameter_or_point | ( | ) | [inline, private] |
Sets the Linear_Row kind to RAY_OR_POINT_OR_INEQUALITY.
Definition at line 141 of file Grid_Generator.inlines.hh.
References Parma_Polyhedra_Library::Generator::set_is_ray_or_point().
Referenced by Parma_Polyhedra_Library::Grid::conversion(), and set_is_parameter().
00141 { 00142 Generator::set_is_ray_or_point(); 00143 }
| dimension_type Parma_Polyhedra_Library::Grid_Generator::size | ( | ) | const [inline, private] |
Returns the actual size of this.
Reimplemented from Parma_Polyhedra_Library::Row.
Definition at line 45 of file Grid_Generator.inlines.hh.
Referenced by all_homogeneous_terms_are_zero(), ascii_dump(), Parma_Polyhedra_Library::Scalar_Products::assign(), coefficient_swap(), divisor(), Parma_Polyhedra_Library::Scalar_Products::homogeneous_assign(), Parma_Polyhedra_Library::Grid_Generator_System::insert(), is_equal_to(), Parma_Polyhedra_Library::Grid::OK(), OK(), Parma_Polyhedra_Library::Grid_Generator_System::recycling_insert(), Parma_Polyhedra_Library::Grid::reduce_line_with_line(), Parma_Polyhedra_Library::Scalar_Products::reduced_assign(), Parma_Polyhedra_Library::Grid::relation_with(), scale_to_divisor(), set_divisor(), and set_is_parameter().
00045 { 00046 return Generator::size(); 00047 }
| dimension_type Parma_Polyhedra_Library::Grid_Generator::space_dimension | ( | ) | const [inline] |
Returns the dimension of the vector space enclosing *this.
Reimplemented from Parma_Polyhedra_Library::Generator.
Definition at line 65 of file Grid_Generator.inlines.hh.
Referenced by Parma_Polyhedra_Library::Grid::add_grid_generator(), coefficient(), Parma_Polyhedra_Library::Grid_Generator_System::insert(), is_equivalent_to(), operator<<(), Parma_Polyhedra_Library::Grid::relation_with(), Parma_Polyhedra_Library::Congruence_System::satisfies_all_congruences(), Parma_Polyhedra_Library::Grid::select_wider_generators(), and Parma_Polyhedra_Library::Grid::throw_dimension_incompatible().
00065 { 00066 return Generator::space_dimension() - 1; 00067 }
| void Parma_Polyhedra_Library::Grid_Generator::strong_normalize | ( | ) | [inline, private] |
Strong normalization: ensures that different Grid_Generator objects represent different hyperplanes or hyperspaces.
Applies both Linear_Row::normalize() and Linear_Row::sign_normalize().
This is simply a wrapper around the Generator::strong_normalize, which means applying it to a parameter may change the parameter.
Reimplemented from Parma_Polyhedra_Library::Linear_Row.
Definition at line 187 of file Grid_Generator.inlines.hh.
00187 { 00188 Generator::strong_normalize(); 00189 }
| void Parma_Polyhedra_Library::Grid_Generator::swap | ( | Grid_Generator & | y | ) | [inline] |
Swaps *this with y.
Definition at line 192 of file Grid_Generator.inlines.hh.
Referenced by coefficient_swap(), Grid_Generator(), and swap().
00192 { 00193 Generator::swap(y); 00194 }
| void Parma_Polyhedra_Library::Grid_Generator::throw_invalid_argument | ( | const char * | method, | |
| const char * | reason | |||
| ) | const [private] |
Throw a std::invalid_argument exception containing the appropriate error message.
Reimplemented from Parma_Polyhedra_Library::Generator.
Definition at line 33 of file Grid_Generator.cc.
Referenced by divisor().
| memory_size_type Parma_Polyhedra_Library::Grid_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::Generator.
Definition at line 171 of file Grid_Generator.inlines.hh.
00171 { 00172 return Generator::total_memory_in_bytes(); 00173 }
| Grid_Generator::Type Parma_Polyhedra_Library::Grid_Generator::type | ( | ) | const [inline] |
Returns the generator type of *this.
Reimplemented from Parma_Polyhedra_Library::Generator.
Definition at line 70 of file Grid_Generator.inlines.hh.
References Parma_Polyhedra_Library::Generator::CLOSURE_POINT, LINE, Parma_Polyhedra_Library::Generator::LINE, PARAMETER, POINT, Parma_Polyhedra_Library::Generator::POINT, Parma_Polyhedra_Library::Generator::RAY, and Parma_Polyhedra_Library::Generator::type().
Referenced by ascii_dump(), is_equal_to(), is_equivalent_to(), Parma_Polyhedra_Library::Grid::map_space_dimensions(), OK(), and operator<<().
00070 { 00071 switch (Generator::type()) { 00072 case Generator::POINT: 00073 return POINT; 00074 case Generator::RAY: 00075 return PARAMETER; 00076 case Generator::LINE: 00077 return LINE; 00078 case Generator::CLOSURE_POINT: 00079 default: 00080 PPL_ASSERT(false); 00081 return POINT; 00082 } 00083 }
| const Grid_Generator & Parma_Polyhedra_Library::Grid_Generator::zero_dim_point | ( | ) | [inline, static] |
Returns the origin of the zero-dimensional space
.
Reimplemented from Parma_Polyhedra_Library::Generator.
Definition at line 181 of file Grid_Generator.inlines.hh.
References zero_dim_point_p.
Referenced by Parma_Polyhedra_Library::Grid_Generator_System::initialize().
00181 { 00182 PPL_ASSERT(zero_dim_point_p != 0); 00183 return *zero_dim_point_p; 00184 }
friend class Congruence_System [friend] |
Definition at line 479 of file Grid_Generator.defs.hh.
friend class Grid [friend] |
Definition at line 476 of file Grid_Generator.defs.hh.
friend class Grid_Generator_System [friend] |
Definition at line 477 of file Grid_Generator.defs.hh.
friend class Grid_Generator_System::const_iterator [friend] |
Definition at line 478 of file Grid_Generator.defs.hh.
| std::ostream& IO_Operators::operator<< | ( | std::ostream & | s, | |
| const Grid_Generator & | g | |||
| ) | [friend] |
friend class Linear_Expression [friend] |
Definition at line 482 of file Grid_Generator.defs.hh.
| bool operator!= | ( | const Grid_Generator & | x, | |
| const Grid_Generator & | y | |||
| ) | [related] |
Returns true if and only if x is not equivalent to y.
Definition at line 204 of file Grid_Generator.inlines.hh.
| std::ostream & operator<< | ( | std::ostream & | s, | |
| const Grid_Generator::Type & | t | |||
| ) | [related] |
Output operator.
Definition at line 350 of file Grid_Generator.cc.
References LINE, PARAMETER, and Parma_Polyhedra_Library::Generator::POINT.
00351 { 00352 const char* n = 0; 00353 switch (t) { 00354 case Grid_Generator::LINE: 00355 n = "LINE"; 00356 break; 00357 case Grid_Generator::PARAMETER: 00358 n = "PARAMETER"; 00359 break; 00360 case Generator::POINT: 00361 n = "POINT"; 00362 break; 00363 } 00364 s << n; 00365 return s; 00366 }
| std::ostream & operator<< | ( | std::ostream & | s, | |
| const Grid_Generator & | g | |||
| ) | [related] |
Output operator.
Definition at line 284 of file Grid_Generator.cc.
References divisor(), LINE, Parma_Polyhedra_Library::neg_assign(), PARAMETER, POINT, PPL_DIRTY_TEMP_COEFFICIENT, space_dimension(), and type().
00284 { 00285 bool need_divisor = false; 00286 bool extra_parentheses = false; 00287 const dimension_type num_variables = g.space_dimension(); 00288 Grid_Generator::Type t = g.type(); 00289 switch (t) { 00290 case Grid_Generator::LINE: 00291 s << "l("; 00292 break; 00293 case Grid_Generator::PARAMETER: 00294 s << "q("; 00295 if (g[num_variables + 1] == 1) 00296 break; 00297 goto any_point; 00298 case Grid_Generator::POINT: 00299 s << "p("; 00300 if (g[0] > 1) { 00301 any_point: 00302 need_divisor = true; 00303 dimension_type num_non_zero_coefficients = 0; 00304 for (dimension_type v = 0; v < num_variables; ++v) 00305 if (g[v+1] != 0) 00306 if (++num_non_zero_coefficients > 1) { 00307 extra_parentheses = true; 00308 s << "("; 00309 break; 00310 } 00311 } 00312 break; 00313 } 00314 00315 PPL_DIRTY_TEMP_COEFFICIENT(gv); 00316 bool first = true; 00317 for (dimension_type v = 0; v < num_variables; ++v) { 00318 gv = g[v+1]; 00319 if (gv != 0) { 00320 if (!first) { 00321 if (gv > 0) 00322 s << " + "; 00323 else { 00324 s << " - "; 00325 neg_assign(gv); 00326 } 00327 } 00328 else 00329 first = false; 00330 if (gv == -1) 00331 s << "-"; 00332 else if (gv != 1) 00333 s << gv << "*"; 00334 s << PPL::Variable(v); 00335 } 00336 } 00337 if (first) 00338 // A generator in the origin. 00339 s << 0; 00340 if (extra_parentheses) 00341 s << ")"; 00342 if (need_divisor) 00343 s << "/" << g.divisor(); 00344 s << ")"; 00345 return s; 00346 }
| bool operator== | ( | const Grid_Generator & | x, | |
| const Grid_Generator & | y | |||
| ) | [related] |
Returns true if and only if x is equivalent to y.
Definition at line 198 of file Grid_Generator.inlines.hh.
References is_equivalent_to().
friend class Scalar_Products [friend] |
Definition at line 480 of file Grid_Generator.defs.hh.
| void swap | ( | Parma_Polyhedra_Library::Grid_Generator & | x, | |
| Parma_Polyhedra_Library::Grid_Generator & | y | |||
| ) | [related] |
Specializes std::swap.
Definition at line 234 of file Grid_Generator.inlines.hh.
References swap().
00235 { 00236 x.swap(y); 00237 }
friend class Topology_Adjusted_Scalar_Product_Sign [friend] |
Definition at line 481 of file Grid_Generator.defs.hh.
const PPL::Grid_Generator * Parma_Polyhedra_Library::Grid_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 from Parma_Polyhedra_Library::Generator.
Definition at line 403 of file Grid_Generator.defs.hh.
Referenced by finalize(), initialize(), and zero_dim_point().
1.6.3