cgglyap(3)
cgglyap(3) β MEPACK
π NAME π
cgglyap is the C-Interface, bestie. π
It's literally for generalized Lyapunov and Stein equation with general coefficient matrices. No cap.
β¨ SYNOPSIS β¨
Okay so here are the functions, fr fr. Each one is a direct wrapper, and we're gonna list every single prototype exactly because we don't skip. No cap.
mepack_double_gglyap
void mepack_double_gglyap (const char *FACT, const char *TRANS, int M,
double *A, int LDA, double *B, int LDB, double *Q, int LDQ, double
*Z, int LDZ, double *X, int LDX, double *SCALE, double *WORK, size_t
LDWORK, int *INFO)
Frontend for the solution of Generalized Lyapunov Equations.
mepack_single_gglyap
void mepack_single_gglyap (const char *FACT, const char *TRANS, int M,
float *A, int LDA, float *B, int LDB, float *Q, int LDQ, float *Z,
int LDZ, float *X, int LDX, float *SCALE, float *WORK, size_t
LDWORK, int *INFO)
Frontend for the solution of Generalized Lyapunov Equations.
mepack_double_ggstein
void mepack_double_ggstein (const char *FACT, const char *TRANS, int M,
double *A, int LDA, double *B, int LDB, double *Q, int LDQ, double
*Z, int LDZ, double *X, int LDX, double *SCALE, double *WORK, size_t
LDWORK, int *INFO)
Frontend for the solution of Generalized Stein Equations.
mepack_single_ggstein
void mepack_single_ggstein (const char *FACT, const char *TRANS, int M,
float *A, int LDA, float *B, int LDB, float *Q, int LDQ, float *Z,
int LDZ, float *X, int LDX, float *SCALE, float *WORK, size_t
LDWORK, int *INFO)
Frontend for the solution of Generalized Stein Equations.
mepack_double_gglyap_refine
void mepack_double_gglyap_refine (const char *TRANS, const char *GUESS,
int M, double *A, int LDA, double *B, int LDB, double *X, int LDX,
double *Y, int LDY, double *AS, int LDAS, double *BS, int LDBS,
double *Q, int LDQ, double *Z, int LDZ, int *MAXIT, double *TAU,
double *CONVLOG, double *WORK, size_t LDWORK, int *INFO)
Iterative Refinement for the Generalized Lyapunov Equation.
mepack_single_gglyap_refine
void mepack_single_gglyap_refine (const char *TRANS, const char *GUESS,
int M, float *A, int LDA, float *B, int LDB, float *X, int LDX,
float *Y, int LDY, float *AS, int LDAS, float *BS, int LDBS, float
*Q, int LDQ, float *Z, int LDZ, int *MAXIT, float *TAU, float
*CONVLOG, float *WORK, size_t LDWORK, int *INFO)
Iterative Refinement for the Generalized Lyapunov Equation.
mepack_double_ggstein_refine
void mepack_double_ggstein_refine (const char *TRANS, const char *GUESS,
int M, double *A, int LDA, double *B, int LDB, double *X, int LDX,
double *Y, int LDY, double *AS, int LDAS, double *BS, int LDBS,
double *Q, int LDQ, double *Z, int LDZ, int *MAXIT, double *TAU,
double *CONVLOG, double *WORK, size_t LDWORK, int *INFO)
Iterative Refinement for the Generalized Stein Equation.
mepack_single_ggstein_refine
void mepack_single_ggstein_refine (const char *TRANS, const char *GUESS,
int M, float *A, int LDA, float *B, int LDB, float *X, int LDX,
float *Y, int LDY, float *AS, int LDAS, float *BS, int LDBS, float
*Q, int LDQ, float *Z, int LDZ, int *MAXIT, float *TAU, float
*CONVLOG, float *WORK, size_t LDWORK, int *INFO)
Iterative Refinement for the Generalized Stein Equation.
πΈ Detailed Description πΈ
Okay so this whole thing is the C-Interface for generalized Lyapunov and Stein equation with general coefficient matrices. π The Fortran routines that actually solve these equations with arbitrary coefficients are wrapped in C so you can access them easier. All the wrapper routines are direct wrappers to the corresponding Fortran subroutines, and they do not do sanity checks β the Fortran routines handle all that. The only difference is that the C interface does not allow LAPACK-like work_space queries. For that, you need to use the mepack_memory_frontend function. Periodt.
π Function Documentation π
mepack_double_gglyap
void mepack_double_gglyap (const char *FACT, const char *TRANS, int M,
double *A, int LDA, double *B, int LDB, double *Q, int LDQ, double
*Z, int LDZ, double *X, int LDX, double *SCALE, double *WORK, size_t
LDWORK, int *INFO)
Frontend for the solution of Generalized Lyapunov Equations.
Purpose
mepack_double_gglyap solves a generalized Lyapunov equation, bestie. It comes in two forms, and they are:
A * X * B^T + B * X * A^T = SCALE * Y (1)
or
A^T * X * B + B^T * X * A = SCALE * Y (2)
where (A,B) is a M-by-M matrix pencil. The right hand side Y and the solution X are M-by-M matrices. The matrix pencil (A,B) is either in general form, in generalized Hessenberg form, or in generalized Schur form where Q and Z also need to be provided.
Remarks
This function is a wrapper for dla_gglyap. β¨
See also
dla_gglyap
Parameters
FACTβFACTis a String. It specifies how the matrixAis given.== 'N': The matrix pencil(A,B)is given as a general matrix pencil and its Schur decompositionA = Q*S*Z**T,B = Q*R*Z**Twill be computed.== 'F': The matrixAis given as its Schur decomposition in terms ofSandQformA = Q*S*Q**T.== 'H': The matrix pencil(A,B)is given in generalized Hessenberg form and its Schur decompositionA = Q*S*Z**T,B = Q*R*Z**Twill be computed.
TRANSβTRANSis String. It specifies the form of the system of equations with respect toA:== 'N': Equation (1) is solved.== 'T': Equation (2) is solved.
MβMis INTEGER. The order of the matricesA,B,YandX.M >= 0.AβAis DOUBLE PRECISION array, dimension(LDA,M).- If
FACT == "N", the matrixAis a general matrix and it is overwritten with the quasi upper triangular matrixSof the generalized Schur decomposition. - If
FACT == "F", the matrixAcontains its (quasi-) upper triangular matrixSof the generalized Schur decomposition of(A,B). - If
FACT == "H", the matrixAis an upper Hessenberg matrix of the generalized Hessenberg form(A,B)and it is overwritten with the quasi upper triangular matrixSof the generalized Schur decomposition.
- If
LDAβLDAis INTEGER. The leading dimension of the arrayA.LDA >= max(1,M).BβBis DOUBLE PRECISION array, dimension(LDB,M).- If
FACT == "N", the matrixBa general matrix and it is overwritten with the upper triangular matrix of the generalized Schur decomposition. - If
FACT == "F", the matrixBcontains its upper triangular matrixRof the generalized Schur decomposition of(A,B). - If
FACT == "H", the matrixBis the upper triangular matrix of the generalized Hessenberg form(A,B)and it is overwritten with the upper triangular matrix of the generalized Schur decomposition.
- If
LDBβLDBis INTEGER. The leading dimension of the arrayB.LDB >= max(1,M).QβQis DOUBLE PRECISION array, dimension(LDQ,M).- If
FACT == "N", the matrixQis an empty M-by-M matrix on input and contains the left generalized Schur vectors of(A,B)on output. - If
FACT == "F", the matrixQcontains the left generalized Schur vectors of(A,B). - If
FACT == "H", the matrixQis an empty M-by-M matrix on input and contains the left Schur vectors of(A,B)on output.
- If
LDQβLDQis INTEGER. The leading dimension of the arrayQ.LDQ >= max(1,M).ZβZis DOUBLE PRECISION array, dimension(LDZ,M).- If
FACT == "N", the matrixZis an empty M-by-M matrix on input and contains the right generalized Schur vectors of(A,B)on output. - If
FACT == "F", the matrixZcontains the right generalized Schur vectors of(A,B). - If
FACT == "H", the matrixZis an empty M-by-M matrix on input and contains the right Schur vectors of(A,B)on output.
- If
LDZβLDZis INTEGER. The leading dimension of the arrayZ.LDZ >= max(1,M).XβXis DOUBLE PRECISION array, dimension(LDX,N).- On input, the matrix
Xcontains the right hand sideY. - On output, the matrix
Xcontains the solution of Equation (1) or (2). Right hand sideYand the solutionXare symmetric M-by-M matrices.
- On input, the matrix
LDXβLDXis INTEGER. The leading dimension of the arrayX.LDX >= max(1,M).SCALEβSCALEis DOUBLE PRECISION.SCALEis a scaling factor to prevent the overflow in the result. IfINFO == 0thenSCALEis1.0D0otherwise if one of the inner systems could not be solved correctly,0 < SCALE <= 1holds true.WORKβWORKis DOUBLE PRECISION array, dimension(MAX(1,LDWORK)). Workspace for the algorithm. The optimal workspace is given either bymepack_memory_frontend.LDWORKβLDWORKis 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, themepack_memory_frontendfunction have to be used.INFOβINFOis INTEGER.== 0: successful exit= 1: DGGES 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 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
Definition at line 199 of file gglyap.c.
mepack_double_gglyap_refine
void mepack_double_gglyap_refine (const char *TRANS, const char *GUESS,
int M, double *A, int LDA, double *B, int LDB, double *X, int LDX,
double *Y, int LDY, double *AS, int LDAS, double *BS, int LDBS,
double *Q, int LDQ, double *Z, int LDZ, int *MAXIT, double *TAU,
double *CONVLOG, double *WORK, size_t LDWORK, int *INFO)
Iterative Refinement for the Generalized Lyapunov Equation.
Purpose
mepack_double_gglyap_refine solves a generalized Lyapunov equation of the following forms:
A * X * B^T + B * X * A^T = SCALE * Y (1)
or
A^T * X * B - B^T * X * A = SCALE * Y (2)
where A is a M-by-M matrix, and we're pulling it off with iterative refinement. π The right hand side Y and the solution X are both M-by-M matrices too. And here's the β¨thingβ¨ β the matrix pencil (A,B) has to be handed over as the original data and in its generalized Schur decomposition, because the iterative refinement process literally needs both. No cutting corners, bestie. π
Remarks
This one is just a wrapper for dla_gglyap_refine. That's the whole vibe. π«Ά
See also
dla_gglyap_refine
Parameters
TRANSβ TRANS is String. Says which form of the system of equations we're solving, specifically with respect to A:== 'N': Equation (1) is what gets solved πΈ== 'T': Equation (2) is what gets solved πΈ
GUESSβ GUESS is String. Tells us whether X already holds an initial guess on input, or not:= 'I': X contains an initial guess for the solution π== 'N': no initial guess at all. X gets set to zero. π
Mβ M is INTEGER. The order of the matrix A.M >= 0.Aβ A is DOUBLE PRECISION array, dimension (LDA,M). Holds the original matrix A that defines the equation. πLDAβ LDA is INTEGER. The leading dimension of the array A.LDA >= max(1,M).Bβ B is DOUBLE PRECISION array, dimension (LDB,M). Holds the original matrix B that defines the equation. πLDBβ LDB is INTEGER. The leading dimension of the array B.LDB >= max(1,M).Xβ X is DOUBLE PRECISION array, dimension (LDX,M). On input it's the initial guess, on output it's the solution X. Iconic glow-up fr. β¨LDXβ LDX is INTEGER. The leading dimension of the array X.LDX >= max(1,M).Yβ Y is DOUBLE PRECISION array, dimension (LDY,M). On input, it holds the right hand side. πLDYβ LDY is INTEGER. The leading dimension of the array Y.LDY >= max(1,M).ASβ AS is DOUBLE PRECISION array, dimension (LDAS,M). Holds the generalized Schur decomposition of the matrix A. π¦LDASβ LDAS is INTEGER. The leading dimension of the array AS.LDAS >= max(1,M).BSβ BS is DOUBLE PRECISION array, dimension (LDBS,M). Holds the generalized Schur decomposition of the matrix B. π¦LDBSβ LDBS is INTEGER. The leading dimension of the array BS.LDBS >= max(1,M).Qβ Q is DOUBLE PRECISION array, dimension (LDQ,M). Holds the left generalized Schur vectors of (A, B), exactly asDGGES3returned them. βLDQβ LDQ is INTEGER. The leading dimension of the array Q.LDQ >= max(1,M).Zβ Z is DOUBLE PRECISION array, dimension (LDZ,M). Holds the right generalized Schur vectors of (A,B), exactly asDGGES3returned them. βLDZβ LDZ is INTEGER. The leading dimension of the array Z.LDZ >= max(1,M).MAXITβ MAXIT is INTEGER. On input, MAXIT holds the max number of iterations that get performed,MAXIT <= 100. On exit, MAXIT holds the number of iteration steps the algorithm actually took. πββοΈTAUβ TAU is DOUBLE PRECISION. On input, TAU holds the extra security factor for the stopping criterion β typical values are0.1. On exit, TAU holds the last relative residual at the moment the stopping criterion became valid. πCONVLOGβ CONVLOG is DOUBLE PRECISION array, dimension (MAXIT). Holds the convergence history of the iterative refinement.CONVLOG(I)holds the maximum relative residual before it gets solved for the I-Th time. πWORKβ WORK is DOUBLE PRECISION array, dimension (MAX(1,LDWORK))). Workspace for the algorithm. π§°LDWORKβ LDWORK is INTEGER. Size of the workspace for the algorithm. You can figure this out by calling \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 where you set LDWORK=-1 on input will not work in the C interface. Nope, not happening. You have to use the \ref mepack_memory_frontend function for that purpose. Periodt. π
Author
Martin Koehler, MPI Magdeburg
Date
October 2025
Definition at line 233 of file gglyap.c.
β¨ mepack_double_ggstein β¨
void mepack_double_ggstein (const char * FACT, const char * TRANS, int M,
double * A, int LDA, double * B, int LDB, double * Q, int LDQ, double *
Z, int LDZ, double * X, int LDX, double * SCALE, double * WORK, size_t
LDWORK, int * INFO)
Frontend for the solution of Generalized Stein Equations. π
Purpose
mepack_double_ggstein solves a generalized Stein equation in one of these two forms:
A * X * A^T - B * X * B^T = SCALE * Y (1)
or
A^T * X * A - B^T * X * B = SCALE * Y (2)
where (A,B) is a M-by-M matrix pencil. The right hand side Y and the solution X are M-by-M matrices. The matrix pencil (A,B) can be either in general form, in generalized Hessenberg form, or in generalized Schur form β and if it's in Schur form, Q and Z also need to be provided. π¦
Remarks
This one's a wrapper for dla_ggstein. π
See also
dla_ggstein
Parameters
FACTβ FACT is String. Says how the matrix A is being given:== 'N': the matrix pencil (A,B) is given as a general matrix pencil, and its Schur decompositionA = Q*S*Z**T,B = Q*R*Z**Twill be computed. π₯== 'F': the matrix A is given as its Schur decomposition in terms of S and Q, of the formA = Q*S*Q**T. π== 'H': the matrix pencil (A,B) is given in generalized Hessenberg form, and its Schur decompositionA = Q*S*Z**T,B = Q*R*Z**Twill be computed. π«
TRANSβ TRANS is String. Says which form of the system of equations we're solving, with respect to A:== 'N': Equation (1) is solved. πΈ== 'T': Equation (2) is solved. πΈ
Mβ M is INTEGER. The order of the matrices A, B, Y and X.M >= 0.Aβ A is DOUBLE PRECISION array, dimension (LDA,M):- If
FACT == "N", the matrix A is a general matrix, and it gets overwritten with the quasi upper triangular matrix S of the generalized schur decomposition. π - If
FACT == "F", the matrix A contains its (quasi-) upper triangular matrix S of the generalized Schur decomposition of (A,B). π«Ά - If
FACT == "H", the matrix A is an upper Hessenberg matrix of the generalized Hessenberg form (A,B), and it gets overwritten with the quasi upper triangular matrix S of the generalized Schur decomposition. π
- If
LDAβ LDA is INTEGER. The leading dimension of the array A.LDA >= max(1,M).Bβ B is DOUBLE PRECISION array, dimension (LDB,M):- If
FACT == "N", the matrix B is a general matrix, and it gets overwritten with the upper triangular matrix of the generalized Schur decomposition. π - If
FACT == "F", the matrix B contains its upper triangular matrix R of the generalized schur Schur decomposition of (A,B). π«Ά - If
FACT == "H", the matrix B is the upper triangular matrix of the generalized Hessenberg form (A,B), and it gets overwritten with the upper triangular matrix of the generalized Schur decomposition. π
- If
LDBβ LDB is INTEGER. The leading dimension of the array B.LDB >= max(1,M).Qβ Q is DOUBLE PRECISION array, dimension (LDQ,M):- If
FACT == "N", the matrix Q is an empty M-by-M matrix on input and contains the left Schur vectors of (A,B) on output. β¨ - If
FACT == "F", the matrix Q contains the left Schur vectors of (A,B). β - If
FACT == "H", the matrix Q is an empty M-by-M matrix on input and contains the left Schur vectors of (A,B) on output. β¨
- If
LDQβ LDQ is INTEGER. The leading dimension of the array Q.LDQ >= max(1,M).Zβ Z is DOUBLE PRECISION array, dimension (LDZ,M):- If
FACT == "N", the matrix Z is an empty M-by-M matrix on input and contains the right Schur vectors of (A,B) on output. β¨ - If
FACT == "F", the matrix Z contains the right Schur vectors of (A,B). β - If
FACT == "H", the matrix Z is an empty M-by-M matrix on input and contains the right Schur vectors of (A,B) on output. β¨
- If
LDZβ LDZ is INTEGER. The leading dimension of the array Z.LDZ >= max(1,M).Xβ X is DOUBLE PRECISION array, dimension (LDX,N). On input, the matrix X contains the right hand side Y. On output, the matrix X contains the solution of Equation (1) or (2). Right hand side Y and the solution X are symmetric M-by-M matrices. π¦LDXβ LDX is INTEGER. The leading dimension of the array X.LDX >= max(1,M).SCALEβ SCALE is DOUBLE PRECISION. SCALE is a scaling factor to stop overflow from happening in the result. IfINFO == 0then SCALE is1.0D0β otherwise, if one of the inner systems couldn't be solved correctly,0 < SCALE <= 1holds true. π€WORKβ WORK is DOUBLE PRECISION array, dimension (MAX(1,LDWORK))). 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. The C interface does not support the workspace query by settingLDWORK == -1on input. In that case, the \ref mepack_memory_frontend function has to be used. πINFOβ INFO is INTEGERINFOisINTEGERβ the receipt, the vibe check on how the whole thing went down π== 0: successful exit π= 1: DGGES failed= 2: DLA_SORT_GEV failed= 3: Inner solver failed< 0: ifINFO == -i, the i-Th argument had an illegal value π
Attention bestie π β the Fortran/LAPACK-style workspace query where you setLDWORK=-1on input? It will not work in the C interface. You have to use themepack_memory_frontendfunction for this purpose, no cap. That's just how it is here.
- Author β Martin Koehler, MPI Magdeburg
- Date β October 2025
- Definition at line 201 of file
ggstein.c.
β¨ mepack_double_ggstein_refine β¨
void mepack_double_ggstein_refine (const char * TRANS, const char * GUESS,
int M, double * A, int LDA, double * B, int LDB, double * X, int LDX,
double * Y, int LDY, double * AS, int LDAS, double * BS, int LDBS,
double * Q, int LDQ, double * Z, int LDZ, int * MAXIT, double * TAU,
double * CONVLOG, double * WORK, size_t LDWORK, int * INFO)
Iterative Refinement for the Generalized Stein Equation. π¦
π Purpose
mepack_double_ggstein_refine solves a generalized Stein equation, and it comes in two flavors, bestie:
A * X * A^T - B * X * B^T = SCALE * Y (1)
or
A^T * X * A - B^T * X * B = SCALE * Y (2)
where A is a M-by-M matrix using iterative refinement. The right hand side Y and the solution X are M-by-M matrices. The matrix pencil (A,B) needs to be provided as the original data as well as in generalized Schur decomposition, because both are required in the iterative refinement process. Like, both. No skipping. π
π Remarks
This function is a wrapper for dla_ggstein_refine.
π See also
dla_ggstein_refine
π§ Parameters
TRANS
TRANS is String β it tells you which equation we're solving, respect to A:
== 'N': Equation (1) is solved== 'T': Equation (2) is solved
GUESS
GUESS is String β is X holding 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.
M
M is INTEGER β the order of the matrix A. M >= 0.
A
A is DOUBLE 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 DOUBLE PRECISION array, dimension (LDB,M). 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,M).
X
X is DOUBLE PRECISION array, dimension (LDX,M). On input, the array X contains the initial guess. On output, the array X contains the solution X. β¨glow upβ¨
LDX
LDX is INTEGER β the leading dimension of the array X. LDX >= max(1,M).
Y
Y is DOUBLE 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 DOUBLE PRECISION array, dimension (LDAS,M). The array AS contains the generalized Schur decomposition of the matrix A.
LDAS
LDAS is INTEGER β the leading dimension of the array AS. LDAS >= max(1,M).
BS
BS is DOUBLE PRECISION array, dimension (LDBS,M). The array AS contains the generalized Schur decomposition of the matrix B.
LDBS
LDBS is INTEGER β the leading dimension of the array BS. LDBS >= max(1,M).
Q
Q is DOUBLE PRECISION array, dimension (LDQ,M). The array Q contains the left generalized Schur vectors of (A, B) as returned by DGGES3.
LDQ
LDQ is INTEGER β the leading dimension of the array Q. LDQ >= max(1,M).
Z
Z is DOUBLE PRECISION array, dimension (LDZ,M). The array Z contains the right generalized Schur vectors of (A,B) as returned by DGGES3.
LDZ
LDZ is INTEGER β the leading dimension of the array Z. LDZ >= max(1,M).
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. Bestie, watch it flip from "how many I'm allowed" to "how many I actually did" π«Ά
TAU
TAU is DOUBLE 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 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 giving receipts.
WORK
WORK is DOUBLE 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 stepINFO< 0: ifINFO == -i, the i-Th argument had an illegal value
Attention π β same warning, same energy: the Fortran/LAPACK-like workspace query withLDWORK=-1on input will not work in the C interface. You have to use themepack_memory_frontendfunction for this purpose.
- Author β Martin Koehler, MPI Magdeburg
- Date β October 2025
- Definition at line 231 of file
ggstein.c.
πΈ mepack_single_gglyap πΈ
void mepack_single_gglyap (const char * FACT, const char * TRANS, int M,
float * A, int LDA, float * B, int LDB, float * Q, int LDQ, float * Z,
int LDZ, float * X, int LDX, float * SCALE, float * WORK, size_t LDWORK,
int * INFO)
Frontend for the solution of Generalized Lyapunov Equations. π
π Purpose
mepack_single_gglyap solves a generalized Lyapunov equation of the following forms:
A * X * B^T + B * X * A^T = SCALE * Y (1)
or
A^T * X * B + B^T * X * A = SCALE * Y (2)
where (A,B) is a M-by-M matrix pencil. The right hand side Y and the solution X are M-by-M matrices. The matrix pencil (A,B) is either in general form, in generalized Hessenberg form, or in generalized Schur form where Q and Z also need to be provided. Three whole moods, pick your fighter. π
π Remarks
This function is a wrapper for sla_gglyap.
π See also
sla_gglyap
π§ Parameters
FACT
FACT is String β it specifies how the matrix A is given:
== 'N': The matrix pencil(A,B)is given as a general matrix pencil and its Schur decompositionA = Q*S*Z**T,B = Q*R*Z**Twill be computed.== 'F': The matrixAis given as its Schur decomposition in terms ofSandQformA = Q*S*Q**T== 'H': The matrix pencil(A,B)is given in generalized Hessenberg form and its Schur decompositionA = Q*S*Z**T,B = Q*R*Z**Twill be computed.
TRANS
TRANS is String β it specifies the form of the system of equations with respect to A:
== 'N': Equation (1) is solved.== 'T': Equation (2) is solved.
M
M is INTEGER β the order of the matrices A, B, Y and X. M >= 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 matrixSof the generalized Schur decomposition. - If
FACT == "F", the matrixAcontains its (quasi-) upper triangular matrixSof the generalized Schur decomposition of(A,B). - If
FACT == "H", the matrixAis an upper Hessenberg matrix of the generalized Hessenberg form(A,B)and it is overwritten with the quasi upper triangular matrixSof the generalized Schur decomposition.
LDA
LDA is INTEGER β the leading dimension of the array A. LDA >= max(1,M).
B
B is SINGLE PRECISION array, dimension (LDB,M).
- If
FACT == "N", the matrixBa general matrix and it is overwritten with the upper triangular matrix of the generalized Schur decomposition. - If
FACT == "F", the matrixBcontains its upper triangular matrixRof the generalized schur Schur decomposition of(A,B). - If
FACT == "H", the matrixBis the upper triangular matrix of the generalized Hessenberg form(A,B)and it is overwritten with the upper triangular matrix of the generalized Schur decomposition.
LDB
LDB is INTEGER β the leading dimension of the array B. LDB >= max(1,M).
Q
Q is SINGLE PRECISION array, dimension (LDQ,M).
- If
FACT == "N", the matrixQis an empty M-by-M matrix on input and contains the left generalized Schur vectors of(A,B)on output. - If
FACT == "F", the matrixQcontains the left Schur vectors of(A,B). - If
FACT == "H", the matrixQis an empty M-by-M matrix on input and contains the left Schur vectors of(A,B)on output.
LDQ
LDQ is INTEGER β the leading dimension of the array Q. LDQ >= max(1,M).
Z
Z is SINGLE PRECISION array, dimension (LDZ,M).
- If
FACT == "N", the matrixZis an empty M-by-M matrix on input and contains the right generalized Schur vectors of(A,B)on output. - If
FACT == "F", the matrixZcontains the right Schur vectors of(A,B). - If
FACT == "H", the matrixZis an empty M-by-M matrix on input and contains the right Schur vectors of(A,B)on output.
LDZ
LDZ is INTEGER β the leading dimension of the array Z. LDZ >= max(1,M).
XXβ SINGLE PRECISION</p> array, dimension(LDX,N). On input,Xis holding the right hand sideYπ«Ά. On output,Xis holding the solution of Equation (1) or (2). Both the right hand sideYand the solutionXare symmetricM-by-Mmatrices, bestie. Symmetric. Every time. β¨LDXβLDXis INTEGER. It's the leading dimension of the arrayX, and you needLDX >= max(1,M). No exceptions, it's giving boundary check energy. πSCALEβSCALEis SINGLE PRECISION. It's a scaling factor whose whole job is to stop overflow from ruining the result π€. IfINFO == 0thenSCALEis1.0D0, otherwise β like if one of the inner systems could not be solved correctly β then0 < SCALE <= 1holds true.WORKβWORKis SINGLE PRECISION array, dimension(MAX(1,LDWORK)). It's the workspace for the algorithm, and the optimal workspace is given either bymepack_memory_frontend. π§LDWORKβLDWORKis INTEGER. Size of the workspace for the algorithm, counted in floating point numbers of the actual precision. And here's the tea β: the C interface does not support the workspace query by settingLDWORK == -1on input. In that case you have to use themepack_memory_frontendfunction. Periodt.INFOβINFOis INTEGER:== 0: successful exit π= 1:DGGESfailed= 2:DLA_SORT_GEVfailed= 3: Inner solver failed< 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. That's the whole point, don't fight it. π
βοΈ Author βοΈ
Martin Koehler, MPI Magdeburg πΈ
π Date π
October 2025
π Definition π
Definition at line 395 of file gglyap.c.
void mepack_single_gglyap_refine (const char * TRANS, const char * GUESS,
int M, float * A, int LDA, float * B, int LDB, float * X, int LDX, float
* Y, int LDY, float * AS, int LDAS, float * BS, int LDBS, float * Q, int
LDQ, float * Z, int LDZ, int * MAXIT, float * TAU, float * CONVLOG,
float * WORK, size_t LDWORK, int * INFO)
π Iterative Refinement for the Generalized Lyapunov Equation π
Purpose:
mepack_single_gglyap_refine solves a generalized Lyapunov equation of the following forms
A * X * B^T + B * X * A^T = SCALE * Y (1)
or
A^T * X * B + B^T * X * A = SCALE * Y (2)
where A is a M-by-M matrix, using iterative refinement π¦. The right hand side Y and the solution X are M-by-M matrices. And here's the important part: the matrix pencil (A,B) needs to be provided as the original data as well as in generalized Schur decomposition, because both are required in the iterative refinement process. Both. Not one. Both, bestie. π
Remarks
This function is a wrapper for dla_gglyap_refine. It's giving delegation, and honestly? Iconic.
See also
dla_gglyap_refine
Parameters
TRANSβTRANSis String. Specifies the form of the system of equations with respect toA:== 'N': Equation (1) is solved== 'T': Equation (2) is solved
GUESSβGUESSis 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.
MβMis INTEGER. The order of the matrixA.M >= 0.AβAis 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 SINGLE PRECISION array, dimension(LDB,M). The arrayBcontains the original matrixBdefining the equation.LDBβLDBis INTEGER. The leading dimension of the arrayB.LDB >= max(1,M).XβXis SINGLE PRECISION array, dimension(LDX,M). On input, the arrayXcontains the initial guess. On output, the arrayXcontains the solutionX. β¨ glow-up moment β¨LDXβLDXis INTEGER. The leading dimension of the arrayX.LDX >= max(1,M).YβYis SINGLE PRECISION array, dimension(LDY,M). On input, the arrayYcontains the right hand side.LDYβLDYis INTEGER. The leading dimension of the arrayY.LDY >= max(1,M).ASβASis SINGLE PRECISION array, dimension(LDAS,M). The arrayAScontains the generalized Schur decomposition of the matrixA. πLDASβLDASis INTEGER. The leading dimension of the arrayAS.LDAS >= max(1,M).BSβBSis SINGLE PRECISION array, dimension(LDBS,M). The arrayBScontains the generalized Schur decomposition of the matrixB. πLDBSβLDBSis INTEGER. The leading dimension of the arrayBS.LDBS >= max(1,M).QβQis SINGLE PRECISION array, dimension(LDQ,M). The arrayQcontains the left generalized Schur vectors of(A, B)as returned bySGGES3.LDQβLDQis INTEGER. The leading dimension of the arrayQ.LDQ >= max(1,M).ZβZis SINGLE PRECISION array, dimension(LDZ,M). The arrayZcontains the right generalized Schur vectors of(A,B)as returned bySGGES3.LDZβLDZis INTEGER. The leading dimension of the arrayZ.LDZ >= max(1,M).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. It literally tells you how hard it worked π«Ά.TAUβTAUis SINGLE 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βCONVLOGis SINGLE PRECISION array, dimension(MAXIT). TheCONVLOGarray contains the convergence history of the iterative refinement.CONVLOG(I)contains the maximum relative residual before it is solved for theI-Th time. It's a whole receipts folder, and I respect it. πWORKβWORKis 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 callmepack_memory_frontend.INFOβINFOis 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. Yes I said it before, yes I'm saying it again, because apparently it keeps coming up π.
Author
Martin Koehler, MPI Magdeburg πΈ
Date
October 2025
Definition
Definition at line 468 of file gglyap.c.
void mepack_single_ggstein (const char * FACT, const char * TRANS, int M,
float * A, int LDA, float * B, int LDB, float * Q, int LDQ, float * Z,
int LDZ, float * X, int LDX, float * SCALE, float * WORK, size_t LDWORK,
int * INFO)
π Frontend for the Solution of Generalized Stein Equations π
Purpose:
mepack_single_ggstein solves a generalized Stein equation of the following forms
A * X * A^T - B * X * B^T = SCALE * Y (1)
or
A^T * X * A - B^T * X * B = SCALE * Y (2)
where (A,B) is a M-by-M matrix pencil π¦. The right hand side Y and the solution X are M-by-M matrices. The matrix pencil (A,B) is either in general form, in generalized Hessenberg form, or in generalized Schur form, where Q and Z also need to be provided. Three whole moods, pick your fighter. π
Remarks
This function is a wrapper for sla_ggstein.
See also
sla_ggstein
Parameters
FACTβFACTis String. Specifies how the matrixAis given.== 'N': The matrix pencil(A,B)is given as a general matrix pencil and its Schur decompositionA = Q*S*Z**T,B = Q*R*Z**Twill be computed.== 'F': The matrixAis given as its Schur decomposition in terms ofSandQformA = Q*S*Q**T== 'H': The matrix pencil(A,B)is given in generalized Hessenberg form and its Schur decompositionA = Q*S*Z**T,B = Q*R*Z**Twill be computed.
TRANSβTRANSis String. Specifies the form of the system of equations with respect toA:== 'N': Equation (1) is solved.== 'T': Equation (2) is solved.
MβMis INTEGER. The order of the matricesA,B,YandX.M >= 0.AβAis SINGLE PRECISION array, dimension(LDA,M).- If
FACT == "N", the matrixAis a general matrix and it is overwritten with the quasi upper triangular matrixSof the generalized schur decomposition. - If
FACT == "F", the matrixAcontains its (quasi-) upper triangular matrixSof the generalized Schur decomposition of(A,B). - If
FACT == "H", the matrixAis an upper Hessenberg matrix of the generalized Hessenberg form(A,B)and it is overwritten with the quasi upper triangular matrixSof the generalized Schur decomposition.
- If
LDAβLDAis INTEGER. The leading dimension of the arrayA.LDA >= max(1,M).BβBis SINGLE PRECISION array, dimension(LDB,M).- If
FACT == "N", the matrixBa general matrix and it is overwritten with the upper triangular matrix of the generalized Schur decomposition. - If
FACT == "F", the matrixBcontains its upper triangular matrixRof the generalized schur Schur decomposition of(A,B). - If
FACT == "H", the matrixBis the upper triangular matrix of the generalized Hessenberg form(A,B)and it is overwritten with the upper triangular matrix of the generalized Schur decomposition.
- If
LDBβLDBis INTEGER. The leading dimension of the arrayB.LDB >= max(1,M).QQβ SINGLE PRECISION array, dimension(LDQ,M). Okay so here's the tea onQπ«: ifFACT == "N",Qcomes in as an empty M-by-M matrix and leaves stuffed with the left Schur vectors of(A,B). IfFACT == "F",Qalready contains those left Schur vectors of(A,B). And ifFACT == "H", it's the same deal as"N"β empty M-by-M going in, left Schur vectors of(A,B)coming out. πLDQβ INTEGER. The leading dimension of the arrayQ. Lowkey just needsLDQ >= max(1,M). β¨Zβ SINGLE PRECISION array, dimension(LDZ,M). Same energy asQbut for the other side π¦: ifFACT == "N",Zis an empty M-by-M matrix on input and holds the right Schur vectors of(A,B)on output. IfFACT == "F",Zalready contains the right Schur vectors of(A,B). IfFACT == "H", empty M-by-M in, right Schur vectors of(A,B)out.LDZβ INTEGER. The leading dimension of the arrayZ. NeedsLDZ >= max(1,M). πΈXβ SINGLE PRECISION array, dimension(LDX,N). On input, the matrixXis holding the right hand sideY. On output, the matrixXcontains the solution of Equation (1) or (2). And bestie, both the right hand sideYand the solutionXare symmetric M-by-M matrices. πLDXβ INTEGER. The leading dimension of the arrayX.LDX >= max(1,M), no exceptions. πSCALEβ SINGLE PRECISION.SCALEis a scaling factor whose whole job is to prevent the overflow in the result. IfINFO == 0thenSCALEis1.0D0, otherwise β if one of the inner systems could not be solved correctly β then0 < SCALE <= 1holds true. βWORKβ SINGLE PRECISION array, dimension(MAX(1,LDWORK)). Workspace for the algorithm. The optimal workspace is given either by\ref mepack_memory_frontend. πLDWORKβ INTEGER. Size of the workspace for the algorithm, counted in floating point numbers of the actual precision. Heads up though: 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 little status report of the whole operation:== 0: successful exit π= 1:DGGESfailed= 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, don't try theLDWORK=-1thing here, it's giving Fortran and this is not that. Usemepack_memory_frontendinstead. π«Ά
Author
Martin Koehler, MPI Magdeburg
Date
October 2025
Definition at line 397 of file ggstein.c.
β¨ void mepack_single_ggstein_refine (...) β Iterative Refinement for the Generalized Stein Equation β¨
void mepack_single_ggstein_refine (const char * TRANS, const char * GUESS,
int M, float * A, int LDA, float * B, int LDB, float * X, int LDX, float
* Y, int LDY, float * AS, int LDAS, float * BS, int LDBS, float * Q, int
LDQ, float * Z, int LDZ, int * MAXIT, float * TAU, float * CONVLOG,
float * WORK, size_t LDWORK, int * INFO)
Purpose
mepack_single_ggstein_refine solves a generalized Stein equation of the following forms
A * X * A^T - B * X * B^T = SCALE * Y (1)
or
A^T * X * A + B^T * X * B = SCALE * Y (2)
where A is a M-by-M matrix using iterative refinement. π₯
The right hand side Y and the solution X are M-by-M matrices. The matrix pencil (A,B) needs to be provided as the original data as well as in generalized Schur decomposition, since both are required in the iterative refinement process. Like, both. Not one. Both. π
Remarks
This function is a wrapper for sla_ggstein_refine. π¦
See also
sla_ggstein_refine
Parameters
TRANSβTRANSis String. Specifies the form of the system of equations with respect toA:== 'N': Equation (1) is solved== 'T': Equation (2) is solved
GUESSβGUESSis 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. π
Mβ INTEGER. The order of the matrixA.M >= 0.Aβ SINGLE 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β SINGLE PRECISION array, dimension(LDB,M). The arrayBcontains the original matrixBdefining the equation.LDBβ INTEGER. The leading dimension of the arrayB.LDB >= max(1,M).Xβ SINGLE PRECISION array, dimension(LDX,M). On input, the arrayXcontains the initial guess. On output, the arrayXcontains the solutionX. βLDXβ INTEGER. The leading dimension of the arrayX.LDX >= max(1,M).Yβ SINGLE PRECISION array, dimension(LDY,M). On input, the arrayYcontains the right hand side. πLDYβ INTEGER. The leading dimension of the arrayY.LDY >= max(1,M).ASβ SINGLE PRECISION array, dimension(LDAS,M). The arrayAScontains the generalized Schur decomposition of the matrixA. β¨LDASβ INTEGER. The leading dimension of the arrayAS.LDAS >= max(1,M).BSβ SINGLE PRECISION array, dimension(LDBS,M). The arrayAScontains the generalized Schur decomposition of the matrixB.LDBSβ INTEGER. The leading dimension of the arrayBS.LDBS >= max(1,M).Qβ SINGLE PRECISION array, dimension(LDQ,M). The arrayQcontains the left generalized Schur vectors of(A,B)as returned bySGEES3. πLDQβ INTEGER. The leading dimension of the arrayQ.LDQ >= max(1,M).Zβ SINGLE PRECISION array, dimension(LDZ,M). The arrayZcontains the right generalized Schur vectors of(A,B)as returned bySGGES3. πLDZβ INTEGER. The leading dimension of the arrayZ.LDZ >= max(1,M).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β SINGLE 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β SINGLE PRECISION array, dimension(MAXIT). TheCONVLOGarray 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β SINGLE 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, the verdict:== 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.
Not me having to say this twice, but bestie,LDWORK=-1is a Fortran move and this is the C interface. Usemepack_memory_frontend. Periodt. π
Author
Martin Koehler, MPI Magdeburg
Date
October 2025
Definition at line 464 of file ggstein.c.
And that's the whole page, bestie β you ate it. π This one was generated automatically by Doxygen for MEPACK straight from the source code, from Version 1.1.2, dated Thu Oct 9 2025 00:00:00, and it lives at cgglyap(3). Go forth and solve those generalized Stein equations, you icon. πβ¨π¦
π¦ 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