# cgglyap - Man Page

## Name

cgglyap — C-Interface

— C-Interface for generalized Lyapunov and Stein equation with general coefficient matrices.

## Synopsis

### Functions

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.

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.

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.

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.

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.

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.

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.

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

C-Interface for generalized Lyapunov and Stein equation with general coefficient matrices.

The Fortran routines to solve generalized Lyapunov and Stein equations with arbitrary coefficients are wrapped in C to provide an easier access to them. All wrapper routines are direct wrappers to the corresponding Fortran subroutines without sanity checks. These are performed by the Fortran routines. The only difference is that the C interface does not allow LAPACK-like work_space queries. For this purpose the **mepack_memory_frontend** function needs to be used.

## Function Documentation

### 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 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 or in generalized Schur form where Q and Z also needs to be provided..fiRemarksThis function is a wrapper fordla_gglyap.See also dla_gglyap ParametersFACTFACT is String Specifies how the matrix A is given. == 'N': The matrix pencil (A,B) is given as a general matrix pencil and its Schur decomposition A = Q*S*Z**T, B = Q*R*Z**T will be computed. == 'F': The matrix A is given as its Schur decomposition in terms of S and Q form A = Q*S*Q**T

*TRANS*

TRANS is String 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 DOUBLE PRECISION array, dimension (LDA,M) If FACT == 'N', the matrix A is a general matrix and it is overwritten with then 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).

*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 a general matrix and it is 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).

*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 generalized Schur vectors of (A,B) on output. If FACT == 'F', the matrix Q contains the left generalized Schur vectors of (A,B).

*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 generalized Schur vectors of (A,B) on output. If FACT == 'F', the matrix Z contains the right generalized Schur vectors of (A,B).

*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 prevent the overflow in the result. If INFO == 0 then SCALE is 1.0D0 otherwise if one of the inner systems could not be solved correctly, 0 < SCALE <= 1 holds true.

*WORK*

WORK is DOUBLE PRECISION array, dimension (MAX(1,LDWORK)) Workspace for the algorithm. The optimal workspace is given either 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 setting LDWORK == -1 on input. In this case, the \ref mepack_memory_frontend function have to be used.

*INFO*

INFO is INTEGER == 0: successful exit = 1: DGGES 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.**Author**Martin Koehler, MPI Magdeburg

**Date**Januar 2023

Definition at line **188** of file **gglyap.c**.

### 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 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..fiRemarksThis function is a wrapper for dla_gglyap_refine.See also dla_gglyap_refine ParametersTRANSTRANS is String Specifies the form of the system of equations with respect to A: == 'N': Equation (1) is solved == 'T': Equation (2) is solved

*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.

*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.

*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 BS 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.

*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.

*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 step INFO < 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.**Author**Martin Koehler, MPI Magdeburg

**Date**Januar 2023

Definition at line **233** of file **gglyap.c**.

### 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 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 or in generalized Schur form where Q and Z also needs to be provided..fiRemarksThis function is a wrapper fordla_ggstein.See also dla_ggstein ParametersFACTFACT is String Specifies how the matrix A is given. == 'N': The matrix pencil (A,B) is given as a general matrix pencil and its Schur decomposition A = Q*S*Z**T, B = Q*R*Z**T will be computed. == 'F': The matrix A is given as its Schur decomposition in terms of S and Q form A = Q*S*Q**T

*TRANS*

TRANS is String 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 DOUBLE PRECISION array, dimension (LDA,M) If FACT == 'N', the matrix A is a general matrix and it is overwritten with then 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).

*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 a general matrix and it is 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).

*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).

*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).

*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 prevent the overflow in the result. If INFO == 0 then SCALE is 1.0D0 otherwise if one of the inner systems could not be solved correctly, 0 < SCALE <= 1 holds true.

*WORK*

WORK is DOUBLE PRECISION array, dimension (MAX(1,LDWORK)) Workspace for the algorithm. The optimal workspace is given either 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 setting LDWORK == -1 on input. In this case, the \ref mepack_memory_frontend function have to be used.

*INFO*

INFO is INTEGER == 0: successful exit = 1: DGGES 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.**Author**Martin Koehler, MPI Magdeburg

**Date**Januar 2023

Definition at line **190** of file **ggstein.c**.

### 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 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..fiRemarksThis function is a wrapper for dla_ggstein_refine.See also dla_ggstein_refine ParametersTRANSTRANS is String Specifies the form of the system of equations with respect to A: == 'N': Equation (1) is solved == 'T': Equation (2) is solved

*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.

*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.

*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.

*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.

*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 step INFO < 0: if INFO == -i, the i-Th argument had an illegal value

**Attention****mepack_memory_frontend**function for this purpose.**Author**Martin Koehler, MPI Magdeburg

**Date**Januar 2023

Definition at line **231** of file **ggstein.c**.

### 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 or in generalized Schur form where Q and Z also needs to be provided..fiRemarksThis function is a wrapper forsla_gglyap.See also sla_gglyap ParametersFACTFACT is String Specifies how the matrix A is given. == 'N': The matrix pencil (A,B) is given as a general matrix pencil and its Schur decomposition A = Q*S*Z**T, B = Q*R*Z**T will be computed. == 'F': The matrix A is given as its Schur decomposition in terms of S and Q form A = Q*S*Q**T

*TRANS*

TRANS is String 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 matrix A is a general matrix and it is overwritten with then 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).

*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 matrix B a general matrix and it is 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).

*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 matrix Q is an empty M-by-M matrix on input and contains the left generalized Schur vectors of (A,B) on output. If FACT == 'F', the matrix Q contains the left Schur vectors of (A,B).

*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 matrix Z is an empty M-by-M matrix on input and contains the right generalized Schur vectors of (A,B) on output. If FACT == 'F', the matrix Z contains the right Schur vectors of (A,B).

*LDZ*

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

*X*

X is SINGLE PRECISION array, dimension (LDX,N) On input, the matrix X contains the right hand side Y. On output, the matrix X contains the solution of Equation (1) or (2) 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 SINGLE PRECISION SCALE is a scaling factor to prevent the overflow in the result. If INFO == 0 then SCALE is 1.0D0 otherwise if one of the inner systems could not be solved correctly, 0 < SCALE <= 1 holds true.

*WORK*

WORK is SINGLE PRECISION array, dimension (MAX(1,LDWORK)) Workspace for the algorithm. The optimal workspace is given either 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 setting LDWORK == -1 on input. In this case, the \ref mepack_memory_frontend function have to be used.

*INFO*

INFO is INTEGER == 0: successful exit = 1: DGGES failed = 2: DLA_SORT_GEV failed = 3: Inner solver failed < 0: if INFO == -i, the i-Th argument had an illegal value

**Attention****mepack_memory_frontend**function for this purpose.**Author**Martin Koehler, MPI Magdeburg

**Date**Januar 2023

Definition at line **373** 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. 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..fiRemarksThis function is a wrapper for dla_gglyap_refine.See also dla_gglyap_refine ParametersTRANSTRANS is String Specifies the form of the system of equations with respect to A: == 'N': Equation (1) is solved == 'T': Equation (2) is solved

*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.

*M*

M is INTEGER The order of the matrix A. M >= 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,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 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 matrix A.

*LDAS*

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

*BS*

BS is SINGLE PRECISION array, dimension (LDBS,M) The array BS 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 SINGLE PRECISION array, dimension (LDQ,M) The array Q contains the left generalized Schur vectors of (A, B) as returned by SGGES3.

*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 of (A,B) as returned by SGGES3.

*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.

*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: if INFO == -i, the i-Th argument had an illegal value

**Attention****mepack_memory_frontend**function for this purpose.**Author**Martin Koehler, MPI Magdeburg

**Date**Januar 2023

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 or in generalized Schur form where Q and Z also needs to be provided..fiRemarksThis function is a wrapper forsla_ggstein.See also sla_ggstein ParametersFACTFACT is String Specifies how the matrix A is given. == 'N': The matrix pencil (A,B) is given as a general matrix pencil and its Schur decomposition A = Q*S*Z**T, B = Q*R*Z**T will be computed. == 'F': The matrix A is given as its Schur decomposition in terms of S and Q form A = Q*S*Q**T

*TRANS*

*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 matrix A is a general matrix and it is overwritten with then 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).

*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 matrix B a general matrix and it is 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).

*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 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).

*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 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).

*LDZ*

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

*X*

X is SINGLE PRECISION array, dimension (LDX,N) On input, the matrix X contains the right hand side Y. On output, the matrix X contains the solution of Equation (1) or (2) 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 SINGLE PRECISION SCALE is a scaling factor to prevent the overflow in the result. If INFO == 0 then SCALE is 1.0D0 otherwise if one of the inner systems could not be solved correctly, 0 < SCALE <= 1 holds true.

*WORK*

WORK is SINGLE PRECISION array, dimension (MAX(1,LDWORK)) Workspace for the algorithm. The optimal workspace is given either by \ref mepack_memory_frontend.

*LDWORK*

*INFO*

**Attention****mepack_memory_frontend**function for this purpose.**Author**Martin Koehler, MPI Magdeburg

**Date**Januar 2023

Definition at line **375** of file **ggstein.c**.

### 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.

**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..fiRemarksThis function is a wrapper for sla_ggstein_refine.See also sla_ggstein_refine ParametersTRANSTRANS is String Specifies the form of the system of equations with respect to A: == 'N': Equation (1) is solved == 'T': Equation (2) is solved

*GUESS*

*M*

M is INTEGER The order of the matrix A. M >= 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,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 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 matrix A.

*LDAS*

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

*BS*

BS is SINGLE 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 SINGLE PRECISION array, dimension (LDQ,M) The array Q contains the left generalized Schur vectors of (A,B) as returned by SGEES3.

*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 of (A,B) as returned by SGGES3.

*LDZ*

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

*MAXIT*

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

*INFO*

**Attention****mepack_memory_frontend**function for this purpose.**Author**Martin Koehler, MPI Magdeburg

**Date**Januar 2023

Definition at line **464** of file **ggstein.c**.

## Author

Generated automatically by Doxygen for MEPACK from the source code.