nag_dggesx (f08xbc) (PDF version)
f08 Chapter Contents
f08 Chapter Introduction
NAG Library Manual

NAG Library Function Document

nag_dggesx (f08xbc)

 Contents

    1  Purpose
    7  Accuracy

1  Purpose

nag_dggesx (f08xbc) computes the generalized eigenvalues, the generalized real Schur form S,T  and, optionally, the left and/or right generalized Schur vectors for a pair of n by n real nonsymmetric matrices A,B .
Estimates of condition numbers for selected generalized eigenvalue clusters and Schur vectors are also computed.

2  Specification

#include <nag.h>
#include <nagf08.h>
void  nag_dggesx (Nag_OrderType order, Nag_LeftVecsType jobvsl, Nag_RightVecsType jobvsr, Nag_SortEigValsType sort,
Nag_Boolean (*selctg)(double ar, double ai, double b),
Nag_RCondType sense, Integer n, double a[], Integer pda, double b[], Integer pdb, Integer *sdim, double alphar[], double alphai[], double beta[], double vsl[], Integer pdvsl, double vsr[], Integer pdvsr, double rconde[], double rcondv[], NagError *fail)

3  Description

The generalized real Schur factorization of A,B  is given by
A = QSZT ,   B = QTZT ,  
where Q and Z are orthogonal, T is upper triangular and S is upper quasi-triangular with 1 by 1 and 2 by 2 diagonal blocks. The generalized eigenvalues, λ , of A,B  are computed from the diagonals of T and S and satisfy
Az = λBz ,  
where z is the corresponding generalized eigenvector. λ  is actually returned as the pair α,β  such that
λ = α/β  
since β , or even both α  and β  can be zero. The columns of Q and Z are the left and right generalized Schur vectors of A,B .
Optionally, nag_dggesx (f08xbc) can order the generalized eigenvalues on the diagonals of S,T  so that selected eigenvalues are at the top left. The leading columns of Q and Z then form an orthonormal basis for the corresponding eigenspaces, the deflating subspaces.
nag_dggesx (f08xbc) computes T to have non-negative diagonal elements, and the 2 by 2 blocks of S correspond to complex conjugate pairs of generalized eigenvalues. The generalized Schur factorization, before reordering, is computed by the QZ algorithm.
The reciprocals of the condition estimates, the reciprocal values of the left and right projection norms, are returned in rconde[0]  and rconde[1]  respectively, for the selected generalized eigenvalues, together with reciprocal condition estimates for the corresponding left and right deflating subspaces, in rcondv[0]  and rcondv[1] . See Section 4.11 of Anderson et al. (1999) for further information.

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

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:     jobvsl Nag_LeftVecsTypeInput
On entry: if jobvsl=Nag_NotLeftVecs, do not compute the left Schur vectors.
If jobvsl=Nag_LeftVecs, compute the left Schur vectors.
Constraint: jobvsl=Nag_NotLeftVecs or Nag_LeftVecs.
3:     jobvsr Nag_RightVecsTypeInput
On entry: if jobvsr=Nag_NotRightVecs, do not compute the right Schur vectors.
If jobvsr=Nag_RightVecs, compute the right Schur vectors.
Constraint: jobvsr=Nag_NotRightVecs or Nag_RightVecs.
4:     sort Nag_SortEigValsTypeInput
On entry: specifies whether or not to order the eigenvalues on the diagonal of the generalized Schur form.
sort=Nag_NoSortEigVals
Eigenvalues are not ordered.
sort=Nag_SortEigVals
Eigenvalues are ordered (see selctg).
Constraint: sort=Nag_NoSortEigVals or Nag_SortEigVals.
5:     selctg function, supplied by the userExternal Function
If sort=Nag_SortEigVals, selctg is used to select generalized eigenvalues to the top left of the generalized Schur form.
If sort=Nag_NoSortEigVals, selctg is not referenced by nag_dggesx (f08xbc), and may be specified as NULLFN.
The specification of selctg is:
Nag_Boolean  selctg (double ar, double ai, double b)
1:     ar doubleInput
2:     ai doubleInput
3:     b doubleInput
On entry: an eigenvalue ar[j-1] + -1 × ai[j-1] / b[j-1]  is selected if selctg ar[j-1],ai[j-1],b[j-1]  is Nag_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-1],ai[j-1],b[j-1]=Nag_TRUE  after ordering. fail.code= NE_SCHUR_REORDER_SELECT in this case.
6:     sense Nag_RCondTypeInput
On entry: determines which reciprocal condition numbers are computed.
sense=Nag_NotRCond
None are computed.
sense=Nag_RCondEigVals
Computed for average of selected eigenvalues only.
sense=Nag_RCondEigVecs
Computed for selected deflating subspaces only.
sense=Nag_RCondBoth
Computed for both.
If sense=Nag_RCondEigVals, Nag_RCondEigVecs or Nag_RCondBoth, sort=Nag_SortEigVals.
Constraint: sense=Nag_NotRCond, Nag_RCondEigVals, Nag_RCondEigVecs or Nag_RCondBoth.
7:     n IntegerInput
On entry: n, the order of the matrices A and B.
Constraint: n0.
8:     a[dim] doubleInput/Output
Note: the dimension, dim, of the array a must be at least max1,pda×n.
The i,jth element of the matrix A is stored in
  • a[j-1×pda+i-1] when order=Nag_ColMajor;
  • a[i-1×pda+j-1] when order=Nag_RowMajor.
On entry: the first of the pair of matrices, A.
On exit: a has been overwritten by its generalized Schur form S.
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.
The i,jth element of the matrix B is stored in
  • b[j-1×pdb+i-1] when order=Nag_ColMajor;
  • b[i-1×pdb+j-1] when order=Nag_RowMajor.
On entry: the second of the pair of matrices, B.
On exit: b has been overwritten by its generalized Schur form T.
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:   sdim Integer *Output
On exit: if sort=Nag_NoSortEigVals, sdim=0.
If sort=Nag_SortEigVals, sdim= number of eigenvalues (after sorting) for which selctg is Nag_TRUE. (Complex conjugate pairs for which selctg is Nag_TRUE for either eigenvalue count as 2.)
13:   alphar[n] doubleOutput
On exit: see the description of beta.
14:   alphai[n] doubleOutput
On exit: see the description of beta.
15:   beta[n] doubleOutput
On exit: alphar[j-1]+alphai[j-1]×i/beta[j-1], for j=1,2,,n, will be the generalized eigenvalues. alphar[j-1]+alphai[j-1]×i, and beta[j-1], for j=1,2,,n, are the diagonals of the complex Schur form S,T that would result if the 2 by 2 diagonal blocks of the real Schur form of A,B were further reduced to triangular form using 2 by 2 complex unitary transformations.
If alphai[j-1] is zero, then the jth eigenvalue is real; if positive, then the jth and j+1st eigenvalues are a complex conjugate pair, with alphai[j] negative.
Note:  the quotients alphar[j-1]/beta[j-1] and alphai[j-1]/beta[j-1] may easily overflow or underflow, and beta[j-1] 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 a2 in magnitude, and beta will always be less than and usually comparable with b2.
16:   vsl[dim] doubleOutput
Note: the dimension, dim, of the array vsl must be at least
  • max1,pdvsl×n when jobvsl=Nag_LeftVecs;
  • 1 otherwise.
The ith element of the jth vector is stored in
  • vsl[j-1×pdvsl+i-1] when order=Nag_ColMajor;
  • vsl[i-1×pdvsl+j-1] when order=Nag_RowMajor.
On exit: if jobvsl=Nag_LeftVecs, vsl will contain the left Schur vectors, Q.
If jobvsl=Nag_NotLeftVecs, vsl is not referenced.
17:   pdvsl IntegerInput
On entry: the stride used in the array vsl.
Constraints:
  • if jobvsl=Nag_LeftVecs, pdvsl max1,n ;
  • otherwise pdvsl1.
18:   vsr[dim] doubleOutput
Note: the dimension, dim, of the array vsr must be at least
  • max1,pdvsr×n when jobvsr=Nag_RightVecs;
  • 1 otherwise.
The ith element of the jth vector is stored in
  • vsr[j-1×pdvsr+i-1] when order=Nag_ColMajor;
  • vsr[i-1×pdvsr+j-1] when order=Nag_RowMajor.
On exit: if jobvsr=Nag_RightVecs, vsr will contain the right Schur vectors, Z.
If jobvsr=Nag_NotRightVecs, vsr is not referenced.
19:   pdvsr IntegerInput
On entry: the stride used in the array vsr.
Constraints:
  • if jobvsr=Nag_RightVecs, pdvsr max1,n ;
  • otherwise pdvsr1.
20:   rconde[2] doubleOutput
On exit: if sense=Nag_RCondEigVals or Nag_RCondBoth, rconde[0] and rconde[1] contain the reciprocal condition numbers for the average of the selected eigenvalues.
If sense=Nag_NotRCond or Nag_RCondEigVecs, rconde is not referenced.
21:   rcondv[2] doubleOutput
On exit: if sense=Nag_RCondEigVecs or Nag_RCondBoth, rcondv[0]  and rcondv[1]  contain the reciprocal condition numbers for the selected deflating subspaces.
if sense=Nag_NotRCond or Nag_RCondEigVals, rcondv is not referenced.
22:   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, jobvsl=value, pdvsl=value and n=value.
Constraint: if jobvsl=Nag_LeftVecs, pdvsl max1,n ;
otherwise pdvsl1.
On entry, jobvsr=value, pdvsr=value and n=value.
Constraint: if jobvsr=Nag_RightVecs, pdvsr max1,n ;
otherwise pdvsr1.
NE_INT
On entry, n=value.
Constraint: n0.
On entry, pda=value.
Constraint: pda>0.
On entry, pdb=value.
Constraint: pdb>0.
On entry, pdvsl=value.
Constraint: pdvsl>0.
On entry, pdvsr=value.
Constraint: pdvsr>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_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.
NE_ITERATION_QZ
The QZ iteration failed. No eigenvectors have been calculated but alphar[j], alphai[j] and beta[j] should be correct from element value.
The QZ iteration failed with an unexpected error, please contact NAG.
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_REORDER
The eigenvalues could not be reordered because some eigenvalues were too close to separate (the problem is very ill-conditioned).
NE_SCHUR_REORDER_SELECT
After reordering, roundoff changed values of some complex eigenvalues so that leading eigenvalues in the generalized Schur form no longer satisfy selctg=Nag_TRUE. This could also be caused by underflow due to scaling.

7  Accuracy

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

8  Parallelism and Performance

nag_dggesx (f08xbc) is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
nag_dggesx (f08xbc) 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

The total number of floating-point operations is proportional to n3.
The complex analogue of this function is nag_zggesx (f08xpc).

10  Example

This example finds the generalized Schur factorization of the matrix pair A,B, where
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.0 -46.0 6.0   and   B= 1.0 2.0 -3.0 1.0 1.0 3.0 -5.0 4.0 1.0 3.0 -4.0 3.0 1.0 3.0 -4.0 4.0 ,  
such that the real positive eigenvalues of A,B correspond to the top left diagonal elements of the generalized Schur form, S,T. Estimates of the condition numbers for the selected eigenvalue cluster and corresponding deflating subspaces are also returned.

10.1  Program Text

Program Text (f08xbce.c)

10.2  Program Data

Program Data (f08xbce.d)

10.3  Program Results

Program Results (f08xbce.r)


nag_dggesx (f08xbc) (PDF version)
f08 Chapter Contents
f08 Chapter Introduction
NAG Library Manual

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