# NAG Library Function Document

## 1Purpose

nag_superlu_condition_number_lu (f11mgc) computes an estimate of the reciprocal of the condition number of a sparse matrix given an $LU$ factorization of the matrix computed by nag_superlu_lu_factorize (f11mec).

## 2Specification

 #include #include
 void nag_superlu_condition_number_lu (Nag_NormType norm, Integer n, const Integer il[], const double lval[], const Integer iu[], const double uval[], double anorm, double *rcond, NagError *fail)

## 3Description

nag_superlu_condition_number_lu (f11mgc) 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 function actually returns an estimate of the reciprocal of the condition number.
The function should be preceded by a call to nag_superlu_matrix_norm (f11mlc) to compute ${‖A‖}_{1}$ or ${‖A‖}_{\infty }$, and a call to nag_superlu_lu_factorize (f11mec) to compute the $LU$ factorization of $A$. The function then estimates ${‖{A}^{-1}‖}_{1}$ or ${‖{A}^{-1}‖}_{\infty }$ and computes the reciprocal of the condition number.

None.

## 5Arguments

1:    $\mathbf{norm}$Nag_NormTypeInput
On entry: indicates whether ${\kappa }_{1}\left(A\right)$ or ${\kappa }_{\infty }\left(A\right)$ is to be estimated.
${\mathbf{norm}}=\mathrm{Nag_RealOneNorm}$
${\kappa }_{1}\left(A\right)$ is estimated.
${\mathbf{norm}}=\mathrm{Nag_RealInfNorm}$
${\kappa }_{\infty }\left(A\right)$ is estimated.
Constraint: ${\mathbf{norm}}=\mathrm{Nag_RealOneNorm}$ or $\mathrm{Nag_RealInfNorm}$.
2:    $\mathbf{n}$IntegerInput
On entry: $n$, the order of the matrix $A$.
Constraint: ${\mathbf{n}}\ge 0$.
3:    $\mathbf{il}\left[\mathit{dim}\right]$const IntegerInput
Note: the dimension, dim, of the array il must be at least as large as the dimension of the array of the same name in nag_superlu_lu_factorize (f11mec).
On entry: records the sparsity pattern of matrix $L$ as computed by nag_superlu_lu_factorize (f11mec).
4:    $\mathbf{lval}\left[\mathit{dim}\right]$const doubleInput
Note: the dimension, dim, of the array lval must be at least as large as the dimension of the array of the same name in nag_superlu_lu_factorize (f11mec).
On entry: records the nonzero values of matrix $L$ and some nonzero values of matrix $U$ as computed by nag_superlu_lu_factorize (f11mec).
5:    $\mathbf{iu}\left[\mathit{dim}\right]$const IntegerInput
Note: the dimension, dim, of the array iu must be at least as large as the dimension of the array of the same name in nag_superlu_lu_factorize (f11mec).
On entry: records the sparsity pattern of matrix $U$ as computed by nag_superlu_lu_factorize (f11mec).
6:    $\mathbf{uval}\left[\mathit{dim}\right]$const doubleInput
Note: the dimension, dim, of the array uval must be at least as large as the dimension of the array of the same name in nag_superlu_lu_factorize (f11mec).
On entry: records some nonzero values of matrix $U$ as computed by nag_superlu_lu_factorize (f11mec).
7:    $\mathbf{anorm}$doubleInput
On entry: if ${\mathbf{norm}}=\mathrm{Nag_RealOneNorm}$, the $1$-norm of the matrix $A$.
If ${\mathbf{norm}}=\mathrm{Nag_RealInfNorm}$, the $\infty$-norm of the matrix $A$.
anorm may be computed by calling nag_superlu_matrix_norm (f11mlc) with the same value for the argument norm.
Constraint: ${\mathbf{anorm}}\ge 0.0$.
8:    $\mathbf{rcond}$double *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:    $\mathbf{fail}$NagError *Input/Output
The NAG error argument (see Section 3.7 in How to Use the NAG Library and its Documentation).

## 6Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 2.3.1.2 in How to Use the NAG Library and its Documentation for further information.
On entry, argument $〈\mathit{\text{value}}〉$ had an illegal value.
NE_INT
On entry, ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{n}}\ge 0$.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 2.7.6 in How to Use the NAG Library and its Documentation for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 2.7.5 in How to Use the NAG Library and its Documentation for further information.
NE_REAL
On entry, ${\mathbf{anorm}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{anorm}}\ge 0.0$.

## 7Accuracy

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.

## 8Parallelism and Performance

nag_superlu_condition_number_lu (f11mgc) makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the x06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this function. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

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

## 10Example

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 nag_superlu_lu_factorize (f11mec). The true condition number in the $1$-norm is $10.875$.

### 10.1Program Text

Program Text (f11mgce.c)

### 10.2Program Data

Program Data (f11mgce.d)

### 10.3Program Results

Program Results (f11mgce.r)

© The Numerical Algorithms Group Ltd, Oxford, UK. 2017