tgex2#

Functions

void stgex2(
    const INT           wantq,
    const INT           wantz,
    const INT           n,
          f32* restrict A,
    const INT           lda,
          f32* restrict B,
    const INT           ldb,
          f32* restrict Q,
    const INT           ldq,
          f32* restrict Z,
    const INT           ldz,
    const INT           j1,
    const INT           n1,
    const INT           n2,
          f32* restrict work,
    const INT           lwork,
          INT*          info
);
void stgex2(const INT wantq, const INT wantz, const INT n, f32 *restrict A, const INT lda, f32 *restrict B, const INT ldb, f32 *restrict Q, const INT ldq, f32 *restrict Z, const INT ldz, const INT j1, const INT n1, const INT n2, f32 *restrict work, const INT lwork, INT *info)#

STGEX2 swaps adjacent diagonal blocks (A11, B11) and (A22, B22) of size 1-by-1 or 2-by-2 in an upper (quasi) triangular matrix pair (A, B) by an orthogonal equivalence transformation.

Parameters

in
wantq

If nonzero, update the left transformation matrix Q.

in
wantz

If nonzero, update the right transformation matrix Z.

in
n

The order of the matrices A and B. n >= 0.

inout
A

Array of dimension (lda, n). On entry, the matrix A. On exit, the updated matrix A.

in
lda

The leading dimension of A. lda >= max(1, n).

inout
B

Array of dimension (ldb, n). On entry, the matrix B. On exit, the updated matrix B.

in
ldb

The leading dimension of B. ldb >= max(1, n).

inout
Q

Array of dimension (ldq, n). If wantq, the orthogonal matrix Q. On exit, the updated matrix Q. Not referenced if !wantq.

in
ldq

The leading dimension of Q. ldq >= 1; if wantq, ldq >= n.

inout
Z

Array of dimension (ldz, n). If wantz, the orthogonal matrix Z. On exit, the updated matrix Z. Not referenced if !wantz.

in
ldz

The leading dimension of Z. ldz >= 1; if wantz, ldz >= n.

in
j1

The index to the first block (A11, B11). 0 <= j1 < n (0-based).

in
n1

The order of the first block. n1 = 0, 1, or 2.

in
n2

The order of the second block. n2 = 0, 1, or 2.

out
work

Array of dimension (lwork).

in
lwork

The dimension of work. lwork >= max(1, n*(n2+n1), (n2+n1)^2 * 2).

out
info

  • = 0: successful exit

  • = 1: the swap was rejected; blocks not swapped

  • = -16: lwork too small

Functions

void dtgex2(
    const INT           wantq,
    const INT           wantz,
    const INT           n,
          f64* restrict A,
    const INT           lda,
          f64* restrict B,
    const INT           ldb,
          f64* restrict Q,
    const INT           ldq,
          f64* restrict Z,
    const INT           ldz,
    const INT           j1,
    const INT           n1,
    const INT           n2,
          f64* restrict work,
    const INT           lwork,
          INT*          info
);
void dtgex2(const INT wantq, const INT wantz, const INT n, f64 *restrict A, const INT lda, f64 *restrict B, const INT ldb, f64 *restrict Q, const INT ldq, f64 *restrict Z, const INT ldz, const INT j1, const INT n1, const INT n2, f64 *restrict work, const INT lwork, INT *info)#

DTGEX2 swaps adjacent diagonal blocks (A11, B11) and (A22, B22) of size 1-by-1 or 2-by-2 in an upper (quasi) triangular matrix pair (A, B) by an orthogonal equivalence transformation.

Parameters

in
wantq

If nonzero, update the left transformation matrix Q.

in
wantz

If nonzero, update the right transformation matrix Z.

in
n

The order of the matrices A and B. n >= 0.

inout
A

Array of dimension (lda, n). On entry, the matrix A. On exit, the updated matrix A.

in
lda

The leading dimension of A. lda >= max(1, n).

inout
B

Array of dimension (ldb, n). On entry, the matrix B. On exit, the updated matrix B.

in
ldb

The leading dimension of B. ldb >= max(1, n).

inout
Q

Array of dimension (ldq, n). If wantq, the orthogonal matrix Q. On exit, the updated matrix Q. Not referenced if !wantq.

in
ldq

The leading dimension of Q. ldq >= 1; if wantq, ldq >= n.

inout
Z

Array of dimension (ldz, n). If wantz, the orthogonal matrix Z. On exit, the updated matrix Z. Not referenced if !wantz.

in
ldz

The leading dimension of Z. ldz >= 1; if wantz, ldz >= n.

in
j1

The index to the first block (A11, B11). 0 <= j1 < n (0-based).

in
n1

The order of the first block. n1 = 0, 1, or 2.

in
n2

The order of the second block. n2 = 0, 1, or 2.

out
work

Array of dimension (lwork).

in
lwork

The dimension of work. lwork >= max(1, n*(n2+n1), (n2+n1)^2 * 2).

out
info

  • = 0: successful exit

  • = 1: the swap was rejected; blocks not swapped

  • = -16: lwork too small

Functions

void ctgex2(
    const INT           wantq,
    const INT           wantz,
    const INT           n,
          c64* restrict A,
    const INT           lda,
          c64* restrict B,
    const INT           ldb,
          c64* restrict Q,
    const INT           ldq,
          c64* restrict Z,
    const INT           ldz,
    const INT           j1,
          INT*          info
);
void ctgex2(const INT wantq, const INT wantz, const INT n, c64 *restrict A, const INT lda, c64 *restrict B, const INT ldb, c64 *restrict Q, const INT ldq, c64 *restrict Z, const INT ldz, const INT j1, INT *info)#

CTGEX2 swaps adjacent diagonal 1 by 1 blocks (A11,B11) and (A22,B22) in an upper triangular matrix pair (A, B) by a unitary equivalence transformation.

(A, B) must be in generalized Schur canonical form, that is, A and B are both upper triangular.

Optionally, the matrices Q and Z of generalized Schur vectors are updated.

   Q(in) * A(in) * Z(in)**H = Q(out) * A(out) * Z(out)**H
   Q(in) * B(in) * Z(in)**H = Q(out) * B(out) * Z(out)**H

Parameters

in
wantq

If nonzero, update the left transformation matrix Q.

in
wantz

If nonzero, update the right transformation matrix Z.

in
n

The order of the matrices A and B. n >= 0.

inout
A

Complex array of dimension (lda, n). On entry, the matrix A. On exit, the updated matrix A.

in
lda

The leading dimension of A. lda >= max(1, n).

inout
B

Complex array of dimension (ldb, n). On entry, the matrix B. On exit, the updated matrix B.

in
ldb

The leading dimension of B. ldb >= max(1, n).

inout
Q

Complex array of dimension (ldq, n). If wantq, the unitary matrix Q. On exit, the updated matrix Q. Not referenced if !wantq.

in
ldq

The leading dimension of Q. ldq >= 1; if wantq, ldq >= n.

inout
Z

Complex array of dimension (ldz, n). If wantz, the unitary matrix Z. On exit, the updated matrix Z. Not referenced if !wantz.

in
ldz

The leading dimension of Z. ldz >= 1; if wantz, ldz >= n.

in
j1

The index to the first block (A11, B11). 0-based.

out
info

  • = 0: successful exit

  • = 1: the transformed matrix pair (A, B) would be too far from generalized Schur form; the problem is ill-conditioned.

Functions

void ztgex2(
    const INT            wantq,
    const INT            wantz,
    const INT            n,
          c128* restrict A,
    const INT            lda,
          c128* restrict B,
    const INT            ldb,
          c128* restrict Q,
    const INT            ldq,
          c128* restrict Z,
    const INT            ldz,
    const INT            j1,
          INT*           info
);
void ztgex2(const INT wantq, const INT wantz, const INT n, c128 *restrict A, const INT lda, c128 *restrict B, const INT ldb, c128 *restrict Q, const INT ldq, c128 *restrict Z, const INT ldz, const INT j1, INT *info)#

ZTGEX2 swaps adjacent diagonal 1 by 1 blocks (A11,B11) and (A22,B22) in an upper triangular matrix pair (A, B) by a unitary equivalence transformation.

(A, B) must be in generalized Schur canonical form, that is, A and B are both upper triangular.

Optionally, the matrices Q and Z of generalized Schur vectors are updated.

   Q(in) * A(in) * Z(in)**H = Q(out) * A(out) * Z(out)**H
   Q(in) * B(in) * Z(in)**H = Q(out) * B(out) * Z(out)**H

Parameters

in
wantq

If nonzero, update the left transformation matrix Q.

in
wantz

If nonzero, update the right transformation matrix Z.

in
n

The order of the matrices A and B. n >= 0.

inout
A

Complex array of dimension (lda, n). On entry, the matrix A. On exit, the updated matrix A.

in
lda

The leading dimension of A. lda >= max(1, n).

inout
B

Complex array of dimension (ldb, n). On entry, the matrix B. On exit, the updated matrix B.

in
ldb

The leading dimension of B. ldb >= max(1, n).

inout
Q

Complex array of dimension (ldq, n). If wantq, the unitary matrix Q. On exit, the updated matrix Q. Not referenced if !wantq.

in
ldq

The leading dimension of Q. ldq >= 1; if wantq, ldq >= n.

inout
Z

Complex array of dimension (ldz, n). If wantz, the unitary matrix Z. On exit, the updated matrix Z. Not referenced if !wantz.

in
ldz

The leading dimension of Z. ldz >= 1; if wantz, ldz >= n.

in
j1

The index to the first block (A11, B11). 0-based.

out
info

  • = 0: successful exit

  • = 1: the transformed matrix pair (A, B) would be too far from generalized Schur form; the problem is ill-conditioned.