Skip to main content

dft

Function dft 

Source
pub fn dft(x: &[Cplx]) -> Vec<Cplx> 
Expand description

Forward DFT: X[k] = Σ_n x[n] · e^{−2πi kn/N}.

This is the f64-exact reference: a naive O(N²) DFT computed entirely on the CPU in f64. It is un-normalized with the forward sign convention e^{−2πi kn/N}. Its bit-for-bit f64 behaviour is a contract — idft round- trips against it to ~1e-9 — so it is deliberately not routed through the f32 GPU forge. Spectral callers that accept f32 precision should call dft_accelerated instead, which uses the WGSL forge when available.