PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_lapack_dhsein (f08pk)
Purpose
nag_lapack_dhsein (f08pk) computes selected left and/or right eigenvectors of a real upper Hessenberg matrix corresponding to specified eigenvalues, by inverse iteration.
Syntax
[
select,
wr,
vl,
vr,
m,
ifaill,
ifailr,
info] = f08pk(
job,
eigsrc,
initv,
select,
h,
wr,
wi,
vl,
vr,
mm, 'n',
n)
[
select,
wr,
vl,
vr,
m,
ifaill,
ifailr,
info] = nag_lapack_dhsein(
job,
eigsrc,
initv,
select,
h,
wr,
wi,
vl,
vr,
mm, 'n',
n)
Description
nag_lapack_dhsein (f08pk) computes left and/or right eigenvectors of a real upper Hessenberg matrix , corresponding to selected eigenvalues.
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 eigenvectors are computed by inverse iteration. They are scaled so that, for a real eigenvector ,
,
and for a complex eigenvector,
.
If
has been formed by reduction of a real general matrix
to upper Hessenberg form, then the eigenvectors of
may be transformed to eigenvectors of
by a call to
nag_lapack_dormhr (f08ng).
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 whether the eigenvalues of
(stored in
wr and
wi) were found using
nag_lapack_dhseqr (f08pe).
- The eigenvalues of were found using nag_lapack_dhseqr (f08pe); thus if has any zero subdiagonal elements (and so is block triangular), then the th eigenvalue can be assumed to be an eigenvalue of the block containing the th row/column. This property allows the function to perform inverse iteration on just one diagonal block.
- No such assumption is made and the function performs inverse iteration using the whole matrix.
Constraint:
or .
- 3:
– string (length ≥ 1)
-
Indicates whether you are supplying initial estimates for the selected eigenvectors.
- No initial estimates are supplied.
- Initial estimates are supplied in vl and/or vr.
Constraint:
or .
- 4:
– logical array
-
The dimension of the array
select
must be at least
Specifies which eigenvectors are to be computed. To obtain the real eigenvector corresponding to the real eigenvalue , must be set true. To select the complex eigenvector corresponding to the complex eigenvalue with complex conjugate (), and/or must be set true; the eigenvector corresponding to the first eigenvalue in the pair is computed.
- 5:
– double array
-
The first dimension of the array
h must be at least
.
The second dimension of the array
h must be at least
.
The by upper Hessenberg matrix .
- 6:
– double array
- 7:
– double array
-
The dimension of the arrays
wr and
wi
must be at least
The real and imaginary parts, respectively, of the eigenvalues of the matrix
. Complex conjugate pairs of values must be stored in consecutive elements of the arrays. If
, the arrays
must be exactly as returned by
nag_lapack_dhseqr (f08pe).
- 8:
– 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 starting vectors for inverse iteration for the left eigenvectors. Each starting vector must be stored in the same column or columns as will be used to store the corresponding eigenvector (see below).
If
,
vl need not be set.
- 9:
– 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 starting vectors for inverse iteration for the right eigenvectors. Each starting vector must be stored in the same column or columns as will be used to store the corresponding eigenvector (see below).
If
,
vr need not be set.
- 10:
– int64int32nag_int scalar
-
The number of columns in the arrays
vl and/or
vr . The actual number of columns required,
, is obtained by counting
for each selected real eigenvector and
for each selected complex eigenvector (see
select);
.
Constraint:
.
Optional Input Parameters
- 1:
– int64int32nag_int scalar
-
Default:
the first dimension of the array
h and the second dimension of the array
h. (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 a complex eigenvector was selected as specified above, then is set to true and to false.
- 2:
– double array
-
The dimension of the arrays
wr and
wi will be
Some elements of
wr may be modified, as close eigenvalues are perturbed slightly in searching for independent eigenvectors.
- 3:
– 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
select). The eigenvectors are stored consecutively in the columns of the array, in the same order as their eigenvalues. Corresponding to each selected real eigenvalue is a real eigenvector, occupying one column. Corresponding to each selected complex eigenvalue 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.
- 4:
– 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
select). The eigenvectors are stored consecutively in the columns of the array, in the same order as their eigenvalues. Corresponding to each selected real eigenvalue is a real eigenvector, occupying one column. Corresponding to each selected complex eigenvalue 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.
- 5:
– int64int32nag_int scalar
-
, the number of columns of
vl and/or
vr required to store the selected eigenvectors.
- 6:
– int64int32nag_int array
-
The dimension of the array
ifaill will be
if
or
and at least
if
If
or
, then
if the selected left eigenvector converged and
if the eigenvector stored in the
th column of
vl (corresponding to the
th eigenvalue as held in
failed to converge. If the
th and
th columns of
vl contain a selected complex eigenvector, then
and
are set to the same value.
If
,
ifaill is not referenced.
- 7:
– int64int32nag_int array
-
The dimension of the array
ifailr will be
if
or
and at least
if
If
or
, then
if the selected right eigenvector converged and
if the eigenvector stored in the
th row or column of
vr (corresponding to the
th eigenvalue as held in
) failed to converge. If the
th and
th rows or columns of
vr contain a selected complex eigenvector, then
and
are set to the same value.
If
,
ifailr is not referenced.
- 8:
– 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:
job, 2:
eigsrc, 3:
initv, 4:
select, 5:
n, 6:
h, 7:
ldh, 8:
wr, 9:
wi, 10:
vl, 11:
ldvl, 12:
vr, 13:
ldvr, 14:
mm, 15:
m, 16:
work, 17:
ifaill, 18:
ifailr, 19:
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
, then
eigenvectors (as indicated by the arguments
ifaill and/or
ifailr above) failed to converge. The corresponding columns of
vl and/or
vr contain no useful information.
Accuracy
Each computed right eigenvector
is the exact eigenvector of a nearby matrix
, such that
. Hence the residual is small:
However, eigenvectors corresponding to close or coincident eigenvalues may not accurately span the relevant subspaces.
Similar remarks apply to computed left eigenvectors.
Further Comments
The complex analogue of this function is
nag_lapack_zhsein (f08px).
Example
See
Example in
nag_lapack_dormhr (f08ng).
Open in the MATLAB editor:
f08pk_example
function f08pk_example
fprintf('f08pk example results\n\n');
n = int64(4);
a = [ 0.35, 0.45, -0.14, -0.17;
0.09, 0.07, -0.54, 0.35;
-0.44, -0.33, -0.03, 0.17;
0.25, -0.32, -0.13, 0.11];
ilo = int64(1);
ihi = n;
[H, tau, info] = f08ne(ilo, ihi, a);
[Q, info] = f08nf(ilo, ihi, H, tau);
job = 'Schur form';
compz = 'No Vectors';
[~, wr, wi, ~, info] = f08pe( ...
job, compz, ilo, ihi, H, Q);
w = wr + i*wi;
disp('Eigenvalues of A');
disp(w);
select = (wr < 0);
job = 'Right';
eigsrc = 'QR';
initv = 'No initial vectors';
vl = [];
vr = zeros(n,n);
[~, ~, ~, VR, m, ifaill, ifailr, info] = ...
f08pk( ...
job, eigsrc, initv, select, H, wr, wi, vl, vr, n);
side = 'Left';
trans = 'No transpose';
[V, info] = f08ng( ...
side, trans, ilo, ihi, H, tau, VR);
j = 0;
for k = 1:n
if select(k)
j = j+1;
if (wi(k)==0)
[~,l] = max(abs(V(:,j)));
if V(l,j) < 0;
V(:,j) = -V(:,j);
end
Z(:,j) = complex(V(:,j));
else
[~,l] = max(abs(V(:,j))+abs(V(:,j+1)));
Z(:,j) = V(:,j) + i*V(:,j+1);
Z(:,j+1) = V(:,j) - i*V(:,j+1);
Z(:,j) = Z(:,j) *conj(Z(l,j)) /abs(Z(l,j));
Z(:,j+1) = Z(:,j+1)*conj(Z(l,j+1))/abs(Z(l,j+1));
j = j+1;
select(k+1) = false;
end
end
end
disp('Eigenvectors corresponding to eigenvalues with negative real part');
disp(Z);
f08pk example results
Eigenvalues of A
0.7995 + 0.0000i
-0.0994 + 0.4008i
-0.0994 - 0.4008i
-0.1007 + 0.0000i
Eigenvectors corresponding to eigenvalues with negative real part
-0.2379 + 0.3134i -0.2379 - 0.3134i 0.1493 + 0.0000i
0.3100 - 0.6430i 0.3100 + 0.6430i 0.3956 + 0.0000i
0.1196 - 0.3795i 0.1196 + 0.3795i 0.7075 + 0.0000i
0.8319 + 0.0000i 0.8319 + 0.0000i 0.8603 + 0.0000i
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015