Comparatively slow python numpy 3D Fourier Transformation

前端 未结 2 1953
执笔经年
执笔经年 2021-01-19 23:07

For my work I need to perform discrete fourier transformations (DFTs) on large images. In the current example I require a 3D FT for a 1921 x 512 x 512 image (along with 2D F

2条回答
  •  时光说笑
    2021-01-19 23:36

    You could try FFT from Intel MKL (Math Kernel Library) which is faster than FFTW. Intel provides mkl-fft for Python which replaces numpy.fft. All that you need to do is type:

    pip install mkl-fft
    

    and run your program again, without any changes.

    Also, numpy 1.17 (soon to be released) will have new implementation of FFT:

    Replacement of the fftpack-based FFT module by the pocketfft library

    Both implementations have the same ancestor (Fortran77 FFTPACK by Paul N. Swarztrauber), but pocketfft contains additional modifications which improve both accuracy and performance in some circumstances. For FFT lengths containing large prime factors, pocketfft uses Bluestein’s algorithm, which maintains O(N log N) run time complexity instead of deteriorating towards O(N*N) for prime lengths. Also, accuracy for real-valued FFTs with near-prime lengths has improved and is on par with complex-valued FFTs.

提交回复
热议问题