# cggsylv - Man Page

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

The Fortran routines to solve the generalized Sylvester equation 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_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..fiRemarksThis function is a wrapper fordla_ggcsylv.See also dla_ggcsylv ParametersFACTAFACTA 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 decomposition A = QA*S*ZA**T, C = QA*R*ZA**T will be computed. == 'F': The matrix pencil (A,C) is already in generalized Schur form and S, R, QA, and ZA are given. == 'H': The matrix pencil (A,C) is given in generalized Hessenberg form and its Schur decomposition A = QA*S*ZA**T, C = QA*R*ZA**T will 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 decomposition B = QB*U*ZB**T, D = QB*V*ZB**T will be computed. == 'F': The matrix pencil (B,D) is already in generalized Schur form and U, V, QB, and ZB are given. == 'H': The matrix pencil (B,D) is given in generalized Hessenberg form and its Schur decomposition B = QB*U*ZB**T, D = QB*V*ZB**T will 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 matrix A is a general matrix and it is overwritten with the (quasi-) upper triangular factor S of the Schur decomposition of (A,C). If FACT == 'F', the matrix A contains its (quasi-) upper triangular matrix S of the Schur decomposition of (A,C). If FACT == 'H', the matrix A is an upper Hessenberg matrix of the generalized Hessenberg form (A,C) and it is overwritten with the (quasi-) upper triangular factor S of 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 matrix B is a general matrix and it is overwritten with the (quasi-) upper triangular factor U of the Schur decomposition of (B,D). If FACT == 'F', the matrix B contains its (quasi-) upper triangular matrix U of the Schur decomposition of (B,D). If FACT == 'H', the matrix B is an upper Hessenberg matrix of the generalized Hessenberg form (B,D) and it is overwritten with the (quasi-) upper triangular factor U of 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 matrix C is a general matrix and it is overwritten with the upper triangular factor R of the Schur decomposition of (A,C). If FACT == 'F', the matrix C contains its upper triangular matrix R of the Schur decomposition of (A,C). If FACT == 'H', the matrix C is the upper triangular matrix of the generalized Hessenberg form (A,C) and it is overwritten with the upper triangular factor R of 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 matrix D is a general matrix and it is overwritten with the upper triangular factor V of the Schur decomposition of (B,D). If FACT == 'F', the matrix D contains its upper triangular matrix V of the Schur decomposition of (B,D). If FACT == 'H', the matrix D is the upper triangular matrix of the generalized Hessenberg form (B,D) and it is overwritten with the upper triangular factor V of 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 matrix QA is an empty M-by-M matrix on input and contains the left Schur vectors of (A,C) on output. If FACT == 'F', the matrix QA contains the left Schur vectors of (A,C). If FACT == 'H', the matrix QA is 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 matrix ZA is an empty M-by-M matrix on input and contains the right Schur vectors of (A,C) on output. If FACT == 'F', the matrix ZA contains the right Schur vectors of (A,C). If FACT == 'H', the matrix ZA is 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,N) If FACT == 'N', the matrix QB is an empty N-by-N matrix on input and contains the left Schur vectors of (B,D) on output. If FACT == 'F', the matrix QB contains the left Schur vectors of (B,D). If FACT == 'H', the matrix QB is 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,N).

*ZB*

ZB is DOUBLE PRECISION array, dimension (LDZB,N) If FACT == 'N', the matrix ZB is an empty N-by-N matrix on input and contains the right Schur vectors of (B,D) on output. If FACT == 'F', the matrix ZB contains the right Schur vectors of (B,D). If FACT == 'H', the matrix ZB is 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,N).

*E*

E is DOUBLE PRECISION array, dimension (LDE,N) On input, the matrix E contains the right hand side E. On output, the matrix E contains the solution R.

*LDE*

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

*F*

F is DOUBLE PRECISION array, dimension (LDF,N) On input, the matrix F contains the right hand side F. On output, the matrix F contains the solution L.

*LDF*

LDF is INTEGER The leading dimension of the array F. LDF >= 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 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: 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.**Author**Martin Koehler, MPI Magdeburg

**Date**January 2024

Definition at line **318** of file **cgsylv.c**.

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

**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)..fiRemarksThis function is a wrapper fordla_ggcsylv_dual.See also dla_ggcsylv_dual ParametersFACTAFACTA 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 decomposition A = QA*S*ZA**T, C = QA*R*ZA**T will be computed. == 'F': The matrix pencil (A,C) is already in generalized Schur form and S, R, QA, and ZA are given. == 'H': The matrix pencil (A,C) is given in generalized Hessenberg form and its Schur decomposition A = QA*S*ZA**T, C = QA*R*ZA**T will 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 decomposition B = QB*U*ZB**T, D = QB*V*ZB**T will be computed. == 'F': The matrix pencil (B,D) is already in generalized Schur form and U, V, QB, and ZB are given. == 'H': The matrix pencil (B,D) is given in generalized Hessenberg form and its Schur decomposition B = QB*U*ZB**T, D = QB*V*ZB**T will 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 matrix A is a general matrix and it is overwritten with the (quasi-) upper triangular factor S of the Schur decomposition of (A,C). If FACT == 'F', the matrix A contains its (quasi-) upper triangular matrix S of the Schur decomposition of (A,C). If FACT == 'H', the matrix A is an upper Hessenberg matrix of the generalized Hessenberg form (A,C) and it is overwritten with the (quasi-) upper triangular factor S of 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 matrix B is a general matrix and it is overwritten with the (quasi-) upper triangular factor U of the Schur decomposition of (B,D). If FACT == 'F', the matrix B contains its (quasi-) upper triangular matrix U of the Schur decomposition of (B,D). If FACT == 'H', the matrix B is an upper Hessenberg matrix of the generalized Hessenberg form (B,D) and it is overwritten with the (quasi-) upper triangular factor U of 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 matrix C is a general matrix and it is overwritten with the upper triangular factor R of the Schur decomposition of (A,C). If FACT == 'F', the matrix C contains its upper triangular matrix R of the Schur decomposition of (A,C). If FACT == 'H', the matrix C is the upper triangular matrix of the generalized Hessenberg form (A,C) and it is overwritten with the upper triangular factor R of 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 matrix D is a general matrix and it is overwritten with the upper triangular factor V of the Schur decomposition of (B,D). If FACT == 'F', the matrix D contains its upper triangular matrix V of the Schur decomposition of (B,D). If FACT == 'H', the matrix D is the upper triangular matrix of the generalized Hessenberg form (B,D) and it is overwritten with the upper triangular factor V of 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 matrix QA is an empty M-by-M matrix on input and contains the left Schur vectors of (A,C) on output. If FACT == 'F', the matrix QA contains the left Schur vectors of (A,C). If FACT == 'H', the matrix QA is 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 matrix ZA is an empty M-by-M matrix on input and contains the right Schur vectors of (A,C) on output. If FACT == 'F', the matrix ZA contains the right Schur vectors of (A,C). If FACT == 'H', the matrix ZA is 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,N) If FACT == 'N', the matrix QB is an empty N-by-N matrix on input and contains the left Schur vectors of (B,D) on output. If FACT == 'F', the matrix QB contains the left Schur vectors of (B,D). If FACT == 'H', the matrix QB is 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,N).

*ZB*

ZB is DOUBLE PRECISION array, dimension (LDZB,N) If FACT == 'N', the matrix ZB is an empty N-by-N matrix on input and contains the right Schur vectors of (B,D) on output. If FACT == 'F', the matrix ZB contains the right Schur vectors of (B,D). If FACT == 'H', the matrix ZB is 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,N).

*E*

E is DOUBLE PRECISION array, dimension (LDE,N) On input, the matrix E contains the right hand side E. On output, the matrix E contains the solution R.

*LDE*

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

*F*

F is DOUBLE PRECISION array, dimension (LDF,N) On input, the matrix F contains the right hand side F. On output, the matrix F contains the solution L.

*LDF*

LDF is INTEGER The leading dimension of the array F. LDF >= 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 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: 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.**Author**Martin Koehler, MPI Magdeburg

**Date**January 2024

Definition at line **335** of file **cgsylv_dual.c**.

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

**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)..fiRemarksThis function is a wrapper fordla_ggcsylv_dual_refine.See also dla_ggcsylv_dual_refine ParametersTRANSATRANSA 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 (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*

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) 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,N) The array B contains the original matrix B defining the equation.

*LDB*

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

*C*

C is DOUBLE 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 DOUBLE PRECISION array, dimension (LDD,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).

*R*

R is DOUBLE 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*

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

*L*

L is DOUBLE 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*

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

*E*

E is DOUBLE PRECISION array, dimension (LDE,N) On input, the array E contains the right hand side E.

*LDE*

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

*F*

F is DOUBLE PRECISION array, dimension (LDF,N) On input, the array F contains the right hand side F.

*LDF*

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

*AS*

AS is DOUBLE 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 DOUBLE PRECISION array, dimension (LDBS,N) The array BS contains the generalized Schur decomposition of the B.

*LDBS*

LDBS is INTEGER The leading dimension of the array BS. LDBS >= max(1,N).

*CS*

CS is DOUBLE PRECISION array, dimension (LDC,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 DOUBLE 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. LDDS >= max(1,N).

*Q*

Q is DOUBLE 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 DOUBLE 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 DOUBLE 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 DOUBLE 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 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 of both equations 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**January 2024

Definition at line **374** of file **cgsylv_dual.c**.

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

**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*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**GUESS*GUESS is 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*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) 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,N) The array B contains the original matrix B defining the equation.

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

*C*C is DOUBLE 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 DOUBLE PRECISION array, dimension (LDD,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).

*R*R is DOUBLE 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*LDR is INTEGER The leading dimension of the array R. LDR >= max(1,M).

*L*L is DOUBLE 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*LDL is INTEGER The leading dimension of the array L. LDL >= max(1,M).

*E*E is DOUBLE PRECISION array, dimension (LDE,N) On input, the array E contains the right hand side E.

*LDE*LDE is INTEGER The leading dimension of the array E. LDE >= max(1,M).

*F*F is DOUBLE PRECISION array, dimension (LDF,N) On input, the array F contains the right hand side F.

*LDF*LDF is INTEGER The leading dimension of the array F. LDF >= max(1,M).

*AS*AS is DOUBLE 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 DOUBLE PRECISION array, dimension (LDBS,N) The array BS contains the generalized Schur decomposition of the B.

*LDBS*LDBS is INTEGER The leading dimension of the array BS. LDBS >= max(1,N).

*CS*CS is DOUBLE 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 DOUBLE 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. LDDS >= max(1,N).

*Q*Q is DOUBLE 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 DOUBLE 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 DOUBLE 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 DOUBLE 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 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 of both equations 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**January 2024

Definition at line **353** of file **cgsylv.c**.

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

**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..fiRemarksThis function is a wrapper fordla_ggsylv.See also dla_ggsylv ParametersFACTAFACTA 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 decomposition A = QA*S*ZA**T, C = QA*R*ZA**T will be computed. == 'F': The matrix pencil (A,C) is already in generalized Schur form and S, R, QA, and ZA are given. == 'H': The matrix pencil (A,C) is given in generalized Hessenberg form and its Schur decomposition A = QA*S*ZA**T, C = QA*R*ZA**T will 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 decomposition B = QB*U*ZB**T, D = QB*V*ZB**T will be computed. == 'F': The matrix pencil (B,D) is already in generalized Schur form and U, V, QB, and ZB are given. == 'H': The matrix pencil (B,D) is given in generalized Hessenberg form and its Schur decomposition B = QB*U*ZB**T, D = QB*V*ZB**T will be computed.

*TRANSA*

*TRANSB*

*SGN*

SGN is DOUBLE PRECISION, allowed values: +/-1 Specifies the sign between the two parts of the Sylvester equation. = 1 : Solve Equation (1) == -1: Solve Equation (2)

*M*

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

*N*

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

*A*

A is DOUBLE PRECISION array, dimension (LDA,M) If FACT == 'N', the matrix A is a general matrix and it is overwritten with the (quasi-) upper triangular factor S of the Schur decomposition of (A,C). If FACT == 'F', the matrix A contains its (quasi-) upper triangular matrix S of the Schur decomposition of (A,C). If FACT == 'H', the matrix A is an upper Hessenberg matrix of the generalized Hessenberg form (A,C) and it is overwritten with the (quasi-) upper triangular factor S of 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 matrix B is a general matrix and it is overwritten with the (quasi-) upper triangular factor U of the Schur decomposition of (B,D). If FACT == 'F', the matrix B contains its (quasi-) upper triangular matrix U of the Schur decomposition of (B,D). If FACT == 'H', the matrix B is an upper Hessenberg matrix of the generalized Hessenberg form (B,D) and it is overwritten with the (quasi-) upper triangular factor U of 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 matrix C is a general matrix and it is overwritten with the upper triangular factor R of the Schur decomposition of (A,C). If FACT == 'F', the matrix C contains its upper triangular matrix R of the Schur decomposition of (A,C). If FACT == 'H', the matrix C is the upper triangular matrix of the generalized Hessenberg form (A,C) and it is overwritten with the upper triangular factor R of 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 matrix D is a general matrix and it is overwritten with the upper triangular factor V of the Schur decomposition of (B,D). If FACT == 'F', the matrix D contains its upper triangular matrix V of the Schur decomposition of (B,D). If FACT == 'H', the matrix D is the upper triangular matrix of the generalized Hessenberg form (B,D) and it is overwritten with the upper triangular factor V of 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 matrix QA is an empty M-by-M matrix on input and contains the left Schur vectors of (A,C) on output. If FACT == 'F', the matrix QA contains the left Schur vectors of (A,C). If FACT == 'H', the matrix QA is 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 matrix ZA is an empty M-by-M matrix on input and contains the right Schur vectors of (A,C) on output. If FACT == 'F', the matrix ZA contains the right Schur vectors of (A,C). If FACT == 'H', the matrix ZA is 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,N) If FACT == 'N', the matrix QB is an empty N-by-N matrix on input and contains the left Schur vectors of (B,D) on output. If FACT == 'F', the matrix QB contains the left Schur vectors of (B,D). If FACT == 'H', the matrix QB is 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,N).

*ZB*

ZB is DOUBLE PRECISION array, dimension (LDZB,N) If FACT == 'N', the matrix ZB is an empty N-by-N matrix on input and contains the right Schur vectors of (B,D) on output. If FACT == 'F', the matrix ZB contains the right Schur vectors of (B,D). If FACT == 'H', the matrix ZB is 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,N).

*X*

X is DOUBLE PRECISION array, dimension (LDX,N) On input, the matrix X contains the right hand side Y. On output, the matrix X contains the solution of Equation (1) or (2) Right hand side Y and the solution X are M-by-N 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 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: DHGGES 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**January 2024

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.

**Remarks**This function is a wrapper for

**dla_ggsylv_refine****See also****dla_ggsylv_refine****Parameters***TRANSA**TRANSB**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 DOUBLE 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 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,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 DOUBLE 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 DOUBLE PRECISION array, dimension (LDD,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 DOUBLE PRECISION array, dimension (LDX,N) 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,N) 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 A.

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

*BS*BS is DOUBLE PRECISION array, dimension (LDBS,N) The array BS contains the generalized Schur decomposition of the B.

*LDBS*LDBS is INTEGER The leading dimension of the array BS. LDBS >= max(1,N).

*CS*CS is DOUBLE 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 DOUBLE 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. LDDS >= max(1,N).

*Q*Q is DOUBLE 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 DOUBLE 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 DOUBLE 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 DOUBLE 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 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**January 2024

Definition at line **324** of file **ggsylv.c**.

### 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..fiRemarksThis function is a wrapper forsla_ggcsylv.See also sla_ggcsylv ParametersFACTAFACTA 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 decomposition A = QA*S*ZA**T, C = QA*R*ZA**T will be computed. == 'F': The matrix pencil (A,C) is already in generalized Schur form and S, R, QA, and ZA are given. == 'H': The matrix pencil (A,C) is given in generalized Hessenberg form and its Schur decomposition A = QA*S*ZA**T, C = QA*R*ZA**T will be computed.

*FACTB*

*TRANSA*

*TRANSB*

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

*LDA*

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

*B*

*LDB*

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

*C*

*LDC*

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

*D*

*LDD*

LDD is INTEGER The leading dimension of the array D. LDD >= max(1,N).

*QA*

*LDQA*

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

*ZA*

*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 matrix QB is an empty M-by-M matrix on input and contains the left Schur vectors of (B,D) on output. If FACT == 'F', the matrix QB contains the left Schur vectors of (B,D). If FACT == 'H', the matrix QB is 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 matrix ZB is an empty M-by-M matrix on input and contains the right Schur vectors of (B,D) on output. If FACT == 'F', the matrix ZB contains the right Schur vectors of (B,D). If FACT == 'H', the matrix ZB is 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 E contains the right hand side E. On output, the matrix E contains the solution R.

*LDE*

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

*F*

F is DOUBLE PRECISION array, dimension (LDF,N) On input, the matrix F contains the right hand side F. On output, the matrix F contains the solution L.

*LDF*

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

*SCALE*

*WORK*

*LDWORK*

*INFO*

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

**Date**January 2024

Definition at line **644** of file **cgsylv.c**.

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

**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)..fiRemarksThis function is a wrapper forsla_ggcsylv_dual.See also sla_ggcsylv_dual ParametersFACTAFACTA 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 decomposition A = QA*S*ZA**T, C = QA*R*ZA**T will be computed. == 'F': The matrix pencil (A,C) is already in generalized Schur form and S, R, QA, and ZA are given. == 'H': The matrix pencil (A,C) is given in generalized Hessenberg form and its Schur decomposition A = QA*S*ZA**T, C = QA*R*ZA**T will be computed.

*FACTB*

*TRANSA*

*TRANSB*

*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 matrix A is a general matrix and it is overwritten with the (quasi-) upper triangular factor S of the Schur decomposition of (A,C). If FACT == 'F', the matrix A contains its (quasi-) upper triangular matrix S of the Schur decomposition of (A,C). If FACT == 'H', the matrix A is an upper Hessenberg matrix of the generalized Hessenberg form (A,C) and it is overwritten with the (quasi-) upper triangular factor S of 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 matrix B is a general matrix and it is overwritten with the (quasi-) upper triangular factor U of the Schur decomposition of (B,D). If FACT == 'F', the matrix B contains its (quasi-) upper triangular matrix U of the Schur decomposition of (B,D). If FACT == 'H', the matrix B is an upper Hessenberg matrix of the generalized Hessenberg form (B,D) and it is overwritten with the (quasi-) upper triangular factor U of 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 matrix C is a general matrix and it is overwritten with the upper triangular factor R of the Schur decomposition of (A,C). If FACT == 'F', the matrix C contains its upper triangular matrix R of the Schur decomposition of (A,C). If FACT == 'H', the matrix C is the upper triangular matrix of the generalized Hessenberg form (A,C) and it is overwritten with the upper triangular factor R of 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 matrix D is a general matrix and it is overwritten with the upper triangular factor V of the Schur decomposition of (B,D). If FACT == 'F', the matrix D contains its upper triangular matrix V of the Schur decomposition of (B,D). If FACT == 'H', the matrix D is the upper triangular matrix of the generalized Hessenberg form (B,D) and it is overwritten with the upper triangular factor V of 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 matrix QA is an empty M-by-M matrix on input and contains the left Schur vectors of (A,C) on output. If FACT == 'F', the matrix QA contains the left Schur vectors of (A,C). If FACT == 'H', the matrix QA is 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 matrix ZA is an empty M-by-M matrix on input and contains the right Schur vectors of (A,C) on output. If FACT == 'F', the matrix ZA contains the right Schur vectors of (A,C). If FACT == 'H', the matrix ZA is 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 matrix QB is an empty M-by-M matrix on input and contains the left Schur vectors of (B,D) on output. If FACT == 'F', the matrix QB contains the left Schur vectors of (B,D). If FACT == 'H', the matrix QB is 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 SINGLE PRECISION array, dimension (LDZB,M) If FACT == 'N', the matrix ZB is an empty M-by-M matrix on input and contains the right Schur vectors of (B,D) on output. If FACT == 'F', the matrix ZB contains the right Schur vectors of (B,D). If FACT == 'H', the matrix ZB is 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 SINGLE PRECISION array, dimension (LDE,N) On input, the matrix E contains the right hand side E. On output, the matrix E contains the solution R.

*LDE*

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

*F*

F is SINGLE PRECISION array, dimension (LDF,N) On input, the matrix F contains the right hand side F. On output, the matrix F contains the solution L.

*LDF*

LDF is INTEGER The leading dimension of the array X. LDF >= 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 by \ref mepack_memory_frontend.

*LDWORK*

*INFO*

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

**Date**January 2024

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)

Iterative Refinement for the dual Coupled Generalized Sylvester Equations.

**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)..fiRemarksThis function is a wrapper forsla_ggcsylv_dual_refine.See also sla_ggcsylv_dual_refine ParametersTRANSATRANSA 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*

*GUESS*

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

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

*R*

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

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

*L*

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

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

*E*

E is SINGLE PRECISION array, dimension (LDE,N) On input, the array E contains the right hand side E.

*LDE*

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

*F*

F is SINGLE PRECISION array, dimension (LDF,N) On input, the array F contains the right hand side F.

*LDF*

LDF is INTEGER The leading dimension of the array F. LDF >= 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.

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

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

*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 of both equations 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**January 2024

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 since both are required in the iterative refinement procedure.

**Remarks**This function is a wrapper for

**sla_ggcsylv_refine****See also****sla_ggcsylv_refine****Parameters***TRANSA**TRANSB**GUESS**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) 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 A. 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).

*R*R is 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*LDR is INTEGER The leading dimension of the array R. LDR >= max(1,M).

*L*L is 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*LDL is INTEGER The leading dimension of the array L. LDL >= max(1,M).

*E*E is SINGLE PRECISION array, dimension (LDE,N) On input, the array E contains the right hand side E.

*LDE*LDE is INTEGER The leading dimension of the array E. LDE >= max(1,M).

*F*F is SINGLE PRECISION array, dimension (LDF,N) On input, the array F contains the right hand side F.

*LDF*LDF is INTEGER The leading dimension of the array F. LDF >= 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.

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

*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**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 of both equations 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**January 2024

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..fiRemarksThis function is a wrapper forsla_ggsylv.See also sla_ggsylv ParametersFACTAFACTA 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 decomposition A = QA*S*ZA**T, C = QA*R*ZA**T will be computed. == 'F': The matrix pencil (A,C) is already in generalized Schur form and S, R, QA, and ZA are given. == 'H': The matrix pencil (A,C) is given in generalized Hessenberg form and its Schur decomposition A = QA*S*ZA**T, C = QA*R*ZA**T will be computed.

*FACTB*

*TRANSA*

*TRANSB*

*SGN*

SGN is SINGLE PRECISION, allowed values: +/-1 Specifies the sign between the two parts of the Sylvester equation. = 1 : Solve Equation (1) == -1: Solve Equation (2)

*M*

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

*N*

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

*A*

A is SINGLE PRECISION array, dimension (LDA,M) If FACT == 'N', the matrix A is a general matrix and it is overwritten with the (quasi-) upper triangular factor S of the Schur decomposition of (A,C). If FACT == 'F', the matrix A contains its (quasi-) upper triangular matrix S of the Schur decomposition of (A,C). If FACT == 'H', the matrix A is an upper Hessenberg matrix of the generalized Hessenberg form (A,C) and it is overwritten with the (quasi-) upper triangular factor S of 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 matrix B is a general matrix and it is overwritten with the (quasi-) upper triangular factor U of the Schur decomposition of (B,D). If FACT == 'F', the matrix B contains its (quasi-) upper triangular matrix U of the Schur decomposition of (B,D). If FACT == 'H', the matrix B is an upper Hessenberg matrix of the generalized Hessenberg form (B,D) and it is overwritten with the (quasi-) upper triangular factor U of 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 matrix C is a general matrix and it is overwritten with the upper triangular factor R of the Schur decomposition of (A,C). If FACT == 'F', the matrix C contains its upper triangular matrix R of the Schur decomposition of (A,C). If FACT == 'H', the matrix C is the upper triangular matrix of the generalized Hessenberg form (A,C) and it is overwritten with the upper triangular factor R of 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 matrix D is a general matrix and it is overwritten with the upper triangular factor V of the Schur decomposition of (B,D). If FACT == 'F', the matrix D contains its upper triangular matrix V of the Schur decomposition of (B,D). If FACT == 'H', the matrix D is the upper triangular matrix of the generalized Hessenberg form (B,D) and it is overwritten with the upper triangular factor V of 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 matrix QA is an empty M-by-M matrix on input and contains the left Schur vectors of (A,C) on output. If FACT == 'F', the matrix QA contains the left Schur vectors of (A,C). If FACT == 'H', the matrix QA is 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 matrix ZA is an empty M-by-M matrix on input and contains the right Schur vectors of (A,C) on output. If FACT == 'F', the matrix ZA contains the right Schur vectors of (A,C). If FACT == 'H', the matrix ZA is 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 matrix QB is an empty M-by-M matrix on input and contains the left Schur vectors of (B,D) on output. If FACT == 'F', the matrix QB contains the left Schur vectors of (B,D). If FACT == 'H', the matrix QB is 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 SINGLE PRECISION array, dimension (LDZB,M) If FACT == 'N', the matrix ZB is an empty M-by-M matrix on input and contains the right Schur vectors of (B,D) on output. If FACT == 'F', the matrix ZB contains the right Schur vectors of (B,D). If FACT == 'H', the matrix ZB is 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).

*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. LDB >= max(1,M).

*SCALE*

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

*WORK*

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

*LDWORK*

*INFO*

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

**Date**January 2024

Definition at line **614** of file **ggsylv.c**.

### 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***TRANSA**TRANSB**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.

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

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

Definition at line **660** of file **ggsylv.c**.

## Author

Generated automatically by Doxygen for MEPACK from the source code.