Hello,

I have a R code for doing convolution of two functions:

convolveSlow <- function(x, y) {
    nx <- length(x); ny <- length(y)
    xy <- numeric(nx + ny - 1)
    for(i in seq(length = nx)) {
        xi <- x[[i]]
        for(j in seq(length = ny)) {
            ij <- i+j-1
            xy[[ij]] <- xy[[ij]] + xi * y[[j]]
        }
    }
    xy
}

How do I reduce the 2 loops so that I can run the  code faster?

Thank you
San

	[[alternative HTML version deleted]]

