pub fn irfft<T>(x: &[T], n: Option<usize>) -> FFTResult<Vec<f64>>
Expand description
Compute the inverse of the 1-dimensional discrete Fourier Transform for real input.
§Arguments
x
- Input complex-valued array representing the Fourier transform of real datan
- Length of the output array (optional)
§Returns
- The inverse Fourier transform, yielding a real-valued array
§Examples
use scirs2_fft::{rfft, irfft};
use scirs2_core::numeric::Complex64;
// Generate a simple signal
let signal = vec![1.0, 2.0, 3.0, 4.0];
// Compute RFFT of the signal
let spectrum = rfft(&signal, None).unwrap();
// Inverse RFFT should recover the original signal
let recovered = irfft(&spectrum, Some(signal.len())).unwrap();
// Check that the recovered signal matches the original
for (i, &val) in signal.iter().enumerate() {
assert!((val - recovered[i]).abs() < 1e-10);
}