NAG Library Routine Document

f11yef  (sym_rcm)

 Contents

    1  Purpose
    7  Accuracy

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

Fortran Interface
Subroutine f11yef ( n, nnz, icolzp, irowix, lopts, mask, perm, info, ifail)
Integer, Intent (In):: n, nnz, icolzp(n+1), irowix(nnz), mask(*)
Integer, Intent (Inout):: ifail
Integer, Intent (Out):: perm(n), info(4)
Logical, Intent (In):: lopts(5)
C Header Interface
#include nagmk26.h
void  f11yef_ ( const Integer *n, const Integer *nnz, const Integer icolzp[], const Integer irowix[], const logical lopts[], const Integer mask[], Integer perm[], Integer info[], Integer *ifail)

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 PAPTPx=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
Arguments

1:     n – IntegerInput
On entry: n, the order of the matrix A.
Constraint: n1.
2:     nnz – IntegerInput
On entry: the number of nonzero elements in the matrix A.
Constraint: nnz0.
3:     icolzpn+1 – Integer arrayInput
On entry: icolzp records the index into irowix which starts each new column.
Constraints:
  • 1icolzpinnz+1, for i=2,3,,n;
  • icolzp1=1;
  • icolzpn+1=nnz+1, where icolzpi holds the position integer for the starts of the columns in irowix.
4:     irowixnnz – Integer arrayInput
On entry: the row indices corresponding to the nonzero elements in the matrix A.
Constraint: 1irowixin, for i=1,2,,nnz.
5:     lopts5 – Logical arrayInput
On entry: the options to be used by f11yef.
lopts1=.TRUE.
Row/column i of the matrix A will only be referenced if maski0, otherwise mask will be ignored.
lopts2=.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)).
lopts3=.TRUE.
The matrix A will be checked for symmetrical sparsity pattern, otherwise not.
lopts4=.TRUE.
The bandwidth and profile of the unpermuted matrix will be calculated, otherwise not.
lopts5=.TRUE.
The bandwidth and profile of the permuted matrix will be calculated, otherwise not.
6:     mask* – Integer arrayInput
Note: the dimension of the array mask must be at least n if lopts1=.TRUE., and at least 0 otherwise.
On entry: mask is only referenced if lopts1 is .TRUE.. A value of maski=0 indicates that the node corresponding to row or column i is not to be referenced. A value of maski0 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:     permn – 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 permi, i=1,2,n.
8:     info4 – 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.
info1
The bandwidth of the matrix A, if lopts4=.TRUE..
info2
The profile of the matrix A, if lopts4=.TRUE..
info3
The bandwidth of the permuted matrix PAPT, if lopts5=.TRUE..
info4
The profile of the permuted matrix PAPT, if lopts5=.TRUE..
9:     ifail – IntegerInput/Output
On entry: ifail must be set to 0, -1​ or ​1. If you are unfamiliar with this argument you should refer to Section 3.4 in How to Use the NAG Library and its Documentation for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value -1​ 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 argument, the recommended value is 0. When the value -1​ or ​1 is used it is essential to test the value of ifail on exit.
On exit: ifail=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6
Error Indicators and Warnings

If on entry ifail=0 or -1, explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
ifail=1
On entry, n=value.
Constraint: n1.
ifail=2
On entry, nnz=value.
Constraint: nnz1.
ifail=3
On entry, irowixvalue=value and n=value.
Constraint: 1irowixin for all i.
ifail=4
On entry, icolzpvalue=value and nnz=value.
Constraint: 1icolzpinnz for all i.
ifail=5
On entry, icolzp1=value.
Constraint: icolzp1=1.
On entry, icolzpn+1=value and nnz=value.
Constraint: icolzpn+1=nnz+1.
ifail=6
On entry, the matrix A is not symmetric.
Element value,value has no symmetric element.
ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 3.9 in How to Use the NAG Library and its Documentation for further information.
ifail=-399
Your licence key may have expired or may not have been installed correctly.
See Section 3.8 in How to Use the NAG Library and its Documentation for further information.
ifail=-999
Dynamic memory allocation failed.
See Section 3.7 in How to Use the NAG Library and its Documentation for further information.

7
Accuracy

Not applicable.

8
Parallelism and Performance

f11yef is not threaded in any implementation.

9
Further Comments

The bandwidth for a matrix A=aij is defined as
b = maxij i-j ,   i,j=1,2,,n​ s.t. ​aij0 .  
The profile is defined as
p = j=1 n bj ,  where ​ bj = max i i-j ,   i=1,2,n ​ s.t. ​ aij0 .  

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)

GnuplotProduced by GNUPLOT 4.6 patchlevel 3 Example Program Figure 1 : Original Matrix Ordering gnuplot_plot_1
GnuplotProduced by GNUPLOT 4.6 patchlevel 3 Figure 2 : Reverse Cuthill-McKee Reordering gnuplot_plot_1
© The Numerical Algorithms Group Ltd, Oxford, UK. 2017