PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_lapack_dtrevc (f08qk)
Purpose
nag_lapack_dtrevc (f08qk) computes selected left and/or right eigenvectors of a real upper quasi-triangular matrix.
Syntax
[
select,
vl,
vr,
m,
info] = f08qk(
job,
howmny,
select,
t,
vl,
vr,
mm, 'n',
n)
[
select,
vl,
vr,
m,
info] = nag_lapack_dtrevc(
job,
howmny,
select,
t,
vl,
vr,
mm, 'n',
n)
Description
nag_lapack_dtrevc (f08qk) computes left and/or right eigenvectors of a real upper quasi-triangular matrix
in canonical Schur form. Such a matrix arises from the Schur factorization of a real general matrix, as computed by
nag_lapack_dhseqr (f08pe), for example.
The right eigenvector
, and the left eigenvector
, corresponding to an eigenvalue
, are defined by:
Note that even though
is real,
,
and
may be complex. If
is an eigenvector corresponding to a complex eigenvalue
, then the complex conjugate vector
is the eigenvector corresponding to the complex conjugate eigenvalue
.
The function can compute the eigenvectors corresponding to selected eigenvalues, or it can compute all the eigenvectors. In the latter case the eigenvectors may optionally be pre-multiplied by an input matrix . Normally is an orthogonal matrix from the Schur factorization of a matrix as ; if is a (left or right) eigenvector of , then is an eigenvector of .
The eigenvectors are computed by forward or backward substitution. They are scaled so that, for a real eigenvector ,
,
and for a complex eigenvector,
.
References
Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore
Parameters
Compulsory Input Parameters
- 1:
– string (length ≥ 1)
-
Indicates whether left and/or right eigenvectors are to be computed.
- Only right eigenvectors are computed.
- Only left eigenvectors are computed.
- Both left and right eigenvectors are computed.
Constraint:
, or .
- 2:
– string (length ≥ 1)
-
Indicates how many eigenvectors are to be computed.
- All eigenvectors (as specified by job) are computed.
- All eigenvectors (as specified by job) are computed and then pre-multiplied by the matrix (which is overwritten).
- Selected eigenvectors (as specified by job and select) are computed.
Constraint:
, or .
- 3:
– logical array
-
The dimension of the array
select
must be at least
if
, and at least
otherwise
Specifies which eigenvectors are to be computed if . To obtain the real eigenvector corresponding to the real eigenvalue , must be set true. To select the complex eigenvector corresponding to a complex conjugate pair of eigenvalues and , and/or must be set true; the eigenvector corresponding to the first eigenvalue in the pair is computed.
- 4:
– double array
-
The first dimension of the array
t must be at least
.
The second dimension of the array
t must be at least
.
The
by
upper quasi-triangular matrix
in canonical Schur form, as returned by
nag_lapack_dhseqr (f08pe).
- 5:
– 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 contain an
by
matrix
(usually the matrix of Schur vectors returned by
nag_lapack_dhseqr (f08pe)).
If
or
,
vl need not be set.
- 6:
– 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 contain an
by
matrix
(usually the matrix of Schur vectors returned by
nag_lapack_dhseqr (f08pe)).
If
or
,
vr need not be set.
- 7:
– int64int32nag_int scalar
-
The number of columns in the arrays
vl and/or
vr. The precise number of columns required,
, is
if
or
; if
,
is obtained by counting
for each selected real eigenvector and
for each selected complex eigenvector (see
select), in which case
.
Constraints:
- if or , ;
- otherwise .
Optional Input Parameters
- 1:
– int64int32nag_int scalar
-
Default:
the first dimension of the array
t and the second dimension of the array
t. (An error is raised if these dimensions are not equal.)
, the order of the matrix .
Constraint:
.
Output Parameters
- 1:
– logical array
-
The dimension of the array
select will be
if
and
otherwise
If a complex eigenvector was selected as specified above, then
is set to
true and
to
false.
If
or
,
select is not referenced.
- 2:
– 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 the computed left eigenvectors (as specified by
howmny and
select). The eigenvectors are stored consecutively in the columns of the array, in the same order as their eigenvalues. Corresponding to each real eigenvalue is a real eigenvector, occupying one column. Corresponding to each complex conjugate pair of eigenvalues, is a complex eigenvector occupying two columns; the first column holds the real part and the second column holds the imaginary part.
If
,
vl is not referenced.
- 3:
– 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 the computed right eigenvectors (as specified by
howmny and
select). The eigenvectors are stored consecutively in the columns of the array, in the same order as their eigenvalues. Corresponding to each real eigenvalue is a real eigenvector, occupying one column. Corresponding to each complex conjugate pair of eigenvalues, is a complex eigenvector occupying two columns; the first column holds the real part and the second column holds the imaginary part.
If
,
vr is not referenced.
- 4:
– int64int32nag_int scalar
-
, the number of columns of
vl and/or
vr actually used to store the computed eigenvectors. If
or
,
m is set to
.
- 5:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
-
If , parameter had an illegal value on entry. The parameters are numbered as follows:
1:
job, 2:
howmny, 3:
select, 4:
n, 5:
t, 6:
ldt, 7:
vl, 8:
ldvl, 9:
vr, 10:
ldvr, 11:
mm, 12:
m, 13:
work, 14:
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.
-
-
On entry, and .
Constraint:
if ,
else , where is obtained by counting for each selected real eigenvector and for each selected complex eigenvector.
Accuracy
If
is an exact right eigenvector, and
is the corresponding computed eigenvector, then the angle
between them is bounded as follows:
where
is the reciprocal condition number of
.
The condition number
may be computed by calling
nag_lapack_dtrsna (f08ql).
Further Comments
For a description of canonical Schur form, see the document for
nag_lapack_dhseqr (f08pe).
The complex analogue of this function is
nag_lapack_ztrevc (f08qx).
Example
See
Example in
nag_lapack_dgebal (f08nh).
Open in the MATLAB editor:
f08qk_example
function f08qk_example
fprintf('f08qk example results\n\n');
n = int64(4);
a = [ 5.14, 0.91, 0.00, -32.80;
0.91, 0.20, 0.00, 34.50;
1.90, 0.80, -0.40, -3.00;
-0.33, 0.35, 0.00, 0.66];
[a, ilo, ihi, scale, info] = f08nh( ...
'Both', a);
[H, tau, info] = f08ne( ...
ilo, ihi, a);
[Q, info] = f08nf( ...
ilo, ihi, H, tau);
[H, wr, wi, Z, info] = f08pe( ...
'Schur Form', 'Vectors', ilo, ihi, H, Q);
w = wr + i*wi;
disp('Eigenvalues:');
disp(w);
[select, ~, VR, m, info] = ...
f08qk( ...
'Right', 'Backtransform', false, H, zeros(1), Z, n);
[VR, info] = f08nj( ...
'Both', 'Right', ilo, ihi, scale, VR);
for j = 1:n
[~,k] = max(abs(VR(:,j)));
VR(:,j) =VR(:,j)/norm(VR(:,j));
if VR(k,j) < 0;
VR(:,j) = -VR(:,j);
end
end
disp('Eigenvectors:');
disp(VR);
f08qk example results
Eigenvalues:
-0.4000
-4.0208
3.0136
7.0072
Eigenvectors:
0 -0.4381 0.4654 0.9513
0 0.8923 0.7888 -0.1714
1.0000 -0.0481 0.3981 0.2494
0 -0.0976 0.0521 -0.0589
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015