NAG Library Routine Document
F08PEF (DHSEQR)
1 Purpose
F08PEF (DHSEQR) 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.
2 Specification
SUBROUTINE F08PEF ( |
JOB, COMPZ, N, ILO, IHI, H, LDH, WR, WI, Z, LDZ, WORK, LWORK, INFO) |
INTEGER |
N, ILO, IHI, LDH, LDZ, LWORK, INFO |
REAL (KIND=nag_wp) |
H(LDH,*), WR(*), WI(*), Z(LDZ,*), WORK(max(1,LWORK)) |
CHARACTER(1) |
JOB, COMPZ |
|
The routine may be called by its
LAPACK
name dhseqr.
3 Description
F08PEF (DHSEQR) 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
Section 9 for details of the structure of
.
The routine 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
F08NEF (DGEHRD) has been called to reduce
to Hessenberg form,
F08NFF (DORGHR) must be called to form
explicitly;
is then passed to F08PEF (DHSEQR), which must be called with
.
The routine can also take advantage of a previous call to
F08NHF (DGEBAL) 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 F08PEF (DHSEQR) directly. Also,
F08NJF (DGEBAK) must be called after this routine to permute the Schur vectors of the balanced matrix to those of the original matrix. If
F08NHF (DGEBAL) has not been called however, then
must be set to
and
to
. Note that if the Schur factorization of
is required,
F08NHF (DGEBAL) must
not be called with
or
, because the balancing transformation is not orthogonal.
F08PEF (DHSEQR) 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
.
4 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
5 Parameters
- 1: – CHARACTER(1)Input
-
On entry: indicates whether eigenvalues only or the Schur form
is required.
- Eigenvalues only are required.
- The Schur form is required.
Constraint:
or .
- 2: – CHARACTER(1)Input
-
On entry: 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 routine).
Constraint:
, or .
- 3: – INTEGERInput
-
On entry: , the order of the matrix .
Constraint:
.
- 4: – INTEGERInput
- 5: – INTEGERInput
-
On entry: if the matrix
has been balanced by
F08NHF (DGEBAL), then
ILO and
IHI must contain the values returned by that routine. Otherwise,
ILO must be set to
and
IHI to
N.
Constraint:
and .
- 6: – REAL (KIND=nag_wp) arrayInput/Output
-
Note: the second dimension of the array
H
must be at least
.
On entry: the
by
upper Hessenberg matrix
, as returned by
F08NEF (DGEHRD).
On exit: if
, the array contains no useful information.
If
,
H is overwritten by the upper quasi-triangular matrix
from the Schur decomposition (the Schur form) unless
.
- 7: – INTEGERInput
-
On entry: the first dimension of the array
H as declared in the (sub)program from which F08PEF (DHSEQR) is called.
Constraint:
.
- 8: – REAL (KIND=nag_wp) arrayOutput
- 9: – REAL (KIND=nag_wp) arrayOutput
-
Note: the dimension of the arrays
WR and
WI
must be at least
.
On exit: the real and imaginary parts, respectively, of the computed eigenvalues, unless
(in which case see
Section 6). 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
Section 9 for details.
- 10: – REAL (KIND=nag_wp) arrayInput/Output
-
Note: the second dimension of the array
Z
must be at least
if
or
and at least
if
.
On entry: if
,
Z must contain the orthogonal matrix
from the reduction to Hessenberg form.
If
,
Z need not be set.
On exit: if
or
,
Z contains the orthogonal matrix of the required Schur vectors, unless
.
If
,
Z is not referenced.
- 11: – INTEGERInput
-
On entry: the first dimension of the array
Z as declared in the (sub)program from which F08PEF (DHSEQR) is called.
Constraints:
- if or , ;
- if , .
- 12: – REAL (KIND=nag_wp) arrayWorkspace
-
On exit: if
,
contains the minimum value of
LWORK required for optimal performance.
- 13: – INTEGERInput
-
On entry: the dimension of the array
WORK as declared in the (sub)program from which F08PEF (DHSEQR) is called, unless
, in which case a workspace query is assumed and the routine only calculates the minimum dimension of
WORK.
Constraint:
or .
- 14: – INTEGEROutput
On exit:
unless the routine detects an error (see
Section 6).
6 Error Indicators and Warnings
-
If , argument had an illegal value. An explanatory message is output, and execution of the program is terminated.
-
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.
7 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
F08QLF (DTRSNA).
8 Parallelism and Performance
F08PEF (DHSEQR) is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
F08PEF (DHSEQR) makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the
X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the
Users' Note for your implementation for any additional implementation-specific information.
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 routine is
F08PSF (ZHSEQR).
10 Example
This example computes all the eigenvalues and the Schur factorization of the upper Hessenberg matrix
, where
See also
Section 10 in F08NFF (DORGHR), which illustrates the use of this routine to compute the Schur factorization of a general matrix.
10.1 Program Text
Program Text (f08pefe.f90)
10.2 Program Data
Program Data (f08pefe.d)
10.3 Program Results
Program Results (f08pefe.r)