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_dspgst (f08te)

 Contents

    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example

Purpose

nag_lapack_dspgst (f08te) reduces a real symmetric-definite generalized eigenproblem Az=λBz, ABz=λz or BAz=λz to the standard form Cy=λy, where A is a real symmetric matrix and B has been factorized by nag_lapack_dpptrf (f07gd), using packed storage.

Syntax

[ap, info] = f08te(itype, uplo, n, ap, bp)
[ap, info] = nag_lapack_dspgst(itype, uplo, n, ap, bp)

Description

To reduce the real symmetric-definite generalized eigenproblem Az=λBz, ABz=λz or BAz=λz to the standard form Cy=λy using packed storage, nag_lapack_dspgst (f08te) must be preceded by a call to nag_lapack_dpptrf (f07gd) which computes the Cholesky factorization of B; B must be positive definite.
The different problem types are specified by the argument itype, as indicated in the table below. The table shows how C is computed by the function, and also how the eigenvectors z of the original problem can be recovered from the eigenvectors of the standard form.
itype Problem uplo B C z
1 Az=λBz 'U'
'L'
UTU 
LLT
U-TAU-1 
L-1AL-T
U-1y 
L-Ty
2 ABz=λz 'U'
'L'
UTU 
LLT
UAUT 
LTAL
U-1y 
L-Ty
3 BAz=λz 'U'
'L'
UTU 
LLT
UAUT 
LTAL
UTy 
Ly

References

Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore

Parameters

Compulsory Input Parameters

1:     itype int64int32nag_int scalar
Indicates how the standard form is computed.
itype=1
  • if uplo='U', C=U-TAU-1;
  • if uplo='L', C=L-1AL-T.
itype=2 or 3
  • if uplo='U', C=UAUT;
  • if uplo='L', C=LTAL.
Constraint: itype=1, 2 or 3.
2:     uplo – string (length ≥ 1)
Indicates whether the upper or lower triangular part of A is stored and how B has been factorized.
uplo='U'
The upper triangular part of A is stored and B=UTU.
uplo='L'
The lower triangular part of A is stored and B=LLT.
Constraint: uplo='U' or 'L'.
3:     n int64int32nag_int scalar
n, the order of the matrices A and B.
Constraint: n0.
4:     ap: – double array
The dimension of the array ap must be at least max1,n×n+1/2
The upper or lower triangle of the n by n symmetric matrix A, packed by columns.
More precisely,
  • if uplo='U', the upper triangle of A must be stored with element Aij in api+jj-1/2 for ij;
  • if uplo='L', the lower triangle of A must be stored with element Aij in api+2n-jj-1/2 for ij.
5:     bp: – double array
The dimension of the array bp must be at least max1,n×n+1/2
The Cholesky factor of B as specified by uplo and returned by nag_lapack_dpptrf (f07gd).

Optional Input Parameters

None.

Output Parameters

1:     ap: – double array
The dimension of the array ap will be max1,n×n+1/2
The upper or lower triangle of ap stores the corresponding upper or lower triangle of C as specified by itype and uplo, using the same packed storage format as described above.
2:     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: itype, 2: uplo, 3: n, 4: ap, 5: bp, 6: info.

Accuracy

Forming the reduced matrix C is a stable procedure. However it involves implicit multiplication by B-1 if (itype=1) or B (if itype=2 or 3). When nag_lapack_dspgst (f08te) is used as a step in the computation of eigenvalues and eigenvectors of the original problem, there may be a significant loss of accuracy if B is ill-conditioned with respect to inversion. See the document for nag_lapack_dsygv (f08sa) for further details.

Further Comments

The total number of floating-point operations is approximately n3.
The complex analogue of this function is nag_lapack_zhpgst (f08ts).

Example

This example computes all the eigenvalues of Az=λBz, where
A = 0.24 0.39 0.42 -0.16 0.39 -0.11 0.79 0.63 0.42 0.79 -0.25 0.48 -0.16 0.63 0.48 -0.03   and   B= 4.16 -3.12 0.56 -0.10 -3.12 5.03 -0.83 1.09 0.56 -0.83 0.76 0.34 -0.10 1.09 0.34 1.18 ,  
using packed storage. Here B is symmetric positive definite and must first be factorized by nag_lapack_dpptrf (f07gd). The program calls nag_lapack_dspgst (f08te) to reduce the problem to the standard form Cy=λy; then nag_lapack_dsptrd (f08ge) to reduce C to tridiagonal form, and nag_lapack_dsterf (f08jf) to compute the eigenvalues.
function f08te_example


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

% Symmetric matrices A and B stored in packed (Lower) format
n = int64(4);
uplo = 'L';
ap = [0.24;  0.39;  0.42; -0.16;
            -0.11;  0.79;  0.63;
                   -0.25;  0.48;
                          -0.03];
bp = [4.16; -3.12;  0.56; -0.10;
             5.03; -0.83;  1.09;
                    0.76;  0.34;
                           1.18];

% Cholesky factorize B = LL^T
[lp, info] = f07gd( ...
                   uplo, n, bp);

% Reduce Generalized eigenproblem Az = lambda Bz to Cy = lambda y
% where C = L^-1 A L^-T and y = L^T z
itype = int64(1);
[cp, info] = f08te( ...
                    itype, uplo, n, ap, lp);

% Reduce C to tridiagonal form T = Q'CQ
[cpf, d, e, tau, info] = f08ge( ...
                                uplo, n, cp);

% Calculate the eigenvalues of T (same as C)
[w, ~, info] = f08jf( ...
                      d, e);

disp('Eigenvalues');
disp(w');


f08te example results

Eigenvalues
   -2.2254   -0.4548    0.1001    1.1270


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