# cgesylv - Man Page

## Name

cgesylv — C-Interface

— C-Interface for standard Sylvester equations.

## Synopsis

### Functions

void mepack_double_gesylv (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 *QA, int LDQA, double *QB, int LDQB, double *X, int LDX, double *SCALE, double *WORK, size_t LDWORK, int *INFO)
Frontend for the solution of Standard Sylvester Equations.
void mepack_single_gesylv (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 *QA, int LDQA, float *QB, int LDQB, float *X, int LDX, float *SCALE, float *WORK, size_t LDWORK, int *INFO)
Frontend for the solution of Standard Sylvester Equations.
void mepack_double_gesylv2 (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 *QA, int LDQA, double *QB, int LDQB, double *X, int LDX, double *SCALE, double *WORK, size_t LDWORK, int *INFO)
Frontend for the solution of Standard Sylvester Equations.
void mepack_single_gesylv2 (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 *QA, int LDQA, float *QB, int LDQB, float *X, int LDX, float *SCALE, float *WORK, size_t LDWORK, int *INFO)
Frontend for the solution of Standard Sylvester Equations.
void mepack_double_gesylv_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 *X, int LDX, double *Y, int LDY, double *AS, int LDAS, double *BS, int LDBS, double *Q, int LDQ, double *U, int LDU, int *MAXIT, double *TAU, double *CONVLOG, double *WORK, size_t LDWORK, int *INFO)
Iterative Refinement for the standard Sylvester Equations.
void mepack_single_gesylv_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 *X, int LDX, float *Y, int LDY, float *AS, int LDAS, float *BS, int LDBS, float *Q, int LDQ, float *U, int LDU, int *MAXIT, float *TAU, float *CONVLOG, float *WORK, size_t LDWORK, int *INFO)
Iterative Refinement for the standard Sylvester Equations.
void mepack_double_gesylv2_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 *X, int LDX, double *Y, int LDY, double *AS, int LDAS, double *BS, int LDBS, double *Q, int LDQ, double *U, int LDU, int *MAXIT, double *TAU, double *CONVLOG, double *WORK, size_t LDWORK, int *INFO)
Iterative Refinement for the standard Sylvester Equations.
void mepack_single_gesylv2_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 *X, int LDX, float *Y, int LDY, float *AS, int LDAS, float *BS, int LDBS, float *Q, int LDQ, float *U, int LDU, int *MAXIT, float *TAU, float *CONVLOG, float *WORK, size_t LDWORK, int *INFO)
Iterative Refinement for the standard Sylvester Equations.

## Detailed Description

C-Interface for standard Sylvester equations.

The Fortran routines to solve the standard 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_gesylv (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 * QA, int LDQA, double * QB, int LDQB, double * X, int LDX, double * SCALE, double * WORK, size_t LDWORK, int * INFO)

Frontend for the solution of Standard Sylvester Equations.

Purpose:

mepack_double_gesylv solves a Sylvester equation of the following forms

op1(A) * X  +  X * op2(B) = SCALE * Y                              (1)

or

op1(A) * X  -  X * op2(B) = SCALE * Y                              (2)

where A is a M-by-M matrix and B is a N-by-N matrix. The right hand
side Y and the solution X are M-by-N matrices. The matrices A and B can be
either a general unreduced matrix or a (quasi-) upper triangular factor.
In the later case QA and QB provide the Schur-vectors of the matrices A
and B.
Remarks

This function is a wrapper for dla_gesylv.

dla_gesylv

Parameters

FACTA

         FACTA is String
Specifies how the matrix A is given.
== 'N':  The matrix A is given as a general matrix and its Schur decomposition
A = QA*S*QA**T will be computed.
== 'F':  The matrix A is given as its Schur decomposition in terms of S and QA
form A = QA*S*QA**T

FACTB

         FACTB is String
Specifies how the matrix B is given.
== 'N':  The matrix B is given as a general matrix and its Schur decomposition
B = QB*R*QB**T will be computed.
== 'F':  The matrix A is given as its Schur decomposition in terms of R and QB
form A = QB*R*QB**T

TRANSA

         TRANSA is String
Specifies the form of the system of equations with respect to A:
== 'N':  op1(A) = A
== 'T':  op1(A) = A**T

TRANSB

         TRANSB is String
Specifies the form of the system of equations with respect to B:
== 'N':  op2(B) = B,
== 'T':  op2(B) = B**T

SGN

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

M

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

N

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

A

         A is DOUBLE PRECISION array, dimension (LDA,M)
If FACT == 'N', the matrix A is a general matrix and it is overwritten with its
schur decomposition S.
If FACT == 'F', the matrix A contains its (quasi-) upper triangular matrix S being the
Schur decomposition of A.

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 its
schur decomposition R.
If FACT == 'F', the matrix A contains its (quasi-) upper triangular matrix R being the
Schur decomposition of B.

LDB

         LDB is INTEGER
The leading dimension of the array B.  LDB >= 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
Schur vectors of A on output.
If FACT == 'F', the matrix QA contains the Schur vectors of A.

LDQA

         LDQA is INTEGER
The leading dimension of the array QA.  LDQA >= 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
Schur vectors of B on output.
If FACT == 'F', the matrix QB contains the Schur vectors of B.

LDQB

         LDQB is INTEGER
The leading dimension of the array QB.  LDQB >= 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 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:  DGEES failed
= 2:  DLA_SORT_EV failed
= 3:  DLA_TRLYAP_DAG 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 221 of file gesylv.c.

### void mepack_double_gesylv2 (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 * QA, int LDQA, double * QB, int LDQB, double * X, int LDX, double * SCALE, double * WORK, size_t LDWORK, int * INFO)

Frontend for the solution of Standard Sylvester Equations.

Purpose:

mepack_double_gesylv2 solves a Sylvester equation of the following forms

op1(A) * X * op2(B) + X  = SCALE * Y                              (1)

or

op1(A) * X * op2(B) - X = SCALE * Y                               (2)

where A is a M-by-M matrix and B is a N-by-N matrix. The right hand
side Y and the solution X are M-by-N matrices. The matrices A and B can be
either a general unreduced matrix or a (quasi-) upper triangular factor.
In the later case QA and QB provide the Schur-vectors of the matrices A
and B.
Remarks

This function is a wrapper for dla_gesylv2.

dla_gesylv2

Parameters

FACTA

         FACTA is String
Specifies how the matrix A is given.
== 'N':  The matrix A is given as a general matrix and its Schur decomposition
A = QA*S*QA**T will be computed.
== 'F':  The matrix A is given as its Schur decomposition in terms of S and QA
form A = QA*S*QA**T

FACTB

         FACTB is String
Specifies how the matrix B is given.
== 'N':  The matrix B is given as a general matrix and its Schur decomposition
B = QB*R*QB**T will be computed.
== 'F':  The matrix A is given as its Schur decomposition in terms of R and QB
form A = QB*R*QB**T

TRANSA

         TRANSA is String
Specifies the form of the system of equations with respect to A:
== 'N':  op1(A) = A
== 'T':  op1(A) = A**T

TRANSB

         TRANSB is String
Specifies the form of the system of equations with respect to B:
== 'N':  op2(B) = B,
== 'T':  op2(B) = B**T

SGN

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

M

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

N

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

A

         A is DOUBLE PRECISION array, dimension (LDA,M)
If FACT == 'N', the matrix A is a general matrix and it is overwritten with its
schur decomposition S.
If FACT == 'F', the matrix A contains its (quasi-) upper triangular matrix S being the
Schur decomposition of A.

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 its
schur decomposition R.
If FACT == 'F', the matrix A contains its (quasi-) upper triangular matrix R beeping the
Schur decomposition of B.

LDB

         LDB is INTEGER
The leading dimension of the array B.  LDB >= 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
Schur vectors of A on output.
If FACT == 'F', the matrix QA contains the Schur vectors of A.

LDQA

         LDQA is INTEGER
The leading dimension of the array QA.  LDQA >= 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
Schur vectors of B on output.
If FACT == 'F', the matrix QB contains the Schur vectors of B.

LDQB

         LDQB is INTEGER
The leading dimension of the array QB.  LDQB >= 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 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:  DGEES failed
= 2:  DLA_SORT_EV failed
= 3:  DLA_TRLYAP_DAG 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 222 of file gesylv2.c.

### void mepack_double_gesylv2_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 * X, int LDX, double * Y, int LDY, double * AS, int LDAS, double * BS, int LDBS, double * Q, int LDQ, double * U, int LDU, int * MAXIT, double * TAU, double * CONVLOG, double * WORK, size_t LDWORK, int * INFO)

Iterative Refinement for the standard Sylvester Equations.

Purpose:

mepack_double_gesylv2_refine solves a Sylvester equation of the following forms

op1(A) * X * op2(B) + X = Y                              (1)

or

op1(A) * X  * op2(B) - X = Y                              (2)

where A is a M-by-M matrix and B is a N-by-N matrix using iterative refinement.
The right hand side Y and the solution X are M-by-N matrices.
The matrix A and B need to be given in the original form as well
as in their Schur decomposition since both are required in the
iterative refinement procedure.
Remarks

This function is a wrapper for dla_gesylv2_refine

dla_gesylv2_refine

Parameters

TRANSA

         TRANSA is String
Specifies the form of the system of equations with respect to A:
== 'N':  op1(A) = A
== 'T':  op1(A) = A**T

TRANSB

         TRANSB is String
Specifies the form of the system of equations with respect to B:
== 'N':  op2(B) = B,
== 'T':  op2(B) = B**T

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 both terms.

M

         M is INTEGER
The order of the matrix A.  M >= 0.

N

         N is INTEGER
The order of the matrix B.  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).

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 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 Schur decomposition of B.

LDBS

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

Q

         Q is DOUBLE PRECISION array, dimension (LDQ,M)
The array Q contains the Schur vectors of A as returned by DGEES.

LDQ

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

U

         U is DOUBLE PRECISION array, dimension (LDU,N)
The array U contains the Schur vectors of B as returned by DGEES.

LDU

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

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 245 of file gesylv2.c.

### void mepack_double_gesylv_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 * X, int LDX, double * Y, int LDY, double * AS, int LDAS, double * BS, int LDBS, double * Q, int LDQ, double * U, int LDU, int * MAXIT, double * TAU, double * CONVLOG, double * WORK, size_t LDWORK, int * INFO)

Iterative Refinement for the standard Sylvester Equations.

Purpose:

mepack_double_gesylv_refine solves a Sylvester equation of the following forms

op1(A) * X  +  X * op2(B) = Y                              (1)

or

op1(A) * X  -  X * op2(B) = Y                              (2)

where A is a M-by-M matrix and B is a N-by-N matrix using iterative refinement.
The right hand side Y and the solution X are M-by-N matrices.
The matrix A and B need to be given in the original form as well
as in their Schur decomposition since both are required in the
iterative refinement procedure.
Remarks

This function is a wrapper for dla_gesylv_refine

dla_gesylv_refine

Parameters

TRANSA

         TRANSA is String
Specifies the form of the system of equations with respect to A:
== 'N':  op1(A) = A
== 'T':  op1(A) = A**T

TRANSB

         TRANSB is String
Specifies the form of the system of equations with respect to B:
== 'N':  op2(B) = B,
== 'T':  op2(B) = B**T

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 both terms.

M

         M is INTEGER
The order of the matrix A.  M >= 0.

N

         N is INTEGER
The order of the matrix B.  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).

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 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 Schur decomposition of B.

LDBS

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

Q

         Q is DOUBLE PRECISION array, dimension (LDQ,M)
The array Q contains the Schur vectors of A as returned by DGEES.

LDQ

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

U

         U is DOUBLE PRECISION array, dimension (LDU,N)
The array U contains the Schur vectors of B as returned by DGEES.

LDU

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

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 246 of file gesylv.c.

### void mepack_single_gesylv (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 * QA, int LDQA, float * QB, int LDQB, float * X, int LDX, float * SCALE, float * WORK, size_t LDWORK, int * INFO)

Frontend for the solution of Standard Sylvester Equations.

Purpose:

mepack_single_gesylv solves a Sylvester equation of the following forms

op1(A) * X  +  X * op2(B) = SCALE * Y                              (1)

or

op1(A) * X  -  X * op2(B) = SCALE * Y                              (2)

where A is a M-by-M matrix and B is a N-by-N matrix. The right hand
side Y and the solution X are M-by-N matrices. The matrices A and B can be
either a general unreduced matrix or a (quasi-) upper triangular factor.
In the later case QA and QB provide the Schur-vectors of the matrices A
and B.
Remarks

This function is a wrapper for sla_gesylv.

dla_gesylv

Parameters

FACTA

         FACTA is String
Specifies how the matrix A is given.
== 'N':  The matrix A is given as a general matrix and its Schur decomposition
A = QA*S*QA**T will be computed.
== 'F':  The matrix A is given as its Schur decomposition in terms of S and QA
form A = QA*S*QA**T

FACTB

         FACTB is String
Specifies how the matrix B is given.
== 'N':  The matrix B is given as a general matrix and its Schur decomposition
B = QB*R*QB**T will be computed.
== 'F':  The matrix A is given as its Schur decomposition in terms of R and QB
form A = QB*R*QB**T

TRANSA

         TRANSA is String
Specifies the form of the system of equations with respect to A:
== 'N':  op1(A) = A
== 'T':  op1(A) = A**T

TRANSB

         TRANSB is String
Specifies the form of the system of equations with respect to B:
== 'N':  op2(B) = B,
== 'T':  op2(B) = B**T

SGN

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

M

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

N

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

A

         A is DOUBLE PRECISION array, dimension (LDA,M)
If FACT == 'N', the matrix A is a general matrix and it is overwritten with its
schur decomposition S.
If FACT == 'F', the matrix A contains its (quasi-) upper triangular matrix S being the
Schur decomposition of A.

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 its
schur decomposition R.
If FACT == 'F', the matrix A contains its (quasi-) upper triangular matrix R being the
Schur decomposition of B.

LDB

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

QA

         QA is DOUBLE PRECISION array, dimension (LDA,M)
If FACT == 'N', the matrix QA is an empty M-by-M matrix on input and contains the
Schur vectors of A on output.
If FACT == 'F', the matrix QA contains the Schur vectors of A.

LDQA

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

QB

         QB is DOUBLE PRECISION array, dimension (LDA,M)
If FACT == 'N', the matrix QB is an empty M-by-M matrix on input and contains the
Schur vectors of B on output.
If FACT == 'F', the matrix QB contains the Schur vectors of B.

LDQB

         LDQB is INTEGER
The leading dimension of the array QB.  LDQB >= 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 symmetric M-by-M matrices.

LDX

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

SCALE

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

WORK

         WORK is DOUBLE PRECISION array, dimension (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:  DGEES failed
= 2:  DLA_SORT_EV failed
= 3:  DLA_TRLYAP_DAG 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 443 of file gesylv.c.

### void mepack_single_gesylv2 (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 * QA, int LDQA, float * QB, int LDQB, float * X, int LDX, float * SCALE, float * WORK, size_t LDWORK, int * INFO)

Frontend for the solution of Standard Sylvester Equations.

Purpose:

mepack_single_gesylv2 solves a Sylvester equation of the following forms

op1(A) * X * op2(B) +  X = SCALE * Y                              (1)

or

op1(A) * X * op2(B) -  X = SCALE * Y                              (2)

where A is a M-by-M matrix and B is a N-by-N matrix. The right hand
side Y and the solution X are M-by-N matrices. The matrices A and B can be
either a general unreduced matrix or a (quasi-) upper triangular factor.
In the later case QA and QB provide the Schur-vectors of the matrices A
and B.
Remarks

This function is a wrapper for sla_gesylv2.

dla_gesylv2

Parameters

FACTA

         FACTA is String
Specifies how the matrix A is given.
== 'N':  The matrix A is given as a general matrix and its Schur decomposition
A = QA*S*QA**T will be computed.
== 'F':  The matrix A is given as its Schur decomposition in terms of S and QA
form A = QA*S*QA**T

FACTB

         FACTB is String
Specifies how the matrix B is given.
== 'N':  The matrix B is given as a general matrix and its Schur decomposition
B = QB*R*QB**T will be computed.
== 'F':  The matrix A is given as its Schur decomposition in terms of R and QB
form A = QB*R*QB**T

TRANSA

         TRANSA is String
Specifies the form of the system of equations with respect to A:
== 'N':  op1(A) = A
== 'T':  op1(A) = A**T

TRANSB

         TRANSB is String
Specifies the form of the system of equations with respect to B:
== 'N':  op2(B) = B,
== 'T':  op2(B) = B**T

SGN

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

M

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

N

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

A

         A is DOUBLE PRECISION array, dimension (LDA,M)
If FACT == 'N', the matrix A is a general matrix and it is overwritten with its
schur decomposition S.
If FACT == 'F', the matrix A contains its (quasi-) upper triangular matrix S being the
Schur decomposition of A.

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 its
schur decomposition R.
If FACT == 'F', the matrix A contains its (quasi-) upper triangular matrix R being the
Schur decomposition of B.

LDB

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

QA

         QA is DOUBLE PRECISION array, dimension (LDA,M)
If FACT == 'N', the matrix QA is an empty M-by-M matrix on input and contains the
Schur vectors of A on output.
If FACT == 'F', the matrix QA contains the Schur vectors of A.

LDQA

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

QB

         QB is DOUBLE PRECISION array, dimension (LDA,M)
If FACT == 'N', the matrix QB is an empty M-by-M matrix on input and contains the
Schur vectors of B on output.
If FACT == 'F', the matrix QB contains the Schur vectors of B.

LDQB

         LDQB is INTEGER
The leading dimension of the array QB.  LDQB >= 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 symmetric M-by-M matrices.

LDX

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

SCALE

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

WORK

         WORK is DOUBLE PRECISION array, dimension (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:  DGEES failed
= 2:  DLA_SORT_EV failed
= 3:  DLA_TRLYAP_DAG 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 444 of file gesylv2.c.

### void mepack_single_gesylv2_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 * X, int LDX, float * Y, int LDY, float * AS, int LDAS, float * BS, int LDBS, float * Q, int LDQ, float * U, int LDU, int * MAXIT, float * TAU, float * CONVLOG, float * WORK, size_t LDWORK, int * INFO)

Iterative Refinement for the standard Sylvester Equations.

Purpose:

mepack_single_gesylv2_refine solves a Sylvester equation of the following forms

op1(A) * X * op2(B) + X = Y                              (1)

or

op1(A) * X * op2(B) - X = Y                              (2)

where A is a M-by-M matrix and B is a N-by-N matrix using iterative refinement.
The right hand side Y and the solution X are M-by-N matrices.
The matrix A and B need to be given in the original form as well
as in their Schur decomposition since both are required in the
iterative refinement procedure.
Remarks

This function is a wrapper for sla_gesylv2_refine

sla_gesylv2_refine

Parameters

TRANSA

         TRANSA is String
Specifies the form of the system of equations with respect to A:
== 'N':  op1(A) = A
== 'T':  op1(A) = A**T

TRANSB

         TRANSB is String
Specifies the form of the system of equations with respect to B:
== 'N':  op2(B) = B,
== 'T':  op2(B) = B**T

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 both terms.

M

         M is INTEGER
The order of the matrix A.  M >= 0.

N

         N is INTEGER
The order of the matrix B.  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).

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 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 Schur decomposition of B.

LDBS

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

Q

         Q is SINGLE PRECISION array, dimension (LDQ,M)
The array Q contains the Schur vectors of A as returned by DGEES.

LDQ

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

U

         U is SINGLE PRECISION array, dimension (LDU,N)
The array U contains the Schur vectors of B as returned by DGEES.

LDU

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

MAXIT

         MAXIT is INTEGER
On input, MAXIT contains the maximum number of iteration that are performed, MAXIT <= 100
On exit, MAXIT contains the number of iteration steps taken by the algorithm.

TAU

         TAU is SINGLE PRECISION
On input, TAU contains the additional security factor for the stopping criterion, typical values are 0.1
On exit, TAU contains the last relative residual when the stopping criterion got valid.

CONVLOG

         CONVLOG is SINGLE PRECISION array, dimension (MAXIT)
The CONVLOG array contains the convergence history of the iterative refinement. CONVLOG(I) contains the maximum
relative residual before it is solved for the I-Th time.

WORK

         WORK is SINGLE PRECISION array, dimension (MAX(1,LDWORK))
Workspace for the algorithm.

LDWORK

         LDWORK is INTEGER
Size of the workspace for the algorithm. This can be determined by a call \ref mepack_memory_frontend.

INFO

         INFO is INTEGER
== 0:  Success
> 0:  Iteration failed in step INFO
< 0:  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 496 of file gesylv2.c.

### void mepack_single_gesylv_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 * X, int LDX, float * Y, int LDY, float * AS, int LDAS, float * BS, int LDBS, float * Q, int LDQ, float * U, int LDU, int * MAXIT, float * TAU, float * CONVLOG, float * WORK, size_t LDWORK, int * INFO)

Iterative Refinement for the standard Sylvester Equations.

Purpose:

mepack_single_gesylv_refine solves a Sylvester equation of the following forms

op1(A) * X  +  X * op2(B) = Y                              (1)

or

op1(A) * X  -  X * op2(B) = Y                              (2)

where A is a M-by-M matrix and B is a N-by-N matrix using iterative refinement.
The right hand side Y and the solution X are M-by-N matrices.
The matrix A and B need to be given in the original form as well
as in their Schur decomposition since both are required in the
iterative refinement procedure.
Remarks

This function is a wrapper for sla_gesylv_refine

sla_gesylv_refine

Parameters

TRANSA

         TRANSA is String
Specifies the form of the system of equations with respect to A:
== 'N':  op1(A) = A
== 'T':  op1(A) = A**T

TRANSB

         TRANSB is String
Specifies the form of the system of equations with respect to B:
== 'N':  op2(B) = B,
== 'T':  op2(B) = B**T

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 both terms.

M

         M is INTEGER
The order of the matrix A.  M >= 0.

N

         N is INTEGER
The order of the matrix B.  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).

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 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 Schur decomposition of B.

LDBS

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

Q

         Q is SINGLE PRECISION array, dimension (LDQ,M)
The array Q contains the Schur vectors of A as returned by DGEES.

LDQ

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

U

         U is SINGLE PRECISION array, dimension (LDU,N)
The array U contains the Schur vectors of B as returned by DGEES.

LDU

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

MAXIT

         MAXIT is INTEGER
On input, MAXIT contains the maximum number of iteration that are performed, MAXIT <= 100
On exit, MAXIT contains the number of iteration steps taken by the algorithm.

TAU

         TAU is SINGLE PRECISION
On input, TAU contains the additional security factor for the stopping criterion, typical values are 0.1
On exit, TAU contains the last relative residual when the stopping criterion got valid.

CONVLOG

         CONVLOG is SINGLE PRECISION array, dimension (MAXIT)
The CONVLOG array contains the convergence history of the iterative refinement. CONVLOG(I) contains the maximum
relative residual before it is solved for the I-Th time.

WORK

         WORK is SINGLE PRECISION array, dimension (MAX(1,LDWORK))
Workspace for the algorithm.

LDWORK

         LDWORK is INTEGER
Size of the workspace for the algorithm. This can be determined by a call \ref mepack_memory_frontend.

INFO

         INFO is INTEGER
== 0:  Success
> 0:  Iteration failed in step INFO
< 0:  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 498 of file gesylv.c.

## Author

Generated automatically by Doxygen for MEPACK from the source code.

## Info

Tue Mar 7 2023 Version 1.0.3 MEPACK