The triangular shape is a special case of the banded shape. There
are four kinds of triangular matrices in MTL, based on the
Uplo argument:
Uplo type  Sub  Super 
upper  0  N  1 
unit_upper  1  N  1 
lower  M  1  0 
unit_lower  M  1  1 
The following is an example of a triangle<upper> shaped
matrix:
[ 1 2 3 4 5 ]
[ 0 6 7 8 9 ]
[ 0 0 10 11 12 ]
[ 0 0 0 13 14 ]
[ 0 0 0 0 15 ]
The next example is of a triangle<unit_lower>
matrix. The main diagonal is not stored, since it consists of
all ones. The MTL algorithms recognize when a matrix is ``unit''
and perform a slightly different operation to take this into
account. The ones will not show up in an iteration of the
matrix, and access to the A(i,i) element of a unit lower/upper
matrix is an error.
[ 1 0 0 0 0 ]
[ 1 1 0 0 0 ]
[ 2 3 1 0 0 ]
[ 4 5 6 1 0 ]
[ 7 8 9 10 1 ]
Here are a couple examples of creating some triangular matrix types:
typedef matrix < double,
triangle,
banded<>,
column_major >::type UpperTriangle;
typedef matrix < double,
triangle,
packed<>,
row_major >::type UnitLowerTriangle;
