hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_lapack_dgges (f08xa)

Purpose

nag_lapack_dgges (f08xa) computes the generalized eigenvalues, the generalized real Schur form (S,T) (S,T)  and, optionally, the left and/or right generalized Schur vectors for a pair of nn by nn real nonsymmetric matrices (A,B) (A,B) .

Syntax

[a, b, sdim, alphar, alphai, beta, vsl, vsr, info] = f08xa(jobvsl, jobvsr, sort, selctg, a, b, 'n', n)
[a, b, sdim, alphar, alphai, beta, vsl, vsr, info] = nag_lapack_dgges(jobvsl, jobvsr, sort, selctg, a, b, 'n', n)

Description

The generalized Schur factorization for a pair of real matrices (A,B) (A,B)  is given by
A = QSZT ,   B = QTZT ,
A = QSZT ,   B = QTZT ,
where QQ and ZZ are orthogonal, TT is upper triangular and SS is upper quasi-triangular with 11 by 11 and 22 by 22 diagonal blocks. The generalized eigenvalues, λ λ , of (A,B) (A,B)  are computed from the diagonals of SS and TT and satisfy
Az = λBz ,
Az = λBz ,
where zz is the corresponding generalized eigenvector. λ λ  is actually returned as the pair (α,β) (α,β)  such that
λ = α / β
λ = α/β
since β β , or even both α α  and β β  can be zero. The columns of QQ and ZZ are the left and right generalized Schur vectors of (A,B) (A,B) .
Optionally, nag_lapack_dgges (f08xa) can order the generalized eigenvalues on the diagonals of (S,T) (S,T)  so that selected eigenvalues are at the top left. The leading columns of QQ and ZZ then form an orthonormal basis for the corresponding eigenspaces, the deflating subspaces.
nag_lapack_dgges (f08xa) computes TT to have non-negative diagonal elements, and the 22 by 22 blocks of SS correspond to complex conjugate pairs of generalized eigenvalues. The generalized Schur factorization, before reordering, is computed by the QZQZ algorithm.

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 http://www.netlib.org/lapack/lug
Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore

Parameters

Compulsory Input Parameters

1:     jobvsl – string (length ≥ 1)
If jobvsl = 'N'jobvsl='N', do not compute the left Schur vectors.
If jobvsl = 'V'jobvsl='V', compute the left Schur vectors.
Constraint: jobvsl = 'N'jobvsl='N' or 'V''V'.
2:     jobvsr – string (length ≥ 1)
If jobvsr = 'N'jobvsr='N', do not compute the right Schur vectors.
If jobvsr = 'V'jobvsr='V', compute the right Schur vectors.
Constraint: jobvsr = 'N'jobvsr='N' or 'V''V'.
3:     sort – string (length ≥ 1)
Specifies whether or not to order the eigenvalues on the diagonal of the generalized Schur form.
sort = 'N'sort='N'
Eigenvalues are not ordered.
sort = 'S'sort='S'
Eigenvalues are ordered (see selctg).
Constraint: sort = 'N'sort='N' or 'S''S'.
4:     selctg – function handle or string containing name of m-file
If sort = 'S'sort='S', selctg is used to select generalized eigenvalues to the top left of the generalized Schur form.
If sort = 'N'sort='N', selctg is not referenced by nag_lapack_dgges (f08xa), and may be called with the string 'f08xaz'.
[result] = selctg(ar, ai, b)

Input Parameters

1:     ar – double scalar
2:     ai – double scalar
3:     b – double scalar
An eigenvalue (ar(j) + sqrt(1) × ai(j)) / b(j) ( arj + -1 × aij ) / bj  is selected if selctg (ar(j),ai(j),b(j)) = true selctg (arj,aij,bj)=true . If either one of a complex conjugate pair is selected, then both complex generalized eigenvalues are selected.
Note that in the ill-conditioned case, a selected complex generalized eigenvalue may no longer satisfy selctg (ar(j),ai(j),b(j)) = true selctg (arj,aij,bj)=true  after ordering. INFO = n + 2INFO=n+2 in this case.

Output Parameters

1:     result – logical scalar
The result of the function.
5:     a(lda, : :) – double array
The first dimension of the array a must be at least max (1,n)max(1,n)
The second dimension of the array must be at least max (1,n)max(1,n)
The first of the pair of matrices, AA.
6:     b(ldb, : :) – double array
The first dimension of the array b must be at least max (1,n)max(1,n)
The second dimension of the array must be at least max (1,n)max(1,n)
The second of the pair of matrices, BB.

Optional Input Parameters

1:     n – int64int32nag_int scalar
Default: The first dimension of the arrays a, b and the second dimension of the arrays a, b. (An error is raised if these dimensions are not equal.)
nn, the order of the matrices AA and BB.
Constraint: n0n0.

Input Parameters Omitted from the MATLAB Interface

lda ldb ldvsl ldvsr work lwork bwork

Output Parameters

1:     a(lda, : :) – double array
The first dimension of the array a will be max (1,n)max(1,n)
The second dimension of the array will be max (1,n)max(1,n)
ldamax (1,n)ldamax(1,n).
a stores its generalized Schur form SS.
2:     b(ldb, : :) – double array
The first dimension of the array b will be max (1,n)max(1,n)
The second dimension of the array will be max (1,n)max(1,n)
ldbmax (1,n)ldbmax(1,n).
b stores its generalized Schur form TT.
3:     sdim – int64int32nag_int scalar
If sort = 'N'sort='N', sdim = 0sdim=0.
If sort = 'S'sort='S', sdim = sdim= number of eigenvalues (after sorting) for which selctg is true. (Complex conjugate pairs for which selctg is true for either eigenvalue count as 22.)
4:     alphar(n) – double array
See the description of beta.
5:     alphai(n) – double array
See the description of beta.
6:     beta(n) – double array
(alphar(j) + alphai(j) × i) / beta(j)(alpharj+alphaij×i)/betaj, for j = 1,2,,nj=1,2,,n, will be the generalized eigenvalues. alphar(j) + alphai(j) × ialpharj+alphaij×i, and beta(j)betaj, for j = 1,2,,nj=1,2,,n, are the diagonals of the complex Schur form (S,T)(S,T) that would result if the 22 by 22 diagonal blocks of the real Schur form of (A,B)(A,B) were further reduced to triangular form using 22 by 22 complex unitary transformations.
If alphai(j)alphaij is zero, then the jjth eigenvalue is real; if positive, then the jjth and (j + 1)(j+1)st eigenvalues are a complex conjugate pair, with alphai(j + 1)alphaij+1 negative.
Note:  the quotients alphar(j) / beta(j)alpharj/betaj and alphai(j) / beta(j)alphaij/betaj may easily overflow or underflow, and beta(j)betaj may even be zero. Thus, you should avoid naively computing the ratio α / βα/β. However, alphar and alphai will always be less than and usually comparable with a2a2 in magnitude, and beta will always be less than and usually comparable with b2b2.
7:     vsl(ldvsl, : :) – double array
The first dimension, ldvsl, of the array vsl will be
  • if jobvsl = 'V'jobvsl='V', ldvsl max (1,n) ldvsl max(1,n) ;
  • otherwise ldvsl1ldvsl1.
The second dimension of the array will be max (1,n)max(1,n) if jobvsl = 'V'jobvsl='V', and at least 11 otherwise
If jobvsl = 'V'jobvsl='V', vsl will contain the left Schur vectors, QQ.
If jobvsl = 'N'jobvsl='N', vsl is not referenced.
8:     vsr(ldvsr, : :) – double array
The first dimension, ldvsr, of the array vsr will be
  • if jobvsr = 'V'jobvsr='V', ldvsr max (1,n) ldvsr max(1,n) ;
  • otherwise ldvsr1ldvsr1.
The second dimension of the array will be max (1,n)max(1,n) if jobvsr = 'V'jobvsr='V', and at least 11 otherwise
If jobvsr = 'V'jobvsr='V', vsr will contain the right Schur vectors, ZZ.
If jobvsr = 'N'jobvsr='N', vsr is not referenced.
9:     info – int64int32nag_int scalar
info = 0info=0 unless the function detects an error (see Section [Error Indicators and Warnings]).

Error Indicators and Warnings

Cases prefixed with W are classified as warnings and do not generate an error of type NAG:error_n. See nag_issue_warnings.

  info = iinfo=-i
If info = iinfo=-i, parameter ii had an illegal value on entry. The parameters are numbered as follows:
1: jobvsl, 2: jobvsr, 3: sort, 4: selctg, 5: n, 6: a, 7: lda, 8: b, 9: ldb, 10: sdim, 11: alphar, 12: alphai, 13: beta, 14: vsl, 15: ldvsl, 16: vsr, 17: ldvsr, 18: work, 19: lwork, 20: bwork, 21: info.
It is possible that info refers to a parameter that is omitted from the MATLAB interface. This usually indicates that an error in one of the other input parameters has caused an incorrect value to be inferred.
W INFO = 1tonINFO=1ton
The QZQZ iteration failed. (A,B)(A,B) are not in Schur form, but alphar(j)alpharj, alphai(j)alphaij, and beta(j)betaj should be correct for j = info + 1,,nj=info+1,,n.
  INFO = N + 1INFO=N+1
Unexpected error returned from nag_lapack_dhgeqz (f08xe).
W INFO = N + 2INFO=N+2
After reordering, roundoff changed values of some complex eigenvalues so that leading eigenvalues in the generalized Schur form no longer satisfy selctg = trueselctg=true. This could also be caused by underflow due to scaling.
W INFO = N + 3INFO=N+3
The eigenvalues could not be reordered because some eigenvalues were too close to separate (the problem is very ill-conditioned).

Accuracy

The computed generalized Schur factorization satisfies
A + E = QS ZT ,   B + F = QT ZT ,
A+E = QS ZT ,   B+F = QT ZT ,
where
(E,F)F = O(ε) (A,B)F
(E,F) F = O(ε) (A,B) F
and εε is the machine precision. See Section 4.11 of Anderson et al. (1999) for further details.

Further Comments

The total number of floating point operations is proportional to n3n3.
The complex analogue of this function is nag_lapack_zgges (f08xn).

Example

function nag_lapack_dgges_example
jobvsl = 'Vectors (left)';
jobvsr = 'Vectors (right)';
sortp = 'Sort';
selctg = @(ar, ai, b) (ai == 0) ;
a = [3.9, 12.5, -34.5, -0.5;
     4.3, 21.5, -47.5, 7.5;
     4.3, 21.5, -43.5, 3.5;
     4.4, 26, -46, 6];
b = [1, 2, -3, 1;
     1, 3, -5, 4;
     1, 3, -4, 3;
     1, 3, -4, 4];
[aOut, bOut, sdim, alphar, alphai, beta, vsl, vsr, info] = ...
    nag_lapack_dgges(jobvsl, jobvsr, sortp, selctg, a, b)
 

aOut =

    3.8009  -69.4505  -50.3135   43.2884
         0    9.2033    0.2001   -5.9881
         0         0    1.4279    4.4453
         0         0   -0.9019    1.1962


bOut =

    1.9005  -10.2285   -0.8658    5.2134
         0    2.3008   -0.7915   -0.4262
         0         0    0.8101         0
         0         0         0    0.2823


sdim =

                    2


alphar =

    3.8009
    9.2033
    0.8571
    0.8571


alphai =

         0
         0
    1.1429
   -1.1429


beta =

    1.9005
    2.3008
    0.2857
    0.2857


vsl =

    0.4642    0.7886   -0.2915   -0.2786
    0.5002   -0.5986   -0.5638   -0.2713
    0.5002    0.0154    0.0107    0.8657
    0.5331   -0.1395    0.7727   -0.3151


vsr =

    0.9961   -0.0014   -0.0887    0.0026
    0.0057   -0.0404    0.0938    0.9948
    0.0626    0.7194    0.6908   -0.0363
    0.0626   -0.6934    0.7114   -0.0956


info =

                    0


function f08xa_example
jobvsl = 'Vectors (left)';
jobvsr = 'Vectors (right)';
sortp = 'Sort';
selctg = @(ar, ai, b) (ai == 0) ;
a = [3.9, 12.5, -34.5, -0.5;
     4.3, 21.5, -47.5, 7.5;
     4.3, 21.5, -43.5, 3.5;
     4.4, 26, -46, 6];
b = [1, 2, -3, 1;
     1, 3, -5, 4;
     1, 3, -4, 3;
     1, 3, -4, 4];
[aOut, bOut, sdim, alphar, alphai, beta, vsl, vsr, info] = ...
    f08xa(jobvsl, jobvsr, sortp, selctg, a, b)
 

aOut =

    3.8009  -69.4505  -50.3135   43.2884
         0    9.2033    0.2001   -5.9881
         0         0    1.4279    4.4453
         0         0   -0.9019    1.1962


bOut =

    1.9005  -10.2285   -0.8658    5.2134
         0    2.3008   -0.7915   -0.4262
         0         0    0.8101         0
         0         0         0    0.2823


sdim =

                    2


alphar =

    3.8009
    9.2033
    0.8571
    0.8571


alphai =

         0
         0
    1.1429
   -1.1429


beta =

    1.9005
    2.3008
    0.2857
    0.2857


vsl =

    0.4642    0.7886   -0.2915   -0.2786
    0.5002   -0.5986   -0.5638   -0.2713
    0.5002    0.0154    0.0107    0.8657
    0.5331   -0.1395    0.7727   -0.3151


vsr =

    0.9961   -0.0014   -0.0887    0.0026
    0.0057   -0.0404    0.0938    0.9948
    0.0626    0.7194    0.6908   -0.0363
    0.0626   -0.6934    0.7114   -0.0956


info =

                    0



PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2013