 # FFT(volumen1) .* volumen2 memory arrangement

Hi,
i need some help with a liitle problem here. i want to multiply a fourier transformed volume with a volume of the same size. the second volume is a real volume. how could i do this. because if i do the elementwise multiplication i get something strange output and this is not corresponding to the result in matlab. matlab: x = fftn(v1) .* v2; is there some memory rearrangement during the fft and where could i find how it is done. or in other words how to convert a volium to intereaved volum"?
rgds

This is explained in the CUFFT documentation. Complex to real (and R2C) transforms in CUFFT have a special memory layout - only the non-redundant N/2+1 complex coefficients are stored.

For higher dimensional transforms of the form N0×N1×…×Nn, the last dimension is cut in half such that the data is N0×N1×…×(Nn/2+1) complex elements.

This the same arrangement used by the FFTW library, their documentation has more details:
http://www.fftw.org/fftw3_doc/Real_002ddat…ray-Format.html

ok that is also what i found but i don’t get thru. any examples? any code available?

I have similar question sometime ago. And i find the answer myself, that is you should only perform elements wise multiplication within the limits size that is N0×N1×…×(Nn/2+1).

and if you use R2C to perform spatial - Fourier transformation you MUST use C2R to perform the inverse transformation to get the correct result, remember scale the value after performing R2C (i think it is informed in CUDA FFT spec, but i don’t think it is well documented ). Make some easy example with small size matrix you will find how it work

Hope this help

ok u mean that it should work to multiply n1 * n2 * (n3/2 +1) part of each volume?

what i want to do is this:

s = sphere(3,64);

pic = ones(64,64,64);

r = ifourier(fourier(pic) .* fftshift(s));

should this work with n1 * n2 * (n3/2 +1) ?

rgds

Yes. It is what i did. But remember it is true with real input only.

The easier way to do this is to make complex input from the real input and perform full component-wise matrix multiplication and working on Complex domain only. Output result should be complex too, but will have the imagine part equal to zero.

ok i am now able to do the whole stuff and i have checked that i have before the ifft. i have the correct values in memory but then something happens and the output of the ifft is not correct. so my question is can i multiply all of the n+1 parts or must the +1 value be unchanged?

Hi
i need a for this stupid thing a second time some help.
i have now made the fftshift and use the fft and ifft of cufft.

what i am doing is