Expand description
Rufft is a pure rust signal processing library which implements fast fourier transform
algorithms. The primary aims of the library are to be compatible with most collection
types, be generic over the floating point type in use and be usable in no_std environments.
§Usage
Rufft provides the trait rufft::traits::Fft which is blanket implemented on types which implement
the rufft::traits::Iterable trait over floating point types i.e. implement the num_traits::Float type.
The Fft trait provides an fft method which returns a collection of the fft results. The compiler
requires some type information to determine the output type e.g. Vec<f64> is not the same type
as Vec<Complex<f64>>. The output type must also implement the Iterable trait but over
Complex<F: num_traits::Float> values.
// Perform an fft on a Vec of floats
use rufft::{Complex, traits::Fft};
let arr = vec![1.0, 2.0, 3.0, 4.0, 5.0];
let _: Vec<Complex<f64>> = arr.fft();Rufft also exposes individual FFT algorithms in the fft module. Currently at the time
of writing only the basic discrete fourier transfrom, dft, the cooley-tukey fft
algorithm fft::ct::fft and the chirp-z fft fft::czt::fft. The inverse transform is
currently unsupported for the Chirp-Z transform. I am still learning about fast fourier
transform algorithms and will add more as time goes on. Any contributions there would be
appreciated.
// Computes the fft using the chirp-z transform
use rufft::{Complex, fft::czt};
let arr = vec![1.0, 2.0, 3.0, 4.0, 5.0];
let _: Vec<Complex<f64>> = czt::fft(&arr);§Feature Flags
-
std(Enabled by default)Links with rust’s std crate, enables
stdfeature in dependecies and provides aIterableimplementation for Vec. Vec technically is from thealloccrate and re-exported instdbut this will do for now -
ndarrayRe-exports the ndarray scientific computing crate and provides an
Iterabletrait implementation for thendarray::Array1type
Re-exports§
pub use num_complex;pub use num_traits;pub use ndarray;
Modules§
- fft
- The
fftmodule itself contains some basic functions ;oledft, andidftfunctions. Other fast fourier transform algorithms are exported through crates like, - itertools
- Signal processing functions which operate on
Iterableimplemenentors. Nameditertoolsafter theitertoolcrate - traits
- waveforms
Structs§
- Complex
- A complex number in Cartesian form.
Traits§
- Float
- Generic trait for floating point numbers
- Float
Const