Convolutions - similarity methods

DSP.convFunction
conv(u,v)

Convolution of two arrays. Uses either FFT convolution or overlap-save, depending on the size of the input. u and v can be N-dimensional arrays, with arbitrary indexing offsets, but their axes must be a UnitRange.

source
conv(u,v,A)

2-D convolution of the matrix A with the 2-D separable kernel generated by the vectors u and v. Uses 2-D FFT algorithm.

source
DSP.deconvFunction
deconv(b,a) -> c

Construct vector c such that b = conv(a,c) + r. Equivalent to polynomial division.

source
DSP.xcorrFunction
xcorr(u; padmode::Symbol=:none, scaling::Symbol=:none)
xcorr(u, v; padmode::Symbol=:none, scaling::Symbol=:none)

With two arguments, compute the cross-correlation of two vectors, by calculating the similarity between u and v with various offsets of v. Delaying u relative to v will shift the result to the right. If one argument is provided, calculate xcorr(u, u; kwargs...).

The size of the output depends on the padmode keyword argument: with padmode = :none the length of the result will be length(u) + length(v) - 1, as with conv. With padmode = :longest, the shorter of the arguments will be padded so they are of equal length. This gives a result with length 2*max(length(u), length(v))-1, with the zero-lag condition at the center.

The keyword argument scaling can be provided. Possible arguments are the default :none and :biased. :biased is valid only if the vectors have the same length, or only one vector is provided, dividing the result by length(u).

Examples

julia> xcorr([1,2,3],[1,2,3])
5-element Vector{Int64}:
  3
  8
 14
  8
  3
source