NAG Library Routine Document
F11MDF
1 Purpose
F11MDF computes a column permutation suitable for
$LU$ factorization (by
F11MEF) of a real sparse matrix in compressed column (Harwell–Boeing) format and applies it to the matrix. This routine must be called prior to
F11MEF.
2 Specification
INTEGER 
N, ICOLZP(*), IROWIX(*), IPRM(7*N), IFAIL 
CHARACTER(1) 
SPEC 

3 Description
Given a sparse matrix in compressed column (Harwell–Boeing) format
$A$ and a choice of column permutation schemes, the routine computes those data structures that will be needed by the
$LU$ factorization routine
F11MEF and associated routines
F11MMF,
F11MFF and
F11MHF. The column permutation choices are:
 original order (that is, no permutation);
 usersupplied permutation;
 a permutation, computed by the routine, designed to minimize fillin during the $LU$ factorization.
The algorithm for this computed permutation is based on the approximate minimum degree column ordering algorithm COLAMD. The computed permutation is not sensitive to the magnitude of the nonzero values of $A$.
4 References
Amestoy P R, Davis T A and Duff I S (1996) An approximate minimum degree ordering algorithm SIAM J. Matrix Anal. Appl. 17 886–905
Gilbert J R and Larimore S I (2004) A column approximate minimum degree ordering algorithm ACM Trans. Math. Software 30,3 353–376
Gilbert J R, Larimore S I and Ng E G (2004) Algorithm 836: COLAMD, an approximate minimum degree ordering algorithm ACM Trans. Math. Software 30, 3 377–380
5 Parameters
 1: $\mathrm{SPEC}$ – CHARACTER(1)Input

On entry: indicates the permutation to be applied.
 ${\mathbf{SPEC}}=\text{'N'}$
 The identity permutation is used (i.e., the columns are not permuted).
 ${\mathbf{SPEC}}=\text{'U'}$
 The permutation in the IPRM array is used, as supplied by you.
 ${\mathbf{SPEC}}=\text{'M'}$
 The permutation computed by the COLAMD algorithm is used
Constraint:
${\mathbf{SPEC}}=\text{'N'}$, $\text{'U'}$ or $\text{'M'}$.
 2: $\mathrm{N}$ – INTEGERInput

On entry: $n$, the order of the matrix $A$.
Constraint:
${\mathbf{N}}\ge 0$.
 3: $\mathrm{ICOLZP}\left(*\right)$ – INTEGER arrayInput

Note: the dimension of the array
ICOLZP
must be at least
${\mathbf{N}}+1$.
On entry:
${\mathbf{ICOLZP}}\left(i\right)$ contains the index in
$A$ of the start of a new column. See
Section 2.1.3 in the F11 Chapter Introduction.
 4: $\mathrm{IROWIX}\left(*\right)$ – INTEGER arrayInput

Note: the dimension of the array
IROWIX
must be at least
${\mathbf{ICOLZP}}\left({\mathbf{N}}+1\right)1$, the number of nonzeros of the sparse matrix
$A$.
On entry:
${\mathbf{IROWIX}}\left(i\right)$ contains the row index in
$A$ for element
$A\left(i\right)$. See
Section 2.1.3 in the F11 Chapter Introduction.
 5: $\mathrm{IPRM}\left(7\times {\mathbf{N}}\right)$ – INTEGER arrayInput/Output

On entry: the first ${\mathbf{N}}$ entries contain the column permutation supplied by you. This will be used if ${\mathbf{SPEC}}=\text{'U'}$, and ignored otherwise. If used, it must consist of a permutation of all the integers in the range $\left[0,\left({\mathbf{N}}1\right)\right]$, the leftmost column of the matrix $A$ denoted by $0$ and the rightmost by ${\mathbf{N}}1$. Labelling columns in this way, ${\mathbf{IPRM}}\left(i\right)=j$ means that column $i1$ of $A$ is in position $j$ in $A{P}_{c}$, where ${P}_{r}A{P}_{c}=LU$ expresses the factorization to be performed.
On exit: a new permutation is returned in the first
${\mathbf{N}}$ entries. The rest of the array contains data structures that will be used by other routines. The routine computes the column elimination tree for
$A$ and a postorder permutation on the tree. It then compounds the
IPRM permutation given or computed by the COLAMD algorthm with the postorder permutation. This array is needed by the
$LU$ factorization routine
F11MEF and associated routines
F11MFF,
F11MHF and
F11MMF and should be passed to them unchanged.
 6: $\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{SPEC}}\ne \text{'N'}$, $\text{'U'}$ or $\text{'M'}$, 
or  ${\mathbf{N}}<0$. 
 ${\mathbf{IFAIL}}=2$

On entry,
${\mathbf{SPEC}}=\text{'U'}$, but
IPRM does not represent a valid permutation of the integers in
$\left[0,\left({\mathbf{N}}1\right)\right]$. An input value of
IPRM is either out of range or repeated.
 ${\mathbf{IFAIL}}=3$

Unspecified failure of the COLAMD algorithm. This should not happen and should be reported to NAG.
 ${\mathbf{IFAIL}}=4$

On entry, the array
ICOLZP failed to satisfy the following constraints:
 ${\mathbf{ICOLZP}}\left(1\right)=1$;
 ${\mathbf{ICOLZP}}\left(\mathit{i}1\right)\le {\mathbf{ICOLZP}}\left(\mathit{i}\right)$, for $\mathit{i}=2,3,\dots ,{\mathbf{N}}+1$;
 ${\mathbf{ICOLZP}}\left(\mathit{i}\right)\le {\mathbf{N}}\times {\mathbf{N}}+1$, for $\mathit{i}=1,2,\dots ,{\mathbf{N}}+1$.
 ${\mathbf{IFAIL}}=5$

On entry, the array
IROWIX failed to satisfy the following constraints:
 $1\le {\mathbf{IROWIX}}\left(\mathit{i}\right)\le {\mathbf{N}}$, for $\mathit{i}=1,2,\dots ,{\mathbf{ICOLZP}}\left({\mathbf{N}}+1\right)1$;
 for each column $i=1\dots {\mathbf{N}}$, the row indices ${\mathbf{IROWIX}}\left(j\right)$, where $j={\mathbf{ICOLZP}}\left(i\right)\dots {\mathbf{ICOLZP}}\left(i+1\right)1$, do not repeat.
 ${\mathbf{IFAIL}}=301$

Unable to allocate required internal workspace.
 ${\mathbf{IFAIL}}=99$
An unexpected error has been triggered by this routine. Please
contact
NAG.
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.
7 Accuracy
Not applicable. This computation does not use floatingpoint numbers.
8 Parallelism and Performance
F11MDF is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
Please consult the
X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the
Users' Note for your implementation for any additional implementationspecific information.
We recommend calling this routine with
${\mathbf{SPEC}}=\text{'M'}$ before calling
F11MEF. The COLAMD algorithm computes a sparsitypreserving permutation
${P}_{c}$ solely from the pattern of
$A$ such that the
$LU$ factorization
${P}_{r}A{P}_{c}=LU$ remains as sparse as possible, regardless of the subsequent choice of
${P}_{r}$. The algorithm takes advantage of the existence of supercolumns (columns with the same sparsity pattern) to reduce running time.
10 Example
This example computes a sparsity preserving column permutation for the
$LU$ factorization of the matrix
$A$, where
10.1 Program Text
Program Text (f11mdfe.f90)
10.2 Program Data
Program Data (f11mdfe.d)
10.3 Program Results
Program Results (f11mdfe.r)