signal::fft::real
On this page
Real-input FFT: an even length n packs x into n / 2 complex points (z_j = x_2j + i x_2j+1), runs one half-length FFT and untangles the even and odd halves with one twiddle per bin; an odd length runs the full complex FFT. About half the work of a complex FFT of n.
Structs
RealPlanSource
pub struct RealPlanA real FFT of one length, reusable: forward gives the n / 2 + 1
non-negative frequency bins, inverse takes them back.
use signal::fft::RealPlan;
use core::array::Vector;
let p = try RealPlan::new(4);
let x: Vector<f64> = [1, 2, 3, 4];
let s = try p.forward(x);
println(s[1]); // -2+2i
let back = try p.inverse(s);
println(back); // [1.0, 2.0, 3.0, 4.0]
Sourcepub fn new(§n: usize) throws (SignalError) -> RealPlan The plan for
nreal samples (at least 1).The number of real samples.
The number of bins
forwardgives:n / 2 + 1.
Sourcepub fn forward_split(§self, x: List<f64>, norm: Norm = Norm::Backward) throws (SignalError) -> (List<f64>, List<f64>) Bins
0..=n/2of the DFT of the realx(len()samples) as split parts.
Sourcepub fn inverse_split(§self, re: List<f64>, im: List<f64>, norm: Norm = Norm::Backward) throws (SignalError) -> List<f64> The
len()real samples whose bins0..=n/2arere/im(bins()of each). The imaginary parts of bin 0, and of binn / 2for evenn, are ignored, as for any real signal.
Sourcepub fn forward(§self, x: Vector<f64>, norm: Norm = Norm::Backward) throws (SignalError) -> Vector<Complex<f64>> Bins
0..=n/2of the DFT ofx.
Sourcepub fn inverse(§self, x: Vector<Complex<f64>>, norm: Norm = Norm::Backward) throws (SignalError) -> Vector<f64> The real signal with bins
x(bins()of them).