[SciPy-Dev] Pull request 9190 - Support specifying axes for fftconvolve

Ralf Gommers ralf.gommers at gmail.com
Wed Sep 5 22:20:31 EDT 2018


On Tue, Sep 4, 2018 at 9:27 AM Todd <toddrjen at gmail.com> wrote:

> Allowing specifying the axes for convolve and fftconvolve was discussed in
> issue #3525 [1]. I have implemented this feature for fftconvolve [2].  It
> allows the user the specify one or more axes as the axes over which the
> convolution will be carried.  Other axes will be broadcast together,
> although both arrays must have the same number of dimensions (it will not
> automatically add implicit length-1 dimensions to make the number of
> dimensions match).
>
> As I side-effect of this, I also implemented a new pair of helper
> functions for n-dimensional transforms that calculates the shape and axes
> arguments.  This is shared between fftn, ifftn, dctn, idctn, dstn, idstn,
> and fftconvolve.  It also adds some additional benefits.  These functions
> now support any integer array-like as their shape and axes arguments
> instead of just tuples.  The functions now consistently interpret
> individual ints as length-1 arrays of ints.  They also support negative
> values in the shape argument, which is interpreted as just using the length
> of that particular dimension from the original array.
>
> I have also implemented unit tests for everything, and updated the
> relevant function signatures.
>
> This feature is a prerequisite for implementing the overlap-add method [2]
> for convolution, which has enormous performance benefits for two arrays of
> very different sizes (one is larger by a factor of more than a few times)
> where both arrays are large (both are more than a few hundred samples long).
>

That sounds really useful, thanks Todd.

Cheers,
Ralf


> [1] https://github.com/scipy/scipy/issues/3525
> [2] https://github.com/scipy/scipy/pull/9190
> [3] https://en.wikipedia.org/wiki/Overlap%E2%80%93add_method
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev at python.org
> https://mail.python.org/mailman/listinfo/scipy-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20180905/20e61fca/attachment.html>


More information about the SciPy-Dev mailing list