F08XEF (DHGEQZ) (PDF version)
F08 Chapter Contents
F08 Chapter Introduction
NAG Library Manual

NAG Library Routine Document

F08XEF (DHGEQZ)

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

F08XEF (DHGEQZ) implements the QZ method for finding generalized eigenvalues of the real matrix pair A,B of order n, which is in the generalized upper Hessenberg form.

2  Specification

SUBROUTINE F08XEF ( JOB, COMPQ, COMPZ, N, ILO, IHI, A, LDA, B, LDB, ALPHAR, ALPHAI, BETA, Q, LDQ, Z, LDZ, WORK, LWORK, INFO)
INTEGER  N, ILO, IHI, LDA, LDB, LDQ, LDZ, LWORK, INFO
REAL (KIND=nag_wp)  A(LDA,*), B(LDB,*), ALPHAR(N), ALPHAI(N), BETA(N), Q(LDQ,*), Z(LDZ,*), WORK(max(1,LWORK))
CHARACTER(1)  JOB, COMPQ, COMPZ
The routine may be called by its LAPACK name dhgeqz.

3  Description

F08XEF (DHGEQZ) implements a single-double-shift version of the QZ method for finding the generalized eigenvalues of the real matrix pair A,B which is in the generalized upper Hessenberg form. If the matrix pair A,B is not in the generalized upper Hessenberg form, then the routine F08WEF (DGGHRD) should be called before invoking F08XEF (DHGEQZ).
This problem is mathematically equivalent to solving the equation
detA-λB=0.
Note that, to avoid underflow, overflow and other arithmetic problems, the generalized eigenvalues λj are never computed explicitly by this routine but defined as ratios between two computed values, αj and βj:
λj=αj/βj.
The parameters αj, in general, are finite complex values and βj are finite real non-negative values.
If desired, the matrix pair A,B may be reduced to generalized Schur form. That is, the transformed matrix B is upper triangular and the transformed matrix A is block upper triangular, where the diagonal blocks are either 1 by 1 or 2 by 2. The 1 by 1 blocks provide generalized eigenvalues which are real and the 2 by 2 blocks give complex generalized eigenvalues.
The parameter JOB specifies two options. If JOB='S' then the matrix pair A,B is simultaneously reduced to Schur form by applying one orthogonal transformation (usually called Q) on the left and another (usually called Z) on the right. That is,
AQTAZ BQTBZ
The 2 by 2 upper-triangular diagonal blocks of B corresponding to 2 by 2 blocks of A will be reduced to non-negative diagonal matrices. That is, if Aj+1j is nonzero, then Bj+1j=Bjj+1=0 and Bjj and Bj+1j+1 will be non-negative.
If JOB='E', then at each iteration the same transformations are computed but they are only applied to those parts of A and B which are needed to compute α and β. This option could be used if generalized eigenvalues are required but not generalized eigenvectors.
If JOB='S' and COMPQ='V' or 'I', and COMPZ='V' or 'I', then the orthogonal transformations used to reduce the pair A,B are accumulated into the input arrays Q and Z. If generalized eigenvectors are required then JOB must be set to JOB='S' and if left (right) generalized eigenvectors are to be computed then COMPQ (COMPZ) must be set to COMPQ='V' or 'I' and not COMPQ'N'.
If COMPQ='I', then eigenvectors are accumulated on the identity matrix and on exit the array Q contains the left eigenvector matrix Q. However, if COMPQ='V' then the transformations are accumulated on the user-supplied matrix Q0 in array Q on entry and thus on exit Q contains the matrix product QQ0. A similar convention is used for COMPZ.

4  References

Anderson E, Bai Z, Bischof C, Blackford S, Demmel J, Dongarra J J, Du Croz J J, Greenbaum A, Hammarling S, McKenney A and Sorensen D (1999) LAPACK Users' Guide (3rd Edition) SIAM, Philadelphia
Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore
Moler C B and Stewart G W (1973) An algorithm for generalized matrix eigenproblems SIAM J. Numer. Anal. 10 241–256
Stewart G W and Sun J-G (1990) Matrix Perturbation Theory Academic Press, London

5  Parameters

1:     JOB – CHARACTER(1)Input
On entry: specifies the operations to be performed on A,B.
JOB='E'
The matrix pair A,B on exit might not be in the generalized Schur form.
JOB='S'
The matrix pair A,B on exit will be in the generalized Schur form.
Constraint: JOB='E' or 'S'.
2:     COMPQ – CHARACTER(1)Input
On entry: specifies the operations to be performed on Q:
COMPQ='N'
The array Q is unchanged.
COMPQ='V'
The left transformation Q is accumulated on the array Q.
COMPQ='I'
The array Q is initialized to the identity matrix before the left transformation Q is accumulated in Q.
Constraint: COMPQ='N', 'V' or 'I'.
3:     COMPZ – CHARACTER(1)Input
On entry: specifies the operations to be performed on Z.
COMPZ='N'
The array Z is unchanged.
COMPZ='V'
The right transformation Z is accumulated on the array Z.
COMPZ='I'
The array Z is initialized to the identity matrix before the right transformation Z is accumulated in Z.
Constraint: COMPZ='N', 'V' or 'I'.
4:     N – INTEGERInput
On entry: n, the order of the matrices A, B, Q and Z.
Constraint: N0.
5:     ILO – INTEGERInput
6:     IHI – INTEGERInput
On entry: the indices ilo and ihi, respectively which define the upper triangular parts of A. The submatrices A1:ilo-1,1:ilo-1 and Aihi+1:n,ihi+1:n are then upper triangular. These parameters are provided by F08WHF (DGGBAL) if the matrix pair was previously balanced; otherwise, ILO=1 and IHI=N.
Constraints:
  • if N>0, 1 ILO IHI N ;
  • if N=0, ILO=1 and IHI=0.
7:     A(LDA,*) – REAL (KIND=nag_wp) arrayInput/Output
Note: the second dimension of the array A must be at least max1,N.
On entry: the n by n upper Hessenberg matrix A. The elements below the first subdiagonal must be set to zero.
On exit: if JOB='S', the matrix pair A,B will be simultaneously reduced to generalized Schur form.
If JOB='E', the 1 by 1 and 2 by 2 diagonal blocks of the matrix pair A,B will give generalized eigenvalues but the remaining elements will be irrelevant.
8:     LDA – INTEGERInput
On entry: the first dimension of the array A as declared in the (sub)program from which F08XEF (DHGEQZ) is called.
Constraint: LDAmax1,N.
9:     B(LDB,*) – REAL (KIND=nag_wp) arrayInput/Output
Note: the second dimension of the array B must be at least max1,N.
On entry: the n by n upper triangular matrix B. The elements below the diagonal must be zero.
On exit: if JOB='S', the matrix pair A,B will be simultaneously reduced to generalized Schur form.
If JOB='E', the 1 by 1 and 2 by 2 diagonal blocks of the matrix pair A,B will give generalized eigenvalues but the remaining elements will be irrelevant.
10:   LDB – INTEGERInput
On entry: the first dimension of the array B as declared in the (sub)program from which F08XEF (DHGEQZ) is called.
Constraint: LDBmax1,N.
11:   ALPHAR(N) – REAL (KIND=nag_wp) arrayOutput
On exit: the real parts of αj, for j=1,2,,n.
12:   ALPHAI(N) – REAL (KIND=nag_wp) arrayOutput
On exit: the imaginary parts of αj, for j=1,2,,n.
13:   BETA(N) – REAL (KIND=nag_wp) arrayOutput
On exit: βj, for j=1,2,,n.
14:   Q(LDQ,*) – REAL (KIND=nag_wp) arrayInput/Output
Note: the second dimension of the array Q must be at least max1,N if COMPQ='V' or 'I' and at least 1 if COMPQ='N'.
On entry: if COMPQ='V', the matrix Q0. The matrix Q0 is usually the matrix Q returned by F08WEF (DGGHRD).
If COMPQ='N', Q is not referenced.
On exit: if COMPQ='V', Q contains the matrix product QQ0.
If COMPQ='I', Q contains the transformation matrix Q.
15:   LDQ – INTEGERInput
On entry: the first dimension of the array Q as declared in the (sub)program from which F08XEF (DHGEQZ) is called.
Constraints:
  • if COMPQ='V' or 'I', LDQN;
  • if COMPQ='N', LDQ1.
16:   Z(LDZ,*) – REAL (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', the matrix Z0. The matrix Z0 is usually the matrix Z returned by F08WEF (DGGHRD).
If COMPZ='N', Z is not referenced.
On exit: if COMPZ='V', Z contains the matrix product ZZ0.
If COMPZ='I', Z contains the transformation matrix Z.
17:   LDZ – INTEGERInput
On entry: the first dimension of the array Z as declared in the (sub)program from which F08XEF (DHGEQZ) is called.
Constraints:
  • if COMPZ='V' or 'I', LDZN;
  • if COMPZ='N', LDZ1.
18:   WORK(max1,LWORK) – REAL (KIND=nag_wp) arrayWorkspace
On exit: if INFO=0, WORK1 contains the minimum value of LWORK required for optimal performance.
19:   LWORK – INTEGERInput
On entry: the dimension of the array WORK as declared in the (sub)program from which F08XEF (DHGEQZ) is called.
If LWORK=-1, a workspace query is assumed; the routine only calculates the minimum size of the WORK array, returns this value as the first entry of the WORK array, and no error message related to LWORK is issued.
Constraint: LWORKmax1,N or LWORK=-1.
20:   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
If 1INFON, the QZ iteration did not converge and the matrix pair A,B is not in the generalized Schur form at exit. However, if INFO<N, then the computed αi and βi should be correct for i=INFO+1,,N.
If N+1INFO2×N, the computation of shifts failed and the matrix pair A,B is not in the generalized Schur form at exit. However, if INFO<2×N, then the computed αi and βi should be correct for i=INFO-N+1,,N.
If INFO>2×N, then an unexpected Library error has occurred. Please contact NAG with details of your program.

7  Accuracy

Please consult Section 4.11 of the LAPACK Users' Guide (see Anderson et al. (1999)) and Chapter 6 of Stewart and Sun (1990), for more information.

8  Further Comments

F08XEF (DHGEQZ) is the fifth step in the solution of the real generalized eigenvalue problem and is called after F08WEF (DGGHRD).
The complex analogue of this routine is F08XSF (ZHGEQZ).

9  Example

This example computes the α and β parameters, which defines the generalized eigenvalues, of the matrix pair A,B given by
A = 1.0 1.0 1.0 1.0 1.0 2.0 4.0 8.0 16.0 32.0 3.0 9.0 27.0 81.0 243.0 4.0 16.0 64.0 256.0 1024.0 5.0 25.0 125.0 625.0 3125.0
B = 1.0 2.0 3.0 4.0 5.0 1.0 4.0 9.0 16.0 25.0 1.0 8.0 27.0 64.0 125.0 1.0 16.0 81.0 256.0 625.0 1.0 32.0 243.0 1024.0 3125.0 .
This requires calls to five routines: F08WHF (DGGBAL) to balance the matrix, F08AEF (DGEQRF) to perform the QR factorization of B, F08AGF (DORMQR) to apply Q to A, F08WEF (DGGHRD) to reduce the matrix pair to the generalized Hessenberg form and F08XEF (DHGEQZ) to compute the eigenvalues using the QZ algorithm.

9.1  Program Text

Program Text (f08xefe.f90)

9.2  Program Data

Program Data (f08xefe.d)

9.3  Program Results

Program Results (f08xefe.r)


F08XEF (DHGEQZ) (PDF version)
F08 Chapter Contents
F08 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2012