From 84c90017660c392e68b68651957eb73ae8fabd93 Mon Sep 17 00:00:00 2001 From: Fredrik Bagge Carlson Date: Fri, 28 Jan 2022 11:49:49 +0100 Subject: [PATCH] special transform if matrix is unitary --- src/matrix_comps.jl | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/matrix_comps.jl b/src/matrix_comps.jl index c20d125d1..376a7174a 100644 --- a/src/matrix_comps.jl +++ b/src/matrix_comps.jl @@ -574,7 +574,7 @@ function baltrunc(sys::ST; atol = sqrt(eps()), rtol = 1e-3, n = nothing, residua end """ - syst = similarity_transform(sys, T) + syst = similarity_transform(sys, T; unitary=false) Perform a similarity transform `T : Tx̃ = x` on `sys` such that ``` Ã = T⁻¹AT @@ -582,11 +582,18 @@ B̃ = T⁻¹ B C̃ = CT D̃ = D ``` + +If `unitary=true`, `T` is assumed unitary and the matrix adjoint is used instead of the inverse. """ -function similarity_transform(sys::ST, T) where ST <: AbstractStateSpace +function similarity_transform(sys::ST, T; unitary=false) where ST <: AbstractStateSpace Tf = factorize(T) - A = Tf\sys.A*T - B = Tf\sys.B + if unitary + A = Tf'sys.A*T + B = Tf'sys.B + else + A = Tf\sys.A*T + B = Tf\sys.B + end C = sys.C*T D = sys.D ST(A,B,C,D,sys.timeevol)