# ?lasy2

Solves the Sylvester matrix equation where the matrices are of order 1 or 2.

## Syntax

call slasy2( ltranl, ltranr, isgn, n1, n2, tl, ldtl, tr, ldtr, b, ldb, scale, x, ldx, xnorm, info )

call dlasy2( ltranl, ltranr, isgn, n1, n2, tl, ldtl, tr, ldtr, b, ldb, scale, x, ldx, xnorm, info )

## Include Files

• Fortran: mkl.fi
• C: mkl.h

## Description

The routine solves for the n1-by-n2 matrix X, `1 ≤ n1`, `n2 ≤ 2`, in

`op(TL)*X + isgn*X*op(TR) = scale*B`,

where

TL is n1-by-n1,

TR is n2-by-n2,

B is n1-by-n2,

and `isgn = 1` or -1. `op(T) = T` or TT, where TT denotes the transpose of T.

## Input Parameters

ltranl

LOGICAL.

On entry, ltranl specifies the `op(TL)`:

= .FALSE., `op(TL) = TL`,

= .TRUE., `op(TL) = (TL)T`.

ltranr

LOGICAL.

On entry, ltranr specifies the op(TR):

= .FALSE., `op(TR) = TR`,

= .TRUE., `op(TR) = (TR)T`.

isgn

INTEGER. On entry, isgn specifies the sign of the equation as described before. isgn may only be 1 or -1.

n1

INTEGER. On entry, n1 specifies the order of matrix TL.

n1 may only be 0, 1 or 2.

n2

INTEGER. On entry, n2 specifies the order of matrix TR.

n2 may only be 0, 1 or 2.

tl

REAL for slasy2

DOUBLE PRECISION for dlasy2.

Array, DIMENSION (ldtl,2).

On entry, tl contains an n1-by-n1 matrix TL.

ldtl

INTEGER.The leading dimension of the matrix TL.

`ldtl ≥ max(1,n1)`.

tr

REAL for slasy2

DOUBLE PRECISION for dlasy2.

Array, DIMENSION (ldtr,2). On entry, tr contains an n2-by-n2 matrix TR.

ldtr

INTEGER. The leading dimension of the matrix TR.

`ldtr ≥ max(1,n2)`.

b

REAL for slasy2

DOUBLE PRECISION for dlasy2.

Array, DIMENSION (ldb,2). On entry, the n1-by-n2 matrix B contains the right-hand side of the equation.

ldb

INTEGER. The leading dimension of the matrix B.

`ldb ≥ max(1,n1)`.

ldx

INTEGER. The leading dimension of the output matrix X.

`ldx ≥ max(1,n1)`.

## Output Parameters

scale

REAL for slasy2

DOUBLE PRECISION for dlasy2.

On exit, scale contains the scale factor.

scale is chosen less than or equal to 1 to prevent the solution overflowing.

x

REAL for slasy2

DOUBLE PRECISION for dlasy2.

Array, DIMENSION (ldx,2). On exit, x contains the n1-by-n2 solution.

xnorm

REAL for slasy2

DOUBLE PRECISION for dlasy2.

On exit, xnorm is the infinity-norm of the solution.

info

INTEGER. On exit, info is set to 0: successful exit. 1: TL and TR have too close eigenvalues, so TL or TR is perturbed to get a nonsingular equation.

### Note

For higher speed, this routine does not check the inputs for errors.

For more complete information about compiler optimizations, see our Optimization Notice.