rfft

Function rfft 

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

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

§Arguments

  • x - Input real-valued array
  • n - Length of the transformed axis (optional)

§Returns

  • The Fourier transform of the real input array

§Examples

use scirs2_fft::rfft;
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();

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