|
|
|
Category:containers |
Component type:concept |
|
 |
Description
|
A diagonal matrix is quite different from the normal MTL Matrix.
Instead of the OneD parts of the Matrix being Rows or Columns, the
OneD parts of this Matrix are diagonals of the matrix. The below
example shows a piece of code that uses the iterators of a diagonal
matrix to fill up the matrix with incrementing numbers. The
matrix depicted below is the result of the code applied to
a diagonal matrix. The iterators traverse along the diagonals
of the Matrix instead of the rows or columns.
int c = 0;
typename Matrix::const_iterator i;
typename Matrix::OneD::const_iterator j;
for (i = A.begin(); i != A.end(); i) {
for ( j = (*i).begin(); j != (*i).end(); j) {
c = c + 1;
*j = c;
}
}
[ 4 1 ]
[ 8 5 2 ]
[ 9 6 3 ]
[ 10 7 ]
|
 |
Refinement of
|
|
 |
Associated types
|
Concept |
Type name |
Description |
Vector
|
X::Diagonal
|
Diagonal type, same as Matrix::OneD
|
|
 |
Notations
|
|
 |
Definitions
|
|
 |
Expression semantics
|
Description |
Expression |
Semantics |
|
 |
Function specification
|
|
 |
Invariants
|
|
 |
Models
|
|
 |
Notes
|
|
 |
See also
|
|