|
Hi group,
I was profiling my code and noticed that IFFT2 is about 3-4 times slower than FFT2. See the following test code:
%%%%%%%%%%
n = 128;
m = 1000;
x = randn(n,n) + 1j * randn(n,n);
dummy = 0;
for k = 1:m
y = fft2(x);
dummy = dummy + y(1,1); %pretend we are using y
end
for k = 1:m
y = ifft2(x);
dummy = dummy + y(1,1); %pretend we are using y
end
%%%%%%%%%%%%
I played a bit with calling (fftw('planner', 'exhaustive'), substiting FFT2/ITTF2 by FFTN/IFFTN and using fft2(..., 'nonsymmetric'), but with pretty similar results. I only found one similar discussion in this group [1], but in that case they were using real vectors as inputs, in my case it is always 2D complex matrices.
The goal of this exercise is to speed up my simulation that can take up to a day and whose inner loop consists of
Y{r} = ifft2(P{p} .* fft2(X{q}));
where all matrices are complex and have size around 100x100. The P{q} are constants, while X{q} changes on every loop. My platform is 32-bit Linux (RedHat clone).
Thanks,
Bas
[1] https://groups.google.com/d/topic/comp.soft-sys.matlab/lpfm5AQGFzI/discussion
|