# lyapchol

Solves continuous-time Lyapunov equation using a square-root solver.

## Syntax

R = lyapchol(A, B)

X = lyapchol(A, B, E)

## Inputs

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

## Outputs

- R, X
- A real matrix.

## Examples

```
A = [ -1 -1 2 2;
37 -10 -4 2;
-12 0 7 7;
-12 4 -6 -9 ];
B = [ 1 0.1 -1 1 -1;
2.5 1 -2.5 2.5 -2.5;
1 0.1 -1 4 -4;
3.5 1 -1.5 -5.5 3.5 ];
U1 = lyapchol (A, B)
```

`U1 = [Matrix] 4 x 4
0.99935 3.02310 1.97208 -0.96401
0.00000 0.97121 -0.98498 0.97361
0.00000 0.00000 0.97572 -2.05182
0.00000 0.00000 0.00000 0.88653`

```
A = [-1 0 -4;
3 5 4;
-4 -2 1 ];
B = [2.0;-1.0;7.0];
E = [2 2 4;
1 0 5;
3 1 1];
U2 = lyapchol(A, B, E)
```

`U2 = [Matrix] 3 x 3
1.60025 -0.44180 -0.15230
0.00000 0.67950 -0.24992
0.00000 0.00000 0.20413`

## Comments

R = lyapchol(A, B) calculates a Cholesky factorization.

Lyapunov matrix equation:

- AU'U + U'UA' = -BB'

Generalized Lyapunov equation:

- AU'UE' + EU'UA' = -BB'

Based on SLICOT library functions SB03OD and SG03BD.