DSP.jl icon indicating copy to clipboard operation
DSP.jl copied to clipboard

Extend `conv` to arbitrary lists of vectors

Open KristofferC opened this issue 8 years ago • 1 comments

Moved from https://github.com/JuliaLang/julia/issues/16126

At this moment conv convolves only two vectors, conv(u,v). If you have a list of vectors lst that you want to convolve, you can do it like this:

reduce(conv, lst)

But this is very inefficient because it computes the inverse Fourier transform too many times. A much more efficient way is to compute the FT of every vector once, multiply them element-wise, and then compute only one FT inversion of the product sequence. But for this you need a dedicated conv(u, v, w, ...) that accepts an arbitrary number of vectors.

KristofferC avatar Jun 25 '17 04:06 KristofferC

Sounds like a good idea, but we have conv(u::AbstractVector, v::AbstractVector, A::AbstractMatrix) for a 2D-convolution with separable (into u and v) convolution kernel. And we support mixing arrays of different dimensions for the two-arg cases, so that would imply a subtle different meaning for that three-arg method if we support n-arg in general. That said, we should probably deprecate the current three-arg method to conv(u::AbstractVector, v::Transpose{<:AbstractVector}, A::AbstractMatrix) which would just be a special case of the general n-arg method to be added in the future.

martinholters avatar Nov 04 '24 14:11 martinholters