NAG CL Interface
f11yec (sym_​rcm)

Settings help

CL Name Style:


1 Purpose

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

2 Specification

#include <nag.h>
void  f11yec (Integer n, Integer nnz, const Integer icolzp[], const Integer irowix[], const Nag_Boolean lopts[], const Integer mask[], Integer perm[], Integer info[], NagError *fail)
The function may be called by the names: f11yec or nag_sparse_sym_rcm.

3 Description

f11yec takes the compressed column storage (CCS) representation (see Section 2.1.3 in the F11 Chapter Introduction) of an n×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).
f11yec can be useful for solving systems of equations Ax=b, as the permuted system PAPT(Px)=Pb (where P is the permutation matrix described by the vector perm returned by f11yec) may require less storage space and/or less computational steps when solving (see Wai-Hung and Sherman (1976)).
f11yec may be used prior to f11jac and f11jbc (see Section 10 in f11jbc).

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 Integer Input
On entry: n, the order of the matrix A.
Constraint: n1.
2: nnz Integer Input
On entry: the number of nonzero elements in the matrix A.
Constraint: nnz0.
3: icolzp[n+1] const Integer Input
On entry: icolzp records the index into irowix which starts each new column.
Constraints:
  • 1icolzp[i-1]nnz+1, for i=2,3,,n;
  • icolzp[0]=1;
  • icolzp[n]=nnz+1, where icolzp[i-1] holds the position integer for the starts of the columns in irowix.
4: irowix[nnz] const Integer Input
On entry: the row indices corresponding to the nonzero elements in the matrix A.
Constraint: 1irowix[i-1]n, for i=1,2,,nnz.
5: lopts[5] const Nag_Boolean Input
On entry: the options to be used by f11yec.
lopts[0]=Nag_TRUE
Row/column i of the matrix A will only be referenced if mask[i-1]0, otherwise mask will be ignored.
lopts[1]=Nag_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)).
lopts[2]=Nag_TRUE
The matrix A will be checked for symmetrical sparsity pattern, otherwise not.
lopts[3]=Nag_TRUE
The bandwidth and profile of the unpermuted matrix will be calculated, otherwise not.
lopts[4]=Nag_TRUE
The bandwidth and profile of the permuted matrix will be calculated, otherwise not.
6: mask[dim] const Integer Input
Note: the dimension, dim, of the array mask must be at least
  • n when lopts[0]=Nag_TRUE;
  • otherwise mask may be NULL.
On entry: mask is only referenced if lopts[0] is Nag_TRUE otherwise mask may be set to NULL. A value of mask[i-1]=0 indicates that the node corresponding to row or column i is not to be referenced. A value of mask[i-1]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: perm[n] Integer Output
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 perm[i-1], i=1,2,n.
8: info[4] Integer Output
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.
info[0]
The bandwidth of the matrix A, if lopts[3]=Nag_TRUE.
info[1]
The profile of the matrix A, if lopts[3]=Nag_TRUE.
info[2]
The bandwidth of the permuted matrix PAPT, if lopts[4]=Nag_TRUE.
info[3]
The profile of the permuted matrix PAPT, if lopts[4]=Nag_TRUE.
9: fail NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

6 Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
NE_BAD_PARAM
On entry, argument value had an illegal value.
NE_INT
On entry, n=value.
Constraint: n1.
On entry, nnz=value.
Constraint: nnz1.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
NE_INVALID_CS
On entry, icolzp[0]=value.
Constraint: icolzp[0]=1.
On entry, icolzp[n]=value and nnz=value.
Constraint: icolzp[n]=nnz+1.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.
NE_NONSYMM_MATRIX
On entry, the matrix A is not symmetric.
Element (value,value) has no symmetric element.
NE_SPARSE_COL
On entry, icolzp[value]=value and nnz=value.
Constraint: 1icolzp[i-1]nnz for all i.
NE_SPARSE_ROW
On entry, irowix[value]=value and n=value.
Constraint: 1irowix[i-1]n for all i.

7 Accuracy

Not applicable.

8 Parallelism and Performance

Background information to multithreading can be found in the Multithreading documentation.
f11yec 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 f11yec to reorder the rows and columns and displays the results.

10.1 Program Text

Program Text (f11yece.c)

10.2 Program Data

Program Data (f11yece.d)

10.3 Program Results

Program Results (f11yece.r)
GnuplotProduced by GNUPLOT 5.4 patchlevel 6 "f11yefe.r" ind 0 Example Program Figure 1 : Original Matrix Ordering
GnuplotProduced by GNUPLOT 5.4 patchlevel 6 "f11yefe.r" ind 1 Figure 2 : Reverse Cuthill-McKee Reordering