[Numpy-discussion] convolve optimisation...

Stéfan van der Walt stefan at sun.ac.za
Wed Jun 24 08:40:37 EDT 2009

2009/6/24 fred <fredmfp at gmail.com>:
> fred a écrit :
>> Hi all,
>> Say I have a 2D array A(nx, ny).
>> In each A[i, j] I want to compute convolve(a, kernel)
>> where a is subarray of A.
>> a and kernel are small besides A.
> I forgot to mention: kernel is not constant, of course.
> It varies vs. others parameters.

If your kernel varies with i and j, you have little choice but to do
this at the C level.

Have a look at the Cython convolution example here:


Alternatively, David Cournapeau can take this opportunity to
illustrate his very nifty Neighbour Iterator.


More information about the NumPy-Discussion mailing list