Developer Reference for Intel® oneAPI Math Kernel Library for Fortran

ID 766686
Date 12/16/2022
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

?ggev

Computes the generalized eigenvalues, and the left and/or right generalized eigenvectors for a pair of nonsymmetric matrices.

Syntax

call sggev(jobvl, jobvr, n, a, lda, b, ldb, alphar, alphai, beta, vl, ldvl, vr, ldvr, work, lwork, info)

call dggev(jobvl, jobvr, n, a, lda, b, ldb, alphar, alphai, beta, vl, ldvl, vr, ldvr, work, lwork, info)

call cggev(jobvl, jobvr, n, a, lda, b, ldb, alpha, beta, vl, ldvl, vr, ldvr, work, lwork, rwork, info)

call zggev(jobvl, jobvr, n, a, lda, b, ldb, alpha, beta, vl, ldvl, vr, ldvr, work, lwork, rwork, info)

call ggev(a, b, alphar, alphai, beta [,vl] [,vr] [,info])

call ggev(a, b, alpha, beta [, vl] [,vr] [,info])

Include Files
  • mkl.fi, lapack.f90
Description

The ?ggev routine computes the generalized eigenvalues, and optionally, the left and/or right generalized eigenvectors for a pair of n-by-n real/complex nonsymmetric matrices (A,B).

A generalized eigenvalue for a pair of matrices (A,B) is a scalar λ or a ratio alpha / beta = λ, such that A - λ*B is singular. It is usually represented as the pair (alpha, beta), as there is a reasonable interpretation for beta =0 and even for both being zero.

The right generalized eigenvector v(j) corresponding to the generalized eigenvalue λ(j) of (A,B) satisfies

A*v(j) = λ(j)*B*v(j).

The left generalized eigenvector u(j) corresponding to the generalized eigenvalue λ(j) of (A,B) satisfies

u(j)H*A = λ(j)*u(j)H*B

where u(j)H denotes the conjugate transpose of u(j).

The ?ggev routine replaces the deprecated ?gegv routine.

Input Parameters
jobvl

CHARACTER*1. Must be 'N' or 'V'.

If jobvl = 'N', the left generalized eigenvectors are not computed;

If jobvl = 'V', the left generalized eigenvectors are computed.

jobvr

CHARACTER*1. Must be 'N' or 'V'.

If jobvr = 'N', the right generalized eigenvectors are not computed;

If jobvr = 'V', the right generalized eigenvectors are computed.

n

INTEGER. The order of the matrices A, B, vl, and vr (n 0).

a, b, work

REAL for sggev

DOUBLE PRECISION for dggev

COMPLEX for cggev

DOUBLE COMPLEX for zggev.

Arrays:

a(lda,*) is an array containing the n-by-n matrix A (first of the pair of matrices).

The second dimension of a must be at least max(1, n).

b(ldb,*) is an array containing the n-by-n matrix B (second of the pair of matrices).

The second dimension of b must be at least max(1, n).

work is a workspace array, its dimension max(1, lwork).

lda

INTEGER. The leading dimension of the array a. Must be at least max(1, n).

ldb

INTEGER. The leading dimension of the array b. Must be at least max(1, n).

ldvl, ldvr

INTEGER. The leading dimensions of the output matrices vl and vr, respectively.

Constraints:

ldvl 1. If jobvl = 'V', ldvl max(1, n).

ldvr 1. If jobvr = 'V', ldvr max(1, n).

lwork

INTEGER.

The dimension of the array work.

lwork max(1, 8n+16) for real flavors;

lwork max(1, 2n) for complex flavors.

For good performance, lwork must generally be larger.

If lwork = -1, then a workspace query is assumed; the routine only calculates the optimal 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 by xerbla.

rwork

REAL for cggev

DOUBLE PRECISION for zggev

Workspace array, size at least max(1, 8n).

This array is used in complex flavors only.

Output Parameters
a, b

On exit, these arrays have been overwritten.

alphar, alphai

REAL for sggev;

DOUBLE PRECISION for dggev.

Arrays, size at least max(1, n) each. Contain values that form generalized eigenvalues in real flavors.

See beta.

alpha

COMPLEX for cggev;

DOUBLE COMPLEX for zggev.

Array, size at least max(1, n). Contain values that form generalized eigenvalues in complex flavors. See beta.

beta

REAL for sggev

DOUBLE PRECISION for dggev

COMPLEX for cggev

DOUBLE COMPLEX for zggev.

Array, size at least max(1, n).

For real flavors:

On exit, (alphar(j) + alphai(j)*i)/beta(j), j=1,..., n, are the generalized eigenvalues.

If alphai(j) is zero, then the j-th eigenvalue is real; if positive, then the j-th and (j+1)-st eigenvalues are a complex conjugate pair, with alphai(j+1) negative.

For complex flavors:

On exit, alpha(j)/beta(j), j=1,..., n, are the generalized eigenvalues.

See also Application Notes below.

vl, vr

REAL for sggev

DOUBLE PRECISION for dggev

COMPLEX for cggev

DOUBLE COMPLEX for zggev.

Arrays:

vl(ldvl,*); the second dimension of vl must be at least max(1, n). Contains the matrix of left generalized eigenvectors VL.

If jobvl = 'V', the left generalized eigenvectors uj are stored one after another in the columns of VL, in the same order as their eigenvalues. Each eigenvector is scaled so the largest component has abs(Re) + abs(Im) = 1.

If jobvl = 'N', vl is not referenced.

For real flavors:

If the j-th eigenvalue is real,then uj = VL*,j, the j-th column of VL.

If the j-th and (j+1)-st eigenvalues form a complex conjugate pair, then for i = sqrt(-1), uj = VL*,j + i*VL*,j + 1 and uj + 1 = VL*,j - i*VL*,j+ + 1.

For complex flavors:

uj = VL*,j, the j-th column of vl.

vr(ldvr,*); the second dimension of vr must be at least max(1, n). Contains the matrix of right generalized eigenvectors VR.

If jobvr = 'V', the right generalized eigenvectors vj are stored one after another in the columns of VR, in the same order as their eigenvalues. Each eigenvector is scaled so the largest component has abs(Re) + abs(Im) = 1.

If jobvr = 'N', vr is not referenced.

For real flavors:

If the j-th eigenvalue is real, then vj = VR*,j, the j-th column of VR.

If the j-th and (j+1)-st eigenvalues form a complex conjugate pair, thenvj = VR*,j + i*VR*,j + 1 and vj + 1 = VR*,j - i*VR*,j + 1.

For complex flavors:

vj = VR*,j, the j-th column of VR.

work(1)

On exit, if info = 0, then work(1) returns the required minimal size of lwork.

info

INTEGER.

If info = 0, the execution is successful.

If info = -i, the i-th parameter had an illegal value.

If info = i, and

in: the QZ iteration failed. No eigenvectors have been calculated, but alphar(j), alphai(j) (for real flavors), or alpha(j) (for complex flavors), and beta(j), j=info+1,..., n should be correct.

i > n: errors that usually indicate LAPACK problems:

i = n+1: other than QZ iteration failed in hgeqz;

i = n+2: error return from tgevc.

LAPACK 95 Interface Notes

Routines in Fortran 95 interface have fewer arguments in the calling sequence than their FORTRAN 77 counterparts. For general conventions applied to skip redundant or restorable arguments, see LAPACK 95 Interface Conventions.

Specific details for the routine ggev interface are the following:

a

Holds the matrix A of size (n, n).

b

Holds the matrix B of size (n, n).

alphar

Holds the vector of length n. Used in real flavors only.

alphai

Holds the vector of length n. Used in real flavors only.

alpha

Holds the vector of length n. Used in complex flavors only.

beta

Holds the vector of length n.

vl

Holds the matrix VL of size (n, n).

vr

Holds the matrix VR of size (n, n).

jobvl

Restored based on the presence of the argument vl as follows:

jobvl = 'V', if vl is present,

jobvl = 'N', if vl is omitted.

jobvr

Restored based on the presence of the argument vr as follows:

jobvr = 'V', if vr is present,

jobvr = 'N', if vr is omitted.

Application Notes

If you are in doubt how much workspace to supply, use a generous value of lwork for the first run or set lwork = -1.

If you choose the first option and set any of admissible lwork sizes, which is no less than the minimal value described, the routine completes the task, though probably not so fast as with a recommended workspace, and provides the recommended workspace in the first element of the corresponding array work on exit. Use this value (work(1)) for subsequent runs.

If you set lwork = -1, the routine returns immediately and provides the recommended workspace in the first element of the corresponding array (work). This operation is called a workspace query.

Note that if you set lwork to less than the minimal required value and not -1, the routine returns immediately with an error exit and does not provide any information on the recommended workspace.

The quotients alphar(j)/beta(j) and alphai(j)/beta(j) may easily over- or underflow, and beta(j) may even be zero. Thus, you should avoid simply computing the ratio. However, alphar and alphai (for real flavors) or alpha (for complex flavors) will be always less than and usually comparable with norm(A) in magnitude, and beta always less than and usually comparable with norm(B).