Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_lapack_zgtcon (f07cu)

Purpose

nag_lapack_zgtcon (f07cu) estimates the reciprocal condition number of a complex $n$ by $n$ tridiagonal matrix $A$, using the $LU$ factorization returned by nag_lapack_zgttrf (f07cr).

Syntax

[rcond, info] = f07cu(norm_p, dl, d, du, du2, ipiv, anorm, 'n', n)
[rcond, info] = nag_lapack_zgtcon(norm_p, dl, d, du, du2, ipiv, anorm, 'n', n)

Description

nag_lapack_zgtcon (f07cu) should be preceded by a call to nag_lapack_zgttrf (f07cr), 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. nag_lapack_zgtcon (f07cu) 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)$.

References

Higham N J (2002) Accuracy and Stability of Numerical Algorithms (2nd Edition) SIAM, Philadelphia

Parameters

Compulsory Input Parameters

1:     $\mathrm{norm_p}$ – string (length ≥ 1)
Specifies the norm to be used to estimate $\kappa \left(A\right)$.
${\mathbf{norm_p}}=\text{'1'}$ or $\text{'O'}$
Estimate ${\kappa }_{1}\left(A\right)$.
${\mathbf{norm_p}}=\text{'I'}$
Estimate ${\kappa }_{\infty }\left(A\right)$.
Constraint: ${\mathbf{norm_p}}=\text{'1'}$, $\text{'O'}$ or $\text{'I'}$.
2:     $\mathrm{dl}\left(:\right)$ – complex array
The dimension of the array dl must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}-1\right)$
Must contain the $\left(n-1\right)$ multipliers that define the matrix $L$ of the $LU$ factorization of $A$.
3:     $\mathrm{d}\left(:\right)$ – complex array
The dimension of the array d must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$
Must contain the $n$ diagonal elements of the upper triangular matrix $U$ from the $LU$ factorization of $A$.
4:     $\mathrm{du}\left(:\right)$ – complex array
The dimension of the array du must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}-1\right)$
Must contain the $\left(n-1\right)$ elements of the first superdiagonal of $U$.
5:     $\mathrm{du2}\left(:\right)$ – complex array
The dimension of the array du2 must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}-2\right)$
Must contain the $\left(n-2\right)$ elements of the second superdiagonal of $U$.
6:     $\mathrm{ipiv}\left(:\right)$int64int32nag_int array
The dimension of the array ipiv must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$
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.
7:     $\mathrm{anorm}$ – double scalar
If ${\mathbf{norm_p}}=\text{'1'}$ or $\text{'O'}$, the $1$-norm of the original matrix $A$.
If ${\mathbf{norm_p}}=\text{'I'}$, the $\infty$-norm of the original matrix $A$.
anorm must be computed either before calling nag_lapack_zgttrf (f07cr) or else from a copy of the original matrix $A$ (see Example).
Constraint: ${\mathbf{anorm}}\ge 0.0$.

Optional Input Parameters

1:     $\mathrm{n}$int64int32nag_int scalar
Default: the dimension of the arrays d, ipiv.
$n$, the order of the matrix $A$.
Constraint: ${\mathbf{n}}\ge 0$.

Output Parameters

1:     $\mathrm{rcond}$ – double scalar
Contains an estimate of the reciprocal condition number.
2:     $\mathrm{info}$int64int32nag_int scalar
${\mathbf{info}}=0$ unless the function detects an error (see Error Indicators and Warnings).

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.

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.

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 real analogue of this function is nag_lapack_dgtcon (f07cg).

Example

This example estimates the condition number in the $1$-norm of the tridiagonal matrix $A$ given by
 $A = -1.3+1.3i 2.0-1.0i 0.0i+0.0 0.0i+0.0 0.0i+0.0 1.0-2.0i -1.3+1.3i 2.0+1.0i 0.0i+0.0 0.0i+0.0 0.0i+0.0 1.0+1.0i -1.3+3.3i -1.0+1.0i 0.0i+0.0 0.0i+0.0 0.0i+0.0 2.0-3.0i -0.3+4.3i 1.0-1.0i 0.0i+0.0 0.0i+0.0 0.0i+0.0 1.0+1.0i -3.3+1.3i .$
```function f07cu_example

fprintf('f07cu example results\n\n');

% Tridiagonal matrix stored by diagonals
du = [              2   - 1i     2   + 1i    -1   + 1i     1   - 1i  ];
d  = [-1.3 + 1.3i  -1.3 + 1.3i  -1.3 + 3.3i  -0.3 + 4.3i  -3.3 + 1.3i];
dl = [ 1   - 2i     1   + 1i     2   - 3i     1   + 1i               ];

% Factorize.
[dlf, df, duf, du2, ipiv, info] = ...
f07cr(dl, d, du);

% 1-norm of A (construct column preserving matrix)
a = [0+0i du; d; dl 0+0i];
anorm = norm(a,1);

% Estimate condition number
norm_p = '1-norm';
[rcond, info] = f07cu( ...
norm_p, dlf, df, duf, du2, ipiv, anorm);

fprintf('Estimate of condition number = %10.2e\n', 1/rcond);

```
```f07cu example results

Estimate of condition number =   1.84e+02
```