PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_lapack_zhseqr (f08ps)
Purpose
nag_lapack_zhseqr (f08ps) computes all the eigenvalues and, optionally, the Schur factorization of a complex Hessenberg matrix or a complex general matrix which has been reduced to Hessenberg form.
Syntax
[
h,
w,
z,
info] = f08ps(
job,
compz,
ilo,
ihi,
h,
z, 'n',
n)
[
h,
w,
z,
info] = nag_lapack_zhseqr(
job,
compz,
ilo,
ihi,
h,
z, 'n',
n)
Description
nag_lapack_zhseqr (f08ps) computes all the eigenvalues and, optionally, the Schur factorization of a complex upper Hessenberg matrix
:
where
is an upper triangular matrix (the Schur form of
), and
is the unitary matrix whose columns are the Schur vectors
. The diagonal elements of
are the eigenvalues of
.
The function may also be used to compute the Schur factorization of a complex general matrix
which has been reduced to upper Hessenberg form
:
In this case, after
nag_lapack_zgehrd (f08ns) has been called to reduce
to Hessenberg form,
nag_lapack_zunghr (f08nt) must be called to form
explicitly;
is then passed to
nag_lapack_zhseqr (f08ps), which must be called with
.
The function can also take advantage of a previous call to
nag_lapack_zgebal (f08nv) 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_zhseqr (f08ps) directly. Also,
nag_lapack_zgebak (f08nw) must be called after this function to permute the Schur vectors of the balanced matrix to those of the original matrix. If
nag_lapack_zgebal (f08nv) has not been called however, then
must be set to
and
to
. Note that if the Schur factorization of
is required,
nag_lapack_zgebal (f08nv) must
not be called with
or
, because the balancing transformation is not unitary.
nag_lapack_zhseqr (f08ps) 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 complex factor of absolute value
.
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_zgebal (f08nv), 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:
– complex 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_zgehrd (f08ns).
- 6:
– complex 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 unitary 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:
– complex 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 triangular matrix
from the Schur decomposition (the Schur form) unless
.
- 2:
– complex array
-
The dimension of the array
w will be
The computed eigenvalues, unless
(in which case see
Error Indicators and Warnings). The eigenvalues are stored in the same order as on the diagonal of the Schur form
(if computed).
- 3:
– complex 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 unitary matrix of the required Schur vectors, unless
.
If
,
z is not referenced.
- 4:
– 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:
compz, 3:
n, 4:
ilo, 5:
ihi, 6:
h, 7:
ldh, 8:
w, 9:
z, 10:
ldz, 11:
work, 12:
lwork, 13:
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.
-
-
The algorithm has failed to find all the eigenvalues after a total of
iterations. If
, elements
and
of
w 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_ztrsna (f08qy).
Further Comments
The total number of real 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 real analogue of this function is
nag_lapack_dhseqr (f08pe).
Example
This example computes all the eigenvalues and the Schur factorization of the upper Hessenberg matrix
, where
See also
Example in
nag_lapack_zunghr (f08nt), which illustrates the use of this function to compute the Schur factorization of a general matrix.
Open in the MATLAB editor:
f08ps_example
function f08ps_example
fprintf('f08ps example results\n\n');
a = [ -3.97 - 5.04i, -4.11 + 3.70i, -0.34 + 1.01i, 1.29 - 0.86i;
0.34 - 1.50i, 1.52 - 0.43i, 1.88 - 5.38i, 3.36 + 0.65i;
3.31 - 3.85i, 2.50 + 3.45i, 0.88 - 1.08i, 0.64 - 1.48i;
-1.10 + 0.82i, 1.81 - 1.59i, 3.25 + 1.33i, 1.57 - 3.44i];
ilo = int64(1);
ihi = int64(4);
[H, tau, info] = f08ns(ilo, ihi, a);
[Q, info] = f08nt(ilo, ihi, H, tau);
job = 'Schur form';
compz = 'Vectors';
[~, w, Z, info] = f08ps( ...
job, compz, ilo, ihi, H, Q);
disp('Eigenvalues of A');
disp(w);
f08ps example results
Eigenvalues of A
-6.0004 - 6.9998i
-5.0000 + 2.0060i
7.9982 - 0.9964i
3.0023 - 3.9998i
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015