solve_continuous_lyapunov — SciPy v1.16.0 Manual (original) (raw)
scipy.linalg.
scipy.linalg.solve_continuous_lyapunov(a, q)[source]#
Solves the continuous Lyapunov equation \(AX + XA^H = Q\).
Uses the Bartels-Stewart algorithm to find \(X\).
The documentation is written assuming array arguments are of specified “core” shapes. However, array argument(s) of this function may have additional “batch” dimensions prepended to the core shape. In this case, the array is treated as a batch of lower-dimensional slices; see Batched Linear Operations for details.
Parameters:
aarray_like
A square matrix
qarray_like
Right-hand side square matrix
Returns:
xndarray
Solution to the continuous Lyapunov equation
Notes
The continuous Lyapunov equation is a special form of the Sylvester equation, hence this solver relies on LAPACK routine ?TRSYL.
Added in version 0.11.0.
Examples
Given a and q solve for x:
import numpy as np from scipy import linalg a = np.array([[-3, -2, 0], [-1, -1, 0], [0, -5, -1]]) b = np.array([2, 4, -1]) q = np.eye(3) x = linalg.solve_continuous_lyapunov(a, q) x array([[ -0.75 , 0.875 , -3.75 ], [ 0.875 , -1.375 , 5.3125], [ -3.75 , 5.3125, -27.0625]]) np.allclose(a.dot(x) + x.dot(a.T), q) True