fft2

Function fft2 

Source
pub fn fft2<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 2-dimensional Fast Fourier Transform

§Arguments

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

§Returns

A 2D array of complex values representing the FFT result

§Examples

use scirs2_fft::fft2;
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 result = fft2(&input, None, None, None).unwrap();

// The DC component should be the sum of all elements
assert!((result[[0, 0]].re - 10.0).abs() < 1e-10);