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 DCFftOrdering::BitReversed input is only available for power-of-two sizes.
Implementations§
Source§impl Fft
impl Fft
pub fn new() -> Self
Sourcepub fn with_plan(
size: usize,
scale: FftScaleFactor,
direction: FftDirection,
ordering: FftOrdering,
) -> Result<Self, ErrorsJSL>
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 FftEngine1D for Fft
impl FftEngine1D for Fft
fn execute( &mut self, input: &[Complex<f64>], ) -> Result<Vec<Complex<f64>>, ErrorsJSL>
fn plan( &mut self, size: usize, scale: FftScaleFactor, direction: FftDirection, ordering: FftOrdering, ) -> Result<(), ErrorsJSL>
fn get_size(&self) -> usize
fn get_scale_factor(&self) -> FftScaleFactor
fn get_direction(&self) -> FftDirection
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more