ifft

Function ifft 

Source
pub fn ifft<T>(input: &[T], n: Option<usize>) -> FFTResult<Vec<Complex64>>
where T: NumCast + Copy + Debug + 'static,
Expand description

Compute the inverse 1-dimensional Fast Fourier Transform

§Arguments

  • input - Input data array
  • n - Length of the output (optional)

§Returns

A vector of complex values representing the inverse FFT result

§Examples

use scirs2_fft::{fft, ifft};
use scirs2_core::numeric::Complex64;

// Generate a simple signal
let signal = vec![1.0, 2.0, 3.0, 4.0];

// Compute the FFT
let spectrum = fft(&signal, None).unwrap();

// Compute the inverse FFT
let reconstructed = ifft(&spectrum, None).unwrap();

// The reconstructed signal should match the original
for (i, val) in signal.iter().enumerate() {
    assert!((*val - reconstructed[i].re).abs() < 1e-10);
    assert!(reconstructed[i].im.abs() < 1e-10);
}