Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

FFT and changing the sign convention

einaro
Beginner
1,470 Views

Is it possible to change the sign convention for the real2Complex FFT's? The default phase sign of the forward transform is negative, but I would like it to be positive.Is it possible to change?

0 Kudos
7 Replies
Dmitry_B_Intel
Employee
1,470 Views

This feature is not implemented in currentMKL.

Dima

0 Kudos
audrius
Beginner
1,470 Views

Hello,

I would like ask this question again, but as feature request: for physicists who are modeling 3D wave propagation in space or material it would be very useful if they could define FFT sign for each dimension independently, because for wave to propagate in forward direction the sign of FFT in first dimension should be negative (as it is now) and positive in other dimensions. Therefore, with the current 3D FFT the wave is propagating in backward direction, and in some situations it is very confusing. Do you have plans to implement this sign convention feature?

Best Regards,

Audrius Zaukevicius

0 Kudos
Dmitry_B_Intel
Employee
1,470 Views
Hi Audrius,

For complex-to-complex transforms the change of the sign is computationally equivalent to replacing forward transform with the backward transform. For the real-to-complex/complex-to-real transforms, the change of the sign is equivalent to taking the complex conjugate of the complex data (that is r2c followed by conj of the result, or conj of the input followed by c2r). Thus sign convention is easily modelledfor transforms of any rank,so we did notconsiderit as a valuable feature to support in DFTI. FFTW interface doesn't support this feature either.

As I understood, you are arguing for setting FFT sign per dimension in 3D transforms. However, I have not got thereason why one particular dimension should have different sign (that is be time-reversed). Could you give a reference to a paper where this technique is used?

Thanks
Dima
0 Kudos
mecej4
Honored Contributor III
1,470 Views
What is 'forward' in 3-D space -- towards +x, +y,+z -- all three ? Or is the issue related to right-handed/left-handed coordinates?

Can you provide some persuasive arguments (or references) that the sign convention that you ask for is the only reasonable choice for 3D FFT?
0 Kudos
audrius
Beginner
1,470 Views

Dear Dima,

yes, I am arguing for setting FFT sign per dimension in 3D transforms. A general solution to the electromagnetic wave equation in rectangular coordinates may be formed as a weighted superposition of all possible elementary plane wave solutions as:

E(t, x, y, z) = 1/2e int int S(w,k)exp(i[w*t-k*r]) dw dk + c.c. (#1)
, here intis integral from -infinity to +infinity; S - complex amplitude of the spectral component;
The critical moment in this equation is the sign in exp(i[wt-kr]). Choosing the negative sign (like it is now), means wave movingto thepositive z direction, and if the signis positive exp(i[wt+kr]), itmeans wave moving to the negative z direction. The negative sign is chosen in all textbooks by default, thus dealingwith the positive signleads tocomplications in some situations.
Now I explain how it comes, that one needs different sign per dimension in 3D FFT:
Equation (#1)can be expanded to:
E(t, x, y, z) = 1/2e int int intS(w, kx, ky, kz)exp(i[w*t-k_x*x-k_y*y-k_z*z]) dw dk_x dk_y+ c.c. (#2)
where k_z=sqrt(k(w)^2-k_x^2-k_y^2); here "_x" (or "_y") denotes a subscript of x (or y)
As you can see from the(#2) equation the integration must be done with positive sign in time domain (exp[i*w*t]) and with negative in space domain (exp[-i*k_x*x-i*k_y*y]).
For now, with Intel 3D FFT the integration sign ispositive for all domains, thus it automatically leads to exp(i[w*t+k*r]), i.e. moving toward negative z direction.
I could notfind any references that would explain this in more detail. Maybe you could find something useful in Wikipedia at:http://en.wikipedia.org/wiki/Electromagnetic_wave_equation under the paragraph "Solutions to the homogeneous electromagnetic wave equation".

Sorry for being so late,
Audrius

0 Kudos
audrius
Beginner
1,470 Views
Hello,
is there anyone out there to answer to this post?

Audrius
0 Kudos
Dmitry_B_Intel
Employee
1,470 Views
Hi Audrius,

Adding per-dimension sign requires additional API and it would be much more justified if supported byworking example that would show the performance impact. Please notice that popular FFTW3 library doesn't provide this feature.

Please also consider the following.
Backward FFT (sign +1) is merely the complex conjugate of forward FFT(sign -1):
invF = conj(fwdF)
The FFT matrix has the time reversal symmetry T, so that the conjugate can be expressed thus:
invF = T*fwdF = fwdF*T,
where T changes the order of elements {x1,x2,x3,...,xN} <--> {x1,xN,...,x3,x2}.

That means, if you want to apply 3DFFT with signs (+1,-1,-1) toarray S(Nw,Nkx,Nky), you will obtain the same result if you permute the input:
S1(iw,kx,ky) = S(iw,kx,ky) if iw = 1
S1(iw,kx,ky) = S(Nw-iw+1,kx,ky) otherwise
and apply conventional (-1,-1,-1) 3D forward FFT to S1.

Alternatively, you can achieve the same effect by taking the result of conventional 3D forward FFT in time-reversed order.

Thanks
Dima
0 Kudos
Reply