`Convolutions`

- similarity methods

`DSP.conv`

— Function`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`

.

`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.

`DSP.deconv`

— Function`deconv(b,a) -> c`

Construct vector `c`

such that `b = conv(a,c) + r`

. Equivalent to polynomial division.

`DSP.xcorr`

— Function`xcorr(u,v; padmode = :none)`

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.

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 equal length. This gives a result with length 2*max(length(u), length(v))-1, with the zero-lag condition at the center.