cggsylv(3)
๐ธ cggsylv โ the C-Interface, bestie ๐
okay so welcome to cggsylv(3) from MEPACK, and yes we're doing the whole thing, no skimming, periodt โจ
๐ NAME ๐
cggsylv โ C-Interface
- C-Interface for generalized Sylvester equations. ๐
โจ SYNOPSIS โจ
๐ซถ Functions
void mepack_double_ggcsylv (const char *FACTA, const char *FACTB, const char *TRANSA, const char *TRANSB, double SGN1, double SGN2, int M, int N, double *A, int LDA, double *B, int LDB, double *C, int LDC, double *D, int LDD, double *QA, int LDQA, double *ZA, int LDZA, double *QB, int LDQB, double *ZB, int LDZB, double *E, int LDE, double *F, int LDF, double *SCALE, double *WORK, size_t LDWORK, int *INFO)
- Frontend for the solution of Coupled Generalized Sylvester Equations. ๐ฅ
void mepack_single_ggcsylv (const char *FACTA, const char *FACTB, const char *TRANSA, const char *TRANSB, float SGN1, float SGN2, int M, int N, float *A, int LDA, float *B, int LDB, float *C, int LDC, float *D, int LDD, float *QA, int LDQA, float *ZA, int LDZA, float *QB, int LDQB, float *ZB, int LDZB, float *E, int LDE, float *F, int LDF, float *SCALE, float *WORK, size_t LDWORK, int *INFO)
- Frontend for the solution of Coupled Generalized Sylvester Equations. ๐ฅ
void mepack_double_ggcsylv_dual (const char *FACTA, const char *FACTB, const char *TRANSA, const char *TRANSB, double SGN1, double SGN2, int M, int N, double *A, int LDA, double *B, int LDB, double *C, int LDC, double *D, int LDD, double *QA, int LDQA, double *ZA, int LDZA, double *QB, int LDQB, double *ZB, int LDZB, double *E, int LDE, double *F, int LDF, double *SCALE, double *WORK, size_t LDWORK, int *INFO)
- Frontend for the solution of the dual Coupled Generalized Sylvester Equations. ๐
void mepack_single_ggcsylv_dual (const char *FACTA, const char *FACTB, const char *TRANSA, const char *TRANSB, float SGN1, float SGN2, int M, int N, float *A, int LDA, float *B, int LDB, float *C, int LDC, float *D, int LDD, float *QA, int LDQA, float *ZA, int LDZA, float *QB, int LDQB, float *ZB, int LDZB, float *E, int LDE, float *F, int LDF, float *SCALE, float *WORK, size_t LDWORK, int *INFO)
- Frontend for the solution of the dual Coupled Generalized Sylvester Equations. ๐
void mepack_double_ggsylv (const char *FACTA, const char *FACTB, const char *TRANSA, const char *TRANSB, double SGN, int M, int N, double *A, int LDA, double *B, int LDB, double *C, int LDC, double *D, int LDD, double *QA, int LDQA, double *ZA, int LDZA, double *QB, int LDQB, double *ZB, int LDZB, double *X, int LDX, double *SCALE, double *WORK, size_t LDWORK, int *INFO)
- Frontend for the solution of Generalized Sylvester Equations. ๐
void mepack_single_ggsylv (const char *FACTA, const char *FACTB, const char *TRANSA, const char *TRANSB, float SGN, int M, int N, float *A, int LDA, float *B, int LDB, float *C, int LDC, float *D, int LDD, float *QA, int LDQA, float *ZA, int LDZA, float *QB, int LDQB, float *ZB, int LDZB, float *X, int LDX, float *SCALE, float *WORK, size_t LDWORK, int *INFO)
- Frontend for the solution of Generalized Sylvester Equations. ๐
void mepack_double_ggcsylv_refine (const char *TRANSA, const char *TRANSB, const char *GUESS, double SGN1, double SGN2, int M, int N, double *A, int LDA, double *B, int LDB, double *C, int LDC, double *D, int LDD, double *R, int LDR, double *L, int LDL, double *E, int LDE, double *F, int LDF, double *AS, int LDAS, double *BS, int LDBS, double *CS, int LDCS, double *DS, int LDDS, double *Q, int LDQ, double *Z, int LDZ, double *U, int LDU, double *V, int LDV, int *MAXIT, double *TAU, double *CONVLOG, double *WORK, size_t LDWORK, int *INFO)
- Iterative Refinement for the Coupled Generalized Sylvester Equations. โจ
void mepack_single_ggcsylv_refine (const char *TRANSA, const char *TRANSB, const char *GUESS, float SGN1, float SGN2, int M, int N, float *A, int LDA, float *B, int LDB, float *C, int LDC, float *D, int LDD, float *R, int LDR, float *L, int LDL, float *E, int LDE, float *F, int LDF, float *AS, int LDAS, float *BS, int LDBS, float *CS, int LDCS, float *DS, int LDDS, float *Q, int LDQ, float *Z, int LDZ, float *U, int LDU, float *V, int LDV, int *MAXIT, float *TAU, float *CONVLOG, float *WORK, size_t LDWORK, int *INFO)
- Iterative Refinement for the Coupled Generalized Sylvester Equations. โจ
void mepack_double_ggcsylv_dual_refine (const char *TRANSA, const char *TRANSB, const char *GUESS, double SGN1, double SGN2, int M, int N, double *A, int LDA, double *B, int LDB, double *C, int LDC, double *D, int LDD, double *R, int LDR, double *L, int LDL, double *E, int LDE, double *F, int LDF, double *AS, int LDAS, double *BS, int LDBS, double *CS, int LDCS, double *DS, int LDDS, double *Q, int LDQ, double *Z, int LDZ, double *U, int LDU, double *V, int LDV, int *MAXIT, double *TAU, double *CONVLOG, double *WORK, size_t LDWORK, int *INFO)
- Iterative Refinement for the dual Coupled Generalized Sylvester Equations. ๐ซ
void mepack_single_ggcsylv_dual_refine (const char *TRANSA, const char *TRANSB, const char *GUESS, float SGN1, float SGN2, int M, int N, float *A, int LDA, float *B, int LDB, float *C, int LDC, float *D, int LDD, float *R, int LDR, float *L, int LDL, float *E, int LDE, float *F, int LDF, float *AS, int LDAS, float *BS, int LDBS, float *CS, int LDCS, float *DS, int LDDS, float *Q, int LDQ, float *Z, int LDZ, float *U, int LDU, float *V, int LDV, int *MAXIT, float *TAU, float *CONVLOG, float *WORK, size_t LDWORK, int *INFO)
- Iterative Refinement for the dual Coupled Generalized Sylvester Equations. ๐ซ
void mepack_double_ggsylv_refine (const char *TRANSA, const char *TRANSB, const char *GUESS, double SGN, int M, int N, double *A, int LDA, double *B, int LDB, double *C, int LDC, double *D, int LDD, double *X, int LDX, double *Y, int LDY, double *AS, int LDAS, double *BS, int LDBS, double *CS, int LDCS, double *DS, int LDDS, double *Q, int LDQ, double *Z, int LDZ, double *U, int LDU, double *V, int LDV, int *MAXIT, double *TAU, double *CONVLOG, double *WORK, size_t LDWORK, int *INFO)
- Iterative Refinement for the Generalized Sylvester Equations. ๐ฆ
void mepack_single_ggsylv_refine (const char *TRANSA, const char *TRANSB, const char *GUESS, float SGN, int M, int N, float *A, int LDA, float *B, int LDB, float *C, int LDC, float *D, int LDD, float *X, int LDX, float *Y, int LDY, float *AS, int LDAS, float *BS, int LDBS, float *CS, int LDCS, float *DS, int LDDS, float *Q, int LDQ, float *Z, int LDZ, float *U, int LDU, float *V, int LDV, int *MAXIT, float *TAU, float *CONVLOG, float *WORK, size_t LDWORK, int *INFO)
- Iterative Refinement for the Generalized Sylvester Equations. ๐ฆ
๐ Detailed Description ๐
C-Interface for generalized Sylvester equations.
So here's the tea โ: the Fortran routines that solve the generalized Sylvester equation with arbitrary coefficients are wrapped in C so you can actually get to them without crying, bestie. The way that these wrapper routines work? Every single one of them is a direct wrapper to the corresponding Fortran subroutine, with no sanity checks โ nope, not one. ๐ Those checks are done by the Fortran routines themselves, so don't come for the wrappers.
The only difference is that the C interface does not allow LAPACK-like work_space queries. Not a vibe, I know. ๐ญ For that, you need to use the mepack_memory_frontend function. iykyk.
๐ Function Documentation ๐
void mepack_double_ggcsylv (const char * FACTA, const char * FACTB, const char * TRANSA, const char * TRANSB, double SGN1, double SGN2, int M, int N, double * A, int LDA, double * B, int LDB, double * C, int LDC, double * D, int LDD, double * QA, int LDQA, double * ZA, int LDZA, double * QB, int LDQB, double * ZB, int LDZB, double * E, int LDE, double * F, int LDF, double * SCALE, double * WORK, size_t LDWORK, int * INFO)
Frontend for the solution of Coupled Generalized Sylvester Equations. ๐ฅ
๐ง Purpose
mepack_double_ggcsylv solves a generalized Sylvester equation of the following forms
op1(A) * R + SGN1 * L * op2(B) = SCALE * E (1)
op1(C) * R + SGN2 * L * op2(D) = SCALE * F
where (A,C) is a M-by-M matrix pencil and (B,D) is a N-by-N matrix pencil. The right hand side (E,F) and the solution (R,L) are M-by-N matrix pencils. The matrix pencils (A,C) and (B,D) can be either given as general unreduced matrices, as generalized Hessenberg form, or in terms of their generalized Schur decomposition. If they are given as general matrices or as a generalized Hessenberg form their generalized Schur decomposition will be computed. ๐
๐ Remarks
- This function is a wrapper for
dla_ggcsylv.
๐ธ See also
dla_ggcsylv
โญ Parameters
FACTAโ bestie, this one is aString, and it Specifies how the matrix pencil(A,C)is given.== 'N':The matrix pencil(A,C)is given as a general matrices and its Schur decompositionA = QA*S*ZA**T,C = QA*R*ZA**Twill be computed.== 'F':The matrix pencil(A,C)is already in generalized Schur form andS,R,QA, andZAare given.== 'H':The matrix pencil(A,C)is given in generalized Hessenberg form and its Schur decompositionA = QA*S*ZA**T,C = QA*R*ZA**Twill be computed.
FACTBโ also aString๐, and it Specifies how the matrix pencil(B,D)is given.== 'N':The matrix pencil(B,D)is given as a general matrices and its Schur decompositionB = QB*U*ZB**T,D = QB*V*ZB**Twill be computed.== 'F':The matrix pencil(B,D)is already in generalized Schur form andU,V,QB, andZBare given.== 'H':The matrix pencil(B,D)is given in generalized Hessenberg form and its Schur decompositionB = QB*U*ZB**T,D = QB*V*ZB**Twill be computed.
TRANSAโStringagain, she's consistent ๐โ๏ธ. Specifies the form of the system of equations with respect toAandC:== 'N':op1(A) = A== 'T':op1(A) = A**T
TRANSBโ you guessed it, aString. โจ Specifies the form of the system of equations with respect toBandD:== 'N':op2(B) = B,== 'T':op2(B) = B**T
SGN1โSGN1is DOUBLE PRECISION, allowed values:+/-1. Specifies the sign between in the first equation.SGN2โSGN2is DOUBLE PRECISION, allowed values:+/-1. Specifies the sign between in the second equation.MโMis INTEGER. The order of the matricesAandC.M >= 0.NโNis INTEGER. The order of the matricesBandD.N >= 0.AโAโ a DOUBLE PRECISION array, dimension(LDA,M). bestie this one's whole personality depends onFACT, so listen up:- If
FACT == "N", the matrixAis a general matrix and it gets overwritten with the (quasi-) upper triangular factorSof the Schur decomposition of(A,C). bye original A ๐ - If
FACT == "F", the matrixAalready contains its (quasi-) upper triangular matrixSof the Schur decomposition of(A,C). - If
FACT == "H", the matrixAis an upper Hessenberg matrix of the generalized Hessenberg form(A,C)and it is overwritten with the (quasi-) upper triangular factorSof the Schur decomposition of(A,C).
- If
LDAโ INTEGER. The leading dimension of the arrayA.LDA >= max(1,M). no cap.Bโ DOUBLE PRECISION array, dimension(LDB,N). same energy, different letter:- If
FACT == "N", the matrixBis a general matrix and it is overwritten with the (quasi-) upper triangular factorUof the Schur decomposition of(B,D). - If
FACT == "F", the matrixBcontains its (quasi-) upper triangular matrixUof the Schur decomposition of(B,D). - If
FACT == "H", the matrixBis an upper Hessenberg matrix of the generalized Hessenberg form(B,D)and it is overwritten with the (quasi-) upper triangular factorUof the Schur decomposition of(B,D).
- If
LDBโ INTEGER. The leading dimension of the arrayB.LDB >= max(1,N).Cโ DOUBLE PRECISION array, dimension(LDC,M):- If
FACT == "N", the matrixCis a general matrix and it is overwritten with the upper triangular factorRof the Schur decomposition of(A,C). - If
FACT == "F", the matrixCcontains its upper triangular matrixRof the Schur decomposition of(A,C). - If
FACT == "H", the matrixCis the upper triangular matrix of the generalized Hessenberg form(A,C)and it is overwritten with the upper triangular factorRof the Schur decomposition of(A,C).
- If
LDCโ INTEGER. The leading dimension of the arrayC.LDC >= max(1,M).Dโ DOUBLE PRECISION array, dimension(LDD,N):- If
FACT == "N", the matrixDis a general matrix and it is overwritten with the upper triangular factorVof the Schur decomposition of(B,D). - If
FACT == "F", the matrixDcontains its upper triangular matrixVof the Schur decomposition of(B,D). - If
FACT == "H", the matrixDis the upper triangular matrix of the generalized Hessenberg form(B,D)and it is overwritten with the upper triangular factorVof the Schur decomposition of(B,D).
- If
LDDโ INTEGER. The leading dimension of the arrayD.LDD >= max(1,N).QAโ DOUBLE PRECISION array, dimension(LDQA,M):- If
FACT == "N", the matrixQAis an emptyM-by-Mmatrix on input and contains the left Schur vectors of(A,C)on output. - If
FACT == "F", the matrixQAcontains the left Schur vectors of(A,C). - If
FACT == "H", the matrixQAis an emptyM-by-Mmatrix on input and contains the left Schur vectors of(A,C)on output.
- If
LDQAโ INTEGER. The leading dimension of the arrayQA.LDQA >= max(1,M).ZAโ DOUBLE PRECISION array, dimension(LDZA,M):- If
FACT == "N", the matrixZAis an emptyM-by-Mmatrix on input and contains the right Schur vectors of(A,C)on output. - If
FACT == "F", the matrixZAcontains the right Schur vectors of(A,C). - If
FACT == "H", the matrixZAis an emptyM-by-Mmatrix on input and contains the right Schur vectors of(A,C)on output.
- If
LDZAโ INTEGER. The leading dimension of the arrayZA.LDZA >= max(1,M).QBโ DOUBLE PRECISION array, dimension(LDQB,N):- If
FACT == "N", the matrixQBis an emptyN-by-Nmatrix on input and contains the left Schur vectors of(B,D)on output. - If
FACT == "F", the matrixQBcontains the left Schur vectors of(B,D). - If
FACT == "H", the matrixQBis an emptyM-by-Mmatrix on input and contains the left Schur vectors of(B,D)on output.
- If
LDQBโ INTEGER. The leading dimension of the arrayQB.LDQB >= max(1,N).ZBโ DOUBLE PRECISION array, dimension(LDZB,N):- If
FACT == "N", the matrixZBis an emptyN-by-Nmatrix on input and contains the right Schur vectors of(B,D)on output. - If
FACT == "F", the matrixZBcontains the right Schur vectors of(B,D). - If
FACT == "H", the matrixZBis an emptyM-by-Mmatrix on input and contains the right Schur vectors of(B,D)on output.
- If
LDZBโ INTEGER. The leading dimension of the arrayZB.LDZB >= max(1,N).Eโ DOUBLE PRECISION array, dimension(LDE,N). On input, the matrixEcontains the right hand sideE. On output, the matrixEcontains the solutionR. glow up moment fr โจLDEโ INTEGER. The leading dimension of the arrayE.LDE >= max(1,M).Fโ DOUBLE PRECISION array, dimension(LDF,N). On input, the matrixFcontains the right hand sideF. On output, the matrixFcontains the solutionL.LDFโ INTEGER. The leading dimension of the arrayF.LDF >= max(1,M).SCALEโ DOUBLE PRECISION.SCALEis a scaling factor to prevent the overflow in the result. IfINFO == 0thenSCALEis1.0D0, otherwise if one of the inner systems could not be solved correctly,0 < SCALE <= 1holds true. she's the safety net bestie, respect her ๐ซถWORKโ DOUBLE PRECISION array, dimension(MAX(1,LDWORK)). Workspace for the algorithm. The optimal workspace is given by\ref mepack_memory_frontend.LDWORKโ INTEGER. Size of the workspace for the algorithm counted in floating point numbers of the actual precision. The C interface does not support the workspace query by settingLDWORK == -1on input. In this case, the\ref mepack_memory_frontendfunction have to be used.INFOโ INTEGER, the receipts:== 0: successful exit ๐= 1:DHGGESfailed= 2:DLA_SORT_GEVfailed= 3: Inner solver failed< 0: ifINFO == -i, the i-Th argument had an illegal value
๐จ Attention
The Fortran/LAPACK-like workspace query with settingLDWORK=-1on input will not work in the C interface. One have to use themepack_memory_frontendfunction for this purpose.
๐ธ Author
Martin Koehler, MPI Magdeburg
๐ Date
October 2025
๐ Definition
At line 318 of file cgsylv.c.
๐ mepack_double_ggcsylv_dual
void mepack_double_ggcsylv_dual (const char * FACTA, const char * FACTB,
const char * TRANSA, const char * TRANSB, double SGN1, double SGN2, int
M, int N, double * A, int LDA, double * B, int LDB, double * C, int LDC,
double * D, int LDD, double * QA, int LDQA, double * ZA, int LDZA,
double * QB, int LDQB, double * ZB, int LDZB, double * E, int LDE,
double * F, int LDF, double * SCALE, double * WORK, size_t LDWORK, int *
INFO)
Frontend for the solution of the dual Coupled Generalized Sylvester Equations. yes she's the dual one, not to be confused, iykyk ๐
โจ Purpose
mepack_double_ggcsylv_dual solves a generalized coupled Sylvester equation of the following form
op1(A)**T * R + op1(C)**T * L = SCALE * E (1)
SGN1 * R * op2(B)**T + SGN2 * L * op2(D)** T = SCALE * F
where A and C are M-by-M matrices and B and D are N-by-N matrices. The right hand sides E, F and the solutions R, L are M-by-N matrices. The equation (1) is the dual to the generalized coupled Sylvester equation
op1(A) * R + SGN1 * L * op2(B) = SCALE * E (2)
op1(C) * R + SGN2 * L * op2(D) = SCALE * F
The equation (1) is the dual one to equation (2) with respect to the underlying linear system. Let Z be the matrix formed by rewriting (2) into its Kronecker form. This yields
| kron(I, op1(A)) SGN1*kron(op2(B)**T, I) | | Vec R | | Vec E |
Z X = | |*| | = | |
| kron(I, op1(C)) SGN2*kron(op2(D)**T, I) | | Vec L | | Vec F |
Regarding Z**T one obtains
| kron(I, op1(A)**T ) kron(I, op1(C)**T) | | Vec R | | Vec E |
Z**T X = | |*| | = | |
| SGN1*kron(op2(B), I) SGN2*kron(op2(D), I) | | Vec L | | Vec F |
which belongs to the Sylvester equation (1). For this reason the parameters TRANSA and TRANSB are expressed in terms of the Sylvester equation (2). the way the transposes just flip the whole narrative ๐ญ
๐ฌ Remarks
This function is a wrapper for dla_ggcsylv_dual.
๐ See also
dla_ggcsylv_dual
๐ Parameters
FACTAโ String. Specifies how the matrix pencil(A,C)is given.== 'N': The matrix pencil(A,C)is given as a general matrices and its Schur decompositionA = QA*S*ZA**T,C = QA*R*ZA**Twill be computed.== 'F': The matrix pencil(A,C)is already in generalized Schur form andS,R,QA, andZAare given.== 'H': The matrix pencil(A,C)is given in generalized Hessenberg form and its Schur decompositionA = QA*S*ZA**T,C = QA*R*ZA**Twill be computed.
FACTBโ String. Specifies how the matrix pencil(B,D)is given.== 'N': The matrix pencil(B,D)is given as a general matrices and its Schur decompositionB = QB*U*ZB**T,D = QB*V*ZB**Twill be computed.== 'F': The matrix pencil(B,D)is already in generalized Schur form andU,V,QB, andZBare given.== 'H': The matrix pencil(B,D)is given in generalized Hessenberg form and its Schur decompositionB = QB*U*ZB**T,D = QB*V*ZB**Twill be computed.
TRANSAโ String. Specifies the form of the system of equations with respect toAandC:== 'N':op1(A) = A== 'T':op1(A) = A**T
TRANSBโ String
TRANSB
TRANSB is a String, bestie, and it tells us the form of the system of equations with respect to B and D:
== 'N': op2(B) = B,
== 'T': op2(B) = B**T
SGN1
SGN1 is DOUBLE PRECISION, allowed values: +/-1. It specifies the sign between in the first equation. That's the vibe โ just a sign flip, but it changes everything. ๐
SGN2
SGN2 is DOUBLE PRECISION, allowed values: +/-1. It specifies the sign between in the second equation. Yes queen, second equation gets her own sign too. โจ
M
M is INTEGER. It's the order of the matrices A and C. And it has to be M >= 0, no cap.
N
N is INTEGER. It's the order of the matrices B and D. Also N >= 0. Iconic symmetry fr fr. ๐ฆ
A
A is a DOUBLE PRECISION array, dimension (LDA,M). What she is depends on FACT, so pay attention bestie:
- If
FACT == "N", the matrixAis a general matrix and it is overwritten with the (quasi-) upper triangular factorSof the Schur decomposition of(A,C). - If
FACT == "F", the matrixAcontains its (quasi-) upper triangular matrixSof the Schur decomposition of(A,C). - If
FACT == "H", the matrixAis an upper Hessenberg matrix of the generalized Hessenberg form(A,C)and it is overwritten with the (quasi-) upper triangular factorSof the Schur decomposition of(A,C).
LDA
LDA is INTEGER โ the leading dimension of the array A. Constraint: LDA >= max(1,M). Don't play with her. ๐
B
B is a DOUBLE PRECISION array, dimension (LDB,N). Again, FACT decides her whole storyline:
- If
FACT == "N", the matrixBis a general matrix and it is overwritten with the (quasi-) upper triangular factorUof the Schur decomposition of(B,D). - If
FACT == "F", the matrixBcontains its (quasi-) upper triangular matrixUof the Schur decomposition of(B,D). - If
FACT == "H", the matrixBis an upper Hessenberg matrix of the generalized Hessenberg form(B,D)and it is overwritten with the (quasi-) upper triangular factorUof the Schur decomposition of(B,D).
LDB
LDB is INTEGER โ the leading dimension of the array B. Constraint: LDB >= max(1,N). โญ
C
C is a DOUBLE PRECISION array, dimension (LDC,M). Three moods, same matrix:
- If
FACT == "N", the matrixCis a general matrix and it is overwritten with the upper triangular factorRof the Schur decomposition of(A,C). - If
FACT == "F", the matrixCcontains its upper triangular matrixRof the Schur decomposition of(A,C). - If
FACT == "H", the matrixCis the upper triangular matrix of the generalized Hessenberg form(A,C)and it is overwritten with the upper triangular factorRof the Schur decomposition of(A,C).
LDC
LDC is INTEGER โ the leading dimension of the array C. Constraint: LDC >= max(1,M). ๐ธ
D
D is a DOUBLE PRECISION array, dimension (LDD,N). And yes, she's got range too:
- If
FACT == "N", the matrixDis a general matrix and it is overwritten with the upper triangular factorVof the Schur decomposition of(B,D). - If
FACT == "F", the matrixDcontains its upper triangular matrixVof the Schur decomposition of(B,D). - If
FACT == "H", the matrixDis the upper triangular matrix of the generalized Hessenberg form(B,D)and it is overwritten with the upper triangular factorVof the Schur decomposition of(B,D).
LDD
LDD is INTEGER โ the leading dimension of the array D. Constraint: LDD >= max(1,N). ๐
QA
QA is a DOUBLE PRECISION array, dimension (LDQA,M). She's all about the left Schur vectors of (A,C):
- If
FACT == "N", the matrixQAis an empty M-by-M matrix on input and contains the left Schur vectors of(A,C)on output. - If
FACT == "F", the matrixQAcontains the left Schur vectors of(A,C). - If
FACT == "H", the matrixQAis an empty M-by-M matrix on input and contains the left Schur vectors of(A,C)on output.
LDQA
LDQA is INTEGER โ the leading dimension of the array QA. Constraint: LDQA >= max(1,M). ๐
ZA
ZA is a DOUBLE PRECISION array, dimension (LDZA,M). Now we're doing right Schur vectors of (A,C), okurrr:
- If
FACT == "N", the matrixZAis an empty M-by-M matrix on input and contains the right Schur vectors of(A,C)on output. - If
FACT == "F", the matrixZAcontains the right Schur vectors of(A,C). - If
FACT == "H", the matrixZAis an empty M-by-M matrix on input and contains the right Schur vectors of(A,C)on output.
LDZA
LDZA is INTEGER โ the leading dimension of the array ZA. Constraint: LDZA >= max(1,M). โจ
QB
QB is a DOUBLE PRECISION array, dimension (LDQB,N). Left Schur vectors of (B,D), bestie:
- If
FACT == "N", the matrixQBis an empty N-by-N matrix on input and contains the left Schur vectors of(B,D)on output. - If
FACT == "F", the matrixQBcontains the left Schur vectors of(B,D). - If
FACT == "H", the matrixQBis an empty M-by-M matrix on input and contains the left Schur vectors of(B,D)on output.
โ ๏ธ heads up: that last FACT == "H" line says M-by-M, not N-by-N. I'm not gonna "fix" it for her โ that's literally what the page says, so it stays. ๐
LDQB
LDQB is INTEGER โ the leading dimension of the array QB. Constraint: LDQB >= max(1,N). ๐
ZB
ZB is a DOUBLE PRECISION array, dimension (LDZB,N). Right Schur vectors of (B,D), periodt:
- If
FACT == "N", the matrixZBis an empty N-by-N matrix on input and contains the right Schur vectors of(B,D)on output. - If
FACT == "F", the matrixZBcontains the right Schur vectors of(B,D). - If
FACT == "H", the matrixZBis an empty M-by-M matrix on input and contains the right Schur vectors of(B,D)on output.
โ ๏ธ same lil' quirk here: FACT == "H" says M-by-M. Copying the page exactly, no edits. ๐
LDZB
LDZB is INTEGER โ the leading dimension of the array ZB. Constraint: LDZB >= max(1,N). ๐ซถ
E
E is a DOUBLE PRECISION array, dimension (LDE,N).
- On input, the matrix
Econtains the right hand sideE. - On output, the matrix
Econtains the solutionR.
LDE
LDE is INTEGER โ the leading dimension of the array E. Constraint: LDE >= max(1,M). ๐ธ
F
F is a DOUBLE PRECISION array, dimension (LDF,N).
- On input, the matrix
Fcontains the right hand sideF. - On output, the matrix
Fcontains the solutionL.
LDF
LDF is INTEGER โ the leading dimension of the array F. Constraint: LDF >= max(1,M). ๐
SCALE
SCALE is DOUBLE PRECISION. She's a scaling factor to prevent the overflow in the result. The tea: 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. So if SCALE is anything but 1, something was lowkey fighting for its life in there. ๐ญ
WORK
WORK is a DOUBLE PRECISION array, dimension (MAX(1,LDWORK)). It's workspace for the algorithm. The optimal workspace is given by \ref mepack_memory_frontend. ๐
LDWORK
LDWORK is INTEGER โ size of the workspace for the algorithm counted in floating point numbers of the actual precision.
๐จ real talk: the C interface does not support the workspace query by settingLDWORK == -1on input. In that case, the\ref mepack_memory_frontendfunction have to be used. No shortcut, bestie.
INFO
INFO is INTEGER. Read her like a mood ring:
== 0: successful exit
= 1: DHGGES failed
= 2: DLA_SORT_GEV failed
= 3: Inner solver failed
< 0: if INFO == -i, the i-Th argument had an illegal value
๐ Attention
The Fortran/LAPACK-like workspace query with setting LDWORK=-1 on input will not work in the C interface. One have to use the mepack_memory_frontend function for this purpose. Don't come for me, I'm just the messenger. ๐
โ๏ธ Author
Martin Koehler, MPI Magdeburg
๐ Date
October 2025
Definition at line 335 of file cgsylv_dual.c.
๐ซ void mepack_double_ggcsylv_dual_refine
void mepack_double_ggcsylv_dual_refine (const char * TRANSA, const char * TRANSB, const char * GUESS, double SGN1, double SGN2, int M, int N, double * A, int LDA, double * B, int LDB, double * C, int LDC, double * D, int LDD, double * R, int LDR, double * L, int LDL, double * E, int LDE, double * F, int LDF, double * AS, int LDAS, double * BS, int LDBS, double * CS, int LDCS, double * DS, int LDDS, double * Q, int LDQ, double * Z, int LDZ, double * U, int LDU, double * V, int LDV, int * MAXIT, double * TAU, double * CONVLOG, double * WORK, size_t LDWORK, int * INFO)
Iterative Refinement for the dual Coupled Generalized Sylvester Equations. She's the glow-up pass, bestie. ๐ง
Purpose:
mepack_double_ggcsylv_dual_refine solves a generalized coupled Sylvester equation of the following form
op1(A)**T * R + op1(C)**T * L = SCALE * E (1)
SGN1 * R * op2(B)**T + SGN2 * L * op2(D)** T = SCALE * F
where A and C are M-by-M matrices and B and D are N-by-N matrices. The right hand sides E, F and the solutions R, L are M-by-N matrices.
The equation (1) is the dual to the generalized coupled Sylvester equation
op1(A) * R + SGN1 * L * op2(B) = SCALE * E (2)
op1(C) * R + SGN2 * L * op2(D) = SCALE * F
The equation (1) is the dual one to equation (2) with respect to the underlying linear system. Let Z be the matrix formed by rewriting (2) into its Kronecker form. This yields
| kron(I, op1(A)) SGN1*kron(op2(B)**T, I) | | Vec R | | Vec E |
Z X = | |*| | = | |
| kron(I, op1(C)) SGN2*kron(op2(D)**T, I) | | Vec L | | Vec F |
Regarding Z**T one obtains
| kron(I, op1(A)**T ) kron(I, op1(C)**T) | | Vec R | | Vec E |
Z**T X = | |*| | = | |
| SGN1*kron(op2(B), I) SGN2*kron(op2(D), I) | | Vec L | | Vec F |
which belongs to the Sylvester equation (1). For this reason the parameters TRANSA and TRANSB are expressed in terms of the Sylvester equation (2). The way that the dual just is the transpose situationโฆ she ate. ๐ฅ
Remarks
This function is a wrapper for dla_ggcsylv_dual_refine.
See also
dla_ggcsylv_dual_refine
Parameters
TRANSA
TRANSA is String. It specifies the form of the system of equations with respect to A and C:
== '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 and D:
== 'N': op2(B) = B,
== 'T': op2(B) = B**T
GUESS
GUESS is String. It specifies whether (R,L) contains an initial guess on input or not:
= 'I': (R,L) contains an initial guess for the solution
== 'N': No initial guess is provided. (R,L) are set to zero.
SGN1โ DOUBLE PRECISION, allowed values:+/-1. It specifies the sign between in the first equation. ๐SGN2โ DOUBLE PRECISION, allowed values:+/-1. It specifies the sign between in the second equation. ๐Mโ INTEGER. The order of the matricesAandC.M >= 0. ๐ฆNโ INTEGER. The order of the matricesBandD.N >= 0. ๐ฆAโ DOUBLE PRECISION array, dimension(LDA,M). The arrayAcontains the original matrixAdefining the equation. ๐LDAโ INTEGER. The leading dimension of the arrayA.LDA >= max(1,M). โจBโ DOUBLE PRECISION array, dimension(LDB,N). The arrayBcontains the original matrixBdefining the equation. ๐LDBโ INTEGER. The leading dimension of the arrayA.LDB >= max(1,N). ngl bestie, the page literally saysAright there and notBโ not me fixing it, we keep it exactly how it's written, periodt. ๐Cโ DOUBLE PRECISION array, dimension(LDC,M). The arrayCcontains the original matrixCdefining the equation. ๐LDCโ INTEGER. The leading dimension of the arrayC.LDC >= max(1,M). โจDโ DOUBLE PRECISION array, dimension(LDD,N). The arrayDcontains the original matrixDdefining the equation. ๐LDDโ INTEGER. The leading dimension of the arrayD.LDD >= max(1,N). โจRโ DOUBLE PRECISION array, dimension(LDR,N). On input, the arrayRcontains the initial guess for the first solution. On output, the arrayRcontains the solutionR. ๐ซถLDRโ INTEGER. The leading dimension of the arrayR.LDR >= max(1,M). โจLโ DOUBLE PRECISION array, dimension(LDL,N). On input, the arrayLcontains the initial guess for the second solution. On output, the arrayLcontains the second solution. ๐ซถLDLโ INTEGER. The leading dimension of the arrayL.LDL >= max(1,M). โจEโ DOUBLE PRECISION array, dimension(LDE,N). On input, the arrayEcontains the right hand sideE. ๐ธLDEโ INTEGER. The leading dimension of the arrayE.LDE >= max(1,M). โจFโ DOUBLE PRECISION array, dimension(LDF,N). On input, the arrayFcontains the right hand sideF. ๐ธLDFโ INTEGER. The leading dimension of the arrayF.LDF >= max(1,M). โจASโ DOUBLE PRECISION array, dimension(LDAS,M). The arrayAScontains the generalized Schur decomposition of theA. ๐ฆLDASโ INTEGER. The leading dimension of the arrayAS.LDAS >= max(1,M). โจBSโ DOUBLE PRECISION array, dimension(LDBS,N). The arrayBScontains the generalized Schur decomposition of theB. ๐ฆLDBSโ INTEGER. The leading dimension of the arrayBS.LDBS >= max(1,N). โจCSโ DOUBLE PRECISION array, dimension(LDC,M). The arrayCScontains the generalized Schur decomposition of theC. ๐ฆLDCSโ INTEGER. The leading dimension of the arrayCS.LDCS >= max(1,M). โจDSโ DOUBLE PRECISION array, dimension(LDDS,N). The arrayDScontains the generalized Schur decomposition of theD. ๐ฆLDDSโ INTEGER. The leading dimension of the arrayDS.LDDS >= max(1,N). โจQโ DOUBLE PRECISION array, dimension(LDQ,M). The arrayQcontains the left generalized Schur vectors for(A,C)as returned byDGGES. ๐LDQโ INTEGER. The leading dimension of the arrayQ.LDQ >= max(1,M). โจZโ DOUBLE PRECISION array, dimension(LDZ,M). The arrayZcontains the right generalized Schur vectors for(A,C)as returned byDGGES. ๐LDZโ INTEGER. The leading dimension of the arrayZ.LDZ >= max(1,M). โจUโ DOUBLE PRECISION array, dimension(LDU,N). The arrayUcontains the left generalized Schur vectors for(B,D)as returned byDGGES. ๐LDUโ INTEGER. The leading dimension of the arrayU.LDU >= max(1,N). โจVโ DOUBLE PRECISION array, dimension(LDV,N). The arrayVcontains the right generalized Schur vectors for(B,D)as returned byDGGES. ๐LDVโ INTEGER. The leading dimension of the arrayV.LDV >= max(1,N). โจMAXITโ INTEGER. On input,MAXITcontains the maximum number of iteration that are performed,MAXIT <= 100. On exit,MAXITcontains the number of iteration steps taken by the algorithm. ๐ฅTAUโ DOUBLE PRECISION. On input,TAUcontains the additional security factor for the stopping criterion, typical values are0.1. On exit,TAUcontains the last relative residual when the stopping criterion got valid. ๐CONVLOGโ DOUBLE PRECISION array, dimension(MAXIT). TheCONVLOGarray contains the convergence history of the iterative refinement.CONVLOG(I)contains the maximum relative residual of both equations before it is solved for theI-Th time. ๐WORKโ DOUBLE PRECISION array, dimension(MAX(1,LDWORK)). Workspace for the algorithm. ๐งฐLDWORKโ INTEGER. Size of the workspace for the algorithm. This can be determined by a call\ref mepack_memory_frontend. ๐งฐINFOโ INTEGER.== 0: Success.> 0: Iteration failed in stepINFO.< 0: ifINFO == -i, thei-Th argument had an illegal value. ๐
๐จ Attention ๐จ
The Fortran/LAPACK-like workspace query with setting LDWORK=-1 on input will not work in the C interface. One have to use the mepack_memory_frontend function for this purpose.
fr fr, do not try the LDWORK=-1 trick here, it's giving C interface and it simply does not go. ๐ญ
โ๏ธ Author
Martin Koehler, MPI Magdeburg ๐
๐ Date
October 2025 ๐
Definition at line 374 of file cgsylv_dual.c.
๐ฆ mepack_double_ggcsylv_refine ๐
Iterative Refinement for the Coupled Generalized Sylvester Equations.
void mepack_double_ggcsylv_refine (const char * TRANSA, const char * TRANSB,
const char * GUESS, double SGN1, double SGN2, int M, int N, double * A,
int LDA, double * B, int LDB, double * C, int LDC, double * D, int LDD,
double * R, int LDR, double * L, int LDL, double * E, int LDE, double *
F, int LDF, double * AS, int LDAS, double * BS, int LDBS, double * CS,
int LDCS, double * DS, int LDDS, double * Q, int LDQ, double * Z, int
LDZ, double * U, int LDU, double * V, int LDV, int * MAXIT, double *
TAU, double * CONVLOG, double * WORK, size_t LDWORK, int * INFO)
โจ Purpose โจ
mepack_double_ggcsylv_refine solves a coupled generalized Sylvester equation of the following forms
op1(A) * R + SGN1 * L * op2(B) = E (1)
op1(C) * R + SGN2 * L * op2(D) = F
with iterative refinement, Thereby (A,C) is a M-by-M matrix pencil and (B,D) is a N-by-N matrix pencil. The right hand side (E,F) and the solution (R,L) are M-by-N matrices. The matrix pencils (A,C) and (B,D) need to be given in the original form as well as in their generalized Schur decomposition since both are required in the iterative refinement procedure. ๐
๐ Remarks ๐
This function is a wrapper for dla_ggcsylv_refine.
๐ See also ๐
dla_ggcsylv_refine
๐ Parameters ๐
TRANSAโ String. Specifies the form of the system of equations with respect toAandC:== 'N':op1(A) = A== 'T':op1(A) = A**T
TRANSBโ String. Specifies the form of the system of equations with respect toBandD:== 'N':op2(B) = B,== 'T':op2(B) = B**T
GUESSโ String. Specifies whether(R,L)contains an initial guess on input or not.= 'I':(R,L)contains an initial guess for the solution== 'N': No initial guess is provided.(R,L)are set to zero.
SGN1โ DOUBLE PRECISION, allowed values:+/-1. Specifies the sign between in the first equation. ๐SGN2โ DOUBLE PRECISION, allowed values:+/-1. Specifies the sign between in the second equation. ๐Mโ INTEGER. The order of the matricesAandC.M >= 0. ๐ฆNโ INTEGER. The order of the matricesBandD.N >= 0. ๐ฆAโ DOUBLE PRECISION array, dimension(LDA,M). The arrayAcontains the original matrixAdefining the equation. ๐LDAโ INTEGER. The leading dimension of the arrayA.LDA >= max(1,M). โจBโ DOUBLE PRECISION array, dimension(LDB,N). The arrayBcontains the original matrixBdefining the equation. ๐LDBโ INTEGER. The leading dimension of the arrayA.LDB >= max(1,N). (yes bestie, again it saysAโ same energy as before, we are NOT editing it, iykyk) ๐Cโ DOUBLE PRECISION array, dimension(LDC,M). The arrayCcontains the original matrixCdefining the equation. ๐LDCโ INTEGER. The leading dimension of the arrayC.LDC >= max(1,M). โจDโ DOUBLE PRECISION array, dimension(LDD,N). The arrayDcontains the original matrixDdefining the equation. ๐LDDโ INTEGER. The leading dimension of the arrayD.LDD >= max(1,N). โจRโ DOUBLE PRECISION array, dimension(LDR,N). On input, the arrayRcontains the initial guess for the first solution. On output, the arrayRcontains the solutionR. ๐ซถLDRโ INTEGER. The leading dimension of the arrayR.LDR >= max(1,M). โจLL(DOUBLE PRECISIONarray, dimension(LDL,N)) โ on the way in,Lis carrying your initial guess for the second solution ๐ซถ. on the way out? it's carrying the actual second solution. character development fr.LDL(INTEGER) โ the leading dimension ofL. rule of the land:LDL >= max(1,M). no exceptions bestie ๐E(DOUBLE PRECISIONarray, dimension(LDE,N)) โ on input,Eholds the right hand sideE. that's it, that's the vibe โจLDE(INTEGER) โ leading dimension ofE. you needLDE >= max(1,M).F(DOUBLE PRECISIONarray, dimension(LDF,N)) โ on input,Fholds the right hand sideF. iconic, no notes ๐ธLDF(INTEGER) โ leading dimension ofF, andLDF >= max(1,M).AS(DOUBLE PRECISIONarray, dimension(LDAS,M)) โAScontains the generalized Schur decomposition of the A. it's giving structured ๐LDAS(INTEGER) โ leading dimension ofAS.LDAS >= max(1,M).BS(DOUBLE PRECISIONarray, dimension(LDBS,N)) โBScontains the generalized Schur decomposition of the B.LDBS(INTEGER) โ leading dimension ofBS.LDBS >= max(1,N).CS(DOUBLE PRECISIONarray, dimension(LDCS,M)) โCScontains the generalized Schur decomposition of the C.LDCS(INTEGER) โ leading dimension ofCS.LDCS >= max(1,M).DS(DOUBLE PRECISIONarray, dimension(LDDS,N)) โDScontains the generalized Schur decomposition of the D.LDDS(INTEGER) โ leading dimension ofDS.LDDS >= max(1,N).Q(DOUBLE PRECISIONarray, dimension(LDQ,M)) โQcontains the left generalized Schur vectors for(A,C)as returned byDGGES. ๐ซLDQ(INTEGER) โ leading dimension ofQ.LDQ >= max(1,M).Z(DOUBLE PRECISIONarray, dimension(LDZ,M)) โZcontains the right generalized Schur vectors for(A,C)as returned byDGGES.LDZ(INTEGER) โ leading dimension ofZ.LDZ >= max(1,M).U(DOUBLE PRECISIONarray, dimension(LDU,N)) โUcontains the left generalized Schur vectors for(B,D)as returned byDGGES.LDU(INTEGER) โ leading dimension ofU.LDU >= max(1,N).V(DOUBLE PRECISIONarray, dimension(LDV,N)) โVcontains the right generalized Schur vectors for(B,D)as returned byDGGES. ๐LDV(INTEGER) โ leading dimension ofV.LDV >= max(1,N).MAXIT(INTEGER) โ okay so on input,MAXITis the maximum number of iterations that get performed, and heads up:MAXIT <= 100๐จ. on exit,MAXITbecomes the number of iteration steps the algorithm actually took. glow-up AND a receipt.TAU(DOUBLE PRECISION) โ on input,TAUis the additional security factor for the stopping criterion, and typical values are0.1. on exit,TAUis the last relative residual from when the stopping criterion got valid. it tells on itself, we love that ๐CONVLOG(DOUBLE PRECISIONarray, dimension(MAXIT)) โ theCONVLOGarray holds the convergence history of the iterative refinement, like a lil diary ๐.CONVLOG(I)contains the maximum relative residual of both equations before it is solved for theI-Th time.WORK(DOUBLE PRECISIONarray, dimension(MAX(1,LDWORK))) โ workspace for the algorithm. the behind-the-scenes bestie.LDWORK(INTEGER) โ the size of the workspace for the algorithm. you can figure this out with a call tomepack_memory_frontend.INFO(INTEGER) โ the verdict โจ== 0: Success ๐> 0: Iteration failed in stepINFO๐< 0: ifINFO == -i, thei-Th argument had an illegal value
๐จ Attention ๐จ
The Fortran/LAPACK-like workspace query with setting LDWORK=-1 on input will not work in the C interface. One have to use the mepack_memory_frontend function for this purpose.
bestie listen. theLDWORK=-1trick? it does NOT work here. do not try it. callmepack_memory_frontendinstead. periodt ๐
๐ธ Author ๐ธ
Martin Koehler, MPI Magdeburg
๐ Date ๐
October 2025
Definition at line 353 of file cgsylv.c.
โจ mepack_double_ggsylv โจ
void mepack_double_ggsylv (const char * FACTA, const char * FACTB, const
char * TRANSA, const char * TRANSB, double SGN, int M, int N, double *
A, int LDA, double * B, int LDB, double * C, int LDC, double * D, int
LDD, double * QA, int LDQA, double * ZA, int LDZA, double * QB, int
LDQB, double * ZB, int LDZB, double * X, int LDX, double * SCALE, double
* WORK, size_t LDWORK, int * INFO)
Frontend for the solution of Generalized Sylvester Equations. main character energy honestly ๐
Purpose
mepack_double_ggsylv solves a generalized Sylvester equation of the following forms
op1(A) * X * op2(B) + op1(C) * X * op2(D) = SCALE * Y (1)
or
op1(A) * X * op2(B) - op1(C) * X * op2(D) = SCALE * Y (2)
where (A,C) is a M-by-M matrix pencil and (B,D) is a N-by-N matrix pencil. The right hand side Y and the solution X M-by-N matrices. The matrix pencils (A,C) and (B,D) can be either given as general unreduced matrices, as generalized Hessenberg form, or in terms of their generalized Schur decomposition. If they are given as general matrices or as a generalized Hessenberg form their generalized Schur decomposition will be computed. ๐ฅ
Remarks
This function is a wrapper for dla_ggsylv.
See also
dla_ggsylv
Parameters
FACTA(String) โ Specifies how the matrix pencil(A,C)is given. ๐ฆ== 'N': The matrix pencil(A,C)is given as a general matrices and its Schur decompositionA = QA*S*ZA**T,C = QA*R*ZA**Twill be computed.== 'F': The matrix pencil(A,C)is already in generalized Schur form andS,R,QA, andZAare given.== 'H': The matrix pencil(A,C)is given in generalized Hessenberg form and its Schur decompositionA = QA*S*ZA**T,C = QA*R*ZA**Twill be computed.
FACTB(String) โ Specifies how the matrix pencil(B,D)is given. ๐ซ== 'N': The matrix pencil(B,D)is given as a general matrices and its Schur decompositionB = QB*U*ZB**T,D = QB*V*ZB**Twill be computed.== 'F': The matrix pencil(B,D)is already in generalized Schur form andU,V,QB, andZBare given.== 'H': The matrix pencil(B,D)is given in generalized Hessenberg form and its Schur decompositionB = QB*U*ZB**T,D = QB*V*ZB**Twill be computed.
TRANSA(String) โ Specifies the form of the system of equations with respect toAandC๐== 'N':op1(A) = A== 'T':op1(A) = A**T
TRANSB(String) โ Specifies the form of the system of equations with respect toBandD:== 'N':op2(B) = B,== 'T':op2(B) = B**T
SGN(DOUBLE PRECISION, allowed values:+/-1) โ Specifies the sign between the two parts of the Sylvester equation. โจ= 1: Solve Equation(1)== -1: Solve Equation(2)
M(INTEGER) โ The order of the matricesAandC.M >= 0.N(INTEGER) โ The order of the matricesBandD.N >= 0.A(DOUBLE PRECISIONarray, dimension(LDA,M)) โ ๐ง- If
FACT == "N", the matrixAis a general matrix and it is overwritten with the (quasi-) upper triangular factorSof the Schur decomposition of(A,C). - If
FACT == "F", the matrixAcontains its (quasi-) upper triangular matrixSof the Schur decomposition of(A,C). - If
FACT == "H", the matrixAis an upper Hessenberg matrix of the generalized Hessenberg form(A,C)and it is overwritten with the (quasi-) upper triangular factorSof the Schur decomposition of(A,C).
- If
LDA(INTEGER) โ The leading dimension of the arrayA.LDA >= max(1,M).B(DOUBLE PRECISIONarray, dimension(LDB,N)) โ ๐- If
FACT == "N", the matrixBis a general matrix and it is overwritten with the (quasi-) upper triangular factorUof the Schur decomposition of(B,D). - If
FACT == "F", the matrixBcontains its (quasi-) upper triangular matrixUof the Schur decomposition of(B,D). - If
FACT == "H", the matrixBis an upper Hessenberg matrix of the generalized Hessenberg form(B,D)and it is overwritten with the (quasi-) upper triangular factorUof the Schur decomposition of(B,D).
- If
LDB(INTEGER) โ The leading dimension of the arrayB.LDB >= max(1,N).C(DOUBLE PRECISIONarray, dimension(LDC,M)) โ ๐- If
FACT == "N", the matrixCis a general matrix and it is overwritten with the upper triangular factorRof the Schur decomposition of(A,C). - If
FACT == "F", the matrixCcontains its upper triangular matrixRof the Schur decomposition of(A,C). - If
FACT == "H", the matrixCis the upper triangular matrix of the generalized Hessenberg form(A,C)and it is overwritten with the upper triangular factorRof the Schur decomposition of(A,C).
- If
LDC(INTEGER) โ The leading dimension of the arrayC.LDC >= max(1,M).DDโ DOUBLE PRECISION array, dimension(LDD,N).- If
FACT == "N",Dis a general matrix and it gets overwritten with the upper triangular factorVof the Schur decomposition of(B,D). - If
FACT == "F",Dalready contains its upper triangular matrixVof the Schur decomposition of(B,D). - If
FACT == "H",Dis the upper triangular matrix of the generalized Hessenberg form(B,D)and it gets overwritten with the upper triangular factorVof the Schur decomposition of(B,D).
- If
LDDโ INTEGER. The leading dimension of the arrayD.LDD >= max(1,N). ๐QAโ DOUBLE PRECISION array, dimension(LDQA,M).- If
FACT == "N",QAis an empty M-by-M matrix on input and holds the left Schur vectors of(A,C)on output. - If
FACT == "F",QAalready contains the left Schur vectors of(A,C). - If
FACT == "H",QAis an empty M-by-M matrix on input and holds the left Schur vectors of(A,C)on output.
- If
LDQAโ INTEGER. The leading dimension of the arrayQA.LDQA >= max(1,M). โจZAโ DOUBLE PRECISION array, dimension(LDZA,M).- If
FACT == "N",ZAis an empty M-by-M matrix on input and holds the right Schur vectors of(A,C)on output. - If
FACT == "F",ZAalready contains the right Schur vectors of(A,C). - If
FACT == "H",ZAis an empty M-by-M matrix on input and holds the right Schur vectors of(A,C)on output.
- If
LDZAโ INTEGER. The leading dimension of the arrayZA.LDZA >= max(1,M). ๐ฆQBโ DOUBLE PRECISION array, dimension(LDQB,N).- If
FACT == "N",QBis an empty N-by-N matrix on input and holds the left Schur vectors of(B,D)on output. - If
FACT == "F",QBalready contains the left Schur vectors of(B,D). - If
FACT == "H",QBis an empty M-by-M matrix on input and holds the left Schur vectors of(B,D)on output.
- If
okay bestie keep your eyes peeled ๐ โ yes, that last one really does sayM-by-M, notN-by-N. That's straight from the source, no cap. Not my typo, not your typo, we just report it. ๐ซถ
LDQBโ INTEGER. The leading dimension of the arrayQB.LDQB >= max(1,N). ๐ZBโ DOUBLE PRECISION array, dimension(LDZB,N).- If
FACT == "N",ZBis an empty N-by-N matrix on input and holds the right Schur vectors of(B,D)on output. - If
FACT == "F",ZBalready contains the right Schur vectors of(B,D). - If
FACT == "H",ZBis an empty M-by-M matrix on input and holds the right Schur vectors of(B,D)on output.
- If
LDZBโ INTEGER. The leading dimension of the arrayZB.LDZB >= max(1,N). ๐ธXโ DOUBLE PRECISION array, dimension(LDX,N).- On input,
Xholds the right hand sideY. - On output,
Xholds the solution of Equation (1) or (2). - Right hand side
Yand the solutionXare M-by-N matrices. ๐
- On input,
LDXโ INTEGER. The leading dimension of the arrayX.LDX >= max(1,M). ๐SCALEโ DOUBLE PRECISION. It's the scaling factor that keeps the result from overflowing, bestie โ it's literally here to protect your numbers. IfINFO == 0thenSCALEis1.0D0, otherwise if one of the inner systems couldn't be solved correctly,0 < SCALE <= 1holds true. ๐ญWORKโ DOUBLE PRECISION array, dimension(MAX(1,LDWORK)). Workspace for the algorithm. The optimal workspace is given by \ref mepack_memory_frontend. โจLDWORKโ INTEGER. Size of the workspace for the algorithm, counted in floating point numbers of the actual precision. The C interface does not support the workspace query by settingLDWORK == -1on input. In that case, you have to use the \ref mepack_memory_frontend function. ๐INFOโ INTEGER, the receipts:== 0: successful exit ๐= 1:DHGGESfailed= 2:DLA_SORT_GEVfailed= 3: Inner solver failed< 0: ifINFO == -i, the i-Th argument had an illegal value ๐
Attention ๐
The Fortran/LAPACK-like workspace query with setting LDWORK=-1 on input will not work in the C interface. One has to use the mepack_memory_frontend function for this purpose.
fr fr, do not try the -1 trick here, it will not slay, it will simply not work. ๐ซ
Author โ๏ธ
Martin Koehler, MPI Magdeburg
Date ๐
October 2025
Definition at line 303 of file ggsylv.c.
void mepack_double_ggsylv_refine (const char * TRANSA, const char * TRANSB,
const char * GUESS, double SGN, int M, int N, double * A, int LDA,
double * B, int LDB, double * C, int LDC, double * D, int LDD, double *
X, int LDX, double * Y, int LDY, double * AS, int LDAS, double * BS, int
LDBS, double * CS, int LDCS, double * DS, int LDDS, double * Q, int LDQ,
double * Z, int LDZ, double * U, int LDU, double * V, int LDV, int *
MAXIT, double * TAU, double * CONVLOG, double * WORK, size_t LDWORK, int
* INFO)
Iterative Refinement for the Generalized Sylvester Equations. โจ๐
Purpose:
mepack_double_ggsylv_refine solves a generalized Sylvester equation of the following forms
op1(A) * X * op2(B) + SGN * op1(C) * X * op2(D) = Y (1)
with iterative refinement. Thereby (A,C) is a M-by-M matrix pencil and (B,D) is a N-by-N matrix pencil. The right hand side Y and the solution X are M-by-N matrices.
The matrix pencils (A,C) and (B,D) need to be given in the original form as well as in their generalized Schur decomposition, since both are required in the iterative refinement procedure. Like, you can't skip one, bestie, they both pull their weight. ๐ซถ
Remarks
This function is a wrapper for dla_ggsylv_refine. ๐ซ
See also
dla_ggsylv_refine
Parameters
TRANSAโ String. Specifies the form of the system of equations with respect toAandC:== 'N':op1(A) = A== 'T':op1(A) = A**T
TRANSBโ String. Specifies the form of the system of equations with respect toBandD:== 'N':op2(B) = B,== 'T':op2(B) = B**T
GUESSโ String. Specifies whetherXcontains an initial guess on input or not.= 'I':Xcontains an initial guess for the solution== 'N': No initial guess is provided.Xis set to zero. ๐
SGNโ DOUBLE PRECISION, allowed values:+/-1. Specifies the sign between in the first equation. ๐Mโ INTEGER. The order of the matricesAandC.M >= 0.Nโ INTEGER. The order of the matricesBandD.N >= 0.Aโ DOUBLE PRECISION array, dimension(LDA,M). The arrayAcontains the original matrixAdefining the equation.LDAโ INTEGER. The leading dimension of the arrayA.LDA >= max(1,M).Bโ DOUBLE PRECISION array, dimension(LDB,N). The arrayBcontains the original matrixBdefining the equation.LDBโ INTEGER. The leading dimension of the arrayB.LDB >= max(1,N).Cโ DOUBLE PRECISION array, dimension(LDC,M). The arrayCcontains the original matrixCdefining the equation.LDCโ INTEGER. The leading dimension of the arrayC.LDC >= max(1,M).Dโ DOUBLE PRECISION array, dimension(LDD,N). The arrayDcontains the original matrixDdefining the equation.LDDโ INTEGER. The leading dimension of the arrayD.LDD >= max(1,N).Xโ DOUBLE PRECISION array, dimension(LDX,N).- On input, the array
Xcontains the initial guess. - On output, the array
Xcontains the solutionX. โจ
- On input, the array
LDXโ INTEGER. The leading dimension of the arrayX.LDX >= max(1,M).Yโ DOUBLE PRECISION array, dimension(LDY,N). On input, the arrayYcontains the right hand side.LDYโ INTEGER. The leading dimension of the arrayY.LDY >= max(1,M).ASโ DOUBLE PRECISION array, dimension(LDAS,M). The arrayAScontains the generalized Schur decomposition of theA.LDASโ INTEGER. The leading dimension of the arrayAS.LDAS >= max(1,M).BSโ DOUBLE PRECISION array, dimension(LDBS,N). The arrayBScontains the generalized Schur decomposition of theB.LDBSโ INTEGER. The leading dimension of the arrayBS.LDBS >= max(1,N).CSโ DOUBLE PRECISION array, dimension(LDCS,M). The arrayCScontains the generalized Schur decomposition of theC.LDCSโ INTEGER. The leading dimension of the arrayCS.LDCS >= max(1,M).DSโ DOUBLE PRECISION array, dimension(LDDS,N). The arrayDScontains the generalized Schur decomposition of theD.LDDSโ INTEGER. The leading dimension of the arrayDS.LDDS >= max(1,N).Qโ DOUBLE PRECISION array, dimension(LDQ,M). The arrayQcontains the left generalized Schur vectors for(A,C)as returned byDGGES.LDQโ INTEGER. The leading dimension of the arrayQ.LDQ >= max(1,M).Zโ DOUBLE PRECISION array, dimension(LDZ,M). The arrayZcontains the right generalized Schur vectors for(A,C)as returned byDGGES.LDZโ INTEGER. The leading dimension of the arrayZ.LDZ >= max(1,M).Uโ DOUBLE PRECISION array, dimension(LDU,N). The arrayUcontains the left generalized Schur vectors for(B,D)as returned byDGGES.LDUโ INTEGER. The leading dimension of the arrayU.LDU >= max(1,N).Vโ ๐ธ to be continued, bestie...
V โ V is a DOUBLE PRECISION array, dimension (LDV,N). She's holding the right generalized Schur vectors for (B,D), literally exactly as DGGES handed them over. no editing, no vibes, just receipts. ๐
LDV
LDV is INTEGER. It's the leading dimension of the array V, and LDV >= max(1,N). that's the rule, bestie, don't fight it.
MAXIT
MAXIT is INTEGER.
- On input,
MAXITcontains the maximum number of iteration that are performed,MAXIT <= 100 - On exit,
MAXITcontains the number of iteration steps taken by the algorithm
so it comes in as a limit and leaves as a flex. ๐
TAU
TAU is DOUBLE PRECISION.
- On input,
TAUcontains the additional security factor for the stopping criterion, typical values are0.1 - On exit,
TAUcontains the last relative residual when the stopping criterion got valid
she's giving "before and after" โจ
CONVLOG
CONVLOG is DOUBLE PRECISION array, dimension (MAXIT). The CONVLOG array contains the convergence history of the iterative refinement. CONVLOG(I) contains the maximum relative residual before it is solved for the I-Th time. it's the diary, the group chat scrollback, the whole storyline ๐ธ
WORK
WORK is DOUBLE PRECISION array, dimension (MAX(1,LDWORK)). Workspace for the algorithm. just the little backstage area, yk? ๐
LDWORK
LDWORK is INTEGER. Size of the workspace for the algorithm. This can be determined by a call to mepack_memory_frontend. ๐ซถ
INFO
INFO is INTEGER.
== 0: Success ๐> 0: Iteration failed in stepINFO< 0: ifINFO == -i, the i-Th argument had an illegal value
โ ๏ธ Attention โ ๏ธ
The Fortran/LAPACK-like workspace query with setting LDWORK=-1 on input will not work in the C interface. One have to use the mepack_memory_frontend function for this purpose.
bestie. i am begging. theLDWORK=-1trick? iconic in Fortran, absolutely does NOT hit in C. usemepack_memory_frontendinstead, periodt. ๐ซ
๐ซถ Author ๐ซถ
Martin Koehler, MPI Magdeburg
๐ Date ๐
October 2025
Definition at line 324 of file ggsylv.c.
๐ฆ void mepack_single_ggcsylv ๐ฆ
void mepack_single_ggcsylv (const char * FACTA, const char * FACTB, const
char * TRANSA, const char * TRANSB, float SGN1, float SGN2, int M, int
N, float * A, int LDA, float * B, int LDB, float * C, int LDC, float *
D, int LDD, float * QA, int LDQA, float * ZA, int LDZA, float * QB, int
LDQB, float * ZB, int LDZB, float * E, int LDE, float * F, int LDF,
float * SCALE, float * WORK, size_t LDWORK, int * INFO)
Frontend for the solution of Coupled Generalized Sylvester Equations. ๐
โจ Purpose โจ
mepack_single_ggcsylv solves a generalized Sylvester equation of the following forms
op1(A) * R + SGN1 * L * op2(B) = SCALE * E (1)
op1(C) * R + SGN2 * L * op2(D) = SCALE * F
where (A,C) is a M-by-M matrix pencil and (B,D) is a N-by-N matrix pencil. The right hand side (E,F) and the solution (R,L) M-by-N matrices. The matrix pencils (A,C) and (B,D) can be either given as general unreduced matrices, as generalized Hessenberg form, or in terms of their generalized Schur decomposition. If they are given as general matrices or as a generalized Hessenberg form their generalized Schur decomposition will be computed. ๐ฆ
๐ Remarks ๐
This function is a wrapper for sla_ggcsylv.
๐ See also ๐
sla_ggcsylv
๐ Parameters ๐
FACTA
FACTA is String. Specifies how the matrix pencil (A,C) is given.
== 'N': The matrix pencil(A,C)is given as a general matrices and its Schur decompositionA = QA*S*ZA**T,C = QA*R*ZA**Twill be computed.== 'F': The matrix pencil(A,C)is already in generalized Schur form andS,R,QA, andZAare given.== 'H': The matrix pencil(A,C)is given in generalized Hessenberg form and its Schur decompositionA = QA*S*ZA**T,C = QA*R*ZA**Twill be computed.
FACTB
FACTB is String. Specifies how the matrix pencil (B,D) is given.
== 'N': The matrix pencil(B,D)is given as a general matrices and its Schur decompositionB = QB*U*ZB**T,D = QB*V*ZB**Twill be computed.== 'F': The matrix pencil(B,D)is already in generalized Schur form andU,V,QB, andZBare given.== 'H': The matrix pencil(B,D)is given in generalized Hessenberg form and its Schur decompositionB = QB*U*ZB**T,D = QB*V*ZB**Twill be computed.
TRANSA
TRANSA is String. Specifies the form of the system of equations with respect to A and C:
== '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 and D:
== 'N':op2(B) = B,== 'T':op2(B) = B**T
SGN1
SGN1 is DOUBLE PRECISION, allowed values: +/-1. Specifies the sign between in the first equation. ๐
SGN2
SGN2 is DOUBLE PRECISION, allowed values: +/-1. Specifies the sign between in the second equation. ๐
M
M is INTEGER. The order of the matrices A and C. 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).
- If
FACT == "N", the matrixAis a general matrix and it is overwritten with the (quasi-) upper triangular factorSof the Schur decomposition of(A,C). - If
FACT == "F", the matrixAcontains its (quasi-) upper triangular matrixSof the Schur decomposition of(A,C). - If
FACT == "H", the matrixAis an upper Hessenberg matrix of the generalized Hessenberg form(A,C)and it is overwritten with the (quasi-) upper triangular factorSof the Schur decomposition of(A,C).
LDA
LDA is INTEGER. The leading dimension of the array A. LDA >= max(1,M).
B
B is DOUBLE PRECISION array, dimension (LDB,N).
- If
FACT == "N", the matrixBis a general matrix and it is overwritten with the (quasi-) upper triangular factorUof the Schur decomposition of(B,D). - If
FACT == "F", the matrixBcontains its (quasi-) upper triangular matrixUof the Schur decomposition of(B,D). - If
FACT == "H", the matrixBis an upper Hessenberg matrix of the generalized Hessenberg form(B,D)and it is overwritten with the (quasi-) upper triangular factorUof the Schur decomposition of(B,D).
LDB
LDB is INTEGER. The leading dimension of the array B. LDB >= max(1,N).
C
C is DOUBLE PRECISION array, dimension (LDC,M).
- If
FACT == "N", the matrixCis a general matrix and it is overwritten with the upper triangular factorRof the Schur decomposition of(A,C). - If
FACT == "F", the matrixCcontains its upper triangular matrixRof the Schur decomposition of(A,C). - If
FACT == "H", the matrixCis the upper triangular matrix of the generalized Hessenberg form(A,C)and it is overwritten with the upper triangular factorRof the Schur decomposition of(A,C).
LDC
LDC is INTEGER. The leading dimension of the array C. LDC >= max(1,M).
D
D is DOUBLE PRECISION array, dimension (LDD,N).
- If
FACT == "N", the matrixDis a general matrix and it is overwritten with the upper triangular factorVof the Schur decomposition of(B,D). - If
FACT == "F", the matrixDcontains its upper triangular matrixVof the Schur decomposition of(B,D). - If
FACT == "H", the matrixDis the upper triangular matrix of the generalized Hessenberg form(B,D)and it is overwritten with the upper triangular factorVof the Schur decomposition of(B,D).
LDD
LDD is INTEGER. The leading dimension of the array D. LDD >= max(1,N).
QA
QA is DOUBLE PRECISION array, dimension (LDQA,M).
- If
FACT == "N", the matrixQAis an empty M-by-M matrix on input and contains the left Schur vectors of(A,C)on output. - If
FACT == "F", the matrixQAcontains the left Schur vectors of(A,C). - If
FACT == "H", the matrixQAis an empty M-by-M matrix on input and contains the left Schur vectors of(A,C)on output.
LDQA
LDQA is INTEGER. The leading dimension of the array QA. LDQA >= max(1,M).
ZA
ZA is DOUBLE PRECISION array, dimension (LDZA,M).
- If
FACT == "N", the matrixZAis an empty M-by-M matrix on input and contains the right Schur vectors of(A,C)on output. - If
FACT == "F", the matrixZAcontains the right Schur vectors of(A,C). - If
FACT == "H", the matrixZAis an empty M-by-M matrix on input and contains the right Schur vectors of(A,C)on output.
LDZA
LDZA is INTEGER. The leading dimension of the array ZA. LDZA >= max(1,M).
QB
QB is DOUBLE PRECISION array, dimension (LDQB,M).
- If
FACT == "N", the matrixQBis an empty M-by-M matrix on input and contains the left Schur vectors of(B,D)on output. - If
FACT == "F", the matrixQBcontains the left Schur vectors of(B,D). - If
FACT == "H", the matrixQBis an empty M-by-M matrix on input and contains the left Schur vectors of(B,D)on output.
LDQB
LDQB is INTEGER. The leading dimension of the array QB. LDQB >= max(1,M).
ZB
ZB is DOUBLE PRECISION array, dimension (LDZB,M).
- If
FACT == "N", the matrixZBis an empty M-by-M matrix on input and contains the right Schur vectors of(B,D)on output. - If
FACT == "F", the matrixZBcontains the right Schur vectors of(B,D). - If
FACT == "H", the matrixZBis an empty M-by-M matrix on input and contains the right Schur vectors of(B,D)on output.
LDZB
LDZB is INTEGER. The leading dimension of the array ZB. LDZB >= max(1,M).
E
E is DOUBLE PRECISION array, dimension (LDE,N).
- On input, the matrix
Econtains the right hand sideE. - On output, the matrix
Econtains the solutionR.
the glow-up is real, she literally becomes the answer โจ
LDE
LDE is INTEGER. The leading dimension of the array X. LDE >= max(1,M).
F
so F, right โ it's a DOUBLE PRECISION array, dimension (LDF,N). ๐
On input, the matrix F contains the right hand side F. On output, that very same matrix F contains the solution L. yes bestie, same array, it gets overwritten โ that's just the vibe ๐
LDF
LDF is INTEGER. It's the leading dimension of the array X. LDF >= max(1,M). (it says X, no we're not fixing it, it literally says X, iykyk ๐)
SCALE
SCALE is DOUBLE PRECISION.
SCALE is a scaling factor whose whole entire job is to prevent overflow in the result ๐ซถ. If INFO == 0 then SCALE is 1.0D0. Otherwise, if one of the inner systems could not be solved correctly, then 0 < SCALE <= 1 holds true.
WORK
WORK is a DOUBLE PRECISION array, dimension (MAX(1,LDWORK)). It's the workspace for the algorithm, and the optimal workspace is handed to you by \ref mepack_memory_frontend. โจ
LDWORK
LDWORK is INTEGER. It's the size of the workspace for the algorithm, counted in floating point numbers of the actual precision.
The C interface does not support the workspace query by settingLDWORK == -1on input. In that case you have to use the\ref mepack_memory_frontendfunction instead. fr fr.
INFO
INFO is INTEGER:
== 0: successful exit ๐= 1:DHGGESfailed ๐ญ= 2:DLA_SORT_GEVfailed ๐ญ= 3: Inner solver failed ๐ญ< 0: ifINFO == -i, the i-Th argument had an illegal value ๐
Attention ๐จ
The Fortran/LAPACK-like workspace query with setting LDWORK=-1 on input will not work in the C interface. One has to use the mepack_memory_frontend function for this purpose. periodt.
Author ๐
Martin Koehler, MPI Magdeburg
Date ๐๏ธ
October 2025
Definition at line 644 of file cgsylv.c.
mepack_single_ggcsylv_dual ๐
void mepack_single_ggcsylv_dual (const char * FACTA, const char * FACTB,
const char * TRANSA, const char * TRANSB, float SGN1, float SGN2, int M,
int N, float * A, int LDA, float * B, int LDB, float * C, int LDC, float
* D, int LDD, float * QA, int LDQA, float * ZA, int LDZA, float * QB,
int LDQB, float * ZB, int LDZB, float * E, int LDE, float * F, int LDF,
float * SCALE, float * WORK, size_t LDWORK, int * INFO)
Frontend for the solution of the dual Coupled Generalized Sylvester Equations. bestie this one's the single precision sibling and it's lowkey iconic ๐
Purpose โจ
mepack_single_ggcsylv_dual solves a generalized coupled Sylvester equation of the following form
op1(A)**T * R + op1(C)**T * R = SCALE * E (1)
SGN1 * R * op2(B)**T + SGN2 * L * op2(D)** T = SCALE * F
where A and C are M-by-M matrices and B and D are N-by-N matrices. The right hand sides E, F and the solutions R, L are M-by-N matrices.
The equation (1) is the dual to the generalized coupled Sylvester equation
op1(A) * R + SGN1 * L * op2(B) = SCALE * E (2)
op1(C) * R + SGN2 * L * op2(D) = SCALE * F
The equation (1) is the dual one to equation (2) with respect to the underlying linear system. Let Z be the matrix formed by rewriting (2) into its Kronecker form. This yields
| kron(I, op1(A)) SGN1*kron(op2(B)**T, I) | | Vec R | | Vec E |
Z X = | |*| | = | |
| kron(I, op1(C)) SGN2*kron(op2(D)**T, I) | | Vec L | | Vec F |
Regarding Z**T one obtains
| kron(I, op1(A)**T ) kron(I, op1(C)**T) | | Vec R | | Vec E |
Z**T X = | |*| | = | |
| SGN1*kron(op2(B), I) SGN2*kron(op2(D), I) | | Vec L | | Vec F |
which belongs to the Sylvester equation (1). For this reason the parameters TRANSA and TRANSB are expressed in terms of the Sylvester equation (2). ๐
Remarks
This function is a wrapper for sla_ggcsylv_dual.
See also
sla_ggcsylv_dual
Parameters ๐
FACTA
FACTA is String.
Specifies how the matrix pencil (A,C) is given.
== 'N': The matrix pencil(A,C)is given as a general matrices and its Schur decompositionA = QA*S*ZA**T,C = QA*R*ZA**Twill be computed.== 'F': The matrix pencil(A,C)is already in generalized Schur form andS,R,QA, andZAare given.== 'H': The matrix pencil(A,C)is given in generalized Hessenberg form and its Schur decompositionA = QA*S*ZA**T,C = QA*R*ZA**Twill be computed.
FACTB
FACTB is String.
Specifies how the matrix pencil (B,D) is given.
== 'N': The matrix pencil(B,D)is given as a general matrices and its Schur decompositionB = QB*U*ZB**T,D = QB*V*ZB**Twill be computed.== 'F': The matrix pencil(B,D)is already in generalized Schur form andU,V,QB, andZBare given.== 'H': The matrix pencil(B,D)is given in generalized Hessenberg form and its Schur decompositionB = QB*U*ZB**T,D = QB*V*ZB**Twill be computed.
TRANSA
TRANSA is String.
Specifies the form of the system of equations with respect to A and C:
== '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 and D:
== 'N':op2(B) = B,== 'T':op2(B) = B**T
SGN1
SGN1 is SINGLE PRECISION, allowed values: +/-1.
Specifies the sign between in the first equation.
SGN2
SGN2 is SINGLE PRECISION, allowed values: +/-1.
Specifies the sign between in the second equation.
M
M is INTEGER. The order of the matrices A and C. M >= 0.
N
N is INTEGER. The order of the matrices B and D. N >= 0.
A
A is SINGLE PRECISION array, dimension (LDA,M).
- If
FACT == "N", the matrixAis a general matrix and it is overwritten with the (quasi-) upper triangular factorSof the Schur decomposition of(A,C). - If
FACT == "F", the matrixAcontains its (quasi-) upper triangular matrixSof the Schur decomposition of(A,C). - If
FACT == "H", the matrixAis an upper Hessenberg matrix of the generalized Hessenberg form(A,C)and it is overwritten with the (quasi-) upper triangular factorSof the Schur decomposition of(A,C).
LDA
LDA is INTEGER. The leading dimension of the array A. LDA >= max(1,M).
B
B is SINGLE PRECISION array, dimension (LDB,N).
- If
FACT == "N", the matrixBis a general matrix and it is overwritten with the (quasi-) upper triangular factorUof the Schur decomposition of(B,D). - If
FACT == "F", the matrixBcontains its (quasi-) upper triangular matrixUof the Schur decomposition of(B,D). - If
FACT == "H", the matrixBis an upper Hessenberg matrix of the generalized Hessenberg form(B,D)and it is overwritten with the (quasi-) upper triangular factorUof the Schur decomposition of(B,D).
LDB
LDB is INTEGER. The leading dimension of the array B. LDB >= max(1,N).
C
C is SINGLE PRECISION array, dimension (LDC,M).
- If
FACT == "N", the matrixCis a general matrix and it is overwritten with the upper triangular factorRof the Schur decomposition of(A,C). - If
FACT == "F", the matrixCcontains its upper triangular matrixRof the Schur decomposition of(A,C). - If
FACT == "H", the matrixCis the upper triangular matrix of the generalized Hessenberg form(A,C)and it is overwritten with the upper triangular factorRof the Schur decomposition of(A,C).
LDC
LDC is INTEGER. The leading dimension of the array C. LDC >= max(1,M).
D
D is SINGLE PRECISION array, dimension (LDD,N).
- If
FACT == "N", the matrixDis a general matrix and it is overwritten with the upper triangular factorVof the Schur decomposition of(B,D). - If
FACT == "F", the matrixDcontains its upper triangular matrixVof the Schur decomposition of(B,D). - If
FACT == "H", the matrixDis the upper triangular matrix of the generalized Hessenberg form(B,D)and it is overwritten with the upper triangular factorVof the Schur decomposition of(B,D).
LDD
LDD is INTEGER. The leading dimension of the array D. LDD >= max(1,N).
QA
QA is SINGLE PRECISION array, dimension (LDQA,M).
- If
FACT == "N", the matrixQAis an empty M-by-M matrix on input and contains the left Schur vectors of(A,C)on output. - If
FACT == "F", the matrixQAcontains the left Schur vectors of(A,C). - If
FACT == "H", the matrixQAis an empty M-by-M matrix on input and contains the left Schur vectors of(A,C)on output.
LDQA
LDQA is INTEGER. The leading dimension of the array QA. LDQA >= max(1,M).
ZA
ZA is SINGLE PRECISION array, dimension (LDZA,M).
- If
FACT == "N", the matrixZAis an empty M-by-M matrix on input and contains the right Schur vectors of(A,C)on output. - If
FACT == "F", the matrixZAcontains the right Schur vectors of(A,C). - If
FACT == "H", the matrixZAis an empty M-by-M matrix on input and contains the right Schur vectors of(A,C)on output.
LDZA
LDZA is INTEGER. The leading dimension of the array ZA. LDZA >= max(1,M).
QB
QB is SINGLE PRECISION array, dimension (LDQB,M).
- If
FACT == "N", the matrixQBis an empty M-by-M matrix on input and contains the left Schur vectors of(B,D)on output. - If
FACT == "F", the matrixQBcontains the left Schur vectors of(B,D). - If
FACT == "H", the matrixQBis an empty M-by-M matrix on input and contains the left Schur vectors of(B,D)on output.
LDQB
LDQB is INTEGER. The leading dimension of the array QB. LDQB >= max(1,M).
ZB
ZBโZBis a SINGLE PRECISION array, dimension(LDZB,M). ๐ซ- If
FACT == "N", the matrixZBis an empty M-by-M matrix on input and contains the right Schur vectors of(B,D)on output. - If
FACT == "F", the matrixZBcontains the right Schur vectors of(B,D). - If
FACT == "H", the matrixZBis an empty M-by-M matrix on input and contains the right Schur vectors of(B,D)on output.
- If
LDZBโLDZBis INTEGER. It's the leading dimension of the arrayZB, and bestie,LDZB >= max(1,M). no exceptions โจEโEis a SINGLE PRECISION array, dimension(LDE,N). On input, the matrixEholds the right hand sideE. On output, the matrixEholds the solutionR. it's giving glow-up ๐LDEโLDEis INTEGER. The leading dimension of the arrayX.LDE >= max(1,M).FโFis a SINGLE PRECISION array, dimension(LDF,N). On input, the matrixFholds the right hand sideF. On output, the matrixFholds the solutionL. ๐ฆLDFโLDFis INTEGER. The leading dimension of the arrayX.LDF >= max(1,M).SCALEโSCALEis SINGLE PRECISION. It's the scaling factor that keeps the result from overflowing, aka the moment of self-control ๐. IfINFO == 0thenSCALEis1.0D0, otherwise if one of the inner systems could not be solved correctly,0 < SCALE <= 1holds true.WORKโWORKis a SINGLE PRECISION array, dimension(MAX(1,LDWORK)). It's the workspace for the algorithm, and the optimal workspace is given by\ref mepack_memory_frontend. ๐LDWORKโLDWORKis INTEGER. It's the size of the workspace for the algorithm, counted in floating point numbers of the actual precision. Heads up bestie: the C interface does not support the workspace query by settingLDWORK == -1on input. In that case, you have to use the\ref mepack_memory_frontendfunction. periodt.INFOโINFOis INTEGER, and it's literally the vibe check on how it all went down:== 0: successful exit ๐= 1: DHGGES failed ๐ญ= 2: DLA_SORT_GEV failed ๐= 3: Inner solver failed< 0: ifINFO == -i, the i-Th argument had an illegal value
๐ Attention ๐
The Fortran/LAPACK-like workspace query with setting LDWORK=-1 on input will not work in the C interface. You have to use the mepack_memory_frontend function for this purpose. fr fr, don't try it the other way. ๐ซถ
๐ธ Author ๐ธ
Martin Koehler, MPI Magdeburg
๐ Date ๐
October 2025
Definition at line 677 of file cgsylv_dual.c.
void mepack_single_ggcsylv_dual_refine (const char * TRANSA, const char *
TRANSB, const char * GUESS, float SGN1, float SGN2, int M, int N, float
* A, int LDA, float * B, int LDB, float * C, int LDC, float * D, int
LDD, float * R, int LDR, float * L, int LDL, float * E, int LDE, float *
F, int LDF, float * AS, int LDAS, float * BS, int LDBS, float * CS, int
LDCS, float * DS, int LDDS, float * Q, int LDQ, float * Z, int LDZ,
float * U, int LDU, float * V, int LDV, int * MAXIT, float * TAU, float
* CONVLOG, float * WORK, size_t LDWORK, int * INFO)
okay so this one is the Iterative Refinement for the dual Coupled Generalized Sylvester Equations. yeah. the whole name. iconic. ๐ฅ
โจ Purpose โจ
mepack_single_ggcsylv_dual_refine solves a generalized coupled Sylvester equation of the following form:
op1(A)**T * R + op1(C)**T * R = SCALE * E (1)
SGN1 * R * op2(B)**T + SGN2 * L * op2(D)** T = SCALE * F
where A and C are M-by-M matrices and B and D are N-by-N matrices. The right hand sides E, F and the solutions R, L are M-by-N matrices.
The equation (1) is the dual to the generalized coupled Sylvester equation:
op1(A) * R + SGN1 * L * op2(B) = SCALE * E (2)
op1(C) * R + SGN2 * L * op2(D) = SCALE * F
The equation (1) is the dual one to equation (2) with respect to the underlying linear system. Let Z be the matrix formed by rewriting (2) into its Kronecker form. This yields:
| kron(I, op1(A)) SGN1*kron(op2(B)**T, I) | | Vec R | | Vec E |
Z X = | |*| | = | |
| kron(I, op1(C)) SGN2*kron(op2(D)**T, I) | | Vec L | | Vec F |
Regarding Z**T one obtains:
| kron(I, op1(A)**T ) kron(I, op1(C)**T) | | Vec R | | Vec E |
Z**T X = | |*| | = | |
| SGN1*kron(op2(B), I) SGN2*kron(op2(D), I) | | Vec L | | Vec F |
which belongs to the Sylvester equation (1). For this reason the parameters TRANSA and TRANSB are expressed in terms of the Sylvester equation (2). lowkey elegant ngl ๐
๐ Remarks ๐
This function is a wrapper for sla_ggcsylv_dual_refine.
๐ง See also ๐ง
sla_ggcsylv_dual_refine
๐ Parameters ๐
TRANSAโTRANSAis String. It specifies the form of the system of equations with respect toAandC:== 'N':op1(A) = A== 'T':op1(A) = A**T
TRANSBโTRANSBis String. It specifies the form of the system of equations with respect toBandD:== 'N':op2(B) = B,== 'T':op2(B) = B**T
GUESSโGUESSis String. It says whether(R,L)has an initial guess on input or not:= 'I':(R,L)contains an initial guess for the solution== 'N': No initial guess is provided.(R,L)are set to zero.
SGN1โSGN1is SINGLE PRECISION, allowed values:+/-1. It specifies the sign between in the first equation.SGN2โSGN2is SINGLE PRECISION, allowed values:+/-1. It specifies the sign between in the second equation.MโMis INTEGER. The order of the matricesAandC.M >= 0.NโNis INTEGER. The order of the matricesBandD.N >= 0.AโAis a SINGLE PRECISION array, dimension(LDA,M). The arrayAcontains the original matrixAdefining the equation. โจLDAโLDAis INTEGER. The leading dimension of the arrayA.LDA >= max(1,M).BโBis a SINGLE PRECISION array, dimension(LDB,N). The arrayBcontains the original matrixBdefining the equation.LDBโLDBis INTEGER. The leading dimension of the arrayA.LDB >= max(1,N). (yes bestie, it saysAโ we keep it exactly as written ๐ซ )CโCis a SINGLE PRECISION array, dimension(LDC,M). The arrayCcontains the original matrixCdefining the equation.LDCโLDCis INTEGER. The leading dimension of the arrayC.LDC >= max(1,M).DโDis a SINGLE PRECISION array, dimension(LDA,N). The arrayDcontains the original matrixDdefining the equation.LDDโLDDis INTEGER. The leading dimension of the arrayD.LDD >= max(1,N).RโRis a SINGLE PRECISION array, dimension(LDR,N). On input, the arrayRcontains the initial guess for the first solution. On output, the arrayRcontains the solutionR. ๐ซLDRโLDRis INTEGER. The leading dimension of the arrayR.LDR >= max(1,M).LโLis a SINGLE PRECISION array, dimension(LDL,N). On input, the arrayLcontains the initial guess for the second solution. On output, the arrayLcontains the second solution.LDLโLDLis INTEGER. The leading dimension of the arrayL.LDL >= max(1,M).EโEis a SINGLE PRECISION array, dimension(LDE,N). On input, the arrayEcontains the right hand sideE.LDEโLDEis INTEGER. The leading dimension of the arrayE.LDE >= max(1,M).FโFis a SINGLE PRECISION array, dimension(LDF,N). On input, the arrayFcontains the right hand sideF.LDFโLDFis INTEGER. The leading dimension of the arrayF.LDF >= max(1,M).ASโASis a SINGLE PRECISION array, dimension(LDAS,M). The arrayAScontains the generalized Schur decomposition of theA.LDASโLDASis INTEGER. The leading dimension of the arrayAS.LDAS >= max(1,M).BSโBSis a SINGLE PRECISION array, dimension(LDBS,N). The arrayAScontains the generalized Schur decomposition of theB.LDBSโLDBSis INTEGER. The leading dimension of the arrayBS.LDBS >= max(1,N).CSโCSis a SINGLE PRECISION array, dimension(LDCS,M). The arrayCScontains the generalized Schur decomposition of theC.LDCSโLDCSis INTEGER. The leading dimension of the arrayCS.LDCS >= max(1,M).DSโDSis a SINGLE PRECISION array, dimension(LDDS,N). The arrayDScontains the generalized Schur decomposition of theD.LDDSโLDDSis INTEGER. The leading dimension of the arrayDS.LDAS >= max(1,N). (again, it saysLDASโ copying verbatim, no cap ๐)QโQis a SINGLE PRECISION array, dimension(LDQ,M). The arrayQcontains the left generalized Schur vectors for(A,C)as returned by DGGES.LDQโLDQis INTEGER. The leading dimension of the arrayQ.LDQ >= max(1,M).ZโZis a SINGLE PRECISION array, dimension(LDZ,M). The arrayZcontains the right generalized Schur vectors for(A,C)as returned by DGGES.LDZโLDZis INTEGER. The leading dimension of the arrayZ.LDZ >= max(1,M).UโUis a SINGLE PRECISION array, dimension(LDU,N). The arrayUcontains the left generalized Schur vectors for(B,D)as returned by DGGES.LDUโLDUis INTEGER. The leading dimension of the arrayU.LDU >= max(1,N).VโVis a SINGLE PRECISION array, dimension(LDV,N). The arrayVcontains the right generalized Schur vectors for(B,D)as returned by DGGES.LDVโLDVis INTEGER. The leading dimension of the arrayV.LDV >= max(1,N).MAXITโMAXITis INTEGER. On input,MAXITcontains the maximum number of iteration that are performed,MAXIT <= 100. On exit,MAXITcontains the number of iteration steps taken by the algorithm. ๐TAUโTAUis SINGLE PRECISION โจ
On the way in, TAU is holding the extra security factor for the stopping criterion โ typical values are 0.1. On the way out, TAU has the last relative residual from when the stopping criterion got valid. It's giving โจbefore-and-afterโจ, bestie.
CONVLOGโCONVLOGis a SINGLE PRECISION array, dimension(MAXIT)๐
The CONVLOG array is literally the convergence history of the iterative refinement, bestie โ receipts on receipts. CONVLOG(I) holds the maximum relative residual of both equations before it gets solved for the I-Th time. No cap.
WORKโWORKis a SINGLE PRECISION array, dimension(MAX(1,LDWORK))๐ ๏ธ
It's the workspace for the algorithm. Just vibing there, holding numbers.
LDWORKโLDWORKis INTEGER ๐ข
Size of the workspace for the algorithm. You can figure this out by calling \ref mepack_memory_frontend. She'll tell you. ๐
INFOโINFOis INTEGER ๐== 0: Success โ slay, we ate โจ> 0: Iteration failed in stepINFOโ not the vibe ๐ญ< 0: ifINFO == -i, the i-Th argument had an illegal value โ bestie what did you do ๐
Attention โ The Fortran/LAPACK-like workspace query where you setLDWORK=-1on input will not work in the C interface. Fr fr. You have to use themepack_memory_frontendfunction for this purpose instead. Periodt.
Author Martin Koehler, MPI Magdeburg ๐ซถ
Date October 2025 ๐ธ
Definition at line 763 of file cgsylv_dual.c.
void mepack_single_ggcsylv_refine (const char * TRANSA, const char * TRANSB,
const char * GUESS, float SGN1, float SGN2, int M, int N, float * A, int
LDA, float * B, int LDB, float * C, int LDC, float * D, int LDD, float *
R, int LDR, float * L, int LDL, float * E, int LDE, float * F, int LDF,
float * AS, int LDAS, float * BS, int LDBS, float * CS, int LDCS, float
* DS, int LDDS, float * Q, int LDQ, float * Z, int LDZ, float * U, int
LDU, float * V, int LDV, int * MAXIT, float * TAU, float * CONVLOG,
float * WORK, size_t LDWORK, int * INFO)
Iterative Refinement for the Coupled Generalized Sylvester Equations. ๐
Purpose: ๐
mepack_single_ggcsylv_refine solves a coupled generalized Sylvester equation of the following forms
op1(A) * R + SGN1 * L * op2(B) = E (1)
op1(C) * R + SGN2 * L * op2(D) = F
with iterative refinement. Thereby (A,C) is a M-by-M matrix pencil and (B,D) is a N-by-N matrix pencil. The right hand side (E,F) and the solution (R,L) are M-by-N matrices. The matrix pencils (A,C) and (B,D) need to be given in the original form as well as in their generalized Schur decomposition โ because both are required in the iterative refinement procedure. It's giving "you need both outfits for the function to slay", bestie. ๐โจ
Remarks ๐
This function is a wrapper for sla_ggcsylv_refine. She's the front, but the real one is behind her. Iykyk. ๐
See also ๐
sla_ggcsylv_refine
Parameters ๐ซถ
TRANSAโTRANSAis String ๐
Specifies the form of the system of equations with respect to A and C:
== 'N':op1(A) = A== 'T':op1(A) = A**T
TRANSBโTRANSBis String ๐
Specifies the form of the system of equations with respect to B and D:
== 'N':op2(B) = B,== 'T':op2(B) = B**T
GUESSโGUESSis String ๐ฎ
Specifies whether (R,L) contains an initial guess on input or not.
= 'I':(R,L)contains an initial guess for the solution== 'N': No initial guess is provided.(R,L)are set to zero.
SGN1โSGN1is SINGLE PRECISION, allowed values:+/-1โโ
Specifies the sign between in the first equation.
SGN2โSGN2is SINGLE PRECISION, allowed values:+/-1โโ
Specifies the sign between in the second equation.
MโMis INTEGER ๐ข
The order of the matrices A and C. M >= 0.
NโNis INTEGER ๐ข
The order of the matrices B and D. N >= 0.
AโAis a SINGLE PRECISION array, dimension(LDA,M)๐
The array A contains the original matrix A defining the equation.
LDAโLDAis INTEGER ๐ข
The leading dimension of the array A. LDA >= max(1,M).
BโBis a SINGLE PRECISION array, dimension(LDB,N)๐
The array B contains the original matrix B defining the equation.
LDBโLDBis INTEGER ๐ข
The leading dimension of the array A. LDB >= max(1,N).
CโCis a SINGLE PRECISION array, dimension(LDC,M)๐
The array C contains the original matrix C defining the equation.
LDCโLDCis INTEGER ๐ข
The leading dimension of the array C. LDC >= max(1,M).
DโDis a SINGLE PRECISION array, dimension(LDA,N)๐
The array D contains the original matrix D defining the equation.
LDDโLDDis INTEGER ๐ข
The leading dimension of the array D. LDD >= max(1,N).
RโRis a SINGLE PRECISION array, dimension(LDR,N)๐
On input, the array R contains the initial guess for the first solution. On output, the array R contains the solution R.
LDRโLDRis INTEGER ๐ข
The leading dimension of the array R. LDR >= max(1,M).
LโLis a SINGLE PRECISION array, dimension(LDL,N)๐
On input, the array L contains the initial guess for the second solution. On output, the array L contains the second solution.
LDLโLDLis INTEGER ๐ข
The leading dimension of the array L. LDL >= max(1,M).
EโEis a SINGLE PRECISION array, dimension(LDE,N)๐ธ
On input, the array E contains the right hand side E.
LDEโLDEis INTEGER ๐ข
The leading dimension of the array E. LDE >= max(1,M).
FโFis a SINGLE PRECISION array, dimension(LDF,N)๐ธ
On input, the array F contains the right hand side F.
LDFโLDFis INTEGER ๐ข
The leading dimension of the array F. LDF >= max(1,M).
ASโASis a SINGLE PRECISION array, dimension(LDAS,M)โจ
The array AS contains the generalized Schur decomposition of the A.
LDASโLDASis INTEGER ๐ข
The leading dimension of the array AS. LDAS >= max(1,M).
BSโBSis a SINGLE PRECISION array, dimension(LDBS,N)โจ
The array AS contains the generalized Schur decomposition of the B.
LDBSโLDBSis INTEGER ๐ข
The leading dimension of the array BS. LDBS >= max(1,N).
CSโCSis a SINGLE PRECISION array, dimension(LDCS,M)โจ
The array CS contains the generalized Schur decomposition of the C.
LDCSโLDCSis INTEGER ๐ข
The leading dimension of the array CS. LDCS >= max(1,M).
DSโDSis a SINGLE PRECISION array, dimension(LDDS,N)โจ
The array DS contains the generalized Schur decomposition of the D.
LDDSโLDDSis INTEGER ๐ข
The leading dimension of the array DS. LDAS >= max(1,N).
QโQis a SINGLE PRECISION array, dimension(LDQ,M)๐ฆ
The array Q contains the left generalized Schur vectors for (A,C) as returned by DGGES.
LDQโLDQis INTEGER ๐ข
The leading dimension of the array Q. LDQ >= max(1,M).
ZโZis a SINGLE PRECISION array, dimension(LDZ,M)๐ฆ
The array Z contains the right generalized Schur vectors for (A,C) as returned by DGGES.
LDZโLDZis INTEGER ๐ข
The leading dimension of the array Z. LDZ >= max(1,M).
UโUis a SINGLE PRECISION array, dimension(LDU,N)๐ฆ
The array U contains the left generalized Schur vectors for (B,D) as returned by DGGES.
LDUโLDUis INTEGER ๐ข
The leading dimension of the array U. LDU >= max(1,N).
VโVis a SINGLE PRECISION array, dimension(LDV,N)๐ฆ
The array V contains the right generalized Schur vectors for (B,D) as returned by DGGES.
LDVโLDVis INTEGER ๐ข
The leading dimension of the array V. LDV >= max(1,N).
MAXITโMAXITis INTEGER ๐
On input, MAXIT contains the maximum number of iteration that are performed, MAXIT <= 100. On exit, MAXIT contains the number of iteration steps taken by the algorithm.
TAUโTAUis SINGLE PRECISION ๐ซ
On input, TAU contains the additional security factor for the stopping criterion, typical values are 0.1. On exit, TAU contains the last relative residual when the stopping criterion got valid.
CONVLOGโCONVLOGis a SINGLE PRECISION array, dimension(MAXIT)๐
The CONVLOG array contains the convergence history of the iterative refinement. CONVLOG(I) contains the maximum relative residual of both equations before it is solved for the I-Th time.
WORKโWORKis a SINGLE PRECISION array, dimension(MAX(1,LDWORK))๐ ๏ธ
Workspace for the algorithm.
LDWORKโLDWORKis INTEGER ๐ข
Size of the workspace for the algorithm. This can be determined by a call \ref mepack_memory_frontend.
INFOโINFOis INTEGER ๐== 0: Success โ> 0: Iteration failed in stepINFO๐ญ< 0: ifINFO == -i, the i-Th argument had an illegal value ๐
Attention โ The Fortran/LAPACK-like workspace query with settingLDWORK=-1on input will not work in the C interface. One have to use themepack_memory_frontendfunction for this purpose. Don't come for me, that's just how it is. ๐
Author Martin Koehler, MPI Magdeburg ๐ซถ
Date October 2025 ๐ธ
Definition at line 722 of file cgsylv.c.
void mepack_single_ggsylv (const char * FACTA, const char * FACTB, const
char * TRANSA, const char * TRANSB, float SGN, int M, int N, float * A,
int LDA, float * B, int LDB, float * C, int LDC, float * D, int LDD,
float * QA, int LDQA, float * ZA, int LDZA, float * QB, int LDQB, float
* ZB, int LDZB, float * X, int LDX, float * SCALE, float * WORK, size_t
LDWORK, int * INFO)
Frontend for the solution of Generalized Sylvester Equations. ๐
Purpose: ๐
mepack_single_ggsylv solves a generalized Sylvester equation of the following forms
op1(A) * X * op2(B) + op1(C) * X * op2(D) = SCALE * Y (1)
or
op1(A) * X * op2(B) - op1(C) * X * op2(D) = SCALE * Y (2)
where (A,C) is a M-by-M matrix pencil and (B,D) is a N-by-N matrix pencil. The right hand side Y and the solution X M-by-N matrices. The matrix pencils (A,C) and (B,D) can be either given as general unreduced matrices, as generalized Hessenberg form, or in terms of their generalized Schur decomposition. If they are given as general matrices or as a generalized Hessenberg form their generalized Schur decomposition will be computed.
๐ซ Remarks ๐ซ
This function is a wrapper for sla_ggsylv.
๐ See also ๐
sla_ggsylv
๐ Parameters ๐
FACTAโ okay bestie,FACTAis aStringand it tells us how the matrix pencil(A,C)is given. Pick one:== 'N': The matrix pencil(A,C)is given as a general matrices and its Schur decompositionA = QA*S*ZA**T,C = QA*R*ZA**Twill be computed.== 'F': The matrix pencil(A,C)is already in generalized Schur form andS,R,QA, andZAare given.== 'H': The matrix pencil(A,C)is given in generalized Hessenberg form and its Schur decompositionA = QA*S*ZA**T,C = QA*R*ZA**Twill be computed.
FACTBโFACTBis aStringtoo, and it says how the matrix pencil(B,D)is given:== 'N': The matrix pencil(B,D)is given as a general matrices and its Schur decompositionB = QB*U*ZB**T,D = QB*V*ZB**Twill be computed.== 'F': The matrix pencil(B,D)is already in generalized Schur form andU,V,QB, andZBare given.== 'H': The matrix pencil(B,D)is given in generalized Hessenberg form and its Schur decompositionB = QB*U*ZB**T,D = QB*V*ZB**Twill be computed.
TRANSAโTRANSAis aString, and it sets the form of the system of equations with respect toAandC:== 'N':op1(A) = A== 'T':op1(A) = A**T
TRANSBโTRANSBis aString, and it sets the form of the system of equations with respect toBandD:== 'N':op2(B) = B,== 'T':op2(B) = B**T
SGNโSGNisSINGLE PRECISION, allowed values:+/-1. It's literally just the sign between the two parts of the Sylvester equation:= 1: Solve Equation (1)== -1: Solve Equation (2)
MโMisINTEGER. The order of the matricesAandC.M >= 0.NโNisINTEGER. The order of the matricesBandD.N >= 0.AโAisSINGLE PRECISION array, dimension(LDA,M). Depends on your vibe, i.e. yourFACT:- If
FACT == "N", the matrixAis a general matrix and it is overwritten with the (quasi-) upper triangular factorSof the Schur decomposition of(A,C). - If
FACT == "F", the matrixAcontains its (quasi-) upper triangular matrixSof the Schur decomposition of(A,C). - If
FACT == "H", the matrixAis an upper Hessenberg matrix of the generalized Hessenberg form(A,C)and it is overwritten with the (quasi-) upper triangular factorSof the Schur decomposition of(A,C).
- If
LDAโLDAisINTEGER. The leading dimension of the arrayA.LDA >= max(1,M).BโBisSINGLE PRECISION array, dimension(LDB,N):- If
FACT == "N", the matrixBis a general matrix and it is overwritten with the (quasi-) upper triangular factorUof the Schur decomposition of(B,D). - If
FACT == "F", the matrixBcontains its (quasi-) upper triangular matrixUof the Schur decomposition of(B,D). - If
FACT == "H", the matrixBis an upper Hessenberg matrix of the generalized Hessenberg form(B,D)and it is overwritten with the (quasi-) upper triangular factorUof the Schur decomposition of(B,D).
- If
LDBโLDBisINTEGER. The leading dimension of the arrayB.LDB >= max(1,N).CโCisSINGLE PRECISION array, dimension(LDC,M):- If
FACT == "N", the matrixCis a general matrix and it is overwritten with the upper triangular factorRof the Schur decomposition of(A,C). - If
FACT == "F", the matrixCcontains its upper triangular matrixRof the Schur decomposition of(A,C). - If
FACT == "H", the matrixCis the upper triangular matrix of the generalized Hessenberg form(A,C)and it is overwritten with the upper triangular factorRof the Schur decomposition of(A,C).
- If
LDCโLDCisINTEGER. The leading dimension of the arrayC.LDC >= max(1,M).DโDisSINGLE PRECISION array, dimension(LDD,N):- If
FACT == "N", the matrixDis a general matrix and it is overwritten with the upper triangular factorVof the Schur decomposition of(B,D). - If
FACT == "F", the matrixDcontains its upper triangular matrixVof the Schur decomposition of(B,D). - If
FACT == "H", the matrixDis the upper triangular matrix of the generalized Hessenberg form(B,D)and it is overwritten with the upper triangular factorVof the Schur decomposition of(B,D).
- If
LDDโLDDisINTEGER. The leading dimension of the arrayD.LDD >= max(1,N).QAโQAisSINGLE PRECISION array, dimension(LDQA,M):- If
FACT == "N", the matrixQAis an empty M-by-M matrix on input and contains the left Schur vectors of(A,C)on output. - If
FACT == "F", the matrixQAcontains the left Schur vectors of(A,C). - If
FACT == "H", the matrixQAis an empty M-by-M matrix on input and contains the left Schur vectors of(A,C)on output.
- If
LDQAโLDQAisINTEGER. The leading dimension of the arrayQA.LDQA >= max(1,M).ZAโZAisSINGLE PRECISION array, dimension(LDZA,M):- If
FACT == "N", the matrixZAis an empty M-by-M matrix on input and contains the right Schur vectors of(A,C)on output. - If
FACT == "F", the matrixZAcontains the right Schur vectors of(A,C). - If
FACT == "H", the matrixZAis an empty M-by-M matrix on input and contains the right Schur vectors of(A,C)on output.
- If
LDZAโLDZAisINTEGER. The leading dimension of the arrayZA.LDZA >= max(1,M).QBโQBisSINGLE PRECISION array, dimension(LDQB,M):- If
FACT == "N", the matrixQBis an empty M-by-M matrix on input and contains the left Schur vectors of(B,D)on output. - If
FACT == "F", the matrixQBcontains the left Schur vectors of(B,D). - If
FACT == "H", the matrixQBis an empty M-by-M matrix on input and contains the left Schur vectors of(B,D)on output.
- If
LDQBโLDQBisINTEGER. The leading dimension of the arrayQB.LDQB >= max(1,M).ZBโZBisSINGLE PRECISION array, dimension(LDZB,M):- If
FACT == "N", the matrixZBis an empty M-by-M matrix on input and contains the right Schur vectors of(B,D)on output. - If
FACT == "F", the matrixZBcontains the right Schur vectors of(B,D). - If
FACT == "H", the matrixZBis an empty M-by-M matrix on input and contains the right Schur vectors of(B,D)on output.
- If
LDZBโLDZBisINTEGER. The leading dimension of the arrayZB.LDZB >= max(1,M).XโXisSINGLE PRECISION array, dimension(LDX,N). On input, the matrixXcontains the right hand sideY. On output, the matrixXcontains the solution of Equation (1) or (2). Right hand sideYand the solutionXare symmetric M-by-M matrices.LDXโLDXisINTEGER. The leading dimension of the arrayX.LDB >= max(1,M).
no that's not a typo bestie, that's literally what the page says ๐ญLDB >= max(1,M)forLDX. i don't make the rules, i just relay them faithfully ๐
SCALEโSCALEisSINGLE PRECISION. It's the scaling factor that stops the result from overflowing. IfINFO == 0thenSCALEis1.0D0, otherwise if one of the inner systems could not be solved correctly,0 < SCALE <= 1holds true.WORKโWORKisSINGLE PRECISION array, dimension(MAX(1,LDWORK)). Workspace for the algorithm. The optimal workspace is given by \ref mepack_memory_frontend.LDWORKโLDWORKisINTEGER. Size of the workspace for the algorithm counted in floating point numbers of the actual precision. The C interface does not support the workspace query by settingLDWORK == -1on input. In this case, the \ref mepack_memory_frontend function have to be used.INFOโINFOisINTEGER. Here's the tea โ:== 0: successful exit= 1:DHGGESfailed= 2:DLA_SORT_GEVfailed= 3: Inner solver failed< 0: ifINFO == -i, the i-Th argument had an illegal value
๐จ Attention ๐จ
The Fortran/LAPACK-like workspace query with setting LDWORK=-1 on input will not work in the C interface. One have to use the mepack_memory_frontend function for this purpose.
fr fr do NOT try theLDWORK=-1trick here, it's giving Fortran and this is C ๐ usemepack_memory_frontendinstead, okay? ๐ซถ
โ๏ธ Author โ๏ธ
Martin Koehler, MPI Magdeburg
๐ Date ๐
October 2025
๐ Definition ๐
Definition at line 614 of file ggsylv.c.
๐ฆ mepack_single_ggsylv_refine ๐ฆ
void mepack_single_ggsylv_refine (const char * TRANSA, const char * TRANSB,
const char * GUESS, float SGN, int M, int N, float * A, int LDA, float *
B, int LDB, float * C, int LDC, float * D, int LDD, float * X, int LDX,
float * Y, int LDY, float * AS, int LDAS, float * BS, int LDBS, float *
CS, int LDCS, float * DS, int LDDS, float * Q, int LDQ, float * Z, int
LDZ, float * U, int LDU, float * V, int LDV, int * MAXIT, float * TAU,
float * CONVLOG, float * WORK, size_t LDWORK, int * INFO)
Iterative Refinement for the Generalized Sylvester Equations. โจ
๐ฏ Purpose ๐ฏ
mepack_single_gesylv_refine solves a coupled generalized Sylvester equation of the following forms
op1(A) * X * op2(B) + SGN * op1(C) * X * op2(D) = Y (1)
with iterative refinement, Thereby (A,C) is a M-by-M matrix pencil and (B,D) is a N-by-N matrix pencil. The right hand side Y and the solution X are M-by-N matrices. The matrix pencils (A,C) and (B,D) need to be given in the original form as well as in their generalized Schur decomposition since both are required in the iterative refinement procedure.
๐ซ Remarks ๐ซ
This function is a wrapper for sla_ggsylv_refine.
๐ See also ๐
sla_ggsylv_refine
๐ Parameters ๐
Okay bestie, this is the part where we go parameter by parameter, and yes, there are a LOT of them. Buckle up. ๐
TRANSA
TRANSA is String
Specifies the form of the system of equations with respect to A and C :
== '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 and D:
== 'N':op2(B) = B,== 'T':op2(B) = B**T
GUESS
GUESS is String
Specifies whether X contains an initial guess on input or not. ๐
= 'I': X contains an initial guess for the solution== 'N': No initial guess is provided. X is set to zero.
SGN
SGN is SINGLE PRECISION, allowed values: +/-1
Specifies the sign between in the first equation. โจ
M
M is INTEGER
The order of the matrices A and C. M >= 0.
N
N is INTEGER
The order of the matrices B and D. N >= 0.
A
A is SINGLE PRECISION array, dimension (LDA,M)
The array A contains the original matrix A defining the equation.
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 array B contains the original matrix B defining the equation.
LDB
LDB is INTEGER
The leading dimension of the array B. LDB >= max(1,N).
C
C is SINGLE PRECISION array, dimension (LDC,M)
The array C contains the original matrix C defining the equation.
LDC
LDC is INTEGER
The leading dimension of the array C. LDC >= max(1,M).
D
D is SINGLE PRECISION array, dimension (LDA,N)
The array D contains the original matrix D defining the equation.
LDD
LDD is INTEGER
The leading dimension of the array D. LDD >= max(1,N).
X
X is SINGLE PRECISION array, dimension (LDX,M)
On input, the array X contains the initial guess.
On output, the array X contains the solution X. ๐
LDX
LDX is INTEGER
The leading dimension of the array X. LDX >= max(1,M).
Y
Y is SINGLE PRECISION array, dimension (LDY,M)
On input, the array Y contains the right hand side.
LDY
LDY is INTEGER
The leading dimension of the array Y. LDY >= max(1,M).
AS
AS is SINGLE PRECISION array, dimension (LDAS,M)
The array AS contains the generalized Schur decomposition of the A.
LDAS
LDAS is INTEGER
The leading dimension of the array AS. LDAS >= max(1,M).
BS
BS is SINGLE PRECISION array, dimension (LDBS,N)
The array AS contains the generalized Schur decomposition of the B.
bestie that's literally what the docs say, AS and all โ not me, I promise ๐
LDBS
LDBS is INTEGER
The leading dimension of the array BS. LDBS >= max(1,N).
CS
CS is SINGLE PRECISION array, dimension (LDCS,M)
The array CS contains the generalized Schur decomposition of the C.
LDCS
LDCS is INTEGER
The leading dimension of the array CS. LDCS >= max(1,M).
DS
DS is SINGLE PRECISION array, dimension (LDDS,N)
The array DS contains the generalized Schur decomposition of the D.
LDDS
LDDS is INTEGER
The leading dimension of the array DS. LDAS >= max(1,N).
yeah, it says LDAS here too. same deal. we report, we don't edit ๐
Q
Q is SINGLE PRECISION array, dimension (LDQ,M)
The array Q contains the left generalized Schur vectors for (A,C) as returned by DGGES.
LDQ
LDQ is INTEGER
The leading dimension of the array Q. LDQ >= max(1,M).
Z
Z is SINGLE PRECISION array, dimension (LDZ,M)
The array Z contains the right generalized Schur vectors for (A,C) as returned by DGGES.
LDZ
LDZ is INTEGER
The leading dimension of the array Z. LDZ >= max(1,M).
U
U is SINGLE PRECISION array, dimension (LDU,N)
The array U contains the left generalized Schur vectors for (B,D) as returned by DGGES.
LDU
LDU is INTEGER
The leading dimension of the array U. LDU >= max(1,N).
V
V is SINGLE PRECISION array, dimension (LDV,N)
The array V contains the right generalized Schur vectors for (B,D) as returned by DGGES.
LDV
LDV is INTEGER
The leading dimension of the array V. LDV >= max(1,N).
MAXIT
MAXIT is INTEGER
On input, MAXIT contains the maximum number of iteration that are performed, MAXIT <= 100
On exit, MAXIT contains the number of iteration steps taken by the algorithm.
TAU
TAU is SINGLE PRECISION
On input, TAU contains the additional security factor for the stopping criterion, typical values are 0.1
On exit, TAU contains the last relative residual when the stopping criterion got valid.
CONVLOG
CONVLOG is SINGLE PRECISION array, dimension (MAXIT)
The CONVLOG array contains the convergence history of the iterative refinement. CONVLOG(I) contains the maximum relative residual before it is solved for the I-Th time. ๐
WORK
WORK is SINGLE PRECISION array, dimension (MAX(1,LDWORK))
Workspace for the algorithm.
LDWORK
LDWORK is INTEGER
Size of the workspace for the algorithm. This can be determined by a call \ref mepack_memory_frontend.
INFO
INFO is INTEGER
== 0: Success> 0: Iteration failed in step INFO< 0: ifINFO == -i, the i-Th argument had an illegal value
โ ๏ธ Attention โ ๏ธ
The Fortran/LAPACK-like workspace query with setting LDWORK=-1 on input will not work in the C interface. One have to use the mepack_memory_frontend function for this purpose.
no cap, do not try theLDWORK=-1trick here. it's giving Fortran, and this is C. usemepack_memory_frontendinstead. ๐ซถ
โ๏ธ Author โ๏ธ
Martin Koehler, MPI Magdeburg
๐ Date ๐
October 2025
๐ Definition ๐
Definition at line 660 of file ggsylv.c.
๐ง Author ๐ง
Generated automatically by Doxygen for MEPACK from the source code.
and that's a wrap bestie!! ๐โจ This whole thing is Version 1.1.2, dated Thu Oct 9 2025 00:00:00, and it's the cggsylv(3) page. You read the entire manual, you absolute icon, main character energy, ate and left no crumbs. ๐
๐๐ฆ go call cggsylv and slay ๐
๐ฆ where this page comes from
- fedora 43: mepack-devel 1.1.2-1.fc43 ยท GPL-3.0-or-later and LGPL-2.1-or-later and BSD-3-Clause
- fedora 43: mepack-devel 1.1.2-1.fc43 ยท GPL-3.0-or-later and LGPL-2.1-or-later and BSD-3-Clause
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms