# ?trexc

Reorders the Schur factorization of a general matrix.

## Syntax

FORTRAN 77:

call strexc(compq, n, t, ldt, q, ldq, ifst, ilst, work, info)

call dtrexc(compq, n, t, ldt, q, ldq, ifst, ilst, work, info)

call ctrexc(compq, n, t, ldt, q, ldq, ifst, ilst, info)

call ztrexc(compq, n, t, ldt, q, ldq, ifst, ilst, info)

Fortran 95:

call trexc(t, ifst, ilst [,q] [,info])

## Description

This routine reorders the Schur factorization of a general matrix `A = Q*T*QH`, so that the diagonal element or block of T with row index ifst is moved to row ilst.

The reordered Schur form S is computed by an unitary (or, for real flavors, orthogonal) similarity transformation: `S = ZH*T*Z`. Optionally the updated matrix P of Schur vectors is computed as `P = Q*Z`, giving `A = P*S*PH`.

## Input Parameters

compq

  CHARACTER*1. Must be 'V' or 'N'.

  If `compq = 'V'`, then the Schur vectors (Q) are updated.

  If `compq = 'N'`, then no Schur vectors are updated.

n

  INTEGER. The order of the matrix T (`n ≥ 0`).

t, q

  REAL for strexc

  DOUBLE PRECISION for dtrexc

  COMPLEX for ctrexc

  DOUBLE COMPLEX for ztrexc.

  Arrays:

  t(ldt,*) contains the n-by-n matrix T.

  The second dimension of t must be at least max(1, n).

  q(ldq,*)

  If `compq = 'V'`, then q must contain Q (Schur vectors).

  If `compq = 'N'`, then q is not referenced.

  The second dimension of q must be at least max(1, n)

  if `compq = 'V'` and at least 1 if `compq = 'N'`.

ldt

  INTEGER. The first dimension of t; at least max(1, n).

ldq

  INTEGER. The first dimension of q;

  If `compq = 'N'`, then `ldq≥ 1`.

  If `compq = 'V'`, then `ldq≥ max(1, n)`.

ifst, ilst

  INTEGER. `1 ≤ ifst ≤ n; 1 ≤ ilst ≤ n`.

  Must specify the reordering of the diagonal elements (or blocks, which is possible for real flavors) of the matrix T. The element (or block) with row index ifst is moved to row ilst by a sequence of exchanges between adjacent elements (or blocks).

work

  REAL for strexc

  DOUBLE PRECISION for dtrexc.

  Array, DIMENSION at least max (1, n).

## Output Parameters

t

  Overwritten by the updated matrix S.

q

  If `compq = 'V'`, q contains the updated matrix of Schur vectors.

ifst, ilst

  Overwritten for real flavors only.

  If ifst pointed to the second row of a 2 by 2 block on entry, it is changed to point to the first row; ilst always points to the first row of the block in its final position (which may differ from its input value by ±1).

info

  INTEGER.

  If `info = 0`, the execution is successful.

  If `info = -i`, the i-th parameter had an illegal value.

## Fortran 95 Interface Notes

Routines in Fortran 95 interface have fewer arguments in the calling sequence than their FORTRAN 77 counterparts. For general conventions applied to skip redundant or restorable arguments, see Fortran 95 Interface Conventions.

Specific details for the routine trexc interface are the following:

t

  Holds the matrix T of size (n,n).

q

  Holds the matrix Q of size (n,n).

compq

  Restored based on the presence of the argument q as follows:

  `compq = 'V'`, if q is present,

  `compq = 'N'`, if q is omitted.

## Application Notes

The computed matrix S is exactly similar to a matrix `T+E`, where `||E||2 = O(ε)*||T||2`, and ε is the machine precision.

Note that if a 2 by 2 diagonal block is involved in the re-ordering, 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, that is, for a pair of complex eigenvalues to become purely real.

The values of eigenvalues however are never changed by the re-ordering.

The approximate number of floating-point operations is

for real flavors:

  `6n(ifst-ilst)` if `compq = 'N'`;

  `12n(ifst-ilst)` if `compq = 'V'`;

for complex flavors:

  `20n(ifst-ilst)` if `compq = 'N'`;

  `40n(ifst-ilst)` if `compq = 'V'`.

Parent topic: Nonsymmetric Eigenvalue Problems