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_dtgevc (f08yk)

 Contents

    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example

Purpose

nag_lapack_dtgevc (f08yk) computes some or all of the right and/or left generalized eigenvectors of a pair of real matrices A,B which are in generalized real Schur form.

Syntax

[vl, vr, m, info] = f08yk(side, howmny, select, a, b, vl, vr, mm, 'n', n)
[vl, vr, m, info] = nag_lapack_dtgevc(side, howmny, select, a, b, vl, vr, mm, 'n', n)

Description

nag_lapack_dtgevc (f08yk) computes some or all of the right and/or left generalized eigenvectors of the matrix pair A,B which is assumed to be in generalized upper Schur form. If the matrix pair A,B is not in the generalized upper Schur form, then nag_lapack_dhgeqz (f08xe) should be called before invoking nag_lapack_dtgevc (f08yk).
The right generalized eigenvector x and the left generalized eigenvector y of A,B corresponding to a generalized eigenvalue λ are defined by
A-λBx=0  
and
yH A-λ B=0.  
If a generalized eigenvalue is determined as 0/0, which is due to zero diagonal elements at the same locations in both A and B, a unit vector is returned as the corresponding eigenvector.
Note that the generalized eigenvalues are computed using nag_lapack_dhgeqz (f08xe) but nag_lapack_dtgevc (f08yk) does not explicitly require the generalized eigenvalues to compute eigenvectors. The ordering of the eigenvectors is based on the ordering of the eigenvalues as computed by nag_lapack_dtgevc (f08yk).
If all eigenvectors are requested, the function may either return the matrices X and/or Y of right or left eigenvectors of A,B, or the products ZX and/or QY, where Z and Q are two matrices supplied by you. Usually, Q and Z are chosen as the orthogonal matrices returned by nag_lapack_dhgeqz (f08xe). Equivalently, Q and Z are the left and right Schur vectors of the matrix pair supplied to nag_lapack_dhgeqz (f08xe). In that case, QY and ZX are the left and right generalized eigenvectors, respectively, of the matrix pair supplied to nag_lapack_dhgeqz (f08xe).
A must be block upper triangular; with 1 by 1 and 2 by 2 diagonal blocks. Corresponding to each 2 by 2 diagonal block is a complex conjugate pair of eigenvalues and eigenvectors; only one eigenvector of the pair is computed, namely the one corresponding to the eigenvalue with positive imaginary part. Each 1 by 1 block gives a real generalized eigenvalue and a corresponding eigenvector.

References

Anderson E, Bai Z, Bischof C, Blackford S, Demmel J, Dongarra J J, Du Croz J J, Greenbaum A, Hammarling S, McKenney A and Sorensen D (1999) LAPACK Users' Guide (3rd Edition) SIAM, Philadelphia
Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore
Moler C B and Stewart G W (1973) An algorithm for generalized matrix eigenproblems SIAM J. Numer. Anal. 10 241–256
Stewart G W and Sun J-G (1990) Matrix Perturbation Theory Academic Press, London

Parameters

Compulsory Input Parameters

1:     side – string (length ≥ 1)
Specifies the required sets of generalized eigenvectors.
side='R'
Only right eigenvectors are computed.
side='L'
Only left eigenvectors are computed.
side='B'
Both left and right eigenvectors are computed.
Constraint: side='B', 'L' or 'R'.
2:     howmny – string (length ≥ 1)
Specifies further details of the required generalized eigenvectors.
howmny='A'
All right and/or left eigenvectors are computed.
howmny='B'
All right and/or left eigenvectors are computed; they are backtransformed using the input matrices supplied in arrays vr and/or vl.
howmny='S'
Selected right and/or left eigenvectors, defined by the array select, are computed.
Constraint: howmny='A', 'B' or 'S'.
3:     select: – logical array
The dimension of the array select must be at least max1,n if howmny='S', and at least 1 otherwise
Specifies the eigenvectors to be computed if howmny='S'. To select the generalized eigenvector corresponding to the jth generalized eigenvalue, the jth element of select should be set to true; if the eigenvalue corresponds to a complex conjugate pair, then real and imaginary parts of eigenvectors corresponding to the complex conjugate eigenvalue pair will be computed.
If howmny='A' or 'B', select is not referenced.
Constraint: if howmny='S', selectj=true or false, for j=1,2,,n.
4:     alda: – double array
The first dimension of the array a must be at least max1,n.
The second dimension of the array a must be at least max1,n.
The matrix pair A,B must be in the generalized Schur form. Usually, this is the matrix A returned by nag_lapack_dhgeqz (f08xe).
5:     bldb: – double array
The first dimension of the array b must be at least max1,n.
The second dimension of the array b must be at least max1,n.
The matrix pair A,B must be in the generalized Schur form. If A has a 2 by 2 diagonal block then the corresponding 2 by 2 block of B must be diagonal with positive elements. Usually, this is the matrix B returned by nag_lapack_dhgeqz (f08xe).
6:     vlldvl: – double array
The first dimension, ldvl, of the array vl must satisfy
  • if side='L' or 'B', ldvl max1,n ;
  • if side='R', ldvl1.
The second dimension of the array vl must be at least max1,mm if side='L' or 'B' and at least 1 if side='R'.
If howmny='B' and side='L' or 'B', vl must be initialized to an n by n matrix Q. Usually, this is the orthogonal matrix Q of left Schur vectors returned by nag_lapack_dhgeqz (f08xe).
7:     vrldvr: – double array
The first dimension, ldvr, of the array vr must satisfy
  • if side='R' or 'B', ldvr max1,n ;
  • if side='L', ldvr1.
The second dimension of the array vr must be at least max1,mm if side='R' or 'B' and at least 1 if side='L'.
If howmny='B' and side='R' or 'B', vr must be initialized to an n by n matrix Z. Usually, this is the orthogonal matrix Z of right Schur vectors returned by nag_lapack_dhgeqz (f08xe).
8:     mm int64int32nag_int scalar
The number of columns in the arrays vl and/or vr.
Constraints:
  • if howmny='A' or 'B', mmn;
  • if howmny='S', mm must not be less than the number of requested eigenvectors.

Optional Input Parameters

1:     n int64int32nag_int scalar
Default: the first dimension of the arrays vl, vr. (An error is raised if these dimensions are not equal.)
n, the order of the matrices A and B.
Constraint: n0.

Output Parameters

1:     vlldvl: – double array
The first dimension, ldvl, of the array vl will be
  • if side='L' or 'B', ldvl= max1,n ;
  • if side='R', ldvl=1.
The second dimension of the array vl will be max1,mm if side='L' or 'B' and at least 1 if side='R'.
If side='L' or 'B', vl contains:
  • if howmny='A', the matrix Y of left eigenvectors of A,B;
  • if howmny='B', the matrix QY;
  • if howmny='S', the left eigenvectors of A,B specified by select, stored consecutively in the columns of the array vl, in the same order as their corresponding eigenvalues.
A complex eigenvector corresponding to a complex eigenvalue is stored in two consecutive columns, the first holding the real part, and the second the imaginary part.
If side='R', vl is not referenced.
2:     vrldvr: – double array
The first dimension, ldvr, of the array vr will be
  • if side='R' or 'B', ldvr= max1,n ;
  • if side='L', ldvr=1.
The second dimension of the array vr will be max1,mm if side='R' or 'B' and at least 1 if side='L'.
If side='R' or 'B', vr contains:
  • if howmny='A', the matrix X of right eigenvectors of A,B;
  • if howmny='B', the matrix ZX;
  • if howmny='S', the right eigenvectors of A,B specified by select, stored consecutively in the columns of the array vr, in the same order as their corresponding eigenvalues.
A complex eigenvector corresponding to a complex eigenvalue is stored in two consecutive columns, the first holding the real part, and the second the imaginary part.
If side='L', vr is not referenced.
3:     m int64int32nag_int scalar
The number of columns in the arrays vl and/or vr actually used to store the eigenvectors. If howmny='A' or 'B', m is set to n. Each selected real eigenvector occupies one column and each selected complex eigenvector occupies two columns.
4:     info int64int32nag_int scalar
info=0 unless the function detects an error (see Error Indicators and Warnings).

Error Indicators and Warnings

Cases prefixed with W are classified as warnings and do not generate an error of type NAG:error_n. See nag_issue_warnings.

   info=-i
If info=-i, parameter i had an illegal value on entry. The parameters are numbered as follows:
1: side, 2: howmny, 3: select, 4: n, 5: a, 6: lda, 7: b, 8: ldb, 9: vl, 10: ldvl, 11: vr, 12: ldvr, 13: mm, 14: m, 15: work, 16: 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.
W  info>0
If info=i, the 2 by 2 block info:info+1 does not have complex eigenvalues.

Accuracy

It is beyond the scope of this manual to summarise the accuracy of the solution of the generalized eigenvalue problem. Interested readers should consult Section 4.11 of the LAPACK Users' Guide (see Anderson et al. (1999)) and Chapter 6 of Stewart and Sun (1990).

Further Comments

nag_lapack_dtgevc (f08yk) is the sixth step in the solution of the real generalized eigenvalue problem and is called after nag_lapack_dhgeqz (f08xe).
The complex analogue of this function is nag_lapack_ztgevc (f08yx).

Example

This example computes the α and β arguments, which defines the generalized eigenvalues and the corresponding left and right eigenvectors, of the matrix pair A,B given by
A = 1.0 1.0 1.0 1.0 1.0 2.0 4.0 8.0 16.0 32.0 3.0 9.0 27.0 81.0 243.0 4.0 16.0 64.0 256.0 1024.0 5.0 25.0 125.0 625.0 3125.0   and   B= 1.0 2.0 3.0 4.0 5.0 1.0 4.0 9.0 16.0 25.0 1.0 8.0 27.0 64.0 125.0 1.0 16.0 81.0 256.0 625.0 1.0 32.0 243.0 1024.0 3125.0 .  
To compute generalized eigenvalues, it is required to call five functions: nag_lapack_dggbal (f08wh) to balance the matrix, nag_lapack_dgeqrf (f08ae) to perform the QR factorization of B, nag_lapack_dormqr (f08ag) to apply Q to A, nag_lapack_dgghrd (f08we) to reduce the matrix pair to the generalized Hessenberg form and nag_lapack_dhgeqz (f08xe) to compute the eigenvalues via the QZ algorithm.
The computation of generalized eigenvectors is done by calling nag_lapack_dtgevc (f08yk) to compute the eigenvectors of the balanced matrix pair. The function nag_lapack_dggbak (f08wj) is called to backward transform the eigenvectors to the user-supplied matrix pair. If both left and right eigenvectors are required then nag_lapack_dggbak (f08wj) must be called twice.
function f08yk_example


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

n = 5;
a = [ 1.0   1.0    1.0    1.0     1.0;
      2.0   4.0    8.0   16.0    32.0;
      3.0   9.0   27.0   81.0   243.0;
      4.0  16.0   64.0  256.0  1024.0;
      5.0  25.0  125.0  625.0  3125.0];
b = transpose(a);

% Balance A and B
job = 'B';
[a, b, ilo, ihi, lscale, rscale, info] = ...
  f08wh(job, a, b);

bbal = b(ilo:ihi,ilo:ihi);
abal = a(ilo:ihi,ilo:ihi);

% QR factorize balanced B
[QR, tau, info] = f08ae(bbal);

% Perform C = Q^T*A
side = 'Left';
trans = 'Transpose';
[C, info] = f08ag( ...
                   side, trans, QR, tau, abal);

% Form Q explicitly and let Z = I.
[Q, info] = f08af(QR, tau);
Z         = eye(n);

% Generalized Hessenberg form (C,R) -> (H,T)
jlo       = int64(1);
jhi       = int64(ihi-ilo+1);
compq     = 'Vectors Q';
compz     = 'Vectors Z';
[H, T, Q, Z, info] = ...
  f08we( ...
         compq, compz, jlo, jhi, C, QR, Q, Z);

% Find eigenvalues of generalized Hessenberg form
%    = eigenvalues of (A,B).
% and return Schur form for computing eigenvectors
job = 'Schur form';
[HS, TS, alphar, alphai, beta, Q, Z, info] = ...
  f08xe(...
        job, compq, compz, jlo, jhi, H, T, Q, Z);

% Obtain scaled eigenvectors from Schur form
side = 'Both sides';
howmny = 'Backtransformed using Q and Z';
select = [false];
[Q, Z, m, info] = f08yk( ...
                         side, howmny, select, HS, TS, Q, Z, jhi);

% rescale to obtain left and right eigenvectors of (A,B)
job  = 'Back scale';
side = 'Left';
[VL, info] = f08wj( ...
                    job, side, jlo, jhi, lscale, rscale, Q);
side = 'Right';
[VR, info] = f08wj( ...
                    job, side, jlo, jhi, lscale, rscale, Z);

% Display eigensolution
w = complex(alphar+i*alphai);
w = w./beta;
[ifail] = x04db( ...
                 'Gen', ' ', w, 'B', 'F7.3', ...
                 'Generalized eigenvalues of (A,B):', 'Int', 'N', ...
                 int64(80), int64(0));
fprintf('\n');
[ifail] = x04ca( ...
                 'Gen', ' ', VR, 'Right Eigenvectors');
fprintf('\n');
[ifail] = x04ca( ...
                 'Gen', ' ', VL, 'Left Eigenvectors');


f08yk example results

 Generalized eigenvalues of (A,B):
 1  ( -2.437,  0.000)
 2  (  0.607,  0.795)
 3  (  0.607, -0.795)
 4  (  1.000,  0.000)
 5  ( -0.410,  0.000)

 Right Eigenvectors
               1            2            3            4            5
 1   -4.9374E-02  -2.0772E-01   2.5702E-02  -7.4074E-02  -6.9466E-02
 2    1.0606E-01   1.7848E-01   8.8325E-02   1.3545E-01   1.3605E-01
 3   -1.0000E-01  -5.3742E-02  -4.6258E-02  -1.0000E-01  -1.0000E-01
 4    4.3761E-02   8.0277E-03   1.3765E-02   2.6455E-02   3.1879E-02
 5   -7.0192E-03  -5.5974E-04  -2.0807E-03  -3.7037E-03  -3.5534E-03

 Left Eigenvectors
               1            2            3            4            5
 1   -6.9466E-02  -2.0922E-01  -5.2678E-03  -7.4074E-02   4.9374E-02
 2    1.3605E-01   1.6346E-01   1.1371E-01   1.3545E-01  -1.0606E-01
 3   -1.0000E-01  -4.6314E-02  -5.3686E-02  -1.0000E-01   1.0000E-01
 4    3.1879E-02   5.9054E-03   1.4799E-02   2.6455E-02  -4.3761E-02
 5   -3.5534E-03  -2.4617E-04  -2.1404E-03  -3.7037E-03   7.0192E-03

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