# cgelyap - Man Page

## Name

cgelyap — C-Interface

— C-Interface for generalized Lyapunov and Stein equations with triangular coefficient matrices.

## Synopsis

### Functions

void **mepack_double_gelyap** (const char *FACT, const char *TRANS, int M, double *A, int LDA, double *Q, int LDQ, double *X, int LDX, double *SCALE, double *WORK, size_t LDWORK, int *INFO)

Frontend for the solution of Standard Lyapunov Equations.

void **mepack_single_gelyap** (const char *FACT, const char *TRANS, int M, float *A, int LDA, float *Q, int LDQ, float *X, int LDX, float *SCALE, float *WORK, size_t LDWORK, int *INFO)

Frontend for the solution of Standard Lyapunov Equations.

void **mepack_double_gestein** (const char *FACT, const char *TRANS, int M, double *A, int LDA, double *Q, int LDQ, double *X, int LDX, double *SCALE, double *WORK, size_t LDWORK, int *INFO)

Frontend for the solution of Standard Stein Equations.

void **mepack_single_gestein** (const char *FACT, const char *TRANS, int M, float *A, int LDA, float *Q, int LDQ, float *X, int LDX, float *SCALE, float *WORK, size_t LDWORK, int *INFO)

Frontend for the solution of Standard Stein Equations.

void **mepack_double_gelyap_refine** (const char *TRANS, const char *GUESS, int M, double *A, int LDA, double *X, int LDX, double *Y, int LDY, double *AS, int LDAS, double *Q, int LDQ, int *MAXIT, double *TAU, double *CONVLOG, double *WORK, size_t LDWORK, int *INFO)

Iterative Refinement for the Standard Lyapunov Equation.

void **mepack_single_gelyap_refine** (const char *TRANS, const char *GUESS, int M, float *A, int LDA, float *X, int LDX, float *Y, int LDY, float *AS, int LDAS, float *Q, int LDQ, int *MAXIT, float *TAU, float *CONVLOG, float *WORK, size_t LDWORK, int *INFO)

Iterative Refinement for the Standard Lyapunov Equation.

void **mepack_double_gestein_refine** (const char *TRANS, const char *GUESS, int M, double *A, int LDA, double *X, int LDX, double *Y, int LDY, double *AS, int LDAS, double *Q, int LDQ, int *MAXIT, double *TAU, double *CONVLOG, double *WORK, size_t LDWORK, int *INFO)

Iterative Refinement for the Standard Stein Equation.

void **mepack_single_gestein_refine** (const char *TRANS, const char *GUESS, int M, float *A, int LDA, float *X, int LDX, float *Y, int LDY, float *AS, int LDAS, float *Q, int LDQ, int *MAXIT, float *TAU, float *CONVLOG, float *WORK, size_t LDWORK, int *INFO)

Iterative Refinement for the Standard Stein Equation.

## Detailed Description

C-Interface for generalized Lyapunov and Stein equations with triangular coefficient matrices.

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

## Function Documentation

### void mepack_double_gelyap (const char * FACT, const char * TRANS, int M, double * A, int LDA, double * Q, int LDQ, double * X, int LDX, double * SCALE, double * WORK, size_t LDWORK, int * INFO)

Frontend for the solution of Standard Lyapunov Equations.

**Purpose:**

mepack_double_gelyap solves a Lyapunov equation of the following forms A * X + X * A**T = SCALE * Y (1) or A ** T * X + X * A = SCALE * Y (2) where A is a M-by-M general matrix. The right hand side Y and the solution X are M-by-M matrices. The matrix A can be either supplied as general matrix or factorized in terms of its Schur decomposition..fiRemarksThis function is a wrapper arounddla_gelyap.See also dla_gelyap ParametersFACTFACT is String Specifies how the matrix A is given. == 'N': The matrix A is given as a general matrix and its Schur decomposition A = Q*S*Q**T will be computed. == 'F': The matrix A is given as its Schur decomposition in terms of S and Q form A = Q*S*Q**T

*TRANS*

TRANS is String Specifies the form of the system of equations with respect to A: == 'N': Equation (1) is solved. == 'T': Equation (2) is solved.

*M*

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

*A*

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

*Q*

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

*LDQ*

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

*X*

X is DOUBLE PRECISION array, dimension (LDX,N) On input, the matrix X contains the right hand side Y. On output, the matrix X contains the solution of Equation (1) or (2) Right hand side Y and the solution X are symmetric M-by-M matrices.

*LDX*

LDX is INTEGER The leading dimension of the array X. 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: Internal solver failed < 0: if INFO == -i, the i-Th argument had an illegal value

**Attention**The Fortran/LAPACK-like workspace query with setting LDWORK=-1 on input will not work in the C interface. One have to use the

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

**Date**Januar 2023

Definition at line **160** of file **gelyap.c**.

### void mepack_double_gelyap_refine (const char * TRANS, const char * GUESS, int M, double * A, int LDA, double * X, int LDX, double * Y, int LDY, double * AS, int LDAS, double * Q, int LDQ, int * MAXIT, double * TAU, double * CONVLOG, double * WORK, size_t LDWORK, int * INFO)

Iterative Refinement for the Standard Lyapunov Equation.

**Purpose:**

mepack_double_GELYAP_refine solves a standard Lyapunov equation of the following forms A * X + X * A^T = SCALE * Y (1) or A^T * X + X * A = SCALE * Y (2) where A is a M-by-M matrix using iterative refinement. The right hand side Y and the solution X are M-by-M matrices. The matrix A needs to be provided as the original data as well as in Schur decomposition since both are required in the iterative refinement process..fiRemarksThis function is a wrapper for dla_GELYAP_refine.See alsodla_GELYAP_refineParametersTRANSTRANS is String Specifies the form of the system of equations with respect to A: == 'N': Equation (1) is solved == 'T': Equation (2) is solved

*GUESS*

GUESS is String Specifies whether X provides an initial guess or not. = 'I': An initial guess is provided == 'N': No initial guess is provided, X is set to zero.

*M*

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

*A*

A is DOUBLE PRECISION array, dimension (LDA,M) The array A contains the original matrix A defining the equation.

*LDA*

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

*X*

X is DOUBLE PRECISION array, dimension (LDX,M) On input, the array X contains an initial guess. On output, the array X contains the solution X.

*LDX*

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

*Y*

Y is DOUBLE PRECISION array, dimension (LDY,M) On input, the array Y contains the right hand side.

*LDY*

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

*AS*

AS is DOUBLE PRECISION array, dimension (LDAS,M) The array AS contains the Schur decomposition of A.

*LDAS*

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

*Q*

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

*LDQ*

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

*MAXIT*

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

*TAU*

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

*CONVLOG*

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

*WORK*

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

*LDWORK*

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

*INFO*

INFO is INTEGER == 0: Success > 0: Iteration failed in step INFO < 0: if INFO == -i, the i-Th argument had an illegal value

**Attention**The Fortran/LAPACK-like workspace query with setting LDWORK=-1 on input will not work in the C interface. One have to use the

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

**Date**Januar 2023

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

### void mepack_double_gestein (const char * FACT, const char * TRANS, int M, double * A, int LDA, double * Q, int LDQ, double * X, int LDX, double * SCALE, double * WORK, size_t LDWORK, int * INFO)

Frontend for the solution of Standard Stein Equations.

**Purpose:**

mepack_double_gestein solves a Stein equation of the following forms A * X * A**T - X = SCALE * Y (1) or A ** T * X * A - X = SCALE * Y (2) where A is a M-by-M general matrix. The right hand side Y and the solution X are M-by-M matrices. The matrix A can be either supplied as general matrix or factorized in terms of its Schur decomposition..fiRemarksThis function is a wrapper arounddla_gestein.See also dla_gestein ParametersFACTFACT is String Specifies how the matrix A is given. == 'N': The matrix A is given as a general matrix and its Schur decomposition A = Q*S*Q**T will be computed. == 'F': The matrix A is given as its Schur decomposition in terms of S and Q form A = Q*S*Q**T

*TRANS*

TRANS is String Specifies the form of the system of equations with respect to A: == 'N': Equation (1) is solved. == 'T': Equation (2) is solved.

*M*

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

*A*

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

*Q*

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

*LDQ*

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

*X*

X is DOUBLE PRECISION array, dimension (LDX,N) On input, the matrix X contains the right hand side Y. On output, the matrix X contains the solution of Equation (1) or (2) Right hand side Y and the solution X are symmetric M-by-M matrices.

*LDX*

LDX is INTEGER The leading dimension of the array X. 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: Internal solver failed < 0: if INFO == -i, the i-Th argument had an illegal value

**Attention**The Fortran/LAPACK-like workspace query with setting LDWORK=-1 on input will not work in the C interface. One have to use the

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

**Date**Januar 2023

Definition at line **159** of file **gestein.c**.

### void mepack_double_gestein_refine (const char * TRANS, const char * GUESS, int M, double * A, int LDA, double * X, int LDX, double * Y, int LDY, double * AS, int LDAS, double * Q, int LDQ, int * MAXIT, double * TAU, double * CONVLOG, double * WORK, size_t LDWORK, int * INFO)

Iterative Refinement for the Standard Stein Equation.

**Purpose:**

mepack_double_gestein_refine solves a standard Stein equation of the following forms A * X * A^T - X = SCALE * Y (1) or A^T * X * A - X = SCALE * Y (2) where A is a M-by-M matrix using iterative refinement. The right hand side Y and the solution X are M-by-M matrices. The matrix A needs to be provided as the original data as well as in Schur decomposition since both are required in the iterative refinement process..fiRemarksThis function is a wrapper for dla_gestein_refine.See also dla_gestein_refine ParametersTRANSTRANS is String Specifies the form of the system of equations with respect to A: == 'N': Equation (1) is solved == 'T': Equation (2) is solved

*GUESS*

GUESS is String Specifies whether X contains an initial guess on input or not. = 'I': X contains an initial guess for the solution == 'N': No initial guess is provided. X is set to zero.

*M*

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

*A*

A is DOUBLE PRECISION array, dimension (LDA,M) The array A contains the original matrix A defining the equation.

*LDA*

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

*X*

X is DOUBLE PRECISION array, dimension (LDX,M) On input, the array X contains the initial guess. On output, the array X contains the solution X.

*LDX*

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

*Y*

Y is DOUBLE PRECISION array, dimension (LDY,M) On input, the array Y contains the right hand side.

*LDY*

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

*AS*

AS is DOUBLE PRECISION array, dimension (LDAS,M) The array AS contains the Schur decomposition of A.

*LDAS*

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

*Q*

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

*LDQ*

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

*MAXIT*

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

*TAU*

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

*CONVLOG*

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

*WORK*

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

*LDWORK*

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

*INFO*

INFO is INTEGER == 0: Success > 0: Iteration failed in step INFO < 0: if INFO == -i, the i-Th argument had an illegal value

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

**Date**Januar 2023

Definition at line **192** of file **gestein.c**.

### void mepack_single_gelyap (const char * FACT, const char * TRANS, int M, float * A, int LDA, float * Q, int LDQ, float * X, int LDX, float * SCALE, float * WORK, size_t LDWORK, int * INFO)

Frontend for the solution of Standard Lyapunov Equations.

**Purpose:**

mepack_single_gelyap solves a Lyapunov equation of the following forms A * X + X * A**T = SCALE * Y (1) or A ** T * X + X * A = SCALE * Y (2) where A is a M-by-M general matrix. The right hand side Y and the solution X are M-by-M matrices. The matrix A can be either supplied as general matrix or factorized in terms of its Schur decomposition..fiRemarksThis function is a wrapper aroundsla_gelyap.See also sla_gelyap ParametersFACTFACT is String Specifies how the matrix A is given. == 'N': The matrix A is given as a general matrix and its Schur decomposition A = Q*S*Q**T will be computed. == 'F': The matrix A is given as its Schur decomposition in terms of S and Q form A = Q*S*Q**T

*TRANS*

TRANS is String Specifies the form of the system of equations with respect to A: == 'N': Equation (1) is solved. == 'T': Equation (2) is solved.

*M*

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

*A*

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

*Q*

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

*LDQ*

LDQ is INTEGER The leading dimension of the array Q. LDQ >= 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 either by \ref mepack_memory_frontend or a previous call to the this routine with LDWORK === -1. On exit, WORK(1) contains the size of the workspace.

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

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

**Date**Januar 2023

Definition at line **315** of file **gelyap.c**.

### void mepack_single_gelyap_refine (const char * TRANS, const char * GUESS, int M, float * A, int LDA, float * X, int LDX, float * Y, int LDY, float * AS, int LDAS, float * Q, int LDQ, int * MAXIT, float * TAU, float * CONVLOG, float * WORK, size_t LDWORK, int * INFO)

Iterative Refinement for the Standard Lyapunov Equation.

**Purpose:**

mepack_single_gelyap_refine solves a standard Lyapunov equation of the following forms A * X + X * A^T = SCALE * Y (1) or A^T * X + X * A = SCALE * Y (2) where A is a M-by-M matrix using iterative refinement. The right hand side Y and the solution X are M-by-M matrices. The matrix A needs to be provided as the original data as well as in Schur decomposition since both are required in the iterative refinement process..fiRemarksThis function is a wrapper for sla_gelyap_refine.See also sla_gelyap_refine ParametersTRANSTRANS is String Specifies the form of the system of equations with respect to A: == 'N': Equation (1) is solved == 'T': Equation (2) is solved

*M*

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

*GUESS*

GUESS is String Specifies whether X provides an initial guess or not. = 'I': An initial guess is provided == 'N': No initial guess is provided, X is set to zero.

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

*X*

X is SINGLE PRECISION array, dimension (LDX,M) On input, the array X contains an 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 A.

*LDAS*

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

*Q*

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

*LDQ*

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

*MAXIT*

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

*TAU*

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

*CONVLOG*

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

*WORK*

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

*LDWORK*

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

*INFO*

INFO is INTEGER == 0: Success > 0: Iteration failed in step INFO < 0: if INFO == -i, the i-Th argument had an illegal value

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

**Date**Januar 2023

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

### void mepack_single_gestein (const char * FACT, const char * TRANS, int M, float * A, int LDA, float * Q, int LDQ, float * X, int LDX, float * SCALE, float * WORK, size_t LDWORK, int * INFO)

Frontend for the solution of Standard Stein Equations.

**Purpose:**

mepack_single_gestein solves a Stein equation of the following forms A * X * A**T - X = SCALE * Y (1) or A ** T * X * A - X = SCALE * Y (2) where A is a M-by-M general matrix. The right hand side Y and the solution X are M-by-M matrices. The matrix A can be either supplied as general matrix or factorized in terms of its Schur decomposition..fiRemarksThis function is a wrapper aroundsla_gestein.See also sla_gestein ParametersFACTFACT is String Specifies how the matrix A is given. == 'N': The matrix A is given as a general matrix and its Schur decomposition A = Q*S*Q**T will be computed. == 'F': The matrix A is given as its Schur decomposition in terms of S and Q form A = Q*S*Q**T

*TRANS*

*M*

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

*A*

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

*Q*

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

*LDQ*

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

*LDWORK*

*INFO*

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

**Date**Januar 2023

Definition at line **312** of file **gestein.c**.

### void mepack_single_gestein_refine (const char * TRANS, const char * GUESS, int M, float * A, int LDA, float * X, int LDX, float * Y, int LDY, float * AS, int LDAS, float * Q, int LDQ, int * MAXIT, float * TAU, float * CONVLOG, float * WORK, size_t LDWORK, int * INFO)

Iterative Refinement for the Standard Stein Equation.

**Purpose:**

mepack_single_gestein_refine solves a standard Stein equation of the following forms A * X * A^T - X = SCALE * Y (1) or A^T * X * A - X = SCALE * Y (2) where A is a M-by-M matrix using iterative refinement. The right hand side Y and the solution X are M-by-M matrices. The matrix A needs to be provided as the original data as well as in Schur decomposition since both are required in the iterative refinement process..fiRemarksThis function is a wrapper for sla_gestein_refine.See also sla_gestein_refine ParametersTRANSTRANS is String Specifies the form of the system of equations with respect to A: == 'N': Equation (1) is solved == 'T': Equation (2) is solved

*GUESS*

GUESS is String Specifies whether X contains an initial guess on input or not. = 'I': X contains an initial guess for the solution == 'N': No initial guess is provided. X is set to zero.

*M*

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

*A*

A is SINGLE PRECISION array, dimension (LDA,M) The array A contains the original matrix A defining the equation.

*LDA*

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

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

*LDAS*

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

*Q*

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

*LDQ*

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

*MAXIT*

*TAU*

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

*CONVLOG*

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

*WORK*

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

*LDWORK*

*INFO*

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

**Date**Januar 2023

Definition at line **380** of file **gestein.c**.

## Author

Generated automatically by Doxygen for MEPACK from the source code.