# NAG CL Interfacef08quc (ztrsen)

Settings help

CL Name Style:

## 1Purpose

f08quc reorders the Schur factorization of a complex general matrix so that a selected cluster of eigenvalues appears in the leading elements 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.

## 2Specification

 #include
 void f08quc (Nag_OrderType order, Nag_JobType job, Nag_ComputeQType compq, const Nag_Boolean select[], Integer n, Complex t[], Integer pdt, Complex q[], Integer pdq, Complex w[], Integer *m, double *s, double *sep, NagError *fail)
The function may be called by the names: f08quc, nag_lapackeig_ztrsen or nag_ztrsen.

## 3Description

f08quc reorders the Schur factorization of a complex general matrix $A=QT{Q}^{\mathrm{H}}$, so that a selected cluster of eigenvalues appears in the leading diagonal elements of the Schur form.
The reordered Schur form $\stackrel{~}{T}$ is computed by a unitary similarity transformation: $\stackrel{~}{T}={Z}^{\mathrm{H}}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{H}}$.
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×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.

## 4References

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{job}$Nag_JobType Input
On entry: indicates whether condition numbers are required for the cluster of eigenvalues and/or the invariant subspace.
${\mathbf{job}}=\mathrm{Nag_DoNothing}$
No condition numbers are required.
${\mathbf{job}}=\mathrm{Nag_EigVals}$
Only the condition number for the cluster of eigenvalues is computed.
${\mathbf{job}}=\mathrm{Nag_Subspace}$
Only the condition number for the invariant subspace is computed.
${\mathbf{job}}=\mathrm{Nag_DoBoth}$
Condition numbers for both the cluster of eigenvalues and the invariant subspace are computed.
Constraint: ${\mathbf{job}}=\mathrm{Nag_DoNothing}$, $\mathrm{Nag_EigVals}$, $\mathrm{Nag_Subspace}$ or $\mathrm{Nag_DoBoth}$.
3: $\mathbf{compq}$Nag_ComputeQType Input
On entry: indicates whether the matrix $Q$ of Schur vectors is to be updated.
${\mathbf{compq}}=\mathrm{Nag_UpdateSchur}$
The matrix $Q$ of Schur vectors is updated.
${\mathbf{compq}}=\mathrm{Nag_NotQ}$
No Schur vectors are updated.
Constraint: ${\mathbf{compq}}=\mathrm{Nag_UpdateSchur}$ or $\mathrm{Nag_NotQ}$.
4: $\mathbf{select}\left[\mathit{dim}\right]$const Nag_Boolean Input
Note: the dimension, dim, of the array select must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
On entry: specifies the eigenvalues in the selected cluster. To select a complex eigenvalue ${\lambda }_{j}$, ${\mathbf{select}}\left[j-1\right]$ must be set Nag_TRUE.
5: $\mathbf{n}$Integer Input
On entry: $n$, the order of the matrix $T$.
Constraint: ${\mathbf{n}}\ge 0$.
6: $\mathbf{t}\left[\mathit{dim}\right]$Complex Input/Output
Note: the dimension, dim, of the array t must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pdt}}×{\mathbf{n}}\right)$.
The $\left(i,j\right)$th element of the matrix $T$ is stored in
• ${\mathbf{t}}\left[\left(j-1\right)×{\mathbf{pdt}}+i-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• ${\mathbf{t}}\left[\left(i-1\right)×{\mathbf{pdt}}+j-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
On entry: the $n×n$ upper triangular matrix $T$, as returned by f08psc.
On exit: t is overwritten by the updated matrix $\stackrel{~}{T}$.
7: $\mathbf{pdt}$Integer Input
On entry: the stride separating row or column elements (depending on the value of order) in the array t.
Constraint: ${\mathbf{pdt}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
8: $\mathbf{q}\left[\mathit{dim}\right]$Complex Input/Output
Note: the dimension, dim, of the array q must be at least
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pdq}}×{\mathbf{n}}\right)$ when ${\mathbf{compq}}=\mathrm{Nag_UpdateSchur}$;
• $1$ when ${\mathbf{compq}}=\mathrm{Nag_NotQ}$.
The $\left(i,j\right)$th element of the matrix $Q$ is stored in
• ${\mathbf{q}}\left[\left(j-1\right)×{\mathbf{pdq}}+i-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• ${\mathbf{q}}\left[\left(i-1\right)×{\mathbf{pdq}}+j-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
On entry: if ${\mathbf{compq}}=\mathrm{Nag_UpdateSchur}$, q must contain the $n×n$ unitary matrix $Q$ of Schur vectors, as returned by f08psc.
On exit: if ${\mathbf{compq}}=\mathrm{Nag_UpdateSchur}$, 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}}=\mathrm{Nag_NotQ}$, q is not referenced.
9: $\mathbf{pdq}$Integer Input
On entry: the stride separating row or column elements (depending on the value of order) in the array q.
Constraints:
• if ${\mathbf{compq}}=\mathrm{Nag_UpdateSchur}$, ${\mathbf{pdq}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$;
• if ${\mathbf{compq}}=\mathrm{Nag_NotQ}$, ${\mathbf{pdq}}\ge 1$.
10: $\mathbf{w}\left[\mathit{dim}\right]$Complex Output
Note: the dimension, dim, of the array w must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
On exit: the reordered eigenvalues of $\stackrel{~}{T}$. The eigenvalues are stored in the same order as on the diagonal of $\stackrel{~}{T}$.
11: $\mathbf{m}$Integer * Output
On exit: $m$, the dimension of the specified invariant subspace, which is the same as the number of selected eigenvalues (see select); $0\le m\le n$.
12: $\mathbf{s}$double * Output
On exit: if ${\mathbf{job}}=\mathrm{Nag_EigVals}$ or $\mathrm{Nag_DoBoth}$, s is a lower bound on the reciprocal condition number of the average of the selected cluster of eigenvalues. If ${\mathbf{m}}=0$ or ${\mathbf{n}}$, ${\mathbf{s}}=1$.
If ${\mathbf{job}}=\mathrm{Nag_DoNothing}$ or $\mathrm{Nag_Subspace}$, s is not referenced.
13: $\mathbf{sep}$double * Output
On exit: if ${\mathbf{job}}=\mathrm{Nag_Subspace}$ or $\mathrm{Nag_DoBoth}$, sep is the estimated reciprocal condition number of the specified invariant subspace. If ${\mathbf{m}}=0$ or ${\mathbf{n}}$, ${\mathbf{sep}}=‖T‖$.
If ${\mathbf{job}}=\mathrm{Nag_DoNothing}$ or $\mathrm{Nag_EigVals}$, sep is not referenced.
14: $\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{compq}}=⟨\mathit{\text{value}}⟩$, ${\mathbf{pdq}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$.
Constraint: if ${\mathbf{compq}}=\mathrm{Nag_UpdateSchur}$, ${\mathbf{pdq}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$;
if ${\mathbf{compq}}=\mathrm{Nag_NotQ}$, ${\mathbf{pdq}}\ge 1$.
NE_INT
On entry, ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{n}}\ge 0$.
On entry, ${\mathbf{pdq}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{pdq}}>0$.
On entry, ${\mathbf{pdt}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{pdt}}>0$.
NE_INT_2
On entry, ${\mathbf{pdt}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{pdt}}\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_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.

## 7Accuracy

The computed matrix $\stackrel{~}{T}$ is similar to a matrix $\left(T+E\right)$, where
 $‖E‖2 = O(ε) ‖T‖2 ,$
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}}$.
The values of the eigenvalues are never changed by the reordering.

## 8Parallelism and Performance

f08quc 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 real analogue of this function is f08qgc.

## 10Example

This example reorders the Schur factorization of the matrix $A=QT{Q}^{\mathrm{H}}$ such that the eigenvalues stored in elements ${t}_{11}$ and ${t}_{44}$ appear as the leading elements on the diagonal of the reordered matrix $\stackrel{~}{T}$, where
 $T = ( -6.0004-6.9999i 0.3637-0.3656i -0.1880+0.4787i 0.8785-0.2539i 0.0000+0.0000i -5.0000+2.0060i -0.0307-0.7217i -0.2290+0.1313i 0.0000+0.0000i 0.0000+0.0000i 7.9982-0.9964i 0.9357+0.5359i 0.0000+0.0000i 0.0000+0.0000i 0.0000+0.0000i 3.0023-3.9998i )$
and
 $Q = ( -0.8347-0.1364i -0.0628+0.3806i 0.2765-0.0846i 0.0633-0.2199i 0.0664-0.2968i 0.2365+0.5240i -0.5877-0.4208i 0.0835+0.2183i -0.0362-0.3215i 0.3143-0.5473i 0.0576-0.5736i 0.0057-0.4058i 0.0086+0.2958i -0.3416-0.0757i -0.1900-0.1600i 0.8327-0.1868i ) .$
The original matrix $A$ is given in f08ntc.

### 10.1Program Text

Program Text (f08quce.c)

### 10.2Program Data

Program Data (f08quce.d)

### 10.3Program Results

Program Results (f08quce.r)