← All problems
#78 2D FFT Medium

Compute the 2D Discrete Fourier Transform (2D DFT) of a complex-valued signal stored on the GPU. Given a 2D complex input signal of shape M × N, compute its 2D DFT spectrum using the row-column decomposition: apply a 1D DFT along each row, then a 1D DFT along each column of the result. All values are 32-bit floating point.

Implementation Requirements

Example

Input: M = 2, N = 2
Signal \(x[m, n]\) (real part): \[ \begin{bmatrix} 1.0 & 0.0 \\ 0.0 & 0.0 \end{bmatrix} \] Signal \(x[m, n]\) (imaginary part): \[ \begin{bmatrix} 0.0 & 0.0 \\ 0.0 & 0.0 \end{bmatrix} \] Output:
Spectrum \(X[k, l]\) (real part): \[ \begin{bmatrix} 1.0 & 1.0 \\ 1.0 & 1.0 \end{bmatrix} \] Spectrum \(X[k, l]\) (imaginary part): \[ \begin{bmatrix} 0.0 & 0.0 \\ 0.0 & 0.0 \end{bmatrix} \]

Constraints

Guided walkthrough coming soon. Below is the official starter signature in each language; the clickable line-by-line explanation hasn't been authored yet.
Problem text & starters from the official AlphaGPU/leetgpu-challenges. Solve it on leetgpu.com.