#![deny(missing_docs)]
#![deny(clippy::undocumented_unsafe_blocks)]
#![doc = include_str!("../README.md")]
#![cfg_attr(feature = "const-realfft", allow(incomplete_features))]
#![cfg_attr(feature = "const-realfft", feature(generic_const_exprs))]
#![warn(clippy::pedantic)]
#![allow(clippy::cast_precision_loss)]
#![allow(clippy::range_plus_one)]
use realfft::ComplexToReal;
use realfft::RealFftPlanner;
use realfft::RealToComplex;
use rustfft::FftPlanner;
use std::sync::Arc;
pub use rustfft::num_complex;
pub use rustfft::FftNum;
pub mod const_size;
pub mod dyn_size;
pub mod prelude {
#[cfg(feature = "const-realfft")]
pub use crate::const_size::realfft::RealDft;
#[cfg(feature = "const-realfft")]
pub use crate::const_size::realfft::RealFft;
#[cfg(feature = "const-realfft")]
pub use crate::const_size::realfft::RealIfft;
pub use crate::const_size::Fft;
pub use crate::const_size::FftMut;
pub use crate::const_size::Ifft;
pub use crate::const_size::IfftMut;
pub use crate::dyn_size::realfft::DynRealDft;
pub use crate::dyn_size::realfft::DynRealFft;
pub use crate::dyn_size::realfft::DynRealIfft;
pub use crate::dyn_size::DynFft;
pub use crate::dyn_size::DynFftMut;
pub use crate::dyn_size::DynIfft;
pub use crate::dyn_size::DynIfftMut;
}
fn with_fft_planner<T: FftNum>(with: impl FnMut(&mut FftPlanner<T>)) {
generic_singleton::get_or_init_thread_local!(|| FftPlanner::new(), with);
}
fn with_fft_algorithm<T: FftNum>(size: usize, mut with: impl FnMut(Arc<dyn rustfft::Fft<T>>)) {
with_fft_planner(|planner: &mut FftPlanner<T>| with(planner.plan_fft_forward(size)));
}
fn with_inverse_fft_algorithm<T: FftNum>(
size: usize,
mut with: impl FnMut(Arc<dyn rustfft::Fft<T>>),
) {
let with = |planner: &mut FftPlanner<T>| with(planner.plan_fft_inverse(size));
with_fft_planner(with);
}
fn with_real_fft_algorithm<T: FftNum>(
size: usize,
mut with: impl FnMut(Arc<dyn RealToComplex<T>>),
) {
let with = |planner: &mut RealFftPlanner<T>| with(planner.plan_fft_forward(size));
generic_singleton::get_or_init_thread_local!(|| RealFftPlanner::new(), with);
}
fn with_inverse_real_fft_algorithm<T: FftNum>(
size: usize,
mut with: impl FnMut(Arc<dyn ComplexToReal<T>>),
) {
let with = |planner: &mut RealFftPlanner<T>| with(planner.plan_fft_inverse(size));
generic_singleton::get_or_init_thread_local!(|| RealFftPlanner::new(), with);
}