F11 Chapter Contents
F11 Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentF11MGF

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

F11MGF computes an estimate of the reciprocal of the condition number of a sparse matrix given an $LU$ factorization of the matrix computed by F11MEF.

## 2  Specification

 SUBROUTINE F11MGF ( NORM, N, IL, LVAL, IU, UVAL, ANORM, RCOND, IFAIL)
 INTEGER N, IL(*), IU(*), IFAIL REAL (KIND=nag_wp) LVAL(*), UVAL(*), ANORM, RCOND CHARACTER(1) NORM

## 3  Description

F11MGF estimates the condition number of a real sparse matrix $A$, in either the $1$-norm or the $\infty$-norm:
 $κ1A=A1 A-11 or κ∞A=A∞ A-1∞.$
Note that ${\kappa }_{\infty }\left(A\right)={\kappa }_{1}\left({A}^{\mathrm{T}}\right)$.
Because the condition number is infinite if $A$ is singular, the routine actually returns an estimate of the reciprocal of the condition number.
The routine should be preceded by a call to F11MLF to compute ${‖A‖}_{1}$ or ${‖A‖}_{\infty }$, and a call to F11MEF to compute the $LU$ factorization of $A$. The routine then estimates ${‖{A}^{-1}‖}_{1}$ or ${‖{A}^{-1}‖}_{\infty }$ and computes the reciprocal of the condition number.

None.

## 5  Parameters

1:     NORM – CHARACTER(1)Input
On entry: indicates whether ${\kappa }_{1}\left(A\right)$ or ${\kappa }_{\infty }\left(A\right)$ is to be estimated.
${\mathbf{NORM}}=\text{'1'}$ or $\text{'O'}$
${\kappa }_{1}\left(A\right)$ is estimated.
${\mathbf{NORM}}=\text{'I'}$
${\kappa }_{\infty }\left(A\right)$ is estimated.
Constraint: ${\mathbf{NORM}}=\text{'1'}$, $\text{'O'}$ or $\text{'I'}$.
2:     N – INTEGERInput
On entry: $n$, the order of the matrix $A$.
Constraint: ${\mathbf{N}}\ge 0$.
3:     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.
4:     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.
5:     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.
6:     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.
7:     ANORM – REAL (KIND=nag_wp)Input
On entry: if ${\mathbf{NORM}}=\text{'1'}$ or $\text{'O'}$, the $1$-norm of the matrix $A$.
If ${\mathbf{NORM}}=\text{'I'}$, the $\infty$-norm of the matrix $A$.
ANORM may be computed by calling F11MLF with the same value for the parameter NORM.
Constraint: ${\mathbf{ANORM}}\ge 0.0$.
8:     RCOND – REAL (KIND=nag_wp)Output
On exit: an estimate of the reciprocal of the condition number of $A$. RCOND is set to zero if exact singularity is detected or the estimate underflows. If RCOND is less than machine precision, $A$ is singular to working precision.
9:     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{NORM}}\ne \text{'1'}$, $\text{'O'}$ or $\text{'I'}$, or ${\mathbf{N}}<0$, or ${\mathbf{ANORM}}<0.0$.
${\mathbf{IFAIL}}=301$
Unable to allocate required internal workspace.

## 7  Accuracy

The computed estimate RCOND is never less than the true value $\rho$, and in practice is nearly always less than $10\rho$, although examples can be constructed where RCOND is much larger.

A call to F11MGF involves solving a number of systems of linear equations of the form $Ax=b$ or ${A}^{\mathrm{T}}x=b$.

## 9  Example

This example estimates the condition number in the $1$-norm of the matrix $A$, 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 .$
Here $A$ is nonsymmetric and must first be factorized by F11MEF. The true condition number in the $1$-norm is $20.25$.

### 9.1  Program Text

Program Text (f11mgfe.f90)

### 9.2  Program Data

Program Data (f11mgfe.d)

### 9.3  Program Results

Program Results (f11mgfe.r)