How to take the 3D fft of a vector?


Hi all,

I was wondering if there were a way to take the 3D fft of a vector. I am obviously using FFTW for my direct fft calculations using plans but I’m not sure for it to calculate the 3D fft and not just a 1D fft. The dims parameter in the fft calculation in FFTW doesn’t seem to really be helpful, so any suggestion or help about how to calculate a 3D fft of a vector would be greatly appreciated.

Thanks and have a great day,

If you have data in a regular 3d grid, store it in a 3d array. If you have an irregular set of points in 3d, then what you want is something other than a DFT (what an FFT computes), since the DFT is only defined on regular lattices.

Firstly, thanks for the response.

Secondly, I was actually about to try and change that part because for the fft part of my program it’s actually not the case. I’m essentially trying to take the fft of a vector.

If you have a data on a regular 3d lattice, why can’t you store it in a 3d array a, with a[i,j,k] corresponding to the value at (x,y,z) = (i\Delta x, j\Delta y, k\Delta z)?

Well, that’s where things kinda get weird because I’m doing these fft’s on projections of a 3D Green function, so I think everything might be stored as [x,y,z] but because of the projections (like G_{xx} or G_{yx}) I kinda question it. No matter what I think an fft using a plan should do the trick but I’m just not sure of the specifics because the basic one in FFTW does multidimensional fft’s with dims but I think this is different than a 3D fft.

It sounds like you need to work out exactly what mathematical operation you want to perform before you ask how to perform it.

Ok then… I don’t exactly understand what you mean. What more is needed than the mathematical operation is the 3D fft of a vector.

A 3d DFT is conventionally defined for a 3-index data set a_{i,j,k} (a “3d array”) producing another 3-index result \hat{a}_{i,j,k}. How do these inputs (and outputs) map to the contents of your “vector”? Write down a formula for what you want.

I’m not too sure honestly because the G_{xx} I have been talking about is a 64x1 vector, so if we want to take the fft of it as an example, I don’t think a 3x1 element would be good. Maybe that’s where the confusion is. I was told that in my whole program things weren’t giving good results because of how my embedding code works (step 1 above) I needed to use 3D fft’s (not too sure why and I won’t be able to know until next Tuesday) and not the usual fft plan’s in FFTW.

I guess there’s no point in continuing this discussion since there’s seems to be some misunderstandings. Thanks for your time and take care,