3.1 Matrix Classes

The BLAS exploit several types of matrix structure: symmetric, Hermitian, triangular, and banded. We represent all these matrix classes by dense real or complex matrix objects, with additional arguments that specify the structure.

Vector
A real or complex n-vector is represented by a matrix of type 'd' or 'z' and length n, with the entries of the vector stored in column-major order.

General matrix
A general real or complex m by n matrix is represented by a real or complex matrix of size (m, n).

Symmetric matrix
A real or complex symmetric matrix of order n is represented by a real or complex matrix of size (n, n), and a character argument uplo with two possible values: 'L' and 'U'. If uplo is 'L', the lower triangular part of the symmetric matrix is stored; if uplo is 'U', the upper triangular part is stored. A square matrix X of size (n, n) can therefore be used to represent the symmetric matrices

\begin{eqnarray*}
& \left[\begin{array}{ccccc}
X[0,0] & X[1,0] & X[2,0] & \cdots...
...& \cdots & X[n-1,n-1]
\end{array}\right] & \mbox{if uplo = U'}.
\end{eqnarray*}


Complex Hermitian matrix
A complex Hermitian matrix of order n is represented by a matrix of type 'z' and size (n, n), and a character argument uplo with the ame meaning as for symmetric matrices. A complex matrix X of size (n, n) can represent the Hermitian matrices

\begin{eqnarray*}
&
\left[\begin{array}{ccccc}
\Re X[0,0] & \bar X[1,0] & \bar X...
...dots & \Re X[n-1,n-1]
\end{array}\right] & \mbox{if uplo = 'U'}.
\end{eqnarray*}


Triangular matrix
A real or complex triangular matrix of order n is represented by a real or complex matrix of size (n, n), and two character arguments: an argument uplo with possible values 'L' and 'U' to distinguish between lower and upper triangular matrices, and an argument diag with possible values 'U' and 'N' to distinguish between unit and non-unit triangular matrices. A square matrix X of size (n, n) can represent the triangular matrices

\begin{eqnarray*}
& \left[\begin{array}{ccccc}
X[0,0] & 0 & 0 & \cdots & 0 \\
X...
...ts & 1
\end{array}\right] & \mbox{if uplo = 'U' and diag = 'U'}.
\end{eqnarray*}


General band matrix
A general real or complex m by n band matrix with kl subdiagonals and ku superdiagonals is represented by a real or complex matrix X of size (kl+ku+1, n), and the two integers m and kl. The diagonals of the band matrix are stored in the rows of X, starting at the top diagonal, and shifted horizontally so that the entries of the kth column of the band matrix are stored in column k of X. A matrix X of size (kl+ku+1, n) therefore represents the m by n band matrix

\begin{displaymath}
\left[ \begin{array}{ccccccc}
X[k_u,0] & X[k_u-1,1] & X[k_u-...
...
\vdots & \vdots & \vdots & \ddots & & &
\end{array}\right].
\end{displaymath}

Symmetric band matrix
A real or complex symmetric band matrix of order n with k subdiagonals, is represented by a real or complex matrix X of size (k+1, n), and an argument uplo to indicate whether the subdiagonals (uplo is 'L') or superdiagonals (uplo is 'U') are stored. The k+1 diagonals are stored as rows of X, starting at the top diagonal (i.e., the main diagonal if uplo is 'L', or the kth superdiagonal if uplo is 'U') and shifted horizontally so that the entries of the kth column of the band matrix are stored in column k of X. A matrix X of size (k+1, n) can therefore represent the band matrices

\begin{eqnarray*}
& \left[ \begin{array}{ccccccc}
X[0,0] & X[1,0] & X[2,0] & \cd...
... \vdots & \ddots & & &
\end{array}\right] & \mbox{if uplo='U'}.
\end{eqnarray*}


Hermitian band matrix
A complex Hermitian band matrix of order n with k subdiagonals is represented by a complex matrix of size (k+1, n) and an argument uplo. A matrix X of size (k+1, n) can represent the band matrices

\begin{eqnarray*}
& \left[ \begin{array}{ccccccc}
\Re X[0,0] & \bar X[1,0] & \ba...
... \vdots & \ddots & & &
\end{array}\right] & \mbox{if uplo='U'}.
\end{eqnarray*}


Triangular band matrix
A triangular band matrix of order n with k subdiagonals or superdiagonals is represented by a real complex matrix of size (k+1, n) and two character arguments uplo and diag. A matrix X of size (k+1, n) can represent the band matrices

\begin{eqnarray*}
& \left[ \begin{array}{cccc}
X[0,0] & 0 & 0 & \cdots \\
X[1,0...
...ddots
\end{array}\right] & \mbox{if uplo = 'U' and diag = 'U'}.
\end{eqnarray*}


When discussing BLAS functions in the following sections we will omit several less important optional arguments that can be used to select submatrices for in-place operations. The complete specification is documented in the docstrings of the source code and the pydoc help program.