Use the Fast Fourier Transform to perform convolutions between a sequence and each column of a matrix.
convolve2D(x, y, conj = TRUE, type = c("circular", "open"))
M x
n matrix
M x
n matrix.
Numeric sequence of length N.
Logical; if TRUE
, take the complex conjugate before
back-transforming. TRUE
is used for usual convolution.
Character; one of circular
, open
(beginning of word
is ok).
For circular
, the two sequences are treated as circular, i.e.,
periodic.
For open
and filter
, the sequences are padded with zeros
(from left and right) first; filter
returns the middle sub-vector of
open, namely, the result of running a weighted mean of x
with
weights y
.
Brandon Whitcher
This is a corrupted version of convolve made by replacing
fft
with mvfft
in a few places. It would be
nice to submit this to the R Developers for inclusion.