# Many 1D FFT -> Single 2D FFT

Hello, forgive me if this is a novice question or the wrong place to ask.

I have trying to modify some FFT code to use the CUDA FFT library instead of the FFTW library.

RIght now in the code, a row is read in from an image, and a backward FFT is performed. The output array from that backward FFT is multiplied by a color map value, and stored in a new array, R.

R is shifted to put the DC value back in the middle of the array, and then R is used as the input value to the forward FFT.

The output of that forward FFT is used to generate the output image. This process happens for each of three spectra, to give me an RGB image.

My questions: is this equivalent to doing a 2D FFT over the entire image at once? Would I get the same result if I ran the backward FFT on the full image, shifted the output matrix to give me DC at the top left corner of the matrix, and ran the forward FFT?

I gather that the only reason the shift even happens is because of the order FFTW returns the results in, and I am not sure that would even be necessary for the CUDA FFT library, but I guess it would.

Thanks

-
Maybe explain some of your acronyms. FFT is obvious, but some of the others, like CUDA (some software package, I guess), DC (who knows) FFTW (what's the W?). – David Roberts Mar 4 '11 at 23:59
This sounds weird. You begin in the image domain, inverse fft into whatever domain that is, then you multiply by a scalar and move back into the image domain. Since the fft is linear you can probably just multiply by a scalar and ignore all the transforms. I'm guessing the shift is because you want a nice way to visualize the fft of the array. See: mathworks.com/help/techdoc/ref/fftshift.html Also, if you're not sure about when you can replace a 1d fft with 2d ffts I would suggest experimenting in matlab before trying to code this up on a gpu. – dranxo Mar 5 '11 at 1:15
This question is completely inappropriate. Vote to close. – Igor Rivin Mar 5 '11 at 4:01
FFTW is a software package that does FFTs..it's pretty common, and the acronym stands for Fastest Fourier Transform in the West. The first sample X(0) of the transformed series is the DC component, more commonly known as the average of the input series. The inverse FFT is into the frequency domain. yes, you are correct about the shift, FFTW does some re-ordering, but i dont know why. Also, why is this question "completely inappropriate?" Where else would I ask a question about FFTs? An AOL chat room? – Dcole Mar 6 '11 at 0:04
@Dcole: I think the reason many MO people dislike these questions is that the question sounds more like a programming question than a mathematical question: to answer it, one would need to know the detailed algorithms used by all these FFT routines, which is mathematically not so interesting. For your question "Would I get the same result if...", there is one way to have a reasonable level of confidence in the answer: try it and see! I would guess FFT questions would be better in StackOverflow. – Zen Harper Mar 13 '11 at 12:17