F08 Chapter Contents
F08 Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentF08QTF (ZTREXC)

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

## 1  Purpose

F08QTF (ZTREXC) reorders the Schur factorization of a complex general matrix.

## 2  Specification

 SUBROUTINE F08QTF ( COMPQ, N, T, LDT, Q, LDQ, IFST, ILST, INFO)
 INTEGER N, LDT, LDQ, IFST, ILST, INFO COMPLEX (KIND=nag_wp) T(LDT,*), Q(LDQ,*) CHARACTER(1) COMPQ
The routine may be called by its LAPACK name ztrexc.

## 3  Description

F08QTF (ZTREXC) reorders the Schur factorization of a complex general matrix $A=QT{Q}^{\mathrm{H}}$, so that the diagonal element of $T$ with row index IFST is moved to row ILST.
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}}$.

## 4  References

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

## 5  Arguments

1:     $\mathrm{COMPQ}$ – CHARACTER(1)Input
On entry: 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'}$.
2:     $\mathrm{N}$ – INTEGERInput
On entry: $n$, the order of the matrix $T$.
Constraint: ${\mathbf{N}}\ge 0$.
3:     $\mathrm{T}\left({\mathbf{LDT}},*\right)$ – COMPLEX (KIND=nag_wp) arrayInput/Output
Note: the second dimension of the array T must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{N}}\right)$.
On entry: the $n$ by $n$ upper triangular matrix $T$, as returned by F08PSF (ZHSEQR).
On exit: T is overwritten by the updated matrix $\stackrel{~}{T}$.
4:     $\mathrm{LDT}$ – INTEGERInput
On entry: the first dimension of the array T as declared in the (sub)program from which F08QTF (ZTREXC) is called.
Constraint: ${\mathbf{LDT}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{N}}\right)$.
5:     $\mathrm{Q}\left({\mathbf{LDQ}},*\right)$ – COMPLEX (KIND=nag_wp) arrayInput/Output
Note: 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'}$.
On entry: if ${\mathbf{COMPQ}}=\text{'V'}$, Q must contain the $n$ by $n$ unitary matrix $Q$ of Schur vectors.
On exit: if ${\mathbf{COMPQ}}=\text{'V'}$, Q contains the updated matrix of Schur vectors.
If ${\mathbf{COMPQ}}=\text{'N'}$, Q is not referenced.
6:     $\mathrm{LDQ}$ – INTEGERInput
On entry: the first dimension of the array Q as declared in the (sub)program from which F08QTF (ZTREXC) is called.
Constraints:
• if ${\mathbf{COMPQ}}=\text{'V'}$, ${\mathbf{LDQ}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{N}}\right)$;
• if ${\mathbf{COMPQ}}=\text{'N'}$, ${\mathbf{LDQ}}\ge 1$.
7:     $\mathrm{IFST}$ – INTEGERInput
8:     $\mathrm{ILST}$ – INTEGERInput
On entry: IFST and ILST must specify the reordering of the diagonal elements of $T$. The element with row index IFST is moved to row ILST by a sequence of exchanges between adjacent elements.
Constraint: $1\le {\mathbf{IFST}}\le {\mathbf{N}}$ and $1\le {\mathbf{ILST}}\le {\mathbf{N}}$.
9:     $\mathrm{INFO}$ – INTEGEROutput
On exit: ${\mathbf{INFO}}=0$ unless the routine detects an error (see Section 6).

## 6  Error Indicators and Warnings

${\mathbf{INFO}}<0$
If ${\mathbf{INFO}}=-i$, argument $i$ had an illegal value. An explanatory message is output, and execution of the program is terminated.

## 7  Accuracy

The computed matrix $\stackrel{~}{T}$ is exactly similar to a matrix $\left(T+E\right)$, where
 $E2 = Oε T2 ,$
and $\epsilon$ is the machine precision.
The values of the eigenvalues are never changed by the reordering.

## 8  Parallelism and Performance

F08QTF (ZTREXC) 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 routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

The total number of real floating-point operations is approximately $20nr$ if ${\mathbf{COMPQ}}=\text{'N'}$, and $40nr$ if ${\mathbf{COMPQ}}=\text{'V'}$, where $r=\left|{\mathbf{IFST}}-{\mathbf{ILST}}\right|$.
The real analogue of this routine is F08QFF (DTREXC).

## 10  Example

This example reorders the Schur factorization of the matrix $T$ so that element ${t}_{11}$ is moved to ${t}_{44}$, where
 $T = -6.00-7.00i 0.36-0.36i -0.19+0.48i 0.88-0.25i 0.00+0.00i -5.00+2.00i -0.03-0.72i -0.23+0.13i 0.00+0.00i 0.00+0.00i 8.00-1.00i 0.94+0.53i 0.00+0.00i 0.00+0.00i 0.00+0.00i 3.00-4.00i .$

### 10.1  Program Text

Program Text (f08qtfe.f90)

### 10.2  Program Data

Program Data (f08qtfe.d)

### 10.3  Program Results

Program Results (f08qtfe.r)