Pierre Barbier de Reuille <

[hidden email]> wrote:

> I would add one element to the discussion: for some (odd) reasons, SciPy is

> lacking the functions `rfftn` and `irfftn`, functions using half the memory

> space compared to their non-real equivalent `fftn` and `ifftn`.

In both NumPy and SciPy the N-dimensional FFTs are implemented in Python.

It is just a Python loop over all the axes, calling fft or rfft on each

axis.

> However, I

> haven't (yet) seriously tested `scipy.fftpack.fftn` vs. `np.fft.rfftn` to

> check if there is a serious performance gain (beside memory usage).

Real-value FFT is implemented with complex-value FFT. You save half the

memory, but not quite half the computation. Apart from that, the FFT in

SciPy is written in Fortran and the FFT in NumPy is written in C, but they

are algorithmically similar. I don't see any good reason why the Fortran

code in SciPy should be faster than the C code in NumPy. It used to be the

case that Fortran was "faster than C", everything else being equal, but

with modern C compilers and CPUs with deep pipelines and branch prediction

this is rarely the case. So I would expect the NumPy rfftn to be slightly

faster than SciPy fftn, but keep in mind that both have a huge Python

overhead.

Sturla

_______________________________________________

NumPy-Discussion mailing list

[hidden email]
http://mail.scipy.org/mailman/listinfo/numpy-discussion