Skip to content

Commit

Permalink
Fix for #188 (#189)
Browse files Browse the repository at this point in the history
* Fix for #188

* Tests for #188

* Added version guard for Julia 0.6

Fixes #188.
  • Loading branch information
hessammehr authored and martinholters committed Mar 26, 2018
1 parent b10ed24 commit 3cdd31a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/dspbase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ function filt!(out::AbstractArray, b::Union{AbstractVector, Number}, a::Union{Ab
# Filter coefficient normalization
if a[1] != 1
norml = a[1]
a ./= norml
b ./= norml
a = a ./ norml
b = b ./ norml
end
# Pad the coefficients with zeros if needed
bs<sz && (b = copyto!(zeros(eltype(b), sz), b))
Expand Down
14 changes: 14 additions & 0 deletions test/dsp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,17 @@ end
@test conv(a, b) [1., 4., 8., 10., 7., 6.]
@test conv(complex.(a, ones(4)), complex(b)) complex.([1., 4., 8., 10., 7., 6.], [1., 3., 6., 6., 5., 3.])
end

@testset "deconv" begin
# Test for issue #188: deconv mutates inputs
if VERSION >= v"0.7.0-DEV.602"
let b = [4.0, 2.0, 1.0]; a = [2.0, 1.0]
bb = b[:]
aa = a[:]
c = deconv(b,a)
@test c == [2.0, 0.0]
@test a == aa
@test b == bb
end
end
end

0 comments on commit 3cdd31a

Please sign in to comment.