Skip to main content

ifft

Function ifft 

Source
pub fn ifft<R: Runtime>(
    device: &R::Device,
    input_real: &[f32],
    input_imag: &[f32],
) -> Vec<f32>
Expand description

Computes the Cooley-Tukey radix-2 DIT IFFT of (input_real, input_imag).

Both slices must have the same power-of-two length (the direct output of fft). Uses the same inner/outer launch strategy as fft: inner stages are fused into a single shared-memory dispatch; outer stages use one global-memory dispatch each. After the butterflies, a CPU-side 1/N divide is applied.

§Returns

Vec<f32> of length 2 * N:

  • [0..N] — reconstructed real signal
  • [N..2N] — reconstructed imaginary signal (≈ 0 for real-valued inputs)

§Panics

Panics if the slice lengths differ or are not a power of two.

§Example

use cubecl::wgpu::WgpuRuntime;
use gpu_fft::ifft::ifft;
let real = vec![1.0f32, 0.0, 0.0, 0.0];
let imag = vec![0.0f32, 0.0, 0.0, 0.0];
let output = ifft::<WgpuRuntime>(&Default::default(), &real, &imag);