control.dlyap

control.dlyap(A, Q, C=None, E=None, method=None)[source]

Solves the discrete-time Lyapunov equation.

X = dlyap(A, Q) solves

A X A^T - X + Q = 0

where A and Q are square matrices of the same dimension. Further Q must be symmetric.

dlyap(A, Q, C) solves the Sylvester equation

A X Q^T - X + C = 0

where A and Q are square matrices.

dlyap(A, Q, None, E) solves the generalized discrete-time Lyapunov equation

A X A^T - E X E^T + Q = 0

where Q is a symmetric matrix and A, Q and E are square matrices of the same dimension.

Parameters:
A, Q2D array_like

Input matrices for the Lyapunov or Sylvestor equation.

C2D array_like, optional

If present, solve the Sylvester equation.

E2D array_like, optional

If present, solve the generalized Lyapunov equation.

methodstr, optional

Set the method used for computing the result. Current methods are ‘slycot’ and ‘scipy’. If set to None (default), try ‘slycot’ first and then ‘scipy’.

Returns:
X2D array (or matrix)

Solution to the Lyapunov or Sylvester equation.

Notes

For the generalized Lyapunov equation, method=’slycot’ uses the SLICOT routine SG03AD, based on the generalized Schur method of Penzl [1], which factors the matrix pencil without inverting E. With method=’scipy’, the equation is transformed to a standard Lyapunov equation by inverting E, which requires E to be nonsingular and loses accuracy when E is ill-conditioned (a UserWarning is then issued). The generalized Lyapunov problem is itself ill-conditioned (about cond(E)**2) when E is, so method=’slycot’, though it does not invert E, is not measurably more accurate in that case. Both methods require E nonsingular; a truly singular (descriptor) E is not currently handled by either.

For the Sylvester equation, method=’slycot’ uses the Hessenberg-Schur method of the SLICOT routine SB04QD [2] and method=’scipy’ uses the Bartels-Stewart method [3]; both reduce the coefficient matrices to (Hessenberg-)Schur form and solve the result by back-substitution, with O(n^3 + m^3) cost.

References

[1]

Penzl, T., “Numerical solution of generalized Lyapunov equations”, Advances in Computational Mathematics, 8:33-48, 1998.

[2]

Golub, G.H., Nash, S., and Van Loan, C., “A Hessenberg-Schur method for the problem AX + XB = C”, IEEE Trans. Automatic Control, AC-24, pp. 909-913, 1979.

[3]

Bartels, R.H. and Stewart, G.W., “Solution of the matrix equation AX + XB = C”, Comm. ACM, 15(9), pp. 820-826, 1972.