NAG FL Interface
f08pef (dhseqr)

Settings help

FL Name Style:


FL Specification Language:


1 Purpose

f08pef 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

Fortran Interface
Subroutine f08pef ( job, compz, n, ilo, ihi, h, ldh, wr, wi, z, ldz, work, lwork, info)
Integer, Intent (In) :: n, ilo, ihi, ldh, ldz, lwork
Integer, Intent (Out) :: info
Real (Kind=nag_wp), Intent (Inout) :: h(ldh,*), wr(*), wi(*), z(ldz,*)
Real (Kind=nag_wp), Intent (Out) :: work(max(1,lwork))
Character (1), Intent (In) :: job, compz
C Header Interface
#include <nag.h>
void  f08pef_ (const char *job, const char *compz, const Integer *n, const Integer *ilo, const Integer *ihi, double h[], const Integer *ldh, double wr[], double wi[], double z[], const Integer *ldz, double work[], const Integer *lwork, Integer *info, const Charlen length_job, const Charlen length_compz)
The routine may be called by the names f08pef, nagf_lapackeig_dhseqr or its LAPACK name dhseqr.

3 Description

f08pef computes all the eigenvalues and, optionally, the Schur factorization of a real upper Hessenberg matrix H:
H = ZTZT ,  
where T is an upper quasi-triangular matrix (the Schur form of H), and Z is the orthogonal matrix whose columns are the Schur vectors zi. See Section 9 for details of the structure of T.
The routine may also be used to compute the Schur factorization of a real general matrix A which has been reduced to upper Hessenberg form H:
A = QHQT, where ​Q​ is orthogonal, = (QZ)T(QZ)T.  
In this case, after f08nef has been called to reduce A to Hessenberg form, f08nff must be called to form Q explicitly; Q is then passed to f08pef, which must be called with compz='V'.
The routine can also take advantage of a previous call to f08nhf which may have balanced the original matrix before reducing it to Hessenberg form, so that the Hessenberg matrix H has the structure:
( H11 H12 H13 H22 H23 H33 )  
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 f08pef directly. Also, f08njf must be called after this routine to permute the Schur vectors of the balanced matrix to those of the original matrix. If f08nhf 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, f08nhf must not be called with job='S' or 'B', because the balancing transformation is not orthogonal.
f08pef 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 factor ±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 Arguments

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='V'
The Schur vectors of A are computed (and the array z must contain the matrix Q on entry).
compz='I'
The Schur vectors of H are computed (and the array z is initialized by the routine).
Constraint: compz='N', 'V' or 'I'.
3: n Integer Input
On entry: n, the order of the matrix H.
Constraint: n0.
4: ilo Integer Input
5: ihi Integer Input
On entry: if the matrix A has been balanced by f08nhf, ilo and ihi must contain the values returned by that routine. Otherwise, ilo must be set to 1 and ihi to n.
Constraint: ilo1 and min(ilo,n) ihin .
6: h(ldh,*) Real (Kind=nag_wp) array Input/Output
Note: the second dimension of the array h must be at least max(1,n).
On entry: the n×n upper Hessenberg matrix H, as returned by f08nef.
On exit: if job='E', the array contains no useful information.
If job='S', h is overwritten by the upper quasi-triangular matrix T from the Schur decomposition (the Schur form) unless info>0.
7: ldh Integer Input
On entry: the first dimension of the array h as declared in the (sub)program from which f08pef is called.
Constraint: ldhmax(1,n).
8: wr(*) Real (Kind=nag_wp) array Output
9: wi(*) Real (Kind=nag_wp) array Output
Note: the dimension of the arrays wr and wi must be at least max(1,n).
On exit: the real and imaginary parts, respectively, of the computed eigenvalues, unless info>0 (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 T (if computed); see Section 9 for details.
10: z(ldz,*) Real (Kind=nag_wp) array Input/Output
Note: the second dimension of the array z must be at least max(1,n) if compz='V' or 'I' and at least 1 if compz='N'.
On entry: if compz='V', z must contain the orthogonal 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 orthogonal matrix of the required Schur vectors, unless info>0.
If compz='N', z is not referenced.
11: ldz Integer Input
On entry: the first dimension of the array z as declared in the (sub)program from which f08pef is called.
Constraints:
  • if compz='V' or 'I', ldz max(1,n) ;
  • if compz='N', ldz1.
12: work(max(1,lwork)) Real (Kind=nag_wp) array Workspace
On exit: if info=0, work(1) contains the minimum value of lwork required for optimal performance.
13: lwork Integer Input
On entry: the dimension of the array work as declared in the (sub)program from which f08pef is called, unless lwork=-1, in which case a workspace query is assumed and the routine only calculates the minimum dimension of work.
Constraint: lworkmax(1,n) or lwork=-1.
14: info Integer Output
On exit: info=0 unless the routine detects an error (see Section 6).

6 Error Indicators and Warnings

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 wr and wi contain the real and imaginary parts of 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 h(ilo:info,ilo:info) , i.e., the ilo through info rows and columns of the final output matrix H.
If job='S', then on exit
(*) Hi U = U H~  
for some matrix U, where Hi is the input upper Hessenberg matrix and H~ is an upper Hessenberg matrix formed from h(info+1:ihi,info+1:ihi) .
If compz='V', then on exit
Zout = Zin U  
where U is defined in (*) (regardless of the value of job).
If compz='I', then on exit
Zout = U  
where U is defined in (*) (regardless of the value of job).
If info>0 and compz='N', z is not accessed.

7 Accuracy

The computed Schur factorization is the exact factorization of a nearby matrix (H+E), where
E2 = O(ε) H2 ,  
and ε is the machine precision.
If λi is an exact eigenvalue, and λ~i is the corresponding computed value, then
|λ~i-λi| c (n) ε H2 si ,  
where c(n) 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 f08qlf.

8 Parallelism and Performance

f08pef is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
f08pef 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.

9 Further Comments

The total number of floating-point operations depends on how rapidly the algorithm converges, but is typically about:
The Schur form T has the following structure (referred to as canonical Schur form).
If all the computed eigenvalues are real, T is upper triangular, and the diagonal elements of T are the eigenvalues; wr(i)=tii, for i=1,2,,n, and wi(i)=0.0.
If some of the computed eigenvalues form complex conjugate pairs, then T has 2×2 diagonal blocks. Each diagonal block has the form
( tii ti,i+1 ti+1,i ti+1,i+1 )= ( α β γ α )  
where βγ<0. The corresponding eigenvalues are α±βγ; wr(i)=wr(i+1)=α; wi(i)=+|βγ|; wi(i+1)=-wi(i).
The complex analogue of this routine is f08psf.

10 Example

This example computes all the eigenvalues and the Schur factorization of the upper Hessenberg matrix H, where
H = ( 0.3500 -0.1160 -0.3886 -0.2942 -0.5140 0.1225 0.1004 0.1126 0.0000 0.6443 -0.1357 -0.0977 0.0000 0.0000 0.4262 0.1632 ) .  
See also f08nff, 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)