Skip to main content

Fft

Struct Fft 

Source
pub struct Fft { /* private fields */ }
Expand description

A one-dimensional complex FFT of any length that picks the best algorithm for the size:

  • powers of two use BestFft (radix-4 passes, AVX2/FMA kernels where available, cache blocking), which is competitive with the fastest Rust FFT libraries;
  • every other length uses BluesteinFft, which costs a few power-of-two FFTs of roughly twice the length but is still O(n log n).
use lib_jsl_ffts::{Fft, FftDirection, FftEngine1D, FftOrdering, FftScaleFactor};
use num_complex::Complex;

let mut fft = Fft::new();
fft.plan(6, FftScaleFactor::None, FftDirection::Forward, FftOrdering::Standard).unwrap();
let spectrum = fft.execute(&[Complex::new(1.0, 0.0); 6]).unwrap();
assert!((spectrum[0].re - 6.0).abs() < 1e-12); // a constant signal is all DC

FftOrdering::BitReversed input is only available for power-of-two sizes.

Implementations§

Source§

impl Fft

Source

pub fn new() -> Self

Source

pub fn with_plan( size: usize, scale: FftScaleFactor, direction: FftDirection, ordering: FftOrdering, ) -> Result<Self, ErrorsJSL>

Creates and plans an engine in one step.

Trait Implementations§

Source§

impl Debug for Fft

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Fft

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl FftEngine1D for Fft

Source§

fn execute( &mut self, input: &[Complex<f64>], ) -> Result<Vec<Complex<f64>>, ErrorsJSL>

Source§

fn plan( &mut self, size: usize, scale: FftScaleFactor, direction: FftDirection, ordering: FftOrdering, ) -> Result<(), ErrorsJSL>

Source§

fn get_size(&self) -> usize

Source§

fn get_scale_factor(&self) -> FftScaleFactor

Source§

fn get_direction(&self) -> FftDirection

Source§

fn get_ordering(&self) -> FftOrdering

Auto Trait Implementations§

§

impl Freeze for Fft

§

impl RefUnwindSafe for Fft

§

impl Send for Fft

§

impl Sync for Fft

§

impl Unpin for Fft

§

impl UnsafeUnpin for Fft

§

impl UnwindSafe for Fft

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.