#include <DB_Matrix.defs.hh>

Public Member Functions | |
| DB_Matrix () | |
| Builds an empty matrix. | |
| DB_Matrix (dimension_type n_rows) | |
| Builds a square matrix having the specified dimension. | |
| DB_Matrix (const DB_Matrix &y) | |
| Copy-constructor. | |
| template<typename U> | |
| DB_Matrix (const DB_Matrix< U > &y) | |
Constructs a conservative approximation of y. | |
| ~DB_Matrix () | |
| Destructor. | |
| DB_Matrix & | operator= (const DB_Matrix &y) |
| Assignment operator. | |
| const_iterator | begin () const |
Returns the const_iterator pointing to the first row, if *this is not empty; otherwise, returns the past-the-end const_iterator. | |
| const_iterator | end () const |
| Returns the past-the-end const_iterator. | |
| void | swap (DB_Matrix &y) |
Swaps *this with y. | |
| void | grow (dimension_type new_n_rows) |
| Makes the matrix grow by adding more rows and more columns. | |
| void | resize_no_copy (dimension_type new_n_rows) |
| Resizes the matrix without worrying about the old contents. | |
| dimension_type | num_rows () const |
| Returns the number of rows in the matrix. | |
| 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) and sets *this accordingly. Returns true if successful, false otherwise. | |
| bool | OK () const |
| Checks if all the invariants are satisfied. | |
Subscript operators. | |
| DB_Row< T > & | operator[] (dimension_type k) |
Returns a reference to the k-th row of the matrix. | |
| const DB_Row< T > & | operator[] (dimension_type k) const |
Returns a constant reference to the k-th row of the matrix. | |
Static Public Member Functions | |
| static dimension_type | max_num_rows () |
| Returns the maximum number of rows a DB_Matrix can handle. | |
| static dimension_type | max_num_columns () |
| Returns the maximum number of columns a DB_Matrix can handle. | |
Private Attributes | |
| std::vector< DB_Row< T > > | rows |
| The rows of the matrix. | |
| dimension_type | row_size |
| Size of the initialized part of each row. | |
| dimension_type | row_capacity |
Capacity allocated for each row, i.e., number of long objects that each row can contain. | |
Friends | |
| class | DB_Matrix |
Related Functions | |
| (Note that these are not member functions.) | |
| template<typename T> | |
| std::ostream & | operator<< (std::ostream &s, const DB_Matrix< T > &c) |
| Output operator. | |
| template<typename T> | |
| void | swap (Parma_Polyhedra_Library::DB_Matrix< T > &x, Parma_Polyhedra_Library::DB_Matrix< T > &y) |
Specializes std::swap. | |
| template<typename T> | |
| bool | operator== (const DB_Matrix< T > &x, const DB_Matrix< T > &y) |
Returns true if and only if x and y are identical. | |
| template<typename T> | |
| bool | operator!= (const DB_Matrix< T > &x, const DB_Matrix< T > &y) |
Returns true if and only if x and y are different. | |
| template<typename Temp, typename To, typename T> | |
| bool | rectilinear_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const DB_Matrix< T > &x, const DB_Matrix< T > &y, const Rounding_Dir dir, Temp &tmp0, Temp &tmp1, Temp &tmp2) |
Computes the rectilinear (or Manhattan) distance between x and y. | |
| template<typename Temp, typename To, typename T> | |
| bool | euclidean_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const DB_Matrix< T > &x, const DB_Matrix< T > &y, const Rounding_Dir dir, Temp &tmp0, Temp &tmp1, Temp &tmp2) |
Computes the euclidean distance between x and y. | |
| template<typename Temp, typename To, typename T> | |
| bool | l_infinity_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const DB_Matrix< T > &x, const DB_Matrix< T > &y, const Rounding_Dir dir, Temp &tmp0, Temp &tmp1, Temp &tmp2) |
Computes the distance between x and y. | |
| template<typename Specialization, typename Temp, typename To, typename T> | |
| bool | l_m_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const DB_Matrix< T > &x, const DB_Matrix< T > &y, const Rounding_Dir dir, Temp &tmp0, Temp &tmp1, Temp &tmp2) |
Classes | |
| class | const_iterator |
| A read-only iterator over the rows of the matrix. More... | |
The templatic class DB_Matrix<T> allows for the representation of a square matrix of T objects. Each DB_Matrix<T> object can be viewed as a multiset of DB_Row<T>.
Definition at line 61 of file DB_Matrix.defs.hh.
| Parma_Polyhedra_Library::DB_Matrix< T >::DB_Matrix | ( | ) |
Builds an empty matrix.
DB_Rows' size and capacity are initialized to
.
| Parma_Polyhedra_Library::DB_Matrix< T >::DB_Matrix | ( | dimension_type | n_rows | ) | [inline, explicit] |
Builds a square matrix having the specified dimension.
Definition at line 171 of file DB_Matrix.inlines.hh.
References Parma_Polyhedra_Library::DB_Matrix< T >::OK(), Parma_Polyhedra_Library::DB_Matrix< T >::row_capacity, and Parma_Polyhedra_Library::DB_Matrix< T >::rows.
00172 : rows(n_rows), 00173 row_size(n_rows), 00174 row_capacity(compute_capacity(n_rows, max_num_columns())) { 00175 // Construct in direct order: will destroy in reverse order. 00176 for (dimension_type i = 0; i < n_rows; ++i) 00177 rows[i].construct(n_rows, row_capacity); 00178 assert(OK()); 00179 }
| Parma_Polyhedra_Library::DB_Matrix< T >::DB_Matrix | ( | const DB_Matrix< T > & | y | ) | [inline] |
Copy-constructor.
Definition at line 183 of file DB_Matrix.inlines.hh.
00184 : rows(y.rows), 00185 row_size(y.row_size), 00186 row_capacity(compute_capacity(y.row_size, max_num_columns())) { 00187 }
| Parma_Polyhedra_Library::DB_Matrix< T >::DB_Matrix | ( | const DB_Matrix< U > & | y | ) | [inline, explicit] |
Constructs a conservative approximation of y.
Definition at line 192 of file DB_Matrix.inlines.hh.
References Parma_Polyhedra_Library::DB_Matrix< T >::OK(), Parma_Polyhedra_Library::DB_Matrix< T >::row_capacity, and Parma_Polyhedra_Library::DB_Matrix< T >::rows.
00193 : rows(y.rows.size()), 00194 row_size(y.row_size), 00195 row_capacity(compute_capacity(y.row_size, max_num_columns())) { 00196 // Construct in direct order: will destroy in reverse order. 00197 for (dimension_type i = 0, n_rows = rows.size(); i < n_rows; ++i) 00198 rows[i].construct_upward_approximation(y[i], row_capacity); 00199 assert(OK()); 00200 }
| Parma_Polyhedra_Library::DB_Matrix< T >::~DB_Matrix | ( | ) | [inline] |
| dimension_type Parma_Polyhedra_Library::DB_Matrix< T >::max_num_rows | ( | ) | [inline, static] |
Returns the maximum number of rows a DB_Matrix can handle.
Definition at line 43 of file DB_Matrix.inlines.hh.
Referenced by Parma_Polyhedra_Library::DB_Matrix< T >::grow(), and Parma_Polyhedra_Library::DB_Matrix< T >::resize_no_copy().
| dimension_type Parma_Polyhedra_Library::DB_Matrix< T >::max_num_columns | ( | ) | [inline, static] |
Returns the maximum number of columns a DB_Matrix can handle.
Definition at line 49 of file DB_Matrix.inlines.hh.
Referenced by Parma_Polyhedra_Library::DB_Matrix< T >::grow(), Parma_Polyhedra_Library::DB_Matrix< T >::operator=(), and Parma_Polyhedra_Library::DB_Matrix< T >::resize_no_copy().
| DB_Matrix< T > & Parma_Polyhedra_Library::DB_Matrix< T >::operator= | ( | const DB_Matrix< T > & | y | ) | [inline] |
Assignment operator.
Definition at line 204 of file DB_Matrix.inlines.hh.
References Parma_Polyhedra_Library::compute_capacity(), Parma_Polyhedra_Library::DB_Matrix< T >::max_num_columns(), Parma_Polyhedra_Library::DB_Matrix< T >::row_capacity, Parma_Polyhedra_Library::DB_Matrix< T >::row_size, and Parma_Polyhedra_Library::DB_Matrix< T >::rows.
00204 { 00205 // Without the following guard against auto-assignments we would 00206 // recompute the row capacity based on row size, possibly without 00207 // actually increasing the capacity of the rows. This would lead to 00208 // an inconsistent state. 00209 if (this != &y) { 00210 // The following assignment may do nothing on auto-assignments... 00211 rows = y.rows; 00212 row_size = y.row_size; 00213 // ... hence the following assignment must not be done on 00214 // auto-assignments. 00215 row_capacity = compute_capacity(y.row_size, max_num_columns()); 00216 } 00217 return *this; 00218 }
| DB_Matrix< T >::const_iterator Parma_Polyhedra_Library::DB_Matrix< T >::begin | ( | ) | const [inline] |
Returns the const_iterator pointing to the first row, if *this is not empty; otherwise, returns the past-the-end const_iterator.
Definition at line 117 of file DB_Matrix.inlines.hh.
References Parma_Polyhedra_Library::DB_Matrix< T >::rows.
00117 { 00118 return const_iterator(rows.begin()); 00119 }
| DB_Matrix< T >::const_iterator Parma_Polyhedra_Library::DB_Matrix< T >::end | ( | ) | const [inline] |
Returns the past-the-end const_iterator.
Definition at line 123 of file DB_Matrix.inlines.hh.
References Parma_Polyhedra_Library::DB_Matrix< T >::rows.
00123 { 00124 return const_iterator(rows.end()); 00125 }
| void Parma_Polyhedra_Library::DB_Matrix< T >::swap | ( | DB_Matrix< T > & | y | ) | [inline] |
Swaps *this with y.
Definition at line 35 of file DB_Matrix.inlines.hh.
References Parma_Polyhedra_Library::DB_Matrix< T >::row_capacity, Parma_Polyhedra_Library::DB_Matrix< T >::row_size, and Parma_Polyhedra_Library::DB_Matrix< T >::rows.
Referenced by Parma_Polyhedra_Library::DB_Matrix< T >::grow(), Parma_Polyhedra_Library::DB_Matrix< T >::resize_no_copy(), and Parma_Polyhedra_Library::DB_Matrix< T >::swap().
00035 { 00036 std::swap(rows, y.rows); 00037 std::swap(row_size, y.row_size); 00038 std::swap(row_capacity, y.row_capacity); 00039 }
| void Parma_Polyhedra_Library::DB_Matrix< T >::grow | ( | dimension_type | new_n_rows | ) | [inline] |
Makes the matrix grow by adding more rows and more columns.
| new_n_rows | The number of rows and columns of the resized matrix. |
*this.
Definition at line 222 of file DB_Matrix.inlines.hh.
References Parma_Polyhedra_Library::compute_capacity(), Parma_Polyhedra_Library::DB_Matrix< T >::max_num_columns(), Parma_Polyhedra_Library::DB_Matrix< T >::max_num_rows(), Parma_Polyhedra_Library::DB_Matrix< T >::row_capacity, Parma_Polyhedra_Library::DB_Matrix< T >::row_size, Parma_Polyhedra_Library::DB_Matrix< T >::rows, and Parma_Polyhedra_Library::DB_Matrix< T >::swap().
00222 { 00223 const dimension_type old_n_rows = rows.size(); 00224 assert(new_n_rows >= old_n_rows); 00225 00226 if (new_n_rows > old_n_rows) { 00227 if (new_n_rows <= row_capacity) { 00228 // We can recycle the old rows. 00229 if (rows.capacity() < new_n_rows) { 00230 // Reallocation will take place. 00231 std::vector<DB_Row<T> > new_rows; 00232 new_rows.reserve(compute_capacity(new_n_rows, max_num_rows())); 00233 new_rows.insert(new_rows.end(), new_n_rows, DB_Row<T>()); 00234 // Construct the new rows. 00235 dimension_type i = new_n_rows; 00236 while (i-- > old_n_rows) 00237 new_rows[i].construct(new_n_rows, row_capacity); 00238 // Steal the old rows. 00239 ++i; 00240 while (i-- > 0) 00241 new_rows[i].swap(rows[i]); 00242 // Put the new vector into place. 00243 std::swap(rows, new_rows); 00244 } 00245 else { 00246 // Reallocation will NOT take place. 00247 rows.insert(rows.end(), new_n_rows - old_n_rows, DB_Row<T>()); 00248 for (dimension_type i = new_n_rows; i-- > old_n_rows; ) 00249 rows[i].construct(new_n_rows, row_capacity); 00250 } 00251 } 00252 else { 00253 // We cannot even recycle the old rows. 00254 DB_Matrix new_matrix; 00255 new_matrix.rows.reserve(compute_capacity(new_n_rows, max_num_rows())); 00256 new_matrix.rows.insert(new_matrix.rows.end(), new_n_rows, DB_Row<T>()); 00257 // Construct the new rows. 00258 new_matrix.row_size = new_n_rows; 00259 new_matrix.row_capacity = compute_capacity(new_n_rows, 00260 max_num_columns()); 00261 dimension_type i = new_n_rows; 00262 while (i-- > old_n_rows) 00263 new_matrix.rows[i].construct(new_matrix.row_size, 00264 new_matrix.row_capacity); 00265 // Copy the old rows. 00266 ++i; 00267 while (i-- > 0) { 00268 DB_Row<T> new_row(rows[i], 00269 new_matrix.row_size, 00270 new_matrix.row_capacity); 00271 std::swap(new_matrix.rows[i], new_row); 00272 } 00273 // Put the new vector into place. 00274 swap(new_matrix); 00275 return; 00276 } 00277 } 00278 // Here we have the right number of rows. 00279 if (new_n_rows > row_size) { 00280 // We need more columns. 00281 if (new_n_rows <= row_capacity) 00282 // But we have enough capacity: we resize existing rows. 00283 for (dimension_type i = old_n_rows; i-- > 0; ) 00284 rows[i].expand_within_capacity(new_n_rows); 00285 else { 00286 // Capacity exhausted: we must reallocate the rows and 00287 // make sure all the rows have the same capacity. 00288 const dimension_type new_row_capacity 00289 = compute_capacity(new_n_rows, max_num_columns()); 00290 for (dimension_type i = old_n_rows; i-- > 0; ) { 00291 DB_Row<T> new_row(rows[i], new_n_rows, new_row_capacity); 00292 std::swap(rows[i], new_row); 00293 } 00294 row_capacity = new_row_capacity; 00295 } 00296 // Rows have grown or shrunk. 00297 row_size = new_n_rows; 00298 } 00299 }
| void Parma_Polyhedra_Library::DB_Matrix< T >::resize_no_copy | ( | dimension_type | new_n_rows | ) | [inline] |
Resizes the matrix without worrying about the old contents.
| new_n_rows | The number of rows and columns of the resized matrix. |
*this.
Definition at line 303 of file DB_Matrix.inlines.hh.
References Parma_Polyhedra_Library::compute_capacity(), Parma_Polyhedra_Library::DB_Matrix< T >::max_num_columns(), Parma_Polyhedra_Library::DB_Matrix< T >::max_num_rows(), Parma_Polyhedra_Library::DB_Matrix< T >::row_capacity, Parma_Polyhedra_Library::DB_Matrix< T >::row_size, Parma_Polyhedra_Library::DB_Matrix< T >::rows, and Parma_Polyhedra_Library::DB_Matrix< T >::swap().
Referenced by Parma_Polyhedra_Library::DB_Matrix< T >::ascii_load().
00303 { 00304 dimension_type old_n_rows = rows.size(); 00305 00306 if (new_n_rows > old_n_rows) { 00307 // Rows will be inserted. 00308 if (new_n_rows <= row_capacity) { 00309 // We can recycle the old rows. 00310 if (rows.capacity() < new_n_rows) { 00311 // Reallocation (of vector `rows') will take place. 00312 std::vector<DB_Row<T> > new_rows; 00313 new_rows.reserve(compute_capacity(new_n_rows, max_num_rows())); 00314 new_rows.insert(new_rows.end(), new_n_rows, DB_Row<T>()); 00315 // Construct the new rows (be careful: each new row must have 00316 // the same capacity as each one of the old rows). 00317 dimension_type i = new_n_rows; 00318 while (i-- > old_n_rows) 00319 new_rows[i].construct(new_n_rows, row_capacity); 00320 // Steal the old rows. 00321 ++i; 00322 while (i-- > 0) 00323 new_rows[i].swap(rows[i]); 00324 // Put the new vector into place. 00325 std::swap(rows, new_rows); 00326 } 00327 else { 00328 // Reallocation (of vector `rows') will NOT take place. 00329 rows.insert(rows.end(), new_n_rows - old_n_rows, DB_Row<T>()); 00330 // Be careful: each new row must have 00331 // the same capacity as each one of the old rows. 00332 for (dimension_type i = new_n_rows; i-- > old_n_rows; ) 00333 rows[i].construct(new_n_rows, row_capacity); 00334 } 00335 } 00336 else { 00337 // We cannot even recycle the old rows: allocate a new matrix and swap. 00338 DB_Matrix new_matrix(new_n_rows); 00339 swap(new_matrix); 00340 return; 00341 } 00342 } 00343 else if (new_n_rows < old_n_rows) { 00344 // Drop some rows. 00345 rows.erase(rows.begin() + new_n_rows, rows.end()); 00346 // Shrink the existing rows. 00347 for (dimension_type i = new_n_rows; i-- > 0; ) 00348 rows[i].shrink(new_n_rows); 00349 old_n_rows = new_n_rows; 00350 } 00351 // Here we have the right number of rows. 00352 if (new_n_rows > row_size) { 00353 // We need more columns. 00354 if (new_n_rows <= row_capacity) 00355 // But we have enough capacity: we resize existing rows. 00356 for (dimension_type i = old_n_rows; i-- > 0; ) 00357 rows[i].expand_within_capacity(new_n_rows); 00358 else { 00359 // Capacity exhausted: we must reallocate the rows and 00360 // make sure all the rows have the same capacity. 00361 const dimension_type new_row_capacity 00362 = compute_capacity(new_n_rows, max_num_columns()); 00363 for (dimension_type i = old_n_rows; i-- > 0; ) { 00364 DB_Row<T> new_row(new_n_rows, new_row_capacity); 00365 std::swap(rows[i], new_row); 00366 } 00367 row_capacity = new_row_capacity; 00368 } 00369 } 00370 // DB_Rows have grown or shrunk. 00371 row_size = new_n_rows; 00372 }
| dimension_type Parma_Polyhedra_Library::DB_Matrix< T >::num_rows | ( | ) | const [inline] |
Returns the number of rows in the matrix.
Definition at line 156 of file DB_Matrix.inlines.hh.
References Parma_Polyhedra_Library::DB_Matrix< T >::rows.
Referenced by Parma_Polyhedra_Library::DB_Matrix< T >::ascii_dump(), Parma_Polyhedra_Library::DB_Matrix< T >::l_m_distance_assign(), Parma_Polyhedra_Library::DB_Matrix< T >::OK(), and Parma_Polyhedra_Library::DB_Matrix< T >::operator==().
00156 { 00157 return rows.size(); 00158 }
| DB_Row< T > & Parma_Polyhedra_Library::DB_Matrix< T >::operator[] | ( | dimension_type | k | ) | [inline] |
Returns a reference to the k-th row of the matrix.
Definition at line 142 of file DB_Matrix.inlines.hh.
References Parma_Polyhedra_Library::DB_Matrix< T >::rows.
| const DB_Row< T > & Parma_Polyhedra_Library::DB_Matrix< T >::operator[] | ( | dimension_type | k | ) | const [inline] |
Returns a constant reference to the k-th row of the matrix.
Definition at line 149 of file DB_Matrix.inlines.hh.
References Parma_Polyhedra_Library::DB_Matrix< T >::rows.
| void Parma_Polyhedra_Library::DB_Matrix< T >::ascii_dump | ( | ) | const |
Writes to std::cerr an ASCII representation of *this.
| void Parma_Polyhedra_Library::DB_Matrix< T >::ascii_dump | ( | std::ostream & | s | ) | const [inline] |
Writes to s an ASCII representation of *this.
Definition at line 376 of file DB_Matrix.inlines.hh.
References Parma_Polyhedra_Library::DB_Matrix< T >::num_rows().
00376 { 00377 const DB_Matrix<T>& x = *this; 00378 const char separator = ' '; 00379 const dimension_type nrows = x.num_rows(); 00380 s << nrows << separator << "\n"; 00381 for (dimension_type i = 0; i < nrows; ++i) { 00382 for (dimension_type j = 0; j < nrows; ++j) { 00383 using namespace IO_Operators; 00384 s << x[i][j] << separator; 00385 } 00386 s << "\n"; 00387 } 00388 }
| void Parma_Polyhedra_Library::DB_Matrix< T >::print | ( | ) | const |
Prints *this to std::cerr using operator<<.
| bool Parma_Polyhedra_Library::DB_Matrix< T >::ascii_load | ( | std::istream & | s | ) | [inline] |
Loads from s an ASCII representation (as produced by ascii_dump) and sets *this accordingly. Returns true if successful, false otherwise.
Definition at line 394 of file DB_Matrix.inlines.hh.
References Parma_Polyhedra_Library::DB_Matrix< T >::OK(), and Parma_Polyhedra_Library::DB_Matrix< T >::resize_no_copy().
00394 { 00395 dimension_type nrows; 00396 if (!(s >> nrows)) 00397 return false; 00398 resize_no_copy(nrows); 00399 DB_Matrix& x = *this; 00400 for (dimension_type i = 0; i < nrows; ++i) 00401 for (dimension_type j = 0; j < nrows; ++j) { 00402 Result r = input(x[i][j], s, ROUND_UP); 00403 // FIXME: V_CVT_STR_UNK is probably not the only possible error. 00404 if (!s || r == V_CVT_STR_UNK) 00405 return false; 00406 } 00407 // Check for well-formedness. 00408 assert(OK()); 00409 return true; 00410 }
| bool Parma_Polyhedra_Library::DB_Matrix< T >::OK | ( | ) | const [inline] |
Checks if all the invariants are satisfied.
Definition at line 620 of file DB_Matrix.inlines.hh.
References Parma_Polyhedra_Library::DB_Matrix< T >::num_rows(), Parma_Polyhedra_Library::DB_Matrix< T >::row_capacity, and Parma_Polyhedra_Library::DB_Matrix< T >::row_size.
Referenced by Parma_Polyhedra_Library::DB_Matrix< T >::ascii_load(), and Parma_Polyhedra_Library::DB_Matrix< T >::DB_Matrix().
00620 { 00621 #ifndef NDEBUG 00622 using std::endl; 00623 using std::cerr; 00624 #endif 00625 00626 // The matrix must be square. 00627 if (num_rows() != row_size) { 00628 #ifndef NDEBUG 00629 cerr << "DB_Matrix has fewer columns than rows:\n" 00630 << "row_size is " << row_size 00631 << ", num_rows() is " << num_rows() << "!" 00632 << endl; 00633 #endif 00634 return false; 00635 } 00636 00637 const DB_Matrix& x = *this; 00638 const dimension_type n_rows = x.num_rows(); 00639 for (dimension_type i = 0; i < n_rows; ++i) { 00640 if (!x[i].OK(row_size, row_capacity)) 00641 return false; 00642 } 00643 00644 // All checks passed. 00645 return true; 00646 }
Parma_Polyhedra_Library::DB_Matrix< T >::DB_Matrix [friend] |
Definition at line 160 of file DB_Matrix.defs.hh.
| std::ostream & operator<< | ( | std::ostream & | s, | |
| const DB_Matrix< T > & | c | |||
| ) | [related] |
Output operator.
Definition at line 653 of file DB_Matrix.inlines.hh.
00653 { 00654 const dimension_type n = c.num_rows(); 00655 for (dimension_type i = 0; i < n; ++i) { 00656 for (dimension_type j = 0; j < n; ++j) 00657 s << c[i][j] << " "; 00658 s << "\n"; 00659 } 00660 return s; 00661 }
| void swap | ( | Parma_Polyhedra_Library::DB_Matrix< T > & | x, | |
| Parma_Polyhedra_Library::DB_Matrix< T > & | y | |||
| ) | [related] |
Specializes std::swap.
Definition at line 672 of file DB_Matrix.inlines.hh.
References Parma_Polyhedra_Library::DB_Matrix< T >::swap().
00673 { 00674 x.swap(y); 00675 }
| bool operator== | ( | const DB_Matrix< T > & | x, | |
| const DB_Matrix< T > & | y | |||
| ) | [related] |
Returns true if and only if x and y are identical.
Definition at line 418 of file DB_Matrix.inlines.hh.
References Parma_Polyhedra_Library::DB_Matrix< T >::num_rows().
00418 { 00419 const dimension_type x_num_rows = x.num_rows(); 00420 if (x_num_rows != y.num_rows()) 00421 return false; 00422 for (dimension_type i = x_num_rows; i-- > 0; ) 00423 if (x[i] != y[i]) 00424 return false; 00425 return true; 00426 }
| bool operator!= | ( | const DB_Matrix< T > & | x, | |
| const DB_Matrix< T > & | y | |||
| ) | [related] |
Returns true if and only if x and y are different.
Definition at line 165 of file DB_Matrix.inlines.hh.
| bool rectilinear_distance_assign | ( | Checked_Number< To, Extended_Number_Policy > & | r, | |
| const DB_Matrix< T > & | x, | |||
| const DB_Matrix< T > & | y, | |||
| const 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 to 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.
Definition at line 534 of file DB_Matrix.inlines.hh.
00540 { 00541 return 00542 l_m_distance_assign<Rectilinear_Distance_Specialization<Temp> >(r, x, y, 00543 dir, 00544 tmp0, 00545 tmp1, 00546 tmp2); 00547 }
| bool euclidean_distance_assign | ( | Checked_Number< To, Extended_Number_Policy > & | r, | |
| const DB_Matrix< T > & | x, | |||
| const DB_Matrix< T > & | y, | |||
| const 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 to 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.
Definition at line 569 of file DB_Matrix.inlines.hh.
00575 { 00576 return 00577 l_m_distance_assign<Euclidean_Distance_Specialization<Temp> >(r, x, y, 00578 dir, 00579 tmp0, 00580 tmp1, 00581 tmp2); 00582 }
| bool l_infinity_distance_assign | ( | Checked_Number< To, Extended_Number_Policy > & | r, | |
| const DB_Matrix< T > & | x, | |||
| const DB_Matrix< T > & | y, | |||
| const 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 to 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.
Definition at line 603 of file DB_Matrix.inlines.hh.
00609 { 00610 return 00611 l_m_distance_assign<L_Infinity_Distance_Specialization<Temp> >(r, x, y, 00612 dir, 00613 tmp0, 00614 tmp1, 00615 tmp2); 00616 }
| bool l_m_distance_assign | ( | Checked_Number< To, Extended_Number_Policy > & | r, | |
| const DB_Matrix< T > & | x, | |||
| const DB_Matrix< T > & | y, | |||
| const Rounding_Dir | dir, | |||
| Temp & | tmp0, | |||
| Temp & | tmp1, | |||
| Temp & | tmp2 | |||
| ) | [related] |
Definition at line 468 of file DB_Matrix.inlines.hh.
References Parma_Polyhedra_Library::assign_r(), Parma_Polyhedra_Library::is_plus_infinity(), Parma_Polyhedra_Library::maybe_assign(), Parma_Polyhedra_Library::DB_Matrix< T >::num_rows(), and Parma_Polyhedra_Library::PLUS_INFINITY.
00474 { 00475 const dimension_type x_num_rows = x.num_rows(); 00476 if (x_num_rows != y.num_rows()) 00477 return false; 00478 assign_r(tmp0, 0, ROUND_NOT_NEEDED); 00479 for (dimension_type i = x_num_rows; i-- > 0; ) { 00480 const DB_Row<T>& x_i = x[i]; 00481 const DB_Row<T>& y_i = y[i]; 00482 for (dimension_type j = x_num_rows; j-- > 0; ) { 00483 const T& x_i_j = x_i[j]; 00484 const T& y_i_j = y_i[j]; 00485 if (is_plus_infinity(x_i_j)) { 00486 if (is_plus_infinity(y_i_j)) 00487 continue; 00488 else { 00489 pinf: 00490 r = PLUS_INFINITY; 00491 return true; 00492 } 00493 } 00494 else if (is_plus_infinity(y_i_j)) 00495 goto pinf; 00496 00497 const Temp* tmp1p; 00498 const Temp* tmp2p; 00499 if (x_i_j > y_i_j) { 00500 maybe_assign(tmp1p, tmp1, x_i_j, dir); 00501 maybe_assign(tmp2p, tmp2, y_i_j, inverse(dir)); 00502 } 00503 else { 00504 maybe_assign(tmp1p, tmp1, y_i_j, dir); 00505 maybe_assign(tmp2p, tmp2, x_i_j, inverse(dir)); 00506 } 00507 sub_assign_r(tmp1, *tmp1p, *tmp2p, dir); 00508 assert(tmp1 >= 0); 00509 Specialization::combine(tmp0, tmp1, dir); 00510 } 00511 } 00512 Specialization::finalize(tmp0, dir); 00513 assign_r(r, tmp0, dir); 00514 return true; 00515 }
std::vector<DB_Row<T> > Parma_Polyhedra_Library::DB_Matrix< T >::rows [private] |
The rows of the matrix.
Definition at line 163 of file DB_Matrix.defs.hh.
Referenced by Parma_Polyhedra_Library::DB_Matrix< T >::begin(), Parma_Polyhedra_Library::DB_Matrix< T >::DB_Matrix(), Parma_Polyhedra_Library::DB_Matrix< T >::end(), Parma_Polyhedra_Library::DB_Matrix< T >::grow(), Parma_Polyhedra_Library::DB_Matrix< T >::num_rows(), Parma_Polyhedra_Library::DB_Matrix< T >::operator=(), Parma_Polyhedra_Library::DB_Matrix< T >::operator[](), Parma_Polyhedra_Library::DB_Matrix< T >::resize_no_copy(), and Parma_Polyhedra_Library::DB_Matrix< T >::swap().
dimension_type Parma_Polyhedra_Library::DB_Matrix< T >::row_size [private] |
Size of the initialized part of each row.
Definition at line 166 of file DB_Matrix.defs.hh.
Referenced by Parma_Polyhedra_Library::DB_Matrix< T >::grow(), Parma_Polyhedra_Library::DB_Matrix< T >::OK(), Parma_Polyhedra_Library::DB_Matrix< T >::operator=(), Parma_Polyhedra_Library::DB_Matrix< T >::resize_no_copy(), and Parma_Polyhedra_Library::DB_Matrix< T >::swap().
dimension_type Parma_Polyhedra_Library::DB_Matrix< T >::row_capacity [private] |
Capacity allocated for each row, i.e., number of long objects that each row can contain.
Definition at line 172 of file DB_Matrix.defs.hh.
Referenced by Parma_Polyhedra_Library::DB_Matrix< T >::DB_Matrix(), Parma_Polyhedra_Library::DB_Matrix< T >::grow(), Parma_Polyhedra_Library::DB_Matrix< T >::OK(), Parma_Polyhedra_Library::DB_Matrix< T >::operator=(), Parma_Polyhedra_Library::DB_Matrix< T >::resize_no_copy(), and Parma_Polyhedra_Library::DB_Matrix< T >::swap().
1.5.6