dbltrsylv(3)
✨ dbltrsylv ✨
okay bestie, welcome to dbltrsylv(3) — it's a MEPACK page and it is THICC. Like, 17-parts long. This is part 1. Buckle up, hydrate, and let's go 💖
🌸 NAME 🌸
dbltrsylv — Double Precision
- Double Precision routines for triangular standard Sylvester.
🦋 SYNOPSIS 🦋
🎀 Functions 🎀
subroutine dla_trsylv2_dag (transa, transb, sgn, m, n, a, lda, b, ldb, x, ldx, scale, work, info)— the Level-3 Bartels-Stewart Algorithm for the discrete time Sylvester equation, except it's running with DAG based parallelization. parallel queen behavior fr fr.subroutine dla_trsylv_dag (transa, transb, sgn, m, n, a, lda, b, ldb, x, ldx, scale, work, info)— Level-3 Bartels-Stewart Algorithm for the generalized Sylvester equation, also with DAG parallelization. the generalized one, not the discrete one, don't mix them up 💅subroutine dla_trsylv2_kernel_44nn (sgn, m, n, a, lda, b, ldb, x, ldx, scale, info)— Solver for a 4x4 discrete time Sylvester equation (TRANSA = N,TRANSB = N).subroutine dla_trsylv2_kernel_44nt (sgn, m, n, a, lda, b, ldb, x, ldx, scale, info)— Solver for a 4x4 discrete time Sylvester equation (TRANSA = N,TRANSB = T).subroutine dla_trsylv2_kernel_44tn (sgn, m, n, a, lda, b, ldb, x, ldx, scale, info)— Solver for a 4x4 discrete time Sylvester equation (TRANSA = T,TRANSB = N).subroutine dla_trsylv2_kernel_44tt (sgn, m, n, a, lda, b, ldb, x, ldx, scale, info)— Solver for a 4x4 discrete time Sylvester equation (TRANSA = T,TRANSB = T).subroutine dla_trsylv_kernel_44nn (sgn, m, n, a, lda, b, ldb, x, ldx, scale, info)— Solver for a 4x4 Sylvester equation (TRANSA = N,TRANSB = N).subroutine dla_trsylv_kernel_44nt (sgn, m, n, a, lda, b, ldb, x, ldx, scale, info)— Solver for a 4x4 Sylvester equation (TRANSA = N,TRANSB = T).subroutine dla_trsylv_kernel_44tn (sgn, m, n, a, lda, b, ldb, x, ldx, scale, info)— Solver for a 4x4 Sylvester equation (TRANSA = T,TRANSB = N).subroutine dla_trsylv_kernel_44tt (sgn, m, n, a, lda, b, ldb, x, ldx, scale, info)— Solver for a 4x4 Sylvester equation (TRANSA = T,TRANSB = T).subroutine dla_trsylv2_l2 (transa, transb, sgn, m, n, a, lda, b, ldb, x, ldx, scale, work, info)— Level-2 Bartels-Stewart Algorithm for the discrete time Sylvester equation (Optimized). glow-up included ✨subroutine dla_trsylv2_l2_local_copy (transa, transb, sgn, m, n, a, lda, b, ldb, x, ldx, scale, work, info)— Level-2 Bartels-Stewart Algorithm for the discrete time Sylvester equation (Optimized).subroutine dla_trsylv2_l2_local_copy_128 (transa, transb, sgn, m, n, a, lda, b, ldb, x, ldx, scale, work, info)— Level-2 Bartels-Stewart Algorithm for the discrete time Sylvester equation (Optimized).subroutine dla_trsylv2_l2_local_copy_32 (transa, transb, sgn, m, n, a, lda, b, ldb, x, ldx, scale, work, info)— Level-2 Bartels-Stewart Algorithm for the discrete time Sylvester equation (Optimized).subroutine dla_trsylv2_l2_local_copy_64 (transa, transb, sgn, m, n, a, lda, b, ldb, x, ldx, scale, work, info)— Level-2 Bartels-Stewart Algorithm for the discrete time Sylvester equation (Optimized).subroutine dla_trsylv2_l2_local_copy_96 (transa, transb, sgn, m, n, a, lda, b, ldb, x, ldx, scale, work, info)— Level-2 Bartels-Stewart Algorithm for the discrete time Sylvester equation (Optimized).subroutine dla_trsylv2_l2_reorder (transa, transb, sgn, m, n, a, lda, b, ldb, x, ldx, scale, work, info)— Level-2 Bartels-Stewart Algorithm for the discrete time Sylvester equation (Optimized).subroutine dla_trsylv2_l2_unopt (transa, transb, sgn, m, n, a, lda, b, ldb, x, ldx, scale, work, info)— Level-2 Bartels-Stewart Algorithm for the discrete time Sylvester equation (unoptimized). no glow-up, just vibes 😭subroutine dla_trsylv_l2 (transa, transb, sgn, m, n, a, lda, b, ldb, x, ldx, scale, work, info)— Level-2 Bartels-Stewart Algorithm for the Sylvester equation (optimized).subroutine dla_trsylv_l2_local_copy (transa, transb, sgn, m, n, a, lda, b, ldb, x, ldx, scale, work, info)— Level-2 Bartels-Stewart Algorithm for the Sylvester equation (optimized).subroutine dla_trsylv_l2_local_copy_128 (transa, transb, sgn, m, n, a, lda, b, ldb, x, ldx, scale, work, info)— Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation (Optimized).subroutine dla_trsylv_l2_local_copy_32 (transa, transb, sgn, m, n, a, lda, b, ldb, x, ldx, scale, work, info)— Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation (Optimized).subroutine dla_trsylv_l2_local_copy_64 (transa, transb, sgn, m, n, a, lda, b, ldb, x, ldx, scale, work, info)— Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation (Optimized).subroutine dla_trsylv_l2_local_copy_96 (transa, transb, sgn, m, n, a, lda, b, ldb, x, ldx, scale, work, info)— Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation (Optimized).subroutine dla_trsylv_l2_reorder (transa, transb, sgn, m, n, a, lda, b, ldb, x, ldx, scale, work, info)— Level-2 Bartels-Stewart Algorithm for the Sylvester equation (optimized).subroutine dla_trsylv_l2_unopt (transa, transb, sgn, m, n, a, lda, b, ldb, x, ldx, scale, work, info)— Level-2 Bartels-Stewart Algorithm for the Sylvester equation (unoptimized).subroutine dla_trsylv2_l3_2s (transa, transb, sgn, m, n, a, lda, b, ldb, x, ldx, scale, work, info)— Two level blocked Bartels-Stewart Algorithm for the discrete time Sylvester equation (Optimized).subroutine dla_trsylv2_l3 (transa, transb, sgn, m, n, a, lda, b, ldb, x, ldx, scale, work, info)— Level-3 Bartels-Stewart Algorithm for the discrete time Sylvester equation (Optimized).subroutine dla_trsylv2_l3_unopt (transa, transb, sgn, m, n, a, lda, b, ldb, x, ldx, scale, work, info)— Level-3 Bartels-Stewart Algorithm for the discrete time Sylvester equation (Not Optimized).subroutine dla_trsylv_l3_2s (transa, transb, sgn, m, n, a, lda, b, ldb, x, ldx, scale, work, info)— Level-3 Bartels-Stewart Algorithm for the generalized Sylvester equation.subroutine dla_trsylv_l3 (transa, transb, sgn, m, n, a, lda, b, ldb, x, ldx, scale, work, info)— Level-3 Bartels-Stewart Algorithm for the generalized Sylvester equation.subroutine dla_trsylv_l3_unopt (transa, transb, sgn, m, n, a, lda, b, ldb, x, ldx, scale, work, info)— Level-3 Bartels-Stewart Algorithm for the generalized Sylvester equation (unoptimized).recursive subroutine dla_trsylv2_recursive (transa, transb, sgn, m, n, a, lda, b, ldb, x, ldx, scale, work, info)— Level-3 Recursive Blocked Algorithm for the discrete time Sylvester equation.recursive subroutine dla_trsylv_recursive (transa, transb, sgn, m, n, a, lda, b, ldb, x, ldx, scale, work, info)— Level-3 Recursive Blocked Solver for the Sylvester equation.
💅 Detailed Description 💅
Double Precision routines for triangular standard Sylvester.
This section contains the solvers for the standard Sylvester equation with (quasi) triangular coefficient matrices. The coefficient matrices are normally generated with the help of the Schur decomposition from LAPACK. The routines use double precision arithmetic for computation and data.
so real talk: the coefficient matrices don't just appear, bestie — they usually come out of the Schur decomposition over in LAPACK. and everything in here is double precision, both the math and the data. no float shenanigans 💅
👑 Function Documentation 👑
🫶 subroutine dla_trsylv2_dag 🫶
subroutine dla_trsylv2_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(ldx, n) x,
integer ldx, double precision scale, double precision, dimension(*)
work, integer info)
Level-3 Bartels-Stewart Algorithm for the discrete time Sylvester equation with DAG based parallelization.
🌟 Purpose 🌟
DLA_TRSYLV2_DAG solves a discrete time Sylvester equation of the following forms:
op1(A) * X * op2(B) + X = SCALE * Y (1)
or
op1(A) * X * op2(B) - X = SCALE * Y (2)
where A is a M-by-M quasi upper triangular matrix and B is a N-by-N upper quasi triangular matrices. The right hand side Y and the solution X M-by-N matrices. Typically the matrices A and B are created by DGEES from LAPACK.
so like,<pink>A</pink>is M-by-M quasi upper triangular,<pink>B</pink>is N-by-N upper quasi triangular, and<pink>X</pink>+<pink>Y</pink>are the M-by-N girlies doing all the work. and yeah —DGEESfrom LAPACK is usually the one who made A and B in the first place, iykyk 🦋
🌸 Remarks 🌸
The algorithm is implemented using BLAS level 3 operations and OpenMP 4.0 DAG scheduling.
⚠️ 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 the DLA_TRSYLV2_L3 routine.
not me being dramatic but this one MATTERS, bestie 😭 because the algorithm is parallel, the scaling is not applied to the right hand. if your problem is ill-posed and scaling shows up, you gotta run it again with a solver that has complete scaling support, like DLA_TRSYLV2_L3. no cap.
🎀 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).
X
...and that's exactly where this part cuts off, bestie — X's whole moment is waiting for you in the next part 🫖✨
X— 💖Xis a DOUBLE PRECISION</> array, dimension(LDX,N). On input, the matrixXcontains the right hand sideY. On output, the matrixXcontains the solution of Equation (1) or (2) — whichever oneTRANSA</>,TRANSB</>, andSGN</> picked, bestie. Right hand sideYand the solutionXareM-by-Nmatrices. 🦋LDX—LDX</> is INTEGER. The leading dimension of the arrayX.LDX >= max(1,M). no cap.SCALE— ✨SCALE</> is DOUBLE PRECISION.SCALEis a scaling factor to prevent the overflow in the result. IfINFO == 0thenSCALEis1.0D0; otherwise if one of the inner systems could not be solved correctly,0 < SCALE <= 1holds true. IfSCALE .NE. 1the problem is no solved correctly in this case one have to use an other solver. 👑
🚨 fr fr: ifSCALEisn't exactly1, that solve did not go correctly and you gotta go find a different solver. not a vibe, but that's the deal.
WORK— 🛠️WORK</> is a DOUBLE PRECISION array, dimensionLWORK. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine withINFO == -1on input. The required workspace is then returned inINFO. 🫶INFO—INFO</> is INTEGER.- On input:
== -1: Perform a workspace query<> -1: normal operation
- On exit, workspace query:
< 0: ifINFO = -i, the i-th argument had an illegal value>= 0: The value ofINFOis the required number of elements in the workspace.
- On exit, normal operation:
== 0: successful exit< 0: ifINFO = -i, the i-th argument had an illegal value> 0: The equation is not solved correctly. One of the arising inner system got singular. 💀
- On input:
Author — Martin Koehler, MPI Magdeburg 🎀
Date — October 2025 🌸
Definition at line 181 of file dla_trsylv2_dag.f90. ⭐
subroutine dla_trsylv2_kernel_44nn ✨
subroutine dla_trsylv2_kernel_44nn (double precision sgn, integer m, integer
n, double precision, dimension(lda, *) a, integer lda, double precision,
dimension(ldb, *) b, integer ldb, double precision, dimension(ldx, *) x,
integer ldx, double precision scale, integer info)
Solver for a 4x4 discrete time Sylvester equation (TRANSA = N, TRANSB = N) 👑
Purpose 🎯
DLA_TRSYLV2_KERNEL_44NN solves a discrete time Sylvester equation of the following form
A * X * B + SGN * X = SCALE * Y (1)
where A is a M-by-M quasi upper triangular matrix and B is a N-by-N quasi upper triangular matrix. The right hand side Y and the solution X are M-by-N matrices. Typically the matrices A and B are created by DGEES from LAPACK. The algorithm is implemented using BLAS level 2 operations. Thereby the order of M and N is at most 4. Furthermore, for fast execution the function does not check the input arguments. 🏃♀️💨
Parameters
SGN—SGN</> is DOUBLE PRECISION, allowed values:+/-1. Specifies the sign between the two parts of the Sylvester equation. 💜M—M</> is INTEGER. The order of the matrixA.4 >= M >= 0. 🦋N—N</> is INTEGER. The order of the matrixB.4 >= N >= 0. 🦋A—A</> is a DOUBLE PRECISION array, dimension(LDA,M). The matrixAmust be (quasi-) upper triangular. ⭐LDA—LDA</> is INTEGER. The leading dimension of the arrayA.LDA >= max(1,M).B—B</> is a DOUBLE PRECISION array, dimension(LDB,N). The matrixBmust be (quasi-) upper triangular. ⭐LDB—LDB</> is INTEGER. The leading dimension of the arrayB.LDB >= max(1,N).X—X</> is a DOUBLE PRECISION array, dimension(LDX,N). On input, the matrixXcontains the right hand sideY. On output, the matrixXcontains the solution of Equation (1) as selected bySGN. Right hand sideYand the solutionXareM-by-Nmatrices. 💖LDX—LDX</> is INTEGER. The leading dimension of the arrayX.LDB >= max(1,M). 🫶SCALE—SCALE</> is DOUBLE PRECISION.SCALEis a scaling factor to prevent the overflow in the result. IfINFO == 0thenSCALEis1.0D0; otherwise if one of the inner systems could not be solved correctly,0 < SCAL <= 1holds true. ✨INFO—INFO</> is INTEGER.- On input:
= 1: Skip the input data checks<> 1: Check input data like normal LAPACK like routines.
- On output:
== 0: successful exit< 0: ifINFO = -i, the i-th argument had an illegal value> 0: The equation is not solved correctly. One of the arising inner system got singular. 💀
- On input:
Author — Martin Koehler, MPI Magdeburg 🎀
Date — October 2025 🌸
Definition at line 135 of file dla_trsylv2_kernel_44_nn.f90. ⭐
subroutine dla_trsylv2_kernel_44nt ✨
subroutine dla_trsylv2_kernel_44nt (double precision sgn, integer m, integer
n, double precision, dimension(lda, *) a, integer lda, double precision,
dimension(ldb, *) b, integer ldb, double precision, dimension(ldx, *) x,
integer ldx, double precision scale, integer info)
Solver for a 4x4 discrete time Sylvester equation (TRANSA = N, TRANSB = T) 👑
Purpose 🎯
DLA_TRSYLV2_KERNEL_44NT solves a discrete time Sylvester equation of the following form
A * X * B**T + SGN * X = SCALE * Y (1)
where A is a M-by-M quasi upper triangular matrix and B is a N-by-N quasi upper triangular matrix. The right hand side Y and the solution X are M-by-N matrices. Typically the matrices A and B are created by DGEES from LAPACK. The algorithm is implemented using BLAS level 2 operations. Thereby the order of M and N is at most 4. Furthermore, for fast execution the function does not check the input arguments. 🏃♀️💨
Parameters
SGN—SGN</> is DOUBLE PRECISION, allowed values:+/-1. Specifies the sign between the two parts of the Sylvester equation. 💜M—M</> is INTEGER. The order of the matrixA.4 >= M >= 0. 🦋N—N</> is INTEGER. The order of the matrixB.4 >= N >= 0. 🦋A—A</> is a DOUBLE PRECISION array, dimension(LDA,M). The matrixAmust be (quasi-) upper triangular. ⭐LDA—LDA</> is INTEGER. The leading dimension of the arrayA.LDA >= max(1,M).B—B</> is a DOUBLE PRECISION array, dimension(LDB,N). The matrixBmust be (quasi-) upper triangular. ⭐LDB—LDB</> is INTEGER. The leading dimension of the arrayB.LDB >= max(1,N).X—X</> is a DOUBLE PRECISION array, dimension(LDX,N). On input, the matrixXcontains the right hand sideY. On output, the matrixXcontains the solution of Equation (1) as selected bySGN. Right hand sideYand the solutionXareM-by-Nmatrices. 💖LDX—LDX</> is INTEGER. The leading dimension of the arrayX.LDB >= max(1,M). 🫶SCALE—SCALE</> is DOUBLE PRECISION.SCALEis a scaling factor to prevent the overflow in the result. IfINFO == 0thenSCALEis1.0D0; otherwise if one of the inner systems could not be solved correctly,0 < SCAL <= 1holds true. ✨INFO—INFO</> is INTEGER.- On input:
= 1: Skip the input data checks<> 1: Check input data like normal LAPACK like routines.
- On output:
== 0: successful exit< 0: ifINFO = -i, the i-th argument had an illegal value> 0: The equation is not solved correctly. One of the arising inner system got singular. 💀
- On input:
Author — Martin Koehler, MPI Magdeburg 🎀
Date — October 2025 🌸
Definition at line 134 of file dla_trsylv2_kernel_44_nt.f90. ⭐
subroutine dla_trsylv2_kernel_44tn ✨
subroutine dla_trsylv2_kernel_44tn (double precision sgn, integer m, integer
n, double precision, dimension(lda, *) a, integer lda, double precision,
dimension(ldb, *) b, integer ldb, double precision, dimension(ldx, *) x,
integer ldx, double precision scale, integer info)
Solver for a 4x4 discrete time Sylvester equation (TRANSA = T, TRANSB = N) 👑
Purpose 🎯
DLA_TRSYLV2_KERNEL_44TN solves a discrete time Sylvester equation of the following form
A**T * X * B + SGN * X = SCALE * Y (1)
where A is a M-by-M quasi upper triangular matrix and B is a N-by-N quasi upper triangular matrix. The right hand side Y and the solution X are M-by-N matrices. Typically the matrices A and B are created by DGEES from LAPACK. The algorithm is implemented using BLAS level 2 operations. Thereby the order of M and N is at most 4. Furthermore, for fast execution the function does not check the input arguments. 🏃♀️💨
Parameters
SGN—SGN</> is DOUBLE PRECISION, allowed values:+/-1. Specifies the sign between the two parts of the Sylvester equation. 💜M—M</> is INTEGER. The order of the matrixA.4 >= M >= 0. 🦋N—N</> is INTEGER. The order of the matrixB.4 >= N >= 0. 🦋A—A</> is a DOUBLE PRECISION array, dimension(LDA,M). The matrixAmust be (quasi-) upper triangular. ⭐LDA—LDA—INTEGER, the leading dimension of the arrayA. Constraint:LDA >= max(1,M). 💅B—DOUBLE PRECISIONarray, dimension(LDB,N). Heads up bestie: the matrixBmust be (quasi-) upper triangular. Non-negotiable, that's the vibe check. 🌸LDB—INTEGER, the leading dimension of the arrayB. Constraint:LDB >= max(1,N). ✨X—DOUBLE PRECISIONarray, dimension(LDX,N). On input, the matrixXcontains the right hand sideY. On output, the matrixXcontains the solution of Equation (1) as selected bySGN. Right hand sideYand the solutionXare M-by-N matrices. It's giving glow-up, honestly. 💖LDX—INTEGER, the leading dimension of the arrayX. Constraint as written:LDB >= max(1,M). (yeah it saysLDBin the source, we are reporting it exactly as it is, no editing the queen's receipts 💀)SCALE—DOUBLE PRECISION.SCALEis a scaling factor to prevent the overflow in the result. IfINFO == 0thenSCALEis1.0D0, otherwise if one of the inner systems could not be solved correctly,0 < SCAL <= 1holds true. 🫶INFO—INTEGER.
On input:
= 1: Skip the input data checks<> 1: Check input data like normal LAPACK like routines.
On output:
== 0: successful exit 🔥< 0: ifINFO = -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 135 of file dla_trsylv2_kernel_44_tn.f90.
🦋 subroutine dla_trsylv2_kernel_44tt
subroutine dla_trsylv2_kernel_44tt (double precision sgn, integer m, integer
n, double precision, dimension(lda, *) a, integer lda, double precision,
dimension(ldb, *) b, integer ldb, double precision, dimension(ldx, *) x,
integer ldx, double precision scale, integer info)
Solver for a 4x4 discrete time Sylvester equation (TRANSA = T, TRANSB = T)
Purpose 👑
!>
!> DLA_TRSYLV2_KERNEL_44TT solves a discrete time Sylvester equation of the following form
!>
!> A**T * X * B**T + SGN * X = SCALE * Y (1)
!>
!> where A is a M-by-M quasi upper triangular matrix and B is a N-by-N quasi upper
!> triangular matrix. The right hand side Y and the solution X
!> M-by-N matrices. Typically the matrices A and B are created by DGEES from LAPACK.
!> The algorithm is implemented using BLAS level 2
!> operations. Thereby the order of M and N is at most 4. Furthermore, for fast execution
!> the function does not check the input arguments.
!>
!>
Okay so real talk: this one does not check the input arguments, because it's built for speed. You're on your own for validation, bestie. Speedrun energy. ⚡
Parameters 💅
SGN—DOUBLE PRECISION, allowed values:+/-1. Specifies the sign between the two parts of the Sylvester equation. ✨M—INTEGER. The order of the matrixA.4 >= M >= 0.N—INTEGER. The order of the matrixB.4 >= N >= 0.A—DOUBLE PRECISIONarray, dimension(LDA,M). The matrixAmust be (quasi-) upper triangular. No cap. 🌸LDA—INTEGER, the leading dimension of the arrayA. Constraint:LDA >= max(1,M).B—DOUBLE PRECISIONarray, dimension(LDB,N). The matrixBmust be (quasi-) upper triangular. 💜LDB—INTEGER, the leading dimension of the arrayB. Constraint:LDB >= max(1,N).X—DOUBLE PRECISIONarray, dimension(LDX,N). On input, the matrixXcontains the right hand sideY. On output, the matrixXcontains the solution of Equation (1) as selected bySGN. Right hand sideYand the solutionXare M-by-N matrices. 🦋LDX—INTEGER, the leading dimension of the arrayX. Constraint as written:LDB >= max(1,M). (again, reporting it exactly, not our typo to fix 🙈)SCALE—DOUBLE PRECISION.SCALEis a scaling factor to prevent the overflow in the result. IfINFO == 0thenSCALEis1.0D0, otherwise if one of the inner systems could not be solved correctly,0 < SCAL <= 1holds true. 🫶INFO—INTEGER.
On input:
= 1: Skip the input data checks<> 1: Check input data like normal LAPACK like routines.
On output:
== 0: successful exit 🔥< 0: ifINFO = -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 135 of file dla_trsylv2_kernel_44_tt.f90.
🌈 subroutine dla_trsylv2_l2
subroutine dla_trsylv2_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(ldx, *) x,
integer ldx, double precision scale, double precision, dimension(*)
work, integer info)
Level-2 Bartels-Stewart Algorithm for the discrete time Sylvester equation (Optimized)
Purpose 👑
!>
!> DLA_TRSYLV2_L2 solves a generalized Sylvester equation of the following forms
!>
!> op1(A) * X * op2(B) + X = SCALE * Y (1)
!>
!> or
!>
!> op1(A) * X * op2(B) - X = SCALE * Y (2)
!>
!> where A is a M-by-M quasi upper triangular matrix and B is a N-by-N upper
!> quasi triangular matrices. The right hand side Y and the solution X
!> M-by-N matrices. Typically the matrices A and B are created by DGEES from LAPACK.
!>
Parameters 💅
TRANSA—CHARACTER(1). Specifies the form of the system of equations with respect toAandC:== 'N':op1(A) = A,op1(C) = C(No transpose forAandC)== 'T':op1(A) = A**T,op1(C) = C **T(TransposeAandC)
TRANSB—CHARACTER(1). Specifies the form of the system of equations with respect toBandD:== 'N':op2(B) = B,op2(D) = D(No transpose forBandD)== 'T':op2(B) = B**T,op2(D) = D **T(TransposeBandD)
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 matricesAandC.M >= 0. ✨N—INTEGER. The order of the matricesBandD.N >= 0. ✨A—DOUBLE PRECISIONarray, dimension(LDA,M). The matrixAmust be (quasi-) upper triangular.LDA—INTEGER, the leading dimension of the arrayA. Constraint:LDA >= max(1,M).B—DOUBLE PRECISIONarray, dimension(LDB,N). The matrixBmust be (quasi-) upper triangular. If the matrixDis already quasi-upper triangular the matrixBmust be upper triangular. 👑 Conditional queen behaviour, we love it.LDB—INTEGER, the leading dimension of the arrayB. Constraint:LDB >= max(1,N).X—DOUBLE PRECISIONarray, dimension(LDX,N). On input, the matrixXcontains the right hand sideY. On output, the matrixXcontains the solution of Equation (1) or (2) as selected byTRANSA,TRANSB, andSGN. Right hand sideYand the solutionXare M-by-N matrices. 🌸LDX—INTEGER, the leading dimension of the arrayX. Constraint as written:LDB >= max(1,M). (yes, stillLDB, still verbatim, still iconic 💀)SCALE—DOUBLE PRECISION.SCALEis a scaling factor to prevent the overflow in the result. IfINFO == 0thenSCALEis1.0D0, otherwise if one of the inner systems could not be solved correctly,0 < SCALE <= 1holds true. 🫶WORK—DOUBLE PRECISIONarray, dimensionLWORK. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine withINFO == -1on input. The required workspace is then returned inINFO. 🎀INFO—INTEGER.
On input:
== -1: Perform a workspace query<> -1: normal operation
On exit, workspace query:
< 0: ifINFO = -i, the i-th argument had an illegal value>= 0: The value ofINFOis the required number of elements in the workspace.
On exit, normal operation:
== 0: successful exit 🔥< 0: ifINFO = -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, 💅
- Replaced
DAXPYoperation by Fortran intrinsic - Replaced all BLAS calls except of
DTRMVandDGERby Fortran intrinsic,
- Replaced
Author 🌸
Martin Koehler, MPI Magdeburg
Date 🎀
October 2025
Definition 💖
Definition at line 182 of file dla_trsylv2_l2.f90.
🦋 subroutine dla_trsylv2_l2_local_copy 🦋
subroutine dla_trsylv2_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(ldx, *) x,
integer ldx, double precision scale, double precision, dimension(*)
work, integer info)
Level-2 Bartels-Stewart Algorithm for the discrete time Sylvester equation (Optimized) ✨
Purpose 💜
DLA_TRSYLV2_L2_LOCAL_COPY solves a generalized Sylvester equation of the following forms
op1(A) * X * op2(B) + X = SCALE * Y (1)
or
op1(A) * X * op2(B) - X = SCALE * Y (2)
where A is a M-by-M quasi upper triangular matrix and B is a N-by-N upper quasi triangular matrices. The right hand side Y and the solution X M-by-N matrices. Typically the matrices A and B are created by DGEES from LAPACK. 🫶
Parameters 🌈
TRANSA—TRANSAisCHARACTER(1)bestie, and it specifies the form of the system of equations with respect toAandC:== 'N':op1(A) = A,op1(C) = C(No transpose forAandC)== 'T':op1(A) = A**T,op1(C) = C **T(TransposeAandC)
TRANSB—TRANSBisCHARACTER(1), and it specifies the form of the system of equations with respect toBandD:== 'N':op2(B) = B,op2(D) = D(No transpose forBandD)== 'T':op2(B) = B**T,op2(D) = D **T(TransposeBandD)
SGN—SGNisDOUBLE 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—MisINTEGER. The order of the matricesAandC.M >= 0. 🌟N—NisINTEGER. The order of the matricesBandD.N >= 0. 🌟A—AisDOUBLE PRECISIONarray, dimension(LDA,M). The matrixAmust be (quasi-) upper triangular. 👑LDA—LDAisINTEGER. The leading dimension of the arrayA.LDA >= max(1,M).B—BisDOUBLE PRECISIONarray, dimension(LDB,N). The matrixBmust be (quasi-) upper triangular. If the matrixDis already quasi-upper triangular the matrixBmust be upper triangular.LDB—LDBisINTEGER. The leading dimension of the arrayB.LDB >= max(1,N).X—XisDOUBLE PRECISIONarray, dimension(LDX,N). On input, the matrixXcontains the right hand sideY. On output, the matrixXcontains the solution of Equation (1) or (2) as selected byTRANSA,TRANSB, andSGN. Right hand sideYand the solutionXare M-by-N matrices. 🦋LDX—LDXisINTEGER. The leading dimension of the arrayX.LDB >= max(1,M). 🙈 (yup, the docs literally sayLDBright there — i'm just copying it exactly, don't come for me)SCALE—SCALEisDOUBLE PRECISION.SCALEis a scaling factor to prevent the overflow in the result. IfINFO == 0thenSCALEis1.0D0otherwise if one of the inner systems could not be solved correctly,0 < SCALE <= 1holds true. 💯WORK—WORKisDOUBLE PRECISIONarray, dimensionLWORK. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine withINFO == -1on input. The required workspace is then returned inINFO. 🔥INFO—INFOisINTEGER.- On input:
== -1: Perform a workspace query<> -1: normal operation
- On exit, workspace query:
< 0: ifINFO = -i, the i-th argument had an illegal value>= 0: The value ofINFOis the required number of elements in the workspace.
- On exit, normal operation:
== 0: successful exit 💖< 0: ifINFO = -i, the i-th argument had an illegal value> 0: The equation is not solved correctly. One of the arising inner system got singular. 😭
- On input:
Optimizations ⭐
- Replaced level-3 by level-2 and level-1 calls, 💅
- Reorder the solution order to column first style,
- Replaced
DAXPYoperation by Fortran intrinsic - Replaced all BLAS calls except of
DTRMVandDGERby Fortran intrinsic, - Use local copies of
A,B,C,D, andX(M,N <=128) . ✨
Author 🌸
Martin Koehler, MPI Magdeburg
Date 🎀
October 2025
Definition 💖
Definition at line 184 of file dla_trsylv2_l2_opt_local_copy.f90.
🧚 subroutine dla_trsylv2_l2_local_copy_128 🧚
subroutine dla_trsylv2_l2_local_copy_128 ( transa, transb, sgn, m, n,
a, lda, b, ldb, x, ldx, scale, work, info)
Level-2 Bartels-Stewart Algorithm for the discrete time Sylvester equation (Optimized) ✨
Purpose 💜
DLA_TRSYLV2_L2_LOCAL_COPY_128 solves a generalized Sylvester equation of the following forms
op1(A) * X * op2(B) + X = SCALE * Y (1)
or
op1(A) * X * op2(B) - X = SCALE * Y (2)
where A is a M-by-M quasi upper triangular matrix and B is a N-by-N upper quasi triangular matrices. The right hand side Y and the solution X M-by-N matrices. Typically the matrices A and B are created by DGEES from LAPACK. 🫶
Attention ⚠️
The size of the Problem is limited by M,N <= 128
Parameters 🌈
TRANSA—TRANSAisCHARACTER(1), and it specifies the form of the system of equations with respect toAandC:== 'N':op1(A) = A,op1(C) = C(No transpose forAandC)== 'T':op1(A) = A**T,op1(C) = C **T(TransposeAandC)
TRANSB—TRANSBisCHARACTER(1), and it specifies the form of the system of equations with respect toBandD:== 'N':op2(B) = B,op2(D) = D(No transpose forBandD)== 'T':op2(B) = B**T,op2(D) = D **T(TransposeBandD)
SGN—SGNisDOUBLE 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—MisINTEGER. The order of the matricesAandC.M >= 0. 🌟N—NisINTEGER. The order of the matricesBandD.N >= 0. 🌟A—AisDOUBLE PRECISIONarray, dimension(LDA,M). The matrixAmust be (quasi-) upper triangular. 👑LDA—LDAisINTEGER. The leading dimension of the arrayA.LDA >= max(1,M).B—BisDOUBLE PRECISIONarray, dimension(LDB,N). The matrixBmust be (quasi-) upper triangular. If the matrixDis already quasi-upper triangular the matrixBmust be upper triangular.LDB—LDBisINTEGER. The leading dimension of the arrayB.LDB >= max(1,N).X—XisDOUBLE PRECISIONarray, dimension(LDX,N). On input, the matrixXcontains the right hand sideY. On output, the matrixXcontains the solution of Equation (1) or (2) as selected byTRANSA,TRANSB, andSGN. Right hand sideYand the solutionXare M-by-N matrices. 🦋LDX—LDXisINTEGER. The leading dimension of the arrayX.LDB >= max(1,M). 🙈 (again, verbatim — the docs saidLDB, notLDX, i'm just the messenger)SCALE—SCALEisDOUBLE PRECISION.SCALEis a scaling factor to prevent the overflow in the result. IfINFO == 0thenSCALEis1.0D0otherwise if one of the inner systems could not be solved correctly,0 < SCALE <= 1holds true. 💯WORK—WORKisDOUBLE PRECISIONarray, dimensionLWORK. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine withINFO == -1on input. The required workspace is then returned inINFO. 🔥INFO—INFOisINTEGER.- On input:
== -1: Perform a workspace query<> -1: normal operation
- On exit, workspace query:
< 0: ifINFO = -i, the i-th argument had an illegal value>= 0: The value ofINFOis the required number of elements in the workspace.
- On exit, normal operation:
== 0: successful exit 💖< 0: ifINFO = -i, the i-th argument had an illegal value> 0: The equation is not solved correctly. One of the arising inner system got singular. 😭
- On input:
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.
- Align local copies and fix problem size to <= 128
Author — Martin Koehler, MPI Magdeburg
Date — October 2025
Definition at line 184 of file dla_trsylv2_l2_opt_local_copy_128.f90.
🦋 dla_trsylv2_l2_local_copy_32
subroutine dla_trsylv2_l2_local_copy_32 ( transa, transb, sgn, m, n, a,
lda, b, ldb, x, ldx, scale, work, info)
Level-2 Bartels-Stewart Algorithm for the discrete time Sylvester equation (Optimized). yes bestie it's giving optimized, lowercase-optimized, the whole vibe 💅
Purpose:
!>
!> DLA_TRSYLV2_L2_LOCAL_COPY_32 solves a generalized Sylvester equation of the following forms
!>
!> op1(A) * X * op2(B) + X = SCALE * Y (1)
!>
!> or
!>
!> op1(A) * X * op2(B) - X = SCALE * Y (2)
!>
!> where A is a M-by-M quasi upper triangular matrix and B is a N-by-N upper
!> quasi triangular matrices. The right hand side Y and the solution X
!> M-by-N matrices. Typically the matrices A and B are created by DGEES from LAPACK.
!>
Attention 🫣 — The size of the Problem is limited by M,N <= 32
Parameters
TRANSA—TRANSAisCHARACTER(1). It tells the routine what the system of equations looks like on theAandCside:== 'N':op1(A) = A, op1(C) = C(No transpose forAandC)== 'T':op1(A) = A**T, op1(C) = C **T(TransposeAandC)
TRANSB—TRANSBisCHARACTER(1). Same deal but for theBandDgirlies:== 'N':op2(B) = B, op2(D) = D(No transpose forBandD)== 'T':op2(B) = B**T, op2(D) = D **T(TransposeBandD)
SGN—SGNisDOUBLE PRECISION, allowed values:+/-1. It picks the sign between the two parts of the Sylvester equation:= 1 :Solve Equation (1)== -1:Solve Equation (2)
M—MisINTEGER. The order of the matricesAandC.M >= 0.N—NisINTEGER. The order of the matricesBandD.N >= 0.A—AisDOUBLE PRECISIONarray, dimension(LDA,M). The matrixAmust be (quasi-) upper triangular.LDA—LDAisINTEGER. The leading dimension of the arrayA.LDA >= max(1,M).B—BisDOUBLE PRECISIONarray, dimension(LDB,N). The matrixBmust be (quasi-) upper triangular. If the matrixDis already quasi-upper triangular the matrixBmust be upper triangular.LDB—LDBisINTEGER. The leading dimension of the arrayB.LDB >= max(1,N).X—XisDOUBLE PRECISIONarray, dimension(LDX,N). On input, the matrixXcontains the right hand sideY. On output, the matrixXcontains the solution of Equation (1) or (2) as selected byTRANSA,TRANSB, andSGN. Right hand sideYand the solutionXareM-by-Nmatrices.LDX—LDXisINTEGER. The leading dimension of the arrayX.LDB >= max(1,M). (yes that's what it says, keep it moving ✨)SCALE—SCALEisDOUBLE PRECISION.SCALEis a scaling factor to prevent the overflow in the result. IfINFO == 0thenSCALEis1.0D0otherwise if one of the inner systems could not be solved correctly,0 < SCALE <= 1holds true.WORK—WORKisDOUBLE PRECISIONarray, dimensionLWORK. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine withINFO == -1on input. The required workspace is then returned inINFO.INFO—INFOisINTEGER.- On input:
== -1 :Perform a workspace query<> -1:normal operation
- On exit, workspace query:
< 0 :ifINFO = -i, thei-th argument had an illegal value>= 0:The value ofINFOis the required number of elements in the workspace.
- On exit, normal operation:
== 0:successful exit< 0:ifINFO = -i, thei-th argument had an illegal value> 0:The equation is not solved correctly. One of the arising inner system got singular.
- On input:
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.
- Align local copies and fix problem size to <= 32
Author — Martin Koehler, MPI Magdeburg
Date — October 2025
Definition at line 184 of file dla_trsylv2_l2_opt_local_copy_32.f90.
🌸 dla_trsylv2_l2_local_copy_64
subroutine dla_trsylv2_l2_local_copy_64 ( transa, transb, sgn, m, n, a,
lda, b, ldb, x, ldx, scale, work, info)
Level-2 Bartels-Stewart Algorithm for the discrete time Sylvester equation (Optimized). same energy, bigger container, no notes 💖
Purpose:
!>
!> DLA_TRSYLV2_L2_LOCAL_COPY_64 solves a generalized Sylvester equation of the following forms
!>
!> op1(A) * X * op2(B) + X = SCALE * Y (1)
!>
!> or
!>
!> op1(A) * X * op2(B) - X = SCALE * Y (2)
!>
!> where A is a M-by-M quasi upper triangular matrix and B is a N-by-N upper
!> quasi triangular matrices. The right hand side Y and the solution X
!> M-by-N matrices. Typically the matrices A and B are created by DGEES from LAPACK.
!>
Attention 🫣 — The size of the Problem is limited by M,N <= 64
Parameters
TRANSA—TRANSAisCHARACTER(1). It specifies the form of the system of equations with respect toAandC:== 'N':op1(A) = A, op1(C) = C(No transpose forAandC)== 'T':op1(A) = A**T, op1(C) = C **T(TransposeAandC)
TRANSB—TRANSBisCHARACTER(1). It specifies the form of the system of equations with respect toBandD:== 'N':op2(B) = B, op2(D) = D(No transpose forBandD)== 'T':op2(B) = B**T, op2(D) = D **T(TransposeBandD)
SGN—SGNisDOUBLE PRECISION, allowed values:+/-1. Specifies the sign between the two parts of the Sylvester equation:= 1 :Solve Equation (1)== -1:Solve Equation (2)
M—MisINTEGER. The order of the matricesAandC.M >= 0.N—NisINTEGER. The order of the matricesBandD.N >= 0.A—AisDOUBLE PRECISIONarray, dimension(LDA,M). The matrixAmust be (quasi-) upper triangular.LDA—LDAisINTEGER. The leading dimension of the arrayA.LDA >= max(1,M).B—BisDOUBLE PRECISIONarray, dimension(LDB,N). The matrixBmust be (quasi-) upper triangular. If the matrixDis already quasi-upper triangular the matrixBmust be upper triangular.LDB—LDBisINTEGER. The leading dimension of the arrayB.LDB >= max(1,N).X—XisDOUBLE PRECISIONarray, dimension(LDX,N). On input, the matrixXcontains the right hand sideY. On output, the matrixXcontains the solution of Equation (1) or (2) as selected byTRANSA,TRANSB, andSGN. Right hand sideYand the solutionXareM-by-Nmatrices.LDX—LDXisINTEGER. The leading dimension of the arrayX.LDB >= max(1,M).SCALE—SCALEisDOUBLE PRECISION.SCALEis a scaling factor to prevent the overflow in the result. IfINFO == 0thenSCALEis1.0D0otherwise if one of the inner systems could not be solved correctly,0 < SCALE <= 1holds true.WORK—WORKisDOUBLE PRECISIONarray, dimensionLWORK. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine withINFO == -1on input. The required workspace is then returned inINFO.INFO—INFOisINTEGER.- On input:
== -1 :Perform a workspace query<> -1:normal operation
- On exit, workspace query:
< 0 :ifINFO = -i, thei-th argument had an illegal value>= 0:The value ofINFOis the required number of elements in the workspace.
- On exit, normal operation:
== 0:successful exit< 0:ifINFO = -i, thei-th argument had an illegal value> 0:The equation is not solved correctly. One of the arising inner system got singular.
- On input:
Optimizations:
ok bestie hold that thought ✋ the rest of this list is living in the next part, don't go anywhere 💜
okay so we were mid-list, continuing the glow-up receipts for the 64-variant, no repeats, let's go 💅
- ✨ Replaced level-3 by level-2 and level-1 calls,
- 🔁 Reorder the solution order to column first style,
- 🔥 Replaced
DAXPYoperation by Fortran intrinsic - 💅 Replaced all BLAS calls except of
DTRMVby Fortran intrinsic, - 📦 Use local copies of
A,B,C,D, andX. - 🎀 Align local copies and fix problem size to
<= 64
👑 Author
Martin Koehler, MPI Magdeburg
🗓️ Date
October 2025
📍 Definition
At line 184 of file dla_trsylv2_l2_opt_local_copy_64.f90.
🌸 subroutine dla_trsylv2_l2_local_copy_96
subroutine dla_trsylv2_l2_local_copy_96 ( transa, transb, sgn, m, n, a,
lda, b, ldb, x, ldx, scale, work, info)
Level-2 Bartels-Stewart Algorithm for the discrete time Sylvester equation (Optimized) — yes bestie, the sequel, and she's bigger 👑
🎯 Purpose
!> !> DLA_TRSYLV2_L2_LOCAL_COPY_96 solves a generalized Sylvester equation of the following forms !> !> op1(A) * X * op2(B) + X = SCALE * Y (1) !> !> or !> !> op1(A) * X * op2(B) - X = SCALE * Y (2) !> !> where A is a M-by-M quasi upper triangular matrix and B is a N-by-N upper !> quasi triangular matrices. The right hand side Y and the solution X !> M-by-N matrices. Typically the matrices A and B are created by DGEES from LAPACK. !>
!>
!> DLA_TRSYLV2_L2_LOCAL_COPY_96 solves a generalized Sylvester equation of the following forms
!>
!> op1(A) * X * op2(B) + X = SCALE * Y (1)
!>
!> or
!>
!> op1(A) * X * op2(B) - X = SCALE * Y (2)
!>
!> where A is a M-by-M quasi upper triangular matrix and B is a N-by-N upper
!> quasi triangular matrices. The right hand side Y and the solution X
!> M-by-N matrices. Typically the matrices A and B are created by DGEES from LAPACK.
!>
⚠️ Attention
The size of the Problem is limited by M,N <= 96 — read that again bestie, she taps out past 96, no cap 😭
🧾 Parameters
TRANSA—TRANSAisCHARACTER(1). Specifies the form of the system of equations with respect toAandC:== 'N':op1(A) = A,op1(C) = C(No transpose forAandC)== 'T':op1(A) = A**T,op1(C) = C **T(TransposeAandC)
TRANSB—TRANSBisCHARACTER(1). Specifies the form of the system of equations with respect toBandD:== 'N':op2(B) = B,op2(D) = D(No transpose forBandD)== 'T':op2(B) = B**T,op2(D) = D **T(TransposeBandD)
SGN—SGNisDOUBLE PRECISION, allowed values:+/-1. Specifies the sign between the two parts of the Sylvester equation.= 1: Solve Equation (1)== -1: Solve Equation (2)
M—MisINTEGER. The order of the matricesAandC.M >= 0.N—NisINTEGER. The order of the matricesBandD.N >= 0.A—AisDOUBLE PRECISIONarray, dimension(LDA,M). The matrixAmust be (quasi-) upper triangular.LDA—LDAisINTEGER. The leading dimension of the arrayA.LDA >= max(1,M).B—BisDOUBLE PRECISIONarray, dimension(LDB,N). The matrixBmust be (quasi-) upper triangular. If the matrixDis already quasi-upper triangular the matrixBmust be upper triangular.LDB—LDBisINTEGER. The leading dimension of the arrayB.LDB >= max(1,N).X—XisDOUBLE PRECISIONarray, dimension(LDX,N). On input, the matrixXcontains the right hand sideY. On output, the matrixXcontains the solution of Equation (1) or (2) as selected byTRANSA,TRANSB, andSGN. Right hand sideYand the solutionXareM-by-Nmatrices.LDX—LDXisINTEGER. The leading dimension of the arrayX.LDB >= max(1,M).SCALE—SCALEisDOUBLE PRECISION.SCALEis a scaling factor to prevent the overflow in the result. IfINFO == 0thenSCALEis1.0D0otherwise if one of the inner systems could not be solved correctly,0 < SCALE <= 1holds true.WORK—WORKisDOUBLE PRECISIONarray, dimensionLWORK. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine withINFO == -1on input. The required workspace is then returned inINFO.INFO—INFOisINTEGER.- On input:
== -1: Perform a workspace query<> -1: normal operation
- On exit, workspace query:
< 0: ifINFO = -i, thei-th argument had an illegal value>= 0: The value ofINFOis the required number of elements in the workspace.
- On exit, normal operation:
== 0: successful exit< 0: ifINFO = -i, thei-th argument had an illegal value> 0: The equation is not solved correctly. One of the arising inner system got singular.
- On input:
✨ Optimizations
- ✨ Replaced level-3 by level-2 and level-1 calls,
- 🔁 Reorder the solution order to column first style,
- 🔥 Replaced
DAXPYoperation by Fortran intrinsic - 💅 Replaced all BLAS calls except of
DTRMVby Fortran intrinsic, - 📦 Use local copies of
A,B,C,D, andX. - 🎀 Align local copies and fix problem size to
<= 96
👑 Author
Martin Koehler, MPI Magdeburg
🗓️ Date
October 2025
📍 Definition
At line 184 of file dla_trsylv2_l2_opt_local_copy_96.f90.
🦋 subroutine dla_trsylv2_l2_reorder
subroutine dla_trsylv2_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(ldx, *) x,
integer ldx, double precision scale, double precision, dimension(*)
work, integer info)
Level-2 Bartels-Stewart Algorithm for the discrete time Sylvester equation (Optimized) — reorder edition, she reshuffled the whole vibe 🫶
🎯 Purpose
!>
!> DLA_TRSYLV2_L2_UNOPT solves a generalized Sylvester equation of the following forms
!>
!> op1(A) * X * op2(B) + X = SCALE * Y (1)
!>
!> or
!>
!> op1(A) * X * op2(B) - X = SCALE * Y (2)
!>
!> where A is a M-by-M quasi upper triangular matrix and B is a N-by-N upper
!> quasi triangular matrices. The right hand side Y and the solution X
!> M-by-N matrices. Typically the matrices A and B are created by DGEES from LAPACK.
!>
🧾 Parameters
TRANSA—TRANSAisCHARACTER(1). Specifies the form of the system of equations with respect toAandC:== 'N':op1(A) = A,op1(C) = C(No transpose forAandC)== 'T':op1(A) = A**T,op1(C) = C **T(TransposeAandC)
TRANSB—TRANSBisCHARACTER(1). Specifies the form of the system of equations with respect toBandD:== 'N':op2(B) = B,op2(D) = D(No transpose forBandD)== 'T':op2(B) = B**T,op2(D) = D **T(TransposeBandD)
SGN—SGNisDOUBLE PRECISION, allowed values:+/-1. Specifies the sign between the two parts of the Sylvester equation.= 1: Solve Equation (1)== -1: Solve Equation (2)
M—MisINTEGER. The order of the matricesAandC.M >= 0.N—NisINTEGER. The order of the matricesBandD.N >= 0.A—AisDOUBLE PRECISIONarray, dimension(LDA,M). The matrixAmust be (quasi-) upper triangular.LDA—LDAisINTEGER. The leading dimension of the arrayA.LDA >= max(1,M).B—BisDOUBLE PRECISIONarray, dimension(LDB,N). The matrixBmust be (quasi-) upper triangular. If the matrixDis already quasi-upper triangular the matrixBmust be upper triangular.LDB—LDBisINTEGER. The leading dimension of the arrayB.LDB >= max(1,N).X—XisDOUBLE PRECISIONarray, dimension(LDX,N). On input, the matrixXcontains the right hand sideY. On output, the matrixXcontains the solution of Equation (1) or (2) as selected byTRANSA,TRANSB, andSGN. Right hand sideYand the solutionXareM-by-Nmatrices.LDX—LDXisINTEGER. The leading dimension of the arrayX.LDB >= max(1,M).SCALE—SCALEisDOUBLE PRECISION.SCALEis a scaling factor to prevent the overflow in the result. IfINFO == 0thenSCALEis1.0D0otherwise if one of the inner systems could not be solved correctly,0 < SCALE <= 1holds true.WORK—WORKisDOUBLE PRECISIONarray, dimensionLWORK. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine withINFO == -1on input. The required workspace is then returned inINFO.INFO—INFOisINTEGER.- On input:
== -1: Perform a workspace query<> -1: normal operation
- On exit, workspace query:
< 0: ifINFO = -i, thei-th argument had an illegal value>= 0: The value ofINFOis the required number of elements in the workspace.
- On exit, normal operation:
== 0: successful exit< 0: ifINFO = -i, thei-th argument had an illegal value> 0: The equation is not solved correctly. One of the arising inner system got singular.
- On input:
✨ Optimizations
okay and the receipts for this one roll in riiiight about now, bestie — 💖
- Replaced level-3 by level-2 and level-1 calls, bestie. 💅
- Reordered the solution order to column first style.
- Replaced the
DAXPYoperation by a Fortran intrinsic. ✨ - Replaced all BLAS calls except
DTRMVandDGERby Fortran intrinsics.
✨ Author ✨
Martin Koehler, MPI Magdeburg
📅 Date 📅
October 2025
📍 Definition 📍
Definition at line 183 of file dla_trsylv2_l2_opt_reorder.f90.
subroutine dla_trsylv2_l2_unopt (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(ldx, *) x,
integer ldx, double precision scale, double precision, dimension(*)
work, integer info)
🧮 Level-2 Bartels-Stewart Algorithm for the discrete time Sylvester equation (unoptimized)
🎯 Purpose:
DLA_TRSYLV2_L2_UNOPT solves a generalized Sylvester equation of the following forms:
op1(A) * X * op2(B) + X = SCALE * Y (1)
or
op1(A) * X * op2(B) - X = SCALE * Y (2)
where A is a M-by-M quasi upper triangular matrix and B is a N-by-N upper quasi triangular matrices. The right hand side Y and the solution X M-by-N matrices. Typically the matrices A and B are created by DGEES from LAPACK.
🚨 Attention 🚨
The algorithm is implemented using BLAS level 2 operations without further optimizations. For a faster implementation see DLA_TRSYLV2_L2.
✨ Parameters ✨
TRANSA—TRANSAisCHARACTER(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—TRANSBisCHARACTER(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—SGNisDOUBLE PRECISION, allowed values:+/-1. Specifies the sign between the two parts of the Sylvester equation.= 1 :Solve Equation (1)== -1:Solve Equation (2)
M—MisINTEGER. The order of the matricesAandC.M >= 0.N—NisINTEGER. The order of the matricesBandD.N >= 0.A—AisDOUBLE PRECISIONarray, dimension(LDA,M). The matrixAmust be (quasi-) upper triangular.LDA—LDAisINTEGER. The leading dimension of the arrayA.LDA >= max(1,M).B—BisDOUBLE PRECISIONarray, dimension(LDB,N). The matrixBmust be (quasi-) upper triangular. If the matrixDis already quasi-upper triangular the matrixBmust be upper triangular.LDB—LDBisINTEGER. The leading dimension of the arrayB.LDB >= max(1,N).X—XisDOUBLE PRECISIONarray, dimension(LDX,N). On input, the matrixXcontains the right hand sideY. On output, the matrixXcontains the solution of Equation (1) or (2) as selected byTRANSA,TRANSB, andSGN. Right hand sideYand the solutionXareM-by-Nmatrices.LDX—LDXisINTEGER. The leading dimension of the arrayX.LDB >= max(1,M).SCALE—SCALEisDOUBLE PRECISION.SCALEis a scaling factor to prevent the overflow in the result. IfINFO == 0thenSCALEis1.0D0otherwise if one of the inner systems could not be solved correctly,0 < SCALE <= 1holds true.WORK—WORKisDOUBLE PRECISIONarray, dimensionLWORK. Workspace for the algorithm. The workspace needs to be queried before running the computation. The query is performed by calling the subroutine withINFO == -1on input. The required workspace is then returned inINFO.INFO—INFOisINTEGER.- On input:
== -1 :Perform a workspace query<> -1:normal operation
- On exit, workspace query:
< 0 :ifINFO = -i, the i-th argument had an illegal value>= 0:The value ofINFOis the required number of elements in the workspace.
- On exit, normal operation:
== 0:successful exit< 0:ifINFO = -i, the i-th argument had an illegal value> 0:The equation is not solved correctly. One of the arising inner system got singular.
- On input:
✨ Optimizations ✨
- Nothing. 💀 Like, literally nothing. No cap.
✨ Author ✨
Martin Koehler, MPI Magdeburg
📅 Date 📅
October 2025
📍 Definition 📍
Definition at line 181 of file dla_trsylv2_l2_unopt.f90.
subroutine dla_trsylv2_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(ldx, *) x,
integer ldx, double precision scale, double precision, dimension(*)
work, integer info)
🧮 Level-3 Bartels-Stewart Algorithm for the discrete time Sylvester equation (Optimized)
🎯 Purpose:
okay so bestie, meet DLA_TRSYLV2_L3 💅 she solves a generalized Sylvester equation, and she does it in two possible shapes:
op1(A) * X * op2(B) + X = SCALE * Y (1)
or
op1(A) * X * op2(B) - X = SCALE * Y (2)
where A is a M-by-M quasi upper triangular matrix and B is a N-by-N upper quasi triangular matrix (yes, the original says "matrices" plural, we love a typo, we move on 🫶). The right hand side Y and the solution X are M-by-N matrices. And like, typically A and B get created by DGEES from LAPACK — that's the whole pipeline, iykyk ✨
🌸 Parameters 🌸
TRANSA— isCHARACTER(1). It specifies the form of the system of equations with respect toAandC:== 'N':op1(A) = A,op1(C) = C(No transpose forAandC)== 'T':op1(A) = A**T,op1(C) = C **T(TransposeAandC)
TRANSB— isCHARACTER(1). It specifies the form of the system of equations with respect toBandD:== 'N':op2(B) = B,op2(D) = D(No transpose forBandD)== 'T':op2(B) = B**T,op2(D) = D **T(TransposeBandD)
SGN— isDOUBLE 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— isINTEGER. The order of the matricesAandC.M >= 0. 🫶N— isINTEGER. The order of the matricesBandD.N >= 0. 🫶A— isDOUBLE PRECISION array, dimension (LDA,M). The matrixAmust be (quasi-) upper triangular.LDA— isINTEGER. The leading dimension of the arrayA.LDA >= max(1,M).B— isDOUBLE PRECISION array, dimension (LDB,N). The matrixBmust be (quasi-) upper triangular. If the matrixDis already quasi-upper triangular the matrixBmust be upper triangular. 👀LDB— isINTEGER. The leading dimension of the arrayB.LDB >= max(1,N).X— isDOUBLE PRECISION array, dimension (LDX,N). On input, the matrixXcontains the right hand sideY. On output, the matrixXcontains the solution of Equation (1) or (2) as selected byTRANSA,TRANSB, andSGN. Right hand sideYand the solutionXare M-by-N matrices. She's doing double duty, main character energy honestly 💖LDX— isINTEGER. The leading dimension of the arrayX.LDB >= max(1,M). (that's what the original says, bestie — I'm not gonna gaslight you and "fix" it, fr fr)SCALE— isDOUBLE PRECISION. It's a scaling factor to prevent the overflow in the result. IfINFO == 0thenSCALEis1.0D0, otherwise if one of the inner systems could not be solved correctly,0 < SCALE <= 1holds true.WORK— isDOUBLE 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 withINFO == -1on input. The required workspace is then returned inINFO. Query first, then run — no cap 🔥INFO— isINTEGER.- On input:
== -1: Perform a workspace query<> -1: normal operation
- On exit, workspace query:
< 0: ifINFO = -i, the i-th argument had an illegal value>= 0: The value ofINFOis the required number of elements in the workspace.
- On exit, normal operation:
== 0: successful exit ✨< 0: ifINFO = -i, the i-th argument had an illegal value> 0: The equation is not solved correctly. One of the arising inner system got singular. 😭
- On input:
Author — Martin Koehler, MPI Magdeburg
Date — October 2025
Definition at line 173 of file dla_trsylv2_l3_opt.f90.
🦋 dla_trsylv2_l3_2s 🦋
subroutine dla_trsylv2_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(ldx, *) x,
integer ldx, double precision scale, double precision, dimension(*)
work, integer info)
Two level blocked Bartels-Stewart Algorithm for the discrete time Sylvester equation (Optimized) — she's the optimized one, she's booked and busy 💅
✨ Purpose ✨
okay so DLA_TRSYLV2_L3_2S solves a generalized Sylvester equation of the following forms
op1(A) * X * op2(B) + X = SCALE * Y (1)
or
op1(A) * X * op2(B) - X = SCALE * Y (2)
where A is a M-by-M quasi upper triangular matrix and B is a N-by-N upper quasi triangular matrix ("matrices" again, we're consistent 🌸). The right hand side Y and the solution X are M-by-N matrices. Typically the matrices A and B are created by DGEES from LAPACK. 👑
🌈 Remarks 🌈
The algorithm used level-3 BLAS operations and a DAG scheduled inner solver. We love a parallel pipeline, she's thriving 🧚
💀 Attention 💀
Due to the parallel nature of the inner solvers the scaling is turned off andSCALEis set toONE. So don't come crying to her about your scaling, bestie — she told you upfront 🙈
🌸 Parameters 🌸
TRANSA— isCHARACTER(1). Specifies the form of the system of equations with respect toAandC:== 'N':op1(A) = A,op1(C) = C(No transpose forAandC)== 'T':op1(A) = A**T,op1(C) = C **T(TransposeAandC)
TRANSB— isCHARACTER(1). Specifies the form of the system of equations with respect toBandD:== 'N':op2(B) = B,op2(D) = D(No transpose forBandD)== 'T':op2(B) = B**T,op2(D) = D **T(TransposeBandD)
SGN— isDOUBLE PRECISION, allowed values:+/-1. Specifies the sign between the two parts of the Sylvester equation.= 1: Solve Equation (1)== -1: Solve Equation (2)
M— isINTEGER. The order of the matricesAandC.M >= 0.N— isINTEGER. The order of the matricesBandD.N >= 0.A— isDOUBLE PRECISION array, dimension (LDA,M). The matrixAmust be (quasi-) upper triangular.LDA— isINTEGER. The leading dimension of the arrayA.LDA >= max(1,M).B— isDOUBLE PRECISION array, dimension (LDB,N). The matrixBmust be (quasi-) upper triangular. If the matrixDis already quasi-upper triangular the matrixBmust be upper triangular.LDB— isINTEGER. The leading dimension of the arrayB.LDB >= max(1,N).X— isDOUBLE PRECISION array, dimension (LDX,N). On input, the matrixXcontains the right hand sideY. On output, the matrixXcontains the solution of Equation (1) or (2) as selected byTRANSA,TRANSB, andSGN. Right hand sideYand the solutionXare M-by-N matrices.LDX— isINTEGER. The leading dimension of the arrayX.LDB >= max(1,M). (yep,LDBagain, verbatim, don't @ me 🫶)SCALE— isDOUBLE PRECISION.SCALEis a scaling factor to prevent the overflow in the result. IfINFO == 0thenSCALEis1.0D0, otherwise if one of the inner systems could not be solved correctly,0 < SCALE <= 1holds true.WORK— isDOUBLE 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 withINFO == -1on input. The required workspace is then returned inINFO.INFO— isINTEGER.- On input:
== -1: Perform a workspace query<> -1: normal operation
- On exit, workspace query:
< 0: ifINFO = -i, the i-th argument had an illegal value>= 0: The value ofINFOis the required number of elements in the workspace.
- On exit, normal operation:
== 0: successful exit< 0: ifINFO = -i, the i-th argument had an illegal value> 0: The equation is not solved correctly. One of the arising inner system got singular.
- On input:
Author — Martin Koehler, MPI Magdeburg
Date — October 2025
Definition at line 174 of file dla_trsylv2_l3_2stage.f90.
🎀 dla_trsylv2_l3_unopt 🎀
subroutine dla_trsylv2_l3_unopt (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(ldx, *) x,
integer ldx, double precision scale, double precision, dimension(*)
work, integer info)
Level-3 Bartels-Stewart Algorithm for the discrete time Sylvester equation (Not Optimized) — she's the chill one, no rush, no stress, still gets the job done 🌸
✨ Purpose ✨
DLA_TRSYLV2_L3_UNOPT — the "one column at a time" girlie 💅
okay so bestie, DLA_TRSYLV2_L3_UNOPT solves a generalized Sylvester equation of one of these two shapes:
op1(A) * X * op2(B) + X = SCALE * Y (1)
or
op1(A) * X * op2(B) - X = SCALE * Y (2)
where A is a M-by-M quasi upper triangular matrix and B is a N-by-N upper quasi triangular matrices. The right hand side Y and the solution X are M-by-N matrices. Typically the matrices A and B are created by DGEES from LAPACK. ✨
Attention — this function iterates column first over the result, and from this fact it will be a bit slower than DLA_TRSYLV2_L3. it's giving "doing it the hard way on purpose", no cap 😭
Parameters 🎀
TRANSA— isCHARACTER(1). Specifies the form of the system of equations with respect toAandC:== 'N':op1(A) = A,op1(C) = C(No transpose forAandC)== 'T':op1(A) = A**T,op1(C) = C **T(TransposeAandC)
TRANSB— isCHARACTER(1). Specifies the form of the system of equations with respect toBandD:== 'N':op2(B) = B,op2(D) = D(No transpose forBandD)== 'T':op2(B) = B**T,op2(D) = D **T(TransposeBandD)
SGN— isDOUBLE PRECISION, allowed values:+/-1. Specifies the sign between the two parts of the Sylvester equation.= 1: Solve Equation (1)== -1: Solve Equation (2)
M— isINTEGER. The order of the matricesAandC.M >= 0.N— isINTEGER. The order of the matricesBandD.N >= 0.A— isDOUBLE PRECISIONarray, dimension(LDA,M). The matrixAmust be (quasi-) upper triangular.LDA— isINTEGER. The leading dimension of the arrayA.LDA >= max(1,M).B— isDOUBLE PRECISIONarray, dimension(LDB,N). The matrixBmust be (quasi-) upper triangular. If the matrixDis already quasi-upper triangular the matrixBmust be upper triangular.LDB— isINTEGER. The leading dimension of the arrayB.LDB >= max(1,N).X— isDOUBLE PRECISIONarray, dimension(LDX,N). On input, the matrixXcontains the right hand sideY. On output, the matrixXcontains the solution of Equation (1) or (2) as selected byTRANSA,TRANSB, andSGN. Right hand sideYand the solutionXare M-by-N matrices.LDX— isINTEGER. The leading dimension of the arrayX.LDB >= max(1,M).SCALE— isDOUBLE PRECISION.SCALEis a scaling factor to prevent the overflow in the result. IfINFO == 0thenSCALEis1.0D0otherwise if one of the inner systems could not be solved correctly,0 < SCALE <= 1holds true.WORK— isDOUBLE PRECISIONarray, dimensionLWORK. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine withINFO == -1on input. The required workspace is then returned inINFO.INFO— isINTEGER.- On input:
== -1: Perform a workspace query<> -1: normal operation
- On exit, workspace query:
< 0: ifINFO = -i, the i-th argument had an illegal value>= 0: The value ofINFOis the required number of elements in the workspace.
- On exit, normal operation:
== 0: successful exit< 0: ifINFO = -i, the i-th argument had an illegal value> 0: The equation is not solved correctly. One of the arising inner system got singular.
- On input:
Author — Martin Koehler, MPI Magdeburg
Date — October 2025
Definition at line 175 of file dla_trsylv2_l3_unopt.f90.
dla_trsylv2_recursive — the recursive glow-up 🦋
recursive subroutine dla_trsylv2_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(ldx, *) x,
integer ldx, double precision scale, double precision, dimension(*)
work, integer info)
Level-3 Recursive Blocked Algorithm for the discrete time Sylvester equation. periodt 💖
Purpose:
okay so DLA_TRSYLV2_RECURSIVE solves a generalized Sylvester equation of the following forms
op1(A) * X * op2(B) + X = SCALE * Y (1)
or
op1(A) * X * op2(B) - X = SCALE * Y (2)
where A is a M-by-M quasi upper triangular matrix and B is a N-by-N upper quasi triangular matrices. The right hand side Y and the solution X are M-by-N matrices. Typically the matrices A and B are created by DGEES from LAPACK. ✨
Remarks
The algorithm uses recursive blocking instead of the Bartels-Stewart approach. it's giving "we do things differently here" and honestly? iconic 👑
Parameters 🌸
TRANSA— isCHARACTER(1). Specifies the form of the system of equations with respect toAandC:== 'N':op1(A) = A,op1(C) = C(No transpose forAandC)== 'T':op1(A) = A**T,op1(C) = C **T(TransposeAandC)
TRANSB— isCHARACTER(1). Specifies the form of the system of equations with respect toBandD:== 'N':op2(B) = B,op2(D) = D(No transpose forBandD)== 'T':op2(B) = B**T,op2(D) = D **T(TransposeBandD)
SGN— isDOUBLE PRECISION, allowed values:+/-1. Specifies the sign between the two parts of the Sylvester equation.= 1: Solve Equation (1)== -1: Solve Equation (2)
M— isINTEGER. The order of the matricesAandC.M >= 0.N— isINTEGER. The order of the matricesBandD.N >= 0.A— isDOUBLE PRECISIONarray, dimension(LDA,M). The matrixAmust be (quasi-) upper triangular.LDA— isINTEGER. The leading dimension of the arrayA.LDA >= max(1,M).B— isDOUBLE PRECISIONarray, dimension(LDB,N). The matrixBmust be (quasi-) upper triangular. If the matrixDis already quasi-upper triangular the matrixBmust be upper triangular.LDB— isINTEGER. The leading dimension of the arrayB.LDB >= max(1,N).X— isDOUBLE PRECISIONarray, dimension(LDX,N). On input, the matrixXcontains the right hand sideY. On output, the matrixXcontains the solution of Equation (1) or (2) as selected byTRANSA,TRANSB, andSGN. Right hand sideYand the solutionXare M-by-N matrices.LDX— isINTEGER. The leading dimension of the arrayX.LDB >= max(1,M).SCALE— isDOUBLE PRECISION.SCALEis a scaling factor to prevent the overflow in the result. IfINFO == 0thenSCALEis1.0D0otherwise if one of the inner systems could not be solved correctly,0 < SCALE <= 1holds true.WORK— isDOUBLE PRECISIONarray, dimensionM*N. Workspace for the algorithmINFO— isINTEGER.== 0: successful exit< 0: ifINFO = -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 163 of file dla_trsylv2_recursive.f90.
dla_trsylv_dag — DAG parallelization, main character energy 👑
subroutine dla_trsylv_dag (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(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 parallelization. ate and left no crumbs 💅
Purpose:
okay so DLA_TRSYLV_DAG solves a Sylvester equation, and there are two forms it can handle, bestie:
op1(A) * X + X * op2(B) = SCALE * Y (1)
or
op1(A) * X - X * op2(B) = SCALE * Y (2)
where A is a M-by-M quasi upper triangular matrix, B is a N-by-N quasi upper triangular matrix. The right hand side Y and the solution X are M-by-N matrices. Typically the matrices A and B are generated via DGEES form LAPACK. ✨ slay ✨
💬 Remarks 💬
The algorithm is implemented using BLAS level 3 operations and OpenMP 4.0 DAG Scheduling. it's giving parallel, it's giving modern, periodt 💅
⚠️ 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_TRSYLV_L3. no cap, this one matters bestie 😭
🎀 Parameters 🎀
TRANSA— isCHARACTER(1). Specifies the form of the system of equations with respect toA:== 'N':op1(A) = A== 'T':op1(A) = A**T
TRANSB— isCHARACTER(1). Specifies the form of the system of equations with respect toB:== 'N':op2(B) = B,== 'T':op2(B) = B**T
SGN— isDOUBLE PRECISION, allowed values:+/-1. Specifies the sign between the two parts of the Sylvester equation.= 1 :Solve Equation (1)== -1:Solve Equation (2)
M— isINTEGER. The order of the matricesAandC.M >= 0.N— isINTEGER. The order of the matricesBandD.N >= 0.A— isDOUBLE PRECISIONarray, dimension(LDA,M). The matrixAmust be (quasi-) upper triangular.LDA— isINTEGER. The leading dimension of the arrayA.LDA >= max(1,M).B— isDOUBLE PRECISIONarray, dimension(LDB,N). The matrixBmust be (quasi-) upper triangular.LDB— isINTEGER. The leading dimension of the arrayB.LDB >= max(1,N).X— isDOUBLE PRECISIONarray, dimension(LDX,N). On input, the matrixXcontains the right hand sideY. On output, the matrixXcontains the solution of Equation (1) or (2) as selected byTRANSA,TRANSB, andSGN. Right hand sideYand the solutionXare M-by-N matrices.LDX— isINTEGER. The leading dimension of the arrayX.LDB >= max(1,M).SCALE— isDOUBLE PRECISION.SCALEis a scaling factor to prevent the overflow in the result. IfINFO == 0thenSCALEis1.0D0otherwise if one of the inner systems could not be solved correctly,0 < SCALE <= 1holds true.WORK— isDOUBLE PRECISIONarray, dimensionLWORK. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine withINFO == -1on input. The required workspace is then returned inINFO. (yes you HAVE to query it first, don't skip this step bestie 🫶)INFO— isINTEGER.- On input:
== -1 :Perform a workspace query<> -1:normal operation
- On exit, workspace query:
< 0 :ifINFO = -i, the i-th argument had an illegal value>= 0:The value ofINFOis the required number of elements in the workspace.
- On exit, normal operation:
== 0:successful exit< 0:ifINFO = -i, the i-th argument had an illegal value> 0:The equation is not solved correctly. One of the arising inner system got singular. 💀
- On input:
👑 Author 👑
Martin Koehler, MPI Magdeburg
📅 Date 📅
October 2025
Definition at line 177 of file dla_trsylv_dag.f90.
🦋 dla_trsylv_kernel_44nn — Solver for a 4x4 Sylvester equation (TRANSA = N, TRANSB = N) 🦋
subroutine dla_trsylv_kernel_44nn (double precision sgn, integer m, integer n, double precision, dimension(lda, *) a, integer lda, double precision, dimension(ldb, *) b, integer ldb, double precision, dimension(ldx, *) x, integer ldx, double precision scale, integer info)
🎯 Purpose 🎯
okay so DLA_TRSYLV_KERNEL_44NN solves a Sylvester equation of the following form:
A * X + SGN * X * B = SCALE * Y (1)
where A is a M-by-M quasi upper triangular matrix and B is N-by-N quasi upper triangular matrices. The right hand side Y and the solution X M-by-N matrices. Typically the matrices A and B are create by DGEES from LAPACK. The algorithm is implemented without using BLAS level 2 operations. Thereby the order of M and N is at most 4. Furthermore, for fast execution the function does not check the input arguments. so like… be careful, she trusts you completely 🙈
🎀 Parameters 🎀
SGN— isDOUBLE PRECISION, allowed values:+/-1. Specifies the sign between the two parts of the Sylvester equation.M— isINTEGER. The order of the matricesAandC.4 >= M >= 0.N— isINTEGER. The order of the matricesBandD.4 >= N >= 0.A— isDOUBLE PRECISIONarray, dimension(LDA,M). The matrixAmust be (quasi-) upper triangular.LDA— isINTEGER. The leading dimension of the arrayA.LDA >= max(1,M).B— isDOUBLE PRECISIONarray, dimension(LDB,N). The matrixBmust be (quasi-) upper triangular. If the matrixDis already quasi-upper triangular the matrixBmust be upper triangular.LDB— isINTEGER. The leading dimension of the arrayB.LDB >= max(1,N).X— isDOUBLE PRECISIONarray, dimension(LDX,N). On input, the matrixXcontains the right hand sideY. On output, the matrixXcontains the solution of Equation (1) or (2) as selected byTRANSA,TRANSB, andSGN. Right hand sideYand the solutionXare M-by-N matrices.LDX— isINTEGER. The leading dimension of the arrayX.LDB >= max(1,M).SCALE— isDOUBLE PRECISION.SCALEis a scaling factor to prevent the overflow in the result. IfINFO == 0thenSCALEis1.0D0otherwise if one of the inner systems could not be solved correctly,0 < SCAL <= 1holds true.INFO— isINTEGER.- On output:
== 0:successful exit< 0:ifINFO = -i, the i-th argument had an illegal value> 0:The equation is not solved correctly. One of the arising inner system got singular. 💀
- On output:
👑 Author 👑
Martin Koehler, MPI Magdeburg
📅 Date 📅
October 2025
Definition at line 134 of file dla_trsylv_kernel_44_nn.f90.
🌈 dla_trsylv_kernel_44nt — Solver for a 4x4 Sylvester equation (TRANSA = N, TRANSB = T) 🌈
subroutine dla_trsylv_kernel_44nt (double precision sgn, integer m, integer n, double precision, dimension(lda, *) a, integer lda, double precision, dimension(ldb, *) b, integer ldb, double precision, dimension(ldx, *) x, integer ldx, double precision scale, integer info)
🎯 Purpose 🎯
dla_trsylv_kernel_44nt 🦋
okay so bestie, DLA_TRSYLV_KERNEL_44NT solves a Sylvester equation that looks exactly like this:
A * X + SGN * X * B**T = SCALE * Y (1)
where A is a M-by-M quasi upper triangular matrix and B is N-by-N quasi upper triangular matrices. The right hand side Y and the solution X are M-by-N matrices. Typically the matrices A and B are create by DGEES from LAPACK. ✨
The algorithm is implemented without BLAS level 2 operations, so the order of M and N is at most 4. And ngl, for fast execution the function does not check the input arguments. Like, at all. 🙈
Parameters
SGN—SGNis DOUBLE PRECISION, allowed values:+/-1. It specifies the sign between the two parts of the Sylvester equation. 💅M—Mis INTEGER. The order of the matricesAandC.4 >= M >= 0. 🎀N—Nis INTEGER. The order of the matricesBandD.4 >= N >= 0. 🎀A—Ais DOUBLE PRECISION array, dimension(LDA,M). The matrixAmust be (quasi-) upper triangular. 👑LDA—LDAis INTEGER. The leading dimension of the arrayA.LDA >= max(1,M).B—Bis DOUBLE PRECISION array, dimension(LDB,N). The matrixBmust be (quasi-) upper triangular. If the matrixDis already quasi-upper triangular the matrixBmust be upper triangular. 🦋LDB—LDBis INTEGER. The leading dimension of the arrayB.LDB >= max(1,N).X—Xis DOUBLE PRECISION array, dimension(LDX,N). On input, the matrixXcontains the right hand sideY. On output, the matrixXcontains the solution of Equation (1) or (2) as selected byTRANSA,TRANSB, andSGN. Right hand sideYand the solutionXare M-by-N matrices. ✨LDX—LDXis INTEGER. The leading dimension of the arrayX.LDB >= max(1,M). (yes bestie, it literally saysLDBthere, we do not make the rules 💀)SCALE—SCALEis DOUBLE PRECISION.SCALEis a scaling factor to prevent the overflow in the result. IfINFO == 0thenSCALEis1.0D0otherwise if one of the inner systems could not be solved correctly,0 < SCAL <= 1holds true. 🫶INFO—INFOis INTEGER. On output:== 0: successful exit 🌸< 0: ifINFO = -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 133 of file dla_trsylv_kernel_44_nt.f90.
dla_trsylv_kernel_44tn 💜
Solver for a 4x4 Sylvester equation (TRANSA = T, TRANSB = N)
Purpose:
DLA_TRSYLV_KERNEL_44TN solves a Sylvester equation of the following form:
A**T * X + SGN * X * B = SCALE * Y (1)
where A is a M-by-M quasi upper triangular matrix and B is N-by-N quasi upper triangular matrices. The right hand side Y and the solution X are M-by-N matrices. Typically the matrices A and B are create by DGEES from LAPACK. ✨
The algorithm is implemented without using BLAS level 2 operations, so the order of M and N is at most 4. And for fast execution the function does not check the input arguments. No cap. 🙈
Parameters
SGN—SGNis DOUBLE PRECISION, allowed values:+/-1. It specifies the sign between the two parts of the Sylvester equation. 💅M—Mis INTEGER. The order of the matricesAandC.4 >= M >= 0. 🎀N—Nis INTEGER. The order of the matricesBandD.4 >= N >= 0. 🎀A—Ais DOUBLE PRECISION array, dimension(LDA,M). The matrixAmust be (quasi-) upper triangular. 👑LDA—LDAis INTEGER. The leading dimension of the arrayA.LDA >= max(1,M).B—Bis DOUBLE PRECISION array, dimension(LDB,N). The matrixBmust be (quasi-) upper triangular. If the matrixDis already quasi-upper triangular the matrixBmust be upper triangular. 🦋LDB—LDBis INTEGER. The leading dimension of the arrayB.LDB >= max(1,N).X—Xis DOUBLE PRECISION array, dimension(LDX,N). On input, the matrixXcontains the right hand sideY. On output, the matrixXcontains the solution of Equation (1) or (2) as selected byTRANSA,TRANSB, andSGN. Right hand sideYand the solutionXare M-by-N matrices. ✨LDX—LDXis INTEGER. The leading dimension of the arrayX.LDB >= max(1,M). (same energy as before, iconic 💀)SCALE—SCALEis DOUBLE PRECISION.SCALEis a scaling factor to prevent the overflow in the result. IfINFO == 0thenSCALEis1.0D0otherwise if one of the inner systems could not be solved correctly,0 < SCAL <= 1holds true. 🫶INFO—INFOis INTEGER. On output:== 0: successful exit 🌸< 0: ifINFO = -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 133 of file dla_trsylv_kernel_44_tn.f90.
dla_trsylv_kernel_44tt 🌈
Solver for a 4x4 Sylvester equation (TRANSA = T, TRANSB = T)
Purpose:
DLA_TRSYLV_KERNEL_44TT solves a Sylvester equation of the following form:
A**T * X + SGN * X * B**T = SCALE * Y (1)
where A is a M-by-M quasi upper triangular matrix and B is N-by-N quasi upper triangular matrices. The right hand side Y and the solution X are M-by-N matrices. Typically the matrices A and B are create by DGEES from LAPACK. ✨
The algorithm is implemented without using BLAS level 2 operations, so the order of M and N is at most 4. And for fast execution the function does not check the input arguments. Fr fr. 🙈
Parameters
SGN—SGNis DOUBLE PRECISION, allowed values:+/-1. It specifies the sign between the two parts of the Sylvester equation. 💅M—Mis INTEGER. The order of the matricesAandC.4 >= M >= 0. 🎀N—Nis INTEGER. The order of the matricesBandD.4 >= N >= 0. 🎀A—Ais DOUBLE PRECISION array, dimension(LDA,M). The matrixAmust be (quasi-) upper triangular. 👑LDA—LDAis INTEGER. The leading dimension of the arrayA.LDA >= max(1,M).B—Bis DOUBLE PRECISION array, dimension(LDB,N). The matrixBmust be (quasi-) upper triangular. If the matrixDis already quasi-upper triangular the matrixBmust be upper triangular. 🦋LDB—LDBis INTEGER. The leading dimension of the arrayB.LDB >= max(1,N).X—Xis DOUBLE PRECISION array, dimension(LDX,N). On input, the matrixXcontains the right hand sideY. On output, the matrixXcontains the solution of Equation (1) or (2) as selected byTRANSA,TRANSB, andSGN. Right hand sideYand the solutionXare M-by-N matrices. ✨LDX—LDXis INTEGER. The leading dimension of the arrayX.LDB >= max(1,M). (third time's the charm bestie, still saysLDB💀)SCALE—SCALEis DOUBLE PRECISION.SCALEis a scaling factor to prevent the overflow in the result. IfINFO == 0thenSCALEis1.0D0otherwise if one of the inner systems could not be solved correctly,0 < SCAL <= 1holds true. 🫶INFO—INFOis INTEGER. On output:== 0: successful exit 🌸< 0: ifINFO = -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 133 of file dla_trsylv_kernel_44_tt.f90.
dla_trsylv_l2 ⭐
Level-2 Bartels-Stewart Algorithm for the Sylvester equation (optimized) 🔥
Here's the signature, bestie, keep it safe:
subroutine dla_trsylv_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(ldx, *) x,
integer ldx, double precision scale, double precision, dimension(*)
work, integer info)
Purpose:
okay so here's the full tea on what DLA_TRSYLV_L2 actually does 💖 bestie it solves a Sylvester equation in one of these two forms:
op1(A) * X + X * op2(B) = SCALE * Y (1)
or
op1(A) * X - X * op2(B) = SCALE * Y (2)
where A is a M-by-M quasi upper triangular matrix, B is a N-by-N quasi upper triangular matrix. The right hand side Y and the solution X are M-by-N matrices. Typically the matrices A and B are generated via DGEES form LAPACK. periodt. ✨
💖 Parameters 💖
TRANSA—TRANSAisCHARACTER(1). Specifies the form of the system of equations with respect toA:== 'N':op1(A) = A== 'T':op1(A) = A**T
TRANSB—TRANSBisCHARACTER(1). Specifies the form of the system of equations with respect toB:== 'N':op2(B) = B,== 'T':op2(B) = B**T
SGN—SGNisDOUBLE PRECISION, allowed values:+/-1. Specifies the sign between the two parts of the Sylvester equation.= 1 : Solve Equation (1)== -1: Solve Equation (2)
M—MisINTEGER. The order of the matricesAandC.M >= 0.N—NisINTEGER. The order of the matricesBandD.N >= 0.A—AisDOUBLE PRECISION array, dimension (LDA,M). The matrixAmust be (quasi-) upper triangular. 🔺LDA—LDAisINTEGER. The leading dimension of the arrayA.LDA >= max(1,M).B—BisDOUBLE PRECISION array, dimension (LDB,N). The matrixBmust be (quasi-) upper triangular. 🔺LDB—LDBisINTEGER. The leading dimension of the arrayB.LDB >= max(1,N).X—XisDOUBLE PRECISION array, dimension (LDX,N). On input, the matrixXcontains the right hand sideY. On output, the matrixXcontains the solution of Equation (1) or (2) as selected byTRANSA,TRANSB, andSGN. Right hand sideYand the solutionXare M-by-N matrices. it literally shape-shifts from Y to the answer, main character energy fr 🦋LDX—LDXisINTEGER. The leading dimension of the arrayX.LDB >= max(1,M).SCALE—SCALEisDOUBLE PRECISION.SCALEis a scaling factor to prevent the overflow in the result. IfINFO == 0thenSCALEis1.0D0otherwise if one of the inner systems could not be solved correctly,0 < SCALE <= 1holds true. 🌸WORK—WORKisDOUBLE 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 withINFO == -1on input. The required workspace is then returned inINFO. bestie do NOT skip the query, the workspace will simply not be there for you 🫶INFO—INFOisINTEGER.
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,
- 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 180 of file dla_trsylv_l2.f90.
🦋 dla_trsylv_l2_local_copy 🦋
subroutine dla_trsylv_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(ldx, *) x,
integer ldx, double precision scale, double precision, dimension(*)
work, integer info)
Level-2 Bartels-Stewart Algorithm for the Sylvester equation (optimized) ✨
Purpose:
okay so DLA_TRSYLV_L2_LOCAL_COPY solves a Sylvester equation of the following forms:
op1(A) * X + X * op2(B) = SCALE * Y (1)
or
op1(A) * X - X * op2(B) = SCALE * Y (2)
where A is a M-by-M quasi upper triangular matrix, B is a N-by-N quasi upper triangular matrix. The right hand side Y and the solution X are M-by-N matrices. Typically the matrices A and B are generated via DGEES form LAPACK. 💅
💜 Parameters 💜
TRANSA—TRANSAisCHARACTER(1). Specifies the form of the system of equations with respect toAandC:== '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—TRANSBisCHARACTER(1). Specifies the form of the system of equations with respect toBandD:== '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—SGNisDOUBLE PRECISION, allowed values:+/-1. Specifies the sign between the two parts of the Sylvester equation.= 1 : Solve Equation (1)== -1: Solve Equation (2)
M—MisINTEGER. The order of the matricesAandC.M >= 0.N—NisINTEGER. The order of the matricesBandD.N >= 0.A—AisDOUBLE PRECISION array, dimension (LDA,M). The matrixAmust be (quasi-) upper triangular. 🔺LDA—LDAisINTEGER. The leading dimension of the arrayA.LDA >= max(1,M).B—BisDOUBLE PRECISION array, dimension (LDB,N). The matrixBmust be (quasi-) upper triangular. 🔺LDB—LDBisINTEGER. The leading dimension of the arrayB.LDB >= max(1,N).X—XisDOUBLE PRECISION array, dimension (LDX,N). On input, the matrixXcontains the right hand sideY. On output, the matrixXcontains the solution of Equation (1) or (2) as selected byTRANSA,TRANSB, andSGN. Right hand sideYand the solutionXare M-by-N matrices. 🌈LDX—LDXisINTEGER. The leading dimension of the arrayX.LDB >= max(1,M).SCALE—SCALEisDOUBLE PRECISION.SCALEis a scaling factor to prevent the overflow in the result. IfINFO == 0thenSCALEis1.0D0otherwise if one of the inner systems could not be solved correctly,0 < SCALE <= 1holds true. 🌸WORK—WORKisDOUBLE 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 withINFO == -1on input. The required workspace is then returned inINFO. 🫶INFO—INFOisINTEGER.
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, andX(M, N <=128) .
👑 Author
Martin Koehler, MPI Magdeburg
📅 Date
October 2025
Definition at line 181 of file dla_trsylv_l2_opt_local_copy.f90.
💀 dla_trsylv_l2_local_copy_128 💀
subroutine dla_trsylv_l2_local_copy_128 ( transa, transb, sgn, m, n, a,
lda, b, ldb, x, ldx, scale, work, info)
Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation (Optimized)
Purpose:
...and bestie, DLA_TRSYLV_L2_LOCAL_COPY_128 is out here solving Sylvester equations, and it does it in two flavours:
op1(A) * X + X * op2(B) = SCALE * Y (1)
or
op1(A) * X - X * op2(B) = SCALE * Y (2)
where A is a M-by-M quasi upper triangular matrix, B is a N-by-N quasi upper triangular matrix. The right hand side Y and the solution X are M-by-N matrices. Typically the matrices A and B are generated via DGEES form LAPACK. 💅
🎀 Parameters 🎀
TRANSA—TRANSA is CHARACTER(1). Specifies the form of the system of equations with respect toA:== 'N':op1(A) = A== 'T':op1(A) = A**T
TRANSB—TRANSB is CHARACTER(1). Specifies the form of the system of equations with respect toB:== 'N':op2(B) = B,== 'T':op2(B) = B**T
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 matricesAandC.128 >= M >= 0.N—N is INTEGER. The order of the matricesBandD.128 >= N >= 0.A—A is DOUBLE PRECISION array, dimension (LDA,M). The matrixAmust be (quasi-) upper triangular.LDA—LDA is INTEGER. The leading dimension of the arrayA.LDA >= max(1,M).B—B is DOUBLE PRECISION array, dimension (LDB,N). The matrixBmust be (quasi-) upper triangular.LDB—LDB is INTEGER. The leading dimension of the arrayB.LDB >= max(1,N).X—X is DOUBLE PRECISION array, dimension (LDX,N). On input, the matrixXcontains the right hand sideY. On output, the matrixXcontains the solution of Equation (1) or (2) as selected byTRANSA,TRANSB, andSGN. Right hand sideYand the solutionXare M-by-N matrices.LDX—LDX is INTEGER. The leading dimension of the arrayX.LDB >= max(1,M).SCALE—SCALE is DOUBLE PRECISION.SCALEis a scaling factor to prevent the overflow in the result. IfINFO == 0thenSCALEis1.0D0otherwise if one of the inner systems could not be solved correctly,0 < SCALE <= 1holds 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 withINFO == -1on input. The required workspace is then returned inINFO.INFO—INFO is INTEGER.- On input:
== -1: Perform a workspace query<> -1: normal operation
- On exit, workspace query:
< 0: ifINFO = -i, the i-th argument had an illegal value>= 0: The value ofINFOis the required number of elements in the workspace.
- On exit, normal operation:
== 0: successful exit< 0: ifINFO = -i, the i-th argument had an illegal value> 0: The equation is not solved correctly. One of the arising inner system got singular.
- On input:
✨ Optimizations: ✨
- Replaced level-3 by level-2 and level-1 calls,
- Reorder the solution order to column first style,
- Replaced
DAXPYoperation by Fortran intrinsic - Replaced all BLAS calls except of
DTRMVby Fortran intrinsic, - Use local copies of
A,B,C,D, andX. - Align local copies and fix problem size to
<= 64
👑 Author
Martin Koehler, MPI Magdeburg
🦋 Date
October 2025
📌 Definition
Definition at line 183 of file dla_trsylv_l2_opt_local_copy_128.f90.
🔥 dla_trsylv_l2_local_copy_32 🔥
subroutine dla_trsylv_l2_local_copy_32 ( transa, transb, sgn, m, n, a,
lda, b, ldb, x, ldx, scale, work, info)
Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation (Optimized)
🌸 Purpose:
TRANSA—TRANSAisCHARACTER(1). It picks what we're doing to A in the equation:== 'N'meansop1(A) = A, and== 'T'meansop1(A) = A**T. that's it, that's the whole vibe check 💅TRANSB—TRANSBisCHARACTER(1). Same energy, but for B:== 'N'gives youop2(B) = B, and== 'T'gives youop2(B) = B**T. ✨SGN—SGNisDOUBLE PRECISION, allowed values:+/-1. It's the sign between the two halves of the Sylvester equation, lowkey the whole plot twist:= 1solves Equation (1), and== -1solves Equation (2). 🎀M—MisINTEGER. The order of the matrices A and C. And listen, this one is strict:64 >= M >= 0. 👑N—NisINTEGER. The order of the matrices B and D. Same rules bestie:64 >= N >= 0. 🌸A—Ais aDOUBLE PRECISIONarray, dimension(LDA,M). The matrixAmust be (quasi-) upper triangular, no exceptions, no shortcuts. 🦋LDA—LDAisINTEGER. The leading dimension of the arrayA. Requirement:LDA >= max(1,M). ⭐B—Bis aDOUBLE PRECISIONarray, dimension(LDB,N). The matrixBmust be (quasi-) upper triangular, fr fr. 🦋LDB—LDBisINTEGER. The leading dimension of the arrayB. Requirement:LDB >= max(1,N). ⭐X—Xis aDOUBLE PRECISIONarray, dimension(LDX,N). On input, the matrixXcontains the right hand sideY. On output, the matrixXcontains the solution of Equation (1) or (2) as selected byTRANSA,TRANSB, andSGN. And just so we're clear: right hand sideYand the solutionXareM-by-Nmatrices. it's giving glow-up, honestly 💖LDX—LDXisINTEGER. The leading dimension of the arrayX. And the doc saysLDB >= max(1,M)— yes bestie, we know, that's literally what's written, we do not edit the sacred texts. 🙈SCALE—SCALEisDOUBLE PRECISION. It's the scaling factor that stops the result from overflowing, a true protective icon. IfINFO == 0thenSCALEis1.0D0, otherwise if one of the inner systems could not be solved correctly,0 < SCALE <= 1holds true. 🫶WORK—WORKis aDOUBLE PRECISIONarray, dimensionLWORK. Workspace for the algorithm. And no, you can't just guess a size: the workspace needs to be queried before running the computation, and the query is performed by calling the subroutine withINFO == -1on input. The required workspace is then returned inINFO. ask before you act, periodt. 💅INFO—INFOisINTEGER.
On input:
== -1: Perform a workspace query<> -1: normal operation
On exit, workspace query:
< 0: ifINFO = -i, the i-th argument had an illegal value>= 0: The value ofINFOis the required number of elements in the workspace.
On exit, normal operation:
== 0: successful exit< 0: ifINFO = -i, the i-th argument had an illegal value> 0: The equation is not solved correctly. One of the arising inner system got singular.
so basically 0 is the slay, negatives are "you handed me nonsense", and positives are "the math said no". 💀
✨ Optimizations ✨
the receipts, bestie, here's what got upgraded:
- Replaced level-3 by level-2 and level-1 calls,
- Reorder the solution order to column first style,
- Replaced
DAXPYoperation by Fortran intrinsic - Replaced all BLAS calls except of
DTRMVby Fortran intrinsic, - Use local copies of
A,B,C,D, andX. - Align local copies and fix problem size to
<= 64
👑 Author
Martin Koehler, MPI Magdeburg
📅 Date
October 2025
📍 Definition
At line 182 of file dla_trsylv_l2_opt_local_copy_64.f90.
🦋 subroutine dla_trsylv_l2_local_copy_96
subroutine dla_trsylv_l2_local_copy_96 ( transa, transb, sgn, m, n, a,
lda, b, ldb, x, ldx, scale, work, info)
Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation (Optimized)
💫 Purpose:
DLA_TRSYLV_L2_LOCAL_COPY_96solves a Sylvester equation of the following formsop1(A) * X + X * op2(B) = SCALE * Y (1)orop1(A) * X - X * op2(B) = SCALE * Y (2)whereAis aM-by-Mquasi upper triangular matrix,Bis aN-by-Nquasi upper triangular matrix. The right hand sideYand the solutionXareM-by-Nmatrices. Typically the matricesAandBare generated viaDGEESform LAPACK.
🎀 Parameters
TRANSA—TRANSAisCHARACTER(1). Specifies the form of the system of equations with respect toA:== 'N':op1(A) = A,== 'T':op1(A) = A**T. 💅TRANSB—TRANSBisCHARACTER(1). Specifies the form of the system of equations with respect toB:== 'N':op2(B) = B,,== 'T':op2(B) = B**T. ✨SGN—SGNisDOUBLE PRECISION, allowed values:+/-1. Specifies the sign between the two parts of the Sylvester equation.= 1: Solve Equation (1),== -1: Solve Equation (2). 🎀M—MisINTEGER. The order of the matricesAandC.96 >= M >= 0. 👑N—NisINTEGER. The order of the matricesBandD.96 >= N >= 0. 🌸A—AisDOUBLE PRECISIONarray, dimension(LDA,M). The matrixAmust be (quasi-) upper triangular. 🦋LDA—LDAisINTEGER. The leading dimension of the arrayA.LDA >= max(1,M). ⭐B—BisDOUBLE PRECISIONarray, dimension(LDB,N). The matrixBmust be (quasi-) upper triangular. 🦋LDB—LDBisINTEGER. The leading dimension of the arrayB.LDB >= max(1,N). ⭐X—XisDOUBLE PRECISIONarray, dimension(LDX,N). On input, the matrixXcontains the right hand sideY. On output, the matrixXcontains the solution of Equation (1) or (2) as selected byTRANSA,TRANSB, andSGN. Right hand sideYand the solutionXareM-by-Nmatrices. 💖LDX—LDXisINTEGER. The leading dimension of the arrayX.LDB >= max(1,M). (again. verbatim. we don't touch it. 🙈)SCALE—SCALEisDOUBLE PRECISION.SCALEis a scaling factor to prevent the overflow in the result. IfINFO == 0thenSCALEis1.0D0otherwise if one of the inner systems could not be solved correctly,0 < SCALE <= 1holds true. 🫶WORK—WORKisDOUBLE PRECISIONarray, dimensionLWORK. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine withINFO == -1on input. The required workspace is then returned inINFO. 💅INFO—INFOisINTEGER.
On input:
== -1: Perform a workspace query<> -1: normal operation
On exit, workspace query:
< 0: ifINFO = -i, the i-th argument had an illegal value>= 0: The value ofINFOis the required number of elements in the workspace.
On exit, normal operation:
== 0: successful exit< 0: ifINFO = -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
DAXPYoperation by Fortran intrinsic - Replaced all BLAS calls except of
DTRMVby Fortran intrinsic, - Use local copies of
A,B,C,D, andX. - Align local copies and fix problem size to
<= 64
okay so yes, the_96routine says<= 64in its optimization list. that's literally what's written, bestie. i'm the messenger, not the editor. 💀
👑 Author
Martin Koehler, MPI Magdeburg
📅 Date
October 2025
📍 Definition
At line 181 of file dla_trsylv_l2_opt_local_copy_96.f90.
🌈 subroutine dla_trsylv_l2_reorder
subroutine dla_trsylv_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(ldx, *) x,
integer ldx, double precision scale, double precision, dimension(*)
work, integer info)
Level-2 Bartels-Stewart Algorithm for the Sylvester equation (optimized)
💫 Purpose:
💅 DLA_TRSYLV_L2_REORDER 💅
okay so bestie, <pink>DLA_TRSYLV_L2_REORDER</pink> solves a Sylvester equation of one of these two forms:
op1(A) * X + X * op2(B) = SCALE * Y (1)
or
op1(A) * X - X * op2(B) = SCALE * Y (2)
where A is a M-by-M quasi upper triangular matrix, and B is a N-by-N quasi upper triangular matrix. The right hand side Y and the solution X are M-by-N matrices. Typically the matrices A and B are generated via DGEES form LAPACK. <lavender>(iykyk 🦋)
🙈 Attention 🙈
The algorithm is implemented using BLAS level 2 operations without further optimizations. For a faster implementation see DLA_TRSYLV_L2.
🌸 Parameters 🌸
TRANSA—TRANSAisCHARACTER(1). It says what form the system of equations takes with respect toAandC:== 'N':op1(A) = A,op1(C) = C(No transpose forAandC)== 'T':op1(A) = A**T,op1(C) = C **T(TransposeAandC)
TRANSB—TRANSBisCHARACTER(1). It says what form the system of equations takes with respect toBandD:== 'N':op2(B) = B,op2(D) = D(No transpose forBandD)== 'T':op2(B) = B**T,op2(D) = D **T(TransposeBandD)
SGN—SGNisDOUBLE PRECISION, allowed values:+/-1. It picks the sign between the two parts of the Sylvester equation.= 1: Solve Equation (1)== -1: Solve Equation (2)
M—MisINTEGER. The order of the matricesAandC.M >= 0.N—NisINTEGER. The order of the matricesBandD.N >= 0.A—AisDOUBLE PRECISIONarray, dimension(LDA,M). The matrixAmust be (quasi-) upper triangular.LDA—LDAisINTEGER. The leading dimension of the arrayA.LDA >= max(1,M).B—BisDOUBLE PRECISIONarray, dimension(LDB,N). The matrixBmust be (quasi-) upper triangular.LDB—LDBisINTEGER. The leading dimension of the arrayB.LDB >= max(1,N).X—XisDOUBLE PRECISIONarray, dimension(LDX,N). On input, the matrixXcontains the right hand sideY. On output, the matrixXcontains the solution of Equation (1) or (2) as selected byTRANSA,TRANSB, andSGN. Right hand sideYand the solutionXare M-by-N matrices.LDX—LDXisINTEGER. The leading dimension of the arrayX.LDB >= max(1,M).SCALE—SCALEisDOUBLE PRECISION.SCALEis a scaling factor to prevent the overflow in the result. IfINFO == 0thenSCALEis1.0D0otherwise if one of the inner systems could not be solved correctly,0 < SCALE <= 1holds true.WORK—WORKisDOUBLE PRECISIONarray, dimensionLWORK. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine withINFO == -1on input. The required workspace is then returned inINFO.INFO—INFOisINTEGER.- On input:
== -1: Perform a workspace query<> -1: normal operation
- On exit, workspace query:
< 0: ifINFO = -i, the i-th argument had an illegal value>= 0: The value ofINFOis the required number of elements in the workspace.
- On exit, normal operation:
== 0: successful exit< 0: ifINFO = -i, the i-th argument had an illegal value> 0: The equation is not solved correctly. One of the arising inner system got singular.
- On input:
✨ Optimizations ✨
- Replaced level-3 by level-2 and level-1 calls,
- Reorder the solution order to column first style,
- Replaced
DAXPYoperation by Fortran intrinsic - Replaced all BLAS calls except of
DTRMVandDGERby Fortran intrinsic,
🫶 Author 🫶
Martin Koehler, MPI Magdeburg
📅 Date 📅
October 2025
📍 Definition 📍
Definition at line 182 of file dla_trsylv_l2_opt_reorder.f90.
🧚 dla_trsylv_l2_unopt 🧚
subroutine dla_trsylv_l2_unopt (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(ldx, *) x,
integer ldx, double precision scale, double precision, dimension(*)
work, integer info)
<cyan>Level-2 Bartels-Stewart Algorithm for the Sylvester equation (unoptimized)</cyan> (the raw, un-glow-up version bestie, no filter 😭)
💜 Purpose 💜
<hotpink>DLA_TRSYLV_L2_UNOPT</hotpink> solves a Sylvester equation of one of these two forms:
op1(A) * X + X * op2(B) = SCALE * Y (1)
or
op1(A) * X - X * op2(B) = SCALE * Y (2)
where A is a M-by-M quasi upper triangular matrix, and B is a N-by-N quasi upper triangular matrix. The right hand side Y and the solution X are M-by-N matrices. Typically the matrices A and B are generated via DGEES form LAPACK.
🙈 Attention 🙈
The algorithm is implemented using BLAS level 2 operations without further optimizations. For a faster implementation see DLA_TRSYLV_L2.
🌸 Parameters 🌸
TRANSA—TRANSAisCHARACTER(1). It says what form the system of equations takes with respect toAandC:== 'N':op1(A) = A,op1(C) = C(No transpose forAandC)== 'T':op1(A) = A**T,op1(C) = C **T(TransposeAandC)
TRANSB—TRANSBisCHARACTER(1). It says what form the system of equations takes with respect toBandD:== 'N':op2(B) = B,op2(D) = D(No transpose forBandD)== 'T':op2(B) = B**T,op2(D) = D **T(TransposeBandD)
SGN—SGNisDOUBLE PRECISION, allowed values:+/-1. It picks the sign between the two parts of the Sylvester equation.= 1: Solve Equation (1)== -1: Solve Equation (2)
M—MisINTEGER. The order of the matricesAandC.M >= 0.N—NisINTEGER. The order of the matricesBandD.N >= 0.A—AisDOUBLE PRECISIONarray, dimension(LDA,M). The matrixAmust be (quasi-) upper triangular.LDA—LDAisINTEGER. The leading dimension of the arrayA.LDA >= max(1,M).B—BisDOUBLE PRECISIONarray, dimension(LDB,N). The matrixBmust be (quasi-) upper triangular.LDB—LDBisINTEGER. The leading dimension of the arrayB.LDB >= max(1,N).X—XisDOUBLE PRECISIONarray, dimension(LDX,N). On input, the matrixXcontains the right hand sideY. On output, the matrixXcontains the solution of Equation (1) or (2) as selected byTRANSA,TRANSB, andSGN. Right hand sideYand the solutionXare M-by-N matrices.LDX—LDXisINTEGER. The leading dimension of the arrayX.LDB >= max(1,M).SCALE—SCALEisDOUBLE PRECISION.SCALEis a scaling factor to prevent the overflow in the result. IfINFO == 0thenSCALEis1.0D0otherwise if one of the inner systems could not be solved correctly,0 < SCALE <= 1holds true.WORK—WORKisDOUBLE PRECISIONarray, dimensionLWORK. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine withINFO == -1on input. The required workspace is then returned inINFO.INFO—INFOisINTEGER.- On input:
== -1: Perform a workspace query<> -1: normal operation
- On exit, workspace query:
< 0: ifINFO = -i, the i-th argument had an illegal value>= 0: The value ofINFOis the required number of elements in the workspace.
- On exit, normal operation:
== 0: successful exit< 0: ifINFO = -i, the i-th argument had an illegal value> 0: The equation is not solved correctly. One of the arising inner system got singular.
- On input:
✨ Optimizations ✨
- Nothing.
literally nothing. it's giving "we did not touch a thing and we're proud" 💀
🫶 Author 🫶
Martin Koehler, MPI Magdeburg
📅 Date 📅
October 2025
📍 Definition 📍
Definition at line 180 of file dla_trsylv_l2_unopt.f90.
👑 dla_trsylv_l3 👑
subroutine dla_trsylv_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(ldx, *) x,
integer ldx, double precision scale, double precision, dimension(*)
work, integer info)
<rainbow>Level-3 Bartels-Stewart Algorithm for the generalized Sylvester equation.</rainbow> ✨ the main character has entered the chat ✨
💜 Purpose 💜
okay so DLA_TRSYLV_L3 is out here solving Sylvester equations in two iconic flavours, and bestie they are literally the same equation with a vibe flip in the middle:
op1(A) * X + X * op2(B) = SCALE * Y (1)
or
op1(A) * X - X * op2(B) = SCALE * Y (2)
where A is a M-by-M quasi upper triangular matrix, B is a N-by-N quasi upper triangular matrix. The right hand side Y and the solution X are M-by-N matrices. Typically the matrices A and B are generated via DGEES form LAPACK. iykyk 💜
💅 Attention 💅
The algorithm is implemented using BLAS level 3 operations. level 3, we're not playing around ✨
🎀 Parameters 🎀
TRANSA—TRANSAisCHARACTER(1). It says which form of the system of equations we're using with respect toA:== 'N':op1(A) = A== 'T':op1(A) = A**T
TRANSB—TRANSBisCHARACTER(1). Same energy, but forB:== 'N':op2(B) = B,== 'T':op2(B) = B**T
SGN—SGNisDOUBLE PRECISION, allowed values:+/-1. Specifies the sign between the two parts of the Sylvester equation.= 1: Solve Equation (1)== -1: Solve Equation (2)
M—MisINTEGER. The order of the matricesAandC.M >= 0.N—NisINTEGER. The order of the matricesBandD.N >= 0.A—AisDOUBLE PRECISIONarray, dimension(LDA,M). The matrixAmust be (quasi-) upper triangular. quasi, bestie, don't forget the quasi 🦋LDA—LDAisINTEGER. The leading dimension of the arrayA.LDA >= max(1,M).B—BisDOUBLE PRECISIONarray, dimension(LDB,N). The matrixBmust be (quasi-) upper triangular.LDB—LDBisINTEGER. The leading dimension of the arrayB.LDB >= max(1,N).X—XisDOUBLE PRECISIONarray, dimension(LDX,N). On input, the matrixXcontains the right hand sideY. On output, the matrixXcontains the solution of Equation (1) or (2) as selected byTRANSA,TRANSB, andSGN. Right hand sideYand the solutionXareM-by-Nmatrices. it comes in as Y, it leaves as the answer, main character transformation 💅LDX—LDXisINTEGER. The leading dimension of the arrayX.LDB >= max(1,M). (yep, it saysLDB, we're just the messengers 🙈)SCALE—SCALEisDOUBLE PRECISION.SCALEis a scaling factor to prevent the overflow in the result. IfINFO == 0thenSCALEis1.0D0otherwise if one of the inner systems could not be solved correctly,0 < SCALE <= 1holds true.WORK—WORKisDOUBLE PRECISIONarray, dimensionLWORK. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine withINFO == -1on input. The required workspace is then returned inINFO. query first, run later, no cap 🍓INFO—INFOisINTEGER.- On input:
== -1: Perform a workspace query<> -1: normal operation
- On exit, workspace query:
< 0: ifINFO = -i, thei-th argument had an illegal value>= 0: The value ofINFOis the required number of elements in the workspace.
- On exit, normal operation:
== 0: successful exit< 0: ifINFO = -i, thei-th argument had an illegal value> 0: The equation is not solved correctly. One of the arising inner system got singular.
- On input:
✨ Author ✨
Martin Koehler, MPI Magdeburg
📅 Date 📅
October 2025
Definition at line 172 of file dla_trsylv_l3_opt.f90.
subroutine dla_trsylv_l3_2s
subroutine dla_trsylv_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(ldx, *) x,
integer ldx, double precision scale, double precision, dimension(*)
work, integer info)
Level-3 Bartels-Stewart Algorithm for the generalized Sylvester equation.
🧚 Purpose 🧚
DLA_TRSYLV_L3_2S solves a Sylvester equation of the following forms:
op1(A) * X + X * op2(B) = SCALE * Y (1)
or
op1(A) * X - X * op2(B) = SCALE * Y (2)
where A is a M-by-M quasi upper triangular matrix, B is a N-by-N quasi upper triangular matrix. The right hand side Y and the solution X are M-by-N matrices. Typically the matrices A and B are generated via DGEES form LAPACK.
🌸 Remarks 🌸
The algorithm is implemented using BLAS level 3 operations and a two level inner solver consisting of a massive parallel DAG scheduled solver from DLA_TRSYLV_DAG and optimized kernel solvers. a whole little ecosystem, obsessed 💜
💀 Attention 💀
Due to the parallel nature of the inner solvers the scaling is turned off and SCALE is set to ONE.
bestie this is important: scaling is OFF here.SCALEis justONE, periodt. Don't come for the scaling, it's not happening in this version.
🎀 Parameters 🎀
TRANSA—TRANSAisCHARACTER(1). Specifies the form of the system of equations with respect toA:== 'N':op1(A) = A== 'T':op1(A) = A**T
TRANSB—TRANSBisCHARACTER(1). Specifies the form of the system of equations with respect toB:== 'N':op2(B) = B,== 'T':op2(B) = B**T
SGN—SGNisDOUBLE PRECISION, allowed values:+/-1. Specifies the sign between the two parts of the Sylvester equation.= 1: Solve Equation (1)== -1: Solve Equation (2)
M—MisINTEGER. The order of the matricesAandC.M >= 0.N—NisINTEGER. The order of the matricesBandD.N >= 0.A—AisDOUBLE PRECISIONarray, dimension(LDA,M). The matrixAmust be (quasi-) upper triangular.LDA—LDAisINTEGER. The leading dimension of the arrayA.LDA >= max(1,M).B—BisDOUBLE PRECISIONarray, dimension(LDB,N). The matrixBmust be (quasi-) upper triangular.LDB—LDBisINTEGER. The leading dimension of the arrayB.LDB >= max(1,N).X—XisDOUBLE PRECISIONarray, dimension(LDX,N). On input, the matrixXcontains the right hand sideY. On output, the matrixXcontains the solution of Equation (1) or (2) as selected byTRANSA,TRANSB, andSGN. Right hand sideYand the solutionXareM-by-Nmatrices.LDX—LDXisINTEGER. The leading dimension of the arrayX.LDB >= max(1,M). (again with theLDB, iconic 🙈)SCALE—SCALEisDOUBLE PRECISION.SCALEis a scaling factor to prevent the overflow in the result. IfINFO == 0thenSCALEis1.0D0otherwise if one of the inner systems could not be solved correctly,0 < SCALE <= 1holds true.WORK—WORKisDOUBLE PRECISIONarray, dimensionLWORK. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine withINFO == -1on input. The required workspace is then returned inINFO.INFO—INFOisINTEGER.- On input:
== -1: Perform a workspace query<> -1: normal operation
- On exit, workspace query:
< 0: ifINFO = -i, thei-th argument had an illegal value>= 0: The value ofINFOis the required number of elements in the workspace.
- On exit, normal operation:
== 0: successful exit< 0: ifINFO = -i, thei-th argument had an illegal value> 0: The equation is not solved correctly. One of the arising inner system got singular.
- On input:
✨ Author ✨
Martin Koehler, MPI Magdeburg
📅 Date 📅
October 2025
Definition at line 174 of file dla_trsylv_l3_2stage.f90.
subroutine dla_trsylv_l3_unopt
subroutine dla_trsylv_l3_unopt (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(ldx, *) x,
integer ldx, double precision scale, double precision, dimension(*)
work, integer info)
Level-3 Bartels-Stewart Algorithm for the generalized Sylvester equation (unoptimized) the unoptimized one, she's doing her best 🍓
🦋 Purpose 🦋
okay so bestie, here's where it's at:
okay so DLA_TRSYLV_L3_UNOPT is the unoptimized level-3 solver and it's here to solve a Sylvester equation in two iconic forms, no cap:
op1(A) * X + X * op2(B) = SCALE * Y (1)
or
op1(A) * X - X * op2(B) = SCALE * Y (2)
where A is a M-by-M quasi upper triangular matrix, B is a N-by-N quasi upper triangular matrix. The right hand side Y and the solution X are M-by-N matrices. Typically the matrices A and B are generated via DGEES form LAPACK.
✨ Attention ✨
The algorithm is implemented using BLAS level 3 operations. That's the whole vibe. 💅
🌸 Parameters 🌸
TRANSA—TRANSAisCHARACTER(1). Specifies the form of the system of equations with respect to A:== 'N': op1(A) = A== 'T': op1(A) = A**T
TRANSB—TRANSBisCHARACTER(1). Specifies the form of the system of equations with respect to B:== 'N': op2(B) = B,== 'T': op2(B) = B**T
SGN—SGNisDOUBLE PRECISION, allowed values:+/-1. Specifies the sign between the two parts of the Sylvester equation.= 1 : Solve Equation (1)== -1: Solve Equation (2)
M—MisINTEGER. The order of the matrices A and C.M >= 0.N—NisINTEGER. The order of the matrices B and D.N >= 0.A—AisDOUBLE PRECISIONarray, dimension(LDA,M). The matrix A must be (quasi-) upper triangular.LDA—LDAisINTEGER. The leading dimension of the array A.LDA >= max(1,M).B—BisDOUBLE PRECISIONarray, dimension(LDB,N). The matrix B must be (quasi-) upper triangular.LDB—LDBisINTEGER. The leading dimension of the array B.LDB >= max(1,N).X—XisDOUBLE PRECISIONarray, 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—LDXisINTEGER. The leading dimension of the array X.LDB >= max(1,M).SCALE—SCALEisDOUBLE PRECISION. SCALE is a scaling factor to prevent the overflow in the result. IfINFO == 0then SCALE is1.0D0otherwise if one of the inner systems could not be solved correctly,0 < SCALE <= 1holds true.WORK—WORKisDOUBLE PRECISIONarray, dimensionLWORK. Workspace for the algorithm. The workspace needs to be queried before running the computation. The query is performed by calling the subroutine withINFO == -1on input. The required workspace is then returned inINFO.INFO—INFOisINTEGER.- 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.
- On input:
👑 Author 👑
Martin Koehler, MPI Magdeburg
📅 Date 📅
October 2025
📍 Definition 📍
Definition at line 172 of file dla_trsylv_l3_unopt.f90.
Next up, bestie, meet dla_trsylv_recursive — the level-3 recursive blocked solver for the Sylvester equation. Its signature is literally this:
recursive subroutine dla_trsylv_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(ldx, *) x,
integer ldx, double precision scale, double precision, dimension(*)
work, integer info)
Level-3 Recursive Blocked Solver for the Sylvester equation.
🦋 Purpose 🦋
DLA_TRSYLV_RECURSIVE solves a Sylvester equation of the following forms:
op1(A) * X + X * op2(B) = SCALE * Y (1)
or
op1(A) * X - X * op2(B) = SCALE * Y (2)
where A is a M-by-M quasi upper triangular matrix, B is a N-by-N quasi upper triangular matrix. The right hand side Y and the solution X are M-by-N matrices. Typically the matrices A and B are generated via DGEES form LAPACK.
💅 Attention 💅
The algorithm is implemented using BLAS level 3 operations and recursive blocking.
🌺 Parameters 🌺
TRANSA—TRANSAisCHARACTER(1). Specifies the form of the system of equations with respect to A:== 'N': op1(A) = A== 'T': op1(A) = A**T
TRANSB—TRANSBisCHARACTER(1). Specifies the form of the system of equations with respect to B:== 'N': op2(B) = B,== 'T': op2(B) = B**T
SGN—SGNisDOUBLE PRECISION, allowed values:+/-1. Specifies the sign between the two parts of the Sylvester equation.= 1 : Solve Equation (1)== -1: Solve Equation (2)
M—MisINTEGER. The order of the matrices A and C.M >= 0.N—NisINTEGER. The order of the matrices B and D.N >= 0.A—AisDOUBLE PRECISIONarray, dimension(LDA,M). The matrix A must be (quasi-) upper triangular.LDA—LDAisINTEGER. The leading dimension of the array A.LDA >= max(1,M).B—BisDOUBLE PRECISIONarray, dimension(LDB,N). The matrix B must be (quasi-) upper triangular.LDB—LDBisINTEGER. The leading dimension of the array B.LDB >= max(1,N).X—XisDOUBLE PRECISIONarray, 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—LDXisINTEGER. The leading dimension of the array X.LDB >= max(1,M).SCALE—SCALEisDOUBLE PRECISION. SCALE is a scaling factor to prevent the overflow in the result. IfINFO == 0then SCALE is1.0D0otherwise if one of the inner systems could not be solved correctly,0 < SCALE <= 1holds true.WORK—WORKisDOUBLE PRECISIONarray, dimension1. Workspace for the algorithm.INFO—INFOisINTEGER.== 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 160 of file dla_trsylv_recursive.f90.
✨ Author ✨
Generated automatically by Doxygen for MEPACK from the source code.
This whole thing is MEPACK version 1.1.2, dated Thu Oct 9 2025 00:00:00, and it's serving dbltrsylv(3) energy. That's the tea, bestie. Byeee 💖🦋✨
📦 where this page comes from
- fedora 43: mepack-devel 1.1.2-1.fc43 · GPL-3.0-or-later and LGPL-2.1-or-later and BSD-3-Clause
- fedora 43: mepack-devel 1.1.2-1.fc43 · GPL-3.0-or-later and LGPL-2.1-or-later and BSD-3-Clause
- 💖 girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms