Skip to main content

Crate lib_jsl_ffts

Crate lib_jsl_ffts 

Source
Expand description

Fast Fourier transforms.

§Which FFT should I use?

Use Fft. It handles any length, picks the right algorithm for it, and is fast:

use lib_jsl_ffts::{Fft, FftDirection, FftEngine1D, FftOrdering, FftScaleFactor};
use num_complex::Complex;

let mut fft = Fft::new();
fft.plan(1024, FftScaleFactor::None, FftDirection::Forward, FftOrdering::Standard).unwrap();
let spectrum = fft.execute(&vec![Complex::new(0.0, 0.0); 1024]).unwrap();

Plan once and reuse the engine; planning builds the twiddle tables.

§What else is here

ItemUse it when
FftYou want a transform and don’t care how it is computed (default)
best_fft::BestFftYou know the size is a power of two and want that engine directly
bluestein_fft::BluesteinFftYou want the arbitrary-length algorithm directly
simd_fft::SimdFftYou need vectorised kernels on ARM or RISC-V as well as x86
fractional_fft::FractionalFftYou need the fractional Fourier transform
helpersFrequency grids (fftfreq), fast lengths (next_fast_len), N-D real FFTs and N-D DCTs
fft_engine_trait::FftEngine1DYou want to write code generic over FFT engines

Readable textbook implementations (recursive radix-2, iterative radix-2, split radix) live in the separate lib_jsl_ffts_reference crate, so they stay out of the way here.

See the book chapter Fast Fourier transforms.

Re-exports§

pub use fftlog::fht;
pub use fftlog::fhtoffset;
pub use fftlog::hfft;
pub use fftlog::ifht;
pub use fftlog::ihfft;
pub use fftlog::ln_gamma_complex;
pub use best_fft::BestFft;
pub use bluestein_fft::BluesteinFft;
pub use dct::TrigNormalization;
pub use dct::TrigTransformType;
pub use dct::dct;
pub use dct::dst;
pub use dct::idct;
pub use dct::idst;
pub use fft::Fft;
pub use fft_engine_trait::FftDirection;
pub use fft_engine_trait::FftEngine1D;
pub use fft_engine_trait::FftOrdering;
pub use fft_engine_trait::FftScaleFactor;
pub use fractional_fft::FractionalFft;
pub use fractional_fft::frft;
pub use helpers::dctn;
pub use helpers::dstn;
pub use helpers::fftfreq;
pub use helpers::fftshift_1d;
pub use helpers::idctn;
pub use helpers::idstn;
pub use helpers::ifftshift;
pub use helpers::ifftshift_1d;
pub use helpers::irfftn;
pub use helpers::next_fast_len;
pub use helpers::rfftfreq;
pub use helpers::rfftn;
pub use multidimensional_fft::fft2;
pub use multidimensional_fft::fft3;
pub use multidimensional_fft::fft_axis;
pub use multidimensional_fft::fftn;
pub use multidimensional_fft::fftshift;
pub use multidimensional_fft::ifft2;
pub use multidimensional_fft::ifft3;
pub use real_fft::RealFft;
pub use real_fft::irfft;
pub use real_fft::rfft;
pub use simd_fft::SimdFft;

Modules§

best_fft
BestFft: the crate’s high-performance FFT for power-of-two sizes.
bluestein_fft
Bluestein’s algorithm (the chirp-z transform) for FFTs of any length.
dct
Discrete cosine and sine transforms of types I-IV, computed through complex FFTs.
fft
Fft: the default FFT engine. Plan it once, then call FftEngine1D::execute repeatedly.
fft_engine_trait
The interface shared by the one-dimensional FFT engines: plan once for a size, scaling, direction and input ordering, then execute repeatedly.
fftlog
The fast Hankel transform by Hamilton’s FFTLog (SciPy’s fft.fht, fft.ifht and fft.fhtoffset), and FFTs of Hermitian-symmetric signals (fft.hfft, fft.ihfft).
fractional_fft
Fractional Fourier transform (FRFT) utilities.
helpers
Frequency grids, fast transform lengths, N-dimensional real FFTs and N-dimensional DCTs and DSTs, following scipy.fft: fftfreq, rfftfreq, next_fast_len, ifftshift, rfftn/irfftn and dctn/idctn/dstn/idstn.
multidimensional_fft
Multidimensional FFTs: transforms along one axis, or over every axis of a 2D, 3D or N-D array.
real_fft
FFTs of real-valued signals.
simd_fft
A radix-2 Cooley-Tukey FFT for power-of-two sizes with architecture-specific butterfly kernels.