F07 Chapter Contents
F07 Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentF07CGF (DGTCON)

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

F07CGF (DGTCON) estimates the reciprocal condition number of a real $n$ by $n$ tridiagonal matrix $A$, using the $LU$ factorization returned by F07CDF (DGTTRF).

## 2  Specification

 SUBROUTINE F07CGF ( NORM, N, DL, D, DU, DU2, IPIV, ANORM, RCOND, WORK, IWORK, INFO)
 INTEGER N, IPIV(*), IWORK(N), INFO REAL (KIND=nag_wp) DL(*), D(*), DU(*), DU2(*), ANORM, RCOND, WORK(2*N) CHARACTER(1) NORM
The routine may be called by its LAPACK name dgtcon.

## 3  Description

F07CGF (DGTCON) should be preceded by a call to F07CDF (DGTTRF), which uses Gaussian elimination with partial pivoting and row interchanges to factorize the matrix $A$ as
 $A=PLU ,$
where $P$ is a permutation matrix, $L$ is unit lower triangular with at most one nonzero subdiagonal element in each column, and $U$ is an upper triangular band matrix, with two superdiagonals. F07CGF (DGTCON) then utilizes the factorization to estimate either ${‖{A}^{-1}‖}_{1}$ or ${‖{A}^{-1}‖}_{\infty }$, from which the estimate of the reciprocal of the condition number of $A$, $1/\kappa \left(A\right)$ is computed as either
 $1 / κ1 A = 1 / A1 A-11$
or
 $1 / κ∞ A = 1 / A∞ A-1∞ .$
$1/\kappa \left(A\right)$ is returned, rather than $\kappa \left(A\right)$, since when $A$ is singular $\kappa \left(A\right)$ is infinite.
Note that ${\kappa }_{\infty }\left(A\right)={\kappa }_{1}\left({A}^{\mathrm{T}}\right)$.
Higham N J (2002) Accuracy and Stability of Numerical Algorithms (2nd Edition) SIAM, Philadelphia

## 5  Parameters

1:     $\mathrm{NORM}$ – CHARACTER(1)Input
On entry: specifies the norm to be used to estimate $\kappa \left(A\right)$.
${\mathbf{NORM}}=\text{'1'}$ or $\text{'O'}$
Estimate ${\kappa }_{1}\left(A\right)$.
${\mathbf{NORM}}=\text{'I'}$
Estimate ${\kappa }_{\infty }\left(A\right)$.
Constraint: ${\mathbf{NORM}}=\text{'1'}$, $\text{'O'}$ or $\text{'I'}$.
2:     $\mathrm{N}$ – INTEGERInput
On entry: $n$, the order of the matrix $A$.
Constraint: ${\mathbf{N}}\ge 0$.
3:     $\mathrm{DL}\left(*\right)$ – REAL (KIND=nag_wp) arrayInput
Note: the dimension of the array DL must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{N}}-1\right)$.
On entry: must contain the $\left(n-1\right)$ multipliers that define the matrix $L$ of the $LU$ factorization of $A$.
4:     $\mathrm{D}\left(*\right)$ – REAL (KIND=nag_wp) arrayInput
Note: the dimension of the array D must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{N}}\right)$.
On entry: must contain the $n$ diagonal elements of the upper triangular matrix $U$ from the $LU$ factorization of $A$.
5:     $\mathrm{DU}\left(*\right)$ – REAL (KIND=nag_wp) arrayInput
Note: the dimension of the array DU must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{N}}-1\right)$.
On entry: must contain the $\left(n-1\right)$ elements of the first superdiagonal of $U$.
6:     $\mathrm{DU2}\left(*\right)$ – REAL (KIND=nag_wp) arrayInput
Note: the dimension of the array DU2 must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{N}}-2\right)$.
On entry: must contain the $\left(n-2\right)$ elements of the second superdiagonal of $U$.
7:     $\mathrm{IPIV}\left(*\right)$ – INTEGER arrayInput
Note: the dimension of the array IPIV must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{N}}\right)$.
On entry: must contain the $n$ pivot indices that define the permutation matrix $P$. At the $i$th step, row $i$ of the matrix was interchanged with row ${\mathbf{IPIV}}\left(i\right)$, and ${\mathbf{IPIV}}\left(i\right)$ must always be either $i$ or $\left(i+1\right)$, ${\mathbf{IPIV}}\left(i\right)=i$ indicating that a row interchange was not performed.
8:     $\mathrm{ANORM}$ – REAL (KIND=nag_wp)Input
On entry: if ${\mathbf{NORM}}=\text{'1'}$ or $\text{'O'}$, the $1$-norm of the original matrix $A$.
If ${\mathbf{NORM}}=\text{'I'}$, the $\infty$-norm of the original matrix $A$.
ANORM may be computed by calling F06RNF with the same value for the parameter NORM.
ANORM must be computed either before calling F07CDF (DGTTRF) or else from a copy of the original matrix $A$ (see Section 10).
Constraint: ${\mathbf{ANORM}}\ge 0.0$.
9:     $\mathrm{RCOND}$ – REAL (KIND=nag_wp)Output
On exit: contains an estimate of the reciprocal condition number.
10:   $\mathrm{WORK}\left(2×{\mathbf{N}}\right)$ – REAL (KIND=nag_wp) arrayWorkspace
11:   $\mathrm{IWORK}\left({\mathbf{N}}\right)$ – INTEGER arrayWorkspace
12:   $\mathrm{INFO}$ – INTEGEROutput
On exit: ${\mathbf{INFO}}=0$ unless the routine detects an error (see Section 6).

## 6  Error Indicators and Warnings

${\mathbf{INFO}}<0$
If ${\mathbf{INFO}}=-i$, argument $i$ had an illegal value. An explanatory message is output, and execution of the program is terminated.

## 7  Accuracy

In practice the condition number estimator is very reliable, but it can underestimate the true condition number; see Section 15.3 of Higham (2002) for further details.

## 8  Parallelism and Performance

F07CGF (DGTCON) is not threaded by NAG in any implementation.
F07CGF (DGTCON) 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 routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

The condition number estimation typically requires between four and five solves and never more than eleven solves, following the factorization. The total number of floating-point operations required to perform a solve is proportional to $n$.
The complex analogue of this routine is F07CUF (ZGTCON).

## 10  Example

This example estimates the condition number in the $1$-norm of the tridiagonal matrix $A$ given by
 $A = 3.0 2.1 0.0 0.0 0.0 3.4 2.3 -1.0 0.0 0.0 0.0 3.6 -5.0 1.9 0.0 0.0 0.0 7.0 -0.9 8.0 0.0 0.0 0.0 -6.0 7.1 .$

### 10.1  Program Text

Program Text (f07cgfe.f90)

### 10.2  Program Data

Program Data (f07cgfe.d)

### 10.3  Program Results

Program Results (f07cgfe.r)