Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

Chapter Contents
Chapter Introduction
NAG Toolbox

# NAG Toolbox: nag_lapack_zgeesx (f08pp)

## Purpose

nag_lapack_zgeesx (f08pp) computes the eigenvalues, the Schur form $T$, and, optionally, the matrix of Schur vectors $Z$ for an $n$ by $n$ complex nonsymmetric matrix $A$.

## Syntax

[a, sdim, w, vs, rconde, rcondv, info] = f08pp(jobvs, sort, select, sense, a, 'n', n)
[a, sdim, w, vs, rconde, rcondv, info] = nag_lapack_zgeesx(jobvs, sort, select, sense, a, 'n', n)

## Description

The Schur factorization of $A$ is given by
 $A = Z T ZH ,$
where $Z$, the matrix of Schur vectors, is unitary and $T$ is the Schur form. A complex matrix is in Schur form if it is upper triangular.
Optionally, nag_lapack_zgeesx (f08pp) also orders the eigenvalues on the diagonal of the Schur form so that selected eigenvalues are at the top left; computes a reciprocal condition number for the average of the selected eigenvalues (rconde); and computes a reciprocal condition number for the right invariant subspace corresponding to the selected eigenvalues (rcondv). The leading columns of $Z$ form an orthonormal basis for this invariant subspace.
For further explanation of the reciprocal condition numbers rconde and rcondv, see Section 4.8 of Anderson et al. (1999) (where these quantities are called $s$ and $\mathrm{sep}$ respectively).

## 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:     $\mathrm{jobvs}$ – string (length ≥ 1)
If ${\mathbf{jobvs}}=\text{'N'}$, Schur vectors are not computed.
If ${\mathbf{jobvs}}=\text{'V'}$, Schur vectors are computed.
Constraint: ${\mathbf{jobvs}}=\text{'N'}$ or $\text{'V'}$.
2:     $\mathrm{sort}$ – string (length ≥ 1)
Specifies whether or not to order the eigenvalues on the diagonal of the Schur form.
${\mathbf{sort}}=\text{'N'}$
Eigenvalues are not ordered.
${\mathbf{sort}}=\text{'S'}$
Eigenvalues are ordered (see select).
Constraint: ${\mathbf{sort}}=\text{'N'}$ or $\text{'S'}$.
3:     $\mathrm{select}$ – function handle or string containing name of m-file
If ${\mathbf{sort}}=\text{'S'}$, select is used to select eigenvalues to sort to the top left of the Schur form.
If ${\mathbf{sort}}=\text{'N'}$, select is not referenced and nag_lapack_zgeesx (f08pp) may be called with the string 'f08pnz'.
An eigenvalue ${\mathbf{w}}\left(j\right)$ is selected if ${\mathbf{select}}\left({\mathbf{w}}\left(j\right)\right)$ is true.
[result] = select(w)

Input Parameters

1:     $\mathrm{w}$ – complex scalar
The real and imaginary parts of the eigenvalue.

Output Parameters

1:     $\mathrm{result}$ – logical scalar
$\mathbf{result}=\mathit{true}$ for selected eigenvalues.
4:     $\mathrm{sense}$ – string (length ≥ 1)
Determines which reciprocal condition numbers are computed.
${\mathbf{sense}}=\text{'N'}$
None are computed.
${\mathbf{sense}}=\text{'E'}$
Computed for average of selected eigenvalues only.
${\mathbf{sense}}=\text{'V'}$
Computed for selected right invariant subspace only.
${\mathbf{sense}}=\text{'B'}$
Computed for both.
If ${\mathbf{sense}}=\text{'E'}$, $\text{'V'}$ or $\text{'B'}$, ${\mathbf{sort}}=\text{'S'}$.
Constraint: ${\mathbf{sense}}=\text{'N'}$, $\text{'E'}$, $\text{'V'}$ or $\text{'B'}$.
5:     $\mathrm{a}\left(\mathit{lda},:\right)$ – complex array
The first dimension of the array a must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
The second dimension of the array a must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
The $n$ by $n$ matrix $A$.

### Optional Input Parameters

1:     $\mathrm{n}$int64int32nag_int scalar
Default: the first dimension of the array a and the second dimension of the array a. (An error is raised if these dimensions are not equal.)
$n$, the order of the matrix $A$.
Constraint: ${\mathbf{n}}\ge 0$.

### Output Parameters

1:     $\mathrm{a}\left(\mathit{lda},:\right)$ – complex array
The first dimension of the array a will be $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
The second dimension of the array a will be $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
a stores its Schur form $T$.
2:     $\mathrm{sdim}$int64int32nag_int scalar
If ${\mathbf{sort}}=\text{'N'}$, ${\mathbf{sdim}}=0$.
If ${\mathbf{sort}}=\text{'S'}$, ${\mathbf{sdim}}=\text{}$ number of eigenvalues for which select is true.
3:     $\mathrm{w}\left(:\right)$ – complex array
The dimension of the array w will be $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$
Contains the computed eigenvalues, in the same order that they appear on the diagonal of the output Schur form $T$.
4:     $\mathrm{vs}\left(\mathit{ldvs},:\right)$ – complex array
The first dimension, $\mathit{ldvs}$, of the array vs will be
• if ${\mathbf{jobvs}}=\text{'V'}$, $\mathit{ldvs}=\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$;
• otherwise $\mathit{ldvs}=1$.
The second dimension of the array vs will be $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$ if ${\mathbf{jobvs}}=\text{'V'}$ and $1$ otherwise.
If ${\mathbf{jobvs}}=\text{'V'}$, vs contains the unitary matrix $Z$ of Schur vectors.
If ${\mathbf{jobvs}}=\text{'N'}$, vs is not referenced.
5:     $\mathrm{rconde}$ – double scalar
If ${\mathbf{sense}}=\text{'E'}$ or $\text{'B'}$, contains the reciprocal condition number for the average of the selected eigenvalues.
If ${\mathbf{sense}}=\text{'N'}$ or $\text{'V'}$, rconde is not referenced.
6:     $\mathrm{rcondv}$ – double scalar
If ${\mathbf{sense}}=\text{'V'}$ or $\text{'B'}$, rcondv contains the reciprocal condition number for the selected right invariant subspace.
If ${\mathbf{sense}}=\text{'N'}$ or $\text{'E'}$, rcondv is not referenced.
7:     $\mathrm{info}$int64int32nag_int scalar
${\mathbf{info}}=0$ unless the function detects an error (see 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.

${\mathbf{info}}=-i$
If ${\mathbf{info}}=-i$, parameter $i$ had an illegal value on entry. The parameters are numbered as follows:
1: jobvs, 2: sort, 3: select, 4: sense, 5: n, 6: a, 7: lda, 8: sdim, 9: w, 10: vs, 11: ldvs, 12: rconde, 13: rcondv, 14: work, 15: lwork, 16: rwork, 17: bwork, 18: 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.
${\mathbf{info}}=1 \text{to} {\mathbf{n}}$
If ${\mathbf{info}}=i$ and $i\le {\mathbf{n}}$, the $QR$ algorithm failed to compute all the eigenvalues.
W  ${\mathbf{info}}={\mathbf{n}}+1$
The eigenvalues could not be reordered because some eigenvalues were too close to separate (the problem is very ill-conditioned).
W  ${\mathbf{info}}={\mathbf{n}}+2$
After reordering, roundoff changed values of some complex eigenvalues so that leading eigenvalues in the Schur form no longer satisfy ${\mathbf{select}}=\mathit{true}$. This could also be caused by underflow due to scaling.

## Accuracy

The computed Schur factorization satisfies
 $A+E = ZTZH ,$
where
 $E2 = Oε A2 ,$
and $\epsilon$ is the machine precision. See Section 4.8 of Anderson et al. (1999) for further details.

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

## Example

This example finds the Schur factorization of the matrix
 $A = -3.97-5.04i -4.11+3.70i -0.34+1.01i 1.29-0.86i 0.34-1.50i 1.52-0.43i 1.88-5.38i 3.36+0.65i 3.31-3.85i 2.50+3.45i 0.88-1.08i 0.64-1.48i -1.10+0.82i 1.81-1.59i 3.25+1.33i 1.57-3.44i ,$
such that the eigenvalues of $A$ with positive real part of are the top left diagonal elements of the Schur form, $T$. Estimates of the condition numbers for the selected eigenvalue cluster and corresponding invariant subspace are also returned.
Note that the block size (NB) of $64$ assumed in this example is not realistic for such a small problem, but should be suitable for large problems.
```function f08pp_example

fprintf('f08pp example results\n\n');

% Complex matrix A
a = [ -3.97 - 5.04i, -4.11 + 3.70i, -0.34 + 1.01i,  1.29 - 0.86i;
0.34 - 1.50i,  1.52 - 0.43i,  1.88 - 5.38i,  3.36 + 0.65i;
3.31 - 3.85i,  2.50 + 3.45i,  0.88 - 1.08i,  0.64 - 1.48i;
-1.10 + 0.82i,  1.81 - 1.59i,  3.25 + 1.33i,  1.57 - 3.44i];

% Schur vectors of A, selecting eigenvalues with positive real parts
jobvs = 'Vectors (Schur)';
sortp = 'Sort';
select = @(w) (real(w) > 0 );
sense = 'Both reciprocal condition numbers';
[~, sdim, w, V, rconde, rcondv, info] = ...
f08pp( ...
jobvs, sortp, select, sense, a);

fprintf('Number of selected eigenvalues = %2d\n',sdim);

disp('Selected eigenvalues:');
disp(w(1:sdim));
disp('Corresponding eigenvectors:');
% Normalize eigenvectors before printing
disp(V(:,1:sdim)/diag(V(1,1:sdim)));

fprintf('Projection norm  for the selected eigenvalues = %7.4f\n',1/rconde);
fprintf('Condition number for the selected eigenvalues = %7.4f\n\n',1/rcondv);

anorm = norm(a);
erbde = x02aj*anorm/rconde;
erbdv = x02aj*anorm/rcondv;
fprintf('%-61s = %9.1e\n', ...
'Approximate asymptotic error bound for selected eigenvalues', erbde);
fprintf('%-61s = %9.1e\n', ...
'Approximate asymptotic error bound for the invariant subspace', ...
erbdv);

```
```f08pp example results

Number of selected eigenvalues =  2
Selected eigenvalues:
7.9982 - 0.9964i
3.0023 - 3.9998i

Corresponding eigenvectors:
1.0000 + 0.0000i   1.0000 + 0.0000i
-1.1841 - 1.8270i  -0.8886 + 0.3089i
0.7402 - 1.7252i   2.1298 - 0.0489i
-0.4668 - 0.6356i   0.6784 + 4.4559i

Projection norm  for the selected eigenvalues =  1.0072
Condition number for the selected eigenvalues =  0.1081

Approximate asymptotic error bound for selected eigenvalues   =   1.0e-15
Approximate asymptotic error bound for the invariant subspace =   1.1e-16
```