Possible Duplicate:
Fast convolution algorithm
I have two arrays a and b of N length. I want to calculate the result array as
res[i+j] += a[i]*b[j]
Is it possible to calculate this using FFT or something similar in time faster than N^2. I saw this question already 1D Fast Convolution without FFT but am not sure how to do that using FFT.
EG: A=[1,2,3],B[2,4,6]
res[3] = A[1]*B[2]+A[2]*B[1]
Thanks in advance
From what i understand you want the FFT algorithm. here you have an implementation of this algorithm, and also a good explanation on how to implement the FFT algorithm.