Struct rustfft::FFTplanner
source · pub struct FFTplanner<T> { /* private fields */ }
Expand description
The FFT planner is used to make new FFT algorithm instances.
RustFFT has several FFT algorithms available; For a given FFT size, the FFTplanner decides which of the available FFT algorithms to use and then initializes them.
// Perform a forward FFT of size 1234
use std::sync::Arc;
use rustfft::FFTplanner;
use rustfft::num_complex::Complex;
use rustfft::num_traits::Zero;
let mut input: Vec<Complex<f32>> = vec![Zero::zero(); 1234];
let mut output: Vec<Complex<f32>> = vec![Zero::zero(); 1234];
let mut planner = FFTplanner::new(false);
let fft = planner.plan_fft(1234);
fft.process(&mut input, &mut output);
// The fft instance returned by the planner is stored behind an `Arc`, so it's cheap to clone
let fft_clone = Arc::clone(&fft);
If you plan on creating multiple FFT instances, it is recommnded to reuse the same planner for all of them. This is because the planner re-uses internal data across FFT instances wherever possible, saving memory and reducing setup time. (FFT instances created with one planner will never re-use data and buffers with FFT instances created by a different planner)
Each FFT instance owns Arc
s to its internal data, rather than borrowing it from the planner, so it’s perfectly
safe to drop the planner after creating FFT instances.
Implementations
Auto Trait Implementations
impl<T> !RefUnwindSafe for FFTplanner<T>
impl<T> Send for FFTplanner<T>
impl<T> Sync for FFTplanner<T>
impl<T> Unpin for FFTplanner<T>
impl<T> !UnwindSafe for FFTplanner<T>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more