I have the program four1.c
from Numerical Recipes in C to calculate the Discrete Fourier Transform (DFT) of a one dimensional array. I want to calculate the DFT of a two dimensional array using four1.c
, how can I do it?
-
3$\begingroup$ Why not just use a 2-dimensional FFT library? $\endgroup$ – Bill Barth Sep 2 '14 at 20:15
-
$\begingroup$ I think @BillBarth is right, why not use something like FFTW? $\endgroup$ – Kirill Sep 3 '14 at 14:29
-
$\begingroup$ Yeah, I'd just use a 2-D FFT library. Hypothetically, one might object to using a GPL'd library. SciPy uses FFTPACK instead of FFTW due to licensing issues, and FFTPACK only implements 1-D transforms, so SciPy implements $n$-D FFTs by composing 1-D FFTs from FFTPACK. (For an in-house tool not intended for distribution, it's all moot anyway.) $\endgroup$ – Geoff Oxberry Sep 4 '14 at 1:31
You just take the DFT across each row and then across each column, or columns then rows, it doesn't matter.