> y <- BinDist(x, weights, lo, up, n)
> kords <- seq.int(0, 2 * (up - lo), length.out = 2L * n)
> kords[(n + 2):(2 * n)] <- -kords[n:2]
> kords <- dnorm(kords, sd = bw)
> kords <- fft(fft(y) * Conj(fft(kords)), inverse = TRUE)
> kords <- pmax.int(0, Re(kords)[1L:n]/length(y))
> xords <- seq.int(lo, up, length.out = n)

The above lines of code taught me the way to write a gaussian filter

> kords <- seq.int(0, 2 * (up - lo), length.out = 2L * n)
> kords[(n + 2):(2 * n)] <- -kords[n:2]
> kords <- dnorm(kords, sd = bw)

First you create twice the length of the signal, then you populate the function in such a way that you get this

> plot(seq_along(kords), kords)

ConvolutionLessons-003.jpg

The reason that this is the gaussian filter is because .. Remember in convolution it is always \begin{align*} \end{align*} So, the graph multiplies the density estimate and smoothens it.