Skip to content

Commit

Permalink
remove unnecessary allocations
Browse files Browse the repository at this point in the history
  • Loading branch information
r9y9 committed May 2, 2015
1 parent 4b0ab0f commit 0cc312f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/cqt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,13 @@ function _kernelmat(T::Type,
atom = Array(Complex{T}, fftlen)

for k = 1:length(winsizes)
fill!(atom, zero(T))
fill!(atom, zero(Complex{T}))
Nk = winsizes[k]
kernel = win(Nk) .* exp(-im*2π*Q/Nk .* (1:Nk)) / Nk
s = (fftlen - Nk) >> 1 + 1
copy!(atom, s, kernel, 1, Nk)
K[:, k] = fft(atom)
fft!(atom)
copy!(K, fftlen*(k-1) + 1, atom, 1, fftlen)
end

K[abs(K) .< threshold] = 0.0
Expand Down

0 comments on commit 0cc312f

Please sign in to comment.