I\'d like to improve the performance of convolution using python, and was hoping for some insight on how to best go about improving performance.
I am currently usin
For the particular example 3x3 kernel, I'd observe that
1 1 1
1 -8 1
1 1 1
1 1 1 0 0 0
= 1 1 1 + 0 -9 0
1 1 1 0 0 0
and that the first of these is factorable - it can be convoluted by convolving (1 1 1) for each row, and then again for each column. Then subtract nine times the original data. This may or may not be faster, depending on whether the scipy programmers made it smart enough to automatically do this. (I haven't checked in a while.)
You probably want to do more interesting convolutions, where factoring may or may not be possible.