FFT Multiple 1d transforms using FFTW

自作多情 提交于 2021-01-28 19:41:35

问题


I have a 3-dimensional array U(z,y,x) and I want to perform a complex Fourier transform in z for all values of y and x. I am planning to use the FFTW library. I figured out from the FFTW manual that there is a way to perform multiple 1d transforms at once(mentioned below).

CALL dfftw_plan_many_dft(PLAN, rank, n, howmany, in, inembed, istride, idist, out, onembed, ostride, odist, FFTW_MEASURE)

I don't clearly understand what inembed and outembed means. Could you provide more insight into this as I am new to Fortran and I am not entirely sure how to use this?

EDIT1: updated the Fortran code


回答1:


It's described here actually quite well: http://www.fftw.org/fftw3_doc/Advanced-Complex-DFTs.html

inembed and outembed allow one to embed the incoming and outgoing data into a larger dataset:

Imagine that you would like to FFT the sub-matrix of in denoted by the O elements. And possibly outembed the result into the out variable's O fields.

     X X X X X           X X X X X X
     X X X X X           X O O X X X
in = X O O X X     out = X O O X X X
     X O O X X
     X X X X X

inembed then would be [2, 1] (column-major) and outmbed [1, 1]. Then stride would take you from slice to slice / volume to volume etc. Using stride and embed you tell FFTW, how to find the O elements for each sub-data to transform and equally, where to put them in a larger dataset.

Hope this explains it. If you already now the the BLAS interface, you will find that inembed and outembed correspond to LDA, LDB of many routines. Of course BLAS routines are limited to matrices, i.e. assume 2 dimensional operations. FFTs you may of course do in as many dimensions as you like.

If you set inembed and outembed as NULL, then FFTW assumes that there are no X fields in either input our output respectively.



来源:https://stackoverflow.com/questions/61735200/fft-multiple-1d-transforms-using-fftw

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!