[SciPy-dev] Old numarray convolve2d fft=1 option
Charles R Harris
charlesr.harris@gmail....
Sun May 27 12:28:28 CDT 2007
On 5/2/07, Christopher Hanley <chanley@stsci.edu> wrote:
>
> David O'Sullivan wrote:
> > Hi,
> > I'm relatively new to this, and certainly no expert on the underlying
> > math of all this stuff, but I'm trying to do relatively large kernel
> > convolutions on large 2d matrices. The kernels might be 160x160 while
> > the matrices themselves might be 2500x2500. They're also likely to be
> > sparse matrices, but I'll worry about that later - for now I'm just
> > scoping things out.
> >
> > So... anyway... with those size convolutions in mind, I'm intrigued by
> > the fft=1 option that was in the numarray.convolve2d function (or so it
> > says at
> >
> > http://stsdas.stsci.edu/numarray/numarray-1.5.html/node65.html
> >
> > This option doesn't seem to be in the current scipy.signal.convolve2d
> > function. Presumably it would speed 2d convolutions up a lot?
> >
> > Is there a way around this?
> >
> > Or a plan to put the fft implementation into scipy.signal.convolve2d?
> >
> > Thanks
> >
> > David
> >
> >
> >
> David,
>
> The numarray convolve package is currently living in
> scipy.stsci.convolve. It should work in the same way the numarray
> version did.
I believe scipy.stsci.convolve is buggy. Convolve calls _correlate2d_fft,
which in turn call fft2 for the forward transforms, multiplies, then calls
irfft2 for the inverse transform. However, fft2 does *complex* transforms,
so you need to call ifft2. This is easily checked. The pair irfft2, irfft2
can be used for the real case.
Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-dev/attachments/20070527/0088dc3d/attachment.html
More information about the Scipy-dev
mailing list