F11 Chapter Contents
F11 Chapter Introduction
NAG Library Manual

NAG Library Routine DocumentF11YEF

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

1  Purpose

F11YEF reduces the bandwidth of a sparse symmetric matrix stored in compressed column storage format using the Reverse Cuthill–McKee algorithm.

2  Specification

 SUBROUTINE F11YEF ( N, NNZ, ICOLZP, IROWIX, LOPTS, MASK, PERM, INFO, IFAIL)
 INTEGER N, NNZ, ICOLZP(N+1), IROWIX(NNZ), MASK(*), PERM(N), INFO(4), IFAIL LOGICAL LOPTS(5)

3  Description

F11YEF takes the compressed column storage (CCS) representation (see Section 2.1.3 in the F11 Chapter Introduction) of an $n$ by $n$ symmetric matrix $A$ and applies the Reverse Cuthill–McKee (RCM) algorithm which aims to minimize the bandwidth of the matrix $A$ by reordering the rows and columns symmetrically. This also results in a lower profile of the matrix (see Section 9).
F11YEF can be useful for solving systems of equations $Ax=b$, as the permuted system $PA{P}^{\mathrm{T}}\left(Px\right)=Pb$ (where $P$ is the permutation matrix described by the vector PERM returned by F11YEF) may require less storage space and/or less computational steps when solving (see Wai-Hung and Sherman (1976)).
F11YEF may be used prior to F11JAF and F11JBF (see Section 10 in F11JBF).

4  References

Pissanetsky S (1984) Sparse Matrix Technology Academic Press
Wai-Hung L and Sherman A H (1976) Comparative analysis of the Cuthill–McKee and the reverse Cuthill–McKee ordering algorithms for sparse matrices SIAM J. Numer. Anal. 13(2) 198–213

5  Parameters

1:     $\mathrm{N}$ – INTEGERInput
On entry: $n$, the order of the matrix $A$.
Constraint: ${\mathbf{N}}\ge 1$.
2:     $\mathrm{NNZ}$ – INTEGERInput
On entry: the number of nonzero elements in the matrix $A$.
Constraint: ${\mathbf{NNZ}}\ge 0$.
3:     $\mathrm{ICOLZP}\left({\mathbf{N}}+1\right)$ – INTEGER arrayInput
On entry: ICOLZP records the index into IROWIX which starts each new column.
Constraints:
• $1\le {\mathbf{ICOLZP}}\left(\mathit{i}\right)\le {\mathbf{NNZ}}+1$, for $\mathit{i}=2,3,\dots ,{\mathbf{N}}$;
• ${\mathbf{ICOLZP}}\left(1\right)=1$;
• ${\mathbf{ICOLZP}}\left({\mathbf{N}}+1\right)={\mathbf{NNZ}}+1$, where ${\mathbf{ICOLZP}}\left(i\right)$ holds the position integer for the starts of the columns in IROWIX.
4:     $\mathrm{IROWIX}\left({\mathbf{NNZ}}\right)$ – INTEGER arrayInput
On entry: the row indices corresponding to the nonzero elements in the matrix $A$.
Constraint: $1\le {\mathbf{IROWIX}}\left(\mathit{i}\right)\le {\mathbf{N}}$, for $\mathit{i}=1,2,\dots ,{\mathbf{NNZ}}$.
5:     $\mathrm{LOPTS}\left(5\right)$ – LOGICAL arrayInput
On entry: the options to be used by F11YEF.
${\mathbf{LOPTS}}\left(1\right)=\mathrm{.TRUE.}$
Row/column $i$ of the matrix $A$ will only be referenced if ${\mathbf{MASK}}\left(i\right)\ne 0$, otherwise ${\mathbf{MASK}}$ will be ignored.
${\mathbf{LOPTS}}\left(2\right)=\mathrm{.TRUE.}$
The final permutation will not be reversed, that is, the Cuthill–McKee ordering will be returned. The bandwidth of the non-reversed matrix will be the same but the profile will be the same or larger (see Wai-Hung and Sherman (1976)).
${\mathbf{LOPTS}}\left(3\right)=\mathrm{.TRUE.}$
The matrix $A$ will be checked for symmetrical sparsity pattern, otherwise not.
${\mathbf{LOPTS}}\left(4\right)=\mathrm{.TRUE.}$
The bandwidth and profile of the unpermuted matrix will be calculated, otherwise not.
${\mathbf{LOPTS}}\left(5\right)=\mathrm{.TRUE.}$
The bandwidth and profile of the permuted matrix will be calculated, otherwise not.
6:     $\mathrm{MASK}\left(*\right)$ – INTEGER arrayInput
Note: the dimension of the array MASK must be at least ${\mathbf{N}}$ if ${\mathbf{LOPTS}}\left(1\right)=\mathrm{.TRUE.}$, and at least $0$ otherwise.
On entry: MASK is only referenced if ${\mathbf{LOPTS}}\left(1\right)$ is .TRUE.. A value of ${\mathbf{MASK}}\left(i\right)=0$ indicates that the node corresponding to row or column $i$ is not to be referenced. A value of ${\mathbf{MASK}}\left(i\right)\ne 0$ indicates that the node corresponding to row or column $i$ is to be referenced. In particular, rows and columns not referenced will not be permuted.
7:     $\mathrm{PERM}\left({\mathbf{N}}\right)$ – INTEGER arrayOutput
On exit: this will contain the permutation vector that describes the permutation matrix $P$ for the reordering of the matrix $A$. The elements of the permutation matrix $P$ are zero except for the unit elements in row $i$ and column ${\mathbf{PERM}}\left(i\right)$, $i=1,2,\dots n$.
8:     $\mathrm{INFO}\left(4\right)$ – INTEGER arrayOutput
On exit: statistics about the matrix $A$ and the permuted matrix. The quantities below are calculated using any masking in effect otherwise the value zero is returned.
${\mathbf{INFO}}\left(1\right)$
The bandwidth of the matrix $A$, if ${\mathbf{LOPTS}}\left(4\right)=\mathrm{.TRUE.}$.
${\mathbf{INFO}}\left(2\right)$
The profile of the matrix $A$, if ${\mathbf{LOPTS}}\left(4\right)=\mathrm{.TRUE.}$.
${\mathbf{INFO}}\left(3\right)$
The bandwidth of the permuted matrix $PA{P}^{\mathrm{T}}$, if ${\mathbf{LOPTS}}\left(5\right)=\mathrm{.TRUE.}$.
${\mathbf{INFO}}\left(4\right)$
The profile of the permuted matrix $PA{P}^{\mathrm{T}}$, if ${\mathbf{LOPTS}}\left(5\right)=\mathrm{.TRUE.}$.
9:     $\mathrm{IFAIL}$ – INTEGERInput/Output
On entry: IFAIL must be set to $0$, $-1\text{​ or ​}1$. If you are unfamiliar with this parameter you should refer to Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value $-1\text{​ or ​}1$ is recommended. If the output of error messages is undesirable, then the value $1$ is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is $0$. When the value $-\mathbf{1}\text{​ or ​}\mathbf{1}$ is used it is essential to test the value of IFAIL on exit.
On exit: ${\mathbf{IFAIL}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see Section 6).

6  Error Indicators and Warnings

If on entry ${\mathbf{IFAIL}}={\mathbf{0}}$ or $-{\mathbf{1}}$, explanatory error messages are output on the current error message unit (as defined by X04AAF).
Errors or warnings detected by the routine:
${\mathbf{IFAIL}}=1$
On entry, ${\mathbf{N}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{N}}\ge 1$.
${\mathbf{IFAIL}}=2$
On entry, ${\mathbf{NNZ}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{NNZ}}\ge 1$.
${\mathbf{IFAIL}}=3$
On entry, ${\mathbf{IROWIX}}\left(〈\mathit{\text{value}}〉\right)=〈\mathit{\text{value}}〉$ and ${\mathbf{N}}=〈\mathit{\text{value}}〉$.
Constraint: $1\le {\mathbf{IROWIX}}\left(i\right)\le {\mathbf{N}}$ for all $i$.
${\mathbf{IFAIL}}=4$
On entry, ${\mathbf{ICOLZP}}\left(〈\mathit{\text{value}}〉\right)=〈\mathit{\text{value}}〉$ and ${\mathbf{NNZ}}=〈\mathit{\text{value}}〉$.
Constraint: $1\le {\mathbf{ICOLZP}}\left(i\right)\le {\mathbf{NNZ}}$ for all $i$.
${\mathbf{IFAIL}}=5$
On entry, ${\mathbf{ICOLZP}}\left(1\right)=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{ICOLZP}}\left(1\right)=1$.
On entry, ${\mathbf{ICOLZP}}\left({\mathbf{N}}+1\right)=〈\mathit{\text{value}}〉$ and ${\mathbf{NNZ}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{ICOLZP}}\left({\mathbf{N}}+1\right)={\mathbf{NNZ}}+1$.
${\mathbf{IFAIL}}=6$
On entry, the matrix $A$ is not symmetric.
Element $\left(〈\mathit{\text{value}}〉,〈\mathit{\text{value}}〉\right)$ has no symmetric element.
${\mathbf{IFAIL}}=-99$
See Section 3.8 in the Essential Introduction for further information.
${\mathbf{IFAIL}}=-399$
Your licence key may have expired or may not have been installed correctly.
See Section 3.7 in the Essential Introduction for further information.
${\mathbf{IFAIL}}=-999$
Dynamic memory allocation failed.
See Section 3.6 in the Essential Introduction for further information.

Not applicable.

8  Parallelism and Performance

Not applicable.

The bandwidth for a matrix $A=\left({a}_{ij}\right)$ is defined as
 $b = maxij i-j , i,j=1,2,…,n​ s.t. ​aij≠0 .$
The profile is defined as
 $p = ∑ j=1 n bj , where ​ bj = max i i-j , i=1,2,…n ​ s.t. ​ aij≠0 .$

10  Example

This example reads the CCS representation of a real sparse matrix $A$ and calls F11YEF to reorder the rows and columns and displays the results.

10.1  Program Text

Program Text (f11yefe.f90)

10.2  Program Data

Program Data (f11yefe.d)

10.3  Program Results

Program Results (f11yefe.r)