dbltgsylv(3)

๐Ÿ“ฆ
version 1.1.2 ยท 3 versions
, in fedora 43

๐Ÿ’– dbltgsylv ๐Ÿ’– โ€” double precision, triangular generalized Sylvester era โœจ

okay so bestie, you just opened dbltgsylv(3) from the MEPACK girlies and I am so glad you're here ๐Ÿซถ this page is the entire double precision lineup โ€” every solver, kernel, and recursion situation for triangular generalized Sylvester equations. it's a lot. it's giving โœจalgorithm catalogโœจ. we're gonna get through it together, no cap.


โœจ NAME โœจ

dbltgsylv โ€” Double Precision ๐Ÿ’– โ€” the Double Precision routines for triangular generalized Sylvester equations. that's the whole vibe, periodt.


โœจ SYNOPSIS โœจ

๐ŸŒธ Functions ๐ŸŒธ

okay so every single one of these is a subroutine, bestie โ€” except the last three, which are recursive subroutines and yes that distinction matters ๐Ÿ’… go off.

  • subroutine dla_tgcsylv_dag (transa, transb, sgn1, sgn2, m, n, a, lda, b, ldb, c, ldc, d, ldd, e, lde, f, ldf, scale, work, info) โ€” the Level-3 Kagstroem-Westin/Bartels-Stewart Algorithm for the generalized coupled Sylvester equation, and it does the whole thing with DAG scheduling ๐Ÿ”ฅ she's organized, she's parallel, she ate.
  • subroutine dla_tgcsylv_dual_dag (transa, transb, sgn1, sgn2, m, n, a, lda, b, ldb, c, ldc, d, ldd, e, lde, f, ldf, scale, work, info) โ€” the OpenMP4 - DAG Algorithm for the dual generalized coupled Sylvester equation โœจ threads said let's go.
  • subroutine dla_tgsylv_dag (transa, transb, sgn, m, n, a, lda, b, ldb, c, ldc, d, ldd, x, ldx, scale, work, info) โ€” Level-3 Bartels-Stewart Algorithm for the generalized Sylvester equation, with DAG based parallelization. iconic behaviour honestly.
  • subroutine dla_tgcsylv_dual_kernel_44nn (sgn1, sgn2, m, n, a, lda, b, ldb, c, ldc, d, ldd, e, lde, f, ldf, scale, info) โ€” solver for a 4x4 dual generalized coupled Sylvester equation when TRANSA = N, TRANSB = N ๐Ÿ’…
  • subroutine dla_tgcsylv_dual_kernel_44nt (sgn1, sgn2, m, n, a, lda, b, ldb, c, ldc, d, ldd, e, lde, f, ldf, scale, info) โ€” same 4x4 dual generalized coupled Sylvester equation solver energy, but TRANSA = N, TRANSB = T ๐Ÿฆ‹
  • subroutine dla_tgcsylv_dual_kernel_44tn (sgn1, sgn2, m, n, a, lda, b, ldb, c, ldc, d, ldd, e, lde, f, ldf, scale, info) โ€” 4x4 dual generalized coupled Sylvester equation solver, TRANSA = T, TRANSB = N ๐ŸŒธ
  • subroutine dla_tgcsylv_dual_kernel_44tt (sgn1, sgn2, m, n, a, lda, b, ldb, c, ldc, d, ldd, e, lde, f, ldf, scale, info) โ€” and the last of the quartet: 4x4 dual generalized coupled Sylvester equation, TRANSA = T, TRANSB = T โญ
  • subroutine dla_tgcsylv_dual_l2 (transa, transb, sgn1, sgn2, m, n, a, lda, b, ldb, c, ldc, d, ldd, e, lde, f, ldf, scale, work, info) โ€” Level-2 Kagstroem-Westin/Bartels-Stewart Algorithm for the dual generalized coupled Sylvester equation. level 2 but make it dual โœจ
  • subroutine dla_tgcsylv_dual_l2_local_copy (transa, transb, sgn1, sgn2, m, n, a, lda, b, ldb, c, ldc, d, ldd, e, lde, f, ldf, scale, work, info) โ€” Level-2 Kagstroem-Westin/Bartels-Stewart Algorithm for the dual generalized coupled Sylvester equation, this one tagged (Local Copy) ๐Ÿ’–
  • subroutine dla_tgcsylv_dual_l2_local_copy_128 (transa, transb, sgn1, sgn2, m, n, a, lda, b, ldb, c, ldc, d, ldd, e, lde, f, ldf, scale, work, info) โ€” Level-2 Kagstroem-Westin/Bartels-Stewart for the dual generalized coupled Sylvester equation (Local Copy), the _128 flavour ๐ŸŽ€
  • subroutine dla_tgcsylv_dual_l2_local_copy_32 (transa, transb, sgn1, sgn2, m, n, a, lda, b, ldb, c, ldc, d, ldd, e, lde, f, ldf, scale, work, info) โ€” Level-2 Kagstroem-Westin/Bartels-Stewart for the dual generalized coupled Sylvester equation (Local Copy), _32 edition ๐Ÿ“
  • subroutine dla_tgcsylv_dual_l2_local_copy_64 (transa, transb, sgn1, sgn2, m, n, a, lda, b, ldb, c, ldc, d, ldd, e, lde, f, ldf, scale, work, info) โ€” Level-2 Kagstroem-Westin/Bartels-Stewart for the dual generalized coupled Sylvester equation (Local Copy), _64 girlie ๐Ÿ’œ
  • subroutine dla_tgcsylv_dual_l2_local_copy_96 (transa, transb, sgn1, sgn2, m, n, a, lda, b, ldb, c, ldc, d, ldd, e, lde, f, ldf, scale, work, info) โ€” Level-2 Kagstroem-Westin/Bartels-Stewart for the dual generalized coupled Sylvester equation (Local Copy), _96 and that's the whole local-copy set ๐Ÿ”ฅ
  • subroutine dla_tgcsylv_l2 (transa, transb, sgn1, sgn2, m, n, a, lda, b, ldb, c, ldc, d, ldd, e, lde, f, ldf, scale, work, info) โ€” Level-2 Kagstroem-Westin/Bartels-Stewart Algorithm for the generalized coupled Sylvester equation, and it's marked (Optimized) ๐Ÿ’…
  • subroutine dla_tgcsylv_l2_local_copy (transa, transb, sgn1, sgn2, m, n, a, lda, b, ldb, c, ldc, d, ldd, e, lde, f, ldf, scale, work, info) โ€” Level-2 Kagstroem-Westin/Bartels-Stewart for the generalized coupled Sylvester equation (Optimized) โœจ
  • subroutine dla_tgcsylv_l2_local_copy_128 (transa, transb, sgn1, sgn2, m, n, a, lda, b, ldb, c, ldc, d, ldd, e, lde, f, ldf, scale, work, info) โ€” Level-2 Kagstroem-Westin/Bartels-Stewart for the generalized coupled Sylvester equation (Optimized), _128 variant ๐Ÿฆ‹
  • subroutine dla_tgcsylv_l2_local_copy_32 (transa, transb, sgn1, sgn2, m, n, a, lda, b, ldb, c, ldc, d, ldd, e, lde, f, ldf, scale, work, info) โ€” Level-2 Kagstroem-Westin/Bartels-Stewart for the generalized coupled Sylvester equation (Optimized), _32 variant ๐ŸŒธ
  • subroutine dla_tgcsylv_l2_local_copy_64 (transa, transb, sgn1, sgn2, m, n, a, lda, b, ldb, c, ldc, d, ldd, e, lde, f, ldf, scale, work, info) โ€” Level-2 Kagstroem-Westin/Bartels-Stewart for the generalized coupled Sylvester equation (Optimized), _64 variant โญ
  • subroutine dla_tgcsylv_l2_local_copy_96 (transa, transb, sgn1, sgn2, m, n, a, lda, b, ldb, c, ldc, d, ldd, e, lde, f, ldf, scale, work, info) โ€” Level-2 Kagstroem-Westin/Bartels-Stewart for the generalized coupled Sylvester equation (Optimized), _96 variant ๐Ÿ’œ
  • subroutine dla_tgcsylv_l2_reorder (transa, transb, sgn1, sgn2, m, n, a, lda, b, ldb, c, ldc, d, ldd, e, lde, f, ldf, scale, work, info) โ€” Level-2 Kagstroem-Westin/Bartels-Stewart for the generalized coupled Sylvester equation (Optimized), and this one reorders, hence the name, iykyk ๐Ÿ’…
  • subroutine dla_tgcsylv_l2_unopt (transa, transb, sgn1, sgn2, m, n, a, lda, b, ldb, c, ldc, d, ldd, e, lde, f, ldf, scale, work, info) โ€” Level-2 Kagstroem-Westin/Bartels-Stewart for the generalized coupled Sylvester equation, (unoptimized) โ€” yes bestie, the unoptimized one exists too and we respect her ๐Ÿซถ
  • subroutine dla_tgsylv_gardiner_laub (transa, transb, sgn, m, n, a, lda, b, ldb, c, ldc, d, ldd, x, ldx, scale, work, info) โ€” the Level-2 Gardiner-Laub algorithm for the generalized Sylvester equation ๐ŸŒˆ a whole different algorithm family, we love range.
  • subroutine dla_tgsylv_l2 (transa, transb, sgn, m, n, a, lda, b, ldb, c, ldc, d, ldd, x, ldx, scale, work, info) โ€” Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation, (Optimized) โœจ
  • subroutine dla_tgsylv_l2_colwise (transa, transb, sgn, m, n, a, lda, b, ldb, c, ldc, d, ldd, x, ldx, scale, work, info) โ€” Level-2 Bartels-Stewart for the generalized Sylvester equation, (unoptimized), going column-wise ๐Ÿ’…
  • subroutine dla_tgsylv_l2_local_copy (transa, transb, sgn, m, n, a, lda, b, ldb, c, ldc, d, ldd, x, ldx, scale, work, info) โ€” Level-2 Bartels-Stewart for the generalized Sylvester equation, (Optimized) ๐Ÿ’–
  • subroutine dla_tgsylv_l2_local_copy_128 (transa, transb, sgn, m, n, a, lda, b, ldb, c, ldc, d, ldd, x, ldx, scale, work, info) โ€” Level-2 Bartels-Stewart for the generalized Sylvester equation, (Optimized), _128 ๐ŸŽ€
  • subroutine dla_tgsylv_l2_local_copy_32 (transa, transb, sgn, m, n, a, lda, b, ldb, c, ldc, d, ldd, x, ldx, scale, work, info) โ€” Level-2 Bartels-Stewart for the generalized Sylvester equation, (Optimized), _32 ๐Ÿ“
  • subroutine dla_tgsylv_l2_local_copy_64 (transa, transb, sgn, m, n, a, lda, b, ldb, c, ldc, d, ldd, x, ldx, scale, work, info) โ€” Level-2 Bartels-Stewart for the generalized Sylvester equation, (Optimized), _64 ๐Ÿ’œ
  • subroutine dla_tgsylv_l2_local_copy_96 (transa, transb, sgn, m, n, a, lda, b, ldb, c, ldc, d, ldd, x, ldx, scale, work, info) โ€” Level-2 Bartels-Stewart for the generalized Sylvester equation, (Optimized), _96 ๐Ÿ”ฅ
  • subroutine dla_tgsylv_l2_reorder (transa, transb, sgn, m, n, a, lda, b, ldb, c, ldc, d, ldd, x, ldx, scale, work, info) โ€” Level-2 Bartels-Stewart for the generalized Sylvester equation, (Optimized), reordering edition โœจ
  • subroutine dla_tgsylv_l2_rowwise (transa, transb, sgn, m, n, a, lda, b, ldb, c, ldc, d, ldd, x, ldx, scale, work, info) โ€” Level-2 Bartels-Stewart for the generalized Sylvester equation, (unoptimized), row-wise this time ๐Ÿฆ‹
  • subroutine dla_tgcsylv_dual_l3 (transa, transb, sgn1, sgn2, m, n, a, lda, b, ldb, c, ldc, d, ldd, e, lde, f, ldf, scale, work, info) โ€” Level-3 Kagstroem-Westin/Bartels-Stewart Algorithm for the dual generalized coupled Sylvester equation ๐Ÿ’… level 3, dual, she's back and she's bigger.
  • subroutine dla_tgcsylv_dual_l3_2s (transa, transb, sgn1, sgn2, m, n, a, lda, b, ldb, c, ldc, d, ldd, e, lde, f, ldf, scale, work, info) โ€” Level-3 Kagstroem-Westin/Bartels-Stewart Algorithm with sub blocking for the dual generalized coupled Sylvester equation ๐ŸŒธ the 2s means sub blocking, and it's giving structure.
  • subroutine dla_tgcsylv_l3_2s (transa, transb, sgn1, sgn2, m, n, a, lda, b, ldb, c, ldc, d, ldd, e, lde, f, ldf, scale, work, info) โ€” Level-3 Kagstroem-Westin/Bartels-Stewart Algorithm for the generalized coupled Sylvester equation, (optimized), sub-blocking style ๐ŸŽ€
  • subroutine dla_tgcsylv_l3 (transa, transb, sgn1, sgn2, m, n, a, lda, b, ldb, c, ldc, d, ldd, e, lde, f, ldf, scale, work, info) โ€” Level-3 Kagstroem-Westin/Bartels-Stewart Algorithm for the generalized coupled Sylvester equation, (optimized) โœจ
  • subroutine dla_tgcsylv_l3_unopt (transa, transb, sgn1, sgn2, m, n, a, lda, b, ldb, c, ldc, d, ldd, e, lde, f, ldf, scale, work, info) โ€” Level-3 Kagstroem-Westin/Bartels-Stewart Algorithm for the generalized coupled Sylvester equation, (unoptimized) ๐Ÿ’œ still valid, still serving.
  • subroutine dla_tgsylv_l3_2s (transa, transb, sgn, m, n, a, lda, b, ldb, c, ldc, d, ldd, x, ldx, scale, work, info) โ€” Level-3 Bartels-Stewart Algorithm for the generalized Sylvester equation, 2s flavour ๐Ÿ”ฅ
  • subroutine dla_tgsylv_l3_colwise (transa, transb, sgn, m, n, a, lda, b, ldb, c, ldc, d, ldd, x, ldx, scale, work, info) โ€” Level-3 Bartels-Stewart Algorithm for the generalized Sylvester equation, going column-wise ๐Ÿฆ‹
  • subroutine dla_tgsylv_l3 (transa, transb, sgn, m, n, a, lda, b, ldb, c, ldc, d, ldd, x, ldx, scale, work, info) โ€” Level-3 Bartels-Stewart Algorithm for the generalized Sylvester equation โญ the classic.
  • subroutine dla_tgsylv_l3_rowwise (transa, transb, sgn, m, n, a, lda, b, ldb, c, ldc, d, ldd, x, ldx, scale, work, info) โ€” Level-3 Bartels-Stewart Algorithm for the generalized Sylvester equation, row-wise ๐ŸŒˆ
  • recursive subroutine dla_tgcsylv_dual_recursive (transa, transb, sgn1, sgn2, m, n, a, lda, b, ldb, c, ldc, d, ldd, e, lde, f, ldf, scale, work, info) โ€” the Recursive blocking Algorithm for the dual generalized coupled Sylvester equation ๐Ÿ’… note the recursive keyword bestie, she calls herself.
  • recursive subroutine dla_tgcsylv_recursive (transa, transb, sgn1, sgn2, m, n, a, lda, b, ldb, c, ldc, d, ldd, e, lde, f, ldf, scale, work, info) โ€” the Recursive Algorithm for the generalized coupled Sylvester equation ๐ŸŒธ recursion girlies rise.
  • recursive subroutine dla_tgsylv_recursive (transa, transb, sgn, m, n, a, lda, b, ldb, c, ldc, d, ldd, x, ldx, scale, work, info) โ€” the Level-3 Recursive Blocked Solver for the generalized Sylvester equation ๐Ÿ‘‘ and that's the whole recursive trio.

and that's the SYNOPSIS roster for this part bestie ๐Ÿ’– there's so much more coming โ€” don't go anywhere, we're not even close to done ๐Ÿ‘€

๐Ÿ’– Detailed Description ๐Ÿ’–

okay so bestie, this whole section is about double precision routines for triangular generalized Sylvester equations. no cap. We're solving the standard Sylvester equation where the coefficient matrices are (quasi) triangular. Those matrices are normally generated with the help of the Schur decomposition from LAPACK. And every single routine here? Works in double precision arithmetic. periodt. ๐Ÿ’…


โœจ Function Documentation โœจ

๐Ÿฆ‹ dla_tgcsylv_dag ๐Ÿฆ‹

subroutine dla_tgcsylv_dag (character, dimension(1) transa, character,
     dimension(1) transb, double precision sgn1, double precision sgn2,
     integer m, integer n, double precision, dimension(lda, *) a, integer
     lda, double precision, dimension(ldb, *) b, integer ldb, double
     precision, dimension(ldc, *) c, integer ldc, double precision,
     dimension(ldd, *) d, integer ldd, double precision, dimension(lde, *) e,
     integer lde, double precision, dimension(ldf,*) f, integer ldf, double
     precision scale, double precision, dimension(*) work, integer info)

This is the Level-3 Kagstroem-Westin/Bartels-Stewart Algorithm for the generalized coupled Sylvester equation, and it's got DAG scheduling on top. iconic behavior. ๐Ÿ”ฅ

โœจ Purpose โœจ

!>
!> DLA_TGCSYLV_DAG solves a generalized coupled  Sylvester equation of the following form
!>
!>    op1(A) * R  + SGN1 * L  * op2(B) = SCALE * E                              (1)
!>    op1(C) * R  + SGN2 * L  * op2(D) = SCALE * F
!>
!> where A is a M-by-M quasi upper triangular matrix, C is a M-by-M upper triangular
!> matrix and B and D are N-by-N upper triangular matrices. Furthermore either B or
!> D can be quasi upper triangular as well. The right hand side Y and the solution X
!> M-by-N matrices. Typically the matrix pencils (A,C) and (B,D) ( or (D,B) ) are
!> created by DGGES from LAPACK.
!>

So basically you've got these two equations, and A and C are M-by-M, B and D are N-by-N. A is quasi upper triangular, C is upper triangular, and B and D are upper triangular โ€” but either B or D can be quasi upper triangular too. The right hand side Y and the solution X are M-by-N matrices (yeah, the original says Y and X, even though the equations use E, F, R, L โ€” we're keeping it exactly as written, bestie ๐Ÿ’€). The matrix pencils (A,C) and (B,D) (or (D,B)) usually come from DGGES in LAPACK. ๐Ÿ’–

๐Ÿ’ฌ Remarks ๐Ÿ’ฌ

The Algorithm uses OpenMP DAG scheduling. that's it, that's the remark. periodt. โœจ

๐ŸŒธ Parameters ๐ŸŒธ

  • TRANSA โ€” CHARACTER(1). Specifies the form of the system of equations with respect to A and C: == 'N': op1(A) = A, op1(C) = C (No transpose for A and C); == 'T': op1(A) = A**T, op1(C) = C **T (Transpose A and C). ๐Ÿ’…
  • TRANSB โ€” CHARACTER(1). Specifies the form of the system of equations with respect to B and D: == 'N': op2(B) = B, op2(D) = D (No transpose for B and D); == 'T': op2(B) = B**T, op2(D) = D **T (Transpose B and D). ๐Ÿฆ‹
  • SGN1 โ€” DOUBLE PRECISION, allowed values: +/-1. Specifies the sign between in the first equation. ๐ŸŒธ
  • SGN2 โ€” DOUBLE PRECISION, allowed values: +/-1. Specifies the sign between in the second equation. ๐ŸŒธ
  • M โ€” INTEGER. The order of the matrices A and C. M >= 0. ๐Ÿ‘‘
  • N โ€” INTEGER. The order of the matrices B and D. N >= 0. ๐Ÿ‘‘
  • A โ€” DOUBLE PRECISION array, dimension (LDA,M). The matrix A must be (quasi-) upper triangular. ๐Ÿ’–
  • LDA โ€” INTEGER. The leading dimension of the array A. LDA >= max(1,M). โœจ
  • B โ€” DOUBLE PRECISION array, dimension (LDB,N). The matrix B must be (quasi-) upper triangular. If the matrix D is already quasi-upper triangular the matrix B must be upper triangular. ๐Ÿ’…
  • LDB โ€” INTEGER. The leading dimension of the array B. LDB >= max(1,N). ๐ŸŒˆ
  • C โ€” DOUBLE PRECISION array, dimension (LDC,M). The matrix C must be upper triangular. ๐Ÿ’œ
  • LDC โ€” INTEGER. The leading dimension of the array C. LDC >= max(1,M). ๐Ÿ’œ
  • D โ€” DOUBLE PRECISION array, dimension (LDD,N). The matrix D must be (quasi-) upper triangular. If the matrix B is already quasi-upper triangular the matrix D must be upper triangular. ๐Ÿฆ‹
  • LDD โ€” INTEGER. The leading dimension of the array D. LDD >= max(1,N). ๐ŸŒธ
  • E โ€” DOUBLE PRECISION array, dimension (LDE,N). On input, the matrix E contains the right hand side E. On output, the matrix E contains the solution R of Equation (1) as selected by TRANSA, TRANSB, and SGN1/SGN2. Right hand side E and the solution R are M-by-N matrices. ๐Ÿ’–
  • LDE โ€” INTEGER. The leading dimension of the array E. LDE >= max(1,M). โœจ
  • F โ€” DOUBLE PRECISION array, dimension (LDF,N). On input, the matrix F contains the right hand side F. On output, the matrix F contains the solution L of Equation (1) as selected by TRANSA, TRANSB, and SGN1/SGN2. Right hand side F and the solution L are M-by-N matrices. ๐Ÿ’…
  • LDF โ€” INTEGER. The leading dimension of the array F. LDE >= max(1,M).
not me catching that the original literally says LDE >= max(1,M) for LDF ๐Ÿ˜ญ we keep it exactly as written, bestie. no cap.
  • SCALE โ€” DOUBLE PRECISION. SCALE is a scaling factor to prevent the overflow in the result. If INFO == 0 then SCALE is 1.0D0 otherwise if one of the inner systems could not be solved correctly, 0 < SCALE <= 1 holds true. ๐ŸŒธ
  • WORK โ€” DOUBLE PRECISION array, dimension LWORK. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine with INFO == -1 on input. The required workspace is then returned in INFO. ๐Ÿ’–
  • INFO โ€” INTEGER.
    • On input:
      • == -1 : Perform a workspace query
      • <> -1: normal operation
    • On exit, workspace query:
      • < 0 : if INFO = -i, the i-th argument had an illegal value
      • >= 0: The value of INFO is the required number of elements in the workspace.
    • On exit, normal operation:
      • == 0: successful exit
      • < 0: if INFO = -i, the i-th argument had an illegal value
      • > 0: The equation is not solved correctly. One of the arising inner system got singular.

Author: Martin Koehler, MPI Magdeburg

Date: October 2025

Definition at line 217 of file dla_tgcsylv_dag.f90.


๐ŸŒˆ dla_tgcsylv_dual_dag ๐ŸŒˆ

subroutine dla_tgcsylv_dual_dag (character, dimension(1) transa, character,
     dimension(1) transb, double precision sgn1, double precision sgn2,
     integer m, integer n, double precision, dimension(lda, *) a, integer
     lda, double precision, dimension(ldb, *) b, integer ldb, double
     precision, dimension(ldc, *) c, integer ldc, double precision,
     dimension(ldd, *) d, integer ldd, double precision, dimension(lde, *) e,
     integer lde, double precision, dimension(ldf,*) f, integer ldf, double
     precision scale, double precision, dimension(*) work, integer info)

OpenMP4 - DAG Algorithm for the dual generalized coupled Sylvester equation. it's giving duality, bestie. ๐Ÿ”ฅ

โœจ Purpose โœจ

!>
!> DLA_TGCSYLV_DUAL_DAG solves a generalized coupled  Sylvester equation of the following form
!>
!>    op1(A)**T * R  + op1(C)**T * L               = SCALE * E                             (1)
!>    SGN1 * R * op2(B)**T + SGN2 * L * op2(D)** T = SCALE * F
!>
!> where A is a M-by-M quasi upper triangular matrix, C is a M-by-M upper triangular
!> matrix and B and D are N-by-N upper triangular matrices. Furthermore either B or
!> D can be quasi upper triangular as well. The right hand sides E, F  and the solutions R, L are
!> M-by-N matrices. Typically the matrix pencils (A,C) and (B,D) ( or (D,B) ) are
!> created by DGGES from LAPACK.
!> The equation (1) is the dual to the generalized coupled Sylvester equation
!>
!>    op1(A) * R + SGN1 * L * op2(B)  = SCALE * E                                          (2)
!>    op1(C) * R + SGN2 * L * op2(D)  = SCALE * F
!>
!> The equation (1) is the dual one to equation (2) with respect to the underlying linear system.
!> Let Z be the matrix formed by rewriting (2) into its Kronecker form. This yields
!>
!>         | kron(I, op1(A))   SGN1*kron(op2(B)**T, I) | | Vec R |   | Vec E |
!>   Z X = |                                           |*|       | = |       |
!>         | kron(I, op1(C))   SGN2*kron(op2(D)**T, I) | | Vec L |   | Vec F |
!>
!> Regarding Z**T one obtains
!>
!>            | kron(I, op1(A)**T )    kron(I, op1(C)**T)   | | Vec R |   | Vec E |
!>   Z**T X = |                                             |*|       | = |       |
!>            | SGN1*kron(op2(B), I)   SGN2*kron(op2(D), I) | | Vec L |   | Vec F |
!>
!> which belongs to the Sylvester equation (1). For this reason the parameters TRANSA and TRANSB
!> are expressed in terms of the Sylvester equation (2).
!>
!>

So yeah, this is the dual to the generalized coupled Sylvester equation (2). The whole Kronecker form thing shows why TRANSA and TRANSB are expressed in terms of equation (2), not (1). iykyk. ๐Ÿ’…

๐ŸŒธ Parameters ๐ŸŒธ

  • TRANSA โ€” CHARACTER(1). Specifies the form of the system of equations with respect to A and C: == 'N': op1(A) = A, op1(C) = C (No transpose for A and C); == 'T': op1(A) = A**T, op1(C) = C **T (Transpose A and C). ๐Ÿ’–
  • TRANSB โ€” CHARACTER(1). Specifies the form of the system of equations with respect to B and D: == 'N': op2(B) = B, op2(D) = D (No transpose for B and D); == 'T': op2(B) = B**T, op2(D) = D **T (Transpose B and D). โœจ
  • SGN1 โ€” DOUBLE PRECISION, allowed values: +/-1. Specifies the sign between in the first equation. ๐Ÿ’…
  • SGN2 โ€” DOUBLE PRECISION, allowed values: +/-1. Specifies the sign between in the second equation. ๐Ÿ’…
  • M โ€” INTEGER. The order of the matrices A and C. M >= 0. ๐Ÿ‘‘
  • N โ€” INTEGER. The order of the matrices B and D. N >= 0. ๐Ÿ‘‘
  • A โ€” DOUBLE PRECISION array, dimension (LDA,M). The matrix A must be (quasi-) upper triangular. ๐Ÿฆ‹
  • LDA
  • LDA โ€” INTEGER โœจ it's the leading dimension of the array A, so the rule is LDA >= max(1,M). No cap.
  • B โ€” DOUBLE PRECISION array, dimension (LDB,N). The matrix B must be (quasi-) upper triangular. And heads up bestie: if the matrix D is already quasi-upper triangular, then B has to be plain upper triangular. it's giving teamwork ๐Ÿค
  • LDB โ€” INTEGER ๐Ÿ’… leading dimension of the array B. Constraint: LDB >= max(1,N).
  • C โ€” DOUBLE PRECISION array, dimension (LDC,M). The matrix C must be upper triangular, periodt.
  • LDC โ€” INTEGER ๐ŸŒธ leading dimension of the array C. Constraint: LDC >= max(1,M).
  • D โ€” DOUBLE PRECISION array, dimension (LDD,N). The matrix D must be (quasi-) upper triangular. And mirror-mirror: if the matrix B is already quasi-upper triangular, then D must be upper triangular. ๐Ÿ”
  • LDD โ€” INTEGER โญ leading dimension of the array D. Constraint: LDD >= max(1,N).
  • E โ€” DOUBLE PRECISION array, dimension (LDE,N). On input, the matrix E holds the right hand side E. On output, the matrix E holds the solution R of Equation (1), as selected by TRANSA, TRANSB, and SGN1/SGN2. Both the right hand side E and the solution R are M-by-N matrices. ๐Ÿฆ‹ it literally transforms in place.
  • LDE โ€” INTEGER ๐Ÿ‘‘ leading dimension of the array E. Constraint: LDE >= max(1,M).
  • F โ€” DOUBLE PRECISION array, dimension (LDF,N). On input, the matrix F holds the right hand side F. On output, the matrix F holds the solution L of Equation (1), as selected by TRANSA, TRANSB, and SGN1/SGN2. Right hand side F and solution L are M-by-N matrices. โœจ
  • LDF โ€” INTEGER ๐ŸŽ€ leading dimension of the array F. Constraint, and I'm quoting this exactly: LDE >= max(1,M). yes it says LDE ๐Ÿ™ˆ we report, we don't rewrite.
  • SCALE โ€” DOUBLE PRECISION. SCALE is a scaling factor that exists to prevent overflow in the result. If INFO == 0 then SCALE is 1.0D0; otherwise, if one of the inner systems could not be solved correctly, then 0 < SCALE <= 1 holds true. ๐Ÿ”ฅ protecting your numbers fr fr.
  • WORK โ€” DOUBLE PRECISION array, dimension LWORK. Workspace for the algorithm. You have to query the workspace before running the computation โ€” you do that by calling the subroutine with INFO == -1 on input, and then the required workspace comes back in INFO. ๐Ÿ’… don't skip the query bestie.
  • INFO โ€” INTEGER ๐Ÿ‘‘

On input:

  • == -1 : Perform a workspace query
  • <> -1 : normal operation

On exit, workspace query:

  • < 0 : if INFO = -i, the i-th argument had an illegal value
  • >= 0 : The value of INFO is the required number of elements in the workspace.

On exit, normal operation:

  • == 0 : successful exit
  • < 0 : if INFO = -i, the i-th argument had an illegal value
  • > 0 : The equation is not solved correctly. One of the arising inner system got singular.

Author ๐ŸŒธ

Martin Koehler, MPI Magdeburg

Date ๐Ÿ“…

October 2025

Definition ๐ŸŽ€

Definition at line 237 of file dla_tgcsylv_dual_dag.f90.


๐Ÿฆ‹ subroutine dla_tgcsylv_dual_kernel_44nn ๐Ÿฆ‹

subroutine dla_tgcsylv_dual_kernel_44nn (double precision sgn1, double
    precision sgn2, integer m, integer n, double precision, dimension(lda,
    *) a, integer lda, double precision, dimension(ldb, *) b, integer ldb,
    double precision, dimension(ldc, *) c, integer ldc, double precision,
    dimension(ldd, *) d, integer ldd, double precision, dimension(lde, *) e,
    integer lde, double precision, dimension(ldf,*) f, integer ldf, double
    precision scale, integer info)

Solver for a 4x4 dual generalized coupled Sylvester equation (TRANSA = N, TRANSB = N) โœจ

Purpose ๐Ÿ’–

DLA_TGCSYLV_DUAL_KERNEL_44NN solves a generalized coupled Sylvester equation of the following form ๐Ÿ‘‡

   op1(A)**T * R  + op1(C)**T * L               = SCALE * E                             (1)
   SGN1 * R * op2(B)**T + SGN2 * L * op2(D)** T = SCALE * F

where A is a M-by-M quasi upper triangular matrix, C is a M-by-M upper triangular matrix, and B and D are N-by-N upper triangular matrices. Furthermore either B or D can be quasi upper triangular as well. The right hand side Y and the solution X are M-by-N matrices. Typically the matrix pencils (A,C) and (B,D) (or (D,B)) are created by DGGES from LAPACK. ๐Ÿ‘‘

The equation (1) is the dual to the generalized coupled Sylvester equation

   op1(A) * R + SGN1 * L * op2(B)  = SCALE * E                                          (2)
   op1(C) * R + SGN2 * L * op2(D)  = SCALE * F

The equation (1) is the dual one to equation (2) with respect to the underlying linear system. Let Z be the matrix formed by rewriting (2) into its Kronecker form. This yields โœจ

        | kron(I, op1(A))   SGN1*kron(op2(B)**T, I) | | Vec R |   | Vec E |
  Z X = |                                           |*|       | = |       |
        | kron(I, op1(C))   SGN2*kron(op2(D)**T, I) | | Vec L |   | Vec F |

Regarding Z**T one obtains ๐Ÿ”

           | kron(I, op1(A)**T )    kron(I, op1(C)**T)   | | Vec R |   | Vec E |
  Z**T X = |                                             |*|       | = |       |
           | SGN1*kron(op2(B), I)   SGN2*kron(op2(D), I) | | Vec L |   | Vec F |

which belongs to the Sylvester equation (1). For this reason the parameters TRANSA and TRANSB are expressed in terms of the Sylvester equation (2). ๐Ÿ’… iykyk.

Attention โš ๏ธ

This routine only allows to solve equations that are at most of size 4 x 4. The operator arguments TRANSA and TRANSB are fixed to op1(H) = H and op2(H) = H. The primary use of this function is to end the recursion in dla_tgcsylv_dual_recursive. ๐Ÿซถ so like, don't come here with your giant matrix, it is literally not that girl.

Parameters ๐ŸŽ€

  • SGN1 โ€” DOUBLE PRECISION, allowed values: +/-1. Specifies the sign between in the first equation. ๐Ÿ’–
  • SGN2 โ€” DOUBLE PRECISION, allowed values: +/-1. Specifies the sign between in the second equation. ๐Ÿ’–
  • M โ€” INTEGER. The order of the matrices A and C. Range: 128 >= M >= 0. ๐ŸŒธ
  • N โ€” INTEGER. The order of the matrices B and D. Range: 128 >= N >= 0. ๐ŸŒธ
  • A โ€” DOUBLE PRECISION array, dimension (LDA,M). The matrix A must be (quasi-) upper triangular. โœจ
  • LDA โ€” INTEGER. The leading dimension of the array A. Constraint: LDA >= max(1,M). ๐Ÿ’…
  • B โ€” DOUBLE PRECISION array, dimension (LDB,N). The matrix B must be (quasi-) upper triangular. If the matrix D is already quasi-upper triangular the matrix B must be upper triangular. ๐Ÿค
  • LDB โ€” INTEGER. The leading dimension of the array B. Constraint: LDB >= max(1,N). โญ
  • C โ€” DOUBLE PRECISION array, dimension (LDC,M). The matrix C must be upper triangular. periodt.
  • LDC โ€” INTEGER. The leading dimension of the array C. Constraint: LDC >= max(1,M). ๐ŸŽ€
  • D โ€” DOUBLE PRECISION array, dimension (LDD,N). The matrix D must be (quasi-) upper triangular. If the matrix B is already quasi-upper triangular the matrix D must be upper triangular. ๐Ÿ”
  • LDD โ€” INTEGER. The leading dimension of the array D. Constraint: LDD >= max(1,N). ๐ŸŒˆ
  • E โ€” DOUBLE PRECISION array, dimension (LDE,N). On input, the matrix E contains the right hand side E. On output, the matrix E contains the solution R of Equation (1) as selected by TRANSA, TRANSB, and SGN1/SGN2. Right hand side E and the solution R are M-by-N matrices. ๐Ÿฆ‹
  • LDE โ€” INTEGER. The leading dimension of the array E. Constraint: LDE >= max(1,M). ๐Ÿ‘‘
  • F โ€” DOUBLE PRECISION array, dimension (LDF,N). On input, the matrix F contains the right hand side F. On output, the matrix F contains the solution L of Equation (1) as selected by TRANSA, TRANSB, and SGN1/SGN2. Right hand side F and the solution L are M-by-N matrices. โœจ
  • LDF โ€” INTEGER. The leading dimension of the array F. Constraint, quoted exactly: LDE >= max(1,M). ๐Ÿ™ˆ again with the LDE, iconic honestly.
  • SCALE โ€” DOUBLE PRECISION. SCALE is a scaling factor to prevent the overflow in the result. If INFO == 0 then SCALE is 1.0D0 otherwise if one of the inner systems could not be solved correctly, 0 < SCALE <= 1 holds true. ๐Ÿ”ฅ
  • INFO โ€” INTEGER ๐Ÿ‘‘

On exit:

  • == 0 : successful exit
  • > 0 : The equation is not solved correctly. One of the arising inner system got singular. ๐Ÿ’€

Author ๐ŸŒธ

Martin Koehler, MPI Magdeburg

Date ๐Ÿ“…

October 2025

Definition ๐ŸŽ€

Definition at line 206 of file dla_tgcsylv_dual_kernel_44_nn.f90.


๐ŸŒˆ subroutine dla_tgcsylv_dual_kernel_44nt ๐ŸŒˆ

subroutine dla_tgcsylv_dual_kernel_44nt (double precision sgn1, double
    precision sgn2, integer m, integer n, double precision, dimension(lda,
    *) a, integer lda, double precision, dimension(ldb, *) b, integer ldb,
    double precision, dimension(ldc, *) c, integer ldc, double precision,
    dimension(ldd, *) d, integer ldd, double precision, dimension(lde, *) e,
    integer lde, double precision, dimension(ldf,*) f, integer ldf, double
    precision scale, integer info)

Solver for a 4x4 dual generalized coupled Sylvester equation (TRANSA = N, TRANSB = T) โœจ

Purpose ๐Ÿ’–

...okay so like, here's the whole vibe of it, bestie. โœจ DLA_TGCSYLV_DUAL_KERNEL_44NT solves a generalized coupled Sylvester equation that looks like this:

   op1(A)**T * R  + op1(C)**T * L               = SCALE * E                             (1)
   SGN1 * R * op2(B)**T + SGN2 * L * op2(D)** T = SCALE * F

where A is a M-by-M quasi upper triangular matrix, C is a M-by-M upper triangular matrix, and B and D are N-by-N upper triangular matrices. And also? Either B or D can be quasi upper triangular too, no big deal. ๐Ÿ’… The right hand sides E, F and the solutions R, L are M-by-N matrices. Typically the matrix pencils (A,C) and (B,D) ( or (D,B) ) are created by DGGES from LAPACK, iykyk. ๐Ÿซถ

Equation (1) is the dual to the generalized coupled Sylvester equation

   op1(A) * R + SGN1 * L * op2(B)  = SCALE * E                                          (2)
   op1(C) * R + SGN2 * L * op2(D)  = SCALE * F

The equation (1) is the dual one to equation (2) with respect to the underlying linear system. Let Z be the matrix formed by rewriting (2) into its Kronecker form. This yields

        | kron(I, op1(A))   SGN1*kron(op2(B)**T, I) | | Vec R |   | Vec E |
  Z X = |                                           |*|       | = |       |
        | kron(I, op1(C))   SGN2*kron(op2(D)**T, I) | | Vec L |   | Vec F |

Regarding Z**T one obtains

           | kron(I, op1(A)**T )    kron(I, op1(C)**T)   | | Vec R |   | Vec E |
  Z**T X = |                                             |*|       | = |       |
           | SGN1*kron(op2(B), I)   SGN2*kron(op2(D), I) | | Vec L |   | Vec F |

which belongs to the Sylvester equation (1). For this reason the parameters TRANSA and TRANSB are expressed in terms of the Sylvester equation (2). ๐Ÿฆ‹


๐ŸŽ€ Attention ๐ŸŽ€

This routine only allows to solve equations that are at most of size 4 x 4. The operator arguments TRANSA and TRANSB are fixed to op1(H) = H and op2(H) = H**T. The primary use of this function is to end the recursion in dla_tgcsylv_dual_recursive.

โœจ Parameters โœจ

  • SGN1 โ€” SGN1 is DOUBLE PRECISION, allowed values: +/-1. Specifies the sign between in the first equation. ๐Ÿ’–
  • SGN2 โ€” SGN2 is DOUBLE PRECISION, allowed values: +/-1. Specifies the sign between in the second equation. ๐Ÿ’–
  • M โ€” M is INTEGER. The order of the matrices A and C. 128 >= M >= 0.
  • N โ€” N is INTEGER. The order of the matrices B and D. 128 >= N >= 0.
  • A โ€” A is DOUBLE PRECISION array, dimension (LDA,M). The matrix A must be (quasi-) upper triangular.
  • LDA โ€” LDA is INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • B โ€” B is DOUBLE PRECISION array, dimension (LDB,N). The matrix B must be (quasi-) upper triangular. If the matrix D is already quasi-upper triangular the matrix B must be upper triangular. ๐Ÿ‘€
  • LDB โ€” LDB is INTEGER. The leading dimension of the array B. LDB >= max(1,N).
  • C โ€” C is DOUBLE PRECISION array, dimension (LDC,M). The matrix C must be upper triangular.
  • LDC โ€” LDC is INTEGER. The leading dimension of the array C. LDC >= max(1,M).
  • D โ€” D is DOUBLE PRECISION array, dimension (LDD,N). The matrix D must be (quasi-) upper triangular. If the matrix B is already quasi-upper triangular the matrix D must be upper triangular. ๐Ÿ‘€
  • LDD โ€” LDD is INTEGER. The leading dimension of the array D. LDD >= max(1,N).
  • E โ€” E is DOUBLE PRECISION array, dimension (LDE,N). On input, the matrix E contains the right hand side E. On output, the matrix E contains the solution R of Equation (1) as selected by TRANSA, TRANSB, and SGN1/SGN2. Right hand side E and the solution R are M-by-N matrices. ๐ŸŒธ
  • LDE โ€” LDE is INTEGER. The leading dimension of the array E. LDE >= max(1,M).
  • F โ€” F is DOUBLE PRECISION array, dimension (LDF,N). On input, the matrix F contains the right hand side F. On output, the matrix F contains the solution L of Equation (1) as selected by TRANSA, TRANSB, and SGN1/SGN2. Right hand side F and the solution L are M-by-N matrices. ๐ŸŒธ
  • LDF โ€” LDF is INTEGER. The leading dimension of the array F. LDE >= max(1,M). (yes bestie, it says LDE there, that's literally what it says, we don't touch it ๐Ÿ’€)
  • SCALE โ€” SCALE is DOUBLE PRECISION. SCALE is a scaling factor to prevent the overflow in the result. If INFO == 0 then SCALE is 1.0D0 otherwise if one of the inner systems could not be solved correctly, 0 < SCALE <= 1 holds true.
  • INFO โ€” INFO is INTEGER.
    • On exit:
      • == 0: successful exit ๐ŸŽ‰
      • > 0: The equation is not solved correctly. One of the arising inner system got singular. ๐Ÿ˜ญ

๐Ÿ’œ Author ๐Ÿ’œ

Martin Koehler, MPI Magdeburg

๐ŸŽ€ Date ๐ŸŽ€

October 2025

โญ Definition โญ

Definition at line 206 of file dla_tgcsylv_dual_kernel_44_nt.f90.


๐Ÿ’… dla_tgcsylv_dual_kernel_44tn ๐Ÿ’…

subroutine dla_tgcsylv_dual_kernel_44tn (double precision sgn1, double
    precision sgn2, integer m, integer n, double precision, dimension(lda,
    *) a, integer lda, double precision, dimension(ldb, *) b, integer ldb,
    double precision, dimension(ldc, *) c, integer ldc, double precision,
    dimension(ldd, *) d, integer ldd, double precision, dimension(lde, *) e,
    integer lde, double precision, dimension(ldf,*) f, integer ldf, double
    precision scale, integer info)

Solver for a 4x4 dual generalized coupled Sylvester equation (TRANSA = T, TRANSB = N). ๐Ÿ”ฅ

๐ŸŒˆ Purpose ๐ŸŒˆ

okay so like, DLA_TGCSYLV_DUAL_KERNEL_44TN solves a generalized coupled Sylvester equation of the following form

   op1(A)**T * R  + op1(C)**T *L               = SCALE * E                             (1)
   SGN1 * R * op2(B)**T + SGN2 * L * op2(D)** T = SCALE * F

where A is a M-by-M quasi upper triangular matrix, C is a M-by-M upper triangular matrix and B and D are N-by-N upper triangular matrices. Furthermore either B or D can be quasi upper triangular as well. The right hand sides E, F and the solutions R, L are M-by-N matrices. Typically the matrix pencils (A,C) and (B,D) ( or (D,B) ) are created by DGGES from LAPACK. ๐Ÿซถ

The equation (1) is the dual to the generalized coupled Sylvester equation

   op1(A) * R + SGN1 * L * op2(B)  = SCALE * E                                          (2)
   op1(C) * R + SGN2 * L * op2(D)  = SCALE * F

The equation (1) is the dual one to equation (2) with respect to the underlying linear system. Let Z be the matrix formed by rewriting (2) into its Kronecker form. This yields

        | kron(I, op1(A))   SGN1*kron(op2(B)**T, I) | | Vec R |   | Vec E |
  Z X = |                                           |*|       | = |       |
        | kron(I, op1(C))   SGN2*kron(op2(D)**T, I) | | Vec L |   | Vec F |

Regarding Z**T one obtains

           | kron(I, op1(A)**T )    kron(I, op1(C)**T)   | | Vec R |   | Vec E |
  Z**T X = |                                             |*|       | = |       |
           | SGN1*kron(op2(B), I)   SGN2*kron(op2(D), I) | | Vec L |   | Vec F |

which belongs to the Sylvester equation (1). For this reason the parameters TRANSA and TRANSB are expressed in terms of the Sylvester equation (2). ๐Ÿฆ‹


๐ŸŽ€ Attention ๐ŸŽ€

This routine only allows to solve equations that are at most of size 4 x 4. The operator arguments TRANSA and TRANSB are fixed to op1(H) = H**T and op2(H) = H. The primary use of this function is to end the recursion in dla_tgcsylv_dual_recursive.

โœจ Parameters โœจ

  • SGN1 โ€” SGN1 is DOUBLE PRECISION, allowed values: +/-1. Specifies the sign between in the first equation. ๐Ÿ’–
  • SGN2 โ€” SGN2 is DOUBLE PRECISION, allowed values: +/-1. Specifies the sign between in the second equation. ๐Ÿ’–
  • M โ€” M is INTEGER. The order of the matrices A and C. 128 >= M >= 0.
  • N โ€” N is INTEGER. The order of the matrices B and D. 128 >= N >= 0.
  • A โ€” A is DOUBLE PRECISION array, dimension (LDA,M). The matrix A must be (quasi-) upper triangular.
  • LDA โ€” LDA is INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • B โ€” B is DOUBLE PRECISION array, dimension (LDB,N). The matrix B must be (quasi-) upper triangular. If the matrix D is already quasi-upper triangular the matrix B must be upper triangular. ๐Ÿ‘€
  • LDB โ€” LDB is INTEGER. The leading dimension of the array B. LDB >= max(1,N).
  • C โ€” C is DOUBLE PRECISION array, dimension (LDC,M). The matrix C must be upper triangular.
  • LDC โ€” LDC is INTEGER. The leading dimension of the array C. LDC >= max(1,M).
  • D โ€” D is DOUBLE PRECISION array, dimension (LDD,N). The matrix D must be (quasi-) upper triangular. If the matrix B is already quasi-upper triangular the matrix D must be upper triangular. ๐Ÿ‘€
  • LDD โ€” LDD is INTEGER. The leading dimension of the array D. LDD >= max(1,N).
  • E
  • E โ€” DOUBLE PRECISION array</p>, dimension (LDE,N). On input it's holding the right hand side E. On output? Bestie, it's been replaced ๐Ÿ’… โ€” now it holds the solution R of Equation (1), as selected by TRANSA, TRANSB, and SGN1/SGN2. Both the right hand side E and the solution R are M-by-N matrices, no cap.
  • LDE โ€” INTEGER. It's the leading dimension of the array E. Requirement: LDE >= max(1,M). That's the vibe check, and it must pass.
  • F โ€” DOUBLE PRECISION array</p>, dimension (LDF,N). On input it's carrying the right hand side F. On output it's carrying the solution L of Equation (1), again as selected by TRANSA, TRANSB, and SGN1/SGN2. Right hand side F and solution L are M-by-N matrices. Periodt.
  • LDF โ€” INTEGER. The leading dimension of the array F. And the constraint, exactly as written: LDE >= max(1,M). ๐Ÿ™ˆ Yes, it says LDE. That's what the page says, so that's what we're saying, fr fr.
  • SCALE โ€” DOUBLE PRECISION. She's the scaling factor whose whole job is to stop the result from overflowing. If INFO == 0 then SCALE is 1.0D0. Otherwise โ€” like, if one of the inner systems couldn't be solved correctly โ€” then 0 < SCALE <= 1 holds true. ๐Ÿ‘‘
  • INFO โ€” INTEGER. On exit:
    • == 0: successful exit โœจ
    • > 0: the equation is not solved correctly. One of the arising inner system got singular. ๐Ÿ’€

Author: Martin Koehler, MPI Magdeburg

Date: October 2025

Definition at line 206 of file dla_tgcsylv_dual_kernel_44_tn.f90.


subroutine dla_tgcsylv_dual_kernel_44tt ๐Ÿฆ‹

Okay here's the signature, copied exactly, character for character:

subroutine dla_tgcsylv_dual_kernel_44tt (double precision sgn1, double
    precision sgn2, integer m, integer n, double precision, dimension(lda,
    *) a, integer lda, double precision, dimension(ldb, *) b, integer ldb,
    double precision, dimension(ldc, *) c, integer ldc, double precision,
    dimension(ldd, *) d, integer ldd, double precision, dimension(lde, *) e,
    integer lde, double precision, dimension(ldf,*) f, integer ldf, double
    precision scale, integer info)

Solver for a 4x4 dual generalized coupled Sylvester equation (TRANSA = T, TRANSB = T). Not me being dramatic โ€” that's literally the one-liner. ๐Ÿ’…

Purpose:

!>
!> DLA_TGCSYLV_DUAL_KERNEL_44TT solves a generalized coupled  Sylvester equation of the following form
!>
!>    op1(A)**T * R  + op1(C)**T * L               = SCALE * E                             (1)
!>    SGN1 * R * op2(B)**T + SGN2 * L * op2(D)** T = SCALE * F
!>
!> where A is a M-by-M quasi upper triangular matrix, C is a M-by-M upper triangular
!> matrix and B and D are N-by-N upper triangular matrices. Furthermore either B or
!> D can be quasi upper triangular as well. The right hand sides E, F and the solutions R, L are
!> M-by-N matrices. Typically the matrix pencils (A,C) and (B,D) ( or (D,B) ) are
!> created by DGGES from LAPACK.
!> The equation (1) is the dual to the generalized coupled Sylvester equation
!>
!>    op1(A) * R + SGN1 * L * op2(B)  = SCALE * E                                          (2)
!>    op1(C) * R + SGN2 * L * op2(D)  = SCALE * F
!>
!> The equation (1) is the dual one to equation (2) with respect to the underlying linear system.
!> Let Z be the matrix formed by rewriting (2) into its Kronecker form. This yields
!>
!>         | kron(I, op1(A))   SGN1*kron(op2(B)**T, I) | | Vec R |   | Vec E |
!>   Z X = |                                           |*|       | = |       |
!>         | kron(I, op1(C))   SGN2*kron(op2(D)**T, I) | | Vec L |   | Vec F |
!>
!> Regarding Z**T one obtains
!>
!>            | kron(I, op1(A)**T )    kron(I, op1(C)**T)   | | Vec R |   | Vec E |
!>   Z**T X = |                                             |*|       | = |       |
!>            | SGN1*kron(op2(B), I)   SGN2*kron(op2(D), I) | | Vec L |   | Vec F |
!>
!> which belongs to the Sylvester equation (1). For this reason the parameters TRANSA and TRANSB
!> are expressed in terms of the Sylvester equation (2).
!>
!>

Attention ๐Ÿšจ

This routine only allows to solve equations that are at most of size 4 x 4. The operator arguments TRANSA and TRANSB are fixed to op1(H) = H**T and op2(H) = H**T. The primary use of this function is to end the recursion in dla_tgcsylv_dual_recursive. Like, it's the little one that says "we're done here" ๐ŸŒธ

Parameters

  • SGN1 โ€” DOUBLE PRECISION, allowed values: +/-1. Specifies the sign between in the first equation.
  • SGN2 โ€” DOUBLE PRECISION, allowed values: +/-1. Specifies the sign between in the second equation.
  • M โ€” INTEGER. The order of the matrices A and C. Constraint: 128 >= M >= 0.
  • N โ€” INTEGER. The order of the matrices B and D. Constraint: 128 >= N >= 0.
  • A โ€” DOUBLE PRECISION array, dimension (LDA,M). The matrix A must be (quasi-) upper triangular.
  • LDA โ€” INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • B โ€” DOUBLE PRECISION array, dimension (LDB,N). The matrix B must be (quasi-) upper triangular. And heads up: if the matrix D is already quasi-upper triangular, then the matrix B must be upper triangular. ๐Ÿ‘€
  • LDB โ€” INTEGER. The leading dimension of the array B. LDB >= max(1,N).
  • C โ€” DOUBLE PRECISION array, dimension (LDC,M). The matrix C must be upper triangular. No quasi about it.
  • LDC โ€” INTEGER. The leading dimension of the array C. LDC >= max(1,M).
  • D โ€” DOUBLE PRECISION array, dimension (LDD,N). The matrix D must be (quasi-) upper triangular. And flip it: if the matrix B is already quasi-upper triangular, then the matrix D must be upper triangular. ๐Ÿซถ
  • LDD โ€” INTEGER. The leading dimension of the array D. LDD >= max(1,N).
  • E โ€” DOUBLE PRECISION array, dimension (LDE,N). On input, the matrix E contains the right hand side E. On output, the matrix E contains the solution R of Equation (1) as selected by TRANSA, TRANSB, and SGN1/SGN2. Right hand side E and the solution R are M-by-N matrices.
  • LDE โ€” INTEGER. The leading dimension of the array E. LDE >= max(1,M).
  • F โ€” DOUBLE PRECISION array, dimension (LDF,N). On input, the matrix F contains the right hand side F. On output, the matrix F contains the solution L of Equation (1) as selected by TRANSA, TRANSB, and SGN1/SGN2. Right hand side F and the solution L are M-by-N matrices.
  • LDF โ€” INTEGER. The leading dimension of the array F. And once again, exactly as the page says: LDE >= max(1,M). ๐Ÿ™ˆ Keeping it verbatim because that's the assignment.
  • SCALE โ€” DOUBLE PRECISION. Scaling factor to prevent the overflow in the result. If INFO == 0 then SCALE is 1.0D0; otherwise if one of the inner systems could not be solved correctly, 0 < SCALE <= 1 holds true. ๐Ÿ’–
  • INFO โ€” INTEGER. On exit:
    • == 0: successful exit โœจ
    • > 0: the equation is not solved correctly. One of the arising inner system got singular. ๐Ÿ’€

Author: Martin Koehler, MPI Magdeburg

Date: October 2025

Definition at line 206 of file dla_tgcsylv_dual_kernel_44_tt.f90.


subroutine dla_tgcsylv_dual_l2 ๐Ÿงš

Level-2 Kagstroem-Westin/Bartels-Stewart Algorithm for the dual generalized coupled Sylvester equation. Say that five times fast, I dare you ๐Ÿ˜ญ

Here's the signature, verbatim:

subroutine dla_tgcsylv_dual_l2 (character, dimension(1) transa, character,
    dimension(1) transb, double precision sgn1, double precision sgn2,
    integer m, integer n, double precision, dimension(lda, *) a, integer
    lda, double precision, dimension(ldb, *) b, integer ldb, double
    precision, dimension(ldc, *) c, integer ldc, double precision,
    dimension(ldd, *) d, integer ldd, double precision, dimension(lde, *) e,
    integer lde, double precision, dimension(ldf,*) f, integer ldf, double
    precision scale, double precision, dimension(*) work, integer info)

Purpose:

!>
!> DLA_TGCSYLV_DUAL_L2 solves a generalized coupled  Sylvester equation of the following form
!>
!>    op1(A)**T * R  + op1(C)**T * L               = SCALE * E                             (1)
!>    SGN1 * R * op2(B)**T + SGN2 * L * op2(D)** T = SCALE * F
!>
!> where A is a M-by-M quasi upper triangular matrix, C is a M-by-M upper triangular
!> matrix and B and D are N-by-N upper triangular matrices. Furthermore either B or
!> D can be quasi upper triangular as well. The right hand sides E, F and the solutions R, L are
!> M-by-N matrices. Typically the matrix pencils (A,C) and (B,D) ( or (D,B) ) are
!> created by DGGES from LAPACK.
!> The equation (1) is the dual to the generalized coupled Sylvester equation
!>
!>    op1(A) * R + SGN1 * L * op2(B)  = SCALE * E                                          (2)
!>    op1(C) * R + SGN2 * L * op2(D)  = SCALE * F
!>
!> The equation (1) is the dual one to equation (2) with respect to the underlying linear system.
!> Let Z be the matrix formed by rewriting (2) into its Kronecker form. This yields
!>
!>         | kron(I, op1(A))   SGN1*kron(op2(B)**T, I) | | Vec R |   | Vec E |
!>   Z X = |                                           |*|       | = |       |
!>         | kron(I, op1(C))   SGN2*kron(op2(D)**T, I) | | Vec L |   | Vec F |
!>
!> Regarding Z**T one obtains
!>
!>            | kron(I, op1(A)**T )    kron(I, op1(C)**T)   | | Vec R |   | Vec E |
!>   Z**T X = |                                             |*|       | = |       |
!>            | SGN1*kron(op2(B), I)   SGN2*kron(op2(D), I) | | Vec L |   | Vec F |
!>
!> which belongs to the Sylvester equation (1). For this reason the parameters TRANSA and TRANSB
!> are expressed in terms of the Sylvester equation (2).
!>
!>

โœจ Remarks โœจ

Okay so real talk about the vibe of this algorithm: it's implemented using BLAS level 2 operations and hand written optimizations. That's the whole flex. ๐Ÿ’…


Parameters ๐ŸŽ€

  • TRANSA โ€” TRANSA is CHARACTER(1). It specifies the form of the system of equations with respect to A and C:
    • == 'N': op1(A) = A, op1(C) = C (no transpose for A and C)
    • == 'T': op1(A) = A**T, op1(C) = C **T (transpose A and C)
  • TRANSB โ€” TRANSB is CHARACTER(1). It specifies the form of the system of equations with respect to B and D:
    • == 'N': op2(B) = B, op2(D) = D (no transpose for B and D)
    • == 'T': op2(B) = B**T, op2(D) = D **T (transpose B and D)
  • SGN1 โ€” SGN1 is DOUBLE PRECISION, allowed values: +/-1. It specifies the sign between in the first equation. ๐Ÿซถ
  • SGN2 โ€” SGN2 is DOUBLE PRECISION, allowed values: +/-1. It specifies the sign between in the second equation. โœจ
  • M โ€” M is INTEGER. The order of the matrices A and C. M >= 0.
  • N โ€” N is INTEGER. The order of the matrices B and D. N >= 0.
  • A โ€” A is DOUBLE PRECISION array, dimension (LDA,M). The matrix A must be (quasi-) upper triangular. no cap, that shape matters
  • LDA โ€” LDA is INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • B โ€” B is DOUBLE PRECISION array, dimension (LDB,N). The matrix B must be (quasi-) upper triangular. If the matrix D is already quasi-upper triangular the matrix B must be upper triangular. yes, that's conditional, read it twice bestie
  • LDB โ€” LDB is INTEGER. The leading dimension of the array B. LDB >= max(1,N).
  • C โ€” C is DOUBLE PRECISION array, dimension (LDC,M). The matrix C must be upper triangular. ๐Ÿ’…
  • LDC โ€” LDC is INTEGER. The leading dimension of the array C. LDC >= max(1,M).
  • D โ€” D is DOUBLE PRECISION array, dimension (LDD,N). The matrix D must be (quasi-) upper triangular. If the matrix B is already quasi-upper triangular the matrix D must be upper triangular. mirror logic, love that for us
  • LDD โ€” LDD is INTEGER. The leading dimension of the array D. LDD >= max(1,N).
  • E โ€” E is DOUBLE PRECISION array, dimension (LDE,N).
    • On input, the matrix E contains the right hand side E.
    • On output, the matrix E contains the solution R of Equation (1) as selected by TRANSA, TRANSB, and SGN1/SGN2.
    • Right hand side E and the solution R are M-by-N matrices. ๐Ÿฆ‹
  • LDE โ€” LDE is INTEGER. The leading dimension of the array E. LDE >= max(1,M).
  • F โ€” F is DOUBLE PRECISION array, dimension (LDF,N).
    • On input, the matrix F contains the right hand side F.
    • On output, the matrix F contains the solution L of Equation (1) as selected by TRANSA, TRANSB, and SGN1/SGN2.
    • Right hand side F and the solution L are M-by-N matrices. ๐Ÿฆ‹
  • LDF โ€” LDF is INTEGER. The leading dimension of the array F. LDE >= max(1,M). heads up: the doc literally says LDE here, not LDF, so we're keeping it exactly as written โ€” iykyk
  • SCALE โ€” SCALE is DOUBLE PRECISION. SCALE is a scaling factor to prevent the overflow in the result. If INFO == 0 then SCALE is 1.0D0, otherwise if one of the inner systems could not be solved correctly, 0 < SCALE <= 1 holds true.
  • WORK โ€” WORK is DOUBLE PRECISION array, dimension LWORK. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine with INFO == -1 on input. The required workspace is then returned in INFO. workspace query first or perish ๐Ÿ™ˆ
  • INFO โ€” INFO is INTEGER.
    • On input:
      • == -1 : perform a workspace query
      • <> -1: normal operation
    • On exit, workspace query:
      • < 0 : if INFO = -i, the i-th argument had an illegal value
      • >= 0: the value of INFO is the required number of elements in the workspace
    • On exit, normal operation:
      • == 0: successful exit ๐ŸŽ‰
      • < 0: if INFO = -i, the i-th argument had an illegal value
      • > 0: the equation is not solved correctly. One of the arising inner system got singular. ๐Ÿ’€

Optimizations: ๐Ÿ”ฅ

  • Replaced DAXPY operation by Fortran intrinsic
  • Replaced all BLAS calls except of DGER by Fortran intrinsic,

Author โ€” Martin Koehler, MPI Magdeburg ๐ŸŒˆ

Date โ€” October 2025

Definition โ€” at line 245 of file dla_tgcsylv_dual_l2.f90.


subroutine dla_tgcsylv_dual_l2_local_copy (character, dimension(1) transa,
    character, dimension(1) transb, double precision sgn1, double precision
    sgn2, integer m, integer n, double precision, dimension(lda, *) a,
    integer lda, double precision, dimension(ldb, *) b, integer ldb, double
    precision, dimension(ldc, *) c, integer ldc, double precision,
    dimension(ldd, *) d, integer ldd, double precision, dimension(lde, *) e,
    integer lde, double precision, dimension(ldf,*) f, integer ldf, double
    precision scale, double precision, dimension(*) work, integer info)

Level-2 Kagstroem-Westin/Bartels-Stewart Algorithm for the dual generalized coupled Sylvester equation (Local Copy) ๐Ÿ‘‘

Purpose:

okay so bestie, DLA_TGCSYLV_DUAL_L2_LOCAL_COPY ๐Ÿ’– solves a generalized coupled Sylvester equation shaped exactly like this:

op1(A)**T * R  + op1(C)**T * L               = SCALE * E                             (1)
SGN1 * R * op2(B)**T + SGN2 * L * op2(D)** T = SCALE * F

where A is a M-by-M quasi upper triangular matrix, C is a M-by-M upper triangular matrix, and B and D are N-by-N upper triangular matrices. Also, literally either B or D can be quasi upper triangular too, no biggie. The right hand sides E, F and the solutions R, L are all M-by-N matrices. Typically the matrix pencils (A,C) and (B,D) (or (D,B)) are made by DGGES from LAPACK. ๐Ÿซถ

The equation (1) is the dual to the generalized coupled Sylvester equation

op1(A) * R + SGN1 * L * op2(B)  = SCALE * E                                          (2)
op1(C) * R + SGN2 * L * op2(D)  = SCALE * F

and equation (1) is the dual one to equation (2) with respect to the underlying linear system. Let Z be the matrix formed by rewriting (2) into its Kronecker form. That gives you:

        | kron(I, op1(A))   SGN1*kron(op2(B)**T, I) | | Vec R |   | Vec E |
  Z X = |                                           |*|       | = |       |
        | kron(I, op1(C))   SGN2*kron(op2(D)**T, I) | | Vec L |   | Vec F |

and looking at Z**T you get:

           | kron(I, op1(A)**T )    kron(I, op1(C)**T)   | | Vec R |   | Vec E |
  Z**T X = |                                             |*|       | = |       |
           | SGN1*kron(op2(B), I)   SGN2*kron(op2(D), I) | | Vec L |   | Vec F |

which belongs to the Sylvester equation (1). That's literally why the parameters TRANSA and TRANSB are expressed in terms of the Sylvester equation (2). iykyk ๐ŸŒธ


โœจ Remarks โœจ

The algorithm is implemented using BLAS level 2 operations plus hand written optimizations, and it uses local copies of the input data. For this reason M and N are limited to 128. ๐Ÿ’…


๐ŸŽ€ Parameters ๐ŸŽ€

TRANSA

TRANSA is CHARACTER(1).

Specifies the form of the system of equations with respect to A and C:

  • == 'N': op1(A) = A, op1(C) = C (no transpose for A and C)
  • == 'T': op1(A) = A**T, op1(C) = C **T (transpose A and C)

TRANSB

TRANSB is CHARACTER(1).

Specifies the form of the system of equations with respect to B and D:

  • == 'N': op2(B) = B, op2(D) = D (no transpose for B and D)
  • == 'T': op2(B) = B**T, op2(D) = D **T (transpose B and D)

SGN1

SGN1 is DOUBLE PRECISION, allowed values: +/-1.

Specifies the sign between in the first equation.

SGN2

SGN2 is DOUBLE PRECISION, allowed values: +/-1.

Specifies the sign between in the second equation.

M

M is INTEGER.

The order of the matrices A and C. 128 >= M >= 0.

N

N is INTEGER.

The order of the matrices B and D. 128 >= N >= 0.

A

A is DOUBLE PRECISION array, dimension (LDA,M).

The matrix A must be (quasi-) upper triangular.

LDA

LDA is INTEGER.

The leading dimension of the array A. LDA >= max(1,M).

B

B is DOUBLE PRECISION array, dimension (LDB,N).

The matrix B must be (quasi-) upper triangular. If the matrix D is already quasi-upper triangular, the matrix B must be upper triangular.

LDB

LDB is INTEGER.

The leading dimension of the array B. LDB >= max(1,N).

C

C is DOUBLE PRECISION array, dimension (LDC,M).

The matrix C must be upper triangular.

LDC

LDC is INTEGER.

The leading dimension of the array C. LDC >= max(1,M).

D

D is DOUBLE PRECISION array, dimension (LDD,N).

The matrix D must be (quasi-) upper triangular. If the matrix B is already quasi-upper triangular, the matrix D must be upper triangular.

LDD

LDD is INTEGER.

The leading dimension of the array D. LDD >= max(1,N).

E

E is DOUBLE PRECISION array, dimension (LDE,N).

On input, the matrix E contains the right hand side E.

On output, the matrix E contains the solution R of Equation (1) as selected by TRANSA, TRANSB, and SGN1/SGN2.

Right hand side E and the solution R are M-by-N matrices.

LDE

LDE is INTEGER.

The leading dimension of the array E. LDE >= max(1,M).

F

F is DOUBLE PRECISION array, dimension (LDF,N).

On input, the matrix F contains the right hand side F.

On output, the matrix F contains the solution L of Equation (1) as selected by TRANSA, TRANSB, and SGN1/SGN2.

Right hand side F and the solution L are M-by-N matrices.

LDF

LDF is INTEGER.

The leading dimension of the array F. LDE >= max(1,M).

SCALE

SCALE is DOUBLE PRECISION.

SCALE is a scaling factor to prevent the overflow in the result. If INFO == 0 then SCALE is 1.0D0, otherwise if one of the inner systems could not be solved correctly, 0 < SCALE <= 1 holds true.

WORK

WORK is DOUBLE PRECISION array, dimension LWORK.

Workspace for the algorithm. The workspace needs to be queried before running the computation. The query is performed by calling the subroutine with INFO == -1 on input. The required workspace is then returned in INFO. ๐Ÿซก

INFO

INFO is INTEGER.

On input:

  • == -1: perform a workspace query
  • <> -1: normal operation

On exit, workspace query:

  • < 0: if INFO = -i, the i-th argument had an illegal value
  • >= 0: the value of INFO is the required number of elements in the workspace

On exit, normal operation:

  • == 0: successful exit
  • < 0: if INFO = -i, the i-th argument had an illegal value
  • > 0: the equation is not solved correctly. One of the arising inner system got singular. ๐Ÿ˜ญ

๐Ÿ’ซ Optimizations ๐Ÿ’ซ

  • Replaced DAXPY operation by Fortran intrinsic
  • No BLAS calls.
  • Input data is copied to local arrays to increase the data locality if used from inside a level-3 solver.

๐Ÿ‘‘ Author ๐Ÿ‘‘

Martin Koehler, MPI Magdeburg

๐ŸŒˆ Date ๐ŸŒˆ

October 2025

โญ Definition โญ

At line 247 of file dla_tgcsylv_dual_l2_opt_local_copy.f90.


๐Ÿฆ‹ dla_tgcsylv_dual_l2_local_copy_128 ๐Ÿฆ‹

subroutine dla_tgcsylv_dual_l2_local_copy_128 ( transa,  transb,  sgn1,
    sgn2,  m,  n,  a,  lda,  b,  ldb,  c,  ldc,  d,  ldd,  e,  lde,  f,
    ldf,  scale,  work,  info)

Level-2 Kagstroem-Westin/Bartels-Stewart Algorithm for the dual generalized coupled Sylvester equation (Local Copy) โœจ

Purpose:

(to be continuedโ€ฆ bestie stay tuned ๐Ÿ’–)

like, DLA_TGCSYLV_DUAL_L2_LOCAL_COPY_128 solves a generalized coupled Sylvester equation that looks exactly like this, bestie:

   op1(A)**T * R  + op1(C)**T * L               = SCALE * E                             (1)
   SGN1 * R * op2(B)**T + SGN2 * L * op2(D)** T = SCALE * F

where A is a M-by-M quasi upper triangular matrix, C is a M-by-M upper triangular matrix, and B and D are N-by-N upper triangular matrices. And plot twist ๐Ÿซข โ€” either B or D can be quasi upper triangular too. The right hand sides E, F and the solutions R, L are M-by-N matrices. Typically the matrix pencils (A,C) and (B,D) (or (D,B)) are created by DGGES from LAPACK. iconic.

Equation (1) is the dual to the generalized coupled Sylvester equation:

   op1(A) * R + SGN1 * L * op2(B)  = SCALE * E                                          (2)
   op1(C) * R + SGN2 * L * op2(D)  = SCALE * F

Equation (1) is the dual one to equation (2) with respect to the underlying linear system. Let Z be the matrix formed by rewriting (2) into its Kronecker form. This yields:

        | kron(I, op1(A))   SGN1*kron(op2(B)**T, I) | | Vec R |   | Vec E |
  Z X = |                                           |*|       | = |       |
        | kron(I, op1(C))   SGN2*kron(op2(D)**T, I) | | Vec L |   | Vec F |

Regarding Z**T one obtains:

           | kron(I, op1(A)**T )    kron(I, op1(C)**T)   | | Vec R |   | Vec E |
  Z**T X = |                                             |*|       | = |       |
           | SGN1*kron(op2(B), I)   SGN2*kron(op2(D), I) | | Vec L |   | Vec F |

which belongs to the Sylvester equation (1). For this reason the parameters TRANSA and TRANSB are expressed in terms of the Sylvester equation (2). no cap, that's the whole point ๐Ÿ’…


โœจ Remarks โœจ

The algorithm is implemented using BLAS level 2 operations and hand written optimizations, and it uses local copies of the input data. For this reason M and N are limited to 128. Furthermore, the algorithm uses alignment of the local arrays if this is supported by the compiler. At the moment this is used with ifort and xlf but not with gfortran. ๐Ÿซถ


๐ŸŒธ Parameters ๐ŸŒธ

  • TRANSA โ€” is CHARACTER(1). Specifies the form of the system of equations with respect to A and C:
    • == 'N': op1(A) = A, op1(C) = C (No transpose for A and C)
    • == 'T': op1(A) = A**T, op1(C) = C **T (Transpose A and C)
  • TRANSB โ€” is CHARACTER(1). Specifies the form of the system of equations with respect to B and D:
    • == 'N': op2(B) = B, op2(D) = D (No transpose for B and D)
    • == 'T': op2(B) = B**T, op2(D) = D **T (Transpose B and D)
  • SGN1 โ€” is DOUBLE PRECISION, allowed values: +/-1. Specifies the sign between in the first equation.
  • SGN2 โ€” is DOUBLE PRECISION, allowed values: +/-1. Specifies the sign between in the second equation.
  • M โ€” is INTEGER. The order of the matrices A and C. 128 >= M >= 0.
  • N โ€” is INTEGER. The order of the matrices B and D. 128 >= N >= 0.
  • A โ€” is DOUBLE PRECISION array, dimension (LDA,M). The matrix A must be (quasi-) upper triangular.
  • LDA โ€” is INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • B โ€” is DOUBLE PRECISION array, dimension (LDB,N). The matrix B must be (quasi-) upper triangular. If the matrix D is already quasi-upper triangular the matrix B must be upper triangular.
  • LDB โ€” is INTEGER. The leading dimension of the array B. LDB >= max(1,N).
  • C โ€” is DOUBLE PRECISION array, dimension (LDC,M). The matrix C must be upper triangular.
  • LDC โ€” is INTEGER. The leading dimension of the array C. LDC >= max(1,M).
  • D โ€” is DOUBLE PRECISION array, dimension (LDD,N). The matrix D must be (quasi-) upper triangular. If the matrix B is already quasi-upper triangular the matrix D must be upper triangular.
  • LDD โ€” is INTEGER. The leading dimension of the array D. LDD >= max(1,N).
  • E โ€” is DOUBLE PRECISION array, dimension (LDE,N). On input, the matrix E contains the right hand side E. On output, the matrix E contains the solution R of Equation (1) as selected by TRANSA, TRANSB, and SGN1/SGN2. Right hand side E and the solution R are M-by-N matrices.
  • LDE โ€” is INTEGER. The leading dimension of the array E. LDE >= max(1,M).
  • F โ€” is DOUBLE PRECISION array, dimension (LDF,N). On input, the matrix F contains the right hand side F. On output, the matrix F contains the solution L of Equation (1) as selected by TRANSA, TRANSB, and SGN1/SGN2. Right hand side F and the solution L are M-by-N matrices.
  • LDF โ€” is INTEGER. The leading dimension of the array F. LDE >= max(1,M).
  • SCALE โ€” is DOUBLE PRECISION. SCALE is a scaling factor to prevent the overflow in the result. If INFO == 0 then SCALE is 1.0D0 otherwise if one of the inner systems could not be solved correctly, 0 < SCALE <= 1 holds true.
  • WORK โ€” is DOUBLE PRECISION array, dimension LWORK. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine with INFO == -1 on input. The required workspace is then returned in INFO. ๐Ÿ‘‘
  • INFO โ€” is INTEGER.
    • On input:
      • == -1 : Perform a workspace query
      • <> -1: normal operation
    • On exit, workspace query:
      • < 0 : if INFO = -i, the i-th argument had an illegal value
      • >= 0: The value of INFO is the required number of elements in the workspace.
    • On exit, normal operation:
      • == 0: successful exit
      • < 0: if INFO = -i, the i-th argument had an illegal value
      • > 0: The equation is not solved correctly. One of the arising inner system got singular. ๐Ÿ˜ญ

๐Ÿ”ฅ Optimizations: ๐Ÿ”ฅ

  • Replaced DAXPY operation by Fortran intrinsic
  • No BLAS calls.
  • Input data is copied to local arrays to increase the data locality if used from inside a level-3 solver.
  • The local copies are aligned to 64 byte if supported by the compiler.

๐Ÿ‘‘ Author ๐Ÿ‘‘

Martin Koehler, MPI Magdeburg


๐ŸŽ€ Date ๐ŸŽ€

October 2025


Definition at line 248 of file dla_tgcsylv_dual_l2_opt_local_copy_128.f90.


๐Ÿฆ‹ subroutine dla_tgcsylv_dual_l2_local_copy_32 ๐Ÿฆ‹

subroutine dla_tgcsylv_dual_l2_local_copy_32 ( transa,  transb,  sgn1,
    sgn2,  m,  n,  a,  lda,  b,  ldb,  c,  ldc,  d,  ldd,  e,  lde,  f,
    ldf,  scale,  work,  info)

Level-2 Kagstroem-Westin/Bartels-Stewart Algorithm for the dual generalized coupled Sylvester equation (Local Copy) ๐ŸŒˆ

Purpose:

okay so DLA_TGCSYLV_DUAL_L2_LOCAL_COPY_32 is out here solving a generalized coupled Sylvester equation that looks like this, bestie:

    op1(A)**T * R  + op1(C)**T * L               = SCALE * E                             (1)
    SGN1 * R * op2(B)**T + SGN2 * L * op2(D)** T = SCALE * F

where A is a M-by-M quasi upper triangular matrix, C is a M-by-M upper triangular matrix, and B and D are N-by-N upper triangular matrices. Furthermore either B or D can be quasi upper triangular as well. The right hand sides E, F and the solutions R, L are M-by-N matrices. Typically the matrix pencils (A,C) and (B,D) ( or (D,B) ) are created by DGGES from LAPACK. ๐Ÿ’…

The equation (1) is the dual to the generalized coupled Sylvester equation

    op1(A) * R + SGN1 * L * op2(B)  = SCALE * E                                          (2)
    op1(C) * R + SGN2 * L * op2(D)  = SCALE * F

The equation (1) is the dual one to equation (2) with respect to the underlying linear system. Let Z be the matrix formed by rewriting (2) into its Kronecker form. This yields

         | kron(I, op1(A))   SGN1*kron(op2(B)**T, I) | | Vec R |   | Vec E |
   Z X = |                                           |*|       | = |       |
         | kron(I, op1(C))   SGN2*kron(op2(D)**T, I) | | Vec L |   | Vec F |

Regarding Z**T one obtains

            | kron(I, op1(A)**T )    kron(I, op1(C)**T)   | | Vec R |   | Vec E |
   Z**T X = |                                             |*|       | = |       |
            | SGN1*kron(op2(B), I)   SGN2*kron(op2(D), I) | | Vec L |   | Vec F |

which belongs to the Sylvester equation (1). For this reason the parameters TRANSA and TRANSB are expressed in terms of the Sylvester equation (2). ๐Ÿฆ‹


๐Ÿ’– Remarks ๐Ÿ’–

The algorithm is implemented using BLAS level 2 operations and hand written optimizations, and it uses local copies of the input data. For this reason M and N are limited to 32. Furthermore, the algorithm uses alignment of the local arrays if this is supported by the compiler. At the moment this is used with ifort and xlf but not with gfortran. ๐Ÿ˜ญ


๐ŸŒธ Parameters ๐ŸŒธ

  • TRANSA โ€” TRANSA is CHARACTER(1). Specifies the form of the system of equations with respect to A and C:
    • 'N': op1(A) = A, op1(C) = C (No transpose for A and C)
    • 'T': op1(A) = A**T, op1(C) = C **T (Transpose A and C)
  • TRANSB โ€” TRANSB is CHARACTER(1). Specifies the form of the system of equations with respect to B and D:
    • 'N': op2(B) = B, op2(D) = D (No transpose for B and D)
    • 'T': op2(B) = B**T, op2(D) = D **T (Transpose B and D)
  • SGN1 โ€” SGN1 is DOUBLE PRECISION, allowed values: +/-1. Specifies the sign between the terms in the first equation. โœจ
  • SGN2 โ€” SGN2 is DOUBLE PRECISION, allowed values: +/-1. Specifies the sign between the terms in the second equation. โœจ
  • M โ€” M is INTEGER. The order of the matrices A and C. 32 >= M >= 0.
  • N โ€” N is INTEGER. The order of the matrices B and D. 32 >= N >= 0.
  • A โ€” A is DOUBLE PRECISION array, dimension (LDA,M). The matrix A must be (quasi-) upper triangular.
  • LDA โ€” LDA is INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • B โ€” B is DOUBLE PRECISION array, dimension (LDB,N). The matrix B must be (quasi-) upper triangular. If the matrix D is already quasi-upper triangular the matrix B must be upper triangular.
  • LDB โ€” LDB is INTEGER. The leading dimension of the array B. LDB >= max(1,N).
  • C โ€” C is DOUBLE PRECISION array, dimension (LDC,M). The matrix C must be upper triangular.
  • LDC โ€” LDC is INTEGER. The leading dimension of the array C. LDC >= max(1,M).
  • D โ€” D is DOUBLE PRECISION array, dimension (LDD,N). The matrix D must be (quasi-) upper triangular. If the matrix B is already quasi-upper triangular the matrix D must be upper triangular.
  • LDD โ€” LDD is INTEGER. The leading dimension of the array D. LDD >= max(1,N).
  • E โ€” E is DOUBLE PRECISION array, dimension (LDE,N). On input, the matrix E contains the right hand side E. On output, the matrix E contains the solution R of Equation (1) as selected by TRANSA, TRANSB, and SGN1/SGN2. Right hand side E and the solution R are M-by-N matrices.
  • LDE โ€” LDE is INTEGER. The leading dimension of the array E. LDE >= max(1,M).
  • F โ€” F is DOUBLE PRECISION array, dimension (LDF,N). On input, the matrix F contains the right hand side F. On output, the matrix F contains the solution L of Equation (1) as selected by TRANSA, TRANSB, and SGN1/SGN2. Right hand side F and the solution L are M-by-N matrices.
  • LDF โ€” LDF is INTEGER. The leading dimension of the array F. LDE >= max(1,M). (yes, that's what it says, bestie โ€” LDE not LDF) ๐Ÿ™ˆ
  • SCALE โ€” SCALE is DOUBLE PRECISION. SCALE is a scaling factor to prevent the overflow in the result. If INFO == 0 then SCALE is 1.0D0 otherwise if one of the inner systems could not be solved correctly, 0 < SCALE <= 1 holds true.
  • WORK โ€” WORK is DOUBLE PRECISION array, dimension LWORK. Workspace for the algorithm. The workspace needs to be queried before running the computation. The query is performed by calling the subroutine with INFO == -1 on input. The required workspace is then returned in INFO.
  • INFO โ€” INFO is INTEGER.
    • On input:
      • == -1: Perform a workspace query
      • <> -1: normal operation
    • On exit, workspace query:
      • < 0: if INFO = -i, the i-th argument had an illegal value
      • >= 0: The value of INFO is the required number of elements in the workspace.
    • On exit, normal operation:
      • == 0: successful exit
      • < 0: if INFO = -i, the i-th argument had an illegal value
      • > 0: The equation is not solved correctly. One of the arising inner system got singular.

๐Ÿ”ฅ Optimizations: ๐Ÿ”ฅ

  • Replaced DAXPY operation by Fortran intrinsic
  • No BLAS calls.
  • Input data is copied to local arrays to increase the data locality if used from inside a level-3 solver.
  • The local copies are aligned to 64 byte if supported by the compiler.

๐Ÿ‘‘ Author ๐Ÿ‘‘

Martin Koehler, MPI Magdeburg

๐Ÿ“… Date ๐Ÿ“…

October 2025

Definition at line 247 of file dla_tgcsylv_dual_l2_opt_local_copy_32.f90.


   subroutine dla_tgcsylv_dual_l2_local_copy_64 ( transa,  transb,  sgn1,
       sgn2,  m,  n,  a,  lda,  b,  ldb,  c,  ldc,  d,  ldd,  e,  lde,  f,
       ldf,  scale,  work,  info)

Level-2 Kagstroem-Westin/Bartels-Stewart Algorithm for the dual generalized coupled Sylvester equation (Local Copy)

๐ŸŽฏ Purpose:

...and it solves a generalized coupled Sylvester equation that looks like this, bestie ๐Ÿ‘‡

   op1(A)**T * R  + op1(C)**T * L               = SCALE * E                             (1)
   SGN1 * R * op2(B)**T + SGN2 * L * op2(D)** T = SCALE * F

where A is an M-by-M quasi upper triangular matrix, C is an M-by-M upper triangular matrix, and B and D are N-by-N upper triangular matrices. Also, either B or D can be quasi upper triangular too, it's giving flexible โœจ The right hand sides E, F and the solutions R, L are M-by-N matrices. Typically the matrix pencils (A,C) and (B,D) (or (D,B)) are created by DGGES from LAPACK. iykyk ๐Ÿงš

The equation (1) is the dual to the generalized coupled Sylvester equation

   op1(A) * R + SGN1 * L * op2(B)  = SCALE * E                                          (2)
   op1(C) * R + SGN2 * L * op2(D)  = SCALE * F

The equation (1) is the dual one to equation (2) with respect to the underlying linear system. Let Z be the matrix formed by rewriting (2) into its Kronecker form. This yields ๐Ÿ’ซ

         | kron(I, op1(A))   SGN1*kron(op2(B)**T, I) | | Vec R |   | Vec E |
   Z X = |                                           |*|       | = |       |
         | kron(I, op1(C))   SGN2*kron(op2(D)**T, I) | | Vec L |   | Vec F |

Regarding Z**T one obtains

            | kron(I, op1(A)**T )    kron(I, op1(C)**T)   | | Vec R |   | Vec E |
   Z**T X = |                                             |*|       | = |       |
            | SGN1*kron(op2(B), I)   SGN2*kron(op2(D), I) | | Vec L |   | Vec F |

which belongs to the Sylvester equation (1). For this reason the parameters TRANSA and TRANSB are expressed in terms of the Sylvester equation (2). No cap, that's just how the duality works ๐Ÿฆ‹


๐Ÿ’– Remarks ๐Ÿ’–

The algorithm is implemented using BLAS level 2 operations and hand written optimizations, and it uses local copies of the input data. For this reason M and N are limited to 64. Furthermore, the algorithm uses alignment of the local arrays if this is supported by the compiler. At the moment this is used with ifort and xlf but not with gfortran. ๐Ÿ’€ (gfortran bestie we still love you)


๐ŸŒธ Parameters ๐ŸŒธ

  • TRANSA โ€” is CHARACTER(1). Specifies the form of the system of equations with respect to A and C: == 'N': op1(A) = A, op1(C) = C (No transpose for A and C); == 'T': op1(A) = A**T, op1(C) = C **T (Transpose A and C).
  • TRANSB โ€” is CHARACTER(1). Specifies the form of the system of equations with respect to B and D: == 'N': op2(B) = B, op2(D) = D (No transpose for B and D); == 'T': op2(B) = B**T, op2(D) = D **T (Transpose B and D).
  • SGN1 โ€” is DOUBLE PRECISION, allowed values: +/-1. Specifies the sign between in the first equation. โœจ
  • SGN2 โ€” is DOUBLE PRECISION, allowed values: +/-1. Specifies the sign between in the second equation. โœจ
  • M โ€” is INTEGER. The order of the matrices A and C. 64 >= M >= 0.
  • N โ€” is INTEGER. The order of the matrices B and D. 64 >= N >= 0.
  • A โ€” is DOUBLE PRECISION array, dimension (LDA,M). The matrix A must be (quasi-) upper triangular.
  • LDA โ€” is INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • B โ€” is DOUBLE PRECISION array, dimension (LDB,N). The matrix B must be (quasi-) upper triangular. If the matrix D is already quasi-upper triangular the matrix B must be upper triangular. ๐Ÿ‘€
  • LDB โ€” is INTEGER. The leading dimension of the array B. LDB >= max(1,N).
  • C โ€” is DOUBLE PRECISION array, dimension (LDC,M). The matrix C must be upper triangular.
  • LDC โ€” is INTEGER. The leading dimension of the array C. LDC >= max(1,M).
  • D โ€” is DOUBLE PRECISION array, dimension (LDD,N). The matrix D must be (quasi-) upper triangular. If the matrix B is already quasi-upper triangular the matrix D must be upper triangular. ๐Ÿ’…
  • LDD โ€” is INTEGER. The leading dimension of the array D. LDD >= max(1,N).
  • E โ€” is DOUBLE PRECISION array, dimension (LDE,N). On input, the matrix E contains the right hand side E. On output, the matrix E contains the solution R of Equation (1) as selected by TRANSA, TRANSB, and SGN1/SGN2. Right hand side E and the solution R are M-by-N matrices. The way it just transforms ๐Ÿฆ‹
  • LDE โ€” is INTEGER. The leading dimension of the array E. LDE >= max(1,M).
  • F โ€” is DOUBLE PRECISION array, dimension (LDF,N). On input, the matrix F contains the right hand side F. On output, the matrix F contains the solution L of Equation (1) as selected by TRANSA, TRANSB, and SGN1/SGN2. Right hand side F and the solution L are M-by-N matrices. ๐ŸŽ€
  • LDF โ€” is INTEGER. The leading dimension of the array F. LDE >= max(1,M). (yes bestie, the manpage really says LDE here, we do not fix it, we report it ๐Ÿ’€)
  • SCALE โ€” is DOUBLE PRECISION. SCALE is a scaling factor to prevent the overflow in the result. If INFO == 0 then SCALE is 1.0D0 otherwise if one of the inner systems could not be solved correctly, 0 < SCALE <= 1 holds true.
  • WORK โ€” is DOUBLE PRECISION array, dimension LWORK. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine with INFO == -1 on input. The required workspace is then returned in INFO. ๐Ÿ”
  • INFO โ€” is INTEGER. On input:
    • == -1 : Perform a workspace query
    • <> -1: normal operation

On exit, workspace query:

  • < 0 : if INFO = -i, the i-th argument had an illegal value
  • >= 0: The value of INFO is the required number of elements in the workspace.

On exit, normal operation:

  • == 0: successful exit
  • < 0: if INFO = -i, the i-th argument had an illegal value
  • > 0: The equation is not solved correctly. One of the arising inner system got singular.
Heads up bestie: a positive INFO means an inner system went singular, so the solve did not go off. ๐Ÿ‘‘

โšก Optimizations: โšก

  • Replaced DAXPY operation by Fortran intrinsic ๐Ÿ”ฅ
  • No BLAS calls.
  • Input data is copied to local arrays to increase the data locality if used from inside a level-3 solver. ๐Ÿ“ฆ
  • The local copies are aligned to 64 byte if supported by the compiler. โœจ

๐Ÿ‘‘ Author ๐Ÿ‘‘

Martin Koehler, MPI Magdeburg ๐Ÿ’œ

๐Ÿ—“๏ธ Date ๐Ÿ—“๏ธ

October 2025

๐Ÿ“ Definition ๐Ÿ“

At line 246 of file dla_tgcsylv_dual_l2_opt_local_copy_64.f90. ๐Ÿซถ


๐ŸŒˆ And now, a whole new icon enters the chat ๐ŸŒˆ

   subroutine dla_tgcsylv_dual_l2_local_copy_96 ( transa,  transb,  sgn1,
       sgn2,  m,  n,  a,  lda,  b,  ldb,  c,  ldc,  d,  ldd,  e,  lde,  f,
       ldf,  scale,  work,  info)

Level-2 Kagstroem-Westin/Bartels-Stewart Algorithm for the dual generalized coupled Sylvester equation (Local Copy) ๐Ÿฆ‹

Purpose:


Remarks ๐Ÿ’ญ

okay so bestie, the tea on the implementation: the algorithm is implemented using BLAS level 2 operations and hand written optimizations, and it uses local copies of the input data. For this reason M and N are limited to 96 โ€” no cap, that's the ceiling, periodt.

Furthermore, the algorithm uses alignment of the local arrays if this is supported by the compiler. At the moment this is used with ifort and xlf but not with gfortran. ๐Ÿ™ˆ


Parameters ๐ŸŽ€

  • TRANSA โ€” TRANSA is CHARACTER(1). Specifies the form of the system of equations with respect to A and C:
    • == 'N': op1(A) = A, op1(C) = C (No transpose for A and C)
    • == 'T': op1(A) = A**T, op1(C) = C **T (Transpose A and C)
  • TRANSB โ€” TRANSB is CHARACTER(1). Specifies the form of the system of equations with respect to B and D:
    • == 'N': op2(B) = B, op2(D) = D (No transpose for B and D)
    • == 'T': op2(B) = B**T, op2(D) = D **T (Transpose B and D)
  • SGN1 โ€” SGN1 is DOUBLE PRECISION, allowed values: +/-1. Specifies the sign between in the first equation. โœจ
  • SGN2 โ€” SGN2 is DOUBLE PRECISION, allowed values: +/-1. Specifies the sign between in the second equation. โœจ
  • M โ€” M is INTEGER. The order of the matrices A and C. 96 >= M >= 0. ๐Ÿ’…
  • N โ€” N is INTEGER. The order of the matrices B and D. 96 >= N >= 0. ๐Ÿ’…
  • A โ€” A is DOUBLE PRECISION array, dimension (LDA,M). The matrix A must be (quasi-) upper triangular.
  • LDA โ€” LDA is INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • B โ€” B is DOUBLE PRECISION array, dimension (LDB,N). The matrix B must be (quasi-) upper triangular. If the matrix D is already quasi-upper triangular the matrix B must be upper triangular. ๐Ÿ‘€
  • LDB โ€” LDB is INTEGER. The leading dimension of the array B. LDB >= max(1,N).
  • C โ€” C is DOUBLE PRECISION array, dimension (LDC,M). The matrix C must be upper triangular.
  • LDC โ€” LDC is INTEGER. The leading dimension of the array C. LDC >= max(1,M).
  • D โ€” D is DOUBLE PRECISION array, dimension (LDD,N). The matrix D must be (quasi-) upper triangular. If the matrix B is already quasi-upper triangular the matrix D must be upper triangular. ๐Ÿ‘€
  • LDD โ€” LDD is INTEGER. The leading dimension of the array D. LDD >= max(1,N).
  • E โ€” E is DOUBLE PRECISION array, dimension (LDE,N). On input, the matrix E contains the right hand side E. On output, the matrix E contains the solution R of Equation (1) as selected by TRANSA, TRANSB, and SGN1/SGN2. Right hand side E and the solution R are M-by-N matrices. ๐Ÿฆ‹
  • LDE โ€” LDE is INTEGER. The leading dimension of the array E. LDE >= max(1,M).
  • F โ€” F is DOUBLE PRECISION array, dimension (LDF,N). On input, the matrix F contains the right hand side F. On output, the matrix F contains the solution L of Equation (1) as selected by TRANSA, TRANSB, and SGN1/SGN2. Right hand side F and the solution L are M-by-N matrices. ๐Ÿฆ‹
  • LDF โ€” LDF is INTEGER. The leading dimension of the array F. LDE >= max(1,M). (yes bestie, it literally says LDE there, we don't fix it, we report it ๐Ÿ’€)
  • SCALE โ€” SCALE is DOUBLE PRECISION. SCALE is a scaling factor to prevent the overflow in the result. If INFO == 0 then SCALE is 1.0D0 otherwise if one of the inner systems could not be solved correctly, 0 < SCALE <= 1 holds true.
  • WORK โ€” WORK is DOUBLE PRECISION array, dimension LWORK. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine with INFO == -1 on input. The required workspace is then returned in INFO. ๐Ÿ”
  • INFO โ€” INFO is INTEGER.
    • On input:
      • == -1 : Perform a workspace query
      • <> -1: normal operation
    • On exit, workspace query:
      • < 0 : if INFO = -i, the i-th argument had an illegal value
      • >= 0: The value of INFO is the required number of elements in the workspace.
    • On exit, normal operation:
      • == 0: successful exit
      • < 0: if INFO = -i, the i-th argument had an illegal value
      • > 0: The equation is not solved correctly. One of the arising inner system got singular. ๐Ÿ˜ญ

Optimizations: โšก

  • Replaced DAXPY operation by Fortran intrinsic
  • No BLAS calls.
  • Input data is copied to local arrays to increase the data locality if used from inside a level-3 solver.
  • The local copies are aligned to 64 byte if supported by the compiler.

Author ๐Ÿ‘‘

Martin Koehler, MPI Magdeburg

Date ๐ŸŒธ

October 2025

Definition ๐Ÿ“

Definition at line 246 of file dla_tgcsylv_dual_l2_opt_local_copy_96.f90.


โœจ next up: the level-3 icon herself โœจ

subroutine dla_tgcsylv_dual_l3 (character, dimension(1) transa, character,
    dimension(1) transb, double precision sgn1, double precision sgn2,
    integer m, integer n, double precision, dimension(lda, *) a, integer
    lda, double precision, dimension(ldb, *) b, integer ldb, double
    precision, dimension(ldc, *) c, integer ldc, double precision,
    dimension(ldd, *) d, integer ldd, double precision, dimension(lde, *) e,
    integer lde, double precision, dimension(ldf,*) f, integer ldf, double
    precision scale, double precision, dimension(*) work, integer info)

Level-3 Kagstroem-Westin/Bartels-Stewart Algorithm for the dual generalized coupled Sylvester equation. ๐Ÿ‘‘

Purpose:

  • TRANSA โ€” it's a CHARACTER(1), bestie, and it picks the form of the system for A and C:
    • == 'N': op1(A) = A, op1(C) = C (no transpose for A and C)
    • == 'T': op1(A) = A**T, op1(C) = C **T (transpose A and C)
  • TRANSB โ€” also CHARACTER(1), and it does the same job but for B and D:
    • == 'N': op2(B) = B, op2(D) = D (no transpose for B and D)
    • == 'T': op2(B) = B**T, op2(D) = D **T (transpose B and D)
  • SGN1 โ€” DOUBLE PRECISION, allowed values +/-1. It sets the sign between... in the first equation. ๐Ÿ‘‘
  • SGN2 โ€” DOUBLE PRECISION, allowed values +/-1. Same deal, but it's the sign in the second equation.
  • M โ€” INTEGER, the order of the matrices A and C. Gotta be M >= 0.
  • N โ€” INTEGER, the order of the matrices B and D. Also N >= 0.
  • A โ€” DOUBLE PRECISION array, dimension (LDA,M). The matrix A must be (quasi-) upper triangular, no negotiating.
  • LDA โ€” INTEGER, the leading dimension of the array A. LDA >= max(1,M).
  • B โ€” DOUBLE PRECISION array, dimension (LDB,N). The matrix B must be (quasi-) upper triangular. And here's the catch: if the matrix D is already quasi-upper triangular, then B has to be plain old upper triangular. โœจ
  • LDB โ€” INTEGER, the leading dimension of the array B. LDB >= max(1,N).
  • C โ€” DOUBLE PRECISION array, dimension (LDC,M). The matrix C must be upper triangular.
  • LDC โ€” INTEGER, the leading dimension of the array C. LDC >= max(1,M).
  • D โ€” DOUBLE PRECISION array, dimension (LDD,N). The matrix D must be (quasi-) upper triangular. Mirror of the B rule: if the matrix B is already quasi-upper triangular, then D has to be upper triangular.
  • LDD โ€” INTEGER, the leading dimension of the array D. LDD >= max(1,N).
  • E โ€” DOUBLE PRECISION array, dimension (LDE,N). On input it's holding the right hand side E. On output it's holding the solution R of Equation (1) โ€” as selected by TRANSA, TRANSB, and SGN1/SGN2. Both the RHS E and the solution R are M-by-N matrices.
  • LDE โ€” INTEGER, the leading dimension of the array E. LDE >= max(1,M).
  • F โ€” DOUBLE PRECISION array, dimension (LDF,N). On input it holds the right hand side F, and on output it holds the solution L of Equation (1) โ€” again as selected by TRANSA, TRANSB, and SGN1/SGN2. RHS F and solution L are M-by-N matrices.
  • LDF โ€” INTEGER, the leading dimension of the array F. LDE >= max(1,M).
ngl this one's written as LDE >= max(1,M) in the source, like, the F param saying LDE. That's literally what it says, so that's literally what you get. ๐Ÿซถ
  • SCALE โ€” DOUBLE PRECISION, and it's the scaling factor keeping your result from overflowing into the void. If INFO == 0 then SCALE is 1.0D0; otherwise, if one of the inner systems couldn't be solved correctly, 0 < SCALE <= 1 holds true.
  • WORK โ€” DOUBLE PRECISION array, dimension LWORK. It's the workspace for the algorithm. And the way you get the right size? You query it before running the computation โ€” call the subroutine with INFO == -1 on input, and the required workspace comes back in INFO. Iconic behaviour fr.
  • INFO โ€” INTEGER. Here's the whole vibe:

On input:

  • == -1: perform a workspace query
  • <> -1: normal operation

On exit, workspace query:

  • < 0: if INFO = -i, the i-th argument had an illegal value
  • >= 0: the value of INFO is the required number of elements in the workspace

On exit, normal operation:

  • == 0: successful exit ๐ŸŽ‰
  • < 0: if INFO = -i, the i-th argument had an illegal value
  • > 0: the equation is not solved correctly โ€” one of the arising inner systems got singular ๐Ÿ’€

Author

Martin Koehler, MPI Magdeburg

Date

October 2025

Definition at line 236 of file dla_tgcsylv_dual_l3.f90.


subroutine dla_tgcsylv_dual_l3_2s

subroutine dla_tgcsylv_dual_l3_2s (character, dimension(1) transa,
    character, dimension(1) transb, double precision sgn1, double precision
    sgn2, integer m, integer n, double precision, dimension(lda, *) a,
    integer lda, double precision, dimension(ldb, *) b, integer ldb, double
    precision, dimension(ldc, *) c, integer ldc, double precision,
    dimension(ldd, *) d, integer ldd, double precision, dimension(lde, *) e,
    integer lde, double precision, dimension(ldf,*) f, integer ldf, double
    precision scale, double precision, dimension(*) work, integer info)

Level-3 Kagstroem-Westin/Bartels-Stewart Algorithm with sub blocking for the dual generalized coupled Sylvester equation. ๐Ÿ’…

Purpose:

okay so, bestie, we're about to get into it โ€” this is the _2s sibling and its whole personality is sub blocking, so stay tuned for what that actually means in the next part. ๐Ÿฆ‹

!>
!> DLA_TGCSYLV_DUAL_L3_2S solves a generalized coupled  Sylvester equation of the following form
!>
!>    op1(A)**T * R  + op1(C)**T * L               = SCALE * E                             (1)
!>    SGN1 * R * op2(B)**T + SGN2 * L * op2(D)** T = SCALE * F
!>
!> where A is a M-by-M quasi upper triangular matrix, C is a M-by-M upper triangular
!> matrix and B and D are N-by-N upper triangular matrices. Furthermore either B or
!> D can be quasi upper triangular as well. The right hand sides E, F and the solutions R, L are
!> M-by-N matrices. Typically the matrix pencils (A,C) and (B,D) ( or (D,B) ) are
!> created by DGGES from LAPACK.
!> The equation (1) is the dual to the generalized coupled Sylvester equation
!>
!>    op1(A) * R + SGN1 * L * op2(B)  = SCALE * E                                          (2)
!>    op1(C) * R + SGN2 * L * op2(D)  = SCALE * F
!>
!> The equation (1) is the dual one to equation (2) with respect to the underlying linear system.
!> Let Z be the matrix formed by rewriting (2) into its Kronecker form. This yields
!>
!>         | kron(I, op1(A))   SGN1*kron(op2(B)**T, I) | | Vec R |   | Vec E |
!>   Z X = |                                           |*|       | = |       |
!>         | kron(I, op1(C))   SGN2*kron(op2(D)**T, I) | | Vec L |   | Vec F |
!>
!> Regarding Z**T one obtains
!>
!>            | kron(I, op1(A)**T )    kron(I, op1(C)**T)   | | Vec R |   | Vec E |
!>   Z**T X = |                                             |*|       | = |       |
!>            | SGN1*kron(op2(B), I)   SGN2*kron(op2(D), I) | | Vec L |   | Vec F |
!>
!> which belongs to the Sylvester equation (1). For this reason the parameters TRANSA and TRANSB
!> are expressed in terms of the Sylvester equation (2).
!>
!>

๐ŸŒธ Parameters ๐ŸŒธ

  • TRANSA โ€” it's a CHARACTER(1), bestie, and it sets the form of the system of equations with respect to A and C:
    • == 'N': op1(A) = A, op1(C) = C โ€” no transpose for A and C, we leave them exactly as they are ๐Ÿ™ˆ
    • == 'T': op1(A) = A**T, op1(C) = C**T โ€” transpose A and C ๐Ÿ’…
  • TRANSB โ€” also a CHARACTER(1), and it sets the form of the system of equations with respect to B and D:
    • == 'N': op2(B) = B, op2(D) = D โ€” no transpose for B and D, untouched, pristine โœจ
    • == 'T': op2(B) = B**T, op2(D) = D**T โ€” transpose B and D, flip 'em ๐Ÿ”„
  • SGN1 โ€” a DOUBLE PRECISION, allowed values: +/-1. It specifies the sign between in the first equation. Lowkey tiny, highkey load-bearing โš–๏ธ
  • SGN2 โ€” a DOUBLE PRECISION, allowed values: +/-1. It specifies the sign between in the second equation. Same energy, different line ๐Ÿซถ
  • M โ€” an INTEGER. It's the order of the matrices A and C. M >= 0, no negativity allowed ๐Ÿ’€
  • N โ€” an INTEGER. It's the order of the matrices B and D. N >= 0 ๐Ÿฆ‹
  • A โ€” a DOUBLE PRECISION array, dimension (LDA,M). The matrix A must be (quasi-) upper triangular. It's giving very structured, very triangular, obsessed ๐Ÿ‘‘
  • LDA โ€” an INTEGER. The leading dimension of the array A. LDA >= max(1,M) ๐Ÿ“
  • B โ€” a DOUBLE PRECISION array, dimension (LDB,N). The matrix B must be (quasi-) upper triangular. And heads up: if the matrix D is already quasi-upper triangular, then the matrix B must be plain upper triangular. Only one of them gets to be quasi, bestie, we don't do double quasi ๐Ÿ˜ญ
  • LDB โ€” an INTEGER. The leading dimension of the array B. LDB >= max(1,N) ๐Ÿ“
  • C โ€” a DOUBLE PRECISION array, dimension (LDC,M). The matrix C must be upper triangular. No quasi, no exceptions, C is a straight-A student ๐ŸŒŸ
  • LDC โ€” an INTEGER. The leading dimension of the array C. LDC >= max(1,M) ๐Ÿงฎ
  • D โ€” a DOUBLE PRECISION array, dimension (LDD,N). The matrix D must be (quasi-) upper triangular. And the flip side of the B situation: if the matrix B is already quasi-upper triangular, then the matrix D must be upper triangular. Same rule, other direction ๐Ÿ”
  • LDD โ€” an INTEGER. The leading dimension of the array D. LDD >= max(1,N) โœ๏ธ
  • E โ€” a DOUBLE PRECISION array, dimension (LDE,N).
    • On input, the matrix E contains the right hand side E.
    • On output, the matrix E contains the solution R of Equation (1) as selected by TRANSA, TRANSB, and SGN1/SGN2.
    • Right hand side E and the solution R are M-by-N matrices. Glow up moment, it literally becomes the answer ๐Ÿ’–
  • LDE โ€” an INTEGER. The leading dimension of the array E. LDE >= max(1,M) ๐Ÿ“Ž
  • F โ€” a DOUBLE PRECISION array, dimension (LDF,N).
    • On input, the matrix F contains the right hand side F.
    • On output, the matrix F contains the solution L of Equation (1) as selected by TRANSA, TRANSB, and SGN1/SGN2.
    • Right hand side F and the solution L are M-by-N matrices. Same arc, same main character energy ๐Ÿ’œ
  • LDF โ€” an INTEGER. The leading dimension of the array F. LDE >= max(1,M). Yes bestie, the doc literally says LDE right there and I am not about to edit the source ๐Ÿ’€ (we report it exactly as written, fr fr)
  • SCALE โ€” a DOUBLE PRECISION. SCALE is a scaling factor to prevent the overflow in the result. If INFO == 0 then SCALE is 1.0D0, otherwise if one of the inner systems could not be solved correctly, 0 < SCALE <= 1 holds true. It's the seatbelt of this whole operation ๐Ÿ›Ÿ
  • WORK โ€” a DOUBLE PRECISION array, dimension LWORK. Workspace for the algorithm.
    • The workspace needs to queried before the running the computation. (yes, that's the original phrasing, we stan a legend ๐Ÿ™ˆ)
    • The query is performed by calling the subroutine with INFO == -1 on input.
    • The required workspace is then returned in INFO.
  • INFO โ€” an INTEGER.
    • On input:
      • == -1 : Perform a workspace query ๐Ÿ”
      • <> -1: normal operation, business as usual ๐Ÿ˜Œ
    • On exit, workspace query:
      • < 0 : if INFO = -i, the i-th argument had an illegal value ๐Ÿšจ
      • >= 0: The value of INFO is the required number of elements in the workspace. Surprise, INFO is the answer now โœจ
    • On exit, normal operation:
      • == 0: successful exit ๐ŸŽ‰
      • < 0: if INFO = -i, the i-th argument had an illegal value ๐Ÿšจ
      • > 0: The equation is not solved correctly. One of the arising inner system got singular. Not the vibe, bestie ๐Ÿ˜ญ

๐Ÿ‘‘ Author

Martin Koehler, MPI Magdeburg

๐ŸŽ€ Date

October 2025

Definition at line 237 of file dla_tgcsylv_dual_l3_2stage.f90.


๐ŸŒˆ recursive subroutine dla_tgcsylv_dual_recursive

recursive subroutine dla_tgcsylv_dual_recursive (character, dimension(1)
     transa, character, dimension(1) transb, double precision sgn1, double
     precision sgn2, integer m, integer n, double precision, dimension(lda,
     *) a, integer lda, double precision, dimension(ldb, *) b, integer ldb,
     double precision, dimension(ldc, *) c, integer ldc, double precision,
     dimension(ldd, *) d, integer ldd, double precision, dimension(lde, *) e,
     integer lde, double precision, dimension(ldf,*) f, integer ldf, double
     precision scale, double precision, dimension(*) work, integer info)

Recursive blocking Algorithm for the dual generalized coupled Sylvester equation.

๐ŸŽฏ Purpose

okay so bestie, DLA_TGCSYLV_DUAL_RECURSIVE solves a generalized coupled Sylvester equation that's literally giving this:

op1(A)**T * R  + op1(C)**T * L               = SCALE * E                             (1)
SGN1 * R * op2(B)**T + SGN2 * L * op2(D)** T = SCALE * F

where A is a M-by-M quasi upper triangular matrix, C is a M-by-M upper triangular matrix and B and D are N-by-N upper triangular matrices. Furthermore either B or D can be quasi upper triangular as well. The right hand sides E, F and the solutions R, L are M-by-N matrices. Typically the matrix pencils (A,C) and (B,D) ( or (D,B) ) are created by DGGES from LAPACK.

The equation (1) is the dual to the generalized coupled Sylvester equation

op1(A) * R + SGN1 * L * op2(B)  = SCALE * E                                          (2)
op1(C) * R + SGN2 * L * op2(D)  = SCALE * F

The equation (1) is the dual one to equation (2) with respect to the underlying linear system. Let Z be the matrix formed by rewriting (2) into its Kronecker form. This yields

         | kron(I, op1(A))   SGN1*kron(op2(B)**T, I) | | Vec R |   | Vec E |
   Z X = |                                           |*|       | = |       |
         | kron(I, op1(C))   SGN2*kron(op2(D)**T, I) | | Vec L |   | Vec F |

Regarding Z**T one obtains

            | kron(I, op1(A)**T )    kron(I, op1(C)**T)   | | Vec R |   | Vec E |
   Z**T X = |                                             |*|       | = |       |
            | SGN1*kron(op2(B), I)   SGN2*kron(op2(D), I) | | Vec L |   | Vec F |

which belongs to the Sylvester equation (1). For this reason the parameters TRANSA and TRANSB are expressed in terms of the Sylvester equation (2).


๐ŸŒธ Parameters ๐ŸŒธ

  • TRANSA โ€” bestie, this is CHARACTER(1). It specifies the form of the system of equations with respect to A and C:
    • == 'N': op1(A) = A, op1(C) = C (No transpose for A and C)
    • == 'T': op1(A) = A**T, op1(C) = C **T (Transpose A and C)
  • TRANSB โ€” CHARACTER(1). Specifies the form of the system of equations with respect to B and D:
    • == 'N': op2(B) = B, op2(D) = D (No transpose for B and D)
    • == 'T': op2(B) = B**T, op2(D) = D **T (Transpose B and D)
  • SGN1 โ€” DOUBLE PRECISION, allowed values: +/-1. Specifies the sign between in the first equation.
  • SGN2 โ€” DOUBLE PRECISION, allowed values: +/-1. Specifies the sign between in the second equation.
  • M โ€” INTEGER. The order of the matrices A and C. M >= 0.
  • N โ€” INTEGER. The order of the matrices B and D. N >= 0.
  • A โ€” DOUBLE PRECISION array, dimension (LDA,M). The matrix A must be (quasi-) upper triangular.
  • LDA โ€” INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • B โ€” DOUBLE PRECISION array, dimension (LDB,N). The matrix B must be (quasi-) upper triangular. If the matrix D is already quasi-upper triangular the matrix B must be upper triangular.
  • LDB โ€” INTEGER. The leading dimension of the array B. LDB >= max(1,N).
  • C โ€” DOUBLE PRECISION array, dimension (LDC,M). The matrix C must be upper triangular.
  • LDC โ€” INTEGER. The leading dimension of the array C. LDC >= max(1,M).
  • D โ€” DOUBLE PRECISION array, dimension (LDD,N). The matrix D must be (quasi-) upper triangular. If the matrix B is already quasi-upper triangular the matrix D must be upper triangular.
  • LDD โ€” INTEGER. The leading dimension of the array D. LDD >= max(1,N).
  • E โ€” DOUBLE PRECISION array, dimension (LDE,N). On input, the matrix E contains the right hand side E. On output, the matrix E contains the solution R of Equation (1) as selected by TRANSA, TRANSB, and SGN1/SGN2. Right hand side E and the solution R are M-by-N matrices.
  • LDE โ€” INTEGER. The leading dimension of the array E. LDE >= max(1,M).
  • F โ€” DOUBLE PRECISION array, dimension (LDF,N). On input, the matrix F contains the right hand side F. On output, the matrix F contains the solution L of Equation (1) as selected by TRANSA, TRANSB, and SGN1/SGN2. Right hand side F and the solution L are M-by-N matrices.
  • LDF โ€” INTEGER. The leading dimension of the array F. LDE >= max(1,M). (yep, the original says LDE, not LDF here, fr fr)
  • SCALE โ€” DOUBLE PRECISION. SCALE is a scaling factor to prevent the overflow in the result. If INFO == 0 then SCALE is 1.0D0 otherwise if one of the inner systems could not be solved correctly, 0 < SCALE <= 1 holds true.
  • WORK โ€” DOUBLE PRECISION array, dimension LWORK. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine with INFO == -1 on input. The required workspace is then returned in INFO.
  • INFO โ€” INTEGER.
    • On input:
      • == -1 : Perform a workspace query
      • <> -1: normal operation
    • On exit, workspace query:
      • < 0 : if INFO = -i, the i-th argument had an illegal value
      • >= 0: The value of INFO is the required number of elements in the workspace.
    • On exit, normal operation:
      • == 0: successful exit
      • < 0: if INFO = -i, the i-th argument had an illegal value
      • > 0: The equation is not solved correctly. One of the arising inner system got singular.

๐Ÿ‘‘ Author ๐Ÿ‘‘

Martin Koehler, MPI Magdeburg

๐ŸŒธ Date ๐ŸŒธ

October 2025

Definition at line 240 of file dla_tgcsylv_dual_recursive.f90.


okay next up, bestie, we got dla_tgcsylv_l2:

subroutine dla_tgcsylv_l2 (character, dimension(1) transa, character,
    dimension(1) transb, double precision sgn1, double precision sgn2,
    integer m, integer n, double precision, dimension(lda, *) a, integer
    lda, double precision, dimension(ldb, *) b, integer ldb, double
    precision, dimension(ldc, *) c, integer ldc, double precision,
    dimension(ldd, *) d, integer ldd, double precision, dimension(lde, *) e,
    integer lde, double precision, dimension(ldf,*) f, integer ldf, double
    precision scale, double precision, dimension(*) work, integer info)

Level-2 Kagstroem-Westin/Bartels-Stewart Algorithm for the generalized coupled Sylvester equation (Optimized)

Purpose:

  • SCALE โ€” DOUBLE PRECISION, bestie. It's the little safety valve ๐Ÿซง that stops your result from straight-up overflowing. If INFO == 0 then SCALE is 1.0D0, easy peasy. But if one of the inner systems couldn't be solved correctly, then 0 < SCALE <= 1 โ€” so you know something got sketchy when that number dips below 1. ๐Ÿ’€
  • WORK โ€” DOUBLE PRECISION array, dimension LWORK. This is the workspace for the algorithm, and here's the tea โ˜•: you gotta query it before you run the computation. No just-yeeting a random array size at it. You do the query by calling the subroutine with INFO == -1 on input, and then the required workspace gets handed back to you in INFO. โœจ
  • INFO โ€” INTEGER. The receipts. ๐Ÿงพ

On input:

  • == -1 : perform a workspace query ๐Ÿ‘€
  • <> -1 : normal operation, business as usual

On exit, workspace query:

  • < 0 : if INFO = -i, the i-th argument had an illegal value ๐Ÿ™ˆ
  • >= 0 : the value of INFO is the required number of elements in the workspace ๐ŸŒˆ

On exit, normal operation:

  • == 0 : successful exit, we ate ๐Ÿ’…
  • < 0 : if INFO = -i, the i-th argument had an illegal value ๐Ÿ˜ญ
  • > 0 : the equation is not solved correctly. One of the arising inner system got singular. ๐Ÿ’€

โœจ Optimizations: โœจ

Like, the glow-up list. Look at her go:

  • Replaced level-3 by level-2 and level-1 calls,
  • Replaced DAXPY operation by Fortran intrinsic
  • Replaced all BLAS calls except of DGER by Fortran intrinsic,

Author: Martin Koehler, MPI Magdeburg ๐Ÿ‘‘

Date: October 2025 ๐Ÿ—“๏ธ

Definition at line 225 of file dla_tgcsylv_l2.f90. ๐Ÿ“


subroutine dla_tgcsylv_l2_local_copy (character, dimension(1) transa,
    character, dimension(1) transb, double precision sgn1, double precision
    sgn2, integer m, integer n, double precision, dimension(lda, *) a,
    integer lda, double precision, dimension(ldb, *) b, integer ldb, double
    precision, dimension(ldc, *) c, integer ldc, double precision,
    dimension(ldd, *) d, integer ldd, double precision, dimension(lde, *) e,
    integer lde, double precision, dimension(ldf,*) f, integer ldf, double
    precision scale, double precision, dimension(*) work, integer info)

Level-2 Kagstroem-Westin/Bartels-Stewart Algorithm for the generalized coupled Sylvester equation (Optimized) ๐ŸŒธ

Purpose:

๐Ÿ’– Remarks ๐Ÿ’–

The algorithm is implemented using BLAS level 2 operations and hand written optimizations. bestie they literally hand-optimized it, we love a craftsperson ๐Ÿซถ


โœจ Parameters โœจ

TRANSA

TRANSA is CHARACTER(1) โ€” it tells us what the system of equations looks like with respect to A and C:

  • 'N': op1(A) = A, op1(C) = C (no transpose for A and C, she's being herself ๐Ÿ’…)
  • 'T': op1(A) = A**T, op1(C) = C **T (transpose A and C, flip era ๐Ÿ”„)

TRANSB

TRANSB is CHARACTER(1) โ€” same energy, but for B and D:

  • 'N': op2(B) = B, op2(D) = D (no transpose for B and D)
  • 'T': op2(B) = B**T, op2(D) = D **T (transpose B and D)

SGN1

SGN1 is DOUBLE PRECISION, allowed values: +/-1. It specifies the sign between in the first equation. no cap, just a plus or minus deciding the whole vibe of equation one ๐ŸŽ€

SGN2

SGN2 is DOUBLE PRECISION, allowed values: +/-1. It specifies the sign between in the second equation. same deal, second equation's turn to choose ๐ŸŒธ

M

M is INTEGER. The order of the matrices A and C. M >= 0.

N

N is INTEGER. The order of the matrices B and D. N >= 0.

A

A is DOUBLE PRECISION array, dimension (LDA,M). The matrix A must be (quasi-) upper triangular. she's got structure, she's not a full mess ๐Ÿ’…

LDA

LDA is INTEGER. The leading dimension of the array A. LDA >= max(1,M).

B

B is DOUBLE PRECISION array, dimension (LDB,N). The matrix B must be (quasi-) upper triangular. If the matrix D is already quasi-upper triangular the matrix B must be upper triangular. okay so only ONE of them gets to be quasi, them's the rules bestie โœจ

LDB

LDB is INTEGER. The leading dimension of the array B. LDB >= max(1,N).

C

C is DOUBLE PRECISION array, dimension (LDC,M). The matrix C must be upper triangular.

LDC

LDC is INTEGER. The leading dimension of the array C. LDC >= max(1,M).

D

D is DOUBLE PRECISION array, dimension (LDD,N). The matrix D must be (quasi-) upper triangular. If the matrix B is already quasi-upper triangular the matrix D must be upper triangular. yeah yeah it's a duo thing, one quasi max ๐Ÿ”ฅ

LDD

LDD is INTEGER. The leading dimension of the array D. LDD >= max(1,N).

E

E is DOUBLE PRECISION array, dimension (LDE,N).

On input, the matrix E contains the right hand side E. On output, the matrix E contains the solution R of Equation (1) โ€” yes, and again, on output the matrix E contains the solution R of Equation (1) โ€” as selected by TRANSA, TRANSB, and SGN1/SGN2. Right hand side E and the solution R are M-by-N matrices. she comes in as input and leaves as the answer, glow up of the century ๐Ÿ˜ญ๐Ÿ’–

LDE

LDE is INTEGER. The leading dimension of the array E. LDE >= max(1,M).

F

F is DOUBLE PRECISION array, dimension (LDF,N).

On input, the matrix F contains the right hand side F. On output, the matrix F contains the solution L of Equation (1) โ€” as selected by TRANSA, TRANSB, and SGN1/SGN2. Right hand side F and the solution L are M-by-N matrices. same main character arc, but for L this time ๐Ÿฆ‹

LDF

LDF is INTEGER. The leading dimension of the array F. LDE >= max(1,M). (yes it says LDE, we're quoting it exactly, no editing the source bestie ๐Ÿ™ˆ)

SCALE

SCALE is DOUBLE PRECISION. SCALE is a scaling factor to prevent the overflow in the result. If INFO == 0 then SCALE is 1.0D0, otherwise if one of the inner systems could not be solved correctly, 0 < SCALE <= 1 holds true. she's out here saving your numbers from overflowing into infinity and beyond ๐ŸŒˆ

WORK

WORK is DOUBLE PRECISION array, dimension LWORK. Workspace for the algorithm.

The workspace needs to queried before the running the computation. The query is performed by calling the subroutine with INFO == -1 on input. The required workspace is then returned in INFO. so like, ask her how much space she needs BEFORE you show up, okay? ๐ŸŽ€

INFO

INFO is INTEGER.

On input:

  • == -1 : Perform a workspace query
  • <> -1: normal operation

On exit, workspace query:

  • < 0 : if INFO = -i, the i-th argument had an illegal value
  • >= 0: The value of INFO is the required number of elements in the workspace.

On exit, normal operation:

  • == 0: successful exit โœจ
  • < 0: if INFO = -i, the i-th argument had an illegal value
  • > 0: The equation is not solved correctly. One of the arising inner system got singular. (rip, the inner system said no ๐Ÿ’€)

๐Ÿ‘‘ Optimizations: ๐Ÿ‘‘

  • Replaced level-3 by level-2 and level-1 calls,
  • Reorder the solution order to column first style,
  • Replaced DAXPY operation by Fortran intrinsic
  • Replaced all BLAS calls except of DTRMV and DGER by Fortran intrinsic,
  • Use local copies of A, B, C, D, E, and F (M, N <=128) .

๐ŸŒธ Author ๐ŸŒธ

Martin Koehler, MPI Magdeburg

๐Ÿ’œ Date ๐Ÿ’œ

October 2025

๐ŸŽ€ Definition ๐ŸŽ€

At line 227 of file dla_tgcsylv_l2_opt_local_copy.f90.


subroutine dla_tgcsylv_l2_local_copy_128 ( transa,  transb,  sgn1,  sgn2,
    m,  n,  a,  lda,  b,  ldb,  c,  ldc,  d,  ldd,  e,  lde,  f,  ldf,
    scale,  work,  info)

Level-2 Kagstroem-Westin/Bartels-Stewart Algorithm for the generalized coupled Sylvester equation (Optimized)

Purpose:

and bestieโ€ฆ the Purpose section is about to go off, keep scrolling ๐Ÿ’–

okay so this is the local-copy-128 version ๐Ÿ’… and honestly? it's the same energy as the others but with a very specific vibe: 128 is the whole personality. Let's get into it.

   op1(A) * R  + SGN1 * L  * op2(B) = SCALE * E                              (1)
   op1(C) * R  + SGN2 * L  * op2(D) = SCALE * F

Where A is a M-by-M quasi upper triangular matrix, C is a M-by-M upper triangular matrix, and B and D are N-by-N upper triangular matrices. Furthermore either B or D can be quasi upper triangular as well. The right hand side Y and the solution X are M-by-N matrices. Typically the matrix pencils (A,C) and (B,D) (or (D,B)) are created by DGGES from LAPACK. ๐Ÿซถ


โœจ Remarks โœจ

The algorithm is implemented using BLAS level 2 operations plus hand written optimizations and aligned local copies. no cap, it's hand-tuned. ๐Ÿ’…


๐ŸŒธ Parameters ๐ŸŒธ

  • TRANSA โ€” TRANSA is CHARACTER(1). It specifies the form of the system of equations with respect to A and C:
    • == 'N': op1(A) = A, op1(C) = C (no transpose for A and C)
    • == 'T': op1(A) = A**T, op1(C) = C**T (transpose A and C)
  • TRANSB โ€” TRANSB is CHARACTER(1). It specifies the form of the system of equations with respect to B and D:
    • == 'N': op2(B) = B, op2(D) = D (no transpose for B and D)
    • == 'T': op2(B) = B**T, op2(D) = D**T (transpose B and D)
  • SGN1 โ€” SGN1 is DOUBLE PRECISION, allowed values: +/-1. It specifies the sign between in the first equation. โญ
  • SGN2 โ€” SGN2 is DOUBLE PRECISION, allowed values: +/-1. It specifies the sign between in the second equation. โญ
  • M โ€” M is INTEGER. The order of the matrices A and C. 128 => M >= 0. ๐ŸŽ€
  • N โ€” N is INTEGER. The order of the matrices B and D. 128 >= N >= 0. ๐ŸŽ€
  • A โ€” A is DOUBLE PRECISION array, dimension (LDA,M). The matrix A must be (quasi-) upper triangular.
  • LDA โ€” LDA is INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • B โ€” B is DOUBLE PRECISION array, dimension (LDB,N). The matrix B must be (quasi-) upper triangular. If the matrix D is already quasi-upper triangular the matrix B must be upper triangular. โš ๏ธ
  • LDB โ€” LDB is INTEGER. The leading dimension of the array B. LDB >= max(1,N).
  • C โ€” C is DOUBLE PRECISION array, dimension (LDC,M). The matrix C must be upper triangular.
  • LDC โ€” LDC is INTEGER. The leading dimension of the array C. LDC >= max(1,M).
  • D โ€” D is DOUBLE PRECISION array, dimension (LDD,N). The matrix D must be (quasi-) upper triangular. If the matrix B is already quasi-upper triangular the matrix D must be upper triangular. โš ๏ธ
  • LDD โ€” LDD is INTEGER. The leading dimension of the array D. LDD >= max(1,N).
  • E โ€” E is DOUBLE PRECISION array, dimension (LDE,N). On input, the matrix E contains the right hand side E. On output, the matrix E contains the solution R of Equation (1) as selected by TRANSA, TRANSB, and SGN1/SGN2. Right hand side E and the solution R are M-by-N matrices. (and yes bestie, the source says "On output, the matrix E contains the solution R of Equation (1)" twice in a row โ€” we said what we said, and we're keeping it ๐Ÿ’€)
  • LDE โ€” LDE is INTEGER. The leading dimension of the array E. LDE >= max(1,M).
  • F โ€” F is DOUBLE PRECISION array, dimension (LDF,N). On input, the matrix F contains the right hand side F. On output, the matrix F contains the solution L of Equation (1) as selected by TRANSA, TRANSB, and SGN1/SGN2. Right hand side F and the solution L are M-by-N matrices.
  • LDF โ€” LDF is INTEGER. The leading dimension of the array F. LDE >= max(1,M). (not me noticing it says LDE here and not LDF โ€” that's literally what the page says, so that's literally what you get ๐Ÿ™ˆ)
  • SCALE โ€” SCALE is DOUBLE PRECISION. SCALE is a scaling factor to prevent the overflow in the result. If INFO == 0 then SCALE is 1.0D0 otherwise if one of the inner systems could not be solved correctly, 0 < SCALE <= 1 holds true.
  • WORK โ€” WORK is DOUBLE PRECISION array, dimension LWORK. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine with INFO == -1 on input. The required workspace is then returned in INFO.
  • INFO โ€” INFO is INTEGER.
    • On input:
      • == -1 : perform a workspace query
      • <> -1: normal operation
    • On exit, workspace query:
      • < 0 : if INFO = -i, the i-th argument had an illegal value
      • >= 0: the value of INFO is the required number of elements in the workspace.
    • On exit, normal operation:
      • == 0: successful exit โœ…
      • < 0: if INFO = -i, the i-th argument had an illegal value
      • > 0: the equation is not solved correctly. One of the arising inner system got singular. ๐Ÿ˜ญ

๐Ÿ”ฅ Optimizations: ๐Ÿ”ฅ

  • Replaced level-3 by level-2 and level-1 calls,
  • Reorder the solution order to column first style,
  • Replaced DAXPY operation by Fortran intrinsic
  • Replaced all BLAS calls except of DTRMV and DGER by Fortran intrinsic,
  • Align local copies and fix problem size to <= 128

Author ๐Ÿซถ

Martin Koehler, MPI Magdeburg

Date ๐Ÿ“…

October 2025

Definition at line 225 of file dla_tgcsylv_l2_opt_local_copy_128.f90.


okay and now the next one pulls up and it's giving smaller, cuter, thirty-two energy ๐Ÿ‘‘

subroutine dla_tgcsylv_l2_local_copy_32 ( transa,  transb,  sgn1,  sgn2,  m,
    n,  a,  lda,  b,  ldb,  c,  ldc,  d,  ldd,  e,  lde,  f,  ldf,  scale,
    work,  info)

Level-2 Kagstroem-Westin/Bartels-Stewart Algorithm for the generalized coupled Sylvester equation (Optimized) โœจ

Purpose:

...and bestie we are NOT done yet, keep scrolling ๐Ÿ’–

๐Ÿ’– DLA_TGCSYLV_L2_LOCAL_COPY_32 ๐Ÿ’–

okay bestie so DLA_TGCSYLV_L2_LOCAL_COPY_32 solves a generalized coupled Sylvester equation that looks exactly like this:

op1(A) * R  + SGN1 * L  * op2(B) = SCALE * E                              (1)
op1(C) * R  + SGN2 * L  * op2(D) = SCALE * F

where A is a M-by-M quasi upper triangular matrix, C is a M-by-M upper triangular matrix, and B and D are N-by-N upper triangular matrices. bestie, either B or D can be quasi upper triangular as well, no cap. The right hand side Y and the solution X are M-by-N matrices. Typically the matrix pencils (A,C) and (B,D) (or (D,B)) are created by DGGES from LAPACK. slay. โœจ

๐ŸŽ€ Remarks ๐ŸŽ€

The algorithm is implemented using BLAS level 2 operations and hand written optimizations and aligned local copies. it's giving โœจ*artisanal*โœจ tbh.

๐Ÿ’… Parameters ๐Ÿ’…

  • TRANSA โ€” TRANSA is CHARACTER(1). Specifies the form of the system of equations with respect to A and C:
    • == 'N': op1(A) = A, op1(C) = C (No transpose for A and C)
    • == 'T': op1(A) = A**T, op1(C) = C **T (Transpose A and C)
  • TRANSB โ€” TRANSB is CHARACTER(1). Specifies the form of the system of equations with respect to B and D:
    • == 'N': op2(B) = B, op2(D) = D (No transpose for B and D)
    • == 'T': op2(B) = B**T, op2(D) = D **T (Transpose B and D)
  • SGN1 โ€” SGN1 is DOUBLE PRECISION, allowed values: +/-1. Specifies the sign between in the first equation.
  • SGN2 โ€” SGN2 is DOUBLE PRECISION, allowed values: +/-1. Specifies the sign between in the second equation.
  • M โ€” M is INTEGER. The order of the matrices A and C. 32 => M >= 0.
  • N โ€” N is INTEGER. The order of the matrices B and D. 32 >= N >= 0.
  • A โ€” A is DOUBLE PRECISION array, dimension (LDA,M). The matrix A must be (quasi-) upper triangular.
  • LDA โ€” LDA is INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • B โ€” B is DOUBLE PRECISION array, dimension (LDB,N). The matrix B must be (quasi-) upper triangular. If the matrix D is already quasi-upper triangular the matrix B must be upper triangular.
  • LDB โ€” LDB is INTEGER. The leading dimension of the array B. LDB >= max(1,N).
  • C โ€” C is DOUBLE PRECISION array, dimension (LDC,M). The matrix C must be upper triangular.
  • LDC โ€” LDC is INTEGER. The leading dimension of the array C. LDC >= max(1,M).
  • D โ€” D is DOUBLE PRECISION array, dimension (LDD,N). The matrix D must be (quasi-) upper triangular. If the matrix B is already quasi-upper triangular the matrix D must be upper triangular.
  • LDD โ€” LDD is INTEGER. The leading dimension of the array D. LDD >= max(1,N).
  • E โ€” E is DOUBLE PRECISION array, dimension (LDE,N). On input, the matrix E contains the right hand side E. On output, the matrix E contains the solution R of Equation (1). On output, the matrix E contains the solution R of Equation (1) as selected by TRANSA, TRANSB, and SGN1/SGN2. Right hand side E and the solution R are M-by-N matrices. (yes it really says that twice, that's the original, I'm not messing with it ๐Ÿ’€)
  • LDE โ€” LDE is INTEGER. The leading dimension of the array E. LDE >= max(1,M).
  • F โ€” F is DOUBLE PRECISION array, dimension (LDF,N). On input, the matrix F contains the right hand side F. On output, the matrix F contains the solution L of Equation (1) as selected by TRANSA, TRANSB, and SGN1/SGN2. Right hand side F and the solution L are M-by-N matrices.
  • LDF โ€” LDF is INTEGER. The leading dimension of the array F. LDE >= max(1,M). (yes, it says LDE here, and I am faithfully reporting this crime ๐Ÿ˜ญ)
  • SCALE โ€” SCALE is DOUBLE PRECISION. SCALE is a scaling factor to prevent the overflow in the result. If INFO == 0 then SCALE is 1.0D0 otherwise if one of the inner systems could not be solved correctly, 0 < SCALE <= 1 holds true.
  • WORK โ€” WORK is DOUBLE PRECISION array, dimension LWORK. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine with INFO == -1 on input. The required workspace is then returned in INFO.
  • INFO โ€” INFO is INTEGER.
    • On input:
      • == -1 : Perform a workspace query
      • <> -1: normal operation
    • On exit, workspace query:
      • < 0 : if INFO = -i, the i-th argument had an illegal value
      • >= 0: The value of INFO is the required number of elements in the workspace.
    • On exit, normal operation:
      • == 0: successful exit
      • < 0: if INFO = -i, the i-th argument had an illegal value
      • > 0: The equation is not solved correctly. One of the arising inner system got singular.

๐ŸŒˆ Optimizations: ๐ŸŒˆ

  • Replaced level-3 by level-2 and level-1 calls,
  • Reorder the solution order to column first style,
  • Replaced DAXPY operation by Fortran intrinsic
  • Replaced all BLAS calls except of DTRMV and DGER by Fortran intrinsic,
  • Align local copies and fix problem size to <= 32

๐Ÿ‘‘ Author ๐Ÿ‘‘

Martin Koehler, MPI Magdeburg

๐Ÿ“… Date ๐Ÿ“…

October 2025

Definition at line 226 of file dla_tgcsylv_l2_opt_local_copy_32.f90.


๐Ÿ’œ dla_tgcsylv_l2_local_copy_64 ๐Ÿ’œ

subroutine dla_tgcsylv_l2_local_copy_64 ( transa,  transb,  sgn1,  sgn2,  m,
    n,  a,  lda,  b,  ldb,  c,  ldc,  d,  ldd,  e,  lde,  f,  ldf,  scale,
    work,  info)

Level-2 Kagstroem-Westin/Bartels-Stewart Algorithm for the generalized coupled Sylvester equation (Optimized) โ€” the 64 version, bestie, the glow-up edition โœจ

Purpose:

   op1(A) * R  + SGN1 * L  * op2(B) = SCALE * E                              (1)
   op1(C) * R  + SGN2 * L  * op2(D) = SCALE * F

where A is a M-by-M quasi upper triangular matrix, C is a M-by-M upper triangular matrix, and B and D are N-by-N upper triangular matrices. Also, bestie, either B or D can be quasi upper triangular as well. The right hand side Y and the solution X are M-by-N matrices. Typically the matrix pencils (A,C) and (B,D) ( or (D,B) ) are created by DGGES from LAPACK. ๐Ÿ’…


โœจ Remarks โœจ

The algorithm is implemented using BLAS level 2 operations and hand written optimizations and aligned local copies. hand written, like, artisanal. ๐ŸŽ€


๐Ÿฆ‹ Parameters ๐Ÿฆ‹

TRANSA

TRANSA is CHARACTER(1)

Specifies the form of the system of equations with respect to A and C:

== 'N':  op1(A) = A, op1(C) = C (No transpose for A and C)
== 'T':  op1(A) = A**T, op1(C) = C **T (Transpose A and C)

TRANSB

TRANSB is CHARACTER(1)

Specifies the form of the system of equations with respect to B and D:

== 'N':  op2(B) = B, op2(D) = D (No transpose for B and D)
== 'T':  op2(B) = B**T, op2(D) = D **T (Transpose B and D)

SGN1

SGN1 is DOUBLE PRECISION, allowed values: +/-1

Specifies the sign between in the first equation. yes, "between in" โ€” that's the original wording, we're not fixing it, it's iconic โœจ

SGN2

SGN2 is DOUBLE PRECISION, allowed values: +/-1

Specifies the sign between in the second equation.

M

M is INTEGER

The order of the matrices A and C. 64 => M >= 0.

N

N is INTEGER

The order of the matrices B and D. 64 >= N >= 0.

A

A is DOUBLE PRECISION array, dimension (LDA,M)

The matrix A must be (quasi-) upper triangular.

LDA

LDA is INTEGER

The leading dimension of the array A. LDA >= max(1,M).

B

B is DOUBLE PRECISION array, dimension (LDB,N)

The matrix B must be (quasi-) upper triangular. If the matrix D is already quasi-upper triangular the matrix B must be upper triangular.

LDB

LDB is INTEGER

The leading dimension of the array B. LDB >= max(1,N).

C

C is DOUBLE PRECISION array, dimension (LDC,M)

The matrix C must be upper triangular.

LDC

LDC is INTEGER

The leading dimension of the array C. LDC >= max(1,M).

D

D is DOUBLE PRECISION array, dimension (LDD,N)

The matrix D must be (quasi-) upper triangular. If the matrix B is already quasi-upper triangular the matrix D must be upper triangular.

LDD

LDD is INTEGER

The leading dimension of the array D. LDD >= max(1,N).

E

E is DOUBLE PRECISION array, dimension (LDE,N)

On input, the matrix E contains the right hand side E.

On output, the matrix E contains the solution R of Equation (1)

On output, the matrix E contains the solution R of Equation (1) as selected by TRANSA, TRANSB, and SGN1/SGN2.

(yeah it says the output line twice in the source โ€” we are leaving it, no cap, it's canon ๐Ÿ’€)

Right hand side E and the solution R are M-by-N matrices.

LDE

LDE is INTEGER

The leading dimension of the array E. LDE >= max(1,M).

F

F is DOUBLE PRECISION array, dimension (LDF,N)

On input, the matrix F contains the right hand side F.

On output, the matrix F contains the solution L of Equation (1) as selected by TRANSA, TRANSB, and SGN1/SGN2.

Right hand side F and the solution L are M-by-N matrices.

LDF

LDF is INTEGER

The leading dimension of the array F. LDE >= max(1,M).

(not me noticing it says LDE in the LDF description ๐Ÿ™ˆ โ€” keeping it exactly as written, because that's the whole assignment)

SCALE

SCALE is DOUBLE PRECISION

SCALE is a scaling factor to prevent the overflow in the result. If INFO == 0 then SCALE is 1.0D0 otherwise if one of the inner systems could not be solved correctly, 0 < SCALE <= 1 holds true.

WORK

WORK is DOUBLE PRECISION array, dimension LWORK

Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine with INFO == -1 on input. The required workspace is then returned in INFO.

INFO

INFO is INTEGER

On input:

== -1 : Perform a workspace query
<> -1: normal operation

On exit, workspace query:

< 0 :  if INFO = -i, the i-th argument had an illegal value
>= 0:  The value of INFO is the required number of elements in the workspace.

On exit, normal operation:

== 0:  successful exit
< 0:  if INFO = -i, the i-th argument had an illegal value
> 0:  The equation is not solved correctly. One of the arising inner
      system got singular.

๐Ÿ‘‘ Optimizations: ๐Ÿ‘‘

  • Replaced level-3 by level-2 and level-1 calls,
  • Reorder the solution order to column first style,
  • Replaced DAXPY operation by Fortran intrinsic
  • Replaced all BLAS calls except of DTRMV and DGER by Fortran intrinsic,
  • Align local copies and fix problem size to <= 64

๐ŸŒธ Author ๐ŸŒธ

Martin Koehler, MPI Magdeburg

๐ŸŒˆ Date ๐ŸŒˆ

October 2025

โญ Definition โญ

Defined at line 226 of file dla_tgcsylv_l2_opt_local_copy_64.f90.


subroutine dla_tgcsylv_l2_local_copy_96 ( transa,  transb,  sgn1,  sgn2,  m,
    n,  a,  lda,  b,  ldb,  c,  ldc,  d,  ldd,  e,  lde,  f,  ldf,  scale,
    work,  info)

Level-2 Kagstroem-Westin/Bartels-Stewart Algorithm for the generalized coupled Sylvester equation (Optimized)

Purpose:

DLA_TGCSYLV_L2_LOCAL_COPY_96 is here to solve a generalized coupled Sylvester equation, and bestie, it's giving big math energy. The form it handles is literally this:

op1(A) * R  + SGN1 * L  * op2(B) = SCALE * E                              (1)
op1(C) * R  + SGN2 * L  * op2(D) = SCALE * F

okay so let's decode the cast list ๐Ÿ’… โ€” A is a M-by-M quasi upper triangular matrix, C is a M-by-M upper triangular matrix, and B and D are N-by-N upper triangular matrices. Also? Either B or D can be quasi upper triangular as well, no cap. The right hand side Y and the solution X are M-by-N matrices. And typically the matrix pencils (A,C) and (B,D) (or (D,B)) are created by DGGES from LAPACK. iykyk.


๐ŸŒธ Remarks ๐ŸŒธ

The algorithm is implemented using BLAS level 2 operations, plus hand written optimizations and aligned local copies. It's giving crafty, honestly.


โœจ Parameters โœจ

  • TRANSA โ€” TRANSA is CHARACTER(1). It specifies the form of the system of equations with respect to A and C:
    • == 'N': op1(A) = A, op1(C) = C (No transpose for A and C)
    • == 'T': op1(A) = A**T, op1(C) = C **T (Transpose A and C)
  • TRANSB โ€” TRANSB is CHARACTER(1). It specifies the form of the system of equations with respect to B and D:
    • == 'N': op2(B) = B, op2(D) = D (No transpose for B and D)
    • == 'T': op2(B) = B**T, op2(D) = D **T (Transpose B and D)
  • SGN1 โ€” SGN1 is DOUBLE PRECISION, allowed values: +/-1. It specifies the sign between in the first equation. ๐ŸŽ€
  • SGN2 โ€” SGN2 is DOUBLE PRECISION, allowed values: +/-1. It specifies the sign between in the second equation.
  • M โ€” M is INTEGER. The order of the matrices A and C. 96 => M >= 0.
  • N โ€” N is INTEGER. The order of the matrices B and D. 96 >= N >= 0.
  • A โ€” A is DOUBLE PRECISION array, dimension (LDA,M). The matrix A must be (quasi-) upper triangular.
  • LDA โ€” LDA is INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • B โ€” B is DOUBLE PRECISION array, dimension (LDB,N). The matrix B must be (quasi-) upper triangular. If the matrix D is already quasi-upper triangular the matrix B must be upper triangular. ๐Ÿ‘€
  • LDB โ€” LDB is INTEGER. The leading dimension of the array B. LDB >= max(1,N).
  • C โ€” C is DOUBLE PRECISION array, dimension (LDC,M). The matrix C must be upper triangular.
  • LDC โ€” LDC is INTEGER. The leading dimension of the array C. LDC >= max(1,M).
  • D โ€” D is DOUBLE PRECISION array, dimension (LDD,N). The matrix D must be (quasi-) upper triangular. If the matrix B is already quasi-upper triangular the matrix D must be upper triangular.
  • LDD โ€” LDD is INTEGER. The leading dimension of the array D. LDD >= max(1,N).
  • E โ€” E is DOUBLE PRECISION array, dimension (LDE,N). On input, the matrix E contains the right hand side E. On output, the matrix E contains the solution R of Equation (1) as selected by TRANSA, TRANSB, and SGN1/SGN2. Right hand side E and the solution R are M-by-N matrices.
  • LDE โ€” LDE is INTEGER. The leading dimension of the array E. LDE >= max(1,M).
  • F โ€” F is DOUBLE PRECISION array, dimension (LDF,N). On input, the matrix F contains the right hand side F. On output, the matrix F contains the solution L of Equation (1) as selected by TRANSA, TRANSB, and SGN1/SGN2. Right hand side F and the solution L are M-by-N matrices.
  • LDF โ€” LDF is INTEGER. The leading dimension of the array F. LDE >= max(1,M). (yes bestie, the page really says LDE there โ€” we keep the lore exactly as it is ๐Ÿ™ˆ)
  • SCALE โ€” SCALE is DOUBLE PRECISION. SCALE is a scaling factor to prevent the overflow in the result. If INFO == 0 then SCALE is 1.0D0 otherwise if one of the inner systems could not be solved correctly, 0 < SCALE <= 1 holds true. safety first, always.
  • WORK โ€” WORK is DOUBLE PRECISION array, dimension LWORK. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine with INFO == -1 on input. The required workspace is then returned in INFO. ๐Ÿซถ
  • INFO โ€” INFO is INTEGER.
    • On input:
      • == -1 : Perform a workspace query
      • <> -1: normal operation
    • On exit, workspace query:
      • < 0 : if INFO = -i, the i-th argument had an illegal value
      • >= 0: The value of INFO is the required number of elements in the workspace.
    • On exit, normal operation:
      • == 0: successful exit
      • < 0: if INFO = -i, the i-th argument had an illegal value
      • > 0: The equation is not solved correctly. One of the arising inner system got singular. ๐Ÿ’€

๐Ÿ”ฅ Optimizations: ๐Ÿ”ฅ

  • Replaced level-3 by level-2 and level-1 calls,
  • Reorder the solution order to column first style,
  • Replaced DAXPY operation by Fortran intrinsic
  • Replaced all BLAS calls except of DTRMV and DGER by Fortran intrinsic,
  • Align local copies and fix problem size to <= 96

๐Ÿ‘‘ Author ๐Ÿ‘‘

Martin Koehler, MPI Magdeburg

๐ŸŒˆ Date ๐ŸŒˆ

October 2025

Definition at line 225 of file dla_tgcsylv_l2_opt_local_copy_96.f90.


subroutine dla_tgcsylv_l2_reorder โ€” okay now we're meeting the next icon in the lineup, and her signature is a whole mouthful, so here it is, verbatim, no edits:

subroutine dla_tgcsylv_l2_reorder (character, dimension(1) transa,
    character, dimension(1) transb, double precision sgn1, double precision
    sgn2, integer m, integer n, double precision, dimension(lda, *) a,
    integer lda, double precision, dimension(ldb, *) b, integer ldb, double
    precision, dimension(ldc, *) c, integer ldc, double precision,
    dimension(ldd, *) d, integer ldd, double precision, dimension(lde, *) e,
    integer lde, double precision, dimension(ldf,*) f, integer ldf, double
    precision scale, double precision, dimension(*) work, integer info)

Level-2 Kagstroem-Westin/Bartels-Stewart Algorithm for the generalized coupled Sylvester equation (Optimized)

๐Ÿ’– Purpose: ๐Ÿ’–

okay so DLA_TGCSYLV_L2_REORDER ๐Ÿ’… solves a generalized coupled Sylvester equation that looks a little something like this, bestie:

op1(A) * R  + SGN1 * L  * op2(B) = SCALE * E                              (1)
op1(C) * R  + SGN2 * L  * op2(D) = SCALE * F

where A is a M-by-M quasi upper triangular matrix, C is a M-by-M upper triangular matrix, and B and D are N-by-N upper triangular matrices. Also โ€” plot twist โ€” either B or D can be quasi upper triangular as well. The right hand side Y and the solution X are M-by-N matrices. Typically the matrix pencils (A,C) and (B,D) (or (D,B)) are created by DGGES from LAPACK. โœจ


๐ŸŽ€ Remarks ๐ŸŽ€

The algorithm is implemented using BLAS level 2 operations and hand written optimizations. iconic, honestly.


๐ŸŒธ Parameters ๐ŸŒธ

  • TRANSA โ€” is CHARACTER(1). Specifies the form of the system of equations with respect to A and C:
    • 'N': op1(A) = A, op1(C) = C (No transpose for A and C)
    • 'T': op1(A) = A**T, op1(C) = C **T (Transpose A and C)
  • TRANSB โ€” is CHARACTER(1). Specifies the form of the system of equations with respect to B and D:
    • 'N': op2(B) = B, op2(D) = D (No transpose for B and D)
    • 'T': op2(B) = B**T, op2(D) = D **T (Transpose B and D)
  • SGN1 โ€” is DOUBLE PRECISION, allowed values: +/-1. Specifies the sign in the first equation. ๐Ÿ’…
  • SGN2 โ€” is DOUBLE PRECISION, allowed values: +/-1. Specifies the sign in the second equation.
  • M โ€” is INTEGER. The order of the matrices A and C. M >= 0.
  • N โ€” is INTEGER. The order of the matrices B and D. N >= 0.
  • A โ€” is DOUBLE PRECISION array, dimension (LDA,M). The matrix A must be (quasi-) upper triangular.
  • LDA โ€” is INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • B โ€” is DOUBLE PRECISION array, dimension (LDB,N). The matrix B must be (quasi-) upper triangular. If the matrix D is already quasi-upper triangular the matrix B must be upper triangular. ๐Ÿ‘€
  • LDB โ€” is INTEGER. The leading dimension of the array B. LDB >= max(1,N).
  • C โ€” is DOUBLE PRECISION array, dimension (LDC,M). The matrix C must be upper triangular.
  • LDC โ€” is INTEGER. The leading dimension of the array C. LDC >= max(1,M).
  • D โ€” is DOUBLE PRECISION array, dimension (LDD,N). The matrix D must be (quasi-) upper triangular. If the matrix B is already quasi-upper triangular the matrix D must be upper triangular.
  • LDD โ€” is INTEGER. The leading dimension of the array D. LDD >= max(1,N).
  • E โ€” is DOUBLE PRECISION array, dimension (LDE,N). On input, the matrix E contains the right hand side E. On output, the matrix E contains the solution R of Equation (1) as selected by TRANSA, TRANSB, and SGN1/SGN2. Right hand side E and the solution R are M-by-N matrices.
  • LDE โ€” is INTEGER. The leading dimension of the array E. LDE >= max(1,M).
  • F โ€” is DOUBLE PRECISION array, dimension (LDF,N). On input, the matrix F contains the right hand side F. On output, the matrix F contains the solution L of Equation (1) as selected by TRANSA, TRANSB, and SGN1/SGN2. Right hand side F and the solution L are M-by-N matrices.
  • LDF โ€” is INTEGER. The leading dimension of the array F. LDE >= max(1,M). (yes bestie, that's literally what it says ๐Ÿ’€)
  • SCALE โ€” is DOUBLE PRECISION. SCALE is a scaling factor to prevent the overflow in the result. If INFO == 0 then SCALE is 1.0D0 otherwise if one of the inner systems could not be solved correctly, 0 < SCALE <= 1 holds true.
  • WORK โ€” is DOUBLE PRECISION array, dimension LWORK. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine with INFO == -1 on input. The required workspace is then returned in INFO.
  • INFO โ€” is INTEGER.
    • On input:
      • == -1 : Perform a workspace query
      • <> -1: normal operation
    • On exit, workspace query:
      • < 0 : if INFO = -i, the i-th argument had an illegal value
      • >= 0: The value of INFO is the required number of elements in the workspace.
    • On exit, normal operation:
      • == 0: successful exit
      • < 0: if INFO = -i, the i-th argument had an illegal value
      • > 0: The equation is not solved correctly. One of the arising inner system got singular.

๐Ÿ’– Optimizations: ๐Ÿ’–

  • Replaced level-3 by level-2 and level-1 calls,
  • Reorder the solution order to column first style,
  • Replaced DAXPY operation by Fortran intrinsic
  • Replaced all BLAS calls except of DTRMV and DGER by Fortran intrinsic,
  • Column first computation of the solution.

๐Ÿ‘‘ Author

Martin Koehler, MPI Magdeburg

๐Ÿ“… Date

October 2025

๐Ÿ”ฅ Definition

At line 226 of file dla_tgcsylv_l2_opt_reorder.f90.


subroutine dla_tgcsylv_l2_unopt (character, dimension(1) transa, character,
    dimension(1) transb, double precision sgn1, double precision sgn2,
    integer m, integer n, double precision, dimension(lda, *) a, integer
    lda, double precision, dimension(ldb, *) b, integer ldb, double
    precision, dimension(ldc, *) c, integer ldc, double precision,
    dimension(ldd, *) d, integer ldd, double precision, dimension(lde, *) e,
    integer lde, double precision, dimension(ldf,*) f, integer ldf, double
    precision scale, double precision, dimension(*) work, integer info)

Level-2 Kagstroem-Westin/Bartels-Stewart Algorithm for the generalized coupled Sylvester equation (unoptimized) ๐Ÿฆ‹

Purpose:

Attention โš ๏ธ bestie read this before you @ me โ€” this algorithm is implemented using BLAS level 2 operations without further optimizations. For a faster implementation see DLA_TGSYLV_L2. That's it, that's the whole heads-up. ๐Ÿ’…

  • TRANSA โ€” TRANSA is CHARACTER(1). It picks the form of the system of equations with respect to A and C:
    • == 'N': op1(A) = A, op1(C) = C (no transpose for A and C, we're keeping it chill)
    • == 'T': op1(A) = A**T, op1(C) = C **T (transpose A and C, spicy mode ๐Ÿ”ฅ)
  • TRANSB โ€” TRANSB is CHARACTER(1). Same energy but for B and D:
    • == 'N': op2(B) = B, op2(D) = D (no transpose for B and D)
    • == 'T': op2(B) = B**T, op2(D) = D **T (transpose B and D)
  • SGN1 โ€” SGN1 is DOUBLE PRECISION, allowed values: +/-1. It specifies the sign between in the first equation. ๐Ÿ‘‘
  • SGN2 โ€” SGN2 is DOUBLE PRECISION, allowed values: +/-1. It specifies the sign between in the second equation. (yes, twin signs, twin equations, it's giving symmetry โœจ)
  • M โ€” M is INTEGER. The order of the matrices A and C. M >= 0.
  • N โ€” N is INTEGER. The order of the matrices B and D. N >= 0.
  • A โ€” A is DOUBLE PRECISION array, dimension (LDA,M). The matrix A must be (quasi-) upper triangular. no cap.
  • LDA โ€” LDA is INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • B โ€” B is DOUBLE PRECISION array, dimension (LDB,N). The matrix B must be (quasi-) upper triangular. If the matrix D is already quasi-upper triangular the matrix B must be upper triangular. (they take turns, it's a whole thing ๐Ÿ™ˆ)
  • LDB โ€” LDB is INTEGER. The leading dimension of the array B. LDB >= max(1,N).
  • C โ€” C is DOUBLE PRECISION array, dimension (LDC,M). The matrix C must be upper triangular. periodt.
  • LDC โ€” LDC is INTEGER. The leading dimension of the array C. LDC >= max(1,M).
  • D โ€” D is DOUBLE PRECISION array, dimension (LDD,N). The matrix D must be (quasi-) upper triangular. If the matrix B is already quasi-upper triangular the matrix D must be upper triangular.
  • LDD โ€” LDD is INTEGER. The leading dimension of the array D. LDD >= max(1,N).
  • E โ€” E is DOUBLE PRECISION array, dimension (LDE,N). On input, the matrix E contains the right hand side E. On output, the matrix E contains the solution R of Equation (1) as selected by TRANSA, TRANSB, and SGN1/SGN2. Right hand side E and the solution R are M-by-N matrices. she goes in one girl and comes out another ๐Ÿ’–
  • LDE โ€” LDE is INTEGER. The leading dimension of the array E. LDE >= max(1,M).
  • F โ€” F is DOUBLE PRECISION array, dimension (LDF,N). On input, the matrix F contains the right hand side F. On output, the matrix F contains the solution L of Equation (1) as selected by TRANSA, TRANSB, and SGN1/SGN2. Right hand side F and the solution L are M-by-N matrices.
  • LDF โ€” LDF is INTEGER. The leading dimension of the array F. LDE >= max(1,M). ๐Ÿ‘€ โ€” yeah it says LDE right there, I'm copying it exactly, not my business, not my problem.
  • SCALE โ€” SCALE is DOUBLE PRECISION. SCALE is a scaling factor to prevent the overflow in the result. If INFO == 0 then SCALE is 1.0D0 otherwise if one of the inner systems could not be solved correctly, 0 < SCALE <= 1 holds true. she's literally the safety net ๐Ÿซถ
  • WORK โ€” WORK is DOUBLE PRECISION array, dimension LWORK. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine with INFO == -1 on input. The required workspace is then returned in INFO. query first, allocate second, no exceptions ๐Ÿ’…
  • INFO โ€” INFO is INTEGER
    • On input:
      • == -1 : perform a workspace query
      • <> -1: normal operation
    • On exit, workspace query:
      • < 0 : if INFO = -i, the i-th argument had an illegal value
      • >= 0: the value of INFO is the required number of elements in the workspace.
    • On exit, normal operation:
      • == 0: successful exit ๐ŸŽ‰
      • < 0: if INFO = -i, the i-th argument had an illegal value
      • > 0: the equation is not solved correctly. One of the arising inner system got singular. ๐Ÿ˜ญ she said "singular", she said "no solution for you"

๐ŸŒˆ Optimizations: ๐ŸŒˆ

  • Nothing. ๐Ÿ’€ (iconic honestly โ€” what you see is what you get)

๐ŸŒธ Author ๐ŸŒธ

Martin Koehler, MPI Magdeburg

๐ŸŽ€ Date ๐ŸŽ€

October 2025

Definition at line 225 of file dla_tgcsylv_l2_unopt.f90.


subroutine dla_tgcsylv_l3 (character, dimension(1) transa, character, dimension(1) transb, double precision sgn1, double precision sgn2, integer m, integer n, double precision, dimension(lda, *) a, integer lda, double precision, dimension(ldb, *) b, integer ldb, double precision, dimension(ldc, *) c, integer ldc, double precision, dimension(ldd, *) d, integer ldd, double precision, dimension(lde, *) e, integer lde, double precision, dimension(ldf,*) f, integer ldf, double precision scale, double precision, dimension(*) work, integer info)

Level-3 Kagstroem-Westin/Bartels-Stewart Algorithm for the generalized coupled Sylvester equation (optimized)

Purpose:

๐Ÿ’– okay so, the entire vibe of this routine in one (1) blessed equation:
!>    op1(A) * R  + SGN1 * L  * op2(B) = SCALE * E                              (1)
!>    op1(C) * R  + SGN2 * L  * op2(D) = SCALE * F

where A is a M-by-M quasi upper triangular matrix, C is a M-by-M upper triangular matrix, and B and D are N-by-N upper triangular matrices. Also โ€” plot twist โ€” either B or D can be quasi upper triangular too, bestie. The right hand side Y and the solution X are M-by-N matrices. Typically the matrix pencils (A,C) and (B,D) (or (D,B)) are created by DGGES from LAPACK. no cap ๐Ÿซถ

Attention ๐Ÿ˜ญ

The algorithm is implemented using BLAS level 3 operations. she's fancy like that ๐Ÿ’…


Parameters ๐Ÿ’…

  • TRANSA โ€” TRANSA is CHARACTER(1). It specifies the form of the system of equations with respect to A and C:
    • == 'N': op1(A) = A, op1(C) = C (no transpose for A and C)
    • == 'T': op1(A) = A**T, op1(C) = C **T (transpose A and C)
  • TRANSB โ€” TRANSB is CHARACTER(1). It specifies the form of the system of equations with respect to B and D:
    • == 'N': op2(B) = B, op2(D) = D (no transpose for B and D)
    • == 'T': op2(B) = B**T, op2(D) = D **T (transpose B and D)
  • SGN1 โ€” SGN1 is DOUBLE PRECISION, allowed values: +/-1. It specifies the sign between in the first equation. ๐ŸŽ€
  • SGN2 โ€” SGN2 is DOUBLE PRECISION, allowed values: +/-1. It specifies the sign between in the second equation. ๐ŸŽ€
  • M โ€” M is INTEGER. The order of the matrices A and C. M >= 0.
  • N โ€” N is INTEGER. The order of the matrices B and D. N >= 0.
  • A โ€” A is DOUBLE PRECISION array, dimension (LDA,M). The matrix A must be (quasi-) upper triangular.
  • LDA โ€” LDA is INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • B โ€” B is DOUBLE PRECISION array, dimension (LDB,N). The matrix B must be (quasi-) upper triangular. If the matrix D is already quasi-upper triangular the matrix B must be upper triangular. ๐Ÿ‘€
  • LDB โ€” LDB is INTEGER. The leading dimension of the array B. LDB >= max(1,N).
  • C โ€” C is DOUBLE PRECISION array, dimension (LDC,M). The matrix C must be upper triangular.
  • LDC โ€” LDC is INTEGER. The leading dimension of the array C. LDC >= max(1,M).
  • D โ€” D is DOUBLE PRECISION array, dimension (LDD,N). The matrix D must be (quasi-) upper triangular. If the matrix B is already quasi-upper triangular the matrix D must be upper triangular. ๐Ÿ‘€
  • LDD โ€” LDD is INTEGER. The leading dimension of the array D. LDD >= max(1,N).
  • E โ€” E is DOUBLE PRECISION array, dimension (LDE,N). On input, the matrix E contains the right hand side E. On output, the matrix E contains the solution R of Equation (1) as selected by TRANSA, TRANSB, and SGN1/SGN2. Right hand side E and the solution R are M-by-N matrices. โœจ
  • LDE โ€” LDE is INTEGER. The leading dimension of the array E. LDE >= max(1,M).
  • F โ€” F is DOUBLE PRECISION array, dimension (LDF,N). On input, the matrix F contains the right hand side F. On output, the matrix F contains the solution L of Equation (1) as selected by TRANSA, TRANSB, and SGN1/SGN2. Right hand side F and the solution L are M-by-N matrices. โœจ
  • LDF โ€” LDF is INTEGER. The leading dimension of the array F. LDE >= max(1,M). (yes bestie, it literally says LDE there, we are not the ones who typed it, we just report it ๐Ÿซ )
  • SCALE โ€” SCALE is DOUBLE PRECISION. SCALE is a scaling factor to prevent the overflow in the result. If INFO == 0 then SCALE is 1.0D0 otherwise if one of the inner systems could not be solved correctly, 0 < SCALE <= 1 holds true. ๐Ÿงš
  • WORK โ€” WORK is DOUBLE PRECISION array, dimension LWORK. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine with INFO == -1 on input. The required workspace is then returned in INFO. ๐ŸŽ€
  • INFO โ€” INFO is INTEGER.
    • On input:
      • == -1 : Perform a workspace query
      • <> -1: normal operation
    • On exit, workspace query:
      • < 0 : if INFO = -i, the i-th argument had an illegal value
      • >= 0: The value of INFO is the required number of elements in the workspace.
    • On exit, normal operation:
      • == 0: successful exit
      • < 0: if INFO = -i, the i-th argument had an illegal value
      • > 0: The equation is not solved correctly. One of the arising inner system got singular. ๐Ÿ˜ญ

Optimizations: ๐Ÿ”ฅ

  • Nothing but standard L3 BLAS calls.
  • Changed computation order to column major

Author ๐Ÿ‘‘

Martin Koehler, MPI Magdeburg

Date ๐Ÿ“…

October 2025

Definition at line 223 of file dla_tgcsylv_l3_opt.f90.


โœจ dla_tgcsylv_l3_2s โœจ

subroutine dla_tgcsylv_l3_2s (character, dimension(1) transa, character,
    dimension(1) transb, double precision sgn1, double precision sgn2,
    integer m, integer n, double precision, dimension(lda, *) a, integer
    lda, double precision, dimension(ldb, *) b, integer ldb, double
    precision, dimension(ldc, *) c, integer ldc, double precision,
    dimension(ldd, *) d, integer ldd, double precision, dimension(lde, *) e,
    integer lde, double precision, dimension(ldf,*) f, integer ldf, double
    precision scale, double precision, dimension(*) work, integer info)

Level-3 Kagstroem-Westin/Bartels-Stewart Algorithm for the generalized coupled Sylvester equation (optimized) ๐ŸŒˆ

Purpose: ๐Ÿ’–

!> DLA_TGCSYLV_L3_2S solves a generalized coupled  Sylvester equation of the following form
!>
!>    op1(A) * R  + SGN1 * L  * op2(B) = SCALE * E                              (1)
!>    op1(C) * R  + SGN2 * L  * op2(D) = SCALE * F
!>
!> where A is a M-by-M quasi upper triangular matrix, C is a M-by-M upper triangular
!> matrix and B and D are N-by-N upper triangular matrices. Furthermore either B or
!> D can be quasi upper triangular as well. The right hand side Y and the solution X
!> M-by-N matrices. Typically the matrix pencils (A,C) and (B,D) ( or (D,B) ) are
!> created by DGGES from LAPACK.
!>

๐Ÿซถ Remarks

okay so this algorithm is out here using 2 Stage blocking with DAG scheduled solves and honestly? iconic behavior ๐Ÿ’…


โœจ Parameters โœจ

  • TRANSA โ€” bestie, TRANSA is CHARACTER(1) and it says what shape the system of equations takes with respect to A and C:
    • == 'N': op1(A) = A, op1(C) = C (no transpose for A and C, we're keeping it chill)
    • == 'T': op1(A) = A**T, op1(C) = C **T (transpose A and C, flipping the whole vibe)
  • TRANSB โ€” TRANSB is CHARACTER(1) and it says what shape the system takes with respect to B and D:
    • == 'N': op2(B) = B, op2(D) = D (no transpose for B and D)
    • == 'T': op2(B) = B**T, op2(D) = D **T (transpose B and D)
  • SGN1 โ€” SGN1 is DOUBLE PRECISION, allowed values are +/-1, and it specifies the sign between in the first equation. yes it's literally just a sign, but it matters okay ๐Ÿ’–
  • SGN2 โ€” SGN2 is DOUBLE PRECISION, allowed values are +/-1, and it specifies the sign between in the second equation.
  • M โ€” M is INTEGER, the order of the matrices A and C. M >= 0. no negativity allowed bestie ๐Ÿ™ˆ
  • N โ€” N is INTEGER, the order of the matrices B and D. N >= 0.
  • A โ€” A is a DOUBLE PRECISION array, dimension (LDA,M). The matrix A must be (quasi-) upper triangular. no cap.
  • LDA โ€” LDA is INTEGER, the leading dimension of the array A. LDA >= max(1,M).
  • B โ€” B is a DOUBLE PRECISION array, dimension (LDB,N). The matrix B must be (quasi-) upper triangular. If the matrix D is already quasi-upper triangular, then the matrix B must be upper triangular. the way that these two have to coordinate... ๐ŸŽ€
  • LDB โ€” LDB is INTEGER, the leading dimension of the array B. LDB >= max(1,N).
  • C โ€” C is a DOUBLE PRECISION array, dimension (LDC,M). The matrix C must be upper triangular. periodt.
  • LDC โ€” LDC is INTEGER, the leading dimension of the array C. LDC >= max(1,M).
  • D โ€” D is a DOUBLE PRECISION array, dimension (LDD,N). The matrix D must be (quasi-) upper triangular. If the matrix B is already quasi-upper triangular, then the matrix D must be upper triangular. it's giving mutual exclusivity, lowkey.
  • LDD โ€” LDD is INTEGER, the leading dimension of the array D. LDD >= max(1,N).
  • E โ€” E is a DOUBLE PRECISION array, dimension (LDE,N). On input, the matrix E contains the right hand side E. On output, the matrix E contains the solution R of Equation (1) as selected by TRANSA, TRANSB, and SGN1/SGN2. Right hand side E and the solution R are M-by-N matrices. glow up moment โœจ
  • LDE โ€” LDE is INTEGER, the leading dimension of the array E. LDE >= max(1,M).
  • F โ€” F is a DOUBLE PRECISION array, dimension (LDF,N). On input, the matrix F contains the right hand side F. On output, the matrix F contains the solution L of Equation (1) as selected by TRANSA, TRANSB, and SGN1/SGN2. Right hand side F and the solution L are M-by-N matrices.
  • LDF โ€” LDF is INTEGER, the leading dimension of the array F. LDE >= max(1,M).
๐Ÿšจ okay so heads up: the manpage literally says LDE >= max(1,M) here for LDF too. that's what it says, so that's what I'm telling you. not me fixing it, i'm just the messenger ๐Ÿ’€
  • SCALE โ€” SCALE is DOUBLE PRECISION. It's a scaling factor to prevent overflow in the result. If INFO == 0 then SCALE is 1.0D0, otherwise if one of the inner systems could not be solved correctly, 0 < SCALE <= 1 holds true. it's the safety net bestie ๐Ÿซถ
  • WORK โ€” WORK is a DOUBLE PRECISION array, dimension LWORK. Workspace for the algorithm. The workspace needs to be queried before running the computation. The query is performed by calling the subroutine with INFO == -1 on input. The required workspace is then returned in INFO. so like... ask first, then compute. consent culture but for memory ๐Ÿ’…
  • INFO โ€” INFO is INTEGER.
    • On input:
      • == -1: perform a workspace query
      • <> -1: normal operation
    • On exit, workspace query:
      • < 0: if INFO = -i, the i-th argument had an illegal value
      • >= 0: the value of INFO is the required number of elements in the workspace
    • On exit, normal operation:
      • == 0: successful exit ๐ŸŽ‰
      • < 0: if INFO = -i, the i-th argument had an illegal value
      • > 0: the equation is not solved correctly. One of the arising inner system got singular. it's giving tragedy ๐Ÿ˜ญ

๐Ÿ‘‘ Author

Martin Koehler, MPI Magdeburg

๐ŸŽ€ Date

October 2025

โญ Definition

Definition at line 217 of file dla_tgcsylv_l3_2stage.f90.


subroutine dla_tgcsylv_l3_unopt (character, dimension(1) transa, character,
    dimension(1) transb, double precision sgn1, double precision sgn2,
    integer m, integer n, double precision, dimension(lda, *) a, integer
    lda, double precision, dimension(ldb, *) b, integer ldb, double
    precision, dimension(ldc, *) c, integer ldc, double precision,
    dimension(ldd, *) d, integer ldd, double precision, dimension(lde, *) e,
    integer lde, double precision, dimension(ldf,*) f, integer ldf, double
    precision scale, double precision, dimension(*) work, integer info)

Level-3 Kagstroem-Westin/Bartels-Stewart Algorithm for the generalized coupled Sylvester equation (unoptimized)

so yeah bestie, this one is the unoptimized sibling โ€” same algorithm energy, just not the glow-up version. still valid, still doing the work ๐Ÿฆ‹

Purpose:

(and the purpose section keeps going, hold that thought โ€” part 25 has it ๐Ÿ’–)

the two equations are literally the whole plot, so here they are, unedited, no notes:

op1(A) * R  + SGN1 * L  * op2(B) = SCALE * E                              (1)
op1(C) * R  + SGN2 * L  * op2(D) = SCALE * F

so who's who in this little friend group? A is a M-by-M quasi upper triangular matrix, C is a M-by-M upper triangular matrix, and B and D are both N-by-N upper triangular matrices. and plot twist bestie โ€” either B or D can be quasi upper triangular as well ๐Ÿซถ. The right hand side Y and the solution X are M-by-N matrices. Typically the matrix pencils (A,C) and (B,D) (or (D,B)) are created by DGGES from LAPACK. iykyk โœจ


โœจ Attention โœจ

The algorithm is implemented using BLAS level 3 operations. that's it, that's the whole warning, it's a flex not a red flag ๐Ÿ’…


๐ŸŽ€ Parameters ๐ŸŽ€

okay buckle up, here's every single one, no skipping, I said what I said:

  • TRANSA โ€” TRANSA is CHARACTER(1). It specifies the form of the system of equations with respect to A and C:
    • 'N': op1(A) = A, op1(C) = C (no transpose for A and C)
    • 'T': op1(A) = A**T, op1(C) = C **T (transpose A and C)
  • TRANSB โ€” TRANSB is CHARACTER(1). It specifies the form of the system of equations with respect to B and D:
    • 'N': op2(B) = B, op2(D) = D (no transpose for B and D)
    • 'T': op2(B) = B**T, op2(D) = D **T (transpose B and D)
  • SGN1 โ€” SGN1 is DOUBLE PRECISION, allowed values: +/-1. It specifies the sign between in the first equation.
  • SGN2 โ€” SGN2 is DOUBLE PRECISION, allowed values: +/-1. It specifies the sign between in the second equation.
  • M โ€” M is INTEGER. The order of the matrices A and C. M >= 0.
  • N โ€” N is INTEGER. The order of the matrices B and D. N >= 0.
  • A โ€” A is DOUBLE PRECISION array, dimension (LDA,M). The matrix A must be (quasi-) upper triangular. no exceptions bestie ๐Ÿ’œ
  • LDA โ€” LDA is INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • B โ€” B is DOUBLE PRECISION array, dimension (LDB,N). The matrix B must be (quasi-) upper triangular. If the matrix D is already quasi-upper triangular the matrix B must be upper triangular. yes they're negotiating, keep up ๐ŸŒธ
  • LDB โ€” LDB is INTEGER. The leading dimension of the array B. LDB >= max(1,N).
  • C โ€” C is DOUBLE PRECISION array, dimension (LDC,M). The matrix C must be upper triangular. periodt.
  • LDC โ€” LDC is INTEGER. The leading dimension of the array C. LDC >= max(1,M).
  • D โ€” D is DOUBLE PRECISION array, dimension (LDD,N). The matrix D must be (quasi-) upper triangular. If the matrix B is already quasi-upper triangular the matrix D must be upper triangular. it's giving reciprocity ๐Ÿ’ซ
  • LDD โ€” LDD is INTEGER. The leading dimension of the array D. LDD >= max(1,N).
  • E โ€” E is DOUBLE PRECISION array, dimension (LDE,N). On input, the matrix E contains the right hand side E. On output, the matrix E contains the solution R of Equation (1) as selected by TRANSA, TRANSB, and SGN1/SGN2. Right hand side E and the solution R are M-by-N matrices. glow up in real time ๐Ÿ˜ญ
  • LDE โ€” LDE is INTEGER. The leading dimension of the array E. LDE >= max(1,M).
  • F โ€” F is DOUBLE PRECISION array, dimension (LDF,N). On input, the matrix F contains the right hand side F. On output, the matrix F contains the solution L of Equation (1) as selected by TRANSA, TRANSB, and SGN1/SGN2. Right hand side F and the solution L are M-by-N matrices. twin behaviour fr fr ๐Ÿฆ‹
  • LDF โ€” LDF is INTEGER. The leading dimension of the array F. LDE >= max(1,M). ๐Ÿ™ˆ okay so the source literally says LDE right there and not LDF โ€” I'm just the messenger, don't come for me, I am reporting it faithfully ๐Ÿ’€
  • SCALE โ€” SCALE is DOUBLE PRECISION. SCALE is a scaling factor to prevent the overflow in the result. If INFO == 0 then SCALE is 1.0D0 otherwise if one of the inner systems could not be solved correctly, 0 < SCALE <= 1 holds true. she's just here to keep things from overflowing, an icon, a protector ๐Ÿ‘‘
  • WORK โ€” WORK is DOUBLE PRECISION array, dimension LWORK. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine with INFO == -1 on input. The required workspace is then returned in INFO. so yes, you gotta ask nicely first, she doesn't do surprises ๐ŸŽ€
  • INFO โ€” INFO is INTEGER
    • On input:
      • == -1 : Perform a workspace query
      • <> -1: normal operation
    • On exit, workspace query:
      • < 0 : if INFO = -i, the i-th argument had an illegal value
      • >= 0: The value of INFO is the required number of elements in the workspace.
    • On exit, normal operation:
      • == 0: successful exit
      • < 0: if INFO = -i, the i-th argument had an illegal value
      • > 0: The equation is not solved correctly. One of the arising inner system got singular.
bestie if INFO comes back > 0 on a normal run, that's not a vibe check you passed โ€” that means the equation is not solved correctly and one of the arising inner system got singular. read the INFO, always read the INFO ๐Ÿ’…

๐Ÿ”ฅ Optimizations: ๐Ÿ”ฅ

  • Nothing but standard L3 BLAS calls. that's the whole optimization list and honestly? clean, efficient, no notes ๐Ÿ”ฅ

๐ŸŒŸ Author ๐ŸŒŸ

Martin Koehler, MPI Magdeburg โ€” the legend, the moment, the main character ๐Ÿซถ


๐ŸŒˆ Date ๐ŸŒˆ

October 2025


โญ Definition โญ

Definition at line 223 of file dla_tgcsylv_l3_unopt.f90.


๐Ÿฆ‹ recursive subroutine dla_tgcsylv_recursive

okay new function, new era, here's the signature, verbatim, don't touch it:

recursive subroutine dla_tgcsylv_recursive (character, dimension(1) transa,
    character, dimension(1) transb, double precision sgn1, double precision
    sgn2, integer m, integer n, double precision, dimension(lda, *) a,
    integer lda, double precision, dimension(ldb, *) b, integer ldb, double
    precision, dimension(ldc, *) c, integer ldc, double precision,
    dimension(ldd, *) d, integer ldd, double precision, dimension(lde, *) e,
    integer lde, double precision, dimension(ldf,*) f, integer ldf, double
    precision scale, double precision, dimension(*) work, integer info)

Recursive Algorithm for the generalized coupled Sylvester equation. โœจ


๐ŸŽ€ Purpose: ๐ŸŽ€

โœจ DLA_TGCSYLV_RECURSIVE โœจ

okay so DLA_TGCSYLV_RECURSIVE solves a generalized coupled Sylvester equation that looks like this ๐Ÿ’–

op1(A) * R  + SGN1 * L  * op2(B) = SCALE * E                              (1)
op1(C) * R  + SGN2 * L  * op2(D) = SCALE * F

where A is a M-by-M quasi upper triangular matrix, C is a M-by-M upper triangular matrix, and B and D are N-by-N upper triangular matrices. also!! either B or D can be quasi upper triangular too, no biggie ๐Ÿ’…. the right hand side Y and the solution X are M-by-N matrices. typically the matrix pencils (A,C) and (B,D) ( or (D,B) ) are created by DGGES from LAPACK, iykyk โœจ


๐Ÿซถ Attention

the algorithm is implemented using BLAS level 3 operations. so it's giving fast, periodt ๐Ÿ”ฅ

๐Ÿ’… Parameters

  • TRANSA โ€” TRANSA is CHARACTER(1). it specifies the form of the system of equations with respect to A and C:
    • == 'N': op1(A) = A, op1(C) = C (No transpose for A and C)
    • == 'T': op1(A) = A**T, op1(C) = C **T (Transpose A and C)
  • TRANSB โ€” TRANSB is CHARACTER(1). it specifies the form of the system of equations with respect to B and D:
    • == 'N': op2(B) = B, op2(D) = D (No transpose for B and D)
    • == 'T': op2(B) = B**T, op2(D) = D **T (Transpose B and D)
  • SGN1 โ€” SGN1 is DOUBLE PRECISION, allowed values: +/-1. it specifies the sign between in the first equation ๐Ÿ’ซ
  • SGN2 โ€” SGN2 is DOUBLE PRECISION, allowed values: +/-1. it specifies the sign between in the second equation ๐Ÿ’ซ
  • M โ€” M is INTEGER. the order of the matrices A and C. M >= 0 ๐Ÿ‘‘
  • N โ€” N is INTEGER. the order of the matrices B and D. N >= 0 ๐Ÿ‘‘
  • A โ€” A is DOUBLE PRECISION array, dimension (LDA,M). the matrix A must be (quasi-) upper triangular ๐Ÿฆ‹
  • LDA โ€” LDA is INTEGER. the leading dimension of the array A. LDA >= max(1,M)
  • B โ€” B is DOUBLE PRECISION array, dimension (LDB,N). the matrix B must be (quasi-) upper triangular. if the matrix D is already quasi-upper triangular the matrix B must be upper triangular ๐ŸŽ€
  • LDB โ€” LDB is INTEGER. the leading dimension of the array B. LDB >= max(1,N)
  • C โ€” C is DOUBLE PRECISION array, dimension (LDC,M). the matrix C must be upper triangular ๐ŸŒธ
  • LDC โ€” LDC is INTEGER. the leading dimension of the array C. LDC >= max(1,M)
  • D โ€” D is DOUBLE PRECISION array, dimension (LDD,N). the matrix D must be (quasi-) upper triangular. if the matrix B is already quasi-upper triangular the matrix D must be upper triangular ๐ŸŽ€
  • LDD โ€” LDD is INTEGER. the leading dimension of the array D. LDD >= max(1,N)
  • E โ€” E is DOUBLE PRECISION array, dimension (LDE,N). on input, the matrix E contains the right hand side E. on output, the matrix E contains the solution R of Equation (1) as selected by TRANSA, TRANSB, and SGN1/SGN2. right hand side E and the solution R are M-by-N matrices ๐Ÿ’–
  • LDE โ€” LDE is INTEGER. the leading dimension of the array E. LDE >= max(1,M)
  • F โ€” F is DOUBLE PRECISION array, dimension (LDF,N). on input, the matrix F contains the right hand side F. on output, the matrix F contains the solution L of Equation (1) as selected by TRANSA, TRANSB, and SGN1/SGN2. right hand side F and the solution L are M-by-N matrices ๐Ÿ’–
  • LDF โ€” LDF is INTEGER. the leading dimension of the array F. LDE >= max(1,M) ๐Ÿ™ˆ (yes bestie, it says LDE in the original, we're not gonna "fix" it, we just report it fr fr)
  • SCALE โ€” SCALE is DOUBLE PRECISION. SCALE is a scaling factor to prevent the overflow in the result ๐Ÿ”ฅ. if INFO == 0 then SCALE is 1.0D0 otherwise if one of the inner systems could not be solved correctly, 0 < SCALE <= 1 holds true.
  • WORK โ€” WORK is DOUBLE PRECISION array, dimension 1. workspace for the algorithm ๐Ÿ› ๏ธ
  • INFO โ€” INFO is INTEGER
    • == 0: successful exit ๐ŸŽ‰
    • < 0: if INFO = -i, the i-th argument had an illegal value ๐Ÿ’€
    • > 0: the equation is not solved correctly. one of the arising inner system got singular ๐Ÿ˜ญ

๐Ÿ‘‘ Author

Martin Koehler, MPI Magdeburg

๐ŸŽ€ Date

October 2025

Definition at line 205 of file dla_tgcsylv_recursive.f90.


๐ŸŒˆ dla_tgsylv_dag

subroutine dla_tgsylv_dag (character, dimension(1) transa, character,
    dimension(1) transb, double precision sgn, integer m, integer n, double
    precision, dimension(lda, m) a, integer lda, double precision,
    dimension(ldb, n) b, integer ldb, double precision, dimension(ldc, m) c,
    integer ldc, double precision, dimension(ldd, n) d, integer ldd, double
    precision, dimension(ldx, n) x, integer ldx, double precision scale,
    double precision, dimension(*) work, integer info)

Level-3 Bartels-Stewart Algorithm for the generalized Sylvester equation with DAG based parallelization โœจ๐Ÿ”ฅ

Purpose:

๐ŸŒ€ DLA_TGSYLV_DAG โ€” the DAG-scheduled girlie

okay so bestie, DLA_TGSYLV_DAG solves a generalized Sylvester equation, and there are two whole flavors:

op1(A) * X * op2(B) + op1(C) * X * op2(D) = SCALE * Y                              (1)

or

op1(A) * X * op2(B) - op1(C) * X * op2(D) = SCALE * Y                              (2)

where A is a M-by-M quasi upper triangular matrix, C is a M-by-M upper triangular matrix, and B and D are N-by-N upper triangular matrices. Also โ€” plot twist โ€” either B or D can be quasi upper triangular as well. The right hand side Y and the solution X are M-by-N matrices. Typically the matrix pencils (A,C) and (B,D) (or (D,B)) are created by DGGES from LAPACK. iykyk ๐Ÿ’…

Remarks ๐ŸŒธ โ€” the algorithm is implemented using BLAS level 3 operations and OpenMP 4.0 DAG scheduling. (yes bestie, that's the whole reason it has _DAG in the name, main character energy โœจ)

Attention ๐Ÿ’€ โ€” due to the parallel nature of the algorithm the scaling is not applied to the right hand. If the problem is ill-posed and scaling appears, you have to solve the equation again with a solver with complete scaling support like DLA_TGSYLV_L3. no cap, do not skip this.

Parameters ๐ŸŽ€

  • TRANSA โ€” TRANSA is CHARACTER(1). Specifies the form of the system of equations with respect to A and C:
    • == 'N': op1(A) = A, op1(C) = C (No transpose for A and C)
    • == 'T': op1(A) = A**T, op1(C) = C **T (Transpose A and C)
  • TRANSB โ€” TRANSB is CHARACTER(1). Specifies the form of the system of equations with respect to B and D:
    • == 'N': op2(B) = B, op2(D) = D (No transpose for B and D)
    • == 'T': op2(B) = B**T, op2(D) = D **T (Transpose B and D)
  • SGN โ€” SGN is DOUBLE PRECISION, allowed values: +/-1. Specifies the sign between the two parts of the Sylvester equation.
    • = 1 : Solve Equation (1)
    • == -1: Solve Equation (2)
  • M โ€” M is INTEGER. The order of the matrices A and C. M >= 0.
  • N โ€” N is INTEGER. The order of the matrices B and D. N >= 0.
  • A โ€” A is DOUBLE PRECISION array, dimension (LDA,M). The matrix A must be (quasi-) upper triangular.
  • LDA โ€” LDA is INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • B โ€” B is DOUBLE PRECISION array, dimension (LDB,N). The matrix B must be (quasi-) upper triangular. If the matrix D is already quasi-upper triangular the matrix B must be upper triangular. (one of them gets to be the quasi one, not both, we don't do chaos ๐Ÿ™ˆ)
  • LDB โ€” LDB is INTEGER. The leading dimension of the array B. LDB >= max(1,N).
  • C โ€” C is DOUBLE PRECISION array, dimension (LDC,M). The matrix C must be upper triangular.
  • LDC โ€” LDC is INTEGER. The leading dimension of the array C. LDC >= max(1,M).
  • D โ€” D is DOUBLE PRECISION array, dimension (LDD,N). The matrix D must be (quasi-) upper triangular. If the matrix B is already quasi-upper triangular the matrix D must be upper triangular.
  • LDD โ€” LDD is INTEGER. The leading dimension of the array D. LDD >= max(1,N).
  • X โ€” X is DOUBLE PRECISION array, dimension (LDX,N). On input, the matrix X contains the right hand side Y. On output, the matrix X contains the solution of Equation (1) or (2) as selected by TRANSA, TRANSB, and SGN. Right hand side Y and the solution X are M-by-N matrices. (she does double duty, iconic ๐Ÿ‘‘)
  • LDX โ€” LDX is INTEGER. The leading dimension of the array X. LDX >= max(1,M).
  • SCALE โ€” SCALE is DOUBLE PRECISION. SCALE is a scaling factor to prevent the overflow in the result. If INFO == 0 then SCALE is 1.0D0 otherwise if one of the inner systems could not be solved correctly, 0 < SCALE <= 1 holds true. If SCALE .NE. 1 the problem is no solved correctly in this case one have to use an other solver. โš ๏ธ
  • WORK โ€” WORK is DOUBLE PRECISION array, dimension LWORK. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine with INFO == -1 on input. The required workspace is then returned in INFO. (ask her first, she'll tell you how much room she needs, we love a communicative queen ๐Ÿซถ)
  • INFO โ€” INFO is INTEGER.
    • On input:
      • == -1 : Perform a workspace query
      • <> -1: normal operation
    • On exit, workspace query:
      • < 0 : if INFO = -i, the i-th argument had an illegal value
      • >= 0: The value of INFO is the required number of elements in the workspace.
    • On exit, normal operation:
      • == 0: successful exit
      • < 0: if INFO = -i, the i-th argument had an illegal value
      • > 0: The equation is not solved correctly. One of the arising inner system got singular.

Author ๐Ÿ’– โ€” Martin Koehler, MPI Magdeburg

Date โ€” October 2025

Definition at line 208 of file dla_tgsylv_dag.f90.


๐Ÿฆ‹ dla_tgsylv_gardiner_laub โ€” the level-2 legend

subroutine dla_tgsylv_gardiner_laub (character, dimension(1) transa,
    character, dimension(1) transb, double precision sgn, integer m, integer
    n, double precision, dimension(lda, *) a, integer lda, double precision,
    dimension(ldb, *) b, integer ldb, double precision, dimension(ldc, *) c,
    integer ldc, double precision, dimension(ldd, *) d, integer ldd, double
    precision, dimension(ldx, *) x, integer ldx, double precision scale,
    double precision, dimension(2*m,*) work, integer info)

Level-2 Gardiner-Laub algorithm for the generalized Sylvester equation. fr fr, that's the whole vibe โœจ

Purpose:

okay so the whole point of this routine is that it solves a generalized Sylvester equation, and it's giving โœจ two forms โœจ โ€” pick your fighter:

op1(A) * X * op2(B) + op1(C) * X * op2(D) = SCALE * Y                              (1)

or

op1(A) * X * op2(B) - op1(C) * X * op2(D) = SCALE * Y                              (2)

where A is a M-by-M quasi upper triangular matrix, C is a M-by-M upper triangular matrix, and B and D are N-by-N upper triangular matrices. And either B or D can be quasi upper triangular as well โ€” so don't come at me about the shapes, that's on purpose ๐Ÿฆ‹. The right hand side Y and the solution X are M-by-N matrices. Typically the matrix pencils (A,C) and (B,D) ( or (D,B) ) are created by DGGES from LAPACK.


๐ŸŒธ Remarks ๐ŸŒธ

The algorithm implements the ideas by Gardiner et. al. on top of BLAS level 2 operations. iykyk ๐Ÿ’…


๐Ÿšจ Attention ๐Ÿšจ

Scaling is not supported by this algorithm so SCALE == 1. Not a drill bestie โ€” do not come in here expecting a cute little scaling rescue ๐Ÿ˜ญ

๐Ÿ’– Parameters ๐Ÿ’–

  • TRANSA โ€” CHARACTER(1). Specifies the form of the system of equations with respect to A and C:
    • == 'N': op1(A) = A, op1(C) = C (No transpose for A and C)
    • == 'T': op1(A) = A**T, op1(C) = C **T (Transpose A and C)
  • TRANSB โ€” CHARACTER(1). Specifies the form of the system of equations with respect to B and D:
    • == 'N': op2(B) = B, op2(D) = D (No transpose for B and D)
    • == 'T': op2(B) = B**T, op2(D) = D **T (Transpose B and D)
  • SGN โ€” DOUBLE PRECISION, allowed values: +/-1. Specifies the sign between the two parts of the Sylvester equation.
    • = 1: Solve Equation (1)
    • == -1: Solve Equation (2)
  • M โ€” INTEGER. The order of the matrices A and C. M >= 0.
  • N โ€” INTEGER. The order of the matrices B and D. N >= 0.
  • A โ€” DOUBLE PRECISION array, dimension (LDA,M). The matrix A must be (quasi-) upper triangular.
  • LDA โ€” INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • B โ€” DOUBLE PRECISION array, dimension (LDB,N). The matrix B must be (quasi-) upper triangular. If the matrix D is already quasi-upper triangular the matrix B must be upper triangular. only one of them gets to be quasi, them's the rules ๐Ÿ’…
  • LDB โ€” INTEGER. The leading dimension of the array B. LDB >= max(1,N).
  • C โ€” DOUBLE PRECISION array, dimension (LDC,M). The matrix C must be upper triangular.
  • LDC โ€” INTEGER. The leading dimension of the array C. LDC >= max(1,M).
  • D โ€” DOUBLE PRECISION array, dimension (LDD,N). The matrix D must be (quasi-) upper triangular. If the matrix B is already quasi-upper triangular the matrix D must be upper triangular. see? told you โœจ
  • LDD โ€” INTEGER. The leading dimension of the array D. LDD >= max(1,N).
  • X โ€” DOUBLE PRECISION array, dimension (LDX,N).
    • On input, the matrix X contains the right hand side Y.
    • On output, the matrix X contains the solution of Equation (1) or (2) as selected by TRANSA, TRANSB, and SGN.
    • Right hand side Y and the solution X are M-by-N matrices.
  • LDX โ€” INTEGER. The leading dimension of the array X. LDB >= max(1,M). yes bestie, the doc literally says LDB here ๐Ÿ™ˆ I am not editing the source, I am merely reporting it fr fr
  • SCALE โ€” DOUBLE PRECISION. SCALE is a scaling factor to prevent the overflow in the result. If INFO == 0 then SCALE is 1.0D0 otherwise if one of the inner systems could not be solved correctly, 0 < SCALE <= 1 holds true.
  • WORK โ€” DOUBLE PRECISION array, dimension LWORK. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine with INFO == -1 on input. The required workspace is then returned in INFO. query first, compute second, that's the order ๐Ÿซถ
  • INFO โ€” INTEGER
    • On input:
      • == -1 : Perform a workspace query
      • <> -1: normal operation
    • On exit, workspace query:
      • < 0 : if INFO = -i, the i-th argument had an illegal value
      • >= 0: The value of INFO is the required number of elements in the workspace.
    • On exit, normal operation:
      • == 0: successful exit ๐Ÿ‘‘
      • < 0: if INFO = -i, the i-th argument had an illegal value
      • > 0: The equation is not solved correctly. One of the arising inner system got singular. ๐Ÿ’€

๐ŸŒˆ Author ๐ŸŒˆ

Martin Koehler, MPI Magdeburg

๐ŸŽ€ Date ๐ŸŽ€

October 2025

Definition at line 204 of file dla_tgsylv_gardiner_laub.f90.


๐Ÿงš subroutine dla_tgsylv_l2 ๐Ÿงš

subroutine dla_tgsylv_l2 (character, dimension(1) transa, character,
    dimension(1) transb, double precision sgn, integer m, integer n, double
    precision, dimension(lda, *) a, integer lda, double precision,
    dimension(ldb, *) b, integer ldb, double precision, dimension(ldc, *) c,
    integer ldc, double precision, dimension(ldd, *) d, integer ldd, double
    precision, dimension(ldx, *) x, integer ldx, double precision scale,
    double precision, dimension(*) work, integer info)

Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation (Optimized)

Purpose

okay bestie so DLA_TGSYLV_L2 solves a generalized Sylvester equation, and it comes in two flavours, pick your fighter:

op1(A) * X * op2(B) + op1(C) * X * op2(D) = SCALE * Y                              (1)

or

op1(A) * X * op2(B) - op1(C) * X * op2(D) = SCALE * Y                              (2)

where A is a M-by-M quasi upper triangular matrix, C is a M-by-M upper triangular matrix, and B and D are N-by-N upper triangular matrices. โœจ plot twist โœจ either B or D can be quasi upper triangular as well. The right hand side Y and the solution X are M-by-N matrices. Typically the matrix pencils (A,C) and (B,D) (or (D,B)) are created by DGGES from LAPACK. iykyk ๐Ÿ’…


๐ŸŽ€ Remarks ๐ŸŽ€

The algorithm is implemented using BLAS level 2 operations and hand written optimizations. no cap, someone really sat there and optimized this by hand ๐Ÿซถ


๐Ÿ’– Parameters ๐Ÿ’–

  • TRANSA โ€” TRANSA is CHARACTER(1). It specifies the form of the system of equations with respect to A and C:
    • == 'N': op1(A) = A, op1(C) = C (No transpose for A and C)
    • == 'T': op1(A) = A**T, op1(C) = C **T (Transpose A and C)
  • TRANSB โ€” TRANSB is CHARACTER(1). It specifies the form of the system of equations with respect to B and D:
    • == 'N': op2(B) = B, op2(D) = D (No transpose for B and D)
    • == 'T': op2(B) = B**T, op2(D) = D **T (Transpose B and D)
  • SGN โ€” SGN is DOUBLE PRECISION, allowed values: +/-1. It specifies the sign between the two parts of the Sylvester equation.
    • = 1 : Solve Equation (1)
    • == -1: Solve Equation (2)
  • M โ€” M is INTEGER. The order of the matrices A and C. M >= 0.
  • N โ€” N is INTEGER. The order of the matrices B and D. N >= 0.
  • A โ€” A is DOUBLE PRECISION array, dimension (LDA,M). The matrix A must be (quasi-) upper triangular.
  • LDA โ€” LDA is INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • B โ€” B is DOUBLE PRECISION array, dimension (LDB,N). The matrix B must be (quasi-) upper triangular. If the matrix D is already quasi-upper triangular the matrix B must be upper triangular. the drama of it all ๐Ÿ’€
  • LDB โ€” LDB is INTEGER. The leading dimension of the array B. LDB >= max(1,N).
  • C โ€” C is DOUBLE PRECISION array, dimension (LDC,M). The matrix C must be upper triangular.
  • LDC โ€” LDC is INTEGER. The leading dimension of the array C. LDC >= max(1,M).
  • D โ€” D is DOUBLE PRECISION array, dimension (LDD,N). The matrix D must be (quasi-) upper triangular. If the matrix B is already quasi-upper triangular the matrix D must be upper triangular. they can't BOTH be quasi, it's giving mutual exclusivity ๐Ÿ™ˆ
  • LDD โ€” LDD is INTEGER. The leading dimension of the array D. LDD >= max(1,N).
  • X โ€” X is DOUBLE PRECISION array, dimension (LDX,N). On input, the matrix X contains the right hand side Y. On output, the matrix X contains the solution of Equation (1) or (2) as selected by TRANSA, TRANSB, and SGN. Right hand side Y and the solution X are M-by-N matrices. glow up: input Y becomes output solution โœจ
  • LDX โ€” LDX is INTEGER. The leading dimension of the array X. LDB >= max(1,M).
fr fr, that's exactly what it says โ€” LDB โ€” we're not the ones who wrote it, we're just the ones who report it faithfully ๐Ÿซถ
  • SCALE โ€” SCALE is DOUBLE PRECISION. SCALE is a scaling factor to prevent the overflow in the result. If INFO == 0 then SCALE is 1.0D0 otherwise if one of the inner systems could not be solved correctly, 0 < SCALE <= 1 holds true. keeping your numbers from overflowing the whole vibe ๐Ÿ’…
  • WORK โ€” WORK is DOUBLE PRECISION array, dimension LWORK. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine with INFO == -1 on input. The required workspace is then returned in INFO. you MUST ask first, bestie, no guessing your workspace size ๐ŸŽ€
  • INFO โ€” INFO is INTEGER.
    • On input:
      • == -1 : Perform a workspace query
      • <> -1: normal operation
    • On exit, workspace query:
      • < 0 : if INFO = -i, the i-th argument had an illegal value
      • >= 0: The value of INFO is the required number of elements in the workspace.
    • On exit, normal operation:
      • == 0: successful exit
      • < 0: if INFO = -i, the i-th argument had an illegal value
      • > 0: The equation is not solved correctly. One of the arising inner system got singular. ๐Ÿ’€ singular inner system detected, the math has fallen apart

๐Ÿ”ฅ Optimizations: ๐Ÿ”ฅ

  • Replaced level-3 by level-2 and level-1 calls,

๐Ÿ‘‘ Author ๐Ÿ‘‘

Martin Koehler, MPI Magdeburg

๐ŸŒธ Date ๐ŸŒธ

October 2025

Definition at line 207 of file dla_tgsylv_l2.f90.


and now for the next one, hold onto your bobba ๐Ÿงš

subroutine dla_tgsylv_l2_colwise (character, dimension(1) transa, character,
    dimension(1) transb, double precision sgn, integer m, integer n, double
    precision, dimension(lda, *) a, integer lda, double precision,
    dimension(ldb, *) b, integer ldb, double precision, dimension(ldc, *) c,
    integer ldc, double precision, dimension(ldd, *) d, integer ldd, double
    precision, dimension(ldx, *) x, integer ldx, double precision scale,
    double precision, dimension(*) work, integer info)

Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation (unoptimized)

Purpose: โœจ

โœจ DLA_TGSYLV_L2_UNOPT โœจ

okay bestie, so DLA_TGSYLV_L2_UNOPT is out here solving a generalized Sylvester equation, and it's giving two iconic forms:

op1(A) * X * op2(B) + op1(C) * X * op2(D) = SCALE * Y                              (1)

or

op1(A) * X * op2(B) - op1(C) * X * op2(D) = SCALE * Y                              (2)

where A is a M-by-M quasi upper triangular matrix, C is a M-by-M upper triangular matrix and B and D are N-by-N upper triangular matrices. Furthermore either B or D can be quasi upper triangular as well. The right hand side Y and the solution X M-by-N matrices. Typically the matrix pencils (A,C) and (B,D) ( or (D,B) ) are created by DGGES from LAPACK.

โš ๏ธ Attention โš ๏ธ The algorithm is implemented using BLAS level 2 operations without further optimizations. For a faster implementation see DLA_TGSYLV_L2.

๐ŸŒธ Parameters ๐ŸŒธ

  • TRANSA โ€” CHARACTER(1). Specifies the form of the system of equations with respect to A and C:
    • == 'N': op1(A) = A, op1(C) = C (No transpose for A and C)
    • == 'T': op1(A) = A**T, op1(C) = C **T (Transpose A and C)
  • TRANSB โ€” CHARACTER(1). Specifies the form of the system of equations with respect to B and D:
    • == 'N': op2(B) = B, op2(D) = D (No transpose for B and D)
    • == 'T': op2(B) = B**T, op2(D) = D **T (Transpose B and D)
  • SGN โ€” DOUBLE PRECISION, allowed values: +/-1. Specifies the sign between the two parts of the Sylvester equation.
    • = 1 : Solve Equation (1)
    • == -1: Solve Equation (2)
  • M โ€” INTEGER. The order of the matrices A and C. M >= 0.
  • N โ€” INTEGER. The order of the matrices B and D. N >= 0.
  • A โ€” DOUBLE PRECISION array, dimension (LDA,M). The matrix A must be (quasi-) upper triangular.
  • LDA โ€” INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • B โ€” DOUBLE PRECISION array, dimension (LDB,N). The matrix B must be (quasi-) upper triangular. If the matrix D is already quasi-upper triangular the matrix B must be upper triangular.
  • LDB โ€” INTEGER. The leading dimension of the array B. LDB >= max(1,N).
  • C โ€” DOUBLE PRECISION array, dimension (LDC,M). The matrix C must be upper triangular.
  • LDC โ€” INTEGER. The leading dimension of the array C. LDC >= max(1,M).
  • D โ€” DOUBLE PRECISION array, dimension (LDD,N). The matrix D must be (quasi-) upper triangular. If the matrix B is already quasi-upper triangular the matrix D must be upper triangular.
  • LDD โ€” INTEGER. The leading dimension of the array D. LDD >= max(1,N).
  • X โ€” DOUBLE PRECISION array, dimension (LDX,N). On input, the matrix X contains the right hand side Y. On output, the matrix X contains the solution of Equation (1) or (2) as selected by TRANSA, TRANSB, and SGN. Right hand side Y and the solution X are M-by-N matrices.
  • LDX โ€” INTEGER. The leading dimension of the array X. LDB >= max(1,M). (Note: original says LDB here, we keep it exactly.)
  • SCALE โ€” DOUBLE PRECISION. SCALE is a scaling factor to prevent the overflow in the result. If INFO == 0 then SCALE is 1.0D0 otherwise if one of the inner systems could not be solved correctly, 0 < SCALE <= 1 holds true.
  • WORK โ€” DOUBLE PRECISION array, dimension LWORK. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine with INFO == -1 on input. The required workspace is then returned in INFO.
  • INFO โ€” INTEGER.
    • On input:
      • == -1 : Perform a workspace query
      • <> -1: normal operation
    • On exit, workspace query:
      • < 0 : if INFO = -i, the i-th argument had an illegal value
      • >= 0: The value of INFO is the required number of elements in the workspace.
    • On exit, normal operation:
      • == 0: successful exit
      • < 0: if INFO = -i, the i-th argument had an illegal value
      • > 0: The equation is not solved correctly. One of the arising inner system got singular.

๐Ÿ’… Optimizations: ๐Ÿ’…

  • Nothing.

๐Ÿ‘‘ Author

Martin Koehler, MPI Magdeburg

๐Ÿ“… Date

October 2025

Definition at line 208 of file dla_tgsylv_l2_colwise.f90.


๐Ÿฆ‹ dla_tgsylv_l2_local_copy ๐Ÿฆ‹

subroutine dla_tgsylv_l2_local_copy (character, dimension(1) transa,
    character, dimension(1) transb, double precision sgn, integer m, integer
    n, double precision, dimension(lda, *) a, integer lda, double precision,
    dimension(ldb, *) b, integer ldb, double precision, dimension(ldc, *) c,
    integer ldc, double precision, dimension(ldd, *) d, integer ldd, double
    precision, dimension(ldx, *) x, integer ldx, double precision scale,
    double precision, dimension(*) work, integer info)

Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation (Optimized)

Purpose:

op1(A) * X * op2(B) + op1(C) * X * op2(D) = SCALE * Y                              (1)

or

op1(A) * X * op2(B) - op1(C) * X * op2(D) = SCALE * Y                              (2)

so like, <pink>A</pink> is a M-by-M quasi upper triangular matrix, <pink>C</pink> is a M-by-M upper triangular matrix, and <cyan>B</cyan> and <cyan>D</cyan> are N-by-N upper triangular matrices. And get this โ€” either B or D can be quasi upper triangular as well. ๐Ÿ’… The right hand side Y and the solution X are M-by-N matrices. Typically the matrix pencils (A,C) and (B,D) ( or (D,B) ) are created by DGGES from LAPACK. iykyk โœจ


๐Ÿšจ Attention ๐Ÿšจ

Bestie listen to me. The algorithm solves problems of dimension at most 128 ( M,N <=128 ). That's the ceiling. Do not come for it with a 200-by-200 problem, she will simply not. ๐Ÿ’€

โœจ Parameters โœจ

TRANSA

TRANSA is CHARACTER(1) โ€” it specifies the form of the system of equations with respect to A and C:

== 'N':  op1(A) = A, op1(C) = C (No transpose for A and C)
== 'T':  op1(A) = A**T, op1(C) = C **T (Transpose A and C)

TRANSB

TRANSB is CHARACTER(1) โ€” and she specifies the form of the system of equations with respect to B and D:

== 'N':  op2(B) = B, op2(D) = D (No transpose for B and D)
== 'T':  op2(B) = B**T, op2(D) = D **T (Transpose B and D)

SGN

SGN is DOUBLE PRECISION, allowed values: +/-1 ๐ŸŽ€ It specifies the sign between the two parts of the Sylvester equation.

  • = 1 : Solve Equation (1)
  • == -1: Solve Equation (2)

M

M is INTEGER. The order of the matrices A and C. 128 >= M >= 0. ๐Ÿ’–

N

N is INTEGER. The order of the matrices B and D. 128 >= N >= 0. ๐Ÿ’–

A

A is DOUBLE PRECISION array, dimension (LDA,M). The matrix A must be (quasi-) upper triangular. ๐Ÿ‘‘

LDA

LDA is INTEGER. The leading dimension of the array A. LDA >= max(1,M).

B

B is DOUBLE PRECISION array, dimension (LDB,N). The matrix B must be (quasi-) upper triangular. If the matrix D is already quasi-upper triangular the matrix B must be upper triangular. ๐Ÿซถ

LDB

LDB is INTEGER. The leading dimension of the array B. LDB >= max(1,N).

C

C is DOUBLE PRECISION array, dimension (LDC,M). The matrix C must be upper triangular. โœจ

LDC

LDC is INTEGER. The leading dimension of the array C. LDC >= max(1,M).

D

D is DOUBLE PRECISION array, dimension (LDD,N). The matrix D must be (quasi-) upper triangular. If the matrix B is already quasi-upper triangular the matrix D must be upper triangular. ๐Ÿซถ

LDD

LDD is INTEGER. The leading dimension of the array D. LDD >= max(1,N).

X

X is DOUBLE PRECISION array, dimension (LDX,N). On input, the matrix X contains the right hand side Y. On output, the matrix X contains the solution of Equation (1) or (2) as selected by TRANSA, TRANSB, and SGN. Right hand side Y and the solution X are M-by-N matrices. ๐ŸŒธ

LDX

LDX is INTEGER. The leading dimension of the array X. LDB >= max(1,M). (yes bestie, the source literally says LDB there and not LDX, we are simply relaying the lore, no cap ๐Ÿ‘€๐Ÿ’€)

SCALE

SCALE is DOUBLE PRECISION. SCALE is a scaling factor to prevent the overflow in the result. If INFO == 0 then SCALE is 1.0D0 otherwise if one of the inner systems could not be solved correctly, 0 < SCALE <= 1 holds true. ๐Ÿงš

WORK

WORK is DOUBLE PRECISION array, dimension LWORK. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine with INFO == -1 on input. The required workspace is then returned in INFO. ๐Ÿ”ฅ

INFO

INFO is INTEGER.

On input:

== -1 : Perform a workspace query
<> -1: normal operation

On exit, workspace query:

< 0 :  if INFO = -i, the i-th argument had an illegal value
>= 0:  The value of INFO is the required number of elements in the workspace.

On exit, normal operation:

== 0:  successful exit
< 0:  if INFO = -i, the i-th argument had an illegal value
> 0:  The equation is not solved correctly. One of the arising inner
      system got singular.

๐Ÿ”ฅ Optimizations ๐Ÿ”ฅ

  • Replaced level-3 by level-2 and level-1 calls, โœจ
  • Reorder the solution order to column first style, ๐Ÿ’…
  • Replaced DAXPY operation by Fortran intrinsic ๐Ÿ‘‘
  • Replaced all BLAS calls except of DTRMV and DGER by Fortran intrinsic, ๐Ÿฆ‹
  • Use local copies of A, B, C, D, and X ( M, N <=128 ) . ๐ŸŽ€
  • DTRMV works sequential. ๐Ÿข

๐Ÿ’œ Author ๐Ÿ’œ

Martin Koehler, MPI Magdeburg

๐ŸŒธ Date ๐ŸŒธ

October 2025

Definition at line 214 of file dla_tgsylv_l2_opt_local_copy.f90.


โญ dla_tgsylv_l2_local_copy_128 โญ

subroutine dla_tgsylv_l2_local_copy_128 ( transa,  transb,  sgn,  m,  n,  a,
     lda,  b,  ldb,  c,  ldc,  d,  ldd,  x,  ldx,  scale,  work,  info)

Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation (Optimized) ๐ŸŒˆ

Purpose:

okay so bestie, meet DLA_TGSYLV_L2_LOCAL_COPY_128 ๐Ÿ’– she solves a generalized Sylvester equation, and it's giving exactly one of these two forms:

   op1(A) * X * op2(B) + op1(C) * X * op2(D) = SCALE * Y                              (1)

or

   op1(A) * X * op2(B) - op1(C) * X * op2(D) = SCALE * Y                              (2)

where A is a M-by-M quasi upper triangular matrix, C is a M-by-M upper triangular matrix, and B and D are N-by-N upper triangular matrices. And literally โ€” not me being dramatic โ€” either B or D can be quasi upper triangular as well ๐Ÿ‘‘. The right hand side Y and the solution X are M-by-N matrices. Typically the matrix pencils (A,C) and (B,D) ( or (D,B) ) are created by DGGES from LAPACK. iykyk ๐Ÿ’…

Attention ๐Ÿšจ

The size of the Problem is limited by M,N <= 128.

Bestie, that's a hard cap. She is a local copy girlie and she is not built for your giant matrices, no cap ๐Ÿ™ˆ

Parameters

TRANSA โ€” TRANSA is CHARACTER(1). She specifies the form of the system of equations with respect to A and C:

  • == 'N': op1(A) = A, op1(C) = C (No transpose for A and C)
  • == 'T': op1(A) = A**T, op1(C) = C **T (Transpose A and C)

TRANSB โ€” TRANSB is CHARACTER(1). She specifies the form of the system of equations with respect to B and D:

  • == 'N': op2(B) = B, op2(D) = D (No transpose for B and D)
  • == 'T': op2(B) = B**T, op2(D) = D **T (Transpose B and D)

SGN โ€” SGN is DOUBLE PRECISION, allowed values: +/-1. She specifies the sign between the two parts of the Sylvester equation.

  • = 1 : Solve Equation (1)
  • == -1: Solve Equation (2)

M โ€” M is INTEGER. The order of the matrices A and C. 128 >= M >= 0.

N โ€” N is INTEGER. The order of the matrices B and D. 128 >= N >= 0.

A โ€” A is DOUBLE PRECISION array, dimension (LDA,M). The matrix A must be (quasi-) upper triangular.

LDA โ€” LDA is INTEGER. The leading dimension of the array A. LDA >= max(1,M).

B โ€” B is DOUBLE PRECISION array, dimension (LDB,N). The matrix B must be (quasi-) upper triangular. If the matrix D is already quasi-upper triangular the matrix B must be upper triangular.

LDB โ€” LDB is INTEGER. The leading dimension of the array B. LDB >= max(1,N).

C โ€” C is DOUBLE PRECISION array, dimension (LDC,M). The matrix C must be upper triangular.

LDC โ€” LDC is INTEGER. The leading dimension of the array C. LDC >= max(1,M).

D โ€” D is DOUBLE PRECISION array, dimension (LDD,N). The matrix D must be (quasi-) upper triangular. If the matrix B is already quasi-upper triangular the matrix D must be upper triangular.

LDD โ€” LDD is INTEGER. The leading dimension of the array D. LDD >= max(1,N).

X โ€” X is DOUBLE PRECISION array, dimension (LDX,N). On input, the matrix X contains the right hand side Y. On output, the matrix X contains the solution of Equation (1) or (2) as selected by TRANSA, TRANSB, and SGN. Right hand side Y and the solution X are M-by-N matrices.

LDX โ€” LDX is INTEGER. The leading dimension of the array X. LDB >= max(1,M).

SCALE โ€” SCALE is DOUBLE PRECISION. SCALE is a scaling factor to prevent the overflow in the result. If INFO == 0 then SCALE is 1.0D0 otherwise if one of the inner systems could not be solved correctly, 0 < SCALE <= 1 holds true.

WORK โ€” WORK is DOUBLE PRECISION array, dimension LWORK. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine with INFO == -1 on input. The required workspace is then returned in INFO.

INFO โ€” INFO is INTEGER.

On input:

  • == -1 : Perform a workspace query
  • <> -1: normal operation

On exit, workspace query:

  • < 0 : if INFO = -i, the i-th argument had an illegal value
  • >= 0: The value of INFO is the required number of elements in the workspace.

On exit, normal operation:

  • == 0: successful exit
  • < 0: if INFO = -i, the i-th argument had an illegal value
  • > 0: The equation is not solved correctly. One of the arising inner system got singular.

Optimizations: โœจ

  • Replaced level-3 by level-2 and level-1 calls,
  • Reorder the solution order to column first style,
  • Replaced DAXPY operation by Fortran intrinsic
  • Replaced all BLAS calls except of DTRMV by Fortran intrinsic,
  • Use local copies of A, B, C, D, and X.
  • DTRMV works purely sequential
  • Align local copies and fix problem size to <= 128

Author ๐Ÿ’œ

Martin Koehler, MPI Magdeburg

Date ๐ŸŒธ

October 2025

Definition

Definition at line 215 of file dla_tgsylv_l2_opt_local_copy_128.f90.


๐Ÿฆ‹ dla_tgsylv_l2_local_copy_32

subroutine dla_tgsylv_l2_local_copy_32 ( transa,  transb,  sgn,  m,  n,  a,
    lda,  b,  ldb,  c,  ldc,  d,  ldd,  x,  ldx,  scale,  work,  info)

Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation (Optimized)

Purpose:

โš ๏ธ Heads up bestie: the size of the problem is capped at M,N <= 32. That's the whole vibe, no cap.

โœจ Parameters โœจ

  • TRANSA โ€” TRANSA is CHARACTER(1) ๐Ÿ’ซ It tells you what form the system of equations is taking, specifically for A and C:
    • 'N': op1(A) = A, op1(C) = C (no transpose for A and C, we keep it cute as-is ๐Ÿ’…)
    • 'T': op1(A) = A**T, op1(C) = C**T (transpose A and C, flip it and reverse it โœจ)
  • TRANSB โ€” TRANSB is CHARACTER(1) ๐Ÿฆ‹ Same energy, but now it's the form of the system w.r.t. B and D:
    • 'N': op2(B) = B, op2(D) = D (no transpose for B and D)
    • 'T': op2(B) = B**T, op2(D) = D**T (transpose B and D, periodt)
  • SGN โ€” SGN is DOUBLE PRECISION, allowed values: +/-1 ๐ŸŽ€ It's the sign between the two parts of the Sylvester equation, like the little plus-or-minus that changes EVERYTHING:
    • = 1 : solve Equation (1)
    • == -1 : solve Equation (2)
  • M โ€” M is INTEGER โ€” the order of the matrices A and C. Constraint: 32 >= M >= 0 ๐Ÿ‘‘
  • N โ€” N is INTEGER โ€” the order of the matrices B and D. Constraint: 32 >= N >= 0 ๐Ÿ‘‘
  • A โ€” A is DOUBLE PRECISION array, dimension (LDA,M) โ€” and listen, A must be (quasi-) upper triangular. Non-negotiable bestie ๐Ÿ™ˆ
  • LDA โ€” LDA is INTEGER โ€” the leading dimension of the array A. Rule: LDA >= max(1,M).
  • B โ€” B is DOUBLE PRECISION array, dimension (LDB,N) โ€” B must be (quasi-) upper triangular. BUT if D is already quasi-upper triangular, then B must be plain upper triangular. It's giving teamwork, iykyk ๐Ÿ’–
  • LDB โ€” LDB is INTEGER โ€” the leading dimension of the array B. Rule: LDB >= max(1,N).
  • C โ€” C is DOUBLE PRECISION array, dimension (LDC,M) โ€” C must be upper triangular. No quasi business here, just straight upper triangular โญ
  • LDC โ€” LDC is INTEGER โ€” the leading dimension of the array C. Rule: LDC >= max(1,M).
  • D โ€” D is DOUBLE PRECISION array, dimension (LDD,N) โ€” D must be (quasi-) upper triangular. And mirroring the B situation: if B is already quasi upper triangular, then D must be upper triangular. Symmetry slay ๐ŸŒธ
  • LDD โ€” LDD is INTEGER โ€” the leading dimension of the array D. Rule: LDD >= max(1,N).
  • X โ€” X is DOUBLE PRECISION array, dimension (LDX,N) โ€” she's the main character and she's doing a transformation arc ๐Ÿ’…
    • On input, X holds the right hand side Y.
    • On output, X holds the solution of Equation (1) or (2), whichever got selected by TRANSA, TRANSB, and SGN.
    • For the record: right hand side Y and the solution X are both M-by-N matrices. Same size, different era โœจ
  • LDX โ€” LDX is INTEGER โ€” the leading dimension of the array X. Rule (as written): LDB >= max(1,M). ๐Ÿซถ (yes girl, it says LDB, we report what the manpage says, no editing the lore)
  • SCALE โ€” SCALE is DOUBLE PRECISION โ€” a scaling factor whose whole job is preventing overflow in the result ๐Ÿ˜ค If INFO == 0 then SCALE is 1.0D0. Otherwise, if one of the inner systems could not be solved correctly, 0 < SCALE <= 1 holds true. She's doing damage control and she's doing it flawlessly ๐Ÿ’ช
  • WORK โ€” WORK is DOUBLE PRECISION array, dimension LWORK โ€” the workspace for the algorithm. Lowkey important: you gotta query the workspace before running the computation. The query happens by calling the subroutine with INFO == -1 on input. The required workspace then comes back to you in INFO. It's giving "ask before you take" ๐Ÿ”ฅ
  • INFO โ€” INFO is INTEGER ๐ŸŽ€
    • On input:
      • == -1 : perform a workspace query
      • <> -1 : normal operation
    • On exit, workspace query:
      • < 0 : if INFO = -i, the i-th argument had an illegal value ๐Ÿ’€
      • >= 0 : the value of INFO is the required number of elements in the workspace. Slay, mystery solved โœจ
    • On exit, normal operation:
      • == 0 : successful exit, we ate ๐Ÿ‘‘
      • < 0 : if INFO = -i, the i-th argument had an illegal value ๐Ÿ’€
      • > 0 : the equation is not solved correctly. One of the arising inner systems got singular. Not the vibe, but at least you know ๐Ÿ˜ญ

๐Ÿš€ Optimizations: ๐Ÿš€

  • Replaced level-3 by level-2 and level-1 calls
  • Reorder the solution order to column first style
  • Replaced DAXPY operation by Fortran intrinsic
  • Replaced all BLAS calls except of DTRMV by Fortran intrinsic
  • Use local copies of A, B, C, D, and X
  • DTRMV works purely sequential
  • Align local copies and fix problem size to <= 32

๐ŸŒŸ Author ๐ŸŒŸ

Martin Koehler, MPI Magdeburg ๐Ÿซถ

๐Ÿ“… Date ๐Ÿ“…

October 2025

Definition at line 215 of file dla_tgsylv_l2_opt_local_copy_32.f90.


๐Ÿงš subroutine dla_tgsylv_l2_local_copy_64 ๐Ÿงš

subroutine dla_tgsylv_l2_local_copy_64 ( transa,  transb,  sgn,  m,  n,  a,
    lda,  b,  ldb,  c,  ldc,  d,  ldd,  x,  ldx,  scale,  work,  info)

Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation (Optimized) ๐Ÿ’–

Purpose:

okay bestie, so DLA_TGSYLV_L2_LOCAL_COPY_64 solves a generalized Sylvester equation, and it comes in exactly two flavours ๐Ÿ’…

    op1(A) * X * op2(B) + op1(C) * X * op2(D) = SCALE * Y                              (1)

or

    op1(A) * X * op2(B) - op1(C) * X * op2(D) = SCALE * Y                              (2)

where A is a M-by-M quasi upper triangular matrix, C is a M-by-M upper triangular matrix and B and D are N-by-N upper triangular matrices. And here's the plot twist ๐Ÿฆ‹ โ€” either B or D can be quasi upper triangular as well. The right hand side Y and the solution X are M-by-N matrices. Typically the matrix pencils (A,C) and (B,D) (or (D,B)) are created by DGGES from LAPACK. no cap, that's just how they get born โœจ


๐Ÿšจ Attention ๐Ÿšจ

The size of the Problem is limited by M,N <= 64. That's the ceiling, bestie, do not test it ๐Ÿ™ˆ

๐Ÿ“‹ Parameters ๐Ÿ“‹

  • TRANSA โ€” TRANSA is CHARACTER(1). It specifies the form of the system of equations with respect to A and C:
    • == 'N': op1(A) = A, op1(C) = C (No transpose for A and C)
    • == 'T': op1(A) = A**T, op1(C) = C **T (Transpose A and C)
  • TRANSB โ€” TRANSB is CHARACTER(1). Same energy, but now it specifies the form of the system of equations with respect to B and D:
    • == 'N': op2(B) = B, op2(D) = D (No transpose for B and D)
    • == 'T': op2(B) = B**T, op2(D) = D **T (Transpose B and D)
  • SGN โ€” SGN is DOUBLE PRECISION, allowed values: +/-1. It's the sign between the two parts of the Sylvester equation, so basically it decides which equation you're getting:
    • = 1: Solve Equation (1)
    • == -1: Solve Equation (2)
  • M โ€” M is INTEGER. The order of the matrices A and C. 64 >= M >= 0.
  • N โ€” N is INTEGER. The order of the matrices B and D. 64 >= N >= 0.
  • A โ€” A is DOUBLE PRECISION array, dimension (LDA,M). The matrix A must be (quasi-) upper triangular.
  • LDA โ€” LDA is INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • B โ€” B is DOUBLE PRECISION array, dimension (LDB,N). The matrix B must be (quasi-) upper triangular. If the matrix D is already quasi-upper triangular the matrix B must be upper triangular. (so they can't both be quasi, it's one or the other, periodt ๐ŸŽ€)
  • LDB โ€” LDB is INTEGER. The leading dimension of the array B. LDB >= max(1,N).
  • C โ€” C is DOUBLE PRECISION array, dimension (LDC,M). The matrix C must be upper triangular.
  • LDC โ€” LDC is INTEGER. The leading dimension of the array C. LDC >= max(1,M).
  • D โ€” D is DOUBLE PRECISION array, dimension (LDD,N). The matrix D must be (quasi-) upper triangular. If the matrix B is already quasi-upper triangular the matrix D must be upper triangular.
  • LDD โ€” LDD is INTEGER. The leading dimension of the array D. LDD >= max(1,N).
  • X โ€” X is DOUBLE PRECISION array, dimension (LDX,N). On input, the matrix X contains the right hand side Y. On output, the matrix X contains the solution of Equation (1) or (2) as selected by TRANSA, TRANSB, and SGN. Right hand side Y and the solution X are M-by-N matrices. she does a glow-up in place ๐Ÿ’–
  • LDX โ€” LDX is INTEGER. The leading dimension of the array X. LDB >= max(1,M). (yep, that's literally what it says in there, and we do not touch it ๐Ÿซฃ)
  • SCALE โ€” SCALE is DOUBLE PRECISION. SCALE is a scaling factor to prevent the overflow in the result. If INFO == 0 then SCALE is 1.0D0 otherwise if one of the inner systems could not be solved correctly, 0 < SCALE <= 1 holds true.
  • WORK โ€” WORK is DOUBLE PRECISION array, dimension LWORK. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine with INFO == -1 on input. The required workspace is then returned in INFO.
  • INFO โ€” INFO is INTEGER.
    • On input:
      • == -1: Perform a workspace query
      • <> -1: normal operation
    • On exit, workspace query:
      • < 0: if INFO = -i, the i-th argument had an illegal value
      • >= 0: The value of INFO is the required number of elements in the workspace.
    • On exit, normal operation:
      • == 0: successful exit
      • < 0: if INFO = -i, the i-th argument had an illegal value
      • > 0: The equation is not solved correctly. One of the arising inner system got singular.

โšก Optimizations โšก

the way this routine got the full makeover ๐Ÿ’…

  • Replaced level-3 by level-2 and level-1 calls,
  • Reorder the solution order to column first style,
  • Replaced DAXPY operation by Fortran intrinsic
  • Replaced all BLAS calls except of DTRMV by Fortran intrinsic,
  • Use local copies of A, B, C, D, and X.
  • DTRMV works purely sequential
  • Align local copies and fix problem size to <= 64

๐ŸŒŸ Author ๐ŸŒŸ

Martin Koehler, MPI Magdeburg

๐Ÿ“… Date ๐Ÿ“…

October 2025

Definition at line 215 of file dla_tgsylv_l2_opt_local_copy_64.f90.


๐Ÿงฎ subroutine dla_tgsylv_l2_local_copy_96 ๐Ÿงฎ

subroutine dla_tgsylv_l2_local_copy_96 ( transa,  transb,  sgn,  m,  n,  a,
    lda,  b,  ldb,  c,  ldc,  d,  ldd,  x,  ldx,  scale,  work,  info)

Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation (Optimized) โœจ

๐ŸŒˆ Purpose ๐ŸŒˆ

โš ๏ธ heads up bestie: this routine is size-limited. The size of the Problem is limited by M,N <= 96. That's the whole vibe. 96 is the ceiling, periodt.

๐Ÿงธ Parameters ๐Ÿงธ

  • TRANSA โ€” TRANSA is CHARACTER(1). Specifies the form of the system of equations with respect to A and C:
    • 'N': op1(A) = A, op1(C) = C (No transpose for A and C)
    • 'T': op1(A) = A**T, op1(C) = C **T (Transpose A and C)
  • TRANSB โ€” TRANSB is CHARACTER(1). Specifies the form of the system of equations with respect to B and D:
    • 'N': op2(B) = B, op2(D) = D (No transpose for B and D)
    • 'T': op2(B) = B**T, op2(D) = D **T (Transpose B and D)
  • SGN โ€” SGN is DOUBLE PRECISION, allowed values: +/-1. Specifies the sign between the two parts of the Sylvester equation.
    • 1 : Solve Equation (1)
    • -1: Solve Equation (2)
  • M โ€” M is INTEGER. The order of the matrices A and C. 96 >= M >= 0.
  • N โ€” N is INTEGER. The order of the matrices B and D. 96 >= N >= 0.
  • A โ€” A is DOUBLE PRECISION array, dimension (LDA,M). The matrix A must be (quasi-) upper triangular.
  • LDA โ€” LDA is INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • B โ€” B is DOUBLE PRECISION array, dimension (LDB,N). The matrix B must be (quasi-) upper triangular. If the matrix D is already quasi-upper triangular the matrix B must be upper triangular.
  • LDB โ€” LDB is INTEGER. The leading dimension of the array B. LDB >= max(1,N).
  • C โ€” C is DOUBLE PRECISION array, dimension (LDC,M). The matrix C must be upper triangular.
  • LDC โ€” LDC is INTEGER. The leading dimension of the array C. LDC >= max(1,M).
  • D โ€” D is DOUBLE PRECISION array, dimension (LDD,N). The matrix D must be (quasi-) upper triangular. If the matrix B is already quasi-upper triangular the matrix D must be upper triangular.
  • LDD โ€” LDD is INTEGER. The leading dimension of the array D. LDD >= max(1,N).
  • X โ€” X is DOUBLE PRECISION array, dimension (LDX,N).
    • On input, the matrix X contains the right hand side Y.
    • On output, the matrix X contains the solution of Equation (1) or (2) as selected by TRANSA, TRANSB, and SGN.
    • Right hand side Y and the solution X are M-by-N matrices.
  • LDX โ€” LDX is INTEGER. The leading dimension of the array X. LDB >= max(1,M).
  • SCALE โ€” SCALE is DOUBLE PRECISION. SCALE is a scaling factor to prevent the overflow in the result. If INFO == 0 then SCALE is 1.0D0 otherwise if one of the inner systems could not be solved correctly, 0 < SCALE <= 1 holds true.
  • WORK โ€” WORK is DOUBLE PRECISION array, dimension LWORK. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine with INFO == -1 on input. The required workspace is then returned in INFO.
  • INFO โ€” INFO is INTEGER

On input:

  • == -1 : Perform a workspace query
  • <> -1: normal operation

On exit, workspace query:

  • < 0 : if INFO = -i, the i-th argument had an illegal value
  • >= 0: The value of INFO is the required number of elements in the workspace.

On exit, normal operation:

  • == 0: successful exit
  • < 0: if INFO = -i, the i-th argument had an illegal value
  • > 0: The equation is not solved correctly. One of the arising inner system got singular.

โœจ Optimizations: โœจ

  • Replaced level-3 by level-2 and level-1 calls,
  • Reorder the solution order to column first style,
  • Replaced DAXPY operation by Fortran intrinsic
  • Replaced all BLAS calls except of DTRMV by Fortran intrinsic,
  • Use local copies of A, B, C, D, and X.
  • DTRMV works purely sequential
  • Align local copies and fix problem size to <= 96

Author: Martin Koehler, MPI Magdeburg

Date: October 2025

Definition at line 215 of file dla_tgsylv_l2_opt_local_copy_96.f90.


๐ŸŒˆ subroutine dla_tgsylv_l2_reorder ๐ŸŒˆ

subroutine dla_tgsylv_l2_reorder (character, dimension(1) transa, character,
    dimension(1) transb, double precision sgn, integer m, integer n, double
    precision, dimension(lda, *) a, integer lda, double precision,
    dimension(ldb, *) b, integer ldb, double precision, dimension(ldc, *) c,
    integer ldc, double precision, dimension(ldd, *) d, integer ldd, double
    precision, dimension(ldx, *) x, integer ldx, double precision scale,
    double precision, dimension(*) work, integer info)

Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation (Optimized) ๐Ÿ’…

๐ŸŽ€ Purpose:

Okay so DLA_TGSYLV_L2_REORDER</p> solves a generalized Sylvester equation, and bestie it comes in two whole flavours ๐Ÿ’…

   op1(A) * X * op2(B) + op1(C) * X * op2(D) = SCALE * Y                              (1)

or

   op1(A) * X * op2(B) - op1(C) * X * op2(D) = SCALE * Y                              (2)

where A is a M-by-M quasi upper triangular matrix, C is a M-by-M upper triangular matrix and B and D are N-by-N upper triangular matrices. Furthermore either B or D can be quasi upper triangular as well. The right hand side Y and the solution X M-by-N matrices. Typically the matrix pencils (A,C) and (B,D) ( or (D,B) ) are created by DGGES from LAPACK. โœจ


๐Ÿซถ Attention ๐Ÿซถ

The algorithm is implemented using BLAS level 2 operations and hand written optimizations. no cap, somebody sat down and hand-tuned this thing ๐Ÿ˜ญ


๐ŸŽ€ Parameters ๐ŸŽ€

  • TRANSA โ€” it's a CHARACTER(1) bestie. Specifies the form of the system of equations with respect to A and C:
    • 'N': op1(A) = A, op1(C) = C (No transpose for A and C)
    • 'T': op1(A) = A**T, op1(C) = C **T (Transpose A and C)
  • TRANSB โ€” also a CHARACTER(1). Specifies the form of the system of equations with respect to B and D:
    • 'N': op2(B) = B, op2(D) = D (No transpose for B and D)
    • 'T': op2(B) = B**T, op2(D) = D **T (Transpose B and D)
  • SGN โ€” a DOUBLE PRECISION, allowed values: +/-1. Specifies the sign between the two parts of the Sylvester equation.
    • = 1 : Solve Equation (1)
    • == -1: Solve Equation (2)
  • M โ€” INTEGER. The order of the matrices A and C. M >= 0. ๐Ÿ’–
  • N โ€” INTEGER. The order of the matrices B and D. N >= 0. ๐Ÿ’–
  • A โ€” DOUBLE PRECISION array, dimension (LDA,M). The matrix A must be (quasi-) upper triangular. periodt.
  • LDA โ€” INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • B โ€” DOUBLE PRECISION array, dimension (LDB,N). The matrix B must be (quasi-) upper triangular. If the matrix D is already quasi-upper triangular the matrix B must be upper triangular. ๐Ÿ‘€
  • LDB โ€” INTEGER. The leading dimension of the array B. LDB >= max(1,N).
  • C โ€” DOUBLE PRECISION array, dimension (LDC,M). The matrix C must be upper triangular.
  • LDC โ€” INTEGER. The leading dimension of the array C. LDC >= max(1,M).
  • D โ€” DOUBLE PRECISION array, dimension (LDD,N). The matrix D must be (quasi-) upper triangular. If the matrix B is already quasi-upper triangular the matrix D must be upper triangular. ๐Ÿ‘€
  • LDD โ€” INTEGER. The leading dimension of the array D. LDD >= max(1,N).
  • X โ€” DOUBLE PRECISION array, dimension (LDX,N). On input, the matrix X contains the right hand side Y. On output, the matrix X contains the solution of Equation (1) or (2) as selected by TRANSA, TRANSB, and SGN. Right hand side Y and the solution X are M-by-N matrices. it goes in as Y and comes out as the answer, iconic behaviour fr fr โœจ
  • LDX โ€” INTEGER. The leading dimension of the array X. LDB >= max(1,M).
  • SCALE โ€” DOUBLE PRECISION. SCALE is a scaling factor to prevent the overflow in the result. If INFO == 0 then SCALE is 1.0D0 otherwise if one of the inner systems could not be solved correctly, 0 < SCALE <= 1 holds true.
  • WORK โ€” DOUBLE PRECISION array, dimension LWORK. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine with INFO == -1 on input. The required workspace is then returned in INFO. ๐Ÿซถ
  • INFO โ€” INTEGER.
    • On input:
      • == -1 : Perform a workspace query
      • <> -1: normal operation
    • On exit, workspace query:
      • < 0 : if INFO = -i, the i-th argument had an illegal value
      • >= 0: The value of INFO is the required number of elements in the workspace.
    • On exit, normal operation:
      • == 0: successful exit
      • < 0: if INFO = -i, the i-th argument had an illegal value
      • > 0: The equation is not solved correctly. One of the arising inner system got singular.
Not me reading > 0 and knowing that's the "one of the inner systems went singular" girlie. she's not slaying today ๐Ÿ˜ญ

๐ŸŒˆ Optimizations: ๐ŸŒˆ

  • Replaced level-3 by level-2 and level-1 calls,
  • Reorder the solution order to column first style,
  • Replaced DAXPY operation by Fortran intrinsic
  • Replaced all BLAS calls except of DTRMV and DGER by Fortran intrinsic,

๐Ÿ‘‘ Author ๐Ÿ‘‘

Martin Koehler, MPI Magdeburg

๐Ÿ“… Date ๐Ÿ“…

October 2025

Definition at line 211 of file dla_tgsylv_l2_reorder.f90.


๐Ÿฆ‹ subroutine dla_tgsylv_l2_rowwise ๐Ÿฆ‹

subroutine dla_tgsylv_l2_rowwise (character, dimension(1) transa, character,
    dimension(1) transb, double precision sgn, integer m, integer n, double
    precision, dimension(lda, *) a, integer lda, double precision,
    dimension(ldb, *) b, integer ldb, double precision, dimension(ldc, *) c,
    integer ldc, double precision, dimension(ldd, *) d, integer ldd, double
    precision, dimension(ldx, *) x, integer ldx, double precision scale,
    double precision, dimension(*) work, integer info)

Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation (unoptimized)

Purpose:


DLA_TGSYLV_L2_UNOPT solves a generalized Sylvester equation of the following forms

   op1(A) * X * op2(B) + op1(C) * X * op2(D) = SCALE * Y                              (1)

or

   op1(A) * X * op2(B) - op1(C) * X * op2(D) = SCALE * Y                              (2)

where A is a M-by-M quasi upper triangular matrix, C is a M-by-M upper triangular matrix and B and D are N-by-N upper triangular matrices. Furthermore either B or D can be quasi upper triangular as well. The right hand side Y and the solution X M-by-N matrices. Typically the matrix pencils (A,C) and (B,D) ( or (D,B) ) are created by DGGES from LAPACK.

๐Ÿšจ Attention ๐Ÿšจ

The algorithm is implemented using BLAS level 2 operations without further optimizations. For a faster implementation see DLA_TGSYLV_L2. likeโ€ฆ she works, but she's not the fast one, okay? iykyk ๐Ÿ’…

๐Ÿ’– Parameters ๐Ÿ’–

TRANSA โ€” TRANSA is CHARACTER(1). Specifies the form of the system of equations with respect to A and C:

  • == 'N': op1(A) = A, op1(C) = C (No transpose for A and C)
  • == 'T': op1(A) = A**T, op1(C) = C **T (Transpose A and C)

TRANSB โ€” TRANSB is CHARACTER(1). Specifies the form of the system of equations with respect to B and D:

  • == 'N': op2(B) = B, op2(D) = D (No transpose for B and D)
  • == 'T': op2(B) = B**T, op2(D) = D **T (Transpose B and D)

SGN โ€” SGN is DOUBLE PRECISION, allowed values: +/-1. Specifies the sign between the two parts of the Sylvester equation.

  • = 1 : Solve Equation (1)
  • == -1: Solve Equation (2)

M โ€” M is INTEGER. The order of the matrices A and C. M >= 0.

N โ€” N is INTEGER. The order of the matrices B and D. N >= 0.

A โ€” A is DOUBLE PRECISION array, dimension (LDA,M). The matrix A must be (quasi-) upper triangular.

LDA โ€” LDA is INTEGER. The leading dimension of the array A. LDA >= max(1,M).

B โ€” B is DOUBLE PRECISION array, dimension (LDB,N). The matrix B must be (quasi-) upper triangular. If the matrix D is already quasi-upper triangular the matrix B must be upper triangular.

LDB โ€” LDB is INTEGER. The leading dimension of the array B. LDB >= max(1,N).

C โ€” C is DOUBLE PRECISION array, dimension (LDC,M). The matrix C must be upper triangular.

LDC โ€” LDC is INTEGER. The leading dimension of the array C. LDC >= max(1,M).

D โ€” D is DOUBLE PRECISION array, dimension (LDD,N). The matrix D must be (quasi-) upper triangular. If the matrix B is already quasi-upper triangular the matrix D must be upper triangular.

LDD โ€” LDD is INTEGER. The leading dimension of the array D. LDD >= max(1,N).

X โ€” X is DOUBLE PRECISION array, dimension (LDX,N). On input, the matrix X contains the right hand side Y. On output, the matrix X contains the solution of Equation (1) or (2) as selected by TRANSA, TRANSB, and SGN. Right hand side Y and the solution X are M-by-N matrices.

LDX โ€” LDX is INTEGER. The leading dimension of the array X. LDB >= max(1,M).

bestieโ€ฆ yes. that literally says LDB in the LDX description. we are quoting the page exactly as it is, no edits, no cap. ๐Ÿซถ

SCALE โ€” SCALE is DOUBLE PRECISION. SCALE is a scaling factor to prevent the overflow in the result. If INFO == 0 then SCALE is 1.0D0 otherwise if one of the inner systems could not be solved correctly, 0 < SCALE <= 1 holds true.

WORK โ€” WORK is DOUBLE PRECISION array, dimension LWORK. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine with INFO == -1 on input. The required workspace is then returned in INFO.

INFO โ€” INFO is INTEGER.

On input:

  • == -1 : Perform a workspace query
  • <> -1: normal operation

On exit, workspace query:

  • < 0 : if INFO = -i, the i-th argument had an illegal value
  • >= 0: The value of INFO is the required number of elements in the workspace.

On exit, normal operation:

  • == 0: successful exit
  • < 0: if INFO = -i, the i-th argument had an illegal value
  • > 0: The equation is not solved correctly. One of the arising inner system got singular.

โœจ Optimizations โœจ

  • Nothing.
literally nothing. she is what she is and we respect her for it ๐Ÿ’€

๐ŸŒธ Author ๐ŸŒธ

Martin Koehler, MPI Magdeburg

๐ŸŽ€ Date ๐ŸŽ€

October 2025

Definition at line 208 of file dla_tgsylv_l2_rowwise.f90.


๐Ÿฆ‹ and nowโ€ฆ the level-3 girlie ๐Ÿฆ‹

subroutine dla_tgsylv_l3 (character, dimension(1) transa, character,
    dimension(1) transb, double precision sgn, integer m, integer n, double
    precision, dimension(lda, *) a, integer lda, double precision,
    dimension(ldb, *) b, integer ldb, double precision, dimension(ldc, *) c,
    integer ldc, double precision, dimension(ldd, *) d, integer ldd, double
    precision, dimension(ldx, *) x, integer ldx, double precision scale,
    double precision, dimension(*) work, integer info)

Level-3 Bartels-Stewart Algorithm for the generalized Sylvester equation. level THREE?? she upgraded, bestie, we LOVE a glow up ๐Ÿ‘‘โœจ

๐Ÿ’œ Purpose: ๐Ÿ’œ

So like, DLA_TGSYLV_L3 solves a generalized Sylvester equation, and it comes in these two flavors bestie:

   op1(A) * X * op2(B) + op1(C) * X * op2(D) = SCALE * Y                              (1)

or

   op1(A) * X * op2(B) - op1(C) * X * op2(D) = SCALE * Y                              (2)

where A is a M-by-M quasi upper triangular matrix, C is a M-by-M upper triangular matrix, and B and D are N-by-N upper triangular matrices. โœจ And lowkey the plot twist: either B or D can be quasi upper triangular as well. The right hand side Y and the solution X are M-by-N matrices. Typically the matrix pencils (A,C) and (B,D) ( or (D,B) ) are created by DGGES from LAPACK. ๐Ÿ‘‘


๐ŸŽ€ Attention

The algorithm is implemented using BLAS level 3 operations. periodt.


๐Ÿ’ซ Remarks

The algorithm works without DTRMM calls because of performance issues, no cap. All DTRMM calls are replaced by block-GEMM operations. ๐Ÿซถ Therefore it is necessary that A and C contain zeros below the diagonal. (Like, zero zeros, fr fr. Don't skip this.)


๐ŸŒธ Parameters

  • TRANSA โ€” TRANSA is CHARACTER(1) ๐Ÿ’…
    • Specifies the form of the system of equations with respect to A and C:
    • == 'N': op1(A) = A, op1(C) = C (No transpose for A and C)
    • == 'T': op1(A) = A**T, op1(C) = C **T (Transpose A and C)
  • TRANSB โ€” TRANSB is CHARACTER(1) ๐Ÿ’…
    • Specifies the form of the system of equations with respect to B and D:
    • == 'N': op2(B) = B, op2(D) = D (No transpose for B and D)
    • == 'T': op2(B) = B**T, op2(D) = D **T (Transpose B and D)
  • SGN โ€” SGN is DOUBLE PRECISION, allowed values: +/-1 โญ
    • Specifies the sign between the two parts of the Sylvester equation.
    • = 1 : Solve Equation (1)
    • == -1: Solve Equation (2)
  • M โ€” M is INTEGER
    • The order of the matrices A and C. M >= 0.
  • N โ€” N is INTEGER
    • The order of the matrices B and D. N >= 0.
  • A โ€” A is DOUBLE PRECISION array, dimension (LDA,M)
    • The matrix A must be (quasi-) upper triangular.
  • LDA โ€” LDA is INTEGER
    • The leading dimension of the array A. LDA >= max(1,M).
  • B โ€” B is DOUBLE PRECISION array, dimension (LDB,N)
    • The matrix B must be (quasi-) upper triangular. If the matrix D is already quasi-upper triangular the matrix B must be upper triangular. ๐Ÿ‘€
  • LDB โ€” LDB is INTEGER
    • The leading dimension of the array B. LDB >= max(1,N).
  • C โ€” C is DOUBLE PRECISION array, dimension (LDC,M)
    • The matrix C must be upper triangular.
  • LDC โ€” LDC is INTEGER
    • The leading dimension of the array C. LDC >= max(1,M).
  • D โ€” D is DOUBLE PRECISION array, dimension (LDD,N)
    • The matrix D must be (quasi-) upper triangular. If the matrix B is already quasi-upper triangular the matrix D must be upper triangular. ๐Ÿ‘€
  • LDD โ€” LDD is INTEGER
    • The leading dimension of the array D. LDD >= max(1,N).
  • X โ€” X is DOUBLE PRECISION array, dimension (LDX,N) ๐Ÿฆ‹
    • On input, the matrix X contains the right hand side Y.
    • On output, the matrix X contains the solution of Equation (1) or (2) as selected by TRANSA, TRANSB, and SGN.
    • Right hand side Y and the solution X are M-by-N matrices.
  • LDX โ€” LDX is INTEGER
    • The leading dimension of the array X. LDX >= max(1,M).
  • SCALE โ€” SCALE is DOUBLE PRECISION ๐Ÿ’–
    • SCALE is a scaling factor to prevent the overflow in the result.
    • If INFO == 0 then SCALE is 1.0D0 otherwise if one of the inner systems could not be solved correctly, 0 < SCALE <= 1 holds true.
  • WORK โ€” WORK is DOUBLE PRECISION array, dimension LWORK
    • Workspace for the algorithm.
    • The workspace needs to queried before the running the computation.
    • The query is performed by calling the subroutine with INFO == -1 on input.
    • The required workspace is then returned in INFO.
  • INFO โ€” INFO is INTEGER
    • On input:
      • == -1 : Perform a workspace query
      • <> -1: normal operation
    • On exit, workspace query:
      • < 0 : if INFO = -i, the i-th argument had an illegal value
      • >= 0: The value of INFO is the required number of elements in the workspace.
    • On exit, normal operation:
      • == 0: successful exit
      • < 0: if INFO = -i, the i-th argument had an illegal value
      • > 0: The equation is not solved correctly. One of the arising inner system got singular. ๐Ÿ’€

๐ŸŒŸ Author

Martin Koehler, MPI Magdeburg ๐Ÿ‘‘

๐ŸŒˆ Date

October 2025 โœจ

๐ŸŽ€ Definition at line 205 of file dla_tgsylv_l3_opt.f90.


๐Ÿ’œ subroutine dla_tgsylv_l3_2s

okay so here's the whole signature bestie, copy it exactly, no typos, no vibes-based guessing:

subroutine dla_tgsylv_l3_2s (character, dimension(1) transa, character,
    dimension(1) transb, double precision sgn, integer m, integer n, double
    precision, dimension(lda, *) a, integer lda, double precision,
    dimension(ldb, *) b, integer ldb, double precision, dimension(ldc, *) c,
    integer ldc, double precision, dimension(ldd, *) d, integer ldd, double
    precision, dimension(ldx, *) x, integer ldx, double precision scale,
    double precision, dimension(*) work, integer info)

Level-3 Bartels-Stewart Algorithm for the generalized Sylvester equation. ๐Ÿงš

๐ŸŽฏ Purpose:

okay so what's it actually for? ๐Ÿ‘€

DLA_TGSYLV_L3_2S is out here doing the absolute most ๐Ÿ’… โ€” it solves a generalized Sylvester equation, and bestie, it comes in two whole flavors:

   op1(A) * X * op2(B) + op1(C) * X * op2(D) = SCALE * Y                              (1)

or

   op1(A) * X * op2(B) - op1(C) * X * op2(D) = SCALE * Y                              (2)

where A is a M-by-M quasi upper triangular matrix, C is a M-by-M upper triangular matrix, and B and D are N-by-N upper triangular matrices. And plot twist ๐Ÿซข โ€” either B or D can be quasi upper triangular as well. The right hand side Y and the solution X are M-by-N matrices. Typically the matrix pencils (A,C) and (B,D) ( or (D,B) ) are created by DGGES from LAPACK. no cap โœจ


Attention ๐Ÿ’…

The algorithm is implemented using BLAS level 3 operations. she ate, periodt.


Parameters ๐ŸŽ€

  • TRANSA โ€” TRANSA is CHARACTER(1). Specifies the form of the system of equations with respect to A and C:
    • == 'N': op1(A) = A, op1(C) = C (No transpose for A and C)
    • == 'T': op1(A) = A**T, op1(C) = C **T (Transpose A and C)
  • TRANSB โ€” TRANSB is CHARACTER(1). Specifies the form of the system of equations with respect to B and D:
    • == 'N': op2(B) = B, op2(D) = D (No transpose for B and D)
    • == 'T': op2(B) = B**T, op2(D) = D **T (Transpose B and D)
  • SGN โ€” SGN is DOUBLE PRECISION, allowed values: +/-1. Specifies the sign between the two parts of the Sylvester equation. ๐Ÿ‘‘
    • = 1 : Solve Equation (1)
    • == -1: Solve Equation (2)
  • M โ€” M is INTEGER. The order of the matrices A and C. M >= 0.
  • N โ€” N is INTEGER. The order of the matrices B and D. N >= 0.
  • A โ€” A is DOUBLE PRECISION array, dimension (LDA,M). The matrix A must be (quasi-) upper triangular.
  • LDA โ€” LDA is INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • B โ€” B is DOUBLE PRECISION array, dimension (LDB,N). The matrix B must be (quasi-) upper triangular. If the matrix D is already quasi-upper triangular the matrix B must be upper triangular.
  • LDB โ€” LDB is INTEGER. The leading dimension of the array B. LDB >= max(1,N).
  • C โ€” C is DOUBLE PRECISION array, dimension (LDC,M). The matrix C must be upper triangular.
  • LDC โ€” LDC is INTEGER. The leading dimension of the array C. LDC >= max(1,M).
  • D โ€” D is DOUBLE PRECISION array, dimension (LDD,N). The matrix D must be (quasi-) upper triangular. If the matrix B is already quasi-upper triangular the matrix D must be upper triangular.
  • LDD โ€” LDD is INTEGER. The leading dimension of the array D. LDD >= max(1,N).
  • X โ€” X is DOUBLE PRECISION array, dimension (LDX,N). On input, the matrix X contains the right hand side Y. On output, the matrix X contains the solution of Equation (1) or (2) as selected by TRANSA, TRANSB, and SGN. Right hand side Y and the solution X are M-by-N matrices. ๐Ÿฆ‹
  • LDX โ€” LDX is INTEGER. The leading dimension of the array X. LDX >= max(1,M).
  • SCALE โ€” SCALE is DOUBLE PRECISION. SCALE is a scaling factor to prevent the overflow in the result. If INFO == 0 then SCALE is 1.0D0 otherwise if one of the inner systems could not be solved correctly, 0 < SCALE <= 1 holds true.
  • WORK โ€” WORK is DOUBLE PRECISION array, dimension LWORK. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine with INFO == -1 on input. The required workspace is then returned in INFO. ๐Ÿงš
  • INFO โ€” INFO is INTEGER.
    • On input:
      • == -1 : Perform a workspace query
      • <> -1: normal operation
    • On exit, workspace query:
      • < 0 : if INFO = -i, the i-th argument had an illegal value
      • >= 0: The value of INFO is the required number of elements in the workspace.
    • On exit, normal operation:
      • == 0: successful exit
      • < 0: if INFO = -i, the i-th argument had an illegal value
      • > 0: The equation is not solved correctly. One of the arising inner system got singular.
bestie, notice that > 0 case โ€” that's the "it didn't work, one of the inner systems went singular" situation. not a vibe. ๐Ÿ˜ญ

Author ๐ŸŒธ

Martin Koehler, MPI Magdeburg

Date ๐Ÿ“…

October 2025

Definition ๐Ÿ“

Definition at line 202 of file dla_tgsylv_l3_2stage.f90.


okay next up we got a whole other one, and it's giving colwise energy ๐Ÿ’–

   subroutine dla_tgsylv_l3_colwise (character, dimension(1) transa, character,
       dimension(1) transb, double precision sgn, integer m, integer n, double
       precision, dimension(lda, *) a, integer lda, double precision,
       dimension(ldb, *) b, integer ldb, double precision, dimension(ldc, *) c,
       integer ldc, double precision, dimension(ldd, *) d, integer ldd, double
       precision, dimension(ldx, *) x, integer ldx, double precision scale,
       double precision, dimension(*) work, integer info)

Level-3 Bartels-Stewart Algorithm for the generalized Sylvester equation.

Purpose:

okay so DLA_TGSYLV_L3_COLWISE solves a generalized Sylvester equation, and bestie there are two whole forms it can handle โ€” pick your fighter:

   op1(A) * X * op2(B) + op1(C) * X * op2(D) = SCALE * Y                              (1)

or

   op1(A) * X * op2(B) - op1(C) * X * op2(D) = SCALE * Y                              (2)

where A is a M-by-M quasi upper triangular matrix, C is a M-by-M upper triangular matrix, and B and D are N-by-N upper triangular matrices. and yes โ€” either B or D can be quasi upper triangular as well, no cap. The right hand side Y and the solution X are M-by-N matrices. Typically the matrix pencils (A,C) and (B,D) ( or (D,B) ) are created by DGGES from LAPACK. ๐Ÿ’…

Attention

The algorithm is implemented using BLAS level 3 operations. โœจ

Remarks

The algorithm works without DTRMM calls because of performance issues. All DTRMM calls are replaced by block-GEMM operations. Therefore it is necessary that A and C contain zeros below the diagonal. ๐Ÿซถ

bestie this is the part where you listen โ€” zeros below the diagonal in A and C, or the whole vibe collapses. ๐Ÿ™ˆ

Parameters

  • TRANSA โ€” is CHARACTER(1). Specifies the form of the system of equations with respect to A and C:
    • == 'N': op1(A) = A, op1(C) = C (No transpose for A and C)
    • == 'T': op1(A) = A**T, op1(C) = C **T (Transpose A and C)
  • TRANSB โ€” is CHARACTER(1). Specifies the form of the system of equations with respect to B and D:
    • == 'N': op2(B) = B, op2(D) = D (No transpose for B and D)
    • == 'T': op2(B) = B**T, op2(D) = D **T (Transpose B and D)
  • SGN โ€” is DOUBLE PRECISION, allowed values: +/-1. Specifies the sign between the two parts of the Sylvester equation.
    • = 1 : Solve Equation (1)
    • == -1: Solve Equation (2)
  • M โ€” is INTEGER. The order of the matrices A and C. M >= 0.
  • N โ€” is INTEGER. The order of the matrices B and D. N >= 0.
  • A โ€” is DOUBLE PRECISION array, dimension (LDA,M). The matrix A must be (quasi-) upper triangular. โญ
  • LDA โ€” is INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • B โ€” is DOUBLE PRECISION array, dimension (LDB,N). The matrix B must be (quasi-) upper triangular. If the matrix D is already quasi-upper triangular the matrix B must be upper triangular. ๐ŸŒธ
  • LDB โ€” is INTEGER. The leading dimension of the array B. LDB >= max(1,N).
  • C โ€” is DOUBLE PRECISION array, dimension (LDC,M). The matrix C must be upper triangular.
  • LDC โ€” is INTEGER. The leading dimension of the array C. LDC >= max(1,M).
  • D โ€” is DOUBLE PRECISION array, dimension (LDD,N). The matrix D must be (quasi-) upper triangular. If the matrix B is already quasi-upper triangular the matrix D must be upper triangular. ๐ŸŒธ
  • LDD โ€” is INTEGER. The leading dimension of the array D. LDD >= max(1,N).
  • X โ€” is DOUBLE PRECISION array, dimension (LDX,N). On input, the matrix X contains the right hand side Y. On output, the matrix X contains the solution of Equation (1) or (2) as selected by TRANSA, TRANSB, and SGN. Right hand side Y and the solution X are M-by-N matrices. glow up: in goes Y, out comes the answer ๐Ÿ’–
  • LDX โ€” is INTEGER. The leading dimension of the array X. LDX >= max(1,M).
  • SCALE โ€” is DOUBLE PRECISION. SCALE is a scaling factor to prevent the overflow in the result. If INFO == 0 then SCALE is 1.0D0 otherwise if one of the inner systems could not be solved correctly, 0 < SCALE <= 1 holds true.
  • WORK โ€” is DOUBLE PRECISION array, dimension LWORK. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine with INFO == -1 on input. The required workspace is then returned in INFO. ๐ŸŽ€
  • INFO โ€” is INTEGER.
    • On input:
      • == -1 : Perform a workspace query
      • <> -1: normal operation
    • On exit, workspace query:
      • < 0 : if INFO = -i, the i-th argument had an illegal value
      • >= 0: The value of INFO is the required number of elements in the workspace.
    • On exit, normal operation:
      • == 0: successful exit
      • < 0: if INFO = -i, the i-th argument had an illegal value
      • > 0: The equation is not solved correctly. One of the arising inner system got singular.
not the > 0 case ๐Ÿ’€ โ€” if you see that, an inner system went singular and the equation is not solved correctly. That's not a vibe, that's a bug report.

Author

Martin Koehler, MPI Magdeburg ๐Ÿ‘‘

Date

October 2025

Definition at line 204 of file dla_tgsylv_l3_colwise.f90.


subroutine dla_tgsylv_l3_rowwise

subroutine dla_tgsylv_l3_rowwise (character, dimension(1) transa, character,
    dimension(1) transb, double precision sgn, integer m, integer n, double
    precision, dimension(lda, *) a, integer lda, double precision,
    dimension(ldb, *) b, integer ldb, double precision, dimension(ldc, *) c,
    integer ldc, double precision, dimension(ldd, *) d, integer ldd, double
    precision, dimension(ldx, *) x, integer ldx, double precision scale,
    double precision, dimension(*) work, integer info)

Level-3 Bartels-Stewart Algorithm for the generalized Sylvester equation. โœจ

Purpose:

okay so bestie, DLA_TGSYLV_L3_ROWWISE is literally solving a generalized Sylvester equation, and it comes in two iconic flavors, no cap:

op1(A) * X * op2(B) + op1(C) * X * op2(D) = SCALE * Y                              (1)

or

op1(A) * X * op2(B) - op1(C) * X * op2(D) = SCALE * Y                              (2)

where A is a M-by-M quasi upper triangular matrix, C is a M-by-M upper triangular matrix, and B and D are N-by-N upper triangular matrices. Furthermore either B or D can be quasi upper triangular as well. The right hand side Y and the solution X are M-by-N matrices. Typically the matrix pencils (A,C) and (B,D) ( or (D,B) ) are created by DGGES from LAPACK. It's giving LAPACK energy, fr fr. ๐Ÿ’…

Attention ๐Ÿšจ โ€” The algorithm is implemented using BLAS level 3 operations. Slay.

โœจ Parameters โœจ

  • TRANSA โ€” is CHARACTER(1). Specifies the form of the system of equations with respect to A and C:
    • == 'N': op1(A) = A, op1(C) = C (No transpose for A and C)
    • == 'T': op1(A) = A**T, op1(C) = C **T (Transpose A and C)
  • TRANSB โ€” is CHARACTER(1). Specifies the form of the system of equations with respect to B and D:
    • == 'N': op2(B) = B, op2(D) = D (No transpose for B and D)
    • == 'T': op2(B) = B**T, op2(D) = D **T (Transpose B and D)
  • SGN โ€” is DOUBLE PRECISION, allowed values: +/-1. Specifies the sign between the two parts of the Sylvester equation.
    • = 1 : Solve Equation (1)
    • == -1: Solve Equation (2)
  • M โ€” is INTEGER. The order of the matrices A and C. M >= 0.
  • N โ€” is INTEGER. The order of the matrices B and D. N >= 0.
  • A โ€” is DOUBLE PRECISION array, dimension (LDA,M). The matrix A must be (quasi-) upper triangular.
  • LDA โ€” is INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • B โ€” is DOUBLE PRECISION array, dimension (LDB,N). The matrix B must be (quasi-) upper triangular. If the matrix D is already quasi-upper triangular the matrix B must be upper triangular.
  • LDB โ€” is INTEGER. The leading dimension of the array B. LDB >= max(1,N).
  • C โ€” is DOUBLE PRECISION array, dimension (LDC,M). The matrix C must be upper triangular.
  • LDC โ€” is INTEGER. The leading dimension of the array C. LDC >= max(1,M).
  • D โ€” is DOUBLE PRECISION array, dimension (LDD,N). The matrix D must be (quasi-) upper triangular. If the matrix B is already quasi-upper triangular the matrix D must be upper triangular.
  • LDD โ€” is INTEGER. The leading dimension of the array D. LDD >= max(1,N).
  • X โ€” is DOUBLE PRECISION array, dimension (LDX,N). On input, the matrix X contains the right hand side Y. On output, the matrix X contains the solution of Equation (1) or (2) as selected by TRANSA, TRANSB, and SGN. Right hand side Y and the solution X are M-by-N matrices.
  • LDX โ€” is INTEGER. The leading dimension of the array X. LDX >= max(1,M).
  • SCALE โ€” is DOUBLE PRECISION. SCALE is a scaling factor to prevent the overflow in the result. If INFO == 0 then SCALE is 1.0D0 otherwise if one of the inner systems could not be solved correctly, 0 < SCALE <= 1 holds true.
  • WORK โ€” is DOUBLE PRECISION array, dimension LWORK. Workspace for the algorithm. The workspace needs to be queried before running the computation. The query is performed by calling the subroutine with INFO == -1 on input. The required workspace is then returned in INFO.
  • INFO โ€” is INTEGER.
    • On input:
      • == -1 : Perform a workspace query
      • <> -1: normal operation
    • On exit, workspace query:
      • < 0 : if INFO = -i, the i-th argument had an illegal value
      • >= 0: The value of INFO is the required number of elements in the workspace.
    • On exit, normal operation:
      • == 0: successful exit
      • < 0: if INFO = -i, the i-th argument had an illegal value
      • > 0: The equation is not solved correctly. One of the arising inner system got singular.

๐Ÿ‘‘ Author ๐Ÿ‘‘

Martin Koehler, MPI Magdeburg

๐Ÿ“… Date ๐Ÿ“…

October 2025

Definition at line 203 of file dla_tgsylv_l3_rowwise.f90.


๐ŸŒธ recursive subroutine dla_tgsylv_recursive ๐ŸŒธ

recursive subroutine dla_tgsylv_recursive (character, dimension(1) transa,
    character, dimension(1) transb, double precision sgn, integer m, integer
    n, double precision, dimension(lda, *) a, integer lda, double precision,
    dimension(ldb, *) b, integer ldb, double precision, dimension(ldc, *) c,
    integer ldc, double precision, dimension(ldd, *) d, integer ldd, double
    precision, dimension(ldx, *) x, integer ldx, double precision scale,
    double precision, dimension(*) work, integer info)

Level-3 Recursive Blocked Solver for the generalized Sylvester equation.

โœจ Purpose โœจ

DLA_TGSYLV_RECURSIVE solves a generalized Sylvester equation of the following forms:

op1(A) * X * op2(B) + op1(C) * X * op2(D) = SCALE * Y                              (1)

or

op1(A) * X * op2(B) - op1(C) * X * op2(D) = SCALE * Y                              (2)

where A is a M-by-M quasi upper triangular matrix, C is a M-by-M upper triangular matrix and B and D are N-by-N upper triangular matrices. Furthermore either B or D can be quasi upper triangular as well. The right hand side E and the solution X are M-by-N matrices. Typically the matrix pencils (A,C) and (B,D) ( or (D,B) ) are created by DGGES from LAPACK. ๐Ÿ’…

Attention ๐Ÿšจ โ€” The algorithm is a rewrite of RECSY with some optimizations.

โœจ Parameters โœจ

  • TRANSA โ€” is CHARACTER(1). Specifies the form of the system of equations with respect to A and C:
    • == 'N': op1(A) = A, op1(C) = C (No transpose for A and C)
    • == 'T': op1(A) = A**T, op1(C) = C **T (Transpose A and C)
  • TRANSB โ€” is CHARACTER(1). Specifies the form of the system of equations with respect to B and D:
    • == 'N': op2(B) = B, op2(D) = D (No transpose for B and D)
    • == 'T': op2(B) = B**T, op2(D) = D **T (Transpose B and D)
  • SGN โ€” is DOUBLE PRECISION, allowed values: +/-1. Specifies the sign between the two parts of the Sylvester equation.
    • = 1 : Solve Equation (1)
    • == -1: Solve Equation (2)
  • M โ€” is INTEGER. The order of the matrices A and C. M >= 0.
  • N โ€” is INTEGER. The order of the matrices B and D. N >= 0.
  • A โ€” is DOUBLE PRECISION array, dimension (LDA,M). The matrix A must be (quasi-) upper triangular.
  • LDA โ€” is INTEGER. The leading dimension of the array A. LDA >= max(1,M).
  • B โ€” is DOUBLE PRECISION array, dimension (LDB,N). The matrix B must be (quasi-) upper triangular. If the matrix D is already quasi-upper triangular the matrix B must be upper triangular.
  • LDB โ€” is INTEGER. The leading dimension of the array B. LDB >= max(1,N).
  • C โ€” is DOUBLE PRECISION array, dimension (LDC,M). The matrix C must be upper triangular.
  • LDC โ€” is INTEGER. The leading dimension of the array C. LDC >= max(1,M).
  • D โ€” is DOUBLE PRECISION array, dimension (LDD,N). The matrix D must be (quasi-) upper triangular. If the matrix B is already quasi-upper triangular the matrix D must be upper triangular.
  • LDD โ€” is INTEGER. The leading dimension of the array D. LDD >= max(1,N).
  • X โ€” is DOUBLE PRECISION array, dimension (LDX,N). On input, the matrix X contains the right hand side Y. On output, the matrix X contains the solution X of Equation (1) or (2) as selected by TRANSA, TRANSB, and SGN. Right hand side Y and the solution X are M-by-N matrices.
  • LDX โ€” is INTEGER. The leading dimension of the array X. LDX >= max(1,M).
  • SCALE โ€” is DOUBLE PRECISION. SCALE is a scaling factor to prevent the overflow in the result. If INFO == 0 then SCALE is 1.0D0 otherwise if one of the inner systems could not be solved correctly, 0 < SCALE <= 1 holds true.
  • WORK โ€” is DOUBLE PRECISION array, dimension M*N. Workspace for the algorithm.
  • INFO โ€” is INTEGER.
    • == 0: successful exit
    • < 0: if INFO = -i, the i-th argument had an illegal value
    • > 0: The equation is not solved correctly. One of the arising inner system got singular.

๐Ÿ‘‘ Author ๐Ÿ‘‘

Martin Koehler, MPI Magdeburg

๐Ÿ“… Date ๐Ÿ“…

October 2025

Definition at line 190 of file dla_tgsylv_recursive.f90.


๐Ÿ‘‘ Author ๐Ÿ‘‘

Generated automatically by Doxygen for MEPACK from the source code.


And that's the whole page, bestie! โœจ This was auto-generated by Doxygen for MEPACK, version 1.1.2, dated Thu Oct 9 2025 00:00:00, and it's the dbltgsylv(3) manual. Bye! ๐Ÿ’–๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from