# NAG CL Interfacef11mgc (direct_​real_​gen_​cond)

Settings help

CL Name Style:

## 1Purpose

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

## 2Specification

 #include
 void f11mgc (Nag_NormType norm, Integer n, const Integer il[], const double lval[], const Integer iu[], const double uval[], double anorm, double *rcond, NagError *fail)
The function may be called by the names: f11mgc, nag_sparse_direct_real_gen_cond or nag_superlu_condition_number_lu.

## 3Description

f11mgc estimates the condition number of a real sparse matrix $A$, in either the $1$-norm or the $\infty$-norm:
 $κ1(A)=‖A‖1 ‖A-1‖1 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 f11mlc to compute ${‖A‖}_{1}$ or ${‖A‖}_{\infty }$, and a call to 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_NormType Input
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}$Integer Input
On entry: $n$, the order of the matrix $A$.
Constraint: ${\mathbf{n}}\ge 0$.
3: $\mathbf{il}\left[\mathit{dim}\right]$const Integer Input
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 f11mec.
On entry: records the sparsity pattern of matrix $L$ as computed by f11mec.
4: $\mathbf{lval}\left[\mathit{dim}\right]$const double Input
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 f11mec.
On entry: records the nonzero values of matrix $L$ and some nonzero values of matrix $U$ as computed by f11mec.
5: $\mathbf{iu}\left[\mathit{dim}\right]$const Integer Input
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 f11mec.
On entry: records the sparsity pattern of matrix $U$ as computed by f11mec.
6: $\mathbf{uval}\left[\mathit{dim}\right]$const double Input
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 f11mec.
On entry: records some nonzero values of matrix $U$ as computed by f11mec.
7: $\mathbf{anorm}$double Input
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 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 7 in the Introduction to the NAG Library CL Interface).

## 6Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface 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 7.5 in the Introduction to the NAG Library CL Interface for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface 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

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 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 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)