rfft_simd

Function rfft_simd 

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

Compute the 1-dimensional discrete Fourier Transform for real input with SIMD acceleration.

This function is optimized using SIMD instructions for improved performance on modern CPUs. For real-valued inputs, this uses a specialized algorithm that is more efficient than a general complex FFT.

§Arguments

  • input - Input real-valued array
  • n - Length of the transformed axis (optional)
  • norm - Normalization mode (optional)

§Returns

  • The Fourier transform of the real input array

§Examples

use scirs2_fft::simd_rfft::{rfft_simd};
use scirs2_fft::simd_fft::NormMode;

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

// Compute RFFT of the signal with SIMD acceleration
let spectrum = rfft_simd(&signal, None, None).unwrap();

// RFFT produces n//2 + 1 complex values
assert_eq!(spectrum.len(), signal.len() / 2 + 1);