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_dtrsen (f08qg)

Purpose

nag_lapack_dtrsen (f08qg) reorders the Schur factorization of a real general matrix so that a selected cluster of eigenvalues appears in the leading elements or blocks on the diagonal of the Schur form. The function also optionally computes the reciprocal condition numbers of the cluster of eigenvalues and/or the invariant subspace.

Syntax

[t, q, wr, wi, m, s, sep, info] = f08qg(job, compq, select, t, q, 'n', n)
[t, q, wr, wi, m, s, sep, info] = nag_lapack_dtrsen(job, compq, select, t, q, 'n', n)

Description

nag_lapack_dtrsen (f08qg) reorders the Schur factorization of a real general matrix $A=QT{Q}^{\mathrm{T}}$, so that a selected cluster of eigenvalues appears in the leading diagonal elements or blocks of the Schur form.
The reordered Schur form $\stackrel{~}{T}$ is computed by an orthogonal similarity transformation: $\stackrel{~}{T}={Z}^{\mathrm{T}}TZ$. Optionally the updated matrix $\stackrel{~}{Q}$ of Schur vectors is computed as $\stackrel{~}{Q}=QZ$, giving $A=\stackrel{~}{Q}\stackrel{~}{T}{\stackrel{~}{Q}}^{\mathrm{T}}$.
Let $\stackrel{~}{T}=\left(\begin{array}{cc}{T}_{11}& {T}_{12}\\ 0& {T}_{22}\end{array}\right)$, where the selected eigenvalues are precisely the eigenvalues of the leading $m$ by $m$ sub-matrix ${T}_{11}$. Let $\stackrel{~}{Q}$ be correspondingly partitioned as $\left(\begin{array}{cc}{Q}_{1}& {Q}_{2}\end{array}\right)$ where ${Q}_{1}$ consists of the first $m$ columns of $Q$. Then $A{Q}_{1}={Q}_{1}{T}_{11}$, and so the $m$ columns of ${Q}_{1}$ form an orthonormal basis for the invariant subspace corresponding to the selected cluster of eigenvalues.
Optionally the function also computes estimates of the reciprocal condition numbers of the average of the cluster of eigenvalues and of the invariant subspace.

References

Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore

Parameters

Compulsory Input Parameters

1:     $\mathrm{job}$ – string (length ≥ 1)
Indicates whether condition numbers are required for the cluster of eigenvalues and/or the invariant subspace.
${\mathbf{job}}=\text{'N'}$
No condition numbers are required.
${\mathbf{job}}=\text{'E'}$
Only the condition number for the cluster of eigenvalues is computed.
${\mathbf{job}}=\text{'V'}$
Only the condition number for the invariant subspace is computed.
${\mathbf{job}}=\text{'B'}$
Condition numbers for both the cluster of eigenvalues and the invariant subspace are computed.
Constraint: ${\mathbf{job}}=\text{'N'}$, $\text{'E'}$, $\text{'V'}$ or $\text{'B'}$.
2:     $\mathrm{compq}$ – string (length ≥ 1)
Indicates whether the matrix $Q$ of Schur vectors is to be updated.
${\mathbf{compq}}=\text{'V'}$
The matrix $Q$ of Schur vectors is updated.
${\mathbf{compq}}=\text{'N'}$
No Schur vectors are updated.
Constraint: ${\mathbf{compq}}=\text{'V'}$ or $\text{'N'}$.
3:     $\mathrm{select}\left(:\right)$ – logical array
The dimension of the array select must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$
The eigenvalues in the selected cluster. To select a real eigenvalue ${\lambda }_{j}$, ${\mathbf{select}}\left(j\right)$ must be set true. To select a complex conjugate pair of eigenvalues ${\lambda }_{j}$ and ${\lambda }_{j+1}$ (corresponding to a $2$ by $2$ diagonal block), ${\mathbf{select}}\left(j\right)$ and/or ${\mathbf{select}}\left(j+1\right)$ must be set to true. A complex conjugate pair of eigenvalues must be either both included in the cluster or both excluded. See also Further Comments.
4:     $\mathrm{t}\left(\mathit{ldt},:\right)$ – double array
The first dimension of the array t must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
The second dimension of the array t must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
The $n$ by $n$ upper quasi-triangular matrix $T$ in canonical Schur form, as returned by nag_lapack_dhseqr (f08pe). See also Further Comments.
5:     $\mathrm{q}\left(\mathit{ldq},:\right)$ – double array
The first dimension, $\mathit{ldq}$, of the array q must satisfy
• if ${\mathbf{compq}}=\text{'V'}$, $\mathit{ldq}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$;
• if ${\mathbf{compq}}=\text{'N'}$, $\mathit{ldq}\ge 1$.
The second dimension of the array q must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$ if ${\mathbf{compq}}=\text{'V'}$ and at least $1$ if ${\mathbf{compq}}=\text{'N'}$.
If ${\mathbf{compq}}=\text{'V'}$, q must contain the $n$ by $n$ orthogonal matrix $Q$ of Schur vectors, as returned by nag_lapack_dhseqr (f08pe).

Optional Input Parameters

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

Output Parameters

1:     $\mathrm{t}\left(\mathit{ldt},:\right)$ – double array
The first dimension of the array t will be $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
The second dimension of the array t will be $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
t stores the updated matrix $\stackrel{~}{T}$.
2:     $\mathrm{q}\left(\mathit{ldq},:\right)$ – double array
The first dimension, $\mathit{ldq}$, of the array q will be
• if ${\mathbf{compq}}=\text{'V'}$, $\mathit{ldq}=\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$;
• if ${\mathbf{compq}}=\text{'N'}$, $\mathit{ldq}=1$.
The second dimension of the array q will be $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$ if ${\mathbf{compq}}=\text{'V'}$ and at least $1$ if ${\mathbf{compq}}=\text{'N'}$.
If ${\mathbf{compq}}=\text{'V'}$, q contains the updated matrix of Schur vectors; the first $m$ columns of $Q$ form an orthonormal basis for the specified invariant subspace.
If ${\mathbf{compq}}=\text{'N'}$, q is not referenced.
3:     $\mathrm{wr}\left(:\right)$ – double array
4:     $\mathrm{wi}\left(:\right)$ – double array
The dimension of the arrays wr and wi will be $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$
The real and imaginary parts, respectively, of the reordered eigenvalues of $\stackrel{~}{T}$. The eigenvalues are stored in the same order as on the diagonal of $\stackrel{~}{T}$; see Further Comments for details. Note that if a complex eigenvalue is sufficiently ill-conditioned, then its value may differ significantly from its value before reordering.
5:     $\mathrm{m}$int64int32nag_int scalar
$m$, the dimension of the specified invariant subspace. The value of $m$ is obtained by counting $1$ for each selected real eigenvalue and $2$ for each selected complex conjugate pair of eigenvalues (see select); $0\le m\le n$.
6:     $\mathrm{s}$ – double scalar
If ${\mathbf{job}}=\text{'E'}$ or $\text{'B'}$, s is a lower bound on the reciprocal condition number of the average of the selected cluster of eigenvalues. If ${\mathbf{m}}=0\text{​ or ​}{\mathbf{n}}$, ${\mathbf{s}}=1$; if ${\mathbf{info}}={\mathbf{1}}$ (see Error Indicators and Warnings), s is set to zero.
If ${\mathbf{job}}=\text{'N'}$ or $\text{'V'}$, s is not referenced.
7:     $\mathrm{sep}$ – double scalar
If ${\mathbf{job}}=\text{'V'}$ or $\text{'B'}$, sep is the estimated reciprocal condition number of the specified invariant subspace. If ${\mathbf{m}}=0\text{​ or ​}{\mathbf{n}}$, ${\mathbf{sep}}=‖T‖$; if ${\mathbf{info}}={\mathbf{1}}$ (see Error Indicators and Warnings), sep is set to zero.
If ${\mathbf{job}}=\text{'N'}$ or $\text{'E'}$, sep is not referenced.
8:     $\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: job, 2: compq, 3: select, 4: n, 5: t, 6: ldt, 7: q, 8: ldq, 9: wr, 10: wi, 11: m, 12: s, 13: sep, 14: work, 15: lwork, 16: iwork, 17: liwork, 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.
W  ${\mathbf{info}}=1$
The reordering of $T$ failed because a selected eigenvalue was too close to an eigenvalue which was not selected; this error exit can only occur if at least one of the eigenvalues involved was complex. The problem is too ill-conditioned: consider modifying the selection of eigenvalues so that eigenvalues which are very close together are either all included in the cluster or all excluded. On exit, $T$ may have been partially reordered, but wr, wi and $Q$ (if requested) are updated consistently with $T$; s and sep (if requested) are both set to zero.

Accuracy

The computed matrix $\stackrel{~}{T}$ is similar to a matrix $\left(T+E\right)$, where
 $E2 = Oε T2 ,$
and $\epsilon$ is the machine precision.
s cannot underestimate the true reciprocal condition number by more than a factor of $\sqrt{\mathrm{min}\phantom{\rule{0.125em}{0ex}}\left(m,n-m\right)}$. sep may differ from the true value by $\sqrt{m\left(n-m\right)}$. The angle between the computed invariant subspace and the true subspace is $\frac{\mathit{O}\left(\epsilon \right){‖A‖}_{2}}{\mathit{sep}}$.
Note that if a $2$ by $2$ diagonal block is involved in the reordering, its off-diagonal elements are in general changed; the diagonal elements and the eigenvalues of the block are unchanged unless the block is sufficiently ill-conditioned, in which case they may be noticeably altered. It is possible for a $2$ by $2$ block to break into two $1$ by $1$ blocks, i.e., for a pair of complex eigenvalues to become purely real. The values of real eigenvalues however are never changed by the reordering.

The input matrix $T$ must be in canonical Schur form, as is the output matrix $\stackrel{~}{T}$. This has the following structure.
If all the computed eigenvalues are real, $\stackrel{~}{T}$ is upper triangular, and the diagonal elements of $\stackrel{~}{T}$ are the eigenvalues; ${\mathbf{wr}}\left(\mathit{i}\right)={\stackrel{~}{t}}_{\mathit{i}\mathit{i}}$, for $\mathit{i}=1,2,\dots ,n$ and ${\mathbf{wi}}\left(i\right)=0.0$.
If some of the computed eigenvalues form complex conjugate pairs, then $\stackrel{~}{T}$ has $2$ by $2$ diagonal blocks. Each diagonal block has the form
 $t~ii t~i,i+1 t~i+1,i t~i+1,i+1 = α β γ α$
where $\beta \gamma <0$. The corresponding eigenvalues are $\alpha ±\sqrt{\beta \gamma }$; ${\mathbf{wr}}\left(i\right)={\mathbf{wr}}\left(i+1\right)=\alpha$; ${\mathbf{wi}}\left(i\right)=+\sqrt{\left|\beta \gamma \right|}$; ${\mathbf{wi}}\left(i+1\right)=-{\mathbf{wi}}\left(i\right)$.
The complex analogue of this function is nag_lapack_ztrsen (f08qu).

Example

This example reorders the Schur factorization of the matrix $A=QT{Q}^{\mathrm{T}}$ such that the two real eigenvalues appear as the leading elements on the diagonal of the reordered matrix $\stackrel{~}{T}$, where
 $T = 0.7995 -0.1144 0.0060 0.0336 0.0000 -0.0994 0.2478 0.3474 0.0000 -0.6483 -0.0994 0.2026 0.0000 0.0000 0.0000 -0.1007$
and
 $Q = 0.6551 0.1037 0.3450 0.6641 0.5236 -0.5807 -0.6141 -0.1068 -0.5362 -0.3073 -0.2935 0.7293 0.0956 0.7467 -0.6463 0.1249 .$
The example program for nag_lapack_dtrsen (f08qg) illustrates the computation of error bounds for the eigenvalues.
The original matrix $A$ is given in Example in nag_lapack_dorghr (f08nf).
```function f08qg_example

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

% Matrices Q and T from reduction of a matrix A to Schur form
t = [0.7995, -0.1144,  0.0060,  0.0336;
0,      -0.0994,  0.2478,  0.3474;
0,      -0.6483, -0.0994,  0.2026;
0,       0,       0,      -0.1007];
q = [0.6551,  0.1037,  0.3450,  0.6641;
0.5236, -0.5807, -0.6141, -0.1068;
-0.5362, -0.3073, -0.2935,  0.7293;
0.0956,  0.7467, -0.6463,  0.1249];

% Recombine to form A
a = q*t*transpose(q);
disp('Original matrix A from Schur factors')
disp(a);

% First and last eigenvalues and correponding invariant subspace
job    = 'Both';
compq  = 'Vectors';
select = [true;     false;     false;     true];
[t, q, wr, wi, m, s, sep, info] = f08qg( ...
job, compq, select, t, q);

fprintf('%s = %10.2e\n\n', ...
'Condition number estimate of the selected eigenvalues', 1/s);
fprintf('%s = %10.2e\n', ...
'Condition number estimate of the invariant subspace  ', 1/sep);

```
```f08qg example results

Original matrix A from Schur factors
0.3500    0.4500   -0.1400   -0.1700
0.0900    0.0700   -0.5399    0.3500
-0.4400   -0.3300   -0.0300    0.1700
0.2500   -0.3200   -0.1300    0.1100

Condition number estimate of the selected eigenvalues =   1.75e+00

Condition number estimate of the invariant subspace   =   3.22e+00
```

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–2015