def _solve_discrete_lyapunov_direct(a, q):
 lhs = kron(a, a.conj())
 lhs = (np.eye(lhs.shape[0]) - lhs)
 x = solve(lhs, q.flatten())
 return np.reshape(x, q.shape)

def _solve_discrete_lyapunov_direct ( a , q ) : lhs = kron ( a , a . conj ( ) ) lhs = ( np . eye ( lhs . shape [ 0 ] ) - lhs ) x = solve ( lhs , q . flatten ( ) ) return np . reshape ( x , q . shape )
solves the discrete lyapunov equation directly .