ndrustfft

ndrustfft: n-dimensional complex-to-complex FFT, real-to-complex FFT and real-to-real DCT

This library is a wrapper for RustFFT, RustDCT and RealFft that enables performing FFTs and DCTs of complex- and real-valued data on n-dimensional arrays (ndarray).

ndrustfft provides Handler structs for FFT's and DCTs, which must be provided alongside with the arrays to the respective functions (see below) . The Handlers implement a process function, which is a wrapper around Rustfft's process. Transforms along the outermost axis are in general the fastest, while transforms along other axis' will temporarily create copies of the input array.

Parallel

The library ships all functions with a parallel version which leverages the parallel iterators of the ndarray crate.

Available transforms

Complex-to-complex

Example

2-Dimensional real-to-complex fft along first axis ```rust use ndarray::{Array2, Dim, Ix}; use ndrustfft::{ndfft_r2c, Complex, R2cFftHandler};

let (nx, ny) = (6, 4); let mut data = Array2::::zeros((nx, ny)); let mut vhat = Array2::>::zeros((nx / 2 + 1, ny)); for (i, v) in data.itermut().enumerate() { *v = i as f64; } let mut ffthandler = R2cFftHandler::::new(nx); ndfftr2c( &data.view(), &mut vhat.viewmut(), &mut fft_handler, 0, ); ```

Versions

The first and last elements of real-to-complex transforms are per definition purely real. This is now enforced actively, by setting the complex part to zero - similar to numpys rfft.

License: MIT