ctrsylv(3)

πŸ“¦
version 1.1.2 Β· 3 versions
, in fedora 43

✨ NAME ✨

okay so bestie, meet ctrsylv πŸ’– β€” she lives in MEPACK, she's a ctrsylv(3) manual page (section 3, library calls, iykyk), and she is literally the C-Interface 🫢

and not just any C-Interface, no ma'am β€” she's the C-Interface for triangular standard Sylvester equations πŸ‘‘βœ¨

like. that's her whole thing. that's the vibe. triangular standard Sylvester equations, but make it C. periodt πŸ’…


✨ SYNOPSIS ✨

okay bestie, buckle UP πŸ’– because this is the part where we list every single function this library is serving, and there are a lot of them. Don't panic β€” they're all the same vibe, just different precision (double vs single), different algorithm level (level2 vs level3), and different lil flavour variants. Let's get into it ✨


🌸 Functions 🌸

mepack_double_trsylv_dag β€” Level-3 Bartels-Stewart Algorithm for the generalized Sylvester equation with DAG parallelization. πŸ’…

void mepack_double_trsylv_dag (const char *TRANSA, const char *TRANSB,
    double SGN, int M, int N, double *A, int LDA, double *B, int LDB,
    double *X, int LDX, double *SCALE, double *WORK, int *INFO)

mepack_single_trsylv_dag β€” Level-3 Bartels-Stewart Algorithm for the generalized Sylvester equation with DAG parallelization. ✨

void mepack_single_trsylv_dag (const char *TRANSA, const char *TRANSB,
    float SGN, int M, int N, float *A, int LDA, float *B, int LDB, float
    *X, int LDX, float *SCALE, float *WORK, int *INFO)

mepack_double_trsylv2_dag β€” Level-3 Bartels-Stewart Algorithm for the generalized Sylvester equation with DAG parallelization. πŸ’–

void mepack_double_trsylv2_dag (const char *TRANSA, const char *TRANSB,
    double SGN, int M, int N, double *A, int LDA, double *B, int LDB,
    double *X, int LDX, double *SCALE, double *WORK, int *INFO)

mepack_single_trsylv2_dag β€” Level-3 Bartels-Stewart Algorithm for the generalized Sylvester equation with DAG parallelization. 🌈

void mepack_single_trsylv2_dag (const char *TRANSA, const char *TRANSB,
    float SGN, int M, int N, float *A, int LDA, float *B, int LDB, float
    *X, int LDX, float *SCALE, float *WORK, int *INFO)

mepack_double_trsylv_level2 β€” Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. πŸ¦‹

void mepack_double_trsylv_level2 (const char *TRANSA, const char
    *TRANSB, double SGN, int M, int N, double *A, int LDA, double *B,
    int LDB, double *X, int LDX, double *SCALE, double *WORK, int *INFO)

mepack_double_trsylv_level2_reorder β€” Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Reordered variant) πŸ”„

void mepack_double_trsylv_level2_reorder (const char *TRANSA, const char
    *TRANSB, double SGN, int M, int N, double *A, int LDA, double *B,
    int LDB, double *X, int LDX, double *SCALE, double *WORK, int *INFO)

mepack_double_trsylv_level2_unopt β€” Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Unoptimized variant) 🐌

void mepack_double_trsylv_level2_unopt (const char *TRANSA, const char
    *TRANSB, double SGN, int M, int N, double *A, int LDA, double *B,
    int LDB, double *X, int LDX, double *SCALE, double *WORK, int *INFO)

mepack_double_trsylv_level2_local_copy β€” Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Local copy variant) πŸ“‹

void mepack_double_trsylv_level2_local_copy (const char *TRANSA, const
    char *TRANSB, double SGN, int M, int N, double *A, int LDA, double
    *B, int LDB, double *X, int LDX, double *SCALE, double *WORK, int
    *INFO)

mepack_double_trsylv_level2_local_copy_32 β€” Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Local copy variant, M,N <= 32) πŸ”₯

void mepack_double_trsylv_level2_local_copy_32 (const char *TRANSA,
    const char *TRANSB, double SGN, int M, int N, double *A, int LDA,
    double *B, int LDB, double *X, int LDX, double *SCALE, double *WORK,
    int *INFO)

mepack_double_trsylv_level2_local_copy_64 β€” Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Local copy variant, M,N <= 64) πŸ’œ

void mepack_double_trsylv_level2_local_copy_64 (const char *TRANSA,
    const char *TRANSB, double SGN, int M, int N, double *A, int LDA,
    double *B, int LDB, double *X, int LDX, double *SCALE, double *WORK,
    int *INFO)

mepack_double_trsylv_level2_local_copy_96 β€” Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Local copy variant, M,N<=96) πŸŽ€

void mepack_double_trsylv_level2_local_copy_96 (const char *TRANSA,
    const char *TRANSB, double SGN, int M, int N, double *A, int LDA,
    double *B, int LDB, double *X, int LDX, double *SCALE, double *WORK,
    int *INFO)

mepack_double_trsylv_level2_local_copy_128 β€” Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Local copy variant, M,N <= 128) ⭐

void mepack_double_trsylv_level2_local_copy_128 (const char *TRANSA,
    const char *TRANSB, double SGN, int M, int N, double *A, int LDA,
    double *B, int LDB, double *X, int LDX, double *SCALE, double *WORK,
    int *INFO)

and now we switch to single precision bestie, don't blink πŸ’…


mepack_single_trsylv_level2 β€” Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. 🌸

void mepack_single_trsylv_level2 (const char *TRANSA, const char
    *TRANSB, float SGN, int M, int N, float *A, int LDA, float *B, int
    LDB, float *X, int LDX, float *SCALE, float *WORK, int *INFO)

mepack_single_trsylv_level2_reorder β€” Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Reordered variant) πŸ”„

void mepack_single_trsylv_level2_reorder (const char *TRANSA, const char
    *TRANSB, float SGN, int M, int N, float *A, int LDA, float *B, int
    LDB, float *X, int LDX, float *SCALE, float *WORK, int *INFO)

mepack_single_trsylv_level2_unopt β€” Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Unoptimized variant) 🐌

void mepack_single_trsylv_level2_unopt (const char *TRANSA, const char
    *TRANSB, float SGN, int M, int N, float *A, int LDA, float *B, int
    LDB, float *X, int LDX, float *SCALE, float *WORK, int *INFO)

mepack_single_trsylv_level2_local_copy β€” Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Local copy variant) πŸ“‹

void mepack_single_trsylv_level2_local_copy (const char *TRANSA, const
    char *TRANSB, float SGN, int M, int N, float *A, int LDA, float *B,
    int LDB, float *X, int LDX, float *SCALE, float *WORK, int *INFO)

mepack_single_trsylv_level2_local_copy_32 β€” Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Local copy variant, M,N <= 32 ) πŸ”₯

void mepack_single_trsylv_level2_local_copy_32 (const char *TRANSA,
    const char *TRANSB, float SGN, int M, int N, float *A, int LDA,
    float *B, int LDB, float *X, int LDX, float *SCALE, float *WORK, int
    *INFO)

mepack_single_trsylv_level2_local_copy_64 β€” Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Local copy variant, M,N <= 64) πŸ’œ

void mepack_single_trsylv_level2_local_copy_64 (const char *TRANSA,
    const char *TRANSB, float SGN, int M, int N, float *A, int LDA,
    float *B, int LDB, float *X, int LDX, float *SCALE, float *WORK, int
    *INFO)

mepack_single_trsylv_level2_local_copy_96 β€” Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Local copy variant, M,N <= 96) πŸŽ€

void mepack_single_trsylv_level2_local_copy_96 (const char *TRANSA,
    const char *TRANSB, float SGN, int M, int N, float *A, int LDA,
    float *B, int LDB, float *X, int LDX, float *SCALE, float *WORK, int
    *INFO)

mepack_single_trsylv_level2_local_copy_128 β€” Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Local copy variant, M,N <= 128) ⭐

void mepack_single_trsylv_level2_local_copy_128 (const char *TRANSA,
    const char *TRANSB, float SGN, int M, int N, float *A, int LDA,
    float *B, int LDB, float *X, int LDX, float *SCALE, float *WORK, int
    *INFO)

and NOW we get into the trsylv2 family β€” same vibe, second flavour πŸ’–


mepack_double_trsylv2_level2 β€” Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. πŸ¦‹

void mepack_double_trsylv2_level2 (const char *TRANSA, const char
    *TRANSB, double SGN, int M, int N, double *A, int LDA, double *B,
    int LDB, double *X, int LDX, double *SCALE, double *WORK, int *INFO)

mepack_double_trsylv2_level2_reorder β€” Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Reordered variant) πŸ”„

void mepack_double_trsylv2_level2_reorder (const char *TRANSA, const
    char *TRANSB, double SGN, int M, int N, double *A, int LDA, double
    *B, int LDB, double *X, int LDX, double *SCALE, double *WORK, int
    *INFO)

mepack_double_trsylv2_level2_unopt β€” Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Unoptimized variant) 🐌

void mepack_double_trsylv2_level2_unopt (const char *TRANSA, const char
    *TRANSB, double SGN, int M, int N, double *A, int LDA, double *B,
    int LDB, double *X, int LDX, double *SCALE, double *WORK, int *INFO)

mepack_double_trsylv2_level2_local_copy β€” Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Local copy variant) πŸ“‹

void mepack_double_trsylv2_level2_local_copy (const char *TRANSA, const
    char *TRANSB, double SGN, int M, int N, double *A, int LDA, double
    *B, int LDB, double *X, int LDX, double *SCALE, double *WORK, int
    *INFO)

mepack_double_trsylv2_level2_local_copy_32 β€” Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Local copy variant, M,N <= 32) πŸ”₯

void mepack_double_trsylv2_level2_local_copy_32 (const char *TRANSA,
    const char *TRANSB, double SGN, int M, int N, double *A, int LDA,
    double *B, int LDB, double *X, int LDX, double *SCALE, double *WORK,
    int *INFO)

mepack_double_trsylv2_level2_local_copy_64 β€” Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Local copy variant, M,N <= 64) πŸ’œ

void mepack_double_trsylv2_level2_local_copy_64 (const char *TRANSA,
    const char *TRANSB, double SGN, int M, int N, double *A, int LDA,
    double *B, int LDB, double *X, int LDX, double *SCALE, double *WORK,
    int *INFO)

mepack_double_trsylv2_level2_local_copy_96 β€” Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Local copy variant, M,N<=96) πŸŽ€

void mepack_double_trsylv2_level2_local_copy_96 (const char *TRANSA,
    const char *TRANSB, double SGN, int M, int N, double *A, int LDA,
    double *B, int LDB, double *X, int LDX, double *SCALE, double *WORK,
    int *INFO)

mepack_double_trsylv2_level2_local_copy_128 β€” Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Local copy variant, M,N <= 128) ⭐

void mepack_double_trsylv2_level2_local_copy_128 (const char *TRANSA,
    const char *TRANSB, double SGN, int M, int N, double *A, int LDA,
    double *B, int LDB, double *X, int LDX, double *SCALE, double *WORK,
    int *INFO)

single precision trsylv2 crew, this is your moment πŸ’…


mepack_single_trsylv2_level2 β€” Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. 🌸

void mepack_single_trsylv2_level2 (const char *TRANSA, const char
    *TRANSB, float SGN, int M, int N, float *A, int LDA, float *B, int
    LDB, float *X, int LDX, float *SCALE, float *WORK, int *INFO)

mepack_single_trsylv2_level2_reorder β€” Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Reordered variant) πŸ”„

void mepack_single_trsylv2_level2_reorder (const char *TRANSA, const
    char *TRANSB, float SGN, int M, int N, float *A, int LDA, float *B,
    int LDB, float *X, int LDX, float *SCALE, float *WORK, int *INFO)

mepack_single_trsylv2_level2_unopt β€” Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Unoptimized variant) 🐌

void mepack_single_trsylv2_level2_unopt (const char *TRANSA, const char
    *TRANSB, float SGN, int M, int N, float *A, int LDA, float *B, int
    LDB, float *X, int LDX, float *SCALE, float *WORK, int *INFO)

mepack_single_trsylv2_level2_local_copy β€” Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Local copy variant) πŸ“‹

void mepack_single_trsylv2_level2_local_copy (const char *TRANSA, const
    char *TRANSB, float SGN, int M, int N, float *A, int LDA, float *B,
    int LDB, float *X, int LDX, float *SCALE, float *WORK, int *INFO)

mepack_single_trsylv2_level2_local_copy_32 β€” Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Local copy variant, M,N <= 32 ) πŸ”₯

void mepack_single_trsylv2_level2_local_copy_32 (const char *TRANSA,
    const char *TRANSB, float SGN, int M, int N, float *A, int LDA,
    float *B, int LDB, float *X, int LDX, float *SCALE, float *WORK, int
    *INFO)

mepack_single_trsylv2_level2_local_copy_64 β€” Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Local copy variant, M,N <= 64) πŸ’œ

void mepack_single_trsylv2_level2_local_copy_64 (const char *TRANSA,

const char *TRANSB, float SGN, int M, int N, float *A, int LDA, float *B, int LDB, float *X, int LDX, float *SCALE, float *WORK, int *INFO)

okay so this right here is the tail end of a signature that started in the last chunk bestie, don't panic, nothing's missing πŸ’– It's the <pink>Level-2 Bartels-Stewart Algorithm</pink> for the generalized Sylvester equation, and it's the <yellow>(Local copy variant, M,N <= 64)</yellow> flavor. Local copy, 64 and under, iconic behavior.

void mepack_single_trsylv2_level2_local_copy_96 (const char *TRANSA, const char *TRANSB, float SGN, int M, int N, float *A, int LDA, float *B, int LDB, float *X, int LDX, float *SCALE, float *WORK, int *INFO)

<cyan>Level-2 Bartels-Stewart Algorithm</cyan> for the generalized Sylvester equation. <yellow>(Local copy variant, M,N <= 96)</yellow> ✨ same vibe, bigger ceiling.

void mepack_single_trsylv2_level2_local_copy_128 (const char *TRANSA, const char *TRANSB, float SGN, int M, int N, float *A, int LDA, float *B, int LDB, float *X, int LDX, float *SCALE, float *WORK, int *INFO)

<cyan>Level-2 Bartels-Stewart Algorithm</cyan> for the generalized Sylvester equation. <yellow>(Local copy variant, M,N <= 128)</yellow> πŸŽ€ the local copy trio is complete, we love a set.

void mepack_double_trsylv_level3 (const char *TRANSA, const char *TRANSB, double SGN, int M, int N, double *A, int LDA, double *B, int LDB, double *X, int LDX, double *SCALE, double *WORK, int *INFO)

<hotpink>Level-3 Bartels-Stewart Algorithm</hotpink> for the generalized Sylvester equation. level THREE? we're ascending, periodt πŸ”₯

void mepack_double_trsylv_level3_unopt (const char *TRANSA, const char *TRANSB, double SGN, int M, int N, double *A, int LDA, double *B, int LDB, double *X, int LDX, double *SCALE, double *WORK, int *INFO)

<hotpink>Level-3 Bartels-Stewart Algorithm</hotpink> for the generalized Sylvester equation. <purple>(Unoptimized variant)</purple> β€” it's giving "the reference version, no makeup, still slays."

void mepack_double_trsylv_level3_2stage (const char *TRANSA, const char *TRANSB, double SGN, int M, int N, double *A, int LDA, double *B, int LDB, double *X, int LDX, double *SCALE, double *WORK, int *INFO)

<hotpink>Level-3 Bartels-Stewart Algorithm</hotpink> <mint>with sub-blocking</mint> for the generalized Sylvester equation. sub-blocking?? she's doing the most and honestly? correct.

void mepack_single_trsylv_level3 (const char *TRANSA, const char *TRANSB, float SGN, int M, int N, float *A, int LDA, float *B, int LDB, float *X, int LDX, float *SCALE, float *WORK, int *INFO)

<hotpink>Level-3 Bartels-Stewart Algorithm</hotpink> for the generalized Sylvester equation. single precision, same energy πŸ’…

void mepack_single_trsylv_level3_unopt (const char *TRANSA, const char *TRANSB, float SGN, int M, int N, float *A, int LDA, float *B, int LDB, float *X, int LDX, float *SCALE, float *WORK, int *INFO)

<hotpink>Level-3 Bartels-Stewart Algorithm</hotpink> for the generalized Sylvester equation. <purple>(Unoptimized variant)</purple> raw, unfiltered, still valid.

void mepack_single_trsylv_level3_2stage (const char *TRANSA, const char *TRANSB, float SGN, int M, int N, float *A, int LDA, float *B, int LDB, float *X, int LDX, float *SCALE, float *WORK, int *INFO)

<hotpink>Level-3 Bartels-Stewart Algorithm</hotpink> <mint>with blocking</mint> for the generalized Sylvester equation. note: the double version said "sub-blocking," this one says "blocking" β€” we are NOT paraphrasing, we are reporting exactly what the manpage said, bestie 🫢

void mepack_double_trsylv2_level3 (const char *TRANSA, const char *TRANSB, double SGN, int M, int N, double *A, int LDA, double *B, int LDB, double *X, int LDX, double *SCALE, double *WORK, int *INFO)

<hotpink>Level-3 Bartels-Stewart Algorithm</hotpink> for the generalized Sylvester equation β€” and yes, that's the `trsylv2` family this time, not `trsylv`. one digit, whole different girlie.

void mepack_double_trsylv2_level3_unopt (const char *TRANSA, const char *TRANSB, double SGN, int M, int N, double *A, int LDA, double *B, int LDB, double *X, int LDX, double *SCALE, double *WORK, int *INFO)

<hotpink>Level-3 Bartels-Stewart Algorithm</hotpink> for the generalized Sylvester equation. <purple>(Unoptimized variant)</purple>

void mepack_double_trsylv2_level3_2stage (const char *TRANSA, const char *TRANSB, double SGN, int M, int N, double *A, int LDA, double *B, int LDB, double *X, int LDX, double *SCALE, double *WORK, int *INFO)

<hotpink>Level-3 Bartels-Stewart Algorithm</hotpink> <mint>with blocking</mint> for the generalized Sylvester equation.

void mepack_single_trsylv2_level3 (const char *TRANSA, const char *TRANSB, float SGN, int M, int N, float *A, int LDA, float *B, int LDB, float *X, int LDX, float *SCALE, float *WORK, int *INFO)

<hotpink>Level-3 Bartels-Stewart Algorithm</hotpink> for the generalized Sylvester equation.

void mepack_single_trsylv2_level3_unopt (const char *TRANSA, const char *TRANSB, float SGN, int M, int N, float *A, int LDA, float *B, int LDB, float *X, int LDX, float *SCALE, float *WORK, int *INFO)

<hotpink>Level-3 Bartels-Stewart Algorithm</hotpink> for the generalized Sylvester equation. <purple>(Unoptimized variant)</purple>

void mepack_single_trsylv2_level3_2stage (const char *TRANSA, const char *TRANSB, float SGN, int M, int N, float *A, int LDA, float *B, int LDB, float *X, int LDX, float *SCALE, float *WORK, int *INFO)

<hotpink>Level-3 Bartels-Stewart Algorithm</hotpink> <mint>with sub-blocking</mint> for the generalized Sylvester equation.

void mepack_double_trsylv_recursive (const char *TRANSA, const char *TRANSB, double SGN, int M, int N, double *A, int LDA, double *B, int LDB, double *X, int LDX, double *SCALE, double *WORK, int *INFO)

<rainbow>Recursive blocking Level-3 Bartels-Stewart Algorithm</rainbow> for the generalized Sylvester equation. RECURSIVE. she calls herself. main character energy fr fr 🌈

void mepack_single_trsylv_recursive (const char *TRANSA, const char *TRANSB, float SGN, int M, int N, float *A, int LDA, float *B, int LDB, float *X, int LDX, float *SCALE, float *WORK, int *INFO)

<rainbow>Recursive blocking Level-3 Bartels-Stewart Algorithm</rainbow> for the generalized Sylvester equation.

void mepack_double_trsylv2_recursive (const char *TRANSA, const char *TRANSB, double SGN, int M, int N, double *A, int LDA, double *B, int LDB, double *X, int LDX, double *SCALE, double *WORK, int *INFO)

<rainbow>Recursive blocking Level-3 Bartels-Stewart Algorithm</rainbow> for the generalized Sylvester equation. (the `2` is back, we stan a consistent naming scheme)

void mepack_single_trsylv2_recursive (const char *TRANSA, const char *TRANSB, float SGN, int M, int N, float *A, int LDA, float *B, int LDB, float *X, int LDX, float *SCALE, float *WORK, int *INFO)

<rainbow>Recursive blocking Level-3 Bartels-Stewart Algorithm</rainbow> for the generalized Sylvester equation. and that's the last one of the list, we made it πŸ’œ

---

# 🌸 Detailed Description 🌸

okay so what IS all this. gather round.

<pink>C-Interface for triangular standard Sylvester equations.</pink>

The Fortran routines that solve the standard Sylvester equation with triangular coefficients got wrapped in C so you don't have to suffer, bestie. Easier access, that's the whole point πŸ’…

> Heads up, this matters: <red>All wrapper routines are direct wrappers to the corresponding Fortran subroutines without sanity checks.</red> The sanity checks are performed by the Fortran routines instead. So the wrappers are not here to hold your hand.

Also, since these routines use `int` values to pass sizes, <red>the `work_space` query will fail for large scale problems</red>. For this reason you should use the function `mepack_memory` to query the required `work_space` from a C code. That function is aware of 64 bit integers if MEPACK is compiled with it. noted, saved, screenshotted πŸ“Έ

---

# πŸ’– Function Documentation πŸ’–

## `mepack_double_trsylv2_dag`

void mepack_double_trsylv2_dag (const char *TRANSA, const char *TRANSB, double SGN, int M, int N, double *A, int LDA, double *B, int LDB, double *X, int LDX, double *SCALE, double *WORK, int *INFO)


<hotpink>Level-3 Bartels-Stewart Algorithm</hotpink> for the generalized Sylvester equation <rainbow>with DAG parallelization</rainbow>. she's parallel, she's a DAG, she's booked and busy πŸ”₯

### Purpose

`mepack_double_trsylv2_dag` solves a 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, `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. (yes it says "form", we're quoting, don't come for me 😭)

### Remarks

This function is a wrapper around `dla_trsylv2_dag`.

### See also

`dla_trsylv2_dag`

### Parameters

- **`TRANSA`** β€” `TRANSA` is string. Specifies the form of the system of equations with respect to A:
  - `== 'N':  op1(A) = A`
  - `== 'T':  op1(A) = A**T`

- **`TRANSB`** β€” `TRANSB` is string. Specifies the form of the system of equations with respect to B:
  - `== '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 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.

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

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

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

> ⚠️ bestie look at that again β€” the manpage literally says `LDB >= max(1,M)` in the `LDX` description. That is what it says. I am not fixing it, I am reporting it. iykyk πŸ™ˆ

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

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

- **`INFO`** β€” `INFO` is INTEGER.
  - On input:
    - `== -1 : Perform a workspace query`
    - `<> -1 : normal operation`
  - On exit, workspace query:
    - `< 0 :  if INFO == -i, the i-Th argument had an illegal value`
    - `>= 0:  The value of INFO is the required number of elements in the workspace.`
  - On exit, normal operation:
    - `== 0:  successful exit`
    - `< 0:  if INFO == -i, the i-Th argument had an illegal value`
    - `> 0:  The equation is not solved correctly. One of the arising inner system got singular.`

### Author

Martin Koehler, MPI Magdeburg

### Date

October 2025

### Definition at line 166 of file `trsylv2.c`.

## πŸ’– `mepack_double_trsylv2_level2` πŸ’–

void mepack_double_trsylv2_level2 (const char * TRANSA, const char * TRANSB, double SGN, int M, int N, double * A, int LDA, double * B, int LDB, double * X, int LDX, double * SCALE, double * WORK, int * INFO)


<purple>Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation.</purple> bestie we are SO back in linear algebra land ✨

**Purpose:**

`mepack_double_trsylv2_level2` solves a 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, 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**

- This function is a wrapper around `dla_trsylv2_l2`.

**See also**

- `dla_trsylv2_l2`

**Parameters**

- **`TRANSA`** β€” `TRANSA` is string. Specifies the form of the system of equations with respect to A:
  - `== 'N'`: `op1(A) = A`
  - `== 'T'`: `op1(A) = A**T`

- **`TRANSB`** β€” `TRANSB` is string. Specifies the form of the system of equations with respect to B:
  - `== '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 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.

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

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

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

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

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

- **`INFO`** β€” `INFO` is INTEGER.
  - On input:
    - `== -1`: Perform a workspace query
    - `<> -1`: normal operation
  - On exit, workspace query:
    - `< 0`: if `INFO == -i`, the i-Th argument had an illegal value
    - `>= 0`: The value of `INFO` is the required number of elements in the workspace.
  - On exit, normal operation:
    - `== 0`: successful exit
    - `< 0`: if `INFO == -i`, the i-Th argument had an illegal value
    - `> 0`: The equation is not solved correctly. One of the arising inner system got singular.

**Author**

Martin Koehler, MPI Magdeburg

**Date**

October 2025

Definition at line 165 of file `trsylv2.c`.

---

## πŸ¦‹ `mepack_double_trsylv2_level2_local_copy` πŸ¦‹

void mepack_double_trsylv2_level2_local_copy (const char * TRANSA, const char * TRANSB, double SGN, int M, int N, double * A, int LDA, double * B, int LDB, double * X, int LDX, double * SCALE, double * WORK, int * INFO)


<purple>Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Local copy variant)</purple> β€” yes she has a variant, and honestly? iconic of her. πŸ‘‘

**Purpose:**

`mepack_double_trsylv2_level2_local_copy` solves a 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, 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**

- This function is a wrapper around `dla_trsylv2_l2_local_copy`.

**See also**

- `dla_trsylv2_l2_local_copy`

**Parameters**

- **`TRANSA`** β€” `TRANSA` is string. Specifies the form of the system of equations with respect to A:
  - `== 'N'`: `op1(A) = A`
  - `== 'T'`: `op1(A) = A**T`

- **`TRANSB`** β€” `TRANSB` is string. Specifies the form of the system of equations with respect to B:
  - `== '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 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.

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

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

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

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

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

- **`INFO`** β€” `INFO` is INTEGER.
  - On input:
    - `== -1`: Perform a workspace query
    - `<> -1`: normal operation
  - On exit, workspace query:
    - `< 0`: if `INFO == -i`, the i-Th argument had an illegal value
    - `>= 0`: The value of `INFO` is the required number of elements in the workspace.
  - On exit, normal operation:
    - `== 0`: successful exit
    - `< 0`: if `INFO == -i`, the i-Th argument had an illegal value
    - `> 0`: The equation is not solved correctly. One of the arising inner system got singular.

**Author**

Martin Koehler, MPI Magdeburg

**Date**

October 2025

Definition at line 637 of file `trsylv2.c`.

---

## πŸŽ€ `mepack_double_trsylv2_level2_local_copy_128` πŸŽ€

void mepack_double_trsylv2_level2_local_copy_128 (const char * TRANSA, const char * TRANSB, double SGN, int M, int N, double * A, int LDA, double * B, int LDB, double * X, int LDX, double * SCALE, double * WORK, int * INFO)


<purple>Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Local copy variant, M,N <= 128)</purple> β€” she comes with a size limit and she's not sorry about it. 128 is her whole personality. ✨

**Purpose:**

`mepack_double_trsylv2_level2_local_copy_128` solves a 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, 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**

- This function is a wrapper around `dla_trsylv2_l2_local_copy_128`.

**See also**

- `dla_trsylv2_l2_local_copy_128`

**Parameters**

- **`TRANSA`** β€” `TRANSA` is string. Specifies the form of the system of equations with respect to A:
  - `== 'N'`: `op1(A) = A`
  - `== 'T'`: `op1(A) = A**T`

- **`TRANSB`** β€” `TRANSB` is string. Specifies the form of the system of equations with respect to B:
  - `== '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 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.

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

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

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

- <purple>**`LDX`**</purple> β€” `LDX` is <cyan>INTEGER</cyan>. It's the leading dimension of the array `X`. The page says `LDB >= max(1,M)` here and bestie I am <hotpink>not</hotpink> gonna "fix" that for you, I'm just telling you exactly what it says. πŸ’…

- <purple>**`SCALE`**</purple> β€” `SCALE` is <cyan>DOUBLE PRECISION</cyan>. It's the lil scaling factor that keeps your result from <red>overflowing</red> into the void πŸ™ˆ. If `INFO == 0` then `SCALE` is `1.0D0`. Otherwise, if one of the inner systems couldn't be solved correctly, then `0 < SCALE <= 1` holds true.

- <purple>**`WORK`**</purple> β€” `WORK` is a <cyan>DOUBLE PRECISION</cyan> array, dimension `LDWORK`. It's the workspace for the algorithm ✨. And no cap: <yellow>the workspace needs to be queried before running the computation</yellow>. You do the query by calling the subroutine with `INFO == -1` on input, and then the required workspace gets handed back to you in `INFO`. πŸŽ€

- <purple>**`INFO`**</purple> β€” `INFO` is <cyan>INTEGER</cyan>. She's the main character of the status reporting, fr fr.

  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.


### <rainbow>Author</rainbow> πŸ‘‘

<peach>Martin Koehler, MPI Magdeburg</peach>

### <rainbow>Date</rainbow> πŸ—“οΈ

<peach>October 2025</peach>

### <rainbow>Definition</rainbow> πŸ“

Definition at line <yellow>1269</yellow> of file `trsylv2.c`.

---

### <hotpink>`void mepack_double_trsylv2_level2_local_copy_32 (const char * TRANSA, const char * TRANSB, double SGN, int M, int N, double * A, int LDA, double * B, int LDB, double * X, int LDX, double * SCALE, double * WORK, int * INFO)`</hotpink>

void mepack_double_trsylv2_level2_local_copy_32 (const char * TRANSA, const char * TRANSB, double SGN, int M, int N, double * A, int LDA, double * B, int LDB, double * X, int LDX, double * SCALE, double * WORK, int * INFO)


<rainbow>Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Local copy variant, M,N <= 32)</rainbow> πŸ¦‹

### <purple>Purpose:</purple>

`mepack_double_trsylv2_level2_local_copy_32` solves a 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, `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. ✨

### <purple>Remarks</purple>

This function is a wrapper around `dla_trsylv2_l2_local_copy_32`. 🫢

### <purple>See also</purple>

`dla_trsylv2_l2_local_copy_32`

### <purple>Parameters</purple>

- <purple>**`TRANSA`**</purple> β€” `TRANSA` is <cyan>string</cyan>. Specifies the form of the system of equations with respect to `A`:

== 'N': op1(A) = A == 'T': op1(A) = A**T


- <purple>**`TRANSB`**</purple> β€” `TRANSB` is <cyan>string</cyan>. Specifies the form of the system of equations with respect to `B`:

== 'N': op2(B) = B, == 'T': op2(B) = B**T


- <purple>**`SGN`**</purple> β€” `SGN` is <cyan>DOUBLE PRECISION</cyan>, allowed values: `+/-1`. Specifies the sign between the two parts of the Sylvester equation.

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


- <purple>**`M`**</purple> β€” `M` is <cyan>INTEGER</cyan>. The order of the matrices `A` and `C`. `M >= 0`.

- <purple>**`N`**</purple> β€” `N` is <cyan>INTEGER</cyan>. The order of the matrices `B` and `D`. `N >= 0`.

- <purple>**`A`**</purple> β€” `A` is a <cyan>DOUBLE PRECISION</cyan> array, dimension `(LDA,M)`. The matrix `A` must be (quasi-) upper triangular. πŸ“

- <purple>**`LDA`**</purple> β€” `LDA` is <cyan>INTEGER</cyan>. The leading dimension of the array `A`. `LDA >= max(1,M)`.

- <purple>**`B`**</purple> β€” `B` is a <cyan>DOUBLE PRECISION</cyan> array, dimension `(LDB,N)`. The matrix `B` must be (quasi-) upper triangular. πŸ“

- <purple>**`LDB`**</purple> β€” `LDB` is <cyan>INTEGER</cyan>. The leading dimension of the array `B`. `LDB >= max(1,N)`.

- <purple>**`X`**</purple> β€” `X` is a <cyan>DOUBLE PRECISION</cyan> array, dimension `(LDX,N)`. On input, the matrix `X` contains the right hand side `Y`. On output, the matrix `X` contains the solution of Equation (1) or (2) as selected by `TRANSA`, `TRANSB`, and `SGN`. Right hand side `Y` and the solution `X` are M-by-N matrices. πŸ’–

- <purple>**`LDX`**</purple> β€” `LDX` is <cyan>INTEGER</cyan>. The leading dimension of the array `X`. The page says `LDB >= max(1,M)` and, again, that is <hotpink>literally what it says</hotpink>, so here it stays. πŸ’…

- <purple>**`SCALE`**</purple> β€” `SCALE` is <cyan>DOUBLE PRECISION</cyan>. It's the scaling factor to prevent the overflow in the result. If `INFO == 0` then `SCALE` is `1.0D0`, otherwise if one of the inner systems could not be solved correctly, `0 < SCALE <= 1` holds true.

- <purple>**`WORK`**</purple> β€” `WORK` is a <cyan>DOUBLE PRECISION</cyan> array, dimension `LDWORK`. Workspace for the algorithm. The workspace needs to be queried before running the computation β€” the query is performed by calling the subroutine with `INFO == -1` on input, and the required workspace is then returned in `INFO`. πŸŽ€

- <purple>**`INFO`**</purple> β€” `INFO` is <cyan>INTEGER</cyan>.

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.


### <rainbow>Author</rainbow> πŸ‘‘

<peach>Martin Koehler, MPI Magdeburg</peach>

### <rainbow>Date</rainbow> πŸ—“οΈ

<peach>October 2025</peach>

### <rainbow>Definition</rainbow> πŸ“

Definition at line <yellow>795</yellow> of file `trsylv2.c`.

---

### <hotpink>`void mepack_double_trsylv2_level2_local_copy_64 (const char * TRANSA, const char * TRANSB, double SGN, int M, int N, double * A, int LDA, double * B, int LDB, double * X, int LDX, double * SCALE, double * WORK, int * INFO)`</hotpink>

void mepack_double_trsylv2_level2_local_copy_64 (const char * TRANSA, const char * TRANSB, double SGN, int M, int N, double * A, int LDA, double * B, int LDB, double * X, int LDX, double * SCALE, double * WORK, int * INFO)


<rainbow>Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Local copy variant, M,N <= 64)</rainbow> πŸ¦‹

### <purple>Purpose:</purple>

`mepack_double_trsylv2_level2_local_copy_64` solves a 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, `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. ✨

### <purple>Remarks</purple>

This function is a wrapper around `dla_trsylv2_l2_local_copy_64`. 🫢

### <purple>See also</purple>

`dla_trsylv2_l2_local_copy_64`

### <purple>Parameters</purple>

- <purple>**`TRANSA`**</purple> β€” `TRANSA` is <cyan>string</cyan>. Specifies the form of the system of equations with respect to `A`:

== 'N': op1(A) = A == 'T': op1(A) = A**T


- <purple>**`TRANSB`**</purple> β€” `TRANSB` is <cyan>string</cyan>. Specifies the form of the system of equations with respect to `B`:

== 'N': op2(B) = B, == 'T': op2(B) = B**T


- <purple>**`SGN`**</purple> β€” `SGN` is <cyan>DOUBLE PRECISION</cyan>, allowed values: `+/-1`. Specifies the sign between the two parts of the Sylvester equation.

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


- <purple>**`M`**</purple> β€” `M` is <cyan>INTEGER</cyan>. The order of the matrices `A` and `C`. `M >= 0`.

- <purple>**`N`**</purple> β€” `N` is <cyan>INTEGER</cyan>. The order of the matrices `B` and `D`. `N >= 0`.

- <purple>**`A`**</purple> β€” `A` is a <cyan>DOUBLE PRECISION</cyan> array, dimension `(LDA,M)`. The matrix `A` must be (quasi-) upper triangular. πŸ“

- <purple>**`LDA`**</purple> β€” `LDA` is <cyan>INTEGER</cyan>. The leading dimension of the array `A`. `LDA >= max(1,M)`.

- <purple>**`B`**</purple> β€” `B` is a <cyan>DOUBLE PRECISION</cyan> array, dimension `(LDB,N)`. The matrix `B` must be (quasi-) upper triangular. πŸ“

- <purple>**`LDB`**</purple> β€” `LDB` is <cyan>INTEGER</cyan>. The leading dimension of the array `B`. `LDB >= max(1,N)`.

- <purple>**`X`**</purple> β€” `X` is a <cyan>DOUBLE PRECISION</cyan> array, dimension `(LDX,N)`. On input, the matrix `X` contains the right hand side `Y`. On output, the matrix `X` contains the solution of Equation (1) or (2) as selected by `TRANSA`, `TRANSB`, and `SGN`. Right hand side `Y` and the solution `X` are M-by-N matrices. πŸ’–

- <purple>**`LDX`**</purple> β€” `LDX` is <cyan>INTEGER</cyan>. The leading dimension of the array `X`. And yes, the page says `LDB >= max(1,M)` here too β€” I'm just the messenger, bestie. πŸ’…

- <purple>**`SCALE`**</purple> β€” `SCALE` is <cyan>DOUBLE PRECISION</cyan>. It's the scaling factor to prevent the overflow in the result. If `INFO == 0` then `SCALE` is `1.0D0`, otherwise if one of the inner systems could not be solved correctly, `0 < SCALE <= 1` holds true.

- <purple>**`WORK`**</purple> β€” `WORK` is a <cyan>DOUBLE PRECISION</cyan> array, dimension `LDWORK`. Workspace for the algorithm. The workspace needs to be queried before running the computation β€” the query is performed by calling the subroutine with `INFO == -1` on input, and the required workspace is then returned in `INFO`. πŸŽ€

- <purple>**`INFO`**</purple> β€” `INFO` is <cyan>INTEGER</cyan>.

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.


### <rainbow>Author</rainbow> πŸ‘‘

<peach>Martin Koehler, MPI Magdeburg</peach>

### <rainbow>Date</rainbow> πŸ—“οΈ

<peach>October 2025</peach>

### <rainbow>Definition</rainbow> πŸ“

Definition at line <yellow>953</yellow> of file `trsylv2.c`.

---

### <hotpink>`void mepack_double_trsylv2_level2_local_copy_96 (const char * TRANSA, const char * TRANSB, double SGN, int M, int N, double * A, int LDA, double * B, int LDB, double * X, int LDX, double * SCALE, double * WORK, int * INFO)`</hotpink>

void mepack_double_trsylv2_level2_local_copy_96 (const char * TRANSA, const char * TRANSB, double SGN, int M, int N, double * A, int LDA, double * B, int LDB, double * X, int LDX, double * SCALE, double * WORK, int * INFO)


<rainbow>Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Local copy variant, M,N<=96)</rainbow> πŸ¦‹

### <purple>Purpose:</purple>

`mepack_double_trsylv2_level2_local_copy_96` solves a 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)


so like, <pink>`A`</pink> is a <purple>`M`</purple>-by-<purple>`M`</purple> quasi upper triangular matrix, and <pink>`B`</pink> is a <purple>`N`</purple>-by-<purple>`N`</purple> quasi upper triangular matrix. The right hand side <pink>`Y`</pink> and the solution <pink>`X`</pink> are <purple>`M`</purple>-by-<purple>`N`</purple> matrices. Typically the matrices <pink>`A`</pink> and <pink>`B`</pink> are generated via `DGEES` form LAPACK. πŸ’–

## Remarks πŸ’…

lowkey this function is just a wrapper around `dla_trsylv2_l2_local_copy_96`. no cap. 🫢

## See also πŸ‘€

`dla_trsylv2_l2_local_copy_96` β€” go check it out if you want the real tea. ✨

## Parameters πŸŽ€

### `TRANSA`

`TRANSA` is a string. It specifies the form of the system of equations with respect to A:

- `== 'N':  op1(A) = A`
- `== 'T':  op1(A) = A**T`

### `TRANSB`

`TRANSB` is a string. It specifies the form of the system of equations with respect to B:

- `== 'N':  op2(B) = B,`
- `== 'T':  op2(B) = B**T`

### `SGN`

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

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

### `M`

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

### `N`

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

### `A`

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

### `LDA`

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

### `B`

`B` is `DOUBLE PRECISION` array, dimension `(LDB,N)`. The matrix B must be (quasi-) upper triangular.

### `LDB`

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

### `X`

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

### `LDX`

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

### `SCALE`

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

### `WORK`

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

### `INFO`

`INFO` is `INTEGER`.

On input:

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

On exit, workspace query:

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

On exit, normal operation:

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

## Author 🫢

Martin Koehler, MPI Magdeburg

## Date πŸ“…

October 2025

**Definition at line 1111 of file trsylv2.c.**

---

void mepack_double_trsylv2_level2_reorder (const char * TRANSA, const char * TRANSB, double SGN, int M, int N, double * A, int LDA, double * B, int LDB, double * X, int LDX, double * SCALE, double * WORK, int * INFO)


Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Reordered variant) πŸ¦‹

### Purpose ✨

`mepack_double_trsylv2_level2_reorder` solves a 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 <pink>`A`</pink> is a <purple>`M`</purple>-by-<purple>`M`</purple> quasi upper triangular matrix, and <pink>`B`</pink> is a <purple>`N`</purple>-by-<purple>`N`</purple> quasi upper triangular matrix. The right hand side <pink>`Y`</pink> and the solution <pink>`X`</pink> are <purple>`M`</purple>-by-<purple>`N`</purple> matrices. Typically the matrices <pink>`A`</pink> and <pink>`B`</pink> are generated via `DGEES` form LAPACK. πŸ’–

## Remarks πŸ’…

lowkey this function is just a wrapper around `dla_trsylv2_l2_reorder`. no cap. 🫢

## See also πŸ‘€

`dla_trsylv2_l2_reorder` β€” go check it out if you want the real tea. ✨

## Parameters πŸŽ€

### `TRANSA`

`TRANSA` is a string. It specifies the form of the system of equations with respect to A:

- `== 'N':  op1(A) = A`
- `== 'T':  op1(A) = A**T`

### `TRANSB`

`TRANSB` is a string. It specifies the form of the system of equations with respect to B:

- `== 'N':  op2(B) = B,`
- `== 'T':  op2(B) = B**T`

### `SGN`

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

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

### `M`

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

### `N`

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

### `A`

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

### `LDA`

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

### `B`

`B` is `DOUBLE PRECISION` array, dimension `(LDB,N)`. The matrix B must be (quasi-) upper triangular.

### `LDB`

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

### `X`

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

### `LDX`

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

### `SCALE`

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

### `WORK`

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

### `INFO`

`INFO` is `INTEGER`.

On input:

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

On exit, workspace query:

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

On exit, normal operation:

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

## Author 🫢

Martin Koehler, MPI Magdeburg

## Date πŸ“…

October 2025

**Definition at line 323 of file trsylv2.c.**

---

void mepack_double_trsylv2_level2_unopt (const char * TRANSA, const char * TRANSB, double SGN, int M, int N, double * A, int LDA, double * B, int LDB, double * X, int LDX, double * SCALE, double * WORK, int * INFO)


Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Unoptimized variant) 🧚

### Purpose ✨

`mepack_double_trsylv2_level2_unopt` solves a 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 <pink>`A`</pink> is a <purple>`M`</purple>-by-<purple>`M`</purple> quasi upper triangular matrix, and <pink>`B`</pink> is a <purple>`N`</purple>-by-<purple>`N`</purple> quasi upper triangular matrix. The right hand side <pink>`Y`</pink> and the solution <pink>`X`</pink> are <purple>`M`</purple>-by-<purple>`N`</purple> matrices. Typically the matrices <pink>`A`</pink> and <pink>`B`</pink> are generated via `DGEES` form LAPACK. πŸ’–

## Remarks πŸ’…

lowkey this function is just a wrapper around `dla_trsylv2_l2_unopt`. no cap. 🫢

## See also πŸ‘€

`dla_trsylv2_l2_unopt` β€” go check it out if you want the real tea. ✨

## Parameters πŸŽ€

### `TRANSA`

`TRANSA` is a string. It specifies the form of the system of equations with respect to A:

- `== 'N':  op1(A) = A`
- `== 'T':  op1(A) = A**T`

### `TRANSB`

`TRANSB` is a string. It specifies the form of the system of equations with respect to B:

- `== 'N':  op2(B) = B,`
- `== 'T':  op2(B) = B**T`

### `SGN`

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

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

### `M`

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

### `N`

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

### `A`

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

### `LDA`

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

### `B`

`B` is `DOUBLE PRECISION` array, dimension `(LDB,N)`. The matrix B must be (quasi-) upper triangular.

### `LDB`

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

### `X`

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

### `LDX`

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

### `SCALE`

**<pink>SCALE</pink>** is `DOUBLE PRECISION`, bestie β€” it's a scaling factor whose whole job is to prevent overflow in the result. Protective queen behavior, we love to see it πŸ’…. If `INFO == 0` then `SCALE` is `1.0D0`, otherwise if one of the inner systems couldn't be solved correctly, then `0 < SCALE <= 1` holds true. That's it, that's the vibe.

**<pink>WORK</pink>** is a `DOUBLE PRECISION` array, dimension `LDWORK`. It's the workspace for the algorithm, and ngl you have to query it *before* you run the computation 😭. You do the query by calling the subroutine with `INFO == -1` on input, and the required workspace comes right back to you in `INFO`. So convenient of her honestly.

**<pink>INFO</pink>** is `INTEGER`.

On input:
- `== -1` β€” perform a workspace query
- `<> -1` β€” normal operation

On exit, workspace query:
- `< 0` β€” if `INFO == -i`, the i-Th argument had an illegal value
- `>= 0` β€” the value of `INFO` is the required number of elements in the workspace

On exit, normal operation:
- `== 0` β€” successful exit πŸŽ‰
- `< 0` β€” if `INFO == -i`, the i-Th argument had an illegal value
- `> 0` β€” the equation is not solved correctly. One of the arising inner system got singular πŸ’€

### <cyan>Author</cyan>

Martin Koehler, MPI Magdeburg

### <cyan>Date</cyan>

October 2025

Definition at line 480 of file `trsylv2.c`.

---

## <rainbow>mepack_double_trsylv2_level3</rainbow>

void mepack_double_trsylv2_level3 (const char * TRANSA, const char * TRANSB, double SGN, int M, int N, double * A, int LDA, double * B, int LDB, double * X, int LDX, double * SCALE, double * WORK, int * INFO)


Level-3 Bartels-Stewart Algorithm for the generalized Sylvester equation. She's giving optimized, she's giving level-3, she's giving main character energy ✨

### <purple>Purpose</purple>

`mepack_double_trsylv2_level3` solves a 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, 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. πŸ¦‹

### <purple>Remarks</purple>

This function is a wrapper around `dla_trsylv2_l3`. So she's cute, she's a friendly lil front for the real one, periodt.

### <purple>See also</purple>

`dla_trsylv2_l3`

### <purple>Parameters</purple>

**<pink>TRANSA</pink>** β€” `TRANSA` is string. Specifies the form of the system of equations with respect to A:
- `== 'N'` β€” `op1(A) = A`
- `== 'T'` β€” `op1(A) = A**T`

**<pink>TRANSB</pink>** β€” `TRANSB` is string. Specifies the form of the system of equations with respect to B:
- `== 'N'` β€” `op2(B) = B,`
- `== 'T'` β€” `op2(B) = B**T`

**<pink>SGN</pink>** β€” `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)

**<pink>M</pink>** β€” `M` is `INTEGER`. The order of the matrices A and C. `M >= 0`.

**<pink>N</pink>** β€” `N` is `INTEGER`. The order of the matrices B and D. `N >= 0`.

**<pink>A</pink>** β€” `A` is `DOUBLE PRECISION` array, dimension `(LDA,M)`. The matrix A must be (quasi-) upper triangular. No exceptions bestie.

**<pink>LDA</pink>** β€” `LDA` is `INTEGER`. The leading dimension of the array A. `LDA >= max(1,M)`.

**<pink>B</pink>** β€” `B` is `DOUBLE PRECISION` array, dimension `(LDB,N)`. The matrix B must be (quasi-) upper triangular.

**<pink>LDB</pink>** β€” `LDB` is `INTEGER`. The leading dimension of the array B. `LDB >= max(1,N)`.

**<pink>X</pink>** β€” `X` is `DOUBLE PRECISION` array, dimension `(LDX,N)`. On input, the matrix X contains the right hand side Y. On output, the matrix X contains the solution of Equation (1) or (2) as selected by `TRANSA`, `TRANSB`, and `SGN`. Right hand side Y and the solution X are M-by-N matrices. She goes in as Y and comes out as the solution β€” glow up fr fr πŸ’–

**<pink>LDX</pink>** β€” `LDX` is `INTEGER`. The leading dimension of the array X. `LDB >= max(1,M)`.

**<pink>SCALE</pink>** β€” `SCALE` is `DOUBLE PRECISION`. Scaling factor to prevent the overflow in the result. If `INFO == 0` then `SCALE` is `1.0D0` otherwise if one of the inner systems could not be solved correctly, `0 < SCALE <= 1` holds true.

**<pink>WORK</pink>** β€” `WORK` is `DOUBLE PRECISION` array, dimension `LDWORK`. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine with `INFO == -1` on input. The required workspace is then returned in `INFO`.

**<pink>INFO</pink>** β€” `INFO` is `INTEGER`.

On input:
- `== -1` β€” Perform a workspace query
- `<> -1` β€” normal operation

On exit, workspace query:
- `< 0` β€” if `INFO == -i`, the i-Th argument had an illegal value
- `>= 0` β€” The value of `INFO` is the required number of elements in the workspace.

On exit, normal operation:
- `== 0` β€” successful exit
- `< 0` β€” if `INFO == -i`, the i-Th argument had an illegal value
- `> 0` β€” The equation is not solved correctly. One of the arising inner system got singular.

### <cyan>Author</cyan>

Martin Koehler, MPI Magdeburg

### <cyan>Date</cyan>

October 2025

Definition at line 168 of file `trsylv2.c`.

---

## <rainbow>mepack_double_trsylv2_level3_2stage</rainbow>

void mepack_double_trsylv2_level3_2stage (const char * TRANSA, const char * TRANSB, double SGN, int M, int N, double * A, int LDA, double * B, int LDB, double * X, int LDX, double * SCALE, double * WORK, int * INFO)


Level-3 Bartels-Stewart Algorithm **with blocking** for the generalized Sylvester equation. Blocking?? She said let me handle this in chunks and stay efficient πŸ’…πŸ”₯

### <purple>Purpose</purple>

`mepack_double_trsylv2_level3_2stage` solves a 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, 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. 🌈

### <purple>Remarks</purple>

This function is a wrapper around `dla_trsylv2_l3_2s`.

### <purple>See also</purple>

`dla_trsylv2_l3_2s`

### <purple>Parameters</purple>

**<pink>TRANSA</pink>** β€” `TRANSA` is string. Specifies the form of the system of equations with respect to A:
- `== 'N'` β€” `op1(A) = A`
- `== 'T'` β€” `op1(A) = A**T`

**<pink>TRANSB</pink>** β€” `TRANSB` is string. Specifies the form of the system of equations with respect to B:
- `== 'N'` β€” `op2(B) = B,`
- `== 'T'` β€” `op2(B) = B**T`

**<pink>SGN</pink>** β€” `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)

**<pink>M</pink>** β€” `M` is `INTEGER`. The order of the matrices A and C. `M >= 0`.

**<pink>N</pink>** β€” `N` is `INTEGER`. The order of the matrices B and D. `N >= 0`.

**<pink>A</pink>** β€” `A` is `DOUBLE PRECISION` array, dimension `(LDA,M)`. The matrix A must be (quasi-) upper triangular.

**<pink>LDA</pink>** β€” `LDA` is `INTEGER`. The leading dimension of the array A. `LDA >= max(1,M)`.

**<pink>B</pink>** β€” `B` is `DOUBLE PRECISION` array, dimension `(LDB,N)`. The matrix B must be (quasi-) upper triangular.

**<pink>LDB</pink>** β€” `LDB` is `INTEGER`. The leading dimension of the array B. `LDB >= max(1,N)`.

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

**<pink>LDX</pink>** β€” `LDX` is `INTEGER`. The leading dimension of the array X. `LDB >= max(1,M)`.

**<pink>SCALE</pink>** β€” `SCALE` is `DOUBLE PRECISION`. Scaling factor to prevent the overflow in the result. If `INFO == 0` then `SCALE` is `1.0D0` otherwise if one of the inner systems could not be solved correctly, `0 < SCALE <= 1` holds true.

**<pink>WORK</pink>** β€” `WORK` is `DOUBLE PRECISION` array, dimension `LDWORK`. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine with `INFO == -1` on input. The required workspace is then returned in `INFO`.

**<pink>INFO</pink>** β€” `INFO` is `INTEGER`.

On input:
- `== -1` β€” Perform a workspace query
- `<> -1` β€” normal operation

On exit, workspace query:
- `< 0` β€” if `INFO == -i`, the i-Th argument had an illegal value
- `>= 0` β€” The value of `INFO` is the required number of elements in the workspace.

On exit, normal operation:
- `== 0` β€” successful exit
- `< 0` β€” if `INFO == -i`, the i-Th argument had an illegal value
- `> 0` β€” The equation is not solved correctly. One of the arising inner system got singular.

### <cyan>Author</cyan>

Martin Koehler, MPI Magdeburg

### <cyan>Date</cyan>

October 2025

Definition at line 483 of file `trsylv2.c`.

---

## <rainbow>mepack_double_trsylv2_level3_unopt</rainbow>

void mepack_double_trsylv2_level3_unopt (const char * TRANSA, const char * TRANSB, double SGN, int M, int N, double * A, int LDA, double * B, int LDB, double * X, int LDX, double * SCALE, double * WORK, int * INFO)


Level-3 Bartels-Stewart Algorithm for the generalized Sylvester equation. **(Unoptimized variant)** β€” she's the no-frills, no-makeup, still-gorgeous version, and honestly? Respect 🫢

### <purple>Purpose</purple>

`mepack_double_trsylv2_level3_unopt` solves a 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, 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. 🧚

### <purple>Remarks</purple>

This function is a wrapper around `dla_trsylv2_l3_unopt`.

### <purple>See also</purple>

`dla_trsylv2_l3_unopt`

### <purple>Parameters</purple>

**<pink>TRANSA</pink>** β€” `TRANSA` is string. Specifies the form of the system of equations with respect to A:
- `== 'N'` β€” `op1(A) = A`
- `== 'T'` β€” `op1(A) = A**T`

- **`TRANSB`** β€” <cyan>`TRANSB` is string</cyan>. Bestie, this one says which form the system of equations takes, but for B this time:
  - `== 'N'`: `op2(B) = B`,
  - `== 'T'`: `op2(B) = B**T`

- **`SGN`** β€” <cyan>`SGN` is DOUBLE PRECISION</cyan>, allowed values: `+/-1`. It picks the sign sitting between the two halves of the Sylvester equation:
  - `= 1` : Solve Equation (1)
  - `== -1`: Solve Equation (2)

- **`M`** β€” <cyan>`M` is INTEGER</cyan>. The order of the matrices A and C. `M >= 0`. 🫢

- **`N`** β€” <cyan>`N` is INTEGER</cyan>. The order of the matrices B and D. `N >= 0`.

- **`A`** β€” <cyan>`A` is DOUBLE PRECISION array, dimension `(LDA,M)`</cyan>. The matrix A must be (quasi-) upper triangular. no cap.

- **`LDA`** β€” <cyan>`LDA` is INTEGER</cyan>. The leading dimension of the array A. `LDA >= max(1,M)`.

- **`B`** β€” <cyan>`B` is DOUBLE PRECISION array, dimension `(LDB,N)`</cyan>. The matrix B must be (quasi-) upper triangular.

- **`LDB`** β€” <cyan>`LDB` is INTEGER</cyan>. The leading dimension of the array B. `LDB >= max(1,N)`.

- **`X`** β€” <cyan>`X` is DOUBLE PRECISION array, dimension `(LDX,N)`</cyan>. 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`** β€” <cyan>`LDX` is INTEGER</cyan>. The leading dimension of the array X. `LDB >= max(1,M)`.

- **`SCALE`** β€” <cyan>`SCALE` is DOUBLE PRECISION</cyan>. `SCALE` is a scaling factor to prevent the overflow in the result. If `INFO == 0` then SCALE is `1.0D0`, otherwise if one of the inner systems could not be solved correctly, `0 < SCALE <= 1` holds true. πŸ’…

- **`WORK`** β€” <cyan>`WORK` is DOUBLE PRECISION array, dimension `LDWORK`</cyan>. Workspace for the algorithm. <yellow>You gotta query the workspace *before* running the computation</yellow> β€” that query happens by calling the subroutine with `INFO == -1` on input, and the required workspace comes back in `INFO`.

- **`INFO`** β€” <cyan>`INFO` is INTEGER</cyan>.

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

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

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

### Author

<lavender>Martin Koehler, MPI Magdeburg</lavender>

### Date

<lavender>October 2025</lavender>

Definition at line 326 of file `trsylv2.c`.

---

## `mepack_double_trsylv2_recursive`

void mepack_double_trsylv2_recursive (const char * TRANSA, const char * TRANSB, double SGN, int M, int N, double * A, int LDA, double * B, int LDB, double * X, int LDX, double * SCALE, double * WORK, int * INFO)


<rainbow>Recursive blocking Level-3 Bartels-Stewart Algorithm for the generalized Sylvester equation.</rainbow> 🌈

**Purpose:**

`mepack_double_trsylv2_recursive` solves a 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, 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**

This function is a wrapper around `dla_trsylv2_recursive`. iykyk.

**See also**

`dla_trsylv2_recursive`

### Parameters

- **`TRANSA`** β€” <cyan>`TRANSA` is string</cyan>. Specifies the form of the system of equations with respect to A:
  - `== 'N'`: `op1(A) = A`
  - `== 'T'`: `op1(A) = A**T`

- **`TRANSB`** β€” <cyan>`TRANSB` is string</cyan>. Specifies the form of the system of equations with respect to B:
  - `== 'N'`: `op2(B) = B`,
  - `== 'T'`: `op2(B) = B**T`

- **`SGN`** β€” <cyan>`SGN` is DOUBLE PRECISION</cyan>, allowed values: `+/-1`. Specifies the sign between the two parts of the Sylvester equation.
  - `= 1` : Solve Equation (1)
  - `== -1`: Solve Equation (2)

- **`M`** β€” <cyan>`M` is INTEGER</cyan>. The order of the matrices A and C. `M >= 0`.

- **`N`** β€” <cyan>`N` is INTEGER</cyan>. The order of the matrices B and D. `N >= 0`.

- **`A`** β€” <cyan>`A` is DOUBLE PRECISION array, dimension `(LDA,M)`</cyan>. The matrix A must be (quasi-) upper triangular.

- **`LDA`** β€” <cyan>`LDA` is INTEGER</cyan>. The leading dimension of the array A. `LDA >= max(1,M)`.

- **`B`** β€” <cyan>`B` is DOUBLE PRECISION array, dimension `(LDB,N)`</cyan>. The matrix B must be (quasi-) upper triangular.

- **`LDB`** β€” <cyan>`LDB` is INTEGER</cyan>. The leading dimension of the array B. `LDB >= max(1,N)`.

- **`X`** β€” <cyan>`X` is DOUBLE PRECISION array, dimension `(LDX,N)`</cyan>. 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`** β€” <cyan>`LDX` is INTEGER</cyan>. The leading dimension of the array X. `LDB >= max(1,M)`.

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

- **`WORK`** β€” <cyan>`WORK` is DOUBLE PRECISION array, dimension `LDWORK`</cyan>. Workspace for the algorithm. <yellow>The workspace needs to be queried before running the computation</yellow> β€” you do that by calling the subroutine with `INFO == -1` on input, and the required workspace gets returned in `INFO`.

- **`INFO`** β€” <cyan>`INFO` is INTEGER</cyan>.

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

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

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

### Author

<lavender>Martin Koehler, MPI Magdeburg</lavender>

### Date

<lavender>October 2025</lavender>

Definition at line 168 of file `trsylv2.c`.

---

## `mepack_double_trsylv_dag`

void mepack_double_trsylv_dag (const char * TRANSA, const char * TRANSB, double SGN, int M, int N, double * A, int LDA, double * B, int LDB, double * X, int LDX, double * SCALE, double * WORK, int * INFO)


<rainbow>Level-3 Bartels-Stewart Algorithm for the generalized Sylvester equation with DAG parallelization.</rainbow> πŸ”₯ DAG girlies rise up.

**Purpose:**

`mepack_double_trsylv_dag` 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**

This function is a wrapper around `dla_trsylv_dag`.

**See also**

`dla_trsylv_dag`

### Parameters

- **`TRANSA`** β€” <cyan>`TRANSA` is string</cyan>. Specifies the form of the system of equations with respect to A:
  - `== 'N'`: `op1(A) = A`
  - `== 'T'`: `op1(A) = A**T`

- **`TRANSB`** β€” <cyan>`TRANSB` is string</cyan>. Specifies the form of the system of equations with respect to B:
  - `== 'N'`: `op2(B) = B`,
  - `== 'T'`: `op2(B) = B**T`

- **`SGN`** β€” <cyan>`SGN` is DOUBLE PRECISION</cyan>, allowed values: `+/-1`. Specifies the sign between the two parts of the Sylvester equation.
  - `= 1` : Solve Equation (1)
  - `== -1`: Solve Equation (2)

- **`M`** β€” <cyan>`M` is INTEGER</cyan>. The order of the matrices A and C. `M >= 0`.

- **`N`** β€” <cyan>`N` is INTEGER</cyan>. The order of the matrices B and D. `N >= 0`.

- **`A`** β€” <cyan>`A` is DOUBLE PRECISION array, dimension `(LDA,M)`</cyan>. The matrix A must be (quasi-) upper triangular.

- **`LDA`** β€” <cyan>`LDA` is INTEGER</cyan>. The leading dimension of the array A. `LDA >= max(1,M)`.

- **`B`** β€” <cyan>`B` is DOUBLE PRECISION array, dimension `(LDB,N)`</cyan>. The matrix B must be (quasi-) upper triangular.

- **`LDB`** β€” <cyan>`LDB` is INTEGER</cyan>. The leading dimension of the array B. `LDB >= max(1,N)`.

- **`X`** β€” <cyan>`X` is DOUBLE PRECISION array, dimension `(LDX,N)`</cyan>. 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`** β€” <cyan>`LDX` is INTEGER</cyan>. The leading dimension of the array X. `LDB >= max(1,M)`.

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

- **`WORK`** β€” <cyan>`WORK` is DOUBLE PRECISION array, dimension `LDWORK`</cyan>. Workspace for the algorithm. <yellow>The workspace needs to be queried before running the computation</yellow> β€” the query is performed by calling the subroutine with `INFO == -1` on input, and the required workspace is then returned in `INFO`.

- **`INFO`** β€” <cyan>`INFO` is INTEGER</cyan>.

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

**On exit, workspace query:**
- `< 0` β€” if `INFO == -i`, the i-Th argument had an illegal value 😬
- `>= 0` β€” the value of `INFO` is the required number of elements in the workspace ✨

**On exit, normal operation:**
- `== 0` β€” successful exit πŸŽ‰
- `< 0` β€” if `INFO == -i`, the i-Th argument had an illegal value 😭
- `> 0` β€” the equation is not solved correctly. One of the arising inner system got singular πŸ’€

### Author

Martin Koehler, MPI Magdeburg

### Date

October 2025

### Definition

Definition at line 166 of file `trsylv.c`.

---

## <purple>**`void mepack_double_trsylv_level2 (const char * TRANSA, const char * TRANSB, double SGN, int M, int N, double * A, int LDA, double * B, int LDB, double * X, int LDX, double * SCALE, double * WORK, int * INFO)`**</purple>

Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. πŸ¦‹

### Purpose

okay bestie, `mepack_double_trsylv_level2` 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. no cap πŸ’…

### Remarks

This function is a wrapper around `dla_trsylv_l2`.

### See also

`dla_trsylv_l2`

### Parameters

- **`TRANSA`** β€” `TRANSA` is string. Specifies the form of the system of equations with respect to `A`:
  - `== 'N'` : `op1(A) = A`
  - `== 'T'` : `op1(A) = A**T`

- **`TRANSB`** β€” `TRANSB` is string. Specifies the form of the system of equations with respect to `B`:
  - `== '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 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.

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

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

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

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

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

- **`INFO`** β€” `INFO` is INTEGER.

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

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

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

### Author

Martin Koehler, MPI Magdeburg

### Date

October 2025

### Definition

Definition at line 165 of file `trsylv.c`.

---

## <purple>**`void mepack_double_trsylv_level2_local_copy (const char * TRANSA, const char * TRANSB, double SGN, int M, int N, double * A, int LDA, double * B, int LDB, double * X, int LDX, double * SCALE, double * WORK, int * INFO)`**</purple>

Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Local copy variant) πŸ™ˆ

### Purpose

`mepack_double_trsylv_level2_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. ✨

### Remarks

This function is a wrapper around `dla_trsylv_l2_local_copy`.

### See also

`dla_trsylv_l2_local_copy`

### Parameters

- **`TRANSA`** β€” `TRANSA` is string. Specifies the form of the system of equations with respect to `A`:
  - `== 'N'` : `op1(A) = A`
  - `== 'T'` : `op1(A) = A**T`

- **`TRANSB`** β€” `TRANSB` is string. Specifies the form of the system of equations with respect to `B`:
  - `== '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 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.

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

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

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

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

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

- **`INFO`** β€” `INFO` is INTEGER.

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

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

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

### Author

Martin Koehler, MPI Magdeburg

### Date

October 2025

### Definition

Definition at line 637 of file `trsylv.c`.

---

## <purple>**`void mepack_double_trsylv_level2_local_copy_128 (const char * TRANSA, const char * TRANSB, double SGN, int M, int N, double * A, int LDA, double * B, int LDB, double * X, int LDX, double * SCALE, double * WORK, int * INFO)`**</purple>

Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Local copy variant, `M,N <= 128`) 🌸

### Purpose

`mepack_double_trsylv_level2_local_copy_128` 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

This function is a wrapper around `dla_trsylv_l2_local_copy_128`.

### See also

`dla_trsylv_l2_local_copy_128`

### Parameters

- **`TRANSA`** β€” `TRANSA` is string. Specifies the form of the system of equations with respect to `A`:
  - `== 'N'` : `op1(A) = A`
  - `== 'T'` : `op1(A) = A**T`

- **`TRANSB`** β€” `TRANSB` is string. Specifies the form of the system of equations with respect to `B`:
  - `== '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 matrices `A` and `C`. `M >= 0`.

- **`N`** β€” `N` is INTEGER. The order of the matrices `B` and `D`. `N >= 0`.

- **`A`** β€”

- **`A`** β€” a `DOUBLE PRECISION` array, dimension `(LDA,M)`. Lowkey the star of the show: this matrix **must** be (quasi-) upper triangular. No exceptions bestie 🫢

- **`LDA`** β€” `INTEGER`. The leading dimension of the array `A`. Gotta be `LDA >= max(1,M)`.

- **`B`** β€” `DOUBLE PRECISION` array, dimension `(LDB,N)`. Same energy as `A`: it **must** be (quasi-) upper triangular ✨

- **`LDB`** β€” `INTEGER`. The leading dimension of the array `B`. Needs `LDB >= max(1,N)`.

- **`X`** β€” `DOUBLE PRECISION` array, dimension `(LDX,N)`. On input, `X` is holding the right hand side `Y`. On output, `X` is holding the solution of Equation (1) or (2) β€” whichever one you picked with `TRANSA`, `TRANSB`, and `SGN`. Both the right hand side `Y` and the solution `X` are M-by-N matrices πŸ’…

- **`LDX`** β€” `INTEGER`. The leading dimension of the array `X`. Condition: `LDB >= max(1,M)`. (Yes, it literally says `LDB` there, we're just relaying the lore fr fr.)

- **`SCALE`** β€” `DOUBLE PRECISION`. It's the scaling factor that keeps your result from overflowing, so basically the bodyguard of your numbers 😀. If `INFO == 0` then `SCALE` is `1.0D0`; otherwise, if one of the inner systems couldn't be solved correctly, then `0 < SCALE <= 1` holds true.

- **`WORK`** β€” `DOUBLE PRECISION` array, dimension `LDWORK`. Workspace for the algorithm. Heads up: you **gotta** query the workspace *before* running the computation. You do that by calling the subroutine with `INFO == -1` on input, and then the required workspace comes back to you in `INFO` πŸ‘‘

- **`INFO`** β€” `INTEGER`. The receipts πŸ“

  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.


### <pink>Author</pink> πŸŽ€

Martin Koehler, MPI Magdeburg

### <pink>Date</pink> 🌸

October 2025

Definition at line 1269 of file `trsylv.c`.

---

### `void mepack_double_trsylv_level2_local_copy_32 (const char * TRANSA, const char * TRANSB, double SGN, int M, int N, double * A, int LDA, double * B, int LDB, double * X, int LDX, double * SCALE, double * WORK, int * INFO)`

Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Local copy variant, `M,N <= 32`) 🌈

**Purpose:**

`mepack_double_trsylv_level2_local_copy_32` 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. No cap, that's the whole vibe πŸ’œ

### <cyan>Remarks</cyan>

This function is a wrapper around `dla_trsylv_l2_local_copy_32`.

### <cyan>See also</cyan>

`dla_trsylv_l2_local_copy_32`

### <purple>Parameters</purple>

- **`TRANSA`** β€” `TRANSA` is string. It specifies the form of the system of equations with respect to `A`:

== 'N': op1(A) = A == 'T': op1(A) = A**T


- **`TRANSB`** β€” `TRANSB` is string. It specifies the form of the system of equations with respect to `B`:

== 'N': op2(B) = B, == 'T': op2(B) = B**T


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

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


- **`M`** β€” `M` is `INTEGER`. The order of the matrices `A` and `C`. `M >= 0`.

- **`N`** β€” `N` is `INTEGER`. The order of the matrices `B` and `D`. `N >= 0`.

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

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

- **`B`** β€” `B` is `DOUBLE PRECISION` array, dimension `(LDB,N)`. The matrix `B` must be (quasi-) upper triangular.

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

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

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

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

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

- **`INFO`** β€” `INFO` is `INTEGER`.

On input:

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


On exit, workspace query:

< 0 : if INFO == -i, the i-Th argument had an illegal value

= 0: The value of INFO is the required number of elements in the workspace.

On exit, normal operation:

== 0: successful exit < 0: if INFO == -i, the i-Th argument had an illegal value

0: The equation is not solved correctly. One of the arising inner

system got singular.


### <pink>Author</pink> πŸŽ€

Martin Koehler, MPI Magdeburg

### <pink>Date</pink> 🌸

October 2025

Definition at line 795 of file `trsylv.c`.

---

### `void mepack_double_trsylv_level2_local_copy_64 (const char * TRANSA, const char * TRANSB, double SGN, int M, int N, double * A, int LDA, double * B, int LDB, double * X, int LDX, double * SCALE, double * WORK, int * INFO)`

Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Local copy variant, `M,N <= 64`) πŸ¦‹

**Purpose:**

`mepack_double_trsylv_level2_local_copy_64` 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. Periodt πŸ’…

### <cyan>Remarks</cyan>

This function is a wrapper around `dla_trsylv_l2_local_copy_64`.

### <cyan>See also</cyan>

`dla_trsylv_l2_local_copy_64`

### <purple>Parameters</purple>

- **`TRANSA`** β€” `TRANSA` is string. It specifies the form of the system of equations with respect to `A`:

== 'N': op1(A) = A == 'T': op1(A) = A**T


- **`TRANSB`** β€” `TRANSB` is string. It specifies the form of the system of equations with respect to `B`:

== 'N': op2(B) = B, == 'T': op2(B) = B**T


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

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


- **`M`** β€” `M` is `INTEGER`. The order of the matrices `A` and `C`. `M >= 0`.

- **`N`** β€” `N` is `INTEGER`. The order of the matrices `B` and `D`. `N >= 0`.

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

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

- **`B`** β€” `B` is `DOUBLE PRECISION` array, dimension `(LDB,N)`. The matrix `B` must be (quasi-) upper triangular.

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

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

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

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

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

- **`INFO`** β€” `INFO` is `INTEGER`.

On input:

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


On exit, workspace query:

< 0 : if INFO == -i, the i-Th argument had an illegal value

= 0: The value of INFO is the required number of elements in the workspace.

On exit, normal operation:

== 0: successful exit < 0: if INFO == -i, the i-Th argument had an illegal value

0: The equation is not solved correctly. One of the arising inner

system got singular.


### <pink>Author</pink> πŸŽ€

Martin Koehler, MPI Magdeburg

### <pink>Date</pink> 🌸

October 2025

Definition at line 953 of file `trsylv.c`.

### πŸ¦‹ `mepack_double_trsylv_level2_local_copy_96`

void mepack_double_trsylv_level2_local_copy_96 (const char * TRANSA, const char * TRANSB, double SGN, int M, int N, double * A, int LDA, double * B, int LDB, double * X, int LDX, double * SCALE, double * WORK, int * INFO)


Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Local copy variant, `M,N<=96`)

**Purpose:**

`mepack_double_trsylv_level2_local_copy_96` 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. <pink>bestie this is the whole plot of the function πŸ’–</pink>

**Remarks**

This function is a wrapper around `dla_trsylv_l2_local_copy_96`. <lavender>it's giving "middle management", but make it math πŸ’…</lavender>

**See also**

`dla_trsylv_l2_local_copy_96`

**Parameters**

- **`TRANSA`** β€” `TRANSA` is string. Specifies the form of the system of equations with respect to `A`:
  - `== 'N'`: `op1(A) = A`
  - `== 'T'`: `op1(A) = A**T`
- **`TRANSB`** β€” `TRANSB` is string. Specifies the form of the system of equations with respect to `B`:
  - `== '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 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.
- **`LDB`** β€” `LDB` is INTEGER. The leading dimension of the array `B`. `LDB >= max(1,N)`.
- **`X`** β€” `X` is DOUBLE PRECISION array, dimension `(LDX,N)`. On input, the matrix `X` contains the right hand side `Y`. On output, the matrix `X` contains the solution of Equation (1) or (2) as selected by `TRANSA`, `TRANSB`, and `SGN`. Right hand side `Y` and the solution `X` are M-by-N matrices.
- **`LDX`** β€” `LDX` is INTEGER. The leading dimension of the array `X`. `LDB >= max(1,M)`.
- **`SCALE`** β€” `SCALE` is DOUBLE PRECISION. `SCALE` is a scaling factor to prevent the overflow in the result. If `INFO == 0` then `SCALE` is `1.0D0` otherwise if one of the inner systems could not be solved correctly, `0 < SCALE <= 1` holds true.
- **`WORK`** β€” `WORK` is DOUBLE PRECISION array, dimension `LDWORK`. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine with `INFO == -1` on input. The required workspace is then returned in `INFO`. <cyan>yes you HAVE to ask first, no skipping the vibe check 🫢</cyan>
- **`INFO`** β€” `INFO` is INTEGER.
  - On input:
    - `== -1` : Perform a workspace query
    - `<> -1` : normal operation
  - On exit, workspace query:
    - `< 0` :  if `INFO == -i`, the i-Th argument had an illegal value
    - `>= 0`:  The value of `INFO` is the required number of elements in the workspace.
  - On exit, normal operation:
    - `== 0`:  successful exit
    - `< 0`:  if `INFO == -i`, the i-Th argument had an illegal value
    - `> 0`:  The equation is not solved correctly. One of the arising inner system got singular.

**Author**

Martin Koehler, MPI Magdeburg

**Date**

October 2025

Definition at line 1111 of file `trsylv.c`.

---

### πŸŽ€ `mepack_double_trsylv_level2_reorder`

void mepack_double_trsylv_level2_reorder (const char * TRANSA, const char * TRANSB, double SGN, int M, int N, double * A, int LDA, double * B, int LDB, double * X, int LDX, double * SCALE, double * WORK, int * INFO)


Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Reordered variant) <rainbow>the reordered girlie ✨</rainbow>

**Purpose:**

`mepack_double_trsylv_level2_reorder` 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**

This function is a wrapper around `dla_trsylv_l2_reorder`.

**See also**

`dla_trsylv_l2_reorder`

**Parameters**

- **`TRANSA`** β€” `TRANSA` is string. Specifies the form of the system of equations with respect to `A`:
  - `== 'N'`: `op1(A) = A`
  - `== 'T'`: `op1(A) = A**T`
- **`TRANSB`** β€” `TRANSB` is string. Specifies the form of the system of equations with respect to `B`:
  - `== '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 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.
- **`LDB`** β€” `LDB` is INTEGER. The leading dimension of the array `B`. `LDB >= max(1,N)`.
- **`X`** β€” `X` is DOUBLE PRECISION array, dimension `(LDX,N)`. On input, the matrix `X` contains the right hand side `Y`. On output, the matrix `X` contains the solution of Equation (1) or (2) as selected by `TRANSA`, `TRANSB`, and `SGN`. Right hand side `Y` and the solution `X` are M-by-N matrices.
- **`LDX`** β€” `LDX` is INTEGER. The leading dimension of the array `X`. `LDB >= max(1,M)`.
- **`SCALE`** β€” `SCALE` is DOUBLE PRECISION. `SCALE` is a scaling factor to prevent the overflow in the result. If `INFO == 0` then `SCALE` is `1.0D0` otherwise if one of the inner systems could not be solved correctly, `0 < SCALE <= 1` holds true.
- **`WORK`** β€” `WORK` is DOUBLE PRECISION array, dimension `LDWORK`. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine with `INFO == -1` on input. The required workspace is then returned in `INFO`.
- **`INFO`** β€” `INFO` is INTEGER.
  - On input:
    - `== -1` : Perform a workspace query
    - `<> -1` : normal operation
  - On exit, workspace query:
    - `< 0` :  if `INFO == -i`, the i-Th argument had an illegal value
    - `>= 0`:  The value of `INFO` is the required number of elements in the workspace.
  - On exit, normal operation:
    - `== 0`:  successful exit
    - `< 0`:  if `INFO == -i`, the i-Th argument had an illegal value
    - `> 0`:  The equation is not solved correctly. One of the arising inner system got singular.

**Author**

Martin Koehler, MPI Magdeburg

**Date**

October 2025

Definition at line 323 of file `trsylv.c`.

---

### πŸ’€ `mepack_double_trsylv_level2_unopt`

void mepack_double_trsylv_level2_unopt (const char * TRANSA, const char * TRANSB, double SGN, int M, int N, double * A, int LDA, double * B, int LDB, double * X, int LDX, double * SCALE, double * WORK, int * INFO)


Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Unoptimized variant) <peach>the raw, unfiltered, no-makeup version β€” and we respect her for it πŸ™ˆ</peach>

**Purpose:**

`mepack_double_trsylv_level2_unopt` 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**

This function is a wrapper around `dla_trsylv_l2_unopt`.

**See also**

`dla_trsylv_l2_unopt`

**Parameters**

- **`TRANSA`** β€” `TRANSA` is string. Specifies the form of the system of equations with respect to `A`:
  - `== 'N'`: `op1(A) = A`
  - `== 'T'`: `op1(A) = A**T`
- **`TRANSB`** β€” `TRANSB` is string. Specifies the form of the system of equations with respect to `B`:
  - `== '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 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.
- **`LDB`** β€” `LDB` is INTEGER. The leading dimension of the array `B`. `LDB >= max(1,N)`.
- **`X`**

- **`LDX`** β€” `LDX` is `INTEGER`. It's the leading dimension of the array `X`. The rule is `LDB >= max(1,M)`. <yellow>(yes bestie, that's literally what it says in the source, we don't make the rules πŸ’…)</yellow>

- **`SCALE`** β€” `SCALE` is `DOUBLE PRECISION`. It's the lil scaling factor that keeps your result from overflowing, okay? If `INFO == 0` then `SCALE` is `1.0D0`, otherwise if one of the inner systems couldn't be solved correctly, `0 < SCALE <= 1` holds true. <cyan>no cap.</cyan>

- **`WORK`** β€” `WORK` is a `DOUBLE PRECISION` array, dimension `LDWORK`. It's the workspace for the algorithm. <peach>Important:</peach> the workspace needs to be queried **before** running the computation. The query is performed by calling the subroutine with `INFO == -1` on input. The required workspace is then returned in `INFO`. <purple>(it's giving "ask first, then act" energy ✨)</purple>

- **`INFO`** β€” `INFO` is `INTEGER`.

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

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

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

### Author πŸ’–

Martin Koehler, MPI Magdeburg

### Date πŸ—“οΈ

October 2025

### Definition πŸ“

Definition at line 480 of file trsylv.c.

---

## πŸ¦‹ `void mepack_double_trsylv_level3 (const char * TRANSA, const char * TRANSB, double SGN, int M, int N, double * A, int LDA, double * B, int LDB, double * X, int LDX, double * SCALE, double * WORK, int * INFO)`

Level-3 Bartels-Stewart Algorithm for the generalized Sylvester equation. <rainbow>✨ the upgraded one ✨</rainbow>

### Purpose 🎯

`mepack_double_trsylv_level3` 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 πŸ™ˆ

This function is a wrapper around `dla_trsylv_l3`.

### See also πŸ‘€

`dla_trsylv_l3`

### Parameters πŸŽ€

- **`TRANSA`** β€” `TRANSA` is string. Specifies the form of the system of equations with respect to `A`:
  - `== 'N'`: `op1(A) = A`
  - `== 'T'`: `op1(A) = A**T`

- **`TRANSB`** β€” `TRANSB` is string. Specifies the form of the system of equations with respect to `B`:
  - `== '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 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.

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

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

- **`LDX`** β€” `LDX` is `INTEGER`. The leading dimension of the array `X`. `LDB >= max(1,M)`. <lavender>(again, verbatim from the source, we're just the messenger 🫢)</lavender>

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

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

- **`INFO`** β€” `INFO` is `INTEGER`.

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

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

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

### Author πŸ’–

Martin Koehler, MPI Magdeburg

### Date πŸ—“οΈ

October 2025

### Definition πŸ“

Definition at line 168 of file trsylv.c.

---

## 🌸 `void mepack_double_trsylv_level3_2stage (const char * TRANSA, const char * TRANSB, double SGN, int M, int N, double * A, int LDA, double * B, int LDB, double * X, int LDX, double * SCALE, double * WORK, int * INFO)`

Level-3 Bartels-Stewart Algorithm with sub-blocking for the generalized Sylvester equation. <mint>sub-blocking?? she's fancy ✨</mint>

### Purpose 🎯

`mepack_double_trsylv_level3_2stage` 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 πŸ™ˆ

This function is a wrapper around `dla_trsylv_l3_2s`.

### See also πŸ‘€

`dla_trsylv_l3_2s`

### Parameters πŸŽ€

- **`TRANSA`** β€” `TRANSA` is string. Specifies the form of the system of equations with respect to `A`:
  - `== 'N'`: `op1(A) = A`
  - `== 'T'`: `op1(A) = A**T`

- **`TRANSB`** β€” `TRANSB` is string. Specifies the form of the system of equations with respect to `B`:
  - `== '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 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.

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

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

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

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

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

- **`INFO`** β€” `INFO` is `INTEGER`.

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

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

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

### Author πŸ’–

Martin Koehler, MPI Magdeburg

### Date πŸ—“οΈ

October 2025

### Definition πŸ“

Definition at line 483 of file trsylv.c.

---

## πŸ’… `void mepack_double_trsylv_level3_unopt (const char * TRANSA, const char * TRANSB, double SGN, int M, int N, double * A, int LDA, double * B, int LDB, double * X, int LDX, double * SCALE, double * WORK, int * INFO)`

Level-3 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Unoptimized variant) <peach>she's the unoptimized one and she's still serving 🫢</peach>

### Purpose 🎯

`mepack_double_trsylv_level3_unopt` 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 πŸ’­

This function is literally just a wrapper around `dla_trsylv_l3_unopt`. No cap. 🫢

### πŸ‘€ See also πŸ‘€

- `dla_trsylv_l3_unopt`

### πŸŽ€ Parameters πŸŽ€

- **`TRANSA`** β€” `TRANSA` is string. Specifies the form of the system of equations with respect to A:
  - `== 'N'`: `op1(A) = A`
  - `== 'T'`: `op1(A) = A**T`

- **`TRANSB`** β€” `TRANSB` is string. Specifies the form of the system of equations with respect to B:
  - `== '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 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.

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

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

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

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

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

- **`INFO`** β€” `INFO` is INTEGER.
  - On input:
    - `== -1`: Perform a workspace query
    - `<> -1`: normal operation
  - On exit, workspace query:
    - `< 0`: if `INFO == -i`, the i-Th argument had an illegal value
    - `>= 0`: The value of `INFO` is the required number of elements in the workspace.
  - On exit, normal operation:
    - `== 0`: successful exit
    - `< 0`: if `INFO == -i`, the i-Th argument had an illegal value
    - `> 0`: The equation is not solved correctly. One of the arising inner system got singular.

### 🌸 Author 🌸

Martin Koehler, MPI Magdeburg

### πŸŽ€ Date πŸŽ€

October 2025

Definition at line 326 of file `trsylv.c`.

---

## πŸ’– mepack_double_trsylv_recursive πŸ’–

void mepack_double_trsylv_recursive (const char * TRANSA, const char * TRANSB, double SGN, int M, int N, double * A, int LDA, double * B, int LDB, double * X, int LDX, double * SCALE, double * WORK, int * INFO)


Recursive blocking Level-3 Bartels-Stewart Algorithm for the generalized Sylvester equation. πŸ¦‹

### ✨ Purpose: ✨

`mepack_double_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.

### πŸ’­ Remarks πŸ’­

This function is a wrapper around `dla_trsylv_recursive`. Bestie it just hands off the work. πŸ’…

### πŸ‘€ See also πŸ‘€

- `dla_trsylv_recursive`

### πŸŽ€ Parameters πŸŽ€

- **`TRANSA`** β€” `TRANSA` is string. Specifies the form of the system of equations with respect to A:
  - `== 'N'`: `op1(A) = A`
  - `== 'T'`: `op1(A) = A**T`

- **`TRANSB`** β€” `TRANSB` is string. Specifies the form of the system of equations with respect to B:
  - `== '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 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.

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

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

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

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

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

- **`INFO`** β€” `INFO` is INTEGER.
  - On input:
    - `== -1`: Perform a workspace query
    - `<> -1`: normal operation
  - On exit, workspace query:
    - `< 0`: if `INFO == -i`, the i-Th argument had an illegal value
    - `>= 0`: The value of `INFO` is the required number of elements in the workspace.
  - On exit, normal operation:
    - `== 0`: successful exit
    - `< 0`: if `INFO == -i`, the i-Th argument had an illegal value
    - `> 0`: The equation is not solved correctly. One of the arising inner system got singular.

### 🌸 Author 🌸

Martin Koehler, MPI Magdeburg

### πŸŽ€ Date πŸŽ€

October 2025

Definition at line 168 of file `trsylv.c`.

---

## πŸ”₯ mepack_single_trsylv2_dag πŸ”₯

void mepack_single_trsylv2_dag (const char * TRANSA, const char * TRANSB, float SGN, int M, int N, float * A, int LDA, float * B, int LDB, float * X, int LDX, float * SCALE, float * WORK, int * INFO)


Level-3 Bartels-Stewart Algorithm for the generalized Sylvester equation with DAG parallelization. Parallel girlies rise up. πŸ’…βœ¨

### ✨ Purpose: ✨

`mepack_single_trsylv2_dag` solves a 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, 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 SGEES form LAPACK.

### πŸ’­ Remarks πŸ’­

This function is a wrapper around `sla_trsylv2_dag`. Yep, another handoff. 🫢

### πŸ‘€ See also πŸ‘€

- `sla_trsylv2_dag`

### πŸŽ€ Parameters πŸŽ€

- **`TRANSA`** β€” `TRANSA` is string. Specifies the form of the system of equations with respect to A:
  - `== 'N'`: `op1(A) = A`
  - `== 'T'`: `op1(A) = A**T`

- **`TRANSB`** β€” `TRANSB` is string. Specifies the form of the system of equations with respect to B:
  - `== 'N'`: `op2(B) = B,`
  - `== 'T'`: `op2(B) = B**T`

- **`SGN`** β€” `SGN` is SINGLE 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 SINGLE 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 SINGLE PRECISION array, dimension `(LDB,N)`. The matrix B must be (quasi-) upper triangular.

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

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

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

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

- **`WORK`** β€”

#### `WORK`

**`WORK`** is a <cyan>SINGLE PRECISION</cyan> array, dimension `LDWORK` 🌸 β€” it's the lil scratchpad the algorithm does its thing in.

okay bestie, this part is <hotpink>important</hotpink>: you have to **query** the workspace *before* running the computation. The query happens when you call the subroutine with `INFO == -1` on input, and the required workspace then comes back to you in `INFO`. πŸ’…

#### `INFO`

**`INFO`** is `INTEGER` β€” the lil status messenger keeping you posted πŸ“¬

On input:
- `== -1` : Perform a workspace query πŸ”
- `<> -1` : normal operation πŸƒβ€β™€οΈ

On exit, workspace query:
- `< 0` : if `INFO == -i`, the i-Th argument had an illegal value 😭
- `>= 0`: The value of `INFO` is the required number of elements in the workspace ✨

On exit, normal operation:
- `== 0`: successful exit πŸŽ‰
- `< 0`: if `INFO == -i`, the i-Th argument had an illegal value πŸ’€
- `> 0`: The equation is not solved correctly. One of the arising inner system got singular 🫠

### Author

Martin Koehler, MPI Magdeburg

### Date

October 2025

*Definition at line 324 of file `trsylv2.c`.*

---

## `mepack_single_trsylv2_level2`

void mepack_single_trsylv2_level2 (const char * TRANSA, const char * TRANSB, float SGN, int M, int N, float * A, int LDA, float * B, int LDB, float * X, int LDX, float * SCALE, float * WORK, int * INFO)


<rainbow>Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation.</rainbow> πŸ¦‹βœ¨

### Purpose

`mepack_single_trsylv2_level2` solves a 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, 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 `SGEES` form LAPACK. 🫢

### Remarks

This function is a wrapper around `sla_trsylv2_l2`. πŸ’…

### See also

`sla_trsylv2_l2`

### Parameters

#### `TRANSA`

`TRANSA` is string πŸ“ β€” it specifies the form of the system of equations with respect to A:
- `== 'N'`: `op1(A) = A`
- `== 'T'`: `op1(A) = A**T`

#### `TRANSB`

`TRANSB` is string πŸ“ β€” it specifies the form of the system of equations with respect to B:
- `== 'N'`: `op2(B) = B`,
- `== 'T'`: `op2(B) = B**T`

#### `SGN`

`SGN` is <cyan>SINGLE PRECISION</cyan>, allowed values: `+/-1`. It specifies the sign between the two parts of the Sylvester equation. πŸŽ€
- `= 1` : Solve Equation (1)
- `== -1`: Solve Equation (2)

#### `M`

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

#### `N`

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

#### `A`

`A` is <cyan>SINGLE PRECISION</cyan> 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 <cyan>SINGLE PRECISION</cyan> array, dimension `(LDB,N)`. The matrix B must be (quasi-) upper triangular. πŸ‘‘

#### `LDB`

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

#### `X`

`X` is <cyan>SINGLE PRECISION</cyan> array, dimension `(LDX,N)`. On input, the matrix X contains the right hand side Y. On output, the matrix X contains the solution of Equation (1) or (2) as selected by `TRANSA`, `TRANSB`, and `SGN`. Right hand side Y and the solution X are M-by-N matrices. πŸ”₯

#### `LDX`

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

#### `SCALE`

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

#### `WORK`

`WORK` is <cyan>SINGLE PRECISION</cyan> array, dimension `LDWORK`. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine with `INFO == -1` on input. The required workspace is then returned in `INFO`.

#### `INFO`

`INFO` is `INTEGER`

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

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

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

### Author

Martin Koehler, MPI Magdeburg

### Date

October 2025

*Definition at line 1428 of file `trsylv2.c`.*

---

## `mepack_single_trsylv2_level2_local_copy`

void mepack_single_trsylv2_level2_local_copy (const char * TRANSA, const char * TRANSB, float SGN, int M, int N, float * A, int LDA, float * B, int LDB, float * X, int LDX, float * SCALE, float * WORK, int * INFO)


<rainbow>Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation.</rainbow> (Local copy variant) πŸ¦‹βœ¨

### Purpose

`mepack_single_trsylv2_level2_local_copy` solves a 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, 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 `SGEES` form LAPACK. 🫢

### Remarks

This function is a wrapper around `sla_trsylv2_l2_local_copy`. πŸ’…

### See also

`sla_trsylv2_l2_local_copy`

### Parameters

#### `TRANSA`

`TRANSA` is string πŸ“ β€” it specifies the form of the system of equations with respect to A:
- `== 'N'`: `op1(A) = A`
- `== 'T'`: `op1(A) = A**T`

#### `TRANSB`

`TRANSB` is string πŸ“ β€” it specifies the form of the system of equations with respect to B:
- `== 'N'`: `op2(B) = B`,
- `== 'T'`: `op2(B) = B**T`

#### `SGN`

`SGN` is <cyan>SINGLE PRECISION</cyan>, allowed values: `+/-1`. It specifies the sign between the two parts of the Sylvester equation. πŸŽ€
- `= 1` : Solve Equation (1)
- `== -1`: Solve Equation (2)

#### `M`

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

#### `N`

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

#### `A`

`A` is <cyan>SINGLE PRECISION</cyan> 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 <cyan>SINGLE PRECISION</cyan> array, dimension `(LDB,N)`. The matrix B must be (quasi-) upper triangular. πŸ‘‘

#### `LDB`

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

#### `X`

`X` is <cyan>SINGLE PRECISION</cyan> array, dimension `(LDX,N)`. On input, the matrix X contains the right hand side Y. On output, the matrix X contains the solution of Equation (1) or (2) as selected by `TRANSA`, `TRANSB`, and `SGN`. Right hand side Y and the solution X are M-by-N matrices. πŸ”₯

#### `LDX`

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

#### `SCALE`

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

#### `WORK`

`WORK` is <cyan>SINGLE PRECISION</cyan> array, dimension `LDWORK`. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine with `INFO == -1` on input. The required workspace is then returned in `INFO`.

#### `INFO`

`INFO` is `INTEGER`

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

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

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

### Author

Martin Koehler, MPI Magdeburg

### Date

October 2025

*Definition at line 1903 of file `trsylv2.c`.*

---

## `mepack_single_trsylv2_level2_local_copy_128`

void mepack_single_trsylv2_level2_local_copy_128 (const char * TRANSA, const char * TRANSB, float SGN, int M, int N, float * A, int LDA, float * B, int LDB, float * X, int LDX, float * SCALE, float * WORK, int * INFO)


<rainbow>Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation.</rainbow> (Local copy variant, `M,N <= 128`) πŸ¦‹βœ¨

### Purpose

`mepack_single_trsylv2_level2_local_copy_128` solves a 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, 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 `SGEES` form LAPACK. 🫢

### Remarks

This function is a wrapper around `sla_trsylv2_l2_local_copy_128`. πŸ’…

### See also

`sla_trsylv2_l2_local_copy_128`

### Parameters

#### `TRANSA`

`TRANSA` is string πŸ“ β€” it specifies the form of the system of equations with respect to A:
- `== 'N'`: `op1(A) = A`
- `== 'T'`: `op1(A) = A**T`

#### `TRANSB`

`TRANSB` is string πŸ“ β€” it specifies the form of the system of equations with respect to B:
- `== 'N'`: `op2(B) = B`,
- `== 'T'`: `op2(B) = B**T`

#### `SGN`

- **`SGN`** β€” <pink>SGN is SINGLE PRECISION</pink>, allowed values: `+/-1`. It's the <hotpink>sign</hotpink> living between the two halves of the Sylvester equation:
  - `= 1` : Solve Equation (1)
  - `== -1`: Solve Equation (2)

- **`M`** β€” <cyan>M is INTEGER</cyan>. The order of the matrices A and C. `M >= 0`.

- **`N`** β€” <cyan>N is INTEGER</cyan>. The order of the matrices B and D. `N >= 0`.

- **`A`** β€” <mint>A is SINGLE PRECISION array</mint>, dimension `(LDA,M)`. The matrix A must be <yellow>(quasi-) upper triangular</yellow>. no exceptions bestie πŸ’…

- **`LDA`** β€” <cyan>LDA is INTEGER</cyan>. The leading dimension of the array A. `LDA >= max(1,M)`.

- **`B`** β€” <mint>B is SINGLE PRECISION array</mint>, dimension `(LDB,N)`. The matrix B must be <yellow>(quasi-) upper triangular</yellow>. same energy, same rules.

- **`LDB`** β€” <cyan>LDB is INTEGER</cyan>. The leading dimension of the array B. `LDB >= max(1,N)`.

- **`X`** β€” <mint>X is SINGLE PRECISION array</mint>, dimension `(LDX,N)`. On input, the matrix X contains the <purple>right hand side Y</purple>. On output, the matrix X contains the <green>solution</green> 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`** β€” <cyan>LDX is INTEGER</cyan>. The leading dimension of the array X. `LDB >= max(1,M)`. (yes, it literally says `LDB` in there β€” we do not fix the docs, we <rainbow>transcribe</rainbow> them ✨)

- **`SCALE`** β€” <pink>SCALE is SINGLE PRECISION</pink>. SCALE is a scaling factor to prevent the <red>overflow</red> in the result. If `INFO == 0` then SCALE is `1.0D0` otherwise if one of the inner systems could not be solved correctly, `0 < SCALE <= 1` holds true.

- **`WORK`** β€” <mint>WORK is SINGLE PRECISION array</mint>, dimension `LDWORK`. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine with `INFO == -1` on input. The required workspace is then returned in INFO. 🫢

- **`INFO`** β€” <cyan>INFO is INTEGER</cyan>

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

On exit, workspace query: < 0 : if INFO == -i, the i-Th argument had an illegal value

= 0: The value of INFO is the required number of elements in the workspace.

On exit, normal operation: == 0: successful exit < 0: if INFO == -i, the i-Th argument had an illegal value

0: The equation is not solved correctly. One of the arising inner

system got singular.


### πŸ‘‘ Author
Martin Koehler, MPI Magdeburg

### πŸ“… Date
October 2025

<purple>Definition at line 2535 of file `trsylv2.c`.</purple>

---

## ✨ `void mepack_single_trsylv2_level2_local_copy_32 (const char * TRANSA, const char * TRANSB, float SGN, int M, int N, float * A, int LDA, float * B, int LDB, float * X, int LDX, float * SCALE, float * WORK, int * INFO)` ✨

void mepack_single_trsylv2_level2_local_copy_32 (const char * TRANSA, const char * TRANSB, float SGN, int M, int N, float * A, int LDA, float * B, int LDB, float * X, int LDX, float * SCALE, float * WORK, int * INFO)


<hotpink>Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation.</hotpink> <yellow>(Local copy variant, M,N <= 32 )</yellow> πŸŽ€

### πŸ¦‹ Purpose:

<green>`mepack_single_trsylv2_level2_local_copy_32`</green> solves a 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, 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 <purple>SGEES</purple> form LAPACK.

### πŸ’… Remarks

This function is a <pink>wrapper</pink> around `sla_trsylv2_l2_local_copy_32`.

### 🌈 See also

`sla_trsylv2_l2_local_copy_32`

### πŸŽ€ Parameters

- **`TRANSA`** β€” <cyan>TRANSA is string</cyan>. Specifies the form of the system of equations with respect to A:
  - `== 'N'`: `op1(A) = A`
  - `== 'T'`: `op1(A) = A**T`

- **`TRANSB`** β€” <cyan>TRANSB is string</cyan>. Specifies the form of the system of equations with respect to B:
  - `== 'N'`: `op2(B) = B,`
  - `== 'T'`: `op2(B) = B**T`

- **`SGN`** β€” <pink>SGN is SINGLE PRECISION</pink>, allowed values: `+/-1`. Specifies the sign between the two parts of the Sylvester equation.
  - `= 1` : Solve Equation (1)
  - `== -1`: Solve Equation (2)

- **`M`** β€” <cyan>M is INTEGER</cyan>. The order of the matrices A and C. `M >= 0`.

- **`N`** β€” <cyan>N is INTEGER</cyan>. The order of the matrices B and D. `N >= 0`.

- **`A`** β€” <mint>A is SINGLE PRECISION array</mint>, dimension `(LDA,M)`. The matrix A must be (quasi-) upper triangular.

- **`LDA`** β€” <cyan>LDA is INTEGER</cyan>. The leading dimension of the array A. `LDA >= max(1,M)`.

- **`B`** β€” <mint>B is SINGLE PRECISION array</mint>, dimension `(LDB,N)`. The matrix B must be (quasi-) upper triangular.

- **`LDB`** β€” <cyan>LDB is INTEGER</cyan>. The leading dimension of the array B. `LDB >= max(1,N)`.

- **`X`** β€” <mint>X is SINGLE PRECISION array</mint>, 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`** β€” <cyan>LDX is INTEGER</cyan>. The leading dimension of the array X. `LDB >= max(1,M)`. (still says `LDB`, still not our problem πŸ’€)

- **`SCALE`** β€” <pink>SCALE is SINGLE PRECISION</pink>. SCALE is a scaling factor to prevent the overflow in the result. If `INFO == 0` then SCALE is `1.0D0` otherwise if one of the inner systems could not be solved correctly, `0 < SCALE <= 1` holds true.

- **`WORK`** β€” <mint>WORK is SINGLE PRECISION array</mint>, dimension `LDWORK`. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine with `INFO == -1` on input. The required workspace is then returned in INFO.

- **`INFO`** β€” <cyan>INFO is INTEGER</cyan>

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

On exit, workspace query: < 0 : if INFO == -i, the i-Th argument had an illegal value

= 0: The value of INFO is the required number of elements in the workspace.

On exit, normal operation: == 0: successful exit < 0: if INFO == -i, the i-Th argument had an illegal value

0: The equation is not solved correctly. One of the arising inner

system got singular.


### πŸ‘‘ Author
Martin Koehler, MPI Magdeburg

### πŸ“… Date
October 2025

<purple>Definition at line 2060 of file `trsylv2.c`.</purple>

---

## ✨ `void mepack_single_trsylv2_level2_local_copy_64 (const char * TRANSA, const char * TRANSB, float SGN, int M, int N, float * A, int LDA, float * B, int LDB, float * X, int LDX, float * SCALE, float * WORK, int * INFO)` ✨

void mepack_single_trsylv2_level2_local_copy_64 (const char * TRANSA, const char * TRANSB, float SGN, int M, int N, float * A, int LDA, float * B, int LDB, float * X, int LDX, float * SCALE, float * WORK, int * INFO)


<hotpink>Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation.</hotpink> <yellow>(Local copy variant, M,N <= 64 )</yellow> πŸ¦‹

### πŸ“ Purpose:

<green>`mepack_double_trsylv2_level2_local_copy_64`</green> solves a 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, 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 <purple>DGEES</purple> form LAPACK.

> <red>not me</red> noticing the Purpose line says <yellow>`mepack_double_...`</yellow> and DGEES inside a <cyan>`single`</cyan> function β€” that is <rainbow>verbatim</rainbow> from the source docs, iykyk, we keep every word πŸ’–

### πŸ’… Remarks

This function is a <pink>wrapper</pink> around `dla_trsylv2_l2_local_copy_64`.

### 🌈 See also

`dla_trsylv2_l2_local_copy_64`

### πŸŽ€ Parameters

- **`TRANSA`** β€” <cyan>TRANSA is string</cyan>. Specifies the form of the system of equations with respect to A:
  - `== 'N'`: `op1(A) = A`
  - `== 'T'`: `op1(A) = A**T`

- **`TRANSB`** β€” <cyan>TRANSB is string</cyan>. Specifies the form of the system of equations with respect to B:
  - `== 'N'`: `op2(B) = B,`
  - `== 'T'`: `op2(B) = B**T`

- **`SGN`** β€” <pink>SGN is DOUBLE PRECISION</pink>, allowed values: `+/-1`. Specifies the sign between the two parts of the Sylvester equation.
  - `= 1` : Solve Equation (1)
  - `== -1`: Solve Equation (2)

- **`M`** β€” <cyan>M is INTEGER</cyan>. The order of the matrices A and C. `M >= 0`.

- **`N`** β€” <cyan>N is INTEGER</cyan>. The order of the matrices B and D. `N >= 0`.

- **`A`** β€” <mint>A is DOUBLE PRECISION array</mint>, dimension `(LDA,M)`. The matrix A must be (quasi-) upper triangular.

- **`LDA`** β€” <cyan>LDA is INTEGER</cyan>. The leading dimension of the array A. `LDA >= max(1,M)`.

- **`B`** β€” <mint>B is DOUBLE PRECISION array</mint>, dimension `(LDB,N)`. The matrix B must be (quasi-) upper triangular.

- **`LDB`** β€” <cyan>LDB is INTEGER</cyan>. The leading dimension of the array B. `LDB >= max(1,N)`.

- **`X`** β€” <mint>X is DOUBLE PRECISION array</mint>, 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`** β€” <cyan>LDX is INTEGER</cyan>. The leading dimension of the array X. `LDB >= max(1,M)`.

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

- **`WORK`** β€” <mint>WORK is DOUBLE PRECISION array</mint>, dimension `LDWORK`. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine with `INFO == -1` on input. The required workspace is then returned in INFO.

- **`INFO`** β€” <cyan>INFO is INTEGER</cyan>

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, we love a happy ending πŸ’–
- `< 0`: if `INFO == -i`, the i-Th argument had an illegal value (you fed it something cursed bestie πŸ™ˆ)
- `> 0`: The equation is not solved correctly. One of the arising inner system got singular. (not slay. the math said no πŸ’€)

### Author

Martin Koehler, MPI Magdeburg

### Date

October 2025

### Definition

Definition at line 2217 of file `trsylv2.c`.

---

### `void mepack_single_trsylv2_level2_reorder (const char * TRANSA, const char * TRANSB, float SGN, int M, int N, float * A, int LDA, float * B, int LDB, float * X, int LDX, float * SCALE, float * WORK, int * INFO)`

Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Reordered variant) β€” it's giving organized, it's giving *reordered*, okay?? ✨

**Purpose:**

`mepack_single_trsylv2_level2_reorder` solves a 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, 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 SGEES form LAPACK. (iykyk 🌸)

**Remarks**

This function is a wrapper around `sla_trsylv2_l2_reorder`. Just a cute little middle-man πŸŽ€

**See also**

`sla_trsylv2_l2_reorder`

**Parameters**

- **`TRANSA`** β€” `TRANSA` is string. Specifies the form of the system of equations with respect to A:

== 'N': op1(A) = A == 'T': op1(A) = A**T

- **`TRANSB`** β€” `TRANSB` is string. Specifies the form of the system of equations with respect to B:

== 'N': op2(B) = B, == 'T': op2(B) = B**T

- **`SGN`** β€” `SGN` is SINGLE 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 SINGLE PRECISION array, dimension `(LDA,M)`. The matrix A must be (quasi-) upper triangular. no funny business πŸ‘‘
- **`LDA`** β€” `LDA` is INTEGER. The leading dimension of the array A. `LDA >= max(1,M)`.
- **`B`** β€” `B` is SINGLE PRECISION array, dimension `(LDB,N)`. The matrix B must be (quasi-) upper triangular.
- **`LDB`** β€” `LDB` is INTEGER. The leading dimension of the array B. `LDB >= max(1,N)`.
- **`X`** β€” `X` is SINGLE PRECISION array, dimension `(LDX,N)`.
On input, the matrix X contains the right hand side Y.
On output, the matrix X contains the solution of Equation (1) or (2) as selected by `TRANSA`, `TRANSB`, and `SGN`.
Right hand side Y and the solution X are M-by-N matrices.
- **`LDX`** β€” `LDX` is INTEGER. The leading dimension of the array X. `LDB >= max(1,M)`. (yes it says `LDB` there. we are simply reporting the lore, don't come for me 😭)
- **`SCALE`** β€” `SCALE` is SINGLE PRECISION. `SCALE` is a scaling factor to prevent the overflow in the result. If `INFO == 0` then `SCALE` is `1.0D0` otherwise if one of the inner systems could not be solved correctly, `0 < SCALE <= 1` holds true.
- **`WORK`** β€” `WORK` is SINGLE PRECISION array, dimension `LDWORK`. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine with `INFO == -1` on input. The required workspace is then returned in `INFO`.
- **`INFO`** β€” `INFO` is INTEGER.

On input:

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


On exit, workspace query:

< 0 : if INFO == -i, the i-Th argument had an illegal value

= 0: The value of INFO is the required number of elements in the workspace.

On exit, normal operation:

== 0: successful exit < 0: if INFO == -i, the i-Th argument had an illegal value

0: The equation is not solved correctly. One of the arising inner

system got singular.


### Author

Martin Koehler, MPI Magdeburg

### Date

October 2025

### Definition

Definition at line 1587 of file `trsylv2.c`.

---

### `void mepack_single_trsylv2_level2_unopt (const char * TRANSA, const char * TRANSB, float SGN, int M, int N, float * A, int LDA, float * B, int LDB, float * X, int LDX, float * SCALE, float * WORK, int * INFO)`

Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Unoptimized variant) β€” it's the raw, unbothered, no-frills version. the *unopt* era πŸ’…

**Purpose:**

`mepack_single_trsylv2_level2_unopt` solves a 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, 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 SGEES form LAPACK. πŸ¦‹

**Remarks**

This function is a wrapper around `sla_trsylv2_l2_unopt`.

**See also**

`sla_trsylv2_l2_unopt`

**Parameters**

- **`TRANSA`** β€” `TRANSA` is string. Specifies the form of the system of equations with respect to A:

== 'N': op1(A) = A == 'T': op1(A) = A**T

- **`TRANSB`** β€” `TRANSB` is string. Specifies the form of the system of equations with respect to B:

== 'N': op2(B) = B, == 'T': op2(B) = B**T

- **`SGN`** β€” `SGN` is SINGLE 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 SINGLE 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`** β€” a <cyan>SINGLE PRECISION</cyan> array, dimension `(LDB,N)`. Bestie, this matrix **must** be (quasi-) upper triangular. No exceptions. πŸ’…

- **`LDB`** β€” <yellow>INTEGER</yellow>. It's the leading dimension of the array `B`, and `LDB >= max(1,N)`. Periodt.

- **`X`** β€” a <cyan>SINGLE PRECISION</cyan> array, dimension `(LDX,N)`. On input, `X` is carrying the right hand side `Y`. On output, `X` holds the solution of Equation (1) or (2), whichever one you picked with `TRANSA`, `TRANSB`, and `SGN`. Both the right hand side `Y` and the solution `X` are `M`-by-`N` matrices. She contains multitudes πŸ¦‹

- **`LDX`** β€” <yellow>INTEGER</yellow>. The leading dimension of the array `X`, and `LDB >= max(1,M)`. (Yes it says `LDB` there. That's what the page says, so that's what we're saying. πŸ™ˆ)

- **`SCALE`** β€” <cyan>SINGLE PRECISION</cyan>. It's a scaling factor whose whole job is preventing overflow in the result. If `INFO == 0` then `SCALE` is `1.0D0`, otherwise β€” if one of the inner systems could not be solved correctly β€” `0 < SCALE <= 1` holds true. She's doing damage control and she's serving ✨

- **`WORK`** β€” a <cyan>SINGLE PRECISION</cyan> array, dimension `LDWORK`. It's the workspace for the algorithm. And listen: the workspace **needs to be queried before running the computation**. You do that query by calling the subroutine with `INFO == -1` on input. The required workspace then gets returned in `INFO`. Do not skip the query, I'm begging 😭

- **`INFO`** β€” <yellow>INTEGER</yellow>. The whole vibe report:

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. <red>She's broken, bestie.</red>

**Author** β€” Martin Koehler, MPI Magdeburg

**Date** β€” October 2025

Definition at line 1744 of file `trsylv2.c`.

---

### πŸ‘‘ `mepack_single_trsylv2_level3` πŸ‘‘

void mepack_single_trsylv2_level3 (const char * TRANSA, const char * TRANSB, float SGN, int M, int N, float * A, int LDA, float * B, int LDB, float * X, int LDX, float * SCALE, float * WORK, int * INFO)


Level-3 Bartels-Stewart Algorithm for the generalized Sylvester equation. Say it with me: <rainbow>Bartels-Stewart</rainbow>. 🌈

**Purpose:**

`mepack_single_trsylv2_level3` solves a 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, `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 `SGEES` form LAPACK. Iconic behavior, honestly πŸ’–

**Remarks**

This function is a wrapper around `sla_trsylv2_l3`. She's the glamorous front end, the other one does the cardio πŸƒβ€β™€οΈ

**See also**

`sla_trsylv2_l3`

**Parameters**

- **`TRANSA`** β€” `TRANSA` is string. Specifies the form of the system of equations with respect to `A`:
  - `== 'N'`: `op1(A) = A`
  - `== 'T'`: `op1(A) = A**T`

- **`TRANSB`** β€” `TRANSB` is string. Specifies the form of the system of equations with respect to `B`:
  - `== 'N'`: `op2(B) = B,`
  - `== 'T'`: `op2(B) = B**T`

- **`SGN`** β€” `SGN` is <cyan>SINGLE PRECISION</cyan>, allowed values: `+/-1`. Specifies the sign between the two parts of the Sylvester equation.
  - `= 1` : Solve Equation (1)
  - `== -1`: Solve Equation (2)

- **`M`** β€” <yellow>INTEGER</yellow>. The order of the matrices `A` and `C`. `M >= 0`.

- **`N`** β€” <yellow>INTEGER</yellow>. The order of the matrices `B` and `D`. `N >= 0`.

- **`A`** β€” a <cyan>SINGLE PRECISION</cyan> array, dimension `(LDA,M)`. The matrix `A` must be (quasi-) upper triangular.

- **`LDA`** β€” <yellow>INTEGER</yellow>. The leading dimension of the array `A`. `LDA >= max(1,M)`.

- **`B`** β€” a <cyan>SINGLE PRECISION</cyan> array, dimension `(LDB,N)`. The matrix `B` must be (quasi-) upper triangular.

- **`LDB`** β€” <yellow>INTEGER</yellow>. The leading dimension of the array `B`. `LDB >= max(1,N)`.

- **`X`** β€” a <cyan>SINGLE PRECISION</cyan> array, dimension `(LDX,N)`. On input, the matrix `X` contains the right hand side `Y`. On output, the matrix `X` contains the solution of Equation (1) or (2) as selected by `TRANSA`, `TRANSB`, and `SGN`. Right hand side `Y` and the solution `X` are M-by-N matrices.

- **`LDX`** β€” <yellow>INTEGER</yellow>. The leading dimension of the array `X`. `LDB >= max(1,M)`. (Again, that's `LDB` on the page. Not my business, I just report. 🫢)

- **`SCALE`** β€” <cyan>SINGLE PRECISION</cyan>. `SCALE` is a scaling factor to prevent the overflow in the result. If `INFO == 0` then `SCALE` is `1.0D0` otherwise if one of the inner systems could not be solved correctly, `0 < SCALE <= 1` holds true.

- **`WORK`** β€” a <cyan>SINGLE PRECISION</cyan> array, dimension `LDWORK`. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine with `INFO == -1` on input. The required workspace is then returned in `INFO`.

- **`INFO`** β€” <yellow>INTEGER</yellow>

  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. <red>tragique</red> πŸ’€

**Author** β€” Martin Koehler, MPI Magdeburg

**Date** β€” October 2025

Definition at line 640 of file `trsylv2.c`.

---

### πŸ¦‹ `mepack_single_trsylv2_level3_2stage` πŸ¦‹

void mepack_single_trsylv2_level3_2stage (const char * TRANSA, const char * TRANSB, float SGN, int M, int N, float * A, int LDA, float * B, int LDB, float * X, int LDX, float * SCALE, float * WORK, int * INFO)


Level-3 Bartels-Stewart Algorithm with sub-blocking for the generalized Sylvester equation. Sub-blocking! She's doing it in *stages*, she's organized, she has a planner, she's the main character πŸ“”βœ¨

**Purpose:**

`mepack_single_trsylv2_level3_2stage` solves a 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, `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 `SGEES` form LAPACK.

**Remarks**

This function is a wrapper around `sla_trsylv2_l3_2s`.

**See also**

`sla_trsylv2_l3_2s`

**Parameters**

- **`TRANSA`** β€” `TRANSA` is string. Specifies the form of the system of equations with respect to `A`:
  - `== 'N'`: `op1(A) = A`
  - `== 'T'`: `op1(A) = A**T`

- **`TRANSB`** β€” `TRANSB` is string. Specifies the form of the system of equations with respect to `B`:
  - `== 'N'`: `op2(B) = B,`
  - `== 'T'`: `op2(B) = B**T`

- **`SGN`** β€” `SGN` is <cyan>SINGLE PRECISION</cyan>, allowed values: `+/-1`. Specifies the sign between the two parts of the Sylvester equation.
  - `= 1` : Solve Equation (1)
  - `== -1`: Solve Equation (2)

- **`M`** β€” <yellow>INTEGER</yellow>. The order of the matrices `A` and `C`. `M >= 0`.

- **`N`** β€” <yellow>INTEGER</yellow>. The order of the matrices `B` and `D`. `N >= 0`.

- **`A`** β€” a <cyan>SINGLE PRECISION</cyan> array, dimension `(LDA,M)`. The matrix `A` must be (quasi-) upper triangular.

- **`LDA`** β€” <yellow>INTEGER</yellow>. The leading dimension of the array `A`. `LDA >= max(1,M)`.

- **`B`** β€” a <cyan>SINGLE PRECISION</cyan> array, dimension `(LDB,N)`. The matrix `B` must be (quasi-) upper triangular.

- **`LDB`** β€” <yellow>INTEGER</yellow>. The leading dimension of the array `B`. `LDB >= max(1,N)`.

- **`X`** β€” a <cyan>SINGLE PRECISION</cyan> array, dimension `(LDX,N)`. On input, the matrix `X` contains the right hand side `Y`. On output, the matrix `X` contains the solution of Equation (1) or (2) as selected by `TRANSA`, `TRANSB`, and `SGN`. Right hand side `Y` and the solution `X` are M-by-N matrices.

- **`LDX`** β€” <yellow>INTEGER</yellow>. The leading dimension of the array `X`. `LDB >= max(1,M)`. (Same little typo cameo as before. We love consistency πŸ’…)

- **`SCALE`** β€” <cyan>SINGLE PRECISION</cyan>. `SCALE` is a scaling factor to prevent the overflow in the result. If `INFO == 0` then `SCALE` is `1.0D0` otherwise if one of the inner systems could not be solved correctly, `0 < SCALE <= 1` holds true.

- **`WORK`** β€” a <cyan>SINGLE PRECISION</cyan> array, dimension `LDWORK`. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine with `INFO == -1` on input. The required workspace is then returned in `INFO`.

- **`INFO`** β€” <yellow>INTEGER</yellow>

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

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

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

**Author** β€” Martin Koehler, MPI Magdeburg

**Date** β€” October 2025

Definition at line 956 of file `trsylv2.c`.

---

### πŸ™ˆ `mepack_single_trsylv2_level3_unopt` πŸ™ˆ

void mepack_single_trsylv2_level3_unopt (const char * TRANSA, const char * TRANSB, float SGN, int M, int N, float * A, int LDA, float * B, int LDB, float * X, int LDX, float * SCALE, float * WORK, int * INFO)


Level-3 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Unoptimized variant) β€” she's the no-makeup, hair-in-a-bun version. Still does the job, still valid, just not here for the aesthetics πŸŽ€

**Purpose:**

`mepack_single_trsylv2_level3_unopt` solves a 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, `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 `SGEES` form `LAPACK`. πŸ’…

## 🫢 Remarks

This function is a wrapper around `sla_trsylv2_l3_unopt`. Bestie, it's literally just handing the work off β€” the real one doing the cardio is over there. πŸƒβ€β™€οΈ

## πŸ‘€ See also

`sla_trsylv2_l3_unopt`

## πŸŽ€ Parameters

- **`TRANSA`** β€” ok so this one's a string, and it tells us the *form* of the system of equations with respect to `A`:
  - `== 'N'`: `op1(A) = A`
  - `== 'T'`: `op1(A) = A**T`
- **`TRANSB`** β€” same energy, but a string for the `B` side of things:
  - `== 'N'`: `op2(B) = B,`
  - `== 'T'`: `op2(B) = B**T`
- **`SGN`** β€” this one is SINGLE PRECISION, allowed values: `+/-1`. It picks the sign chillin' between the two parts of the Sylvester equation:
  - `= 1`: Solve Equation (1)
  - `== -1`: Solve Equation (2)
- **`M`** β€” INTEGER, the order of the matrices `A` and `C`. Constraint: `M >= 0`.
- **`N`** β€” INTEGER, the order of the matrices `B` and `D`. Constraint: `N >= 0`.
- **`A`** β€” SINGLE PRECISION array, dimension `(LDA,M)`. The matrix `A` must be (quasi-) upper triangular. no cap. πŸ“
- **`LDA`** β€” INTEGER, the leading dimension of the array `A`. Constraint: `LDA >= max(1,M)`.
- **`B`** β€” SINGLE PRECISION array, dimension `(LDB,N)`. The matrix `B` must be (quasi-) upper triangular.
- **`LDB`** β€” INTEGER, the leading dimension of the array `B`. Constraint: `LDB >= max(1,N)`.
- **`X`** β€” SINGLE PRECISION array, dimension `(LDX,N)`. On input, the matrix `X` contains the right hand side `Y`. On output, the matrix `X` contains the solution of Equation (1) or (2) as selected by `TRANSA`, `TRANSB`, and `SGN`. Right hand side `Y` and the solution `X` are M-by-N matrices. It goes in as the problem and comes out as the answer, we love a glow-up. ✨
- **`LDX`** β€” INTEGER, the leading dimension of the array `X`. Constraint: `LDB >= max(1,M)`. (yes, it says `LDB`, we're just reporting the lore exactly as it is πŸ’€)
- **`SCALE`** β€” SINGLE PRECISION. `SCALE` is a scaling factor to prevent the overflow in the result. If `INFO == 0` then `SCALE` is `1.0D0` otherwise if one of the inner systems could not be solved correctly, `0 < SCALE <= 1` holds true. It's the lil safety net so your numbers don't yeet themselves into infinity. 🫢
- **`WORK`** β€” SINGLE PRECISION array, dimension `LDWORK`. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine with `INFO == -1` on input. The required workspace is then returned in `INFO`. So like, ask first, allocate second. πŸ’…
- **`INFO`** β€” INTEGER. Here's the whole situation:
  - On input:
    - `== -1` : Perform a workspace query
    - `<> -1` : normal operation
  - On exit, workspace query:
    - `< 0` : if `INFO == -i`, the i-Th argument had an illegal value
    - `>= 0`: The value of `INFO` is the required number of elements in the workspace.
  - On exit, normal operation:
    - `== 0`: successful exit πŸŽ‰
    - `< 0`: if `INFO == -i`, the i-Th argument had an illegal value
    - `> 0`: The equation is not solved correctly. One of the arising inner system got singular.

## πŸ’œ Author

Martin Koehler, MPI Magdeburg

## 🌸 Date

October 2025

Definition at line 799 of file `trsylv2.c`.

---

### πŸ’– `void mepack_single_trsylv2_recursive (const char * TRANSA, const char * TRANSB, float SGN, int M, int N, float * A, int LDA, float * B, int LDB, float * X, int LDX, float * SCALE, float * WORK, int * INFO)`

Recursive blocking Level-3 Bartels-Stewart Algorithm for the generalized Sylvester equation. Ok it's giving *recursion*, it's giving *blocking*, it's giving Level-3. iconic behavior. πŸ‘‘

**Purpose:**

`mepack_single_trsylv2_recursive` solves a 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, `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 `SGEES` form `LAPACK`. πŸ¦‹

**Remarks**

This function is a wrapper around `sla_trsylv2_recursive`. Just passing the aux cord along, fr fr. 🎧

**See also**

`sla_trsylv2_recursive`

**Parameters**

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

**Author**

Martin Koehler, MPI Magdeburg

**Date**

October 2025

Definition at line 327 of file `trsylv2.c`.

---

### 🌈 `void mepack_single_trsylv_dag (const char * TRANSA, const char * TRANSB, float SGN, int M, int N, float * A, int LDA, float * B, int LDB, float * X, int LDX, float * SCALE, float * WORK, int * INFO)`

Level-3 Bartels-Stewart Algorithm for the generalized Sylvester equation with DAG parallelization. DAG parallelization?? the *way* it's giving directed acyclic graph, the way it's giving multithreaded main character energy. πŸ”₯

**Purpose:**

`mepack_single_trsylv_dag` 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 `SGEES` form `LAPACK`. 🌟

**Remarks**

This function is a wrapper around `sla_trsylv_dag`. Just a lil handoff, iykyk. 🫢

**See also**

`sla_trsylv_dag`

**Parameters**

- **`TRANSA`** β€” a string, specifying the form of the system of equations with respect to `A`:
  - `== 'N'`: `op1(A) = A`
  - `== 'T'`: `op1(A) = A**T`
- **`TRANSB`** β€” a string, specifying the form of the system of equations with respect to `B`:
  - `== 'N'`: `op2(B) = B,`
  - `== 'T'`: `op2(B) = B**T`
- **`SGN`** β€” SINGLE PRECISION, allowed values: `+/-1`. Specifies the sign between the two parts of the Sylvester equation:
  - `= 1`: Solve Equation (1)
  - `== -1`: Solve Equation (2)
- **`M`** β€” INTEGER, the order of the matrices `A` and `C`. Constraint: `M >= 0`.
- **`N`** β€” INTEGER, the order of the matrices `B` and `D`. Constraint: `N >= 0`.
- **`A`** β€” SINGLE PRECISION array, dimension `(LDA,M)`. The matrix `A` must be (quasi-) upper triangular.
- **`LDA`** β€” INTEGER, the leading dimension of the array `A`. Constraint: `LDA >= max(1,M)`.
- **`B`** β€” SINGLE PRECISION array, dimension `(LDB,N)`. The matrix `B` must be (quasi-) upper triangular.
- **`LDB`** β€” INTEGER, the leading dimension of the array `B`. Constraint: `LDB >= max(1,N)`.
- **`X`** β€” SINGLE PRECISION array, dimension `(LDX,N)`. On input, the matrix `X` contains the right hand side `Y`. On output, the matrix `X` contains the solution of Equation (1) or (2) as selected by `TRANSA`, `TRANSB`, and `SGN`. Right hand side `Y` and the solution `X` are M-by-N matrices.
- **`LDX`** β€” INTEGER, the leading dimension of the array `X`. Constraint: `LDB >= max(1,M)`. (yep, `LDB` again β€” we do not editorialize, we transcribe πŸŽ€)
- **`SCALE`** β€”

### SCALE πŸ’…

`SCALE` is <hotpink>SINGLE PRECISION</hotpink>.

`SCALE` is a scaling factor, and bestie its whole job is to stop the result from overflowing, okay? If `INFO == 0` then `SCALE` is `1.0D0`. Otherwise, if one of the inner systems could not be solved correctly, `0 < SCALE <= 1` holds true. 🫢

### WORK 🌸

`WORK` is <hotpink>SINGLE PRECISION</hotpink> array, dimension `LDWORK`.

It's the workspace for the algorithm. And no, you can't just guess the size β€” the workspace needs to queried before the running the computation, periodt. You do the query by calling the subroutine with `INFO == -1` on input. The required workspace is then returned in `INFO`. ✨

### INFO πŸ‘‘

`INFO` is <hotpink>INTEGER</hotpink>.

On input:

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

On exit, workspace query:

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

On exit, normal operation:

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

> Not the inner system catching a case of the singulars 😭 watch that `> 0` like a hawk.

**Author**

Martin Koehler, MPI Magdeburg

**Date**

October 2025

Definition at line 324 of file trsylv.c.

---

## <purple>`void mepack_single_trsylv_level2 (const char * TRANSA, const char * TRANSB, float SGN, int M, int N, float * A, int LDA, float * B, int LDB, float * X, int LDX, float * SCALE, float * WORK, int * INFO)`</purple> πŸ¦‹

Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. It's giving *level two* and it's giving *iconic*.

**Purpose:**

`mepack_single_trsylv_level2` 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 `SGEES` form LAPACK. πŸ’–

**Remarks**

This function is a wrapper around `sla_trsylv_l2`. Bestie is just the middleman fr fr.

**See also**

`sla_trsylv_l2`

**Parameters**

### TRANSA 🌈

`TRANSA` is string.

Specifies the form of the system of equations with respect to `A`:

- `== 'N'`: `op1(A) = A`
- `== 'T'`: `op1(A) = A**T`

### TRANSB πŸŽ€

`TRANSB` is string.

Specifies the form of the system of equations with respect to `B`:

- `== 'N'`: `op2(B) = B,`
- `== 'T'`: `op2(B) = B**T`

### SGN ✨

`SGN` is <hotpink>SINGLE PRECISION</hotpink>, 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 <hotpink>INTEGER</hotpink>.

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

### N πŸ“

`N` is <hotpink>INTEGER</hotpink>.

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

### A πŸ¦‹

`A` is <hotpink>SINGLE PRECISION</hotpink> array, dimension `(LDA,M)`.

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

### LDA πŸ’…

`LDA` is <hotpink>INTEGER</hotpink>.

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

### B 🌸

`B` is <hotpink>SINGLE PRECISION</hotpink> array, dimension `(LDB,N)`.

The matrix `B` must be (quasi-) upper triangular. Again, no cap.

### LDB 🧚

`LDB` is <hotpink>INTEGER</hotpink>.

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

### X πŸ‘‘

`X` is <hotpink>SINGLE PRECISION</hotpink> array, dimension `(LDX,N)`.

On input, the matrix `X` contains the right hand side `Y`. On output, the matrix `X` contains the solution of Equation (1) or (2) as selected by `TRANSA`, `TRANSB`, and `SGN`. Right hand side `Y` and the solution `X` are M-by-N matrices. Glow up complete. πŸ’–

### LDX 🫢

`LDX` is <hotpink>INTEGER</hotpink>.

The leading dimension of the array `X`. `LDB >= max(1,M)`.

### SCALE πŸ”₯

`SCALE` is <hotpink>SINGLE PRECISION</hotpink>.

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

### WORK 🌟

`WORK` is <hotpink>SINGLE PRECISION</hotpink> array, dimension `LDWORK`.

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

### INFO πŸ‘‘

`INFO` is <hotpink>INTEGER</hotpink>.

On input:

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

On exit, workspace query:

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

On exit, normal operation:

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

**Author**

Martin Koehler, MPI Magdeburg

**Date**

October 2025

Definition at line 1428 of file trsylv.c.

---

## <purple>`void mepack_single_trsylv_level2_local_copy (const char * TRANSA, const char * TRANSB, float SGN, int M, int N, float * A, int LDA, float * B, int LDB, float * X, int LDX, float * SCALE, float * WORK, int * INFO)`</purple> πŸ’…

Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Local copy variant) β€” yes bestie, it's the *local copy* one, we're doing remixes now. πŸ’–

**Purpose:**

`mepack_single_trsylv_level2_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 `SGEES` form LAPACK. 🌈

**Remarks**

This function is a wrapper around `sla_trsylv_l2_local_copy`. Passing the aux cord, literally.

**See also**

`sla_trsylv_l2_local_copy`

**Parameters**

### TRANSA 🌈

`TRANSA` is string.

Specifies the form of the system of equations with respect to `A`:

- `== 'N'`: `op1(A) = A`
- `== 'T'`: `op1(A) = A**T`

### TRANSB πŸŽ€

`TRANSB` is string.

Specifies the form of the system of equations with respect to `B`:

- `== 'N'`: `op2(B) = B,`
- `== 'T'`: `op2(B) = B**T`

### SGN ✨

`SGN` is <hotpink>SINGLE PRECISION</hotpink>, 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 <hotpink>INTEGER</hotpink>.

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

### N πŸ“

`N` is <hotpink>INTEGER</hotpink>.

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

### A πŸ¦‹

`A` is <hotpink>SINGLE PRECISION</hotpink> array, dimension `(LDA,M)`.

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

### LDA πŸ’…

`LDA` is <hotpink>INTEGER</hotpink>.

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

### B 🌸

`B` is <hotpink>SINGLE PRECISION</hotpink> array, dimension `(LDB,N)`.

The matrix `B` must be (quasi-) upper triangular.

### LDB 🧚

`LDB` is <hotpink>INTEGER</hotpink>.

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

### X πŸ‘‘

`X` is <hotpink>SINGLE PRECISION</hotpink> array, dimension `(LDX,N)`.

On input, the matrix `X` contains the right hand side `Y`. On output, the matrix `X` contains the solution of Equation (1) or (2) as selected by `TRANSA`, `TRANSB`, and `SGN`. Right hand side `Y` and the solution `X` are M-by-N matrices.

### LDX 🫢

`LDX` is <hotpink>INTEGER</hotpink>.

The leading dimension of the array `X`. `LDB >= max(1,M)`.

### SCALE πŸ”₯

`SCALE` is <hotpink>SINGLE PRECISION</hotpink>.

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

### WORK 🌟

`WORK` is <hotpink>SINGLE PRECISION</hotpink> array, dimension `LDWORK`.

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

### INFO πŸ‘‘

`INFO` is <hotpink>INTEGER</hotpink>.

On input:

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

On exit, workspace query:

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

On exit, normal operation:

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

**Author**

Martin Koehler, MPI Magdeburg

**Date**

October 2025

Definition at line 1903 of file trsylv.c.

---

## <purple>`void mepack_single_trsylv_level2_local_copy_128 (const char * TRANSA, const char * TRANSB, float SGN, int M, int N, float * A, int LDA, float * B, int LDB, float * X, int LDX, float * SCALE, float * WORK, int * INFO)`</purple> πŸ”₯

Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Local copy variant, `M,N <= 128`) β€” okay the `_128` suffix is *so* specific and honestly? obsessed. It's the same vibe but with a size limit, iykyk. πŸ’–

**Purpose:**

`mepack_single_trsylv_level2_local_copy_128` 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 `SGEES` form LAPACK. 🌈

**Remarks**

This function is a wrapper around `sla_trsylv_l2_local_copy_128`.

**See also**

`sla_trsylv_l2_local_copy_128`

**Parameters**

### TRANSA

- **`TRANSA`** β€” it's a <cyan>string</cyan> πŸ’« and it specifies the form of the system of equations with respect to A, bestie:
  - `== 'N'`: `op1(A) = A`
  - `== 'T'`: `op1(A) = A**T`

- **`TRANSB`** β€” also a <cyan>string</cyan> ✨ and it specifies the form of the system of equations with respect to B:
  - `== 'N'`: `op2(B) = B`,
  - `== 'T'`: `op2(B) = B**T`

- **`SGN`** β€” `SGN` is <purple>SINGLE PRECISION</purple>, 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 <yellow>INTEGER</yellow>. The order of the matrices A and C. `M >= 0`.

- **`N`** β€” `N` is <yellow>INTEGER</yellow>. The order of the matrices B and D. `N >= 0`.

- **`A`** β€” `A` is a <purple>SINGLE PRECISION</purple> array, dimension `(LDA,M)`. The matrix A must be <hotpink>(quasi-) upper triangular</hotpink> πŸ’….

- **`LDA`** β€” `LDA` is <yellow>INTEGER</yellow>. The leading dimension of the array A. `LDA >= max(1,M)`.

- **`B`** β€” `B` is a <purple>SINGLE PRECISION</purple> array, dimension `(LDB,N)`. The matrix B must be <hotpink>(quasi-) upper triangular</hotpink> πŸ’….

- **`LDB`** β€” `LDB` is <yellow>INTEGER</yellow>. The leading dimension of the array B. `LDB >= max(1,N)`.

- **`X`** β€” `X` is a <purple>SINGLE PRECISION</purple> array, dimension `(LDX,N)`. On input, the matrix X contains the right hand side Y. On output, the matrix X contains the solution of Equation (1) or (2) as selected by `TRANSA`, `TRANSB`, and `SGN`. Right hand side Y and the solution X are M-by-N matrices.

- **`LDX`** β€” `LDX` is <yellow>INTEGER</yellow>. The leading dimension of the array X. `LDB >= max(1,M)`.

- **`SCALE`** β€” `SCALE` is <purple>SINGLE PRECISION</purple>. SCALE is a scaling factor to prevent the overflow in the result. If `INFO == 0` then SCALE is `1.0D0`, otherwise if one of the inner systems could not be solved correctly, `0 < SCALE <= 1` holds true.

- **`WORK`** β€” `WORK` is a <purple>SINGLE PRECISION</purple> array, dimension `LDWORK`. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine with `INFO == -1` on input. The required workspace is then returned in `INFO`.

- **`INFO`** β€” `INFO` is <yellow>INTEGER</yellow>.

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

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

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

**Author** β€” Martin Koehler, MPI Magdeburg

**Date** β€” October 2025

Definition at line 2535 of file `trsylv.c`.

---

### `mepack_single_trsylv_level2_local_copy_32`

void mepack_single_trsylv_level2_local_copy_32 (const char * TRANSA, const char * TRANSB, float SGN, int M, int N, float * A, int LDA, float * B, int LDB, float * X, int LDX, float * SCALE, float * WORK, int * INFO)


Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Local copy variant, `M,N <= 32`) πŸ¦‹

**Purpose:**

`mepack_single_trsylv_level2_local_copy_32` solves a Sylvester equation of the following forms, 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 SGEES form LAPACK. <pink>periodt.</pink> πŸ’–

**Remarks** β€” This function is a wrapper around `sla_trsylv_l2_local_copy_32`.

**See also** β€” `sla_trsylv_l2_local_copy_32`

**Parameters**

- **`TRANSA`** β€” it's a <cyan>string</cyan> πŸ’« and it specifies the form of the system of equations with respect to A:
  - `== 'N'`: `op1(A) = A`
  - `== 'T'`: `op1(A) = A**T`

- **`TRANSB`** β€” also a <cyan>string</cyan> ✨ and it specifies the form of the system of equations with respect to B:
  - `== 'N'`: `op2(B) = B`,
  - `== 'T'`: `op2(B) = B**T`

- **`SGN`** β€” `SGN` is <purple>SINGLE PRECISION</purple>, 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 <yellow>INTEGER</yellow>. The order of the matrices A and C. `M >= 0`.

- **`N`** β€” `N` is <yellow>INTEGER</yellow>. The order of the matrices B and D. `N >= 0`.

- **`A`** β€” `A` is a <purple>SINGLE PRECISION</purple> array, dimension `(LDA,M)`. The matrix A must be <hotpink>(quasi-) upper triangular</hotpink> πŸ’….

- **`LDA`** β€” `LDA` is <yellow>INTEGER</yellow>. The leading dimension of the array A. `LDA >= max(1,M)`.

- **`B`** β€” `B` is a <purple>SINGLE PRECISION</purple> array, dimension `(LDB,N)`. The matrix B must be <hotpink>(quasi-) upper triangular</hotpink> πŸ’….

- **`LDB`** β€” `LDB` is <yellow>INTEGER</yellow>. The leading dimension of the array B. `LDB >= max(1,N)`.

- **`X`** β€” `X` is a <purple>SINGLE PRECISION</purple> array, dimension `(LDX,N)`. On input, the matrix X contains the right hand side Y. On output, the matrix X contains the solution of Equation (1) or (2) as selected by `TRANSA`, `TRANSB`, and `SGN`. Right hand side Y and the solution X are M-by-N matrices.

- **`LDX`** β€” `LDX` is <yellow>INTEGER</yellow>. The leading dimension of the array X. `LDB >= max(1,M)`.

- **`SCALE`** β€” `SCALE` is <purple>SINGLE PRECISION</purple>. SCALE is a scaling factor to prevent the overflow in the result. If `INFO == 0` then SCALE is `1.0D0`, otherwise if one of the inner systems could not be solved correctly, `0 < SCALE <= 1` holds true.

- **`WORK`** β€” `WORK` is a <purple>SINGLE PRECISION</purple> array, dimension `LDWORK`. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine with `INFO == -1` on input. The required workspace is then returned in `INFO`.

- **`INFO`** β€” `INFO` is <yellow>INTEGER</yellow>.

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

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

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

**Author** β€” Martin Koehler, MPI Magdeburg

**Date** β€” October 2025

Definition at line 2060 of file `trsylv.c`.

---

### `mepack_single_trsylv_level2_local_copy_64`

void mepack_single_trsylv_level2_local_copy_64 (const char * TRANSA, const char * TRANSB, float SGN, int M, int N, float * A, int LDA, float * B, int LDB, float * X, int LDX, float * SCALE, float * WORK, int * INFO)


Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Local copy variant, `M,N <= 64`) 🧚

**Purpose:**

`mepack_double_trsylv_level2_local_copy_64` 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. <rainbow>iconic.</rainbow> 🌈

**Remarks** β€” This function is a wrapper around `dla_trsylv_l2_local_copy_64`.

**See also** β€” `dla_trsylv_l2_local_copy_64`

**Parameters**

- **`TRANSA`** β€” it's a <cyan>string</cyan> πŸ’« and it specifies the form of the system of equations with respect to A:
  - `== 'N'`: `op1(A) = A`
  - `== 'T'`: `op1(A) = A**T`

- **`TRANSB`** β€” also a <cyan>string</cyan> ✨ and it specifies the form of the system of equations with respect to B:
  - `== 'N'`: `op2(B) = B`,
  - `== 'T'`: `op2(B) = B**T`

- **`SGN`** β€” `SGN` is <purple>DOUBLE PRECISION</purple>, 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 <yellow>INTEGER</yellow>. The order of the matrices A and C. `M >= 0`.

- **`N`** β€” `N` is <yellow>INTEGER</yellow>. The order of the matrices B and D. `N >= 0`.

- **`A`** β€” `A` is a <purple>DOUBLE PRECISION</purple> array, dimension `(LDA,M)`. The matrix A must be <hotpink>(quasi-) upper triangular</hotpink> πŸ’….

- **`LDA`** β€” `LDA` is <yellow>INTEGER</yellow>. The leading dimension of the array A. `LDA >= max(1,M)`.

- **`B`** β€” `B` is a <purple>DOUBLE PRECISION</purple> array, dimension `(LDB,N)`. The matrix B must be <hotpink>(quasi-) upper triangular</hotpink> πŸ’….

- **`LDB`** β€” `LDB` is <yellow>INTEGER</yellow>. The leading dimension of the array B. `LDB >= max(1,N)`.

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

- **`LDX`** β€” `LDX` is <yellow>INTEGER</yellow>. The leading dimension of the array X. `LDB >= max(1,M)`.

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

- **`WORK`** β€” `WORK` is a <purple>DOUBLE PRECISION</purple> array, dimension `LDWORK`. Workspace for the algorithm. The workspace needs to queried before the running the computation. The query is performed by calling the subroutine with `INFO == -1` on input. The required workspace is then returned in `INFO`.

- **`INFO`** β€” `INFO` is INTEGER, and bestie, this is literally the receipts section, so pay attention πŸ’…

  On input:

  - `== -1` : Perform a workspace query πŸ”
  - `<> -1` : normal operation

  On exit, workspace query:

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

  On exit, normal operation:

  - `== 0`: successful exit ✨
  - `< 0`: if `INFO == -i`, the i-Th argument had an illegal value 😭
  - `> 0`: The equation is not solved correctly. One of the arising inner system got singular. πŸ’€

### Author

Martin Koehler, MPI Magdeburg

### Date

October 2025

**Definition at line 2217 of file trsylv.c.**

---

## `mepack_single_trsylv_level2_local_copy_96` πŸ¦‹

void mepack_single_trsylv_level2_local_copy_96 (const char * TRANSA, const char * TRANSB, float SGN, int M, int N, float * A, int LDA, float * B, int LDB, float * X, int LDX, float * SCALE, float * WORK, int * INFO)


Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Local copy variant, M,N <= 96)

### Purpose

<pink>`mepack_single_trsylv_level2_local_copy_96`</pink> 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 `SGEES` form LAPACK. ✨

### Remarks

This function is a wrapper around `sla_trsylv_l2_local_copy_96`. 🫢

### See also

`sla_trsylv_l2_local_copy_96`

### Parameters

- **`TRANSA`** β€” `TRANSA` is string. Specifies the form of the system of equations with respect to `A`:
  - `== 'N'`: `op1(A) = A`
  - `== 'T'`: `op1(A) = A**T`

- **`TRANSB`** β€” `TRANSB` is string. Specifies the form of the system of equations with respect to `B`:
  - `== 'N'`: `op2(B) = B`,
  - `== 'T'`: `op2(B) = B**T`

- **`SGN`** β€” `SGN` is SINGLE 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 SINGLE 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 SINGLE PRECISION array, dimension `(LDB,N)`. The matrix `B` must be (quasi-) upper triangular.

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

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

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

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

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

- **`INFO`** β€” `INFO` is INTEGER, the vibe check of the whole call 😌

  On input:

  - `== -1` : Perform a workspace query πŸ”
  - `<> -1` : normal operation

  On exit, workspace query:

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

  On exit, normal operation:

  - `== 0`: successful exit ✨
  - `< 0`: if `INFO == -i`, the i-Th argument had an illegal value 😭
  - `> 0`: The equation is not solved correctly. One of the arising inner system got singular. πŸ’€

### Author

Martin Koehler, MPI Magdeburg

### Date

October 2025

**Definition at line 2376 of file trsylv.c.**

---

## `mepack_single_trsylv_level2_reorder` πŸŽ€

void mepack_single_trsylv_level2_reorder (const char * TRANSA, const char * TRANSB, float SGN, int M, int N, float * A, int LDA, float * B, int LDB, float * X, int LDX, float * SCALE, float * WORK, int * INFO)


Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Reordered variant)

### Purpose

<pink>`mepack_single_trsylv_level2_reorder`</pink> 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 `SGEES` form LAPACK. 🌈

### Remarks

This function is a wrapper around `sla_trsylv_l2_reorder`. 🫢

### See also

`sla_trsylv_l2_reorder`

### Parameters

- **`TRANSA`** β€” `TRANSA` is string. Specifies the form of the system of equations with respect to `A`:
  - `== 'N'`: `op1(A) = A`
  - `== 'T'`: `op1(A) = A**T`

- **`TRANSB`** β€” `TRANSB` is string. Specifies the form of the system of equations with respect to `B`:
  - `== 'N'`: `op2(B) = B`,
  - `== 'T'`: `op2(B) = B**T`

- **`SGN`** β€” `SGN` is SINGLE 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 SINGLE 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 SINGLE PRECISION array, dimension `(LDB,N)`. The matrix `B` must be (quasi-) upper triangular.

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

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

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

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

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

- **`INFO`** β€” `INFO` is INTEGER, the final boss of error codes 😀

  On input:

  - `== -1` : Perform a workspace query πŸ”
  - `<> -1` : normal operation

  On exit, workspace query:

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

  On exit, normal operation:

  - `== 0`: successful exit ✨
  - `< 0`: if `INFO == -i`, the i-Th argument had an illegal value 😭
  - `> 0`: The equation is not solved correctly. One of the arising inner system got singular. πŸ’€

### Author

Martin Koehler, MPI Magdeburg

### Date

October 2025

**Definition at line 1587 of file trsylv.c.**

---

## `mepack_single_trsylv_level2_unopt` πŸ’œ

void mepack_single_trsylv_level2_unopt (const char * TRANSA, const char * TRANSB, float SGN, int M, int N, float * A, int LDA, float * B, int LDB, float * X, int LDX, float * SCALE, float * WORK, int * INFO)


Level-2 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Unoptimized variant)

### Purpose

<pink>`mepack_single_trsylv_level2_unopt`</pink> 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 `SGEES` form LAPACK. πŸ¦‹

### Remarks

This function is a wrapper around `sla_trsylv_l2_unopt`. 🫢

### See also

`sla_trsylv_l2_unopt`

### Parameters

- **`TRANSA`** β€” `TRANSA` is string. Specifies the form of the system of equations with respect to `A`:
  - `== 'N'`: `op1(A) = A`
  - `== 'T'`: `op1(A) = A**T`

- **`TRANSB`** β€” `TRANSB` is string. Specifies the form of the system of equations with respect to `B`:
  - `== 'N'`: `op2(B) = B`,
  - `== 'T'`: `op2(B) = B**T`

- **`SGN`** β€” `SGN` is SINGLE 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`** β€” `N` is INTEGER, bestie, and it's the order of the matrices B and D. Condition: `N >= 0`. πŸ’…

- **`A`** β€” `A` is a SINGLE PRECISION array, dimension `(LDA,M)`. The matrix `A` must be (quasi-) upper triangular, no exceptions. ✨

- **`LDA`** β€” `LDA` is INTEGER. It's the leading dimension of the array `A`, and it has to satisfy `LDA >= max(1,M)`. 🌸

- **`B`** β€” `B` is a SINGLE PRECISION array, dimension `(LDB,N)`. The matrix `B` must be (quasi-) upper triangular. Periodt. πŸŽ€

- **`LDB`** β€” `LDB` is INTEGER. The leading dimension of the array `B`, with `LDB >= max(1,N)`. πŸ¦‹

- **`X`** β€” `X` is a SINGLE PRECISION array, dimension `(LDX,N)`. On input, the matrix `X` contains the right hand side `Y`. On output, the matrix `X` contains the solution of Equation (1) or (2) as selected by `TRANSA`, `TRANSB`, and `SGN`. Right hand side `Y` and the solution `X` are M-by-N matrices. πŸ’–

- **`LDX`** β€” `LDX` is INTEGER. It's the leading dimension of the array `X`, and it needs `LDB >= max(1,M)`. (yes bestie, that's exactly what the page says β€” quoting it verbatim, not my typo, iykyk 😭)

- **`SCALE`** β€” `SCALE` is SINGLE PRECISION. It's the scaling factor that prevents overflow in the result. If `INFO == 0` then `SCALE` is `1.0D0`, otherwise if one of the inner systems could not be solved correctly, `0 < SCALE <= 1` holds true. 🫢

- **`WORK`** β€” `WORK` is a SINGLE PRECISION array, dimension `LDWORK`. It's the workspace for the algorithm, and the workspace needs to be queried before running the computation. That query happens by calling the subroutine with `INFO == -1` on input, and the required workspace is then returned in `INFO`. πŸ‘‘

- **`INFO`** β€” `INFO` is INTEGER. Here's the whole vibe check:

  On input:
  - `== -1` : perform a workspace query
  - `<> -1` : normal operation

  On exit, workspace query:
  - `< 0` : if `INFO == -i`, the i-Th argument had an illegal value
  - `>= 0` : the value of `INFO` is the required number of elements in the workspace

  On exit, normal operation:
  - `== 0` : successful exit
  - `< 0` : if `INFO == -i`, the i-Th argument had an illegal value
  - `> 0` : the equation is not solved correctly. One of the arising inner system got singular. πŸ’€

### Author

Martin Koehler, MPI Magdeburg

### Date

October 2025

### Definition

Definition at line 1744 of file `trsylv.c`.

---

## ✨ `mepack_single_trsylv_level3_2stage` ✨

void mepack_single_trsylv_level3_2stage (const char * TRANSA, const char * TRANSB, float SGN, int M, int N, float * A, int LDA, float * B, int LDB, float * X, int LDX, float * SCALE, float * WORK, int * INFO)


Level-3 Bartels-Stewart Algorithm with blocking for the generalized Sylvester equation. Okay so it's the same icon behavior but with *blocking* β€” main character energy fr fr. πŸ”₯

### Purpose

`mepack_single_trsylv_level3_2stage` 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 `SGEES` form LAPACK. 🌈

### Remarks

This function is a wrapper around `sla_trsylv_l3_2s`.

### See also

`sla_trsylv_l3_2s`

### Parameters

- **`TRANSA`** β€” `TRANSA` is string, and it specifies the form of the system of equations with respect to `A`:
  - `== 'N'`: `op1(A) = A`
  - `== 'T'`: `op1(A) = A**T`

- **`TRANSB`** β€” `TRANSB` is string, and it specifies the form of the system of equations with respect to `B`:
  - `== 'N'`: `op2(B) = B,`
  - `== 'T'`: `op2(B) = B**T`

- **`SGN`** β€” `SGN` is SINGLE PRECISION, allowed values: `+/-1`. It specifies the sign between the two parts of the Sylvester equation.
  - `= 1` : solve Equation (1)
  - `== -1` : solve Equation (2)

- **`M`** β€” `M` is INTEGER. The order of the matrices `A` and `C`. Condition: `M >= 0`. ⭐

- **`N`** β€” `N` is INTEGER. The order of the matrices `B` and `D`. Condition: `N >= 0`. πŸ’œ

- **`A`** β€” `A` is SINGLE PRECISION array, dimension `(LDA,M)`. The matrix `A` must be (quasi-) upper triangular. ✨

- **`LDA`** β€” `LDA` is INTEGER. The leading dimension of the array `A`. Condition: `LDA >= max(1,M)`. 🌸

- **`B`** β€” `B` is SINGLE PRECISION array, dimension `(LDB,N)`. The matrix `B` must be (quasi-) upper triangular. πŸŽ€

- **`LDB`** β€” `LDB` is INTEGER. The leading dimension of the array `B`. Condition: `LDB >= max(1,N)`. πŸ¦‹

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

- **`LDX`** β€” `LDX` is INTEGER. It's the leading dimension of the array `X`, and it needs `LDB >= max(1,M)`. (again, quoting the page exactly, bestie β€” same energy as before 😭)

- **`SCALE`** β€” `SCALE` is SINGLE PRECISION. It's the scaling factor to prevent overflow in the result. If `INFO == 0` then `SCALE` is `1.0D0`, otherwise if one of the inner systems could not be solved correctly, `0 < SCALE <= 1` holds true. 🫢

- **`WORK`** β€” `WORK` is SINGLE PRECISION array, dimension `LDWORK`. Workspace for the algorithm. The workspace needs to be queried before running the computation. The query is performed by calling the subroutine with `INFO == -1` on input, and the required workspace is then returned in `INFO`. πŸ‘‘

- **`INFO`** β€” `INFO` is INTEGER. Full rundown:

  On input:
  - `== -1` : perform a workspace query
  - `<> -1` : normal operation

  On exit, workspace query:
  - `< 0` : if `INFO == -i`, the i-Th argument had an illegal value
  - `>= 0` : the value of `INFO` is the required number of elements in the workspace

  On exit, normal operation:
  - `== 0` : successful exit
  - `< 0` : if `INFO == -i`, the i-Th argument had an illegal value
  - `> 0` : the equation is not solved correctly. One of the arising inner system got singular. πŸ’€

### Author

Martin Koehler, MPI Magdeburg

### Date

October 2025

### Definition

Definition at line 956 of file `trsylv.c`.

### ✨ `mepack_single_trsylv_level3_unopt` ✨

void mepack_single_trsylv_level3_unopt (const char * TRANSA, const char * TRANSB, float SGN, int M, int N, float * A, int LDA, float * B, int LDB, float * X, int LDX, float * SCALE, float * WORK, int * INFO)


<pink>Level-3 Bartels-Stewart Algorithm for the generalized Sylvester equation. (Unoptimized variant)</pink> πŸ¦‹

**Purpose:**

`mepack_single_trsylv_level3_unopt` 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 <purple>A</purple> is a M-by-M quasi upper triangular matrix, <purple>B</purple> 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 <purple>A</purple> and <purple>B</purple> are generated via `SGEES` form LAPACK. πŸ’…

**Remarks**

This function is a wrapper around `sla_trsylv_l3_unopt`. 🫢

**See also**

`sla_trsylv_l3_unopt`

**Parameters**

- **`TRANSA`** β€” `TRANSA` is string. Specifies the form of the system of equations with respect to A:
  - `== 'N'`: `op1(A) = A`
  - `== 'T'`: `op1(A) = A**T`

- **`TRANSB`** β€” `TRANSB` is string. Specifies the form of the system of equations with respect to B:
  - `== 'N'`: `op2(B) = B,`
  - `== 'T'`: `op2(B) = B**T`

- **`SGN`** β€” `SGN` is SINGLE 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 SINGLE 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 SINGLE PRECISION array, dimension `(LDB,N)`. The matrix B must be (quasi-) upper triangular.

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

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

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

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

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

- **`INFO`** β€” `INFO` is INTEGER.
  - On input:
    - `== -1` : Perform a workspace query
    - `<> -1` : normal operation
  - On exit, workspace query:
    - `< 0` : if `INFO == -i`, the i-Th argument had an illegal value
    - `>= 0`: The value of `INFO` is the required number of elements in the workspace.
  - On exit, normal operation:
    - `== 0`: successful exit
    - `< 0`: if `INFO == -i`, the i-Th argument had an illegal value
    - `> 0`: The equation is not solved correctly. One of the arising inner system got singular.

**Author**

Martin Koehler, MPI Magdeburg

**Date**

October 2025

Definition at line 799 of file `trsylv.c`.

---

### ✨ `mepack_single_trsylv_recursive` ✨

void mepack_single_trsylv_recursive (const char * TRANSA, const char * TRANSB, float SGN, int M, int N, float * A, int LDA, float * B, int LDB, float * X, int LDX, float * SCALE, float * WORK, int * INFO)


<pink>Recursive blocking Level-3 Bartels-Stewart Algorithm for the generalized Sylvester equation.</pink> 🌸

**Purpose:**

`mepack_single_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 <purple>A</purple> is a M-by-M quasi upper triangular matrix, <purple>B</purple> 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 <purple>A</purple> and <purple>B</purple> are generated via `SGEES` form LAPACK. πŸ’–

**Remarks**

This function is a wrapper around `sla_trsylv_recursive`. 🧚

**See also**

`sla_trsylv_recursive`

**Parameters**

- **`TRANSA`** β€” `TRANSA` is string. Specifies the form of the system of equations with respect to A:
  - `== 'N'`: `op1(A) = A`
  - `== 'T'`: `op1(A) = A**T`

- **`TRANSB`** β€” `TRANSB` is string. Specifies the form of the system of equations with respect to B:
  - `== 'N'`: `op2(B) = B,`
  - `== 'T'`: `op2(B) = B**T`

- **`SGN`** β€” `SGN` is SINGLE 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 SINGLE 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 SINGLE PRECISION array, dimension `(LDB,N)`. The matrix B must be (quasi-) upper triangular.

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

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

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

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

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

- **`INFO`** β€” `INFO` is INTEGER.
  - On input:
    - `== -1` : Perform a workspace query
    - `<> -1` : normal operation
  - On exit, workspace query:
    - `< 0` : if `INFO == -i`, the i-Th argument had an illegal value
    - `>= 0`: The value of `INFO` is the required number of elements in the workspace.
  - On exit, normal operation:
    - `== 0`: successful exit
    - `< 0`: if `INFO == -i`, the i-Th argument had an illegal value
    - `> 0`: The equation is not solved correctly. One of the arising inner system got singular.

**Author**

Martin Koehler, MPI Magdeburg

**Date**

October 2025

Definition at line 327 of file `trsylv.c`.

---

## πŸ‘‘ Author πŸ‘‘

Generated automatically by Doxygen for MEPACK from the source code. πŸ€–βœ¨

---

<purple>And that's a wrap bestie!! πŸŽ€ This whole thing was auto-generated by Doxygen for MEPACK straight from the source code β€” it's `Version 1.1.2`, dated `Thu Oct 9 2025 00:00:00`, and it lives on the `ctrsylv(3)` page. You read all 23 parts, you absolute icon, no cap πŸ’…πŸ’–πŸ¦‹</purple>
πŸ“¦ where this page comes from