Code covered by the BSD License  

Highlights from
FFT-based convolution

5.0

5.0 | 3 ratings Rate this file 45 Downloads (last 30 days) File Size: 4.99 KB File ID: #24504

FFT-based convolution

by Bruno Luong

 

21 Jun 2009 (Updated 16 Sep 2009)

Discrete convolution using FFT method

| Watch this File

File Information
Description

As opposed to Matlab CONV, CONV2, and CONVN implemented as straight forward sliding sums, CONVNFFT uses Fourier transform (FT) convolution theorem, i.e. FT of the convolution is equal to the product of the FTs of the input functions.

In 1-D, the complexity is O((na+nb)*log(na+nb)), where na/nb are respectively the lengths of A and B.

Optional arguments to control the dimension(s) along which convolution is carried out.

Slightly less accurate than sliding sum convolution.

Good usage recommendation:
        In 1D, this function is faster than CONV for nA, nB > 1000.
        In 2D, this function is faster than CONV2 for nA, nB > 20.
        In 3D, this function is faster than CONVN for nA, nB > 5.

Acknowledgements
This submission has inspired the following:
conv2fft_reuse
MATLAB release MATLAB 7.8 (R2009a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (4)
23 Jul 2010 Eric  
02 Nov 2010 Alexander

Awesome function! My code runs 60x faster now (thanks to your GPU support).

06 Mar 2011 Felipe G. Nievinski

Well written (IMHO).

09 Aug 2011 Arun Shamanna  
Please login to add a comment or rating.
Updates
23 Jun 2009

correct bug when ndims(A)<ndims(B)

02 Sep 2009

GPU/Jacket capable

03 Sep 2009

GPU unable by default + changes in help section

16 Sep 2009

Option allows to disable padding to next power-two. Mex implement inplace product that saves about 1/3 memory. These two enhancement might be useful when perform convolution with very large arrays.

Tag Activity for this File
Tag Applied By Date/Time
convolution Bruno Luong 22 Jun 2009 11:19:43
conv Bruno Luong 22 Jun 2009 11:19:43
conv2 Bruno Luong 22 Jun 2009 11:19:43
convn Bruno Luong 22 Jun 2009 11:19:43
fft Bruno Luong 22 Jun 2009 11:19:43
gpu Bruno Luong 03 Sep 2009 13:21:59
jacket Bruno Luong 03 Sep 2009 13:21:59
fft Omri 07 Aug 2011 11:56:28

Contact us at files@mathworks.com