hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_lapack_dgtcon (f07cg)

 Contents

    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example

Purpose

nag_lapack_dgtcon (f07cg) estimates the reciprocal condition number of a real n  by n  tridiagonal matrix A , using the LU  factorization returned by nag_lapack_dgttrf (f07cd).

Syntax

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

Description

nag_lapack_dgtcon (f07cg) should be preceded by a call to nag_lapack_dgttrf (f07cd), 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_dgtcon (f07cg) then utilizes the factorization to estimate either A-11  or A-1 , from which the estimate of the reciprocal of the condition number of A , 1/κA  is computed as either
1 / κ1 A = 1 / A1 A-11  
or
1 / κ A = 1 / A A-1 .  
1/κA  is returned, rather than κA , since when A  is singular κA  is infinite.
Note that κA=κ1AT .

References

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

Parameters

Compulsory Input Parameters

1:     norm_p – string (length ≥ 1)
Specifies the norm to be used to estimate κA.
norm_p='1' or 'O'
Estimate κ1A.
norm_p='I'
Estimate κA.
Constraint: norm_p='1', 'O' or 'I'.
2:     dl: – double array
The dimension of the array dl must be at least max1,n-1
Must contain the n-1 multipliers that define the matrix L of the LU factorization of A.
3:     d: – double array
The dimension of the array d must be at least max1,n
Must contain the n diagonal elements of the upper triangular matrix U from the LU factorization of A.
4:     du: – double array
The dimension of the array du must be at least max1,n-1
Must contain the n-1 elements of the first superdiagonal of U.
5:     du2: – double array
The dimension of the array du2 must be at least max1,n-2
Must contain the n-2 elements of the second superdiagonal of U.
6:     ipiv: int64int32nag_int array
The dimension of the array ipiv must be at least max1,n
Must contain the n pivot indices that define the permutation matrix P. At the ith step, row i of the matrix was interchanged with row ipivi, and ipivi must always be either i or i+1, ipivi=i indicating that a row interchange was not performed.
7:     anorm – double scalar
If norm_p='1' or 'O', the 1-norm of the original matrix A.
If norm_p='I', the -norm of the original matrix A.
anorm must be computed either before calling nag_lapack_dgttrf (f07cd) or else from a copy of the original matrix A (see Example).
Constraint: anorm0.0.

Optional Input Parameters

1:     n int64int32nag_int scalar
Default: the dimension of the arrays d, ipiv.
n, the order of the matrix A.
Constraint: n0.

Output Parameters

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

Error Indicators and Warnings

   info<0
If 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.

Further Comments

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 function is nag_lapack_zgtcon (f07cu).

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 .  
function f07cg_example


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

% Tridiagonal matrix A stored as diagonals:
du = [        2.1    -1.0      1.9     8.0];
d  = [3.0     2.3    -5.0     -0.9     7.1];
dl = [3.4     3.6     7.0     -6.0        ];
n  = numel(d);

% Factorize A.
[dlf, df, duf, du2f, ipiv, info] = ...
  f07cd(dl, d, du);

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

norm_p = '1-norm';
[rcond, info] = f07cg( ...
                       norm_p, dlf, df, duf, du2f, ipiv, anorm);

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


f07cg example results

Estimate of condition number =   9.27e+01

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015