NAG FL Interface
f08xef (dhgeqz)

Settings help

FL Name Style:


FL Specification Language:


1 Purpose

f08xef 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

Fortran Interface
Subroutine f08xef ( job, compq, compz, n, ilo, ihi, a, lda, b, ldb, alphar, alphai, beta, q, ldq, z, ldz, work, lwork, info)
Integer, Intent (In) :: n, ilo, ihi, lda, ldb, ldq, ldz, lwork
Integer, Intent (Out) :: info
Real (Kind=nag_wp), Intent (Inout) :: a(lda,*), b(ldb,*), q(ldq,*), z(ldz,*)
Real (Kind=nag_wp), Intent (Out) :: alphar(n), alphai(n), beta(n), work(max(1,lwork))
Character (1), Intent (In) :: job, compq, compz
C Header Interface
#include <nag.h>
void  f08xef_ (const char *job, const char *compq, const char *compz, const Integer *n, const Integer *ilo, const Integer *ihi, double a[], const Integer *lda, double b[], const Integer *ldb, double alphar[], double alphai[], double beta[], double q[], const Integer *ldq, double z[], const Integer *ldz, double work[], const Integer *lwork, Integer *info, const Charlen length_job, const Charlen length_compq, const Charlen length_compz)
The routine may be called by the names f08xef, nagf_lapackeig_dhgeqz or its LAPACK name dhgeqz.

3 Description

f08xef 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 f08wff should be called before invoking f08xef.
This problem is mathematically equivalent to solving the equation
det(A-λ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 arguments α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×1 or 2×2. The 1×1 blocks provide generalized eigenvalues which are real and the 2×2 blocks give complex generalized eigenvalues.
The argument 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×2 upper-triangular diagonal blocks of B corresponding to 2×2 blocks of a will be reduced to non-negative diagonal matrices. That is, if a(j+1,j) is nonzero, then b(j+1,j)=b(j,j+1)=0 and b(j,j) and b(j+1,j+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 Arguments

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 Integer Input
On entry: n, the order of the matrices A, B, Q and Z.
Constraint: n0.
5: ilo Integer Input
6: ihi Integer Input
On entry: the indices ilo and ihi, respectively which define the upper triangular parts of A. The submatrices A(1:ilo-1,1:ilo-1) and A(ihi+1:n,ihi+1:n) are then upper triangular. These arguments are provided by f08whf 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) array Input/Output
Note: the second dimension of the array a must be at least max(1,n).
On entry: the n×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×1 and 2×2 diagonal blocks of the matrix pair (A,B) will give generalized eigenvalues but the remaining elements will be irrelevant.
8: lda Integer Input
On entry: the first dimension of the array a as declared in the (sub)program from which f08xef is called.
Constraint: ldamax(1,n).
9: b(ldb,*) Real (Kind=nag_wp) array Input/Output
Note: the second dimension of the array b must be at least max(1,n).
On entry: the n×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×1 and 2×2 diagonal blocks of the matrix pair (A,B) will give generalized eigenvalues but the remaining elements will be irrelevant.
10: ldb Integer Input
On entry: the first dimension of the array b as declared in the (sub)program from which f08xef is called.
Constraint: ldbmax(1,n).
11: alphar(n) Real (Kind=nag_wp) array Output
On exit: the real parts of αj, for j=1,2,,n.
12: alphai(n) Real (Kind=nag_wp) array Output
On exit: the imaginary parts of αj, for j=1,2,,n.
13: beta(n) Real (Kind=nag_wp) array Output
On exit: βj, for j=1,2,,n.
14: q(ldq,*) Real (Kind=nag_wp) array Input/Output
Note: the second dimension of the array q must be at least max(1,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 f08wff.
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 Integer Input
On entry: the first dimension of the array q as declared in the (sub)program from which f08xef is called.
Constraints:
  • if compq='V' or 'I', ldqn;
  • if compq='N', ldq1.
16: 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', the matrix Z0. The matrix Z0 is usually the matrix Z returned by f08wff.
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 Integer Input
On entry: the first dimension of the array z as declared in the (sub)program from which f08xef is called.
Constraints:
  • if compz='V' or 'I', ldzn;
  • if compz='N', ldz1.
18: 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.
19: lwork Integer Input
On entry: the dimension of the array work as declared in the (sub)program from which f08xef 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: lworkmax(1,n) or lwork=−1.
20: 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=1,,n
The QZ iteration did not converge and the matrix pair (A,B) is not in the generalized Schur form. The computed αi and βi should be correct for i=value,,value.
info>n and info2×n
The computation of shifts failed and the matrix pair (A,B) is not in the generalized Schur form. The computed αi and βi should be correct for i=value,,value.
info>2×n
An unexpected Library error has occurred.

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 Parallelism and Performance

Background information to multithreading can be found in the Multithreading documentation.
f08xef 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

f08xef is the fifth step in the solution of the real generalized eigenvalue problem and is called after f08wff.
The complex analogue of this routine is f08xsf.

10 Example

This example computes the α and β arguments, 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 to balance the matrix, f08aef to perform the QR factorization of B, f08agf to apply Q to A, f08wff to reduce the matrix pair to the generalized Hessenberg form and f08xef to compute the eigenvalues using the QZ algorithm.

10.1 Program Text

Program Text (f08xefe.f90)

10.2 Program Data

Program Data (f08xefe.d)

10.3 Program Results

Program Results (f08xefe.r)