Skip to main content

Module convolution_fft

Module convolution_fft 

Source
Expand description

FFT-based 1D linear convolution for OxiGDAL GPU.

Implements linear convolution via the FFT theorem:

Y = IFFT(FFT(signal) * FFT(kernel))

where * is pointwise complex multiplication. This is equivalent to direct convolution for finite-length sequences, and is efficient when both sequences are padded to the same power-of-two length.

§Limitation

The underlying Fft1d kernel supports sizes up to 2048. For inputs where (signal.len() + kernel.len() - 1).next_power_of_two() > 2048 this module returns GpuError::InvalidKernelParams. Long signals require an Overlap-Save or Overlap-Add segmentation strategy (not implemented here).

§Sign convention

Forward FFT: twiddle angle = -2π·k/N (no normalisation). Inverse FFT: twiddle angle = +2π·k/N, result divided by N.

§Thread safety

FftConvolution holds an Arc<GpuContext> and is Send + Sync.

Structs§

FftConvolution
GPU-accelerated FFT-based 1D linear convolution.

Constants§

MAX_FFT_CONVOLUTION_SIZE
Maximum single-pass FFT size supported by FftConvolution.

Functions§

complex_multiply
Pointwise complex multiplication: (ar + i·ai) × (br + i·bi).
convolve_reference
Pure-Rust reference linear convolution (direct O(N·M) algorithm).