NAG CL Interfacef08xpc (zggesx)

Settings help

CL Name Style:

1Purpose

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

2Specification

 #include
void  f08xpc (Nag_OrderType order, Nag_LeftVecsType jobvsl, Nag_RightVecsType jobvsr, Nag_SortEigValsType sort,
 Nag_Boolean (*selctg)(Complex a, Complex b),
Nag_RCondType sense, Integer n, Complex a[], Integer pda, Complex b[], Integer pdb, Integer *sdim, Complex alpha[], Complex beta[], Complex vsl[], Integer pdvsl, Complex vsr[], Integer pdvsr, double rconde[], double rcondv[], NagError *fail)
The function may be called by the names: f08xpc, nag_lapackeig_zggesx or nag_zggesx.

3Description

The generalized Schur factorization for a pair of complex matrices $\left(A,B\right)$ is given by
 $A = QSZH , B = QTZH ,$
where $Q$ and $Z$ are unitary, $T$ and $S$ are upper triangular. The generalized eigenvalues, $\lambda$, of $\left(A,B\right)$ are computed from the diagonals of $T$ and $S$ and satisfy
 $Az = λBz ,$
where $z$ is the corresponding generalized eigenvector. $\lambda$ is actually returned as the pair $\left(\alpha ,\beta \right)$ such that
 $λ = α/β$
since $\beta$, or even both $\alpha$ and $\beta$ can be zero. The columns of $Q$ and $Z$ are the left and right generalized Schur vectors of $\left(A,B\right)$.
Optionally, f08xpc can order the generalized eigenvalues on the diagonals of $\left(S,T\right)$ 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.
f08xpc computes $T$ to have real non-negative diagonal entries. 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 ${\mathbf{rconde}}\left[0\right]$ and ${\mathbf{rconde}}\left[1\right]$ respectively, for the selected generalized eigenvalues, together with reciprocal condition estimates for the corresponding left and right deflating subspaces, in ${\mathbf{rcondv}}\left[0\right]$ and ${\mathbf{rcondv}}\left[1\right]$. See Section 4.11 of Anderson et al. (1999) for further information.

4References

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

5Arguments

1: $\mathbf{order}$Nag_OrderType Input
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 ${\mathbf{order}}=\mathrm{Nag_RowMajor}$. See Section 3.1.3 in the Introduction to the NAG Library CL Interface for a more detailed explanation of the use of this argument.
Constraint: ${\mathbf{order}}=\mathrm{Nag_RowMajor}$ or $\mathrm{Nag_ColMajor}$.
2: $\mathbf{jobvsl}$Nag_LeftVecsType Input
On entry: if ${\mathbf{jobvsl}}=\mathrm{Nag_NotLeftVecs}$, do not compute the left Schur vectors.
If ${\mathbf{jobvsl}}=\mathrm{Nag_LeftVecs}$, compute the left Schur vectors.
Constraint: ${\mathbf{jobvsl}}=\mathrm{Nag_NotLeftVecs}$ or $\mathrm{Nag_LeftVecs}$.
3: $\mathbf{jobvsr}$Nag_RightVecsType Input
On entry: if ${\mathbf{jobvsr}}=\mathrm{Nag_NotRightVecs}$, do not compute the right Schur vectors.
If ${\mathbf{jobvsr}}=\mathrm{Nag_RightVecs}$, compute the right Schur vectors.
Constraint: ${\mathbf{jobvsr}}=\mathrm{Nag_NotRightVecs}$ or $\mathrm{Nag_RightVecs}$.
4: $\mathbf{sort}$Nag_SortEigValsType Input
On entry: specifies whether or not to order the eigenvalues on the diagonal of the generalized Schur form.
${\mathbf{sort}}=\mathrm{Nag_NoSortEigVals}$
Eigenvalues are not ordered.
${\mathbf{sort}}=\mathrm{Nag_SortEigVals}$
Eigenvalues are ordered (see selctg).
Constraint: ${\mathbf{sort}}=\mathrm{Nag_NoSortEigVals}$ or $\mathrm{Nag_SortEigVals}$.
5: $\mathbf{selctg}$function, supplied by the user External Function
If ${\mathbf{sort}}=\mathrm{Nag_SortEigVals}$, selctg is used to select generalized eigenvalues to be moved to the top left of the generalized Schur form.
If ${\mathbf{sort}}=\mathrm{Nag_NoSortEigVals}$, selctg is not referenced by f08xpc, and may be specified as NULLFN.
The specification of selctg is:
 Nag_Boolean selctg (Complex a, Complex b)
1: $\mathbf{a}$Complex Input
2: $\mathbf{b}$Complex Input
On entry: an eigenvalue ${\mathbf{a}}\left[j-1\right]/{\mathbf{b}}\left[j-1\right]$ is selected if ${\mathbf{selctg}}\left({\mathbf{a}}\left[j-1\right],{\mathbf{b}}\left[j-1\right]\right)$ is Nag_TRUE.
Note that in the ill-conditioned case, a selected generalized eigenvalue may no longer satisfy ${\mathbf{selctg}}\left({\mathbf{a}}\left[j-1\right],{\mathbf{b}}\left[j-1\right]\right)=\mathrm{Nag_TRUE}$ after ordering. ${\mathbf{fail}}\mathbf{.}\mathbf{code}=$ NE_SCHUR_REORDER_SELECT in this case.
6: $\mathbf{sense}$Nag_RCondType Input
On entry: determines which reciprocal condition numbers are computed.
${\mathbf{sense}}=\mathrm{Nag_NotRCond}$
None are computed.
${\mathbf{sense}}=\mathrm{Nag_RCondEigVals}$
Computed for average of selected eigenvalues only.
${\mathbf{sense}}=\mathrm{Nag_RCondEigVecs}$
Computed for selected deflating subspaces only.
${\mathbf{sense}}=\mathrm{Nag_RCondBoth}$
Computed for both.
If ${\mathbf{sense}}=\mathrm{Nag_RCondEigVals}$, $\mathrm{Nag_RCondEigVecs}$ or $\mathrm{Nag_RCondBoth}$, ${\mathbf{sort}}=\mathrm{Nag_SortEigVals}$.
Constraint: ${\mathbf{sense}}=\mathrm{Nag_NotRCond}$, $\mathrm{Nag_RCondEigVals}$, $\mathrm{Nag_RCondEigVecs}$ or $\mathrm{Nag_RCondBoth}$.
7: $\mathbf{n}$Integer Input
On entry: $n$, the order of the matrices $A$ and $B$.
Constraint: ${\mathbf{n}}\ge 0$.
8: $\mathbf{a}\left[\mathit{dim}\right]$Complex Input/Output
Note: the dimension, dim, of the array a must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pda}}×{\mathbf{n}}\right)$.
The $\left(i,j\right)$th element of the matrix $A$ is stored in
• ${\mathbf{a}}\left[\left(j-1\right)×{\mathbf{pda}}+i-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• ${\mathbf{a}}\left[\left(i-1\right)×{\mathbf{pda}}+j-1\right]$ when ${\mathbf{order}}=\mathrm{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: $\mathbf{pda}$Integer Input
On entry: the stride separating row or column elements (depending on the value of order) in the array a.
Constraint: ${\mathbf{pda}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
10: $\mathbf{b}\left[\mathit{dim}\right]$Complex Input/Output
Note: the dimension, dim, of the array b must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pdb}}×{\mathbf{n}}\right)$.
The $\left(i,j\right)$th element of the matrix $B$ is stored in
• ${\mathbf{b}}\left[\left(j-1\right)×{\mathbf{pdb}}+i-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• ${\mathbf{b}}\left[\left(i-1\right)×{\mathbf{pdb}}+j-1\right]$ when ${\mathbf{order}}=\mathrm{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: $\mathbf{pdb}$Integer Input
On entry: the stride separating row or column elements (depending on the value of order) in the array b.
Constraint: ${\mathbf{pdb}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
12: $\mathbf{sdim}$Integer * Output
On exit: if ${\mathbf{sort}}=\mathrm{Nag_NoSortEigVals}$, ${\mathbf{sdim}}=0$.
If ${\mathbf{sort}}=\mathrm{Nag_SortEigVals}$, ${\mathbf{sdim}}=\text{}$ number of eigenvalues (after sorting) for which selctg is Nag_TRUE.
13: $\mathbf{alpha}\left[{\mathbf{n}}\right]$Complex Output
On exit: see the description of beta.
14: $\mathbf{beta}\left[{\mathbf{n}}\right]$Complex Output
On exit: ${\mathbf{alpha}}\left[\mathit{j}-1\right]/{\mathbf{beta}}\left[\mathit{j}-1\right]$, for $\mathit{j}=1,2,\dots ,{\mathbf{n}}$, will be the generalized eigenvalues. ${\mathbf{alpha}}\left[j-1\right]$ and ${\mathbf{beta}}\left[j-1\right],j=1,2,\dots ,{\mathbf{n}}$ are the diagonals of the complex Schur form $\left(S,T\right)$. ${\mathbf{beta}}\left[j-1\right]$ will be non-negative real.
Note:  the quotients ${\mathbf{alpha}}\left[j-1\right]/{\mathbf{beta}}\left[j-1\right]$ may easily overflow or underflow, and ${\mathbf{beta}}\left[j-1\right]$ may even be zero. Thus, you should avoid naively computing the ratio $\alpha /\beta$. However, alpha will always be less than and usually comparable with $‖{\mathbf{a}}‖$ in magnitude, and beta will always be less than and usually comparable with $‖{\mathbf{b}}‖$.
15: $\mathbf{vsl}\left[\mathit{dim}\right]$Complex Output
Note: the dimension, dim, of the array vsl must be at least
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pdvsl}}×{\mathbf{n}}\right)$ when ${\mathbf{jobvsl}}=\mathrm{Nag_LeftVecs}$;
• $1$ otherwise.
$i$th element of the $j$th vector is stored in
• ${\mathbf{vsl}}\left[\left(j-1\right)×{\mathbf{pdvsl}}+i-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• ${\mathbf{vsl}}\left[\left(i-1\right)×{\mathbf{pdvsl}}+j-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
On exit: if ${\mathbf{jobvsl}}=\mathrm{Nag_LeftVecs}$, vsl will contain the left Schur vectors, $Q$.
If ${\mathbf{jobvsl}}=\mathrm{Nag_NotLeftVecs}$, vsl is not referenced.
16: $\mathbf{pdvsl}$Integer Input
On entry: the stride used in the array vsl.
Constraints:
• if ${\mathbf{jobvsl}}=\mathrm{Nag_LeftVecs}$, ${\mathbf{pdvsl}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$;
• otherwise ${\mathbf{pdvsl}}\ge 1$.
17: $\mathbf{vsr}\left[\mathit{dim}\right]$Complex Output
Note: the dimension, dim, of the array vsr must be at least
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pdvsr}}×{\mathbf{n}}\right)$ when ${\mathbf{jobvsr}}=\mathrm{Nag_RightVecs}$;
• $1$ otherwise.
$i$th element of the $j$th vector is stored in
• ${\mathbf{vsr}}\left[\left(j-1\right)×{\mathbf{pdvsr}}+i-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• ${\mathbf{vsr}}\left[\left(i-1\right)×{\mathbf{pdvsr}}+j-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
On exit: if ${\mathbf{jobvsr}}=\mathrm{Nag_RightVecs}$, vsr will contain the right Schur vectors, $Z$.
If ${\mathbf{jobvsr}}=\mathrm{Nag_NotRightVecs}$, vsr is not referenced.
18: $\mathbf{pdvsr}$Integer Input
On entry: the stride used in the array vsr.
Constraints:
• if ${\mathbf{jobvsr}}=\mathrm{Nag_RightVecs}$, ${\mathbf{pdvsr}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$;
• otherwise ${\mathbf{pdvsr}}\ge 1$.
19: $\mathbf{rconde}\left[2\right]$double Output
On exit: if ${\mathbf{sense}}=\mathrm{Nag_RCondEigVals}$ or $\mathrm{Nag_RCondBoth}$, ${\mathbf{rconde}}\left[0\right]$ and ${\mathbf{rconde}}\left[1\right]$ contain the reciprocal condition numbers for the average of the selected eigenvalues.
If ${\mathbf{sense}}=\mathrm{Nag_NotRCond}$ or $\mathrm{Nag_RCondEigVecs}$, rconde is not referenced.
20: $\mathbf{rcondv}\left[2\right]$double Output
On exit: if ${\mathbf{sense}}=\mathrm{Nag_RCondEigVecs}$ or $\mathrm{Nag_RCondBoth}$, ${\mathbf{rcondv}}\left[0\right]$ and ${\mathbf{rcondv}}\left[1\right]$ contain the reciprocal condition numbers for the selected deflating subspaces.
if ${\mathbf{sense}}=\mathrm{Nag_NotRCond}$ or $\mathrm{Nag_RCondEigVals}$, rcondv is not referenced.
21: $\mathbf{fail}$NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

6Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
On entry, argument $⟨\mathit{\text{value}}⟩$ had an illegal value.
NE_ENUM_INT_2
On entry, ${\mathbf{jobvsl}}=⟨\mathit{\text{value}}⟩$, ${\mathbf{pdvsl}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$.
Constraint: if ${\mathbf{jobvsl}}=\mathrm{Nag_LeftVecs}$, ${\mathbf{pdvsl}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$;
otherwise ${\mathbf{pdvsl}}\ge 1$.
On entry, ${\mathbf{jobvsr}}=⟨\mathit{\text{value}}⟩$, ${\mathbf{pdvsr}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$.
Constraint: if ${\mathbf{jobvsr}}=\mathrm{Nag_RightVecs}$, ${\mathbf{pdvsr}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$;
otherwise ${\mathbf{pdvsr}}\ge 1$.
NE_INT
On entry, ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{n}}\ge 0$.
On entry, ${\mathbf{pda}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{pda}}>0$.
On entry, ${\mathbf{pdb}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{pdb}}>0$.
On entry, ${\mathbf{pdvsl}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{pdvsl}}>0$.
On entry, ${\mathbf{pdvsr}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{pdvsr}}>0$.
NE_INT_2
On entry, ${\mathbf{pda}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{pda}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
On entry, ${\mathbf{pdb}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{pdb}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
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.
See Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
NE_ITERATION_QZ
The $QZ$ iteration failed. $\left(A,B\right)$ are not in Schur form, but ${\mathbf{alpha}}\left[j\right]$ and ${\mathbf{beta}}\left[j\right]$ should be correct from element $⟨\mathit{\text{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 8 in the Introduction to the NAG Library CL Interface 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 ${\mathbf{selctg}}=\mathrm{Nag_TRUE}$. This could also be caused by underflow due to scaling.

7Accuracy

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

8Parallelism and Performance

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

The total number of floating-point operations is proportional to ${n}^{3}$.
The real analogue of this function is f08xbc.

10Example

This example finds the generalized Schur factorization of the matrix pair $\left(A,B\right)$, where
 $A = ( -21.10-22.50i 53.50-50.50i -34.50+127.50i 7.50+00.50i -0.46-07.78i -3.50-37.50i -15.50+058.50i -10.50-01.50i 4.30-05.50i 39.70-17.10i -68.50+012.50i -7.50-03.50i 5.50+04.40i 14.40+43.30i -32.50-046.00i -19.00-32.50i )$
and
 $B = ( 1.00-5.00i 1.60+1.20i -3.00+0.00i 0.00-1.00i 0.80-0.60i 3.00-5.00i -4.00+3.00i -2.40-3.20i 1.00+0.00i 2.40+1.80i -4.00-5.00i 0.00-3.00i 0.00+1.00i -1.80+2.40i 0.00-4.00i 4.00-5.00i ) ,$
such that the eigenvalues of $\left(A,B\right)$ for which $|\lambda |<6$ correspond to the top left diagonal elements of the generalized Schur form, $\left(S,T\right)$. Estimates of the condition numbers for the selected eigenvalue cluster and corresponding deflating subspaces are also returned.

10.1Program Text

Program Text (f08xpce.c)

10.2Program Data

Program Data (f08xpce.d)

10.3Program Results

Program Results (f08xpce.r)