F11 Chapter Contents
F11 Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentF11MFF

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

F11MFF solves a real sparse system of linear equations with multiple right-hand sides given an $LU$ factorization of the sparse matrix computed by F11MEF.

## 2  Specification

 SUBROUTINE F11MFF ( TRANS, N, IPRM, IL, LVAL, IU, UVAL, NRHS, B, LDB, IFAIL)
 INTEGER N, IPRM(7*N), IL(*), IU(*), NRHS, LDB, IFAIL REAL (KIND=nag_wp) LVAL(*), UVAL(*), B(LDB,*) CHARACTER(1) TRANS

## 3  Description

F11MFF solves a real system of linear equations with multiple right-hand sides $AX=B$ or ${A}^{\mathrm{T}}X=B$, according to the value of the parameter TRANS, where the matrix factorization ${P}_{r}A{P}_{c}=LU$ corresponds to an $LU$ decomposition of a sparse matrix stored in compressed column (Harwell–Boeing) format, as computed by F11MEF.
In the above decomposition $L$ is a lower triangular sparse matrix with unit diagonal elements and $U$ is an upper triangular sparse matrix; ${P}_{r}$ and ${P}_{c}$ are permutation matrices.

None.

## 5  Parameters

1:     TRANS – CHARACTER(1)Input
On entry: specifies whether $AX=B$ or ${A}^{\mathrm{T}}X=B$ is solved.
${\mathbf{TRANS}}=\text{'N'}$
$AX=B$ is solved.
${\mathbf{TRANS}}=\text{'T'}$
${A}^{\mathrm{T}}X=B$ is solved.
Constraint: ${\mathbf{TRANS}}=\text{'N'}$ or $\text{'T'}$.
2:     N – INTEGERInput
On entry: $n$, the order of the matrix $A$.
Constraint: ${\mathbf{N}}\ge 0$.
3:     IPRM($7×{\mathbf{N}}$) – INTEGER arrayInput
On entry: the column permutation which defines ${P}_{c}$, the row permutation which defines ${P}_{r}$, plus associated data structures as computed by F11MEF.
4:     IL($*$) – INTEGER arrayInput
Note: the dimension of the array IL must be at least as large as the dimension of the array of the same name in F11MEF.
On entry: records the sparsity pattern of matrix $L$ as computed by F11MEF.
5:     LVAL($*$) – REAL (KIND=nag_wp) arrayInput
Note: the dimension of the array LVAL must be at least as large as the dimension of the array of the same name in F11MEF.
On entry: records the nonzero values of matrix $L$ and some nonzero values of matrix $U$ as computed by F11MEF.
6:     IU($*$) – INTEGER arrayInput
Note: the dimension of the array IU must be at least as large as the dimension of the array of the same name in F11MEF.
On entry: records the sparsity pattern of matrix $U$ as computed by F11MEF.
7:     UVAL($*$) – REAL (KIND=nag_wp) arrayInput
Note: the dimension of the array UVAL must be at least as large as the dimension of the array of the same name in F11MEF.
On entry: records some nonzero values of matrix $U$ as computed by F11MEF.
8:     NRHS – INTEGERInput
On entry: $\mathit{nrhs}$, the number of right-hand sides in $B$.
Constraint: ${\mathbf{NRHS}}\ge 0$.
9:     B(LDB,$*$) – REAL (KIND=nag_wp) arrayInput/Output
Note: the second dimension of the array B must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{NRHS}}\right)$.
On entry: the ${\mathbf{N}}$ by ${\mathbf{NRHS}}$ right-hand side matrix $B$.
On exit: the ${\mathbf{N}}$ by ${\mathbf{NRHS}}$ solution matrix $X$.
10:   LDB – INTEGERInput
On entry: the first dimension of the array B as declared in the (sub)program from which F11MFF is called.
Constraint: ${\mathbf{LDB}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{N}}\right)$.
11:   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{N}}<0$, or ${\mathbf{NRHS}}<0$, or ${\mathbf{LDB}}<\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{N}}\right)$.
${\mathbf{IFAIL}}=2$
Ill-defined row permutation in array ${\mathbf{IPRM}}$. Internal checks have revealed that the ${\mathbf{IPRM}}$ array is corrupted.
${\mathbf{IFAIL}}=3$
Ill-defined column permutations in array ${\mathbf{IPRM}}$. Internal checks have revealed that the ${\mathbf{IPRM}}$ array is corrupted.
${\mathbf{IFAIL}}=301$
Unable to allocate required internal workspace.

## 7  Accuracy

For each right-hand side vector $b$, the computed solution $x$ is the exact solution of a perturbed system of equations $\left(A+E\right)x=b$, where
 $E≤cnεLU,$
$c\left(n\right)$ is a modest linear function of $n$, and $\epsilon$ is the machine precision, when partial pivoting is used.
If $\stackrel{^}{x}$ is the true solution, then the computed solution $x$ satisfies a forward error bound of the form
 $x-x^∞ x∞ ≤cncondA,xε$
where $\mathrm{cond}\left(A,x\right)={‖\left|{A}^{-1}\right|\left|A\right|\left|x\right|‖}_{\infty }/{‖x‖}_{\infty }\le \mathrm{cond}\left(A\right)={‖\left|{A}^{-1}\right|\left|A\right|‖}_{\infty }\le {\kappa }_{\infty }\left(A\right)$. Note that $\mathrm{cond}\left(A,x\right)$ can be much smaller than $\mathrm{cond}\left(A\right)$, and $\mathrm{cond}\left({A}^{\mathrm{T}}\right)$ can be much larger (or smaller) than $\mathrm{cond}\left(A\right)$.
Forward and backward error bounds can be computed by calling F11MHF, and an estimate for ${\kappa }_{\infty }\left(A\right)$ can be obtained by calling F11MGF.

F11MFF may be followed by a call to F11MHF to refine the solution and return an error estimate.

## 9  Example

This example solves the system of equations $AX=B$, where
 $A= 2.00 1.00 0 0 0 0 0 1.00 -1.00 0 4.00 0 1.00 0 1.00 0 0 0 1.00 2.00 0 -2.00 0 0 3.00 and B= 1.56 3.12 -0.25 -0.50 3.60 7.20 1.33 2.66 0.52 1.04 .$
Here $A$ is nonsymmetric and must first be factorized by F11MEF.

### 9.1  Program Text

Program Text (f11mffe.f90)

### 9.2  Program Data

Program Data (f11mffe.d)

### 9.3  Program Results

Program Results (f11mffe.r)