pub fn fft<R: Runtime>(
device: &R::Device,
input: Vec<f32>,
) -> (Vec<f32>, Vec<f32>)
Expand description
Computes the Fast Fourier Transform (FFT) of a vector of f32 input data.
This function initializes the FFT computation on the provided input vector, launching the FFT kernel to perform the transformation. The input data is expected to be in the form of real numbers, which are treated as complex numbers with zero imaginary parts.
§Parameters
device
: A reference to the device on which the FFT computation will be performed.input
: A vector off32
values representing the real parts of the input data.
§Returns
A tuple containing two vectors:
- A vector of
f32
values representing the real parts of the FFT output. - A vector of
f32
values representing the imaginary parts of the FFT output.
§Example
let input = vec![1.0, 0.0, 0.0, 0.0]; // Example input
let (real, imag) = fft::<YourRuntimeType>(device, input);
§Safety
This function uses unsafe operations to interact with the underlying runtime and device. The caller must ensure that the input data is valid and that the device is properly set up for computation.