# dlyapchol

Solves discrete-time Lyapunov equations with a square-root solver.

## Syntax

X = dlyapchol(A, B)

X = dlyapchol(A, B, E)

## Inputs

A
Real square matrix.
B
A real matrix.
E
Real square matrix.

X
A real matrix.

## Examples

Example based on a Lyapunov matrix equation:
A = [-5.0           0        -5.0;
0.5           0           0;
0           0         0.5];

B = [ 0.5           1         0.5;
1.5           1           1;
1           1         1.5];

U1 = dlyapchol (A, B)
U1 = [Matrix] 3 x 3
0.50000  1.50000  1.00000
1.00000  1.00000  1.00000
0.50000  1.00000  1.50000
Example based on a Sylvester equation:
A = [-5.0           0        -5.0;
0.5           0           0;
0           0         0.5];

B = [ 0.5           1         0.5;
1.5           1           1;
1           1         1.5];

E = [2           2           4;
1           0           5;
3           1           1];

U2 = dlyapchol (A, B, E)
U2 = [Matrix] 3 x 3
0.50000  1.50000  1.00000
1.00000  1.00000  1.00000
0.50000  1.00000  0.00000

## Comments

R = dlyapchol(A, B) solves AU'UA' - U'U = -BB' (Lyapunov matrix equation).

X = dlyapchol(A, B, E) solves AU'UA' - EU'UE' = -B B' (Sylvester equation).

Based on the SLICOT library functions SB03OD and SG03BD.