#include <Row.defs.hh>
Public Member Functions | |
Row () | |
Pre-constructs a row: construction must be completed by construct(). | |
Row (dimension_type sz, Flags f) | |
Tight constructor: resizing may require reallocation. | |
Row (dimension_type sz, dimension_type capacity, Flags f) | |
Sizing constructor with capacity. | |
Row (const Row &y) | |
Ordinary copy constructor. | |
Row (const Row &y, dimension_type capacity) | |
Copy constructor with specified capacity. | |
Row (const Row &y, dimension_type sz, dimension_type capacity) | |
Copy constructor with specified size and capacity. | |
~Row () | |
Destructor. | |
Row & | operator= (const Row &y) |
Assignment operator. | |
void | swap (Row &y) |
Swaps *this with y . | |
void | assign (Row &y) |
Assigns the implementation of y to *this . | |
void | allocate (dimension_type capacity, Flags f) |
Allocates memory for a default constructed Row object, setting flags to f and allowing for capacity coefficients at most. | |
void | expand_within_capacity (dimension_type new_size) |
Expands the row to size new_size . | |
void | shrink (dimension_type new_size) |
Shrinks the row by erasing elements at the end. | |
const Flags & | flags () const |
Returns a const reference to the flags of *this . | |
Flags & | flags () |
Returns a non-const reference to the flags of *this . | |
dimension_type | size () const |
Gives the number of coefficients currently in use. | |
void | normalize () |
Normalizes the modulo of coefficients so that they are mutually prime. | |
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) |
Uses the ASCII Row representation at s to recreate *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 a lower bound to the size in bytes of the memory managed by *this . | |
memory_size_type | total_memory_in_bytes (dimension_type capacity) const |
Returns the total size in bytes of the memory occupied by *this , provided the capacity of *this is given by capacity . | |
memory_size_type | external_memory_in_bytes (dimension_type capacity) const |
Returns the size in bytes of the memory managed by *this , provided the capacity of *this is given by capacity . | |
bool | OK (dimension_type row_size, dimension_type row_capacity) const |
Checks if all the invariants are satisfied. | |
Post-constructors | |
void | construct (dimension_type sz, Flags f) |
Constructs properly a default-constructed element. | |
void | construct (dimension_type sz, dimension_type capacity, Flags f) |
Constructs properly a default-constructed element. | |
Subscript operators | |
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 . | |
Static Public Member Functions | |
static dimension_type | max_size () |
Returns the size() of the largest possible Row. | |
Private Member Functions | |
void | copy_construct_coefficients (const Row &y) |
Exception-safe copy construction mechanism for coefficients. | |
Related Functions | |
(Note that these are not member functions.) | |
bool | operator== (const Row &x, const Row &y) |
Returns true if and only if x and y are equal. | |
bool | operator!= (const Row &x, const Row &y) |
Returns true if and only if x and y are different. | |
void | swap (Parma_Polyhedra_Library::Row &x, Parma_Polyhedra_Library::Row &y) |
Specializes std::swap . | |
void | iter_swap (std::vector< Parma_Polyhedra_Library::Row >::iterator x, std::vector< Parma_Polyhedra_Library::Row >::iterator y) |
Specializes std::iter_swap . | |
Classes | |
class | Flags |
Wrapper class to represent a set of flags with bits in a native unsigned integral type. More... |
Definition at line 84 of file Row.defs.hh.
Parma_Polyhedra_Library::Row::Row | ( | ) | [inline] |
Pre-constructs a row: construction must be completed by construct().
Definition at line 205 of file Row.inlines.hh.
00206 : Row_Impl_Handler() { 00207 }
Parma_Polyhedra_Library::Row::Row | ( | dimension_type | sz, | |
Flags | f | |||
) | [inline] |
Tight constructor: resizing may require reallocation.
Constructs a row with size and capacity sz
, and flags f
.
Definition at line 270 of file Row.inlines.hh.
References construct().
00271 : Row_Impl_Handler() { 00272 construct(sz, f); 00273 }
Parma_Polyhedra_Library::Row::Row | ( | dimension_type | sz, | |
dimension_type | capacity, | |||
Flags | f | |||
) | [inline] |
Sizing constructor with capacity.
sz | The size of the row that will be constructed; | |
capacity | The capacity of the row that will be constructed; | |
f | Flags for the row that will be constructed. |
capacity
elements, sz
of which are default-constructed now. The row flags are set to f
.
Definition at line 262 of file Row.inlines.hh.
References construct().
00265 : Row_Impl_Handler() { 00266 construct(sz, capacity, f); 00267 }
Parma_Polyhedra_Library::Row::Row | ( | const Row & | y | ) | [inline] |
Ordinary copy constructor.
Definition at line 276 of file Row.inlines.hh.
References allocate(), Parma_Polyhedra_Library::compute_capacity(), copy_construct_coefficients(), flags(), Parma_Polyhedra_Library::Row_Impl_Handler::impl, max_size(), and size().
00277 : Row_Impl_Handler() { 00278 if (y.impl) { 00279 allocate(compute_capacity(y.size(), max_size()), y.flags()); 00280 copy_construct_coefficients(y); 00281 } 00282 }
Parma_Polyhedra_Library::Row::Row | ( | const Row & | y, | |
dimension_type | capacity | |||
) | [inline] |
Copy constructor with specified capacity.
It is assumed that capacity
is greater than or equal to the size of y
.
Definition at line 285 of file Row.inlines.hh.
References allocate(), copy_construct_coefficients(), flags(), Parma_Polyhedra_Library::Row_Impl_Handler::impl, max_size(), and size().
00287 : Row_Impl_Handler() { 00288 assert(y.impl); 00289 assert(y.size() <= capacity && capacity <= max_size()); 00290 allocate(capacity, y.flags()); 00291 copy_construct_coefficients(y); 00292 }
Parma_Polyhedra_Library::Row::Row | ( | const Row & | y, | |
dimension_type | sz, | |||
dimension_type | capacity | |||
) | [inline] |
Copy constructor with specified size and capacity.
It is assumed that sz
is greater than or equal to the size of y
and, of course, that sz
is less than or equal to capacity
.
Definition at line 295 of file Row.inlines.hh.
References allocate(), copy_construct_coefficients(), expand_within_capacity(), flags(), Parma_Polyhedra_Library::Row_Impl_Handler::impl, max_size(), and size().
00298 : Row_Impl_Handler() { 00299 assert(y.impl); 00300 assert(y.size() <= sz && sz <= capacity && capacity <= max_size()); 00301 allocate(capacity, y.flags()); 00302 copy_construct_coefficients(y); 00303 expand_within_capacity(sz); 00304 }
Parma_Polyhedra_Library::Row::~Row | ( | ) | [inline] |
void Parma_Polyhedra_Library::Row::construct | ( | dimension_type | sz, | |
Flags | f | |||
) | [inline] |
Constructs properly a default-constructed element.
Builds a row with size and capacity sz
and flags f
.
Reimplemented in Parma_Polyhedra_Library::Linear_Row.
Definition at line 257 of file Row.inlines.hh.
Referenced by Parma_Polyhedra_Library::Linear_Row::construct(), and Row().
00257 { 00258 construct(sz, sz, f); 00259 }
void Parma_Polyhedra_Library::Row::construct | ( | dimension_type | sz, | |
dimension_type | capacity, | |||
Flags | f | |||
) | [inline] |
Constructs properly a default-constructed element.
sz | The size of the row that will be constructed; | |
capacity | The capacity of the row that will be constructed; | |
f | Flags for the row that will be constructed. |
capacity
elements, sz
of which are default-constructed now. The row flags are set to f
.
Reimplemented in Parma_Polyhedra_Library::Linear_Row.
Definition at line 248 of file Row.inlines.hh.
References allocate(), expand_within_capacity(), and max_size().
00250 { 00251 assert(sz <= capacity && capacity <= max_size()); 00252 allocate(capacity, f); 00253 expand_within_capacity(sz); 00254 }
Assignment operator.
Definition at line 333 of file Row.inlines.hh.
References swap().
Referenced by Parma_Polyhedra_Library::Generator::operator=(), Parma_Polyhedra_Library::Constraint::operator=(), and Parma_Polyhedra_Library::Congruence::operator=().
00333 { 00334 // Copy-construct `tmp' from `y'. 00335 Row tmp(y); 00336 // Swap the implementation of `*this' with the one of `tmp'. 00337 swap(tmp); 00338 // Now `tmp' goes out of scope, so the old `*this' will be destroyed. 00339 return *this; 00340 }
void Parma_Polyhedra_Library::Row::swap | ( | Row & | y | ) | [inline] |
Swaps *this
with y
.
Definition at line 317 of file Row.inlines.hh.
References Parma_Polyhedra_Library::Row_Impl_Handler::impl.
Referenced by Parma_Polyhedra_Library::Congruence::Congruence(), Parma_Polyhedra_Library::LP_Problem::erase_slacks(), iter_swap(), operator=(), Parma_Polyhedra_Library::LP_Problem::second_phase(), swap(), and Parma_Polyhedra_Library::Congruence::swap().
00317 { 00318 std::swap(impl, y.impl); 00319 #if EXTRA_ROW_DEBUG 00320 std::swap(capacity_, y.capacity_); 00321 #endif 00322 }
void Parma_Polyhedra_Library::Row::assign | ( | Row & | y | ) | [inline] |
Assigns the implementation of y
to *this
.
To be used with extra care, since it may easily cause memory leaks or undefined behavior.
Definition at line 325 of file Row.inlines.hh.
References Parma_Polyhedra_Library::Row_Impl_Handler::impl.
00325 { 00326 impl = y.impl; 00327 #if EXTRA_ROW_DEBUG 00328 capacity_ = y.capacity_; 00329 #endif 00330 }
void Parma_Polyhedra_Library::Row::allocate | ( | dimension_type | capacity, | |
Flags | f | |||
) | [inline] |
Allocates memory for a default constructed Row object, setting flags to f
and allowing for capacity
coefficients at most.
It is assumed that no allocation has been performed before (otherwise, a memory leak will occur). After execution, the size of the Row object is zero.
Definition at line 210 of file Row.inlines.hh.
References Parma_Polyhedra_Library::Row_Impl_Handler::impl, and max_size().
Referenced by construct(), and Row().
00215 { 00216 assert(capacity <= max_size()); 00217 #if !CXX_SUPPORTS_FLEXIBLE_ARRAYS 00218 if (capacity == 0) 00219 ++capacity; 00220 #endif 00221 assert(impl == 0); 00222 impl = new (capacity) Impl(f); 00223 #if EXTRA_ROW_DEBUG 00224 assert(capacity_ == 0); 00225 capacity_ = capacity; 00226 #endif 00227 }
void Parma_Polyhedra_Library::Row::expand_within_capacity | ( | dimension_type | new_size | ) | [inline] |
Expands the row to size new_size
.
Adds new positions to the implementation of the row obtaining a new row with size new_size
. It is assumed that new_size
is between the current size and capacity of the row.
Definition at line 230 of file Row.inlines.hh.
References Parma_Polyhedra_Library::Row_Impl_Handler::Impl::expand_within_capacity(), and Parma_Polyhedra_Library::Row_Impl_Handler::impl.
Referenced by Parma_Polyhedra_Library::Congruence::Congruence(), construct(), and Row().
00230 { 00231 assert(impl); 00232 #if EXTRA_ROW_DEBUG 00233 assert(new_size <= capacity_); 00234 #endif 00235 impl->expand_within_capacity(new_size); 00236 }
void Parma_Polyhedra_Library::Row::shrink | ( | dimension_type | new_size | ) | [inline] |
Shrinks the row by erasing elements at the end.
Destroys elements of the row implementation from position new_size
to the end. It is assumed that new_size
is not greater than the current size.
Definition at line 311 of file Row.inlines.hh.
References Parma_Polyhedra_Library::Row_Impl_Handler::impl, and Parma_Polyhedra_Library::Row_Impl_Handler::Impl::shrink().
Referenced by Parma_Polyhedra_Library::LP_Problem::erase_slacks().
const Row::Flags & Parma_Polyhedra_Library::Row::flags | ( | ) | const [inline] |
Returns a const reference to the flags of *this
.
Reimplemented in Parma_Polyhedra_Library::Linear_Row.
Definition at line 175 of file Row.inlines.hh.
References Parma_Polyhedra_Library::Row_Impl_Handler::Impl::flags(), and Parma_Polyhedra_Library::Row_Impl_Handler::impl.
Referenced by ascii_dump(), ascii_load(), Parma_Polyhedra_Library::Linear_Row::flags(), operator==(), and Row().
Row::Flags & Parma_Polyhedra_Library::Row::flags | ( | ) | [inline] |
Returns a non-const reference to the flags of *this
.
Reimplemented in Parma_Polyhedra_Library::Linear_Row.
Definition at line 180 of file Row.inlines.hh.
References Parma_Polyhedra_Library::Row_Impl_Handler::Impl::flags(), and Parma_Polyhedra_Library::Row_Impl_Handler::impl.
dimension_type Parma_Polyhedra_Library::Row::max_size | ( | ) | [inline, static] |
Returns the size() of the largest possible Row.
Definition at line 165 of file Row.inlines.hh.
References Parma_Polyhedra_Library::Row_Impl_Handler::Impl::max_size().
Referenced by allocate(), construct(), Parma_Polyhedra_Library::Matrix::max_num_columns(), Parma_Polyhedra_Library::Linear_Row::max_space_dimension(), Parma_Polyhedra_Library::Congruence::max_space_dimension(), OK(), and Row().
00165 { 00166 return Impl::max_size(); 00167 }
dimension_type Parma_Polyhedra_Library::Row::size | ( | ) | const [inline] |
Gives the number of coefficients currently in use.
Reimplemented in Parma_Polyhedra_Library::Grid_Generator.
Definition at line 170 of file Row.inlines.hh.
References Parma_Polyhedra_Library::Row_Impl_Handler::impl, and Parma_Polyhedra_Library::Row_Impl_Handler::Impl::size().
Referenced by Parma_Polyhedra_Library::Linear_System::add_pending_row(), Parma_Polyhedra_Library::Linear_System::add_row(), Parma_Polyhedra_Library::Constraint_System::affine_preimage(), Parma_Polyhedra_Library::Congruence_System::affine_preimage(), Parma_Polyhedra_Library::Linear_Row::all_homogeneous_terms_are_zero(), ascii_dump(), Parma_Polyhedra_Library::Linear_Row::ascii_dump(), Parma_Polyhedra_Library::Congruence::ascii_dump(), ascii_load(), Parma_Polyhedra_Library::Linear_Row::ascii_load(), Parma_Polyhedra_Library::Congruence::ascii_load(), Parma_Polyhedra_Library::Scalar_Products::assign(), Parma_Polyhedra_Library::Linear_Row::compare(), Parma_Polyhedra_Library::LP_Problem::compute_simplex(), Parma_Polyhedra_Library::Congruence::Congruence(), copy_construct_coefficients(), Parma_Polyhedra_Library::LP_Problem::erase_slacks(), Parma_Polyhedra_Library::LP_Problem::get_entering_var_index(), Parma_Polyhedra_Library::Scalar_Products::homogeneous_assign(), Parma_Polyhedra_Library::Linear_System::insert(), Parma_Polyhedra_Library::Linear_System::insert_pending(), Parma_Polyhedra_Library::Congruence_System::insert_verbatim(), Parma_Polyhedra_Library::Constraint::is_inconsistent(), Parma_Polyhedra_Library::Constraint::is_tautological(), Parma_Polyhedra_Library::LP_Problem::linear_combine(), Parma_Polyhedra_Library::Linear_Row::linear_combine(), Parma_Polyhedra_Library::Linear_Expression::Linear_Expression(), Parma_Polyhedra_Library::Congruence::modulus(), normalize(), Parma_Polyhedra_Library::Congruence::normalize(), Parma_Polyhedra_Library::Congruence_System::normalize_moduli(), OK(), Parma_Polyhedra_Library::LP_Problem::OK(), Parma_Polyhedra_Library::Linear_Expression::OK(), Parma_Polyhedra_Library::Generator::OK(), Parma_Polyhedra_Library::Constraint::OK(), Parma_Polyhedra_Library::Congruence::operator/=(), operator==(), Parma_Polyhedra_Library::LP_Problem::prepare_first_phase(), Parma_Polyhedra_Library::Scalar_Products::reduced_assign(), Row(), Parma_Polyhedra_Library::LP_Problem::second_phase(), Parma_Polyhedra_Library::Linear_Row::sign_normalize(), Parma_Polyhedra_Library::Congruence::sign_normalize(), Parma_Polyhedra_Library::Grid_Generator::size(), Parma_Polyhedra_Library::Linear_Row::space_dimension(), Parma_Polyhedra_Library::Linear_Expression::space_dimension(), Parma_Polyhedra_Library::Congruence::space_dimension(), Parma_Polyhedra_Library::LP_Problem::steepest_edge(), Parma_Polyhedra_Library::Generator::type(), and Parma_Polyhedra_Library::Constraint::type().
Coefficient & Parma_Polyhedra_Library::Row::operator[] | ( | dimension_type | k | ) | [inline] |
Returns a reference to the element of the row indexed by k
.
Reimplemented in Parma_Polyhedra_Library::Grid_Generator.
Definition at line 343 of file Row.inlines.hh.
References Parma_Polyhedra_Library::Row_Impl_Handler::impl.
Referenced by Parma_Polyhedra_Library::Grid_Generator::divisor(), Parma_Polyhedra_Library::Congruence::is_equal_at_dimension(), and Parma_Polyhedra_Library::Grid_Generator::operator[]().
Coefficient_traits::const_reference Parma_Polyhedra_Library::Row::operator[] | ( | dimension_type | k | ) | const [inline] |
Returns a constant reference to the element of the row indexed by k
.
Reimplemented in Parma_Polyhedra_Library::Grid_Generator.
Definition at line 349 of file Row.inlines.hh.
References Parma_Polyhedra_Library::Row_Impl_Handler::impl.
void Parma_Polyhedra_Library::Row::normalize | ( | ) |
Normalizes the modulo of coefficients so that they are mutually prime.
Computes the Greatest Common Divisor (GCD) among the elements of the row and normalizes them by the GCD itself.
Reimplemented in Parma_Polyhedra_Library::Congruence.
Definition at line 87 of file Row.cc.
References Parma_Polyhedra_Library::exact_div_assign(), Parma_Polyhedra_Library::gcd_assign(), Parma_Polyhedra_Library::neg_assign(), size(), and TEMP_INTEGER.
Referenced by Parma_Polyhedra_Library::Generator_System::add_corresponding_closure_points(), Parma_Polyhedra_Library::Polyhedron::add_generator(), Parma_Polyhedra_Library::Polyhedron::BHRZ03_evolving_rays(), Parma_Polyhedra_Library::Generator::is_equivalent_to(), Parma_Polyhedra_Library::Constraint::is_equivalent_to(), Parma_Polyhedra_Library::LP_Problem::linear_combine(), Parma_Polyhedra_Library::Linear_Row::strong_normalize(), Parma_Polyhedra_Library::Congruence::strong_normalize(), Parma_Polyhedra_Library::Polyhedron::strongly_minimize_generators(), Parma_Polyhedra_Library::Polyhedron::time_elapse_assign(), and Parma_Polyhedra_Library::Polyhedron::topological_closure_assign().
00087 { 00088 Row& x = *this; 00089 // Compute the GCD of all the coefficients. 00090 const dimension_type sz = size(); 00091 dimension_type i = sz; 00092 TEMP_INTEGER(gcd); 00093 while (i > 0) { 00094 const Coefficient& x_i = x[--i]; 00095 if (const int x_i_sign = sgn(x_i)) { 00096 gcd = x_i; 00097 if (x_i_sign < 0) 00098 neg_assign(gcd); 00099 goto compute_gcd; 00100 } 00101 } 00102 // We reach this point only if all the coefficients were zero. 00103 return; 00104 00105 compute_gcd: 00106 if (gcd == 1) 00107 return; 00108 while (i > 0) { 00109 const Coefficient& x_i = x[--i]; 00110 if (x_i != 0) { 00111 // Note: we use the ternary version instead of a more concise 00112 // gcd_assign(gcd, x_i) to take advantage of the fact that 00113 // `gcd' will decrease very rapidly (see D. Knuth, The Art of 00114 // Computer Programming, second edition, Section 4.5.2, 00115 // Algorithm C, and the discussion following it). Our 00116 // implementation of gcd_assign(x, y, z) for checked numbers is 00117 // optimized for the case where `z' is smaller than `y', so that 00118 // on checked numbers we gain. On the other hand, for the 00119 // implementation of gcd_assign(x, y, z) on GMP's unbounded 00120 // integers we cannot make any assumption, so here we draw. 00121 // Overall, we win. 00122 gcd_assign(gcd, x_i, gcd); 00123 if (gcd == 1) 00124 return; 00125 } 00126 } 00127 // Divide the coefficients by the GCD. 00128 for (dimension_type j = sz; j-- > 0; ) { 00129 Coefficient& x_j = x[j]; 00130 exact_div_assign(x_j, x_j, gcd); 00131 } 00132 }
void Parma_Polyhedra_Library::Row::ascii_dump | ( | ) | const |
Writes to std::cerr
an ASCII representation of *this
.
Reimplemented in Parma_Polyhedra_Library::Linear_Row, Parma_Polyhedra_Library::Constraint, Parma_Polyhedra_Library::Congruence, Parma_Polyhedra_Library::Generator, and Parma_Polyhedra_Library::Grid_Generator.
Referenced by Parma_Polyhedra_Library::LP_Problem::ascii_dump().
void Parma_Polyhedra_Library::Row::ascii_dump | ( | std::ostream & | s | ) | const |
Writes to s
an ASCII representation of *this
.
Reimplemented in Parma_Polyhedra_Library::Linear_Row, Parma_Polyhedra_Library::Constraint, Parma_Polyhedra_Library::Congruence, Parma_Polyhedra_Library::Generator, and Parma_Polyhedra_Library::Grid_Generator.
Definition at line 162 of file Row.cc.
References Parma_Polyhedra_Library::Row::Flags::ascii_dump(), flags(), and size().
00162 { 00163 const Row& x = *this; 00164 const dimension_type x_size = x.size(); 00165 for (dimension_type i = 0; i < x_size; ++i) 00166 s << x[i] << ' '; 00167 s << "f "; 00168 flags().ascii_dump(s); 00169 s << "\n"; 00170 }
void Parma_Polyhedra_Library::Row::print | ( | ) | const |
Prints *this
to std::cerr
using operator<<
.
Reimplemented in Parma_Polyhedra_Library::Linear_Row, Parma_Polyhedra_Library::Constraint, Parma_Polyhedra_Library::Congruence, Parma_Polyhedra_Library::Generator, and Parma_Polyhedra_Library::Grid_Generator.
bool Parma_Polyhedra_Library::Row::ascii_load | ( | std::istream & | s | ) |
Uses the ASCII Row representation at s
to recreate *this.
Returns true
if successful, false
otherwise. The ASCII representation is as output by ascii_dump.
Reimplemented in Parma_Polyhedra_Library::Linear_Row, Parma_Polyhedra_Library::Constraint, Parma_Polyhedra_Library::Congruence, Parma_Polyhedra_Library::Generator, and Parma_Polyhedra_Library::Grid_Generator.
Definition at line 175 of file Row.cc.
References Parma_Polyhedra_Library::Row::Flags::ascii_load(), flags(), and size().
00175 { 00176 Row& x = *this; 00177 std::string str; 00178 const dimension_type x_size = x.size(); 00179 for (dimension_type col = 0; col < x_size; ++col) 00180 if (!(s >> x[col])) 00181 return false; 00182 if (!(s >> str) || (str.compare("f") != 0)) 00183 return false; 00184 return flags().ascii_load(s); 00185 }
memory_size_type Parma_Polyhedra_Library::Row::total_memory_in_bytes | ( | ) | const [inline] |
Returns a lower bound to the total size in bytes of the memory occupied by *this
.
Reimplemented in Parma_Polyhedra_Library::Linear_Expression, Parma_Polyhedra_Library::Constraint, Parma_Polyhedra_Library::Congruence, Parma_Polyhedra_Library::Generator, and Parma_Polyhedra_Library::Grid_Generator.
Definition at line 374 of file Row.inlines.hh.
References external_memory_in_bytes().
00374 { 00375 return sizeof(*this) + external_memory_in_bytes(); 00376 }
memory_size_type Parma_Polyhedra_Library::Row::external_memory_in_bytes | ( | ) | const [inline] |
Returns a lower bound to the size in bytes of the memory managed by *this
.
Reimplemented in Parma_Polyhedra_Library::Linear_Expression, Parma_Polyhedra_Library::Constraint, Parma_Polyhedra_Library::Congruence, Parma_Polyhedra_Library::Generator, and Parma_Polyhedra_Library::Grid_Generator.
Definition at line 365 of file Row.inlines.hh.
References Parma_Polyhedra_Library::Row_Impl_Handler::impl, and Parma_Polyhedra_Library::Row_Impl_Handler::Impl::total_memory_in_bytes().
Referenced by Parma_Polyhedra_Library::LP_Problem::external_memory_in_bytes(), and total_memory_in_bytes().
00365 { 00366 #if EXTRA_ROW_DEBUG 00367 return impl->total_memory_in_bytes(capacity_); 00368 #else 00369 return impl->total_memory_in_bytes(); 00370 #endif 00371 }
memory_size_type Parma_Polyhedra_Library::Row::total_memory_in_bytes | ( | dimension_type | capacity | ) | const [inline] |
Returns the total size in bytes of the memory occupied by *this
, provided the capacity of *this
is given by capacity
.
Definition at line 360 of file Row.inlines.hh.
References external_memory_in_bytes().
00360 { 00361 return sizeof(*this) + external_memory_in_bytes(capacity); 00362 }
memory_size_type Parma_Polyhedra_Library::Row::external_memory_in_bytes | ( | dimension_type | capacity | ) | const [inline] |
Returns the size in bytes of the memory managed by *this
, provided the capacity of *this
is given by capacity
.
Definition at line 355 of file Row.inlines.hh.
References Parma_Polyhedra_Library::Row_Impl_Handler::impl, and Parma_Polyhedra_Library::Row_Impl_Handler::Impl::total_memory_in_bytes().
00355 { 00356 return impl->total_memory_in_bytes(capacity); 00357 }
bool Parma_Polyhedra_Library::Row::OK | ( | dimension_type | row_size, | |
dimension_type | row_capacity | |||
) | const |
Checks if all the invariants are satisfied.
Reimplemented in Parma_Polyhedra_Library::Linear_Row.
Definition at line 196 of file Row.cc.
References max_size(), and size().
Referenced by Parma_Polyhedra_Library::Matrix::add_recycled_row(), and Parma_Polyhedra_Library::Linear_Row::OK().
00201 { 00202 #ifndef NDEBUG 00203 using std::endl; 00204 using std::cerr; 00205 #endif 00206 00207 bool is_broken = false; 00208 #if EXTRA_ROW_DEBUG 00209 # if !CXX_SUPPORTS_FLEXIBLE_ARRAYS 00210 if (capacity_ == 0) { 00211 cerr << "Illegal row capacity: is 0, should be at least 1" 00212 << endl; 00213 is_broken = true; 00214 } 00215 else if (capacity_ == 1 && row_capacity == 0) 00216 // This is fine. 00217 ; 00218 else 00219 # endif 00220 if (capacity_ > max_size()) { 00221 cerr << "Row capacity exceeds the maximum allowed size:" 00222 << endl 00223 << "is " << capacity_ 00224 << ", should be less than or equal to " << max_size() << "." 00225 << endl; 00226 is_broken = true; 00227 } 00228 if (capacity_ != row_capacity) { 00229 cerr << "Row capacity mismatch: is " << capacity_ 00230 << ", should be " << row_capacity << "." 00231 << endl; 00232 is_broken = true; 00233 } 00234 #endif 00235 if (size() > max_size()) { 00236 #ifndef NDEBUG 00237 cerr << "Row size exceeds the maximum allowed size:" 00238 << endl 00239 << "is " << size() 00240 << ", should be less than or equal to " << max_size() << "." 00241 << endl; 00242 #endif 00243 is_broken = true; 00244 } 00245 if (size() != row_size) { 00246 #ifndef NDEBUG 00247 cerr << "Row size mismatch: is " << size() 00248 << ", should be " << row_size << "." 00249 << endl; 00250 #endif 00251 is_broken = true; 00252 } 00253 #if EXTRA_ROW_DEBUG 00254 if (capacity_ < size()) { 00255 #ifndef NDEBUG 00256 cerr << "Row is completely broken: capacity is " << capacity_ 00257 << ", size is " << size() << "." 00258 << endl; 00259 #endif 00260 is_broken = true; 00261 } 00262 #endif 00263 return !is_broken; 00264 }
void Parma_Polyhedra_Library::Row::copy_construct_coefficients | ( | const Row & | y | ) | [inline, private] |
Exception-safe copy construction mechanism for coefficients.
Definition at line 239 of file Row.inlines.hh.
References Parma_Polyhedra_Library::Row_Impl_Handler::Impl::copy_construct_coefficients(), Parma_Polyhedra_Library::Row_Impl_Handler::impl, and size().
Referenced by Row().
00239 { 00240 assert(impl && y.impl); 00241 #if EXTRA_ROW_DEBUG 00242 assert(y.size() <= capacity_); 00243 #endif 00244 impl->copy_construct_coefficients(*(y.impl)); 00245 }
Returns true
if and only if x
and y
are equal.
Definition at line 268 of file Row.cc.
References flags(), and size().
00268 { 00269 const dimension_type x_size = x.size(); 00270 const dimension_type y_size = y.size(); 00271 if (x_size != y_size) 00272 return false; 00273 00274 if (x.flags() != y.flags()) 00275 return false; 00276 00277 for (dimension_type i = x_size; i-- > 0; ) 00278 if (x[i] != y[i]) 00279 return false; 00280 00281 return true; 00282 }
void swap | ( | Parma_Polyhedra_Library::Row & | x, | |
Parma_Polyhedra_Library::Row & | y | |||
) | [related] |
Specializes std::swap
.
Definition at line 391 of file Row.inlines.hh.
References swap().
00391 { 00392 x.swap(y); 00393 }
void iter_swap | ( | std::vector< Parma_Polyhedra_Library::Row >::iterator | x, | |
std::vector< Parma_Polyhedra_Library::Row >::iterator | y | |||
) | [related] |
Specializes std::iter_swap
.
Definition at line 397 of file Row.inlines.hh.
References swap().
00398 { 00399 swap(*x, *y); 00400 }