PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_lapack_dtgevc (f08yk)
Purpose
nag_lapack_dtgevc (f08yk) computes some or all of the right and/or left generalized eigenvectors of a pair of real matrices 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
which is assumed to be in generalized upper Schur form. If the matrix pair
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
and the left generalized eigenvector
of
corresponding to a generalized eigenvalue
are defined by
and
If a generalized eigenvalue is determined as
, which is due to zero diagonal elements at the same locations in both
and
, 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
and/or
of right or left eigenvectors of
, or the products
and/or
, where
and
are two matrices supplied by you. Usually,
and
are chosen as the orthogonal matrices returned by
nag_lapack_dhgeqz (f08xe). Equivalently,
and
are the left and right Schur vectors of the matrix pair supplied to
nag_lapack_dhgeqz (f08xe). In that case,
and
are the left and right generalized eigenvectors, respectively, of the matrix pair supplied to
nag_lapack_dhgeqz (f08xe).
must be block upper triangular; with by and by diagonal blocks. Corresponding to each by 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 by 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:
– string (length ≥ 1)
-
Specifies the required sets of generalized eigenvectors.
- Only right eigenvectors are computed.
- Only left eigenvectors are computed.
- Both left and right eigenvectors are computed.
Constraint:
, or .
- 2:
– string (length ≥ 1)
-
Specifies further details of the required generalized eigenvectors.
- All right and/or left eigenvectors are computed.
- All right and/or left eigenvectors are computed; they are backtransformed using the input matrices supplied in arrays vr and/or vl.
- Selected right and/or left eigenvectors, defined by the array select, are computed.
Constraint:
, or .
- 3:
– logical array
-
The dimension of the array
select
must be at least
if
, and at least
otherwise
Specifies the eigenvectors to be computed if
. To select the generalized eigenvector corresponding to the
th generalized eigenvalue, the
th 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
or
,
select is not referenced.
Constraint:
if , or , for .
- 4:
– double array
-
The first dimension of the array
a must be at least
.
The second dimension of the array
a must be at least
.
The matrix pair
must be in the generalized Schur form. Usually, this is the matrix
returned by
nag_lapack_dhgeqz (f08xe).
- 5:
– double array
-
The first dimension of the array
b must be at least
.
The second dimension of the array
b must be at least
.
The matrix pair
must be in the generalized Schur form. If
has a
by
diagonal block then the corresponding
by
block of
must be diagonal with positive elements. Usually, this is the matrix
returned by
nag_lapack_dhgeqz (f08xe).
- 6:
– double array
-
The first dimension,
, of the array
vl must satisfy
- if or , ;
- if , .
The second dimension of the array
vl must be at least
if
or
and at least
if
.
If
and
or
,
vl must be initialized to an
by
matrix
. Usually, this is the orthogonal matrix
of left Schur vectors returned by
nag_lapack_dhgeqz (f08xe).
- 7:
– double array
-
The first dimension,
, of the array
vr must satisfy
- if or , ;
- if , .
The second dimension of the array
vr must be at least
if
or
and at least
if
.
If
and
or
,
vr must be initialized to an
by
matrix
. Usually, this is the orthogonal matrix
of right Schur vectors returned by
nag_lapack_dhgeqz (f08xe).
- 8:
– int64int32nag_int scalar
-
The number of columns in the arrays
vl and/or
vr.
Constraints:
- if or , ;
- if , mm must not be less than the number of requested eigenvectors.
Optional Input Parameters
- 1:
– int64int32nag_int scalar
-
Default:
the first dimension of the arrays
vl,
vr. (An error is raised if these dimensions are not equal.)
, the order of the matrices and .
Constraint:
.
Output Parameters
- 1:
– double array
-
The first dimension,
, of the array
vl will be
- if or , ;
- if , .
The second dimension of the array
vl will be
if
or
and at least
if
.
If
or
,
vl contains:
- if , the matrix of left eigenvectors of ;
- if , the matrix ;
- if , the left eigenvectors of 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
,
vl is not referenced.
- 2:
– double array
-
The first dimension,
, of the array
vr will be
- if or , ;
- if , .
The second dimension of the array
vr will be
if
or
and at least
if
.
If
or
,
vr contains:
- if , the matrix of right eigenvectors of ;
- if , the matrix ;
- if , the right eigenvectors of 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
,
vr is not referenced.
- 3:
– int64int32nag_int scalar
-
The number of columns in the arrays
vl and/or
vr actually used to store the eigenvectors. If
or
,
m is set to
n. Each selected real eigenvector occupies one column and each selected complex eigenvector occupies two columns.
- 4:
– int64int32nag_int scalar
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.
-
If , parameter 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
-
If , the by block 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
given by
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
factorization of
,
nag_lapack_dormqr (f08ag) to apply
to
,
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
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.
Open in the MATLAB editor:
f08yk_example
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);
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, tau, info] = f08ae(bbal);
side = 'Left';
trans = 'Transpose';
[C, info] = f08ag( ...
side, trans, QR, tau, abal);
[Q, info] = f08af(QR, tau);
Z = eye(n);
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);
job = 'Schur form';
[HS, TS, alphar, alphai, beta, Q, Z, info] = ...
f08xe(...
job, compq, compz, jlo, jhi, H, T, Q, Z);
side = 'Both sides';
howmny = 'Backtransformed using Q and Z';
select = [false];
[Q, Z, m, info] = f08yk( ...
side, howmny, select, HS, TS, Q, Z, jhi);
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);
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)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015