[Numpy-discussion] fast way to convolve a 2d array with 1d filter

Charles R Harris charlesr.harris@gmail....
Tue Dec 2 01:05:04 CST 2008


On Mon, Dec 1, 2008 at 11:14 PM, frank wang <f.yw@hotmail.com> wrote:

>  This is what I thought to do. However, I am not sure whether this is a
> fast way to do it and also I want to find a more generous way to do it. I
> thought there may be a more elegant way to do it.
>
> Thanks
>
> Frank
>

Well, for just the one matrix not much will speed it up. If you have lots of
matrices and the coefficients are fixed, then you can set up a "convolution"
matrix whose columns are the coefficients shifted appropriately. Then just
do a matrix multiply.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20081202/5218eb7e/attachment.html 


More information about the Numpy-discussion mailing list