@@ -8,7 +8,7 @@ pole(sys::SisoTf) = error("pole is not implemented for type $(typeof(sys))")
88# converting to zpk before works better in the cases I have tested.
99pole (sys:: TransferFunction ) = pole (zpk (sys))
1010
11- function pole (sys:: TransferFunction{SisoZpk{T,TR}} ) where {T<: Number , TR<: Number }
11+ function pole (sys:: TransferFunction{SisoZpk{T,TR}} ) where {T, TR}
1212 # With right TR, this code works for any SisoTf
1313
1414 # Calculate least common denominator of the minors,
7070
7171Compute the determinant of the Matrix `sys` of SisoTf systems, returns a SisoTf system."""
7272# TODO : improve this implementation, should be more efficient ones
73- function det (sys:: Matrix{S} ) where {T <: Number , TR, S<: SisoZpk }
73+ function det (sys:: Matrix{S} ) where {S<: SisoZpk }
7474 ny, nu = size (sys)
7575 @assert ny == nu " Matrix is not square"
7676 if ny == 1
@@ -192,12 +192,12 @@ end
192192# Note that this returns either Vector{ComplexF32} or Vector{Float64}
193193tzero (sys:: StateSpace ) = tzero (sys. A, sys. B, sys. C, sys. D)
194194# Make sure everything is BlasFloat
195- function tzero (A:: Matrix{<:Number} , B:: Matrix{<:Number} , C:: Matrix{<:Number} , D:: Matrix{<:Number} )
195+ function tzero (A:: AbstractMatrix , B:: AbstractMatrix , C:: AbstractMatrix , D:: AbstractMatrix )
196196 T = promote_type (eltype (A), eltype (B), eltype (C), eltype (D))
197- A2, B2, C2, D2 = promote (A,B,C,D, fill (zero (T)/ one (T),0 ,0 )) # If Int, we get Float64
197+ A2, B2, C2, D2, _ = promote (A,B,C,D, fill (zero (T)/ one (T),0 ,0 )) # If Int, we get Float64
198198 tzero (A2, B2, C2, D2)
199199end
200- function tzero (A:: Matrix {T} , B:: Matrix {T} , C:: Matrix {T} , D:: Matrix {T} ) where T <: BlasFloat
200+ function tzero (A:: AbstractMatrix {T} , B:: AbstractMatrix {T} , C:: AbstractMatrix {T} , D:: AbstractMatrix {T} ) where {T <: Union{AbstractFloat,Complex{<:AbstractFloat}} #= For eps(T) =# }
201201 # Balance the system
202202 A, B, C = balance_statespace (A, B, C)
203203
@@ -232,13 +232,13 @@ function tzero(A::Matrix{T}, B::Matrix{T}, C::Matrix{T}, D::Matrix{T}) where T<:
232232 return zs
233233end
234234
235- reduce_sys (A:: AbstractMatrix{<:BlasFloat} , B:: AbstractMatrix{<:BlasFloat} , C:: AbstractMatrix{<:BlasFloat} , D:: AbstractMatrix{<:BlasFloat} , meps:: BlasFloat ) =
236- reduce_sys (promote (A,B,C,D)... , meps)
235+
237236"""
238237Implements REDUCE in the Emami-Naeini & Van Dooren paper. Returns transformed
239238A, B, C, D matrices. These are empty if there are no zeros.
240239"""
241- function reduce_sys (A:: AbstractMatrix{T} , B:: AbstractMatrix{T} , C:: AbstractMatrix{T} , D:: AbstractMatrix{T} , meps:: BlasFloat ) where T <: BlasFloat
240+ function reduce_sys (A:: AbstractMatrix , B:: AbstractMatrix , C:: AbstractMatrix , D:: AbstractMatrix , meps:: AbstractFloat )
241+ T = promote_type (eltype (A), eltype (B), eltype (C), eltype (D))
242242 Cbar, Dbar = C, D
243243 if isempty (A)
244244 return A, B, C, D
@@ -313,7 +313,7 @@ If `!allMargins`, return only the smallest margin
313313If `full` return also `fullPhase`
314314
315315"""
316- function margin (sys:: LTISystem , w:: AbstractVector{S } ; full= false , allMargins= false ) where S <: Real
316+ function margin (sys:: LTISystem , w:: AbstractVector{<:Real } ; full= false , allMargins= false )
317317 ny, nu = size (sys)
318318
319319 if allMargins
346346
347347returns frequencies for gain margins, gain margins, frequencies for phase margins, phase margins
348348"""
349- function sisomargin (sys:: LTISystem , w:: AbstractVector{S } ; full= false , allMargins= false ) where S <: Real
349+ function sisomargin (sys:: LTISystem , w:: AbstractVector{<:Real } ; full= false , allMargins= false )
350350 ny, nu = size (sys)
351351 if ny != 1 || nu != 1
352352 error (" System must be SISO, use `margin` instead" )
0 commit comments