F11 Chapter Contents
F11 Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentF11DBF

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

F11DBF solves a system of linear equations involving the incomplete $LU$ preconditioning matrix generated by F11DAF.

## 2  Specification

 SUBROUTINE F11DBF ( TRANS, N, A, LA, IROW, ICOL, IPIVP, IPIVQ, ISTR, IDIAG, CHECK, Y, X, IFAIL)
 INTEGER N, LA, IROW(LA), ICOL(LA), IPIVP(N), IPIVQ(N), ISTR(N+1), IDIAG(N), IFAIL REAL (KIND=nag_wp) A(LA), Y(N), X(N) CHARACTER(1) TRANS, CHECK

## 3  Description

F11DBF solves a system of linear equations
 $Mx=y, or MTx=y,$
according to the value of the parameter TRANS, where the matrix $M=PLDUQ$, corresponds to an incomplete $LU$ decomposition of a sparse matrix stored in coordinate storage (CS) format (see Section 2.1.1 in the F11 Chapter Introduction), as generated by F11DAF.
In the above decomposition $L$ is a lower triangular sparse matrix with unit diagonal elements, $D$ is a diagonal matrix, $U$ is an upper triangular sparse matrix with unit diagonal elements and, $P$ and $Q$ are permutation matrices. $L$, $D$ and $U$ are supplied to F11DBF through the matrix
 $C=L+D-1+U-2I$
which is an N by N sparse matrix, stored in CS format, as returned by F11DAF. The permutation matrices $P$ and $Q$ are returned from F11DAF via the arrays IPIVP and IPIVQ.
It is envisaged that a common use of F11DBF will be to carry out the preconditioning step required in the application of F11BEF to sparse linear systems. F11DBF is used for this purpose by the Black Box routine F11DCF.
F11DBF may also be used in combination with F11DAF to solve a sparse system of linear equations directly (see Section 8.5 in F11DAF). This use of F11DBF is demonstrated in Section 9.

None.

## 5  Parameters

1:     TRANS – CHARACTER(1)Input
On entry: specifies whether or not the matrix $M$ is transposed.
${\mathbf{TRANS}}=\text{'N'}$
$Mx=y$ is solved.
${\mathbf{TRANS}}=\text{'T'}$
${M}^{\mathrm{T}}x=y$ is solved.
Constraint: ${\mathbf{TRANS}}=\text{'N'}$ or $\text{'T'}$.
2:     N – INTEGERInput
On entry: $n$, the order of the matrix $M$. This must be the same value as was supplied in the preceding call to F11DAF.
Constraint: ${\mathbf{N}}\ge 1$.
3:     A(LA) – REAL (KIND=nag_wp) arrayInput
On entry: the values returned in the array A by a previous call to F11DAF.
4:     LA – INTEGERInput
On entry: the dimension of the arrays A, IROW and ICOL as declared in the (sub)program from which F11DBF is called. This must be the same value returned by the preceding call to F11DAF.
5:     IROW(LA) – INTEGER arrayInput
6:     ICOL(LA) – INTEGER arrayInput
7:     IPIVP(N) – INTEGER arrayInput
8:     IPIVQ(N) – INTEGER arrayInput
9:     ISTR(${\mathbf{N}}+1$) – INTEGER arrayInput
10:   IDIAG(N) – INTEGER arrayInput
On entry: the values returned in arrays IROW, ICOL, IPIVP, IPIVQ, ISTR and IDIAG by a previous call to F11DAF.
11:   CHECK – CHARACTER(1)Input
On entry: specifies whether or not the CS representation of the matrix $M$ should be checked.
${\mathbf{CHECK}}=\text{'C'}$
Checks are carried on the values of N, IROW, ICOL, IPIVP, IPIVQ, ISTR and IDIAG.
${\mathbf{CHECK}}=\text{'N'}$
None of these checks are carried out.
Constraint: ${\mathbf{CHECK}}=\text{'C'}$ or $\text{'N'}$.
12:   Y(N) – REAL (KIND=nag_wp) arrayInput
On entry: the right-hand side vector $y$.
13:   X(N) – REAL (KIND=nag_wp) arrayOutput
On exit: the solution vector $x$.
14:   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{TRANS}}\ne \text{'N'}$ or $\text{'T'}$, or ${\mathbf{CHECK}}\ne \text{'C'}$ or $\text{'N'}$.
${\mathbf{IFAIL}}=2$
 On entry, ${\mathbf{N}}<1$.
${\mathbf{IFAIL}}=3$
On entry, the CS representation of the preconditioning matrix $M$ is invalid. Further details are given in the error message. Check that the call to F11DBF has been preceded by a valid call to F11DAF and that the arrays A, IROW, ICOL, IPIVP, IPIVQ, ISTR and IDIAG have not been corrupted between the two calls.

## 7  Accuracy

If ${\mathbf{TRANS}}=\text{'N'}$ the computed solution $x$ is the exact solution of a perturbed system of equations $\left(M+\delta M\right)x=y$, where
 $δM≤cnεPLDUQ,$
$c\left(n\right)$ is a modest linear function of $n$, and $\epsilon$ is the machine precision. An equivalent result holds when ${\mathbf{TRANS}}=\text{'T'}$.

### 8.1  Timing

The time taken for a call to F11DBF is proportional to the value of NNZC returned from F11DAF.

### 8.2  Use of CHECK

It is expected that a common use of F11DBF will be to carry out the preconditioning step required in the application of F11BEF to sparse linear systems. In this situation F11DBF is likely to be called many times with the same matrix $M$. In the interests of both reliability and efficiency, you are recommended to set ${\mathbf{CHECK}}=\text{'C'}$ for the first of such calls, and for all subsequent calls set ${\mathbf{CHECK}}=\text{'N'}$.

## 9  Example

This example reads in a sparse nonsymmetric matrix $A$ and a vector $y$. It then calls F11DAF, with ${\mathbf{LFILL}}=-1$ and ${\mathbf{DTOL}}=0.0$, to compute the complete $LU$ decomposition
 $A=PLDUQ.$
Finally it calls F11DBF to solve the system
 $PLDUQx=y.$

### 9.1  Program Text

Program Text (f11dbfe.f90)

### 9.2  Program Data

Program Data (f11dbfe.d)

### 9.3  Program Results

Program Results (f11dbfe.r)