Matrix Precision and Shape
There are two aspects to each matrix's type provided with the Linear Algebra Module: precision and shape.
The
precision of a matrix determines the type of elements that are stored in it. For example, float double, double complex, and int are all examples of a matrix precision.
The
shape of a matrix determines which entries in the matrix are allowed to be nonzero, and sometimes specifies that certain elements in the matrix must be related to each other. For example, in a symmetric banded matrix, only elements in the center band of the matrix are nonzero; they must also be symmetric about the main diagonal.
The matrix precision is concatenated to the matrix shape to create the complete matrix type. For example, the
RWBandMat<DComplex> type holds matrices of banded shape containing elements of double complex precision.
Following this paragraph is a list of each of the available matrix shapes and the types available for each shape. A more complete description of each shape, including technical details like the storage scheme used, are in the
SourcePro API Reference Guide.
General matrix. A
general matrix is a rectangular matrix with arbitrary entries. General matrices arise frequently in many areas of math and science. The general matrix types are part of the Essential Math Module and are described fully in that module’s documentation. The following types are provided:
RWGenMat<double>,
RWGenMat<float>,
RWGenMat<DComplex>,
RWGenMat<int>,
RWGenMat<UChar>,
RWGenMat<SChar>.
Symmetric matrix. A
symmetric matrix is a square matrix with the property that the matrix is equal to its transpose. Symmetric matrices are often used to represent quadratic forms; for example, the energy in a system can be represented as a symmetric matrix. Many problems lead to systems of equations which can be represented using symmetric matrices. The following template class is provided:
RWSymMat<T>.
Hermitian matrix. The complex analog of a symmetric matrix is a
Hermitian matrix. A symmetric matrix is equal to its own transpose; a Hermitian matrix is equal to its conjugate transpose. A symmetric matrix is a special case of a Hermitian matrix where all the elements are real. Hermitian matrices are used in the same kinds of situations as symmetric matrices. The Hermitian type is
RWHermMat<T>.
Skew symmetric matrix. A
skew symmetric matrix has the property that an off-diagonal element
(i,j) is equal to the negative of element
(j,i). Actually, the strict mathematical definition restricts diagonal entries to be 0, but this is
not enforced in the skew symmetric classes. You can think of
RWSkewMat<T> as the sum of a skew symmetric and a diagonal matrix. Skew- symmetric matrices are often used in computer graphics applications to represent rotation matrices.
Banded matrix. A
banded matrix is non-zero only near the diagonal. Specifically, entries farther above the diagonal than the upper bandwidth, or farther below than the lower bandwidth, are defined to be 0. Banded matrices represent systems of equations where each equation relates variables pertaining to nearby quantities. For example, one-dimensional finite difference problems lead to systems of equations represented with a banded matrix. The general banded matrix type is
RWBandMat<T>.
Symmetric banded matrix. A
symmetric banded matrix is both symmetric and banded. Symmetric banded matrices are often used to represent equations in one-dimensional finite element problems. The symmetric banded type is
RWSymBandMat<T>.
Hermitian banded matrix. The complex analog of a symmetric banded matrix is a
Hermitian banded matrix, which is both banded and Hermitian. Hermitian banded matrices are used in solving elliptic partial differential equations in a complex variable. The Hermitian banded type is
RWHermBandMat<T>.
Lower-triangular matrix. A
lower-triangular matrix is 0 above and to the right of the main diagonal. Lower triangular matrices represent systems of equations where each variable depends only on the preceding variables. The lower-triangular matrix type is
RWLowerTriMat<T>.
Upper-triangular matrix. An
upper-triangular matrix is 0 below and to the left of the main diagonal. Upper-triangular matrices represent systems of equations where each variable depends only on the following variables. The upper-triangular matrix type is
RWUpperTriMat<T>.