SRC/ztgex2.f(3)
π SRC/ztgex2.f β from the LAPACK Library Functions Manual, bestie
okay so this is a page out of the LAPACK manual β yes, that LAPACK, the linear algebra girlies' holy text β and today's main character is ztgex2, a Fortran subroutine that does one very specific little swap. she's not flashy, she's just precise. periodt.
β¨ SYNOPSIS β¨
Functions/Subroutines
subroutine ztgex2(wantq, wantz, n, a, lda, b, ldb, q, ldq, z, ldz, j1, info)β ZTGEX2 swaps adjacent diagonal blocks in an upper (quasi) triangular matrix pair by an unitary equivalence transformation. that's the whole vibe, no cap.
π¦ Function/Subroutine Documentation π¦
subroutine ztgex2 β the full glow-up
subroutine ztgex2 (logical wantq, logical wantz, integer n, complex*16,
dimension( lda, * ) a, integer lda, complex*16, dimension( ldb, * ) b,
integer ldb, complex*16, dimension( ldq, * ) q, integer ldq, complex*16,
dimension( ldz, * ) z, integer ldz, integer j1, integer info)
ZTGEX2 swaps adjacent diagonal blocks in an upper (quasi) triangular matrix pair by an unitary equivalence transformation. that's her job, she does it, she leaves. π
Purpose:
so here's the tea π β ZTGEX2 swaps adjacent diagonal 1 by 1 blocks (A11,B11) and (A22,B22) in an upper triangular matrix pair (A, B) by an unitary equivalence transformation.
(A, B) must be in generalized Schur canonical form, that is, A and B are both upper triangular. no exceptions, bestie, she is not flexible on this.
Optionally, the matrices Q and Z of generalized Schur vectors are updated.
and the identity she's out here preserving, literally the whole point:
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
like. she ate. π₯
πΈ Parameters πΈ
okay this is the part where we go through every single argument one by one, and yes we're doing all of them, because every one matters. sit down, hydrate, let's go π
WANTQβWANTQ is LOGICAL..TRUE.: update the left transformation matrixQ;.FALSE.: do not updateQ.WANTZβWANTZ is LOGICAL..TRUE.: update the right transformation matrixZ;.FALSE.: do not updateZ.NβN is INTEGER. The order of the matricesAandB.N >= 0. (zero is allowed, she's chill like that.)AβA is COMPLEX*16 array, dimensions (LDA,N). On entry, the matrixAin the pair(A, B). On exit, the updated matrixA. she comes in one way and leaves another, main character energy honestly.LDAβLDA is INTEGER. The leading dimension of the arrayA.LDA >= max(1,N).BβB is COMPLEX*16 array, dimensions (LDB,N). On entry, the matrixBin the pair(A, B). On exit, the updated matrixB. same deal as her sisterA.LDBβLDB is INTEGER. The leading dimension of the arrayB.LDB >= max(1,N).QβQ is COMPLEX*16 array, dimension (LDQ,N). IfWANTQ = .TRUE, on entry, the unitary matrixQ. On exit, the updated matrixQ. Not referenced ifWANTQ = .FALSE..(so if you said no, she literally will not even look at it π)LDQβLDQ is INTEGER. The leading dimension of the arrayQ.LDQ >= 1; IfWANTQ = .TRUE.,LDQ >= N.ZβZ is COMPLEX*16 array, dimension (LDZ,N). IfWANTZ = .TRUE, on entry, the unitary matrixZ. On exit, the updated matrixZ. Not referenced ifWANTZ = .FALSE..LDZβLDZ is INTEGER. The leading dimension of the arrayZ.LDZ >= 1; IfWANTZ = .TRUE.,LDZ >= N.J1βJ1 is INTEGER. The index to the first block(A11, B11). that's where the swap starts, iykyk.INFOβINFO is INTEGER.=0: Successful exit.=1: The transformed matrix pair(A, B)would be too far from generalized Schur form; the problem is ill-conditioned.
β οΈ bestie listen β INFO = 1 is not a cute look. it means the pair drifted too far from generalized Schur form and the problem is ill-conditioned. she's telling you politely that the vibes were off. π
π Author π
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
the whole consortium came together for this one. iconic collaborative behaviour honestly π«Ά
β Further Details: β
In the current code both weak and strong stability tests are performed. The user can omit the strong stability test by changing the internal logical parameter WANDS to .FALSE.. See ref. [2] for details.
π note that WANDS is internal, so this is a "you'd have to edit the source" situation, not a "pass a flag" situation. adjusting internal parameters is a whole commitment, ngl.
π§ Contributors: π§
Bo Kagstrom and Peter Poromaa, Department of Computing Science, Umea University, S-901 87 Umea, Sweden. the original architects. we stan. π
π References: π
- B. Kagstrom; A Direct Method for Reordering Eigenvalues in the Generalized Real Schur Form of a Regular Matrix Pair (A, B), in M.S. Moonen et al (eds), Linear Algebra for Large Scale and Real-Time Applications, Kluwer Academic Publ. 1993, pp 195-218.
- B. Kagstrom and P. Poromaa; Computing Eigenspaces with Specified Eigenvalues of a Regular Matrix Pair (A, B) and Condition Estimation: Theory, Algorithms and Software, Report UMINF-94.04, Department of Computing Science, Umea University, S-901 87 Umea, Sweden, 1994. Also as LAPACK Working Note 87. To appear in Numerical Algorithms, 1996.
like, they really cited themselves twice and honestly? respect. the lore is deep. πβ¨
Definition at line 188 of file ztgex2.f.
and that's the page, bestie π¦ sign-off time: this whole thing was generated automatically by Doxygen for LAPACK from the source code β LAPACK, Version 3.12.0, page SRC/ztgex2.f(3). not me writing it by hand, the robots did that part. slay π
π
π¦ where this page comes from
- arch rolling: lapack-doc 3.12.1-2 Β· custom
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms