banded<int MemLoc=internal> [MTL Home] Programmers Guide
  Contents | Index |  Search 


Category:containers,selectors Component type:type
Description

Shape Type Selectors

A banded shape matrix is one in which non-zero matrix elements only appear within a ``band'' of a matrix. The bandwidth of a matrix is described by the number of diagonals in the band that are below the main diagonal, refered to as the sub diagonals, and the number of diagonals in the band above the main diagonal, refered to as the super diagonals. The following is an example of a matrix with a bandwidth of (1,2).
 [  1   2   3   0   0 ]
 [  4   5   6   7   0 ]
 [  0   8   9  10  11 ]
 [  0   0  12  13  14 ]
 [  0   0   0  15  16 ]
 
There are many storage types that can be used to efficiently represent banded matrices. The MTL storage types that can be used are banded, packed, banded_view, and array. Here are some examples of creating banded matrix types:
 typedef matrix < double,
                  banded<>, 
                  packed<>,
                  column_major >::type BLAS_Packed;

 typedef matrix < double,
                  banded<>, 
                  banded<>,
                  column_major >::type BLAS_Banded;
 

Storage Type Selectors

banded is also the type selectors for the banded storage format. This storage format is equivalent to the banded storage used in the BLAS and LAPACK. Similar to the dense storage format, a single contiguous chunk of memory is allocated. The banded storage format maps the bands of the matrix to a twod-array of dimension (sub + super + 1) by min(M, N + sub). In MTL the 2D array can be row or column major (for the BLAS it is always column major). The twod-array is then in turn mapped the the linear memory space of the single chunk of memory. The following is an example banded matrix with the mapping to the row-major and column-major 2D arrays. The x's represent memory locations that are not used.
 [  1   2   3   0   0   0  ]
 [  4   5   6   7   0   0  ]
 [  0   8   9  10  11   0  ]
 [  0   0  12  13  14  15  ]
 [  0   0   0  16  17  18  ]
 [  0   0   0   0  19  20  ]

 row-major
 [  1   2   3   x  ]
 [  4   5   6   7  ]
 [  8   9  10  11  ]
 [ 12  13  14  15  ]
 [  x  16  17  18  ]
 [  x   x  19  20  ]

 column-major
 [  x   x   3   7  11  15  ]
 [  x   2   6  10  14  18  ]
 [  1   5   9  13  17  20  ]
 [  4   8  12  16  19   x  ]
 
Example
Definition
matrix.h
Template Parameters

ParameterDescriptionDefault
MemLocSpecify whether the memory used is "owned" by the matrix or if it was provided to the matrix from some external source (with a pointer to some data) internal
Model of
Members
Member Where defined Description
size_type    
enum { id = BAND, oned_id, uplo, ext=MemLoc, M=0, N=0, issparse=0, index }    
New members
Notes
See also

[MTL Home] Copyright © 1998,1999 University of Notre Dame. All Rights Reserved.