PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_lapack_dhseqr (f08pe)
Purpose
nag_lapack_dhseqr (f08pe) computes all the eigenvalues and, optionally, the Schur factorization of a real Hessenberg matrix or a real general matrix which has been reduced to Hessenberg form.
Syntax
[
h,
wr,
wi,
z,
info] = f08pe(
job,
compz,
ilo,
ihi,
h,
z, 'n',
n)
[
h,
wr,
wi,
z,
info] = nag_lapack_dhseqr(
job,
compz,
ilo,
ihi,
h,
z, 'n',
n)
Description
nag_lapack_dhseqr (f08pe) computes all the eigenvalues and, optionally, the Schur factorization of a real upper Hessenberg matrix
:
where
is an upper quasi-triangular matrix (the Schur form of
), and
is the orthogonal matrix whose columns are the Schur vectors
. See
Further Comments for details of the structure of
.
The function may also be used to compute the Schur factorization of a real general matrix
which has been reduced to upper Hessenberg form
:
In this case, after
nag_lapack_dgehrd (f08ne) has been called to reduce
to Hessenberg form,
nag_lapack_dorghr (f08nf) must be called to form
explicitly;
is then passed to
nag_lapack_dhseqr (f08pe), which must be called with
.
The function can also take advantage of a previous call to
nag_lapack_dgebal (f08nh) which may have balanced the original matrix before reducing it to Hessenberg form, so that the Hessenberg matrix
has the structure:
where
and
are upper triangular. If so, only the central diagonal block
(in rows and columns
to
) needs to be further reduced to Schur form (the blocks
and
are also affected). Therefore the values of
and
can be supplied to
nag_lapack_dhseqr (f08pe) directly. Also,
nag_lapack_dgebak (f08nj) must be called after this function to permute the Schur vectors of the balanced matrix to those of the original matrix. If
nag_lapack_dgebal (f08nh) has not been called however, then
must be set to
and
to
. Note that if the Schur factorization of
is required,
nag_lapack_dgebal (f08nh) must
not be called with
or
, because the balancing transformation is not orthogonal.
nag_lapack_dhseqr (f08pe) uses a multishift form of the upper Hessenberg
algorithm, due to
Bai and Demmel (1989). The Schur vectors are normalized so that
, but are determined only to within a factor
.
References
Bai Z and Demmel J W (1989) On a block implementation of Hessenberg multishift iteration Internat. J. High Speed Comput. 1 97–112
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 eigenvalues only or the Schur form
is required.
- Eigenvalues only are required.
- The Schur form is required.
Constraint:
or .
- 2:
– string (length ≥ 1)
-
Indicates whether the Schur vectors are to be computed.
- No Schur vectors are computed (and the array z is not referenced).
- The Schur vectors of are computed (and the array z must contain the matrix on entry).
- The Schur vectors of are computed (and the array z is initialized by the function).
Constraint:
, or .
- 3:
– int64int32nag_int scalar
- 4:
– int64int32nag_int scalar
-
If the matrix
has been balanced by
nag_lapack_dgebal (f08nh), then
ilo and
ihi must contain the values returned by that function. Otherwise,
ilo must be set to
and
ihi to
n.
Constraint:
and .
- 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
, as returned by
nag_lapack_dgehrd (f08ne).
- 6:
– double array
-
The first dimension,
, of the array
z must satisfy
- if or , ;
- if , .
The second dimension of the array
z must be at least
if
or
and at least
if
.
If
,
z must contain the orthogonal matrix
from the reduction to Hessenberg form.
If
,
z need not be set.
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:
– double array
-
The first dimension of the array
h will be
.
The second dimension of the array
h will be
.
If
, the array contains no useful information.
If
,
h stores the upper quasi-triangular matrix
from the Schur decomposition (the Schur form) unless
.
- 2:
– double array
- 3:
– double array
-
The dimension of the arrays
wr and
wi will be
The real and imaginary parts, respectively, of the computed eigenvalues, unless
(in which case see
Error Indicators and Warnings). Complex conjugate pairs of eigenvalues appear consecutively with the eigenvalue having positive imaginary part first. The eigenvalues are stored in the same order as on the diagonal of the Schur form
(if computed); see
Further Comments for details.
- 4:
– double array
-
The first dimension,
, of the array
z will be
- if or , ;
- if , .
The second dimension of the array
z will be
if
or
and at least
if
.
If
or
,
z contains the orthogonal matrix of the required Schur vectors, unless
.
If
,
z is not referenced.
- 5:
– 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:
compz, 3:
n, 4:
ilo, 5:
ihi, 6:
h, 7:
ldh, 8:
wr, 9:
wi, 10:
z, 11:
ldz, 12:
work, 13:
lwork, 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.
- W
-
The algorithm has failed to find all the eigenvalues after a total of
iterations. If
, elements
and
of
wr and
wi contain the real and imaginary parts of contain the eigenvalues which have been found.
If
, then on exit, the remaining unconverged eigenvalues are the eigenvalues of the upper Hessenberg matrix
, formed from
, i.e., the
ilo through
info rows and columns of the final output matrix
.
If
, then on exit
for some matrix
, where
is the input upper Hessenberg matrix and
is an upper Hessenberg matrix formed from
.
If
, then on exit
where
is defined in
(regardless of the value of
job).
If
, then on exit
where
is defined in
(regardless of the value of
job).
If
and
, then
z is not accessed.
Accuracy
The computed Schur factorization is the exact factorization of a nearby matrix
, where
and
is the
machine precision.
If
is an exact eigenvalue, and
is the corresponding computed value, then
where
is a modestly increasing function of
, and
is the reciprocal condition number of
. The condition numbers
may be computed by calling
nag_lapack_dtrsna (f08ql).
Further Comments
The total number of floating-point operations depends on how rapidly the algorithm converges, but is typically about:
- if only eigenvalues are computed;
- if the Schur form is computed;
- if the full Schur factorization is computed.
The Schur form has the following structure (referred to as canonical Schur form).
If all the computed eigenvalues are real, is upper triangular, and the diagonal elements of are the eigenvalues; , for , and .
If some of the computed eigenvalues form complex conjugate pairs, then
has
by
diagonal blocks. Each diagonal block has the form
where
. The corresponding eigenvalues are
;
;
;
.
The complex analogue of this function is
nag_lapack_zhseqr (f08ps).
Example
This example computes all the eigenvalues and the Schur factorization of the upper Hessenberg matrix
, where
See also
Example in
nag_lapack_dorghr (f08nf), which illustrates the use of this function to compute the Schur factorization of a general matrix.
Open in the MATLAB editor:
f08pe_example
function f08pe_example
fprintf('f08pe example results\n\n');
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 = int64(4);
[H, tau, info] = f08ne(ilo, ihi, a);
[Q, info] = f08nf(ilo, ihi, H, tau);
job = 'Schur form';
compz = 'Vectors';
[~, wr, wi, Z, info] = f08pe( ...
job, compz, ilo, ihi, H, Q);
w = wr + i*wi;
disp('Eigenvalues of A');
disp(w);
f08pe example results
Eigenvalues of A
0.7995 + 0.0000i
-0.0994 + 0.4008i
-0.0994 - 0.4008i
-0.1007 + 0.0000i
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015