fftw_convolve: fftw_convolve

Description Usage Arguments Value Examples

View source: R/brf_distributed_lag.R

Description

Do convolution for a data series and matrix of equal length filters. For long data series this function will be much faster than non-fft methods.

Usage

1
fftw_convolve(x, y, normalize = TRUE, align = "center")

Arguments

x

numeric vector or single column matrix the data series

y

numeric matrix of filter(s)

normalize

logical do you want the values normalized

align

character what alignment for the convolution

Value

convolution of data series and filter

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
library(splines)

knots <- round(10^seq(0.5, 4.635484, length.out = 9))
n_lags <- 86400*2

bla <- ns(0:(n_lags), knots = knots,
          Boundary.knots = c(0, n_lags))
bv <- rnorm(86400*2 + 3600*24*4)
system.time({
dl <- fftw_convolve(bv, bla, normalize = FALSE)
})

jkennel/waterlevel documentation built on Dec. 1, 2019, 6:24 p.m.