X = Matrices.discreteLyapunov(A, C); X = Matrices.discreteLyapunov(A, C, ATisSchur, sgn, eps);
This function computes the solution X of the discrete-time Lyapunov equation
A'*X*A + sgn*X = C
where sgn=1 or sgn =-1. For sgn = -1, the discrete Lyapunov equation is a special case of the Stein equation:
A*X*B - X + Q = 0.
The algorithm uses the Schur method for Lyapunov equations proposed by Bartels and Stewart [1].
In a nutshell, the problem is reduced to the corresponding problem
R*Y*R' + sgn*Y = D.
with R=U'*A'*U is the real Schur form of A' and D=U'*C*U and Y=U'*X*U
are the corresponding transformations of C and X. This problem is solved sequentially by exploiting the block triangular form of R.
Finally the solution of the original problem is recovered as X=U*Y*U'.
The Boolean input "ATisSchur" indicates to omit the transformation to Schur in the case that A' has already Schur form.
[1] Bartels, R.H. and Stewart G.W. Algorithm 432: Solution of the matrix equation AX + XB = C. Comm. ACM., Vol. 15, pp. 820-826, 1972.
A = [1, 2, 3, 4; 3, 4, 5, -2; -1, 2, -3, -5; 0, 2, 0, 6]; C = [-2, 3, 1, 0; -6, 8, 0, 1; 2, 3, 4, 5; 0, -2, 0, 0]; X = discreteLyapunov(A, C, sgn=-1); results in: X = [7.5735, -3.1426, 2.7205, -2.5958; -2.6105, 1.2384, -0.9232, 0.9632; 6.6090, -2.6775, 2.6415, -2.6928; -0.3572, 0.2298, 0.0533, -0.27410];
Matrices.discreteSylvester, Matrices.continuousLyapunov
function discreteLyapunov extends Modelica.Icons.Function; import Modelica.Math.Matrices; input Real A[:, size(A, 1)] "Square matrix A in A'*X*A + sgn*X = C"; input Real C[size(A, 1), size(A, 2)] "Square matrix C in A'*X*A + sgn*X = C"; input Boolean ATisSchur = false "= true, if transpose(A) has already real Schur form"; input Integer sgn = 1 "Specifies the sign in A'*X*A + sgn*X = C"; input Real eps = Matrices.norm(A, 1)*10*Modelica.Constants.eps "Tolerance eps"; output Real X[size(A, 1), size(A, 2)] "Solution X of the Lyapunov equation A'*X*A + sgn*X = C"; end discreteLyapunov;