ifft2

Function ifft2 

Source
pub fn ifft2<T>(
    input: &Array2<T>,
    shape: Option<(usize, usize)>,
    axes: Option<(i32, i32)>,
    norm: Option<&str>,
) -> FFTResult<Array2<Complex64>>
where T: NumCast + Copy + Debug + 'static,
Expand description

Compute the inverse 2-dimensional Fast Fourier Transform

§Arguments

  • input - Input 2D array
  • shape - Shape of the output (optional)
  • axes - Axes along which to compute the inverse FFT (optional)
  • norm - Normalization mode: “backward”, “ortho”, or “forward” (optional)

§Returns

A 2D array of complex values representing the inverse FFT result

§Examples

use scirs2_fft::{fft2, ifft2};
use scirs2_core::ndarray::{array, Array2};

// Create a simple 2x2 array
let input = array![[1.0, 2.0], [3.0, 4.0]];

// Compute the 2D FFT
let spectrum = fft2(&input, None, None, None).unwrap();

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

// The reconstructed signal should match the original
for i in 0..2 {
    for j in 0..2 {
        assert!((input[[i, j]] - reconstructed[[i, j]].re).abs() < 1e-10);
        assert!(reconstructed[[i, j]].im.abs() < 1e-10);
    }
}