F11 Chapter Contents
F11 Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentF11DTF

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

F11DTF computes a block diagonal incomplete $LU$ factorization of a complex sparse non-Hermitian matrix, represented in coordinate storage format. The diagonal blocks may be composed of arbitrary rows and the corresponding columns, and may overlap. This factorization can be used to provide a block Jacobi or additive Schwarz preconditioner, for use in combination with F11BSF or F11DUF.

## 2  Specification

 SUBROUTINE F11DTF ( N, NNZ, A, LA, IROW, ICOL, NB, ISTB, INDB, LINDB, LFILL, DTOL, PSTRAT, MILU, IPIVP, IPIVQ, ISTR, IDIAG, NNZC, NPIVM, IWORK, LIWORK, IFAIL)
 INTEGER N, NNZ, LA, IROW(LA), ICOL(LA), NB, ISTB(NB+1), INDB(LINDB), LINDB, LFILL(NB), IPIVP(LINDB), IPIVQ(LINDB), ISTR(LINDB+1), IDIAG(LINDB), NNZC, NPIVM(NB), IWORK(LIWORK), LIWORK, IFAIL REAL (KIND=nag_wp) DTOL(NB) COMPLEX (KIND=nag_wp) A(LA) CHARACTER(1) PSTRAT(NB), MILU(NB)

## 3  Description

F11DTF computes an incomplete $LU$ factorization (see Meijerink and Van der Vorst (1977) and Meijerink and Van der Vorst (1981)) of the (possibly overlapping) diagonal blocks ${A}_{b}$, $b=1,2,\dots ,{\mathbf{NB}}$, of a complex sparse non-Hermitian $n$ by $n$ matrix $A$. The factorization is intended primarily for use as a block Jacobi or additive Schwarz preconditioner (see Saad (1996)), with one of the iterative solvers F11BSF and F11DUF.
The NB diagonal blocks need not consist of consecutive rows and columns of $A$, but may be composed of arbitrarily indexed rows, and the corresponding columns, as defined in the arguments INDB and ISTB. Any given row or column index may appear in more than one diagonal block, resulting in overlap. Each diagonal block ${A}_{b}$, $b=1,2,\dots ,{\mathbf{NB}}$, is factorized as:
 $Ab = Mb+Rb$
where
 $Mb = Pb Lb Db Ub Qb$
and ${L}_{b}$ is lower triangular with unit diagonal elements, ${D}_{b}$ is diagonal, ${U}_{b}$ is upper triangular with unit diagonals, ${P}_{b}$ and ${Q}_{b}$ are permutation matrices, and ${R}_{b}$ is a remainder matrix.
The amount of fill-in occurring in the factorization of block $b$ can vary from zero to complete fill, and can be controlled by specifying either the maximum level of fill ${\mathbf{LFILL}}\left(b\right)$, or the drop tolerance ${\mathbf{DTOL}}\left(b\right)$.
The parameter ${\mathbf{PSTRAT}}\left(b\right)$ defines the pivoting strategy to be used in block $b$. The options currently available are no pivoting, user-defined pivoting, partial pivoting by columns for stability, and complete pivoting by rows for sparsity and by columns for stability. The factorization may optionally be modified to preserve the row-sums of the original block matrix.
The sparse matrix $A$ is represented in coordinate storage (CS) format (see Section 2.1.1 in the F11 Chapter Introduction). The array A stores all the nonzero elements of the matrix $A$, while arrays IROW and ICOL store the corresponding row and column indices respectively. Multiple nonzero elements may not be specified for the same row and column index.
The preconditioning matrices ${M}_{b}$, $b=1,2,\dots ,{\mathbf{NB}}$, are returned in terms of the CS representations of the matrices
 $Cb = Lb + D-1b + Ub -2I .$

## 4  References

Meijerink J and Van der Vorst H (1977) An iterative solution method for linear systems of which the coefficient matrix is a symmetric M-matrix Math. Comput. 31 148–162
Meijerink J and Van der Vorst H (1981) Guidelines for the usage of incomplete decompositions in solving sets of linear equations as they occur in practical problems J. Comput. Phys. 44 134–155
Saad Y (1996) Iterative Methods for Sparse Linear Systems PWS Publishing Company, Boston, MA

## 5  Parameters

1:     N – INTEGERInput
On entry: $n$, the order of the matrix $A$.
Constraint: ${\mathbf{N}}\ge 1$.
2:     NNZ – INTEGERInput
On entry: the number of nonzero elements in the matrix $A$.
Constraint: $1\le {\mathbf{NNZ}}\le {{\mathbf{N}}}^{2}$.
3:     A(LA) – COMPLEX (KIND=nag_wp) arrayInput/Output
On entry: the nonzero elements in the matrix $A$, ordered by increasing row index, and by increasing column index within each row. Multiple entries for the same row and column indices are not permitted. The routine F11ZNF may be used to order the elements in this way.
On exit: the first NNZ entries of A contain the nonzero elements of $A$ and the next NNZC entries contain the elements of the matrices ${C}_{\mathit{b}}$, for $\mathit{b}=1,2,\dots ,{\mathbf{NB}}$ stored consecutively. Within each block the matrix elements are ordered by increasing row index, and by increasing column index within each row.
4:     LA – INTEGERInput
On entry: the dimension of the arrays A, IROW and ICOL as declared in the (sub)program from which F11DTF is called. These arrays must be of sufficient size to store both $A$ (NNZ elements) and $C$ (NNZC elements).
Constraint: ${\mathbf{LA}}\ge 2×{\mathbf{NNZ}}$.
5:     IROW(LA) – INTEGER arrayInput/Output
6:     ICOL(LA) – INTEGER arrayInput/Output
On entry: the row and column indices of the nonzero elements supplied in A.
Constraints:
IROW and ICOL must satisfy these constraints (which may be imposed by a call to F11ZAF):
• $1\le {\mathbf{IROW}}\left(\mathit{i}\right)\le {\mathbf{N}}$ and $1\le {\mathbf{ICOL}}\left(\mathit{i}\right)\le {\mathbf{N}}$, for $\mathit{i}=1,2,\dots ,{\mathbf{NNZ}}$;
• either ${\mathbf{IROW}}\left(\mathit{i}-1\right)<{\mathbf{IROW}}\left(\mathit{i}\right)$ or both ${\mathbf{IROW}}\left(\mathit{i}-1\right)={\mathbf{IROW}}\left(\mathit{i}\right)$ and ${\mathbf{ICOL}}\left(\mathit{i}-1\right)<{\mathbf{ICOL}}\left(\mathit{i}\right)$, for $\mathit{i}=2,3,\dots ,{\mathbf{NNZ}}$.
On exit: the row and column indices of the nonzero elements returned in A.
7:     NB – INTEGERInput
On entry: the number of diagonal blocks to factorize.
Constraint: $1\le {\mathbf{NB}}\le {\mathbf{N}}$.
8:     ISTB(${\mathbf{NB}}+1$) – INTEGER arrayInput
On entry: ${\mathbf{ISTB}}\left(\mathit{b}\right)$, for $\mathit{b}=1,2,\dots ,{\mathbf{NB}}$, holds the index in arrays INDB, IPIVP, IPIVQ and IDIAG defining block $b$. ${\mathbf{ISTB}}\left({\mathbf{NB}}+1\right)$ holds the sum of the number of rows in all blocks plus ${\mathbf{ISTB}}\left(1\right)$.
Constraint: ${\mathbf{ISTB}}\left(1\right)\ge 1,{\mathbf{ISTB}}\left(\mathit{b}\right)<{\mathbf{ISTB}}\left(\mathit{b}+1\right)$, for $\mathit{b}=1,2,\dots ,{\mathbf{NB}}$.
9:     INDB(LINDB) – INTEGER arrayInput
On entry: INDB must hold the row indices appearing in each diagonal block, stored consecutively. Thus the elements ${\mathbf{INDB}}\left({\mathbf{ISTB}}\left(b\right)\right)$ to ${\mathbf{INDB}}\left({\mathbf{ISTB}}\left(b+1\right)-1\right)$ are the row indices in the $b$th block.
Constraint: $1\le {\mathbf{INDB}}\left(\mathit{m}\right)\le {\mathbf{N}}$, for $\mathit{m}=1,2,\dots ,{\mathbf{ISTB}}\left({\mathbf{NB}}+1\right)-1$.
10:   LINDB – INTEGERInput
On entry: the dimension of the arrays INDB, IPIVP, IPIVQ and IDIAG as declared in the (sub)program from which F11DTF is called.
Constraint: ${\mathbf{LINDB}}\ge {\mathbf{ISTB}}\left({\mathbf{NB}}+1\right)-1$.
11:   LFILL(NB) – INTEGER arrayInput
On entry: if ${\mathbf{LFILL}}\left(b\right)\ge 0$ its value is the maximum level of fill allowed in the decomposition of the block $b$ (see Section 8.2 in F11DNF). A negative value of ${\mathbf{LFILL}}\left(b\right)$ indicates that ${\mathbf{DTOL}}\left(b\right)$ will be used to control the fill in block $b$ instead.
12:   DTOL(NB) – REAL (KIND=nag_wp) arrayInput
On entry: if ${\mathbf{LFILL}}\left(b\right)<0$ then ${\mathbf{DTOL}}\left(b\right)$ is used as a drop tolerance in block $b$ to control the fill-in (see Section 8.2 in F11DNF); otherwise ${\mathbf{DTOL}}\left(b\right)$ is not referenced.
Constraint: if ${\mathbf{LFILL}}\left(b\right)<0$, ${\mathbf{DTOL}}\left(\mathit{b}\right)\ge 0.0$, for $\mathit{b}=1,2,\dots ,{\mathbf{NB}}$.
13:   PSTRAT(NB) – CHARACTER(1) arrayInput
On entry: ${\mathbf{PSTRAT}}\left(\mathit{b}\right)$, for $\mathit{b}=1,2,\dots ,{\mathbf{NB}}$, specifies the pivoting strategy to be adopted in block $b$ as follows:
${\mathbf{PSTRAT}}\left(b\right)=\text{'N'}$
No pivoting is carried out.
${\mathbf{PSTRAT}}\left(b\right)=\text{'U'}$
Pivoting is carried out according to the user-defined input values of IPIVP and IPIVQ.
${\mathbf{PSTRAT}}\left(b\right)=\text{'P'}$
Partial pivoting by columns for stability is carried out.
${\mathbf{PSTRAT}}\left(b\right)=\text{'C'}$
Complete pivoting by rows for sparsity, and by columns for stability, is carried out.
Suggested value: ${\mathbf{PSTRAT}}\left(\mathit{b}\right)=\text{'C'}$, for $\mathit{b}=1,2,\dots ,{\mathbf{NB}}$.
Constraint: ${\mathbf{PSTRAT}}\left(\mathit{b}\right)=\text{'N'}$, $\text{'U'}$, $\text{'P'}$ or $\text{'C'}$, for $\mathit{b}=1,2,\dots ,{\mathbf{NB}}$.
14:   MILU(NB) – CHARACTER(1) arrayInput
On entry: ${\mathbf{MILU}}\left(\mathit{b}\right)$, for $\mathit{b}=1,2,\dots ,{\mathbf{NB}}$, indicates whether or not the factorization in block $\mathit{b}$ should be modified to preserve row-sums (see Section 8.4 in F11DNF).
${\mathbf{MILU}}\left(b\right)=\text{'M'}$
The factorization is modified.
${\mathbf{MILU}}\left(b\right)=\text{'N'}$
The factorization is not modified.
Constraint: ${\mathbf{MILU}}\left(\mathit{b}\right)=\text{'M'}$ or $\text{'N'}$, for $\mathit{b}=1,2,\dots ,{\mathbf{NB}}$.
15:   IPIVP(LINDB) – INTEGER arrayInput/Output
16:   IPIVQ(LINDB) – INTEGER arrayInput/Output
On entry: if ${\mathbf{PSTRAT}}\left(b\right)=\text{'U'}$, then ${\mathbf{IPIVP}}\left({\mathbf{ISTB}}\left(b\right)+k-1\right)$ and ${\mathbf{IPIVQ}}\left({\mathbf{ISTB}}\left(b\right)+k-1\right)$ must specify the row and column indices of the element used as a pivot at elimination stage $k$ of the factorization of block $b$. Otherwise IPIVP and IPIVQ need not be initialized.
Constraint: if ${\mathbf{PSTRAT}}\left(b\right)=\text{'U'}$, the elements ${\mathbf{ISTB}}\left(b\right)$ to ${\mathbf{ISTB}}\left(b+1\right)-1$ of IPIVP and IPIVQ must both hold valid permutations of the integers on $\left[1,{\mathbf{ISTB}}\left(b+1\right)-{\mathbf{ISTB}}\left(b\right)\right]$.
On exit: the row and column indices of the pivot elements, arranged consecutively for each block, as for INDB. If ${\mathbf{IPIVP}}\left({\mathbf{ISTB}}\left(b\right)+k-1\right)=i$ and ${\mathbf{IPIVQ}}\left({\mathbf{ISTB}}\left(b\right)+k-1\right)=j$, then the element in row $i$ and column $j$ of ${A}_{b}$ was used as the pivot at elimination stage $k$.
17:   ISTR(${\mathbf{LINDB}}+1$) – INTEGER arrayOutput
On exit: ${\mathbf{ISTR}}\left({\mathbf{ISTB}}\left(\mathit{b}\right)+\mathit{k}-1\right)$, gives the starting address in the arrays A, IROW and ICOL of row $\mathit{k}$ of the matrix ${C}_{\mathit{b}}$, for $\mathit{b}=1,2,\dots ,{\mathbf{NB}}$ and $\mathit{k}=1,2,\dots ,{\mathbf{ISTB}}\left(\mathit{b}+1\right)-{\mathbf{ISTB}}\left(\mathit{b}\right)$.
${\mathbf{ISTR}}\left({\mathbf{ISTB}}\left({\mathbf{NB}}+1\right)\right)$ contains ${\mathbf{NNZ}}+{\mathbf{NNZC}}+1$.
18:   IDIAG(LINDB) – INTEGER arrayOutput
On exit: ${\mathbf{IDIAG}}\left({\mathbf{ISTB}}\left(\mathit{b}\right)+\mathit{k}-1\right)$, gives the address in the arrays A, IROW and ICOL of the diagonal element in row $\mathit{k}$ of the matrix ${C}_{\mathit{b}}$, for $\mathit{b}=1,2,\dots ,{\mathbf{NB}}$ and $\mathit{k}=1,2,\dots ,{\mathbf{ISTB}}\left(\mathit{b}+1\right)-{\mathbf{ISTB}}\left(\mathit{b}\right)$.
19:   NNZC – INTEGEROutput
On exit: the sum total number of nonzero elements in the matrices ${C}_{\mathit{b}}$, for $\mathit{b}=1,2,\dots ,{\mathbf{NB}}$.
20:   NPIVM(NB) – INTEGER arrayOutput
On exit: if ${\mathbf{NPIVM}}\left(b\right)>0$ it gives the number of pivots which were modified during the factorization to ensure that ${M}_{b}$ exists.
If ${\mathbf{NPIVM}}\left(\mathit{b}\right)=-1$ no pivot modifications were required, but a local restart occurred (see Section 8.3 in F11DNF). The quality of the preconditioner will generally depend on the returned values of ${\mathbf{NPIVM}}\left(\mathit{b}\right)$, for $\mathit{b}=1,2,\dots ,{\mathbf{NB}}$.
If ${\mathbf{NPIVM}}\left(b\right)$ is large, for some $b$, the preconditioner may not be satisfactory. In this case it may be advantageous to call F11DTF again with an increased value of ${\mathbf{LFILL}}\left(b\right)$, a reduced value of ${\mathbf{DTOL}}\left(b\right)$, or ${\mathbf{PSTRAT}}\left(b\right)=\text{'C'}$.
21:   IWORK(LIWORK) – INTEGER arrayWorkspace
22:   LIWORK – INTEGERInput
On entry: the dimension of the array IWORK as declared in the (sub)program from which F11DTF is called.
Constraint: ${\mathbf{LIWORK}}\ge 9×{\mathbf{N}}+3$.
23:   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{DTOL}}\left(⟨\mathit{\text{value}}⟩\right)=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{DTOL}}\left(b\right)\ge 0.0$ for all $b$.
On entry, for $b=⟨\mathit{\text{value}}⟩$, ${\mathbf{ISTB}}\left(b+1\right)=⟨\mathit{\text{value}}⟩$ and ${\mathbf{ISTB}}\left(b\right)=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{ISTB}}\left(b+1\right)>{\mathbf{ISTB}}\left(b\right)$ for all $b$.
On entry, ${\mathbf{INDB}}\left(⟨\mathit{\text{value}}⟩\right)=⟨\mathit{\text{value}}⟩$ and ${\mathbf{N}}=⟨\mathit{\text{value}}⟩$.
Constraint: $1\le {\mathbf{INDB}}\left(b\right)\le {\mathbf{N}}$ for all $b$.
On entry, ${\mathbf{ISTB}}\left(1\right)=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{ISTB}}\left(1\right)\ge 1$.
On entry, ${\mathbf{LA}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{NNZ}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{LA}}\ge 2×{\mathbf{NNZ}}$.
On entry, ${\mathbf{LINDB}}=⟨\mathit{\text{value}}⟩$, ${\mathbf{ISTB}}\left({\mathbf{NB}}+1\right)-1=⟨\mathit{\text{value}}⟩$ and ${\mathbf{NB}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{LINDB}}\ge {\mathbf{ISTB}}\left({\mathbf{NB}}+1\right)-1$.
On entry, ${\mathbf{LIWORK}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{LIWORK}}\ge ⟨\mathit{\text{value}}⟩$.
On entry, ${\mathbf{MILU}}\left(⟨\mathit{\text{value}}⟩\right)="⟨\mathit{\text{value}}⟩"$.
Constraint: ${\mathbf{MILU}}\left(b\right)=\text{'M'}$ or $\text{'N'}$ for all $b$.
On entry, ${\mathbf{N}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{N}}\ge 1$.
On entry, ${\mathbf{NB}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{N}}=⟨\mathit{\text{value}}⟩$.
Constraint: $1\le {\mathbf{NB}}\le {\mathbf{N}}$.
On entry, ${\mathbf{NNZ}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{NNZ}}\ge 1$.
On entry, ${\mathbf{NNZ}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{N}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{NNZ}}\le {{\mathbf{N}}}^{2}$.
On entry, ${\mathbf{PSTRAT}}\left(⟨\mathit{\text{value}}⟩\right)="⟨\mathit{\text{value}}⟩"$.
Constraint: ${\mathbf{PSTRAT}}\left(b\right)=\text{'N'}$, $\text{'U'}$, $\text{'P'}$ or $\text{'C'}$ for all $b$.
${\mathbf{IFAIL}}=2$
On entry, element $⟨\mathit{\text{value}}⟩$ of A was out of order.
On entry, ${\mathbf{ICOL}}\left(⟨\mathit{\text{value}}⟩\right)=⟨\mathit{\text{value}}⟩$ and ${\mathbf{N}}=⟨\mathit{\text{value}}⟩$.
Constraint: $1\le {\mathbf{ICOL}}\left(j\right)\le {\mathbf{N}}$ for all $j$.
On entry, ${\mathbf{IROW}}\left(⟨\mathit{\text{value}}⟩\right)=⟨\mathit{\text{value}}⟩$ and ${\mathbf{N}}=⟨\mathit{\text{value}}⟩$.
Constraint: $1\le {\mathbf{IROW}}\left(i\right)\le {\mathbf{N}}$ for all $i$.
On entry, location $⟨\mathit{\text{value}}⟩$ of $\left({\mathbf{IROW}},{\mathbf{ICOL}}\right)$ was a duplicate.
${\mathbf{IFAIL}}=3$
On entry, the user-supplied value of IPIVP for block $⟨\mathit{\text{value}}⟩$ lies outside the range $\left[1,{\mathbf{N}}\right]$.
On entry, the user-supplied value of IPIVP for block $⟨\mathit{\text{value}}⟩$ was repeated.
On entry, the user-supplied value of IPIVQ for block $⟨\mathit{\text{value}}⟩$ lies outside the range $\left[1,{\mathbf{N}}\right]$.
On entry, the user-supplied value of IPIVQ for block $⟨\mathit{\text{value}}⟩$ was repeated.
${\mathbf{IFAIL}}=4$
The number of nonzero entries in the decomposition is too large.
The decomposition has been terminated before completion.
Either increase LA, or reduce the fill by reducing LFILL, or increasing DTOL.

## 7  Accuracy

The accuracy of the factorization of each block ${A}_{b}$ will be determined by the size of the elements that are dropped and the size of any modifications made to the pivot elements. If these sizes are small then the computed factors will correspond to a matrix close to ${A}_{b}$. The factorization can generally be made more accurate by increasing the level of fill ${\mathbf{LFILL}}\left(b\right)$, or by reducing the drop tolerance ${\mathbf{DTOL}}\left(b\right)$ with ${\mathbf{LFILL}}\left(b\right)<0$.
If F11DTF is used in combination with F11BSF or F11DUF, the more accurate the factorization the fewer iterations will be required. However, the cost of the decomposition will also generally increase.

F11DTF calls F11DNF internally for each block ${A}_{b}$. The comments and advice provided in Section 8 in F11DNF on timing, control of fill, algorithmic details, and choice of parameters, are all therefore relevant to F11DTF, if interpreted blockwise.

## 9  Example

This example program reads in a sparse matrix $A$ and then defines a block partitioning of the row indices with a user-supplied overlap and computes an overlapping incomplete $LU$ factorization suitable for use as an additive Schwarz preconditioner. Such a factorization is used for this purpose in the example program of F11DUF.

### 9.1  Program Text

Program Text (f11dtfe.f90)

### 9.2  Program Data

Program Data (f11dtfe.d)

### 9.3  Program Results

Program Results (f11dtfe.r)