Skip to content

Commit 84045b1

Browse files
kagalenko-m-bdevmotionmschauer
committed
Apply suggestions from code review
Implement assorted suggestions from code review Co-authored-by: David Widmann <[email protected]> Co-authored-by: Moritz Schauer <[email protected]>
1 parent 39137e3 commit 84045b1

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

src/signalcorr.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,16 @@ The output is not normalized. See [`autocor`](@ref) for a function with normaliz
108108
"""
109109
function autocov(x::AbstractVector, lags::AbstractVector{<:Integer}; demean::Bool=true)
110110
out = Vector{float(eltype(x))}(undef, length(lags))
111-
autocov!(out, x, lags; demean)
111+
autocov!(out, x, lags; demean=demean)
112112
end
113113

114114
function autocov(x::AbstractMatrix, lags::AbstractVector{<:Integer}; demean::Bool=true)
115115
out = Matrix{float(eltype(x))}(undef, length(lags), size(x,2))
116-
autocov!(out, x, lags; demean)
116+
autocov!(out, x, lags; demean=demean)
117117
end
118118

119119
autocov(x::AbstractVecOrMat; demean::Bool=true) =
120-
autocov(x, default_autolags(size(x,1)); demean)
120+
autocov(x, default_autolags(size(x,1)); demean=demean)
121121

122122
## autocor
123123

@@ -155,7 +155,7 @@ function autocor!(
155155
T = typeof(zero(eltype(x))/1)
156156
z = Vector{T}(undef, size(x, 1))
157157
for n in 1:size(x, 2)
158-
autocor!(view(r, :, n), view(x, :, n), lags, z; demean)
158+
autocor!(view(r, :, n), view(x, :, n), lags, z; demean=demean)
159159
end
160160
return r
161161
end
@@ -180,16 +180,16 @@ autocorrelation is 1. See [`autocov`](@ref) for the unnormalized form.
180180
"""
181181
function autocor(x::AbstractVector, lags::AbstractVector{<:Integer}; demean::Bool=true)
182182
out = Vector{float(eltype(x))}(undef, length(lags))
183-
autocor!(out, x, lags; demean)
183+
autocor!(out, x, lags; demean=demean)
184184
end
185185

186186
function autocor(x::AbstractMatrix, lags::AbstractVector{<:Integer}; demean::Bool=true)
187187
out = Matrix{float(eltype(x))}(undef, length(lags), size(x,2))
188-
autocor!(out, x, lags; demean)
188+
autocor!(out, x, lags; demean=demean)
189189
end
190190

191191
autocor(x::AbstractVecOrMat; demean::Bool=true) =
192-
autocor(x, default_autolags(size(x,1)); demean)
192+
autocor(x, default_autolags(size(x,1)); demean=demean)
193193

194194

195195
#######################################

src/toeplitzsolvers.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ function durbin!(r::AbstractVector{T}, p::AbstractVector{T}, y::AbstractVector{T
1818
y[j] += α*conj(y[k-j+1])
1919
y[k-j+1] += α*conj(tmp)
2020
end
21-
if isodd(k) y[div(k,2)+1] += α*conj(y[div(k,2)+1]) end
21+
if isodd(k)
22+
y[div(k,2)+1] += α*conj(y[div(k,2)+1])
23+
end
2224
y[k+1] = α
2325
p[k+1] = α
2426
end

test/signalcorr.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ function toeplitz(v::AbstractVector{T}) where T
132132
N=length(v)
133133
A = zeros(T, N - 1, N - 1)
134134
for n in 1:N-1
135-
A[n, n + 1:end] = conj(v[2:N-n])
135+
A[n, n+1:end] = conj(v[2:N-n])
136136
A[n, 1:n] = reverse(v[1:n])
137137
end
138138
return A

0 commit comments

Comments
 (0)