Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
ifft very slow

Subject: ifft very slow

From: paolo serena

Date: 15 Nov, 2012 09:31:18

Message: 1 of 3

Hi to all.

I was wondering why ifft is slow compared to fft. For instance, with the following code:

N = 2^16;
x=complex(randn(N,1),randn(N,1));
invN = 1/N;
tic, for k=1:1000, z=ifft(x);end,toc
tic, for k=1:1000, z2=conj(fft(conj(x)))*invN;end,toc

I got:

Elapsed time is 9.806159 seconds.
Elapsed time is 5.950683 seconds.

with max(abs(z-z2)) = 4.8487e-18. The speed improvement is significant (40%) and it is substantially what I observe in much more complex simulations. Can you explain me the reason? I also tried fftw('planner','patient'), without significant change.

Thanks
Paolo

Subject: ifft very slow

From: Yair Altman

Date: 18 Nov, 2012 16:58:07

Message: 2 of 3

"paolo serena" wrote in message <k82cp6$9t5$1@newscl01ah.mathworks.com>...
> Hi to all.
>
> I was wondering why ifft is slow compared to fft. For instance, with the following code:
>
> N = 2^16;
> x=complex(randn(N,1),randn(N,1));
> invN = 1/N;
> tic, for k=1:1000, z=ifft(x);end,toc
> tic, for k=1:1000, z2=conj(fft(conj(x)))*invN;end,toc
>
> I got:
>
> Elapsed time is 9.806159 seconds.
> Elapsed time is 5.950683 seconds.
>
> with max(abs(z-z2)) = 4.8487e-18. The speed improvement is significant (40%) and it is substantially what I observe in much more complex simulations. Can you explain me the reason? I also tried fftw('planner','patient'), without significant change.
>
> Thanks
> Paolo


This is probably platform and release dependent. On my WinXP laptop running R2012a, the top row (using ifft) takes <3secs, whereas the second (fft with 2 conjs) takes 4.5 secs. Your results may possibly be due to a different BLAS version on your system. Try running on other releases/platforms.

Yair Altman
http://UndocumentedMatlab.com

Subject: ifft very slow

From: paolo serena

Date: 19 Nov, 2012 08:24:09

Message: 3 of 3


>
> This is probably platform and release dependent. On my WinXP laptop running R2012a, the top row (using ifft) takes <3secs, whereas the second (fft with 2 conjs) takes 4.5 secs. Your results may possibly be due to a different BLAS version on your system. Try running on other releases/platforms.
>

Actually I verified that it is load dependent. My test was for a 12 cores workstation (Matlab R2009b) close to full load (11 cores active). If I run Matlab with the option -singleCompThread I have comparable values to yours, i.e., standard ifft is the best option. Thanks.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us