1 ## Copyright (C) 2010 Lukas F. Reichlin
3 ## This file is part of LTI Syncope.
5 ## LTI Syncope is free software: you can redistribute it and/or modify
6 ## it under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation, either version 3 of the License, or
8 ## (at your option) any later version.
10 ## LTI Syncope is distributed in the hope that it will be useful,
11 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ## GNU General Public License for more details.
15 ## You should have received a copy of the GNU General Public License
16 ## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>.
19 ## @deftypefn{Function File} {@var{u} =} dlyapchol (@var{a}, @var{b})
20 ## @deftypefnx{Function File} {@var{u} =} dlyapchol (@var{a}, @var{b}, @var{e})
21 ## Compute Cholesky factor of discrete-time Lyapunov equations.
26 ## A U' U A' - U' U + B B' = 0 (Lyapunov Equation)
28 ## A U' U A' - E U' U E' + B B' = 0 (Generalized Lyapunov Equation)
32 ## @strong{Algorithm}@*
33 ## Uses SLICOT SB03OD and SG03BD by courtesy of
34 ## @uref{http://www.slicot.org, NICONET e.V.}
36 ## @seealso{dlyap, lyap, lyapchol}
39 ## Author: Lukas Reichlin <lukas.reichlin@gmail.com>
40 ## Created: January 2010
43 function [u, scale] = dlyapchol (a, b, e)
48 if (! is_real_square_matrix (a))
49 ## error ("dlyapchol: a must be real and square");
50 error ("dlyapchol: %s must be real and square", \
54 if (! is_real_matrix (b))
55 ## error ("dlyapchol: b must be real")
56 error ("dlyapchol: %s must be real", \
60 if (rows (a) != rows (b))
61 ## error ("dlyapchol: a and b must have the same number of rows");
62 error ("dlyapchol: %s and %s must have the same number of rows", \
63 inputname (1), inputname (2));
66 [u, scale] = slsb03od (a.', b.', true);
68 ## NOTE: TRANS = 'T' not suitable because we need U' U, not U U'
72 if (! is_real_square_matrix (a, e))
73 ## error ("dlyapchol: a, e must be real and square");
74 error ("dlyapchol: %s, %s must be real and square", \
75 inputname (1), inputname (3));
78 if (! is_real_matrix (b))
79 ## error ("dlyapchol: b must be real");
80 error ("dlyapchol: %s must be real", \
84 if (rows (b) != rows (a) || rows (e) != rows (a))
85 ## error ("dlyapchol: a, b, e must have the same number of rows");
86 error ("dlyapchol: %s, %s, %s must have the same number of rows", \
87 inputname (1), inputname (2), inputname (3));
90 [u, scale] = slsg03bd (a.', e.', b.', true);
92 ## NOTE: TRANS = 'T' not suitable because we need U' U, not U U'
100 warning ("dlyapchol: solution scaled by %g to prevent overflow", scale);