问题描述
我有一个3维数组U(z,y,x),我想对y和x的所有值在z中执行复杂的傅立叶变换.我打算使用FFTW库.我从FFTW手册中发现,有一种方法可以一次执行多个1d转换(如下所述).
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(计划,等级,n,Howmany,进,嵌入式,同位,同位,出,onembed,ostride,odist,FFTW_MEASURE)
CALL dfftw_plan_many_dft(PLAN, rank, n, howmany, in, inembed, istride, idist, out, onembed, ostride, odist, FFTW_MEASURE)
我不太清楚嵌入
和嵌入
的含义.当我刚接触Fortran时,您能否提供更多的见解?我不确定如何使用它吗?
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?
更新了Fortran代码
updated the Fortran code
推荐答案
在这里实际上已经很好地描述了它: http://www.fftw.org/fftw3_doc/Advanced-Complex-DFTs.html
It's described here actually quite well:http://www.fftw.org/fftw3_doc/Advanced-Complex-DFTs.html
inmbed
和 outembed
允许将传入和传出的数据嵌入到更大的数据集中:
inembed
and outembed
allow one to embed the incoming and outgoing data into a larger dataset:
想象一下,您想对 O
元素表示的 in
的子矩阵进行FFT.可能会将结果嵌入到 out
变量的 O
字段中.
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
inmbed
将为[2,1](主要列),而 outmbed
[1,1].然后跨步将使您从切片到切片/从卷到卷等.使用 stride
和 embed
,您告诉FFTW如何找到 O
元素对于每个要转换的子数据,同样地,将其放置在较大的数据集中.
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.
希望这可以解释它.如果您现在已经是BLAS界面,您会发现 inmbed
和 outembed
对应于 LDA
, LDB
许多例程.当然,BLAS例程仅限于矩阵,即假设二维运算.您当然可以在任意数量的维度上进行FFT.
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.
如果将 inmbed
和 outembed
设置为 NULL
,则FFTW假定其中没有 X
字段要么分别输入我们的输出.
If you set inembed
and outembed
as NULL
, then FFTW assumes that there are no X
fields in either input our output respectively.
这篇关于使用FFTW进行FFT一维变换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!