Skip to main content

ifft

Function ifft 

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

Computes the Cooley-Tukey radix-2 IFFT of a complex spectrum.

Runs in O(N log₂ N) using log₂ N butterfly-stage kernels with positive twiddle factors, followed by a CPU-side 1/N scaling pass.

Both slices must have the same power-of-two length — i.e. pass the direct output of [fft] unchanged.

§Returns

A Vec<f32> of length 2 * N:

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

§Example

use gpu_fft::ifft;
let real = vec![0.0f32, 1.0, 0.0, 0.0];
let imag = vec![0.0f32, 0.0, 0.0, 0.0];
let output = ifft(&real, &imag);
let reconstructed = &output[..4]; // real part