nag_dhgeqz (f08xec) (PDF version)
f08 Chapter Contents
f08 Chapter Introduction
NAG Library Manual

NAG Library Function Document

nag_dhgeqz (f08xec)

 Contents

    1  Purpose
    7  Accuracy

1  Purpose

nag_dhgeqz (f08xec) 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

#include <nag.h>
#include <nagf08.h>
void  nag_dhgeqz (Nag_OrderType order, Nag_JobType job, Nag_ComputeQType compq, Nag_ComputeZType compz, Integer n, Integer ilo, Integer ihi, double a[], Integer pda, double b[], Integer pdb, double alphar[], double alphai[], double beta[], double q[], Integer pdq, double z[], Integer pdz, NagError *fail)

3  Description

nag_dhgeqz (f08xec) 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 function nag_dgghrd (f08wec) should be called before invoking nag_dhgeqz (f08xec).
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 function 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 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 argument job specifies two options. If job=Nag_Schur 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+1,j is nonzero, then Bj+1,j=Bj,j+1=0 and Bj,j and Bj+1,j+1 will be non-negative.
If job=Nag_EigVals, 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=Nag_Schur and compq=Nag_AccumulateQ or Nag_InitQ, and compz=Nag_AccumulateZ or Nag_InitZ, 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=Nag_Schur and if left (right) generalized eigenvectors are to be computed then compq (compz) must be set to compq=Nag_AccumulateQ or Nag_InitQ and not compqNag_NotQ.
If compq=Nag_InitQ, then eigenvectors are accumulated on the identity matrix and on exit the array q contains the left eigenvector matrix Q. However, if compq=Nag_AccumulateQ 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:     order Nag_OrderTypeInput
On entry: the order argument specifies the two-dimensional storage scheme being used, i.e., row-major ordering or column-major ordering. C language defined storage is specified by order=Nag_RowMajor. See Section 3.2.1.3 in the Essential Introduction for a more detailed explanation of the use of this argument.
Constraint: order=Nag_RowMajor or Nag_ColMajor.
2:     job Nag_JobTypeInput
On entry: specifies the operations to be performed on A,B.
job=Nag_EigVals
The matrix pair A,B on exit might not be in the generalized Schur form.
job=Nag_Schur
The matrix pair A,B on exit will be in the generalized Schur form.
Constraint: job=Nag_EigVals or Nag_Schur.
3:     compq Nag_ComputeQTypeInput
On entry: specifies the operations to be performed on Q:
compq=Nag_NotQ
The array q is unchanged.
compq=Nag_AccumulateQ
The left transformation Q is accumulated on the array q.
compq=Nag_InitQ
The array q is initialized to the identity matrix before the left transformation Q is accumulated in q.
Constraint: compq=Nag_NotQ, Nag_AccumulateQ or Nag_InitQ.
4:     compz Nag_ComputeZTypeInput
On entry: specifies the operations to be performed on Z.
compz=Nag_NotZ
The array z is unchanged.
compz=Nag_AccumulateZ
The right transformation Z is accumulated on the array z.
compz=Nag_InitZ
The array z is initialized to the identity matrix before the right transformation Z is accumulated in z.
Constraint: compz=Nag_NotZ, Nag_AccumulateZ or Nag_InitZ.
5:     n IntegerInput
On entry: n, the order of the matrices A, B, Q and Z.
Constraint: n0.
6:     ilo IntegerInput
7:     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 arguments are provided by nag_dggbal (f08whc) 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.
8:     a[dim] doubleInput/Output
Note: the dimension, dim, of the array a must be at least max1,pda×n.
Where Ai,j appears in this document, it refers to the array element
  • a[j-1×pda+i-1] when order=Nag_ColMajor;
  • a[i-1×pda+j-1] when order=Nag_RowMajor.
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=Nag_Schur, the matrix pair A,B will be simultaneously reduced to generalized Schur form.
If job=Nag_EigVals, 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.
9:     pda IntegerInput
On entry: the stride separating row or column elements (depending on the value of order) in the array a.
Constraint: pdamax1,n.
10:   b[dim] doubleInput/Output
Note: the dimension, dim, of the array b must be at least max1,pdb×n.
Where Bi,j appears in this document, it refers to the array element
  • b[j-1×pdb+i-1] when order=Nag_ColMajor;
  • b[i-1×pdb+j-1] when order=Nag_RowMajor.
On entry: the n by n upper triangular matrix B. The elements below the diagonal must be zero.
On exit: if job=Nag_Schur, the matrix pair A,B will be simultaneously reduced to generalized Schur form.
If job=Nag_EigVals, 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.
11:   pdb IntegerInput
On entry: the stride separating row or column elements (depending on the value of order) in the array b.
Constraint: pdbmax1,n.
12:   alphar[n] doubleOutput
On exit: the real parts of αj, for j=1,2,,n.
13:   alphai[n] doubleOutput
On exit: the imaginary parts of αj, for j=1,2,,n.
14:   beta[n] doubleOutput
On exit: βj, for j=1,2,,n.
15:   q[dim] doubleInput/Output
Note: the dimension, dim, of the array q must be at least
  • max1,pdq×n when compq=Nag_AccumulateQ or Nag_InitQ;
  • 1 when compq=Nag_NotQ.
The i,jth element of the matrix Q is stored in
  • q[j-1×pdq+i-1] when order=Nag_ColMajor;
  • q[i-1×pdq+j-1] when order=Nag_RowMajor.
On entry: if compq=Nag_AccumulateQ, the matrix Q0. The matrix Q0 is usually the matrix Q returned by nag_dgghrd (f08wec).
If compq=Nag_NotQ, q is not referenced.
On exit: if compq=Nag_AccumulateQ, q contains the matrix product QQ0.
If compq=Nag_InitQ, q contains the transformation matrix Q.
16:   pdq IntegerInput
On entry: the stride separating row or column elements (depending on the value of order) in the array q.
Constraints:
  • if order=Nag_ColMajor,
    • if compq=Nag_AccumulateQ or Nag_InitQ, pdqn;
    • if compq=Nag_NotQ, pdq1;
  • if order=Nag_RowMajor,
    • if compq=Nag_AccumulateQ or Nag_InitQ, pdqmax1,n;
    • if compq=Nag_NotQ, pdq1.
17:   z[dim] doubleInput/Output
Note: the dimension, dim, of the array z must be at least
  • max1,pdz×n when compz=Nag_AccumulateZ or Nag_InitZ;
  • 1 when compz=Nag_NotZ.
The i,jth element of the matrix Z is stored in
  • z[j-1×pdz+i-1] when order=Nag_ColMajor;
  • z[i-1×pdz+j-1] when order=Nag_RowMajor.
On entry: if compz=Nag_AccumulateZ, the matrix Z0. The matrix Z0 is usually the matrix Z returned by nag_dgghrd (f08wec).
If compz=Nag_NotZ, z is not referenced.
On exit: if compz=Nag_AccumulateZ, z contains the matrix product ZZ0.
If compz=Nag_InitZ, z contains the transformation matrix Z.
18:   pdz IntegerInput
On entry: the stride separating row or column elements (depending on the value of order) in the array z.
Constraints:
  • if order=Nag_ColMajor,
    • if compz=Nag_AccumulateZ or Nag_InitZ, pdzn;
    • if compz=Nag_NotZ, pdz1;
  • if order=Nag_RowMajor,
    • if compz=Nag_AccumulateZ or Nag_InitZ, pdzmax1,n;
    • if compz=Nag_NotZ, pdz1.
19:   fail NagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

6  Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.2.1.2 in the Essential Introduction for further information.
NE_BAD_PARAM
On entry, argument value had an illegal value.
NE_ENUM_INT_2
On entry, compq=value, pdq=value, n=value.
Constraint: if compq=Nag_AccumulateQ or Nag_InitQ, pdqmax1,n;
if compq=Nag_NotQ, pdq1.
On entry, compq=value, pdq=value and n=value.
Constraint: if compq=Nag_AccumulateQ or Nag_InitQ, pdqn;
if compq=Nag_NotQ, pdq1.
On entry, compz=value, pdz=value, n=value.
Constraint: if compz=Nag_AccumulateZ or Nag_InitZ, pdzmax1,n;
if compz=Nag_NotZ, pdz1.
On entry, compz=value, pdz=value and n=value.
Constraint: if compz=Nag_AccumulateZ or Nag_InitZ, pdzn;
if compz=Nag_NotZ, pdz1.
NE_INT
On entry, n=value.
Constraint: n0.
On entry, pda=value.
Constraint: pda>0.
On entry, pdb=value.
Constraint: pdb>0.
On entry, pdq=value.
Constraint: pdq>0.
On entry, pdz=value.
Constraint: pdz>0.
NE_INT_2
On entry, pda=value and n=value.
Constraint: pdamax1,n.
On entry, pdb=value and n=value.
Constraint: pdbmax1,n.
NE_INT_3
On entry, n=value, ilo=value and ihi=value.
Constraint: if n>0, 1 ilo ihi n ;
if n=0, ilo=1 and ihi=0.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
An unexpected error has been triggered by this function. Please contact NAG.
See Section 3.6.6 in the Essential Introduction for further information.
An unexpected Library error has occurred.
NE_ITERATION_QZ
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.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 3.6.5 in the Essential Introduction for further information.
NE_SCHUR
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.

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

nag_dhgeqz (f08xec) is not threaded by NAG in any implementation.
nag_dhgeqz (f08xec) 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 function. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

9  Further Comments

nag_dhgeqz (f08xec) is the fifth step in the solution of the real generalized eigenvalue problem and is called after nag_dgghrd (f08wec).
The complex analogue of this function is nag_zhgeqz (f08xsc).

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 functions: nag_dggbal (f08whc) to balance the matrix, nag_dgeqrf (f08aec) to perform the QR factorization of B, nag_dormqr (f08agc) to apply Q to A, nag_dgghrd (f08wec) to reduce the matrix pair to the generalized Hessenberg form and nag_dhgeqz (f08xec) to compute the eigenvalues using the QZ algorithm.

10.1  Program Text

Program Text (f08xece.c)

10.2  Program Data

Program Data (f08xece.d)

10.3  Program Results

Program Results (f08xece.r)


nag_dhgeqz (f08xec) (PDF version)
f08 Chapter Contents
f08 Chapter Introduction
NAG Library Manual

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