From 715b8e99b2487502f1cfd30cda2b125ce10d75a7 Mon Sep 17 00:00:00 2001 From: Fredrik Bagge Carlson Date: Sat, 1 Oct 2022 14:46:33 +0200 Subject: [PATCH] fix some linting warnings --- lib/ControlSystemsBase/src/analysis.jl | 2 +- lib/ControlSystemsBase/src/delay_systems.jl | 2 +- lib/ControlSystemsBase/src/utilities.jl | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ControlSystemsBase/src/analysis.jl b/lib/ControlSystemsBase/src/analysis.jl index 7e24eece5..2b05ff2a1 100644 --- a/lib/ControlSystemsBase/src/analysis.jl +++ b/lib/ControlSystemsBase/src/analysis.jl @@ -18,7 +18,7 @@ function poles(sys::TransferFunction{<:TimeEvolution,SisoZpk{T,TR}}) where {T, T for poles = minorpoles(sys.matrix) # Poles have to be equal to existing poles for the individual transfer functions and this # calculation probably is more precise than the full. Seems to work better at least. - for i = 1:length(poles) + for i = eachindex(poles) idx = argmin(map(abs, individualpoles .- poles[i])) poles[i] = individualpoles[idx] end diff --git a/lib/ControlSystemsBase/src/delay_systems.jl b/lib/ControlSystemsBase/src/delay_systems.jl index 691096cd9..404d34070 100644 --- a/lib/ControlSystemsBase/src/delay_systems.jl +++ b/lib/ControlSystemsBase/src/delay_systems.jl @@ -6,7 +6,7 @@ function freqresp!(R::Array{T,3}, sys::DelayLtiSystem, ω::AbstractVector{W}) wh cache = cis.(ω[1].*sys.Tau) - @views for ω_idx=1:length(ω) + @views for ω_idx = eachindex(ω) P11_fr = P_fr[1:ny, 1:nu, ω_idx] P12_fr = P_fr[1:ny, nu+1:end, ω_idx] P21_fr = P_fr[ny+1:end, 1:nu, ω_idx] diff --git a/lib/ControlSystemsBase/src/utilities.jl b/lib/ControlSystemsBase/src/utilities.jl index 302d1b309..8eb257e29 100644 --- a/lib/ControlSystemsBase/src/utilities.jl +++ b/lib/ControlSystemsBase/src/utilities.jl @@ -115,13 +115,13 @@ poly2vec(p::Polynomial) = p.coeffs[1:end] function unwrap!(M::Array, dim=1) alldims(i) = ntuple(n->n==dim ? i : (1:size(M,n)), ndims(M)) + π2 = eltype(M)(2π) for i = 2:size(M, dim) #This is a copy of slicedim from the JuliaLang but enables us to write to it #The code (with dim=1) is equivalent to # d = M[i,:,:,...,:] - M[i-1,:,...,:] # M[i,:,:,...,:] -= floor((d+π) / (2π)) * 2π d = M[alldims(i)...] - M[alldims(i-1)...] - π2 = eltype(M)(2π) M[alldims(i)...] -= @. floor((d + π) / π2) * π2 end return M