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_dsbtrd (f08he)

 Contents

    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example

Purpose

nag_lapack_dsbtrd (f08he) reduces a real symmetric band matrix to tridiagonal form.

Syntax

[ab, d, e, q, info] = f08he(vect, uplo, kd, ab, q, 'n', n)
[ab, d, e, q, info] = nag_lapack_dsbtrd(vect, uplo, kd, ab, q, 'n', n)

Description

nag_lapack_dsbtrd (f08he) reduces a symmetric band matrix A to symmetric tridiagonal form T by an orthogonal similarity transformation:
T = QT A Q .  
The orthogonal matrix Q is determined as a product of Givens rotation matrices, and may be formed explicitly by the function if required.
The function uses a vectorizable form of the reduction, due to Kaufman (1984).

References

Kaufman L (1984) Banded eigenvalue solvers on vector machines ACM Trans. Math. Software 10 73–86
Parlett B N (1998) The Symmetric Eigenvalue Problem SIAM, Philadelphia

Parameters

Compulsory Input Parameters

1:     vect – string (length ≥ 1)
Indicates whether Q is to be returned.
vect='V'
Q is returned.
vect='U'
Q is updated (and the array q must contain a matrix on entry).
vect='N'
Q is not required.
Constraint: vect='V', 'U' or 'N'.
2:     uplo – string (length ≥ 1)
Indicates whether the upper or lower triangular part of A is stored.
uplo='U'
The upper triangular part of A is stored.
uplo='L'
The lower triangular part of A is stored.
Constraint: uplo='U' or 'L'.
3:     kd int64int32nag_int scalar
If uplo='U', the number of superdiagonals, kd, of the matrix A.
If uplo='L', the number of subdiagonals, kd, of the matrix A.
Constraint: kd0.
4:     abldab: – double array
The first dimension of the array ab must be at least max1,kd+1.
The second dimension of the array ab must be at least max1,n.
The upper or lower triangle of the n by n symmetric band matrix A.
The matrix is stored in rows 1 to kd+1, more precisely,
  • if uplo='U', the elements of the upper triangle of A within the band must be stored with element Aij in abkd+1+i-jj​ for ​max1,j-kdij;
  • if uplo='L', the elements of the lower triangle of A within the band must be stored with element Aij in ab1+i-jj​ for ​jiminn,j+kd.
5:     qldq: – double array
The first dimension, ldq, of the array q must satisfy
  • if vect='V' or 'U', ldq max1,n ;
  • if vect='N', ldq1.
The second dimension of the array q must be at least max1,n if vect='V' or 'U' and at least 1 if vect='N'.
If vect='U', q must contain the matrix formed in a previous stage of the reduction (for example, the reduction of a banded symmetric-definite generalized eigenproblem); otherwise q need not be set.

Optional Input Parameters

1:     n int64int32nag_int scalar
Default: the first dimension of the array ab and the second dimension of the array ab. (An error is raised if these dimensions are not equal.)
n, the order of the matrix A.
Constraint: n0.

Output Parameters

1:     abldab: – double array
The first dimension of the array ab will be max1,kd+1.
The second dimension of the array ab will be max1,n.
ab stores values generated during the reduction to tridiagonal form.
The first superdiagonal or subdiagonal and the diagonal of the tridiagonal matrix T are returned in ab using the same storage format as described above.
2:     dn – double array
The diagonal elements of the tridiagonal matrix T.
3:     en-1 – double array
The off-diagonal elements of the tridiagonal matrix T.
4:     qldq: – double array
The first dimension, ldq, of the array q will be
  • if vect='V' or 'U', ldq= max1,n ;
  • if vect='N', ldq=1.
The second dimension of the array q will be max1,n if vect='V' or 'U' and at least 1 if vect='N'.
If vect='V' or 'U', the n by n matrix Q.
If vect='N', q is not referenced.
5:     info int64int32nag_int scalar
info=0 unless the function detects an error (see Error Indicators and Warnings).

Error Indicators and Warnings

   info=-i
If info=-i, parameter i had an illegal value on entry. The parameters are numbered as follows:
1: vect, 2: uplo, 3: n, 4: kd, 5: ab, 6: ldab, 7: d, 8: e, 9: q, 10: ldq, 11: work, 12: info.
It is possible that info refers to a parameter that is omitted from the MATLAB interface. This usually indicates that an error in one of the other input parameters has caused an incorrect value to be inferred.

Accuracy

The computed tridiagonal matrix T is exactly similar to a nearby matrix A+E, where
E2 c n ε A2 ,  
cn is a modestly increasing function of n, and ε is the machine precision.
The elements of T themselves may be sensitive to small perturbations in A or to rounding errors in the computation, but this does not affect the stability of the eigenvalues and eigenvectors.
The computed matrix Q differs from an exactly orthogonal matrix by a matrix E such that
E2 = Oε ,  
where ε is the machine precision.

Further Comments

The total number of floating-point operations is approximately 6n2k if vect='N' with 3n3k-1/k additional operations if vect='V'.
The complex analogue of this function is nag_lapack_zhbtrd (f08hs).

Example

This example computes all the eigenvalues and eigenvectors of the matrix A, where
A = 4.99 0.04 0.22 0.00 0.04 1.05 -0.79 1.04 0.22 -0.79 -2.31 -1.30 0.00 1.04 -1.30 -0.43 .  
Here A is symmetric and is treated as a band matrix. The program first calls nag_lapack_dsbtrd (f08he) to reduce A to tridiagonal form T, and to form the orthogonal matrix Q; the results are then passed to nag_lapack_dsteqr (f08je) which computes the eigenvalues and eigenvectors of A.
function f08he_example


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

% Symmetric band matrix A, stored on symmetric banded format
uplo = 'L';
kd   = int64(2);
n    = int64(4);
ab   = [4.99,  1.05, -2.31, -0.43;
        0.04, -0.79, -1.30,  0;
        0.22,  1.04,  0,     0];

% Reduce A to tridiagonal form and compute Q
vect = 'V';
q = zeros(n, n);
[apf, d, e, q, info] = f08he( ...
                              vect, uplo, kd, ab, q);

% Calculate eigenvalues and eigenvectors of A
[w, ~, z, info] = f08je( ...
                         vect, d, e, 'z', q);

% Normalize eigenvectors: largest element positive
for j = 1:n
  [~,k] = max(abs(z(:,j)));
  if z(k,j) < 0;
    z(:,j) = -z(:,j);
  end
end                            

disp('Eigenvalues');
disp(w');
disp('Eigenvectors');
disp(z);


f08he example results

Eigenvalues
   -2.9943   -0.7000    1.9974    4.9969

Eigenvectors
   -0.0251    0.0162    0.0113    0.9995
    0.0656   -0.5859    0.8077    0.0020
    0.9002   -0.3135   -0.3006    0.0311
    0.4298    0.7471    0.5070   -0.0071


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