For odd integers T and S, Array1 and Array2 are both 2 dimensional ndarrays of shape (T, S) which represent samples of functions func1(t, s) and func2(t, s) on an equally spaced lattice L of T x S points stretching from t=0 to t=1 and s=-10 to s=10. I wish to obtain a third Array3 of shape (T, S) which takes values as func3(t, s) on this lattice, where func3(t, s) is the sum of func1(q, p)*func2(t-q, s-p) over all q and p such that both (q, p) and (t-q, s-p) are on the lattice L.
My current working method for doing this is padding Array2 with 0's to create an ExtendedArray2 of shape (2T-1, 2S-1) such that ExtendedArray2[(T-1)+x][(S-1)+y]=Array2[x][y] for 0 <= x <= T-1 and 0 <= y <= S-1, and takes values of 0 elsewhere. I convolve Array1 and ExtendedArray2 in the following way using signal from scipy to get my desired result.
Array3 = signal.fftconvolve(Array1, ExtendedArray2, mode='valid')
The fftconvolve is reasonably fast, but this method has the drawback that it requires doubling both dimensions of the input arrays, which makes the speed take a hit compared to what it could be on the smaller sized arrays. Is there a way a speed-efficient convolution method could be used on the unpadded arrays to obtain Array3?