packages

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 RealPlan

A real FFT of one length, reusable: forward gives the n / 2 + 1 non-negative frequency bins, inverse takes them back.

nabi
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]
  • pub fn new(n: usize) throws (SignalError) -> RealPlan§

    Source

    The plan for n real samples (at least 1).

  • pub fn len(self) -> usize§

    Source

    The number of real samples.

  • pub fn bins(self) -> usize§

    Source

    The number of bins forward gives: n / 2 + 1.

  • pub fn forward_split(self, x: List<f64>, norm: Norm = Norm::Backward) throws (SignalError) -> (List<f64>, List<f64>)§

    Source

    Bins 0..=n/2 of the DFT of the real x (len() samples) as split parts.

  • pub fn inverse_split(self, re: List<f64>, im: List<f64>, norm: Norm = Norm::Backward) throws (SignalError) -> List<f64>§

    Source

    The len() real samples whose bins 0..=n/2 are re / im (bins() of each). The imaginary parts of bin 0, and of bin n / 2 for even n, are ignored, as for any real signal.

  • pub fn forward(self, x: Vector<f64>, norm: Norm = Norm::Backward) throws (SignalError) -> Vector<Complex<f64>>§

    Source

    Bins 0..=n/2 of the DFT of x.

  • pub fn inverse(self, x: Vector<Complex<f64>>, norm: Norm = Norm::Backward) throws (SignalError) -> Vector<f64>§

    Source

    The real signal with bins x (bins() of them).