From 430e218ec3931acf0e921096e4dd6be5f1d76c3e Mon Sep 17 00:00:00 2001 From: Guillaume Berger <47389731+guberger@users.noreply.github.com> Date: Mon, 26 Oct 2020 16:22:26 +0100 Subject: [PATCH] Solving Lyapunov equation for matrices given in Adjoint form There seems to be no consensus about what should be the Lyapunov equation: A'P+PA+Q=0 or AP+PA'+Q=0. For instance, Wikipedia says differently than the doc of `lyap`. For this reason, I think it would be nice to have an easy interface to switch between both definitions by allowing to put `A'` directly in the arguments of `lyap`. --- stdlib/LinearAlgebra/src/dense.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/stdlib/LinearAlgebra/src/dense.jl b/stdlib/LinearAlgebra/src/dense.jl index aa215735d3daf..fc6b197411c7c 100644 --- a/stdlib/LinearAlgebra/src/dense.jl +++ b/stdlib/LinearAlgebra/src/dense.jl @@ -1567,4 +1567,5 @@ function lyap(A::StridedMatrix{T}, C::StridedMatrix{T}) where {T<:BlasFloat} rmul!(Q*(Y * adjoint(Q)), inv(scale)) end lyap(A::StridedMatrix{T}, C::StridedMatrix{T}) where {T<:Integer} = lyap(float(A), float(C)) +lyap(A::Adjoint{T,Matrix{T}}, C::Adjoint{T,Matrix{T}}) where T = lyap(Matrix(A), Matrix(C)) lyap(a::T, c::T) where {T<:Number} = -c/(2a)