NAG Library Routine Document
F08PSF (ZHSEQR)
1 Purpose
F08PSF (ZHSEQR) 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.
2 Specification
SUBROUTINE F08PSF ( |
JOB, COMPZ, N, ILO, IHI, H, LDH, W, Z, LDZ, WORK, LWORK, INFO) |
INTEGER |
N, ILO, IHI, LDH, LDZ, LWORK, INFO |
COMPLEX (KIND=nag_wp) |
H(LDH,*), W(*), Z(LDZ,*), WORK(max(1,LWORK)) |
CHARACTER(1) |
JOB, COMPZ |
|
The routine may be called by its
LAPACK
name zhseqr.
3 Description
F08PSF (ZHSEQR) computes all the eigenvalues and, optionally, the Schur factorization of a complex upper Hessenberg matrix
H:
where
T is an upper triangular matrix (the Schur form of
H), and
Z is the unitary matrix whose columns are the Schur vectors
zi. The diagonal elements of
T are the eigenvalues of
H.
The routine may also be used to compute the Schur factorization of a complex general matrix
A which has been reduced to upper Hessenberg form
H:
In this case, after
F08NSF (ZGEHRD) has been called to reduce
A to Hessenberg form,
F08NTF (ZUNGHR) must be called to form
Q explicitly;
Q is then passed to F08PSF (ZHSEQR), which must be called with
COMPZ='V'.
The routine can also take advantage of a previous call to
F08NVF (ZGEBAL) which may have balanced the original matrix before reducing it to Hessenberg form, so that the Hessenberg matrix
H has the structure:
where
H11 and
H33 are upper triangular. If so, only the central diagonal block
H22 (in rows and columns
ilo to
ihi) needs to be further reduced to Schur form (the blocks
H12 and
H23 are also affected). Therefore the values of
ilo and
ihi can be supplied to F08PSF (ZHSEQR) directly. Also,
F08NWF (ZGEBAK) must be called after this routine to permute the Schur vectors of the balanced matrix to those of the original matrix. If
F08NVF (ZGEBAL) has not been called however, then
ilo must be set to
1 and
ihi to
n. Note that if the Schur factorization of
A is required,
F08NVF (ZGEBAL) must
not be called with
JOB='S' or
'B', because the balancing transformation is not unitary.
F08PSF (ZHSEQR) uses a multishift form of the upper Hessenberg
QR algorithm, due to
Bai and Demmel (1989). The Schur vectors are normalized so that
zi2=1, but are determined only to within a complex factor of absolute value
1.
4 References
Bai Z and Demmel J W (1989) On a block implementation of Hessenberg multishift
QR 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: JOB – CHARACTER(1)Input
On entry: indicates whether eigenvalues only or the Schur form
T is required.
- JOB='E'
- Eigenvalues only are required.
- JOB='S'
- The Schur form T is required.
Constraint:
JOB='E' or 'S'.
- 2: COMPZ – CHARACTER(1)Input
On entry: indicates whether the Schur vectors are to be computed.
- COMPZ='N'
- No Schur vectors are computed (and the array Z is not referenced).
- COMPZ='I'
- The Schur vectors of H are computed (and the array Z is initialized by the routine).
- COMPZ='V'
- The Schur vectors of A are computed (and the array Z must contain the matrix Q on entry).
Constraint:
COMPZ='N', 'V' or 'I'.
- 3: N – INTEGERInput
On entry: n, the order of the matrix H.
Constraint:
N≥0.
- 4: ILO – INTEGERInput
- 5: IHI – INTEGERInput
On entry: if the matrix
A has been balanced by
F08NVF (ZGEBAL), then
ILO and
IHI must contain the values returned by that routine. Otherwise,
ILO must be set to
1 and
IHI to
N.
Constraint:
ILO≥1 and minILO,N ≤ IHI≤N .
- 6: H(LDH,*) – COMPLEX (KIND=nag_wp) arrayInput/Output
-
Note: the second dimension of the array
H
must be at least
max1,N.
On entry: the
n by
n upper Hessenberg matrix
H, as returned by
F08NSF (ZGEHRD).
On exit: if
JOB='E', the array contains no useful information.
If
JOB='S',
H is overwritten by the upper triangular matrix
T from the Schur decomposition (the Schur form) unless
INFO>0.
- 7: LDH – INTEGERInput
On entry: the first dimension of the array
H as declared in the (sub)program from which F08PSF (ZHSEQR) is called.
Constraint:
LDH≥max1,N.
- 8: W(*) – COMPLEX (KIND=nag_wp) arrayOutput
-
Note: the dimension of the array
W
must be at least
max1,N.
On exit: the computed eigenvalues, unless
INFO>0 (in which case see
Section 6). The eigenvalues are stored in the same order as on the diagonal of the Schur form
T (if computed).
- 9: Z(LDZ,*) – COMPLEX (KIND=nag_wp) arrayInput/Output
Note: the second dimension of the array
Z
must be at least
max1,N if
COMPZ='V' or
'I' and at least
1 if
COMPZ='N'.
On entry: if
COMPZ='V',
Z must contain the unitary matrix
Q from the reduction to Hessenberg form.
If
COMPZ='I',
Z need not be set.
On exit: if
COMPZ='V' or
'I',
Z contains the unitary matrix of the required Schur vectors, unless
INFO>0.
If
COMPZ='N',
Z is not referenced.
- 10: LDZ – INTEGERInput
On entry: the first dimension of the array
Z as declared in the (sub)program from which F08PSF (ZHSEQR) is called.
Constraints:
- if COMPZ='I' or 'V', LDZ≥ max1,N ;
- if COMPZ='N', LDZ≥1.
- 11: WORK(max1,LWORK) – COMPLEX (KIND=nag_wp) arrayWorkspace
On exit: if
INFO=0, the real part of
WORK1 contains the minimum value of
LWORK required for optimal performance.
- 12: LWORK – INTEGERInput
On entry: the dimension of the array
WORK as declared in the (sub)program from which F08PSF (ZHSEQR) is called, unless
LWORK=-1, in which case a workspace query is assumed and the routine only calculates the minimum dimension of
WORK.
Constraint:
LWORK≥max1,N or LWORK=-1.
- 13: INFO – INTEGEROutput
On exit:
INFO=0 unless the routine detects an error (see
Section 6).
6 Error Indicators and Warnings
Errors or warnings detected by the routine:
- INFO<0
If INFO=-i, argument i had an illegal value. An explanatory message is output, and execution of the program is terminated.
- INFO>0
The algorithm has failed to find all the eigenvalues after a total of
30×IHI-ILO+1 iterations. If
INFO=i, elements
1,2,…,ILO-1 and
i+1,i+2,…,n of
W
contain the eigenvalues which have been found.
If
JOB='E', then on exit, the remaining unconverged eigenvalues are the eigenvalues of the upper Hessenberg matrix
H^, formed from
HILO:INFOILO:INFO
, i.e., the
ILO through
INFO rows and columns of the final output matrix
H.
If
JOB='S', then on exit
for some matrix
U, where
Hi is the input upper Hessenberg matrix and
H~ is an upper Hessenberg matrix formed from
HINFO+1:IHIINFO+1:IHI
.
If
COMPZ='V', then on exit
where
U is defined in
* (regardless of the value of
JOB).
If
COMPZ='I', then on exit
where
U is defined in
* (regardless of the value of
JOB).
If
INFO>0 and
COMPZ='N', then
Z is not accessed.
7 Accuracy
The computed Schur factorization is the exact factorization of a nearby matrix
H+E, where
and
ε is the
machine precision.
If
λi is an exact eigenvalue, and
λ~i is the corresponding computed value, then
where
cn is a modestly increasing function of
n, and
si is the reciprocal condition number of
λi. The condition numbers
si may be computed by calling
F08QYF (ZTRSNA).
8 Further Comments
The total number of real floating point operations depends on how rapidly the algorithm converges, but is typically about:
- 25n3 if only eigenvalues are computed;
- 35n3 if the Schur form is computed;
- 70n3 if the full Schur factorization is computed.
The real analogue of this routine is
F08PEF (DHSEQR).
9 Example
This example computes all the eigenvalues and the Schur factorization of the upper Hessenberg matrix
H, where
See also
Section 9 in F08NTF (ZUNGHR), which illustrates the use of this routine to compute the Schur factorization of a general matrix.
9.1 Program Text
Program Text (f08psfe.f90)
9.2 Program Data
Program Data (f08psfe.d)
9.3 Program Results
Program Results (f08psfe.r)