4 releases (breaking)
| 0.4.0 | Oct 20, 2025 |
|---|---|
| 0.3.0 | Oct 20, 2025 |
| 0.2.0 | Oct 20, 2025 |
| 0.1.0 | Oct 20, 2025 |
#2035 in Math
31KB
741 lines
Fast Fractional Fourier Transform
This is an implementation of the one dimensional discrete fractional fourier transform (DFrFT) in rust.
Previews
A visual preview of results of the discrete fractional fourier transform can be seen here.
References
The implementation is manually translated from the the Matlab code provided by A.Bultheel, H. Martínez-Sulbaran. in their paper Computation of the Fractional Fourier Transform.
They provided two different Matlab implementations frft.m and frft.m.
Both have been translated to rust as frfft1d::strategy::Basic and frfft1d::strategy::Fast respectively.
Usage
use frfft1d::strategy::FastFrft;
use frfft1d::strategy::BasicFrft;
// The Signal to be transformed.
let mut signal = [
Complex::new(1.0, 0.0),
Complex::new(0.0, 0.0),
Complex::new(0.0, 0.0),
Complex::new(0.0, 0.0),
];
// prepare the calculation for the given signal length.
let mut frft = FastFrft::new(signal.len());
// transform the signal inplace
// the seconds parameter is the fractional exponent of the transform.
// 1.0 corresponds to the classic DFT/FFT.
frft.process_scaled(&mut signal, 1.0);
// 2.0 corresponds to applying the DFT/FFT twice.
frft.process_scaled(&mut signal, 2.0);
// 3.0 corresponds to applying the DFT/FFT three times, which is inturn the same as applying the inverse DFT (iDFT)
frft.process_scaled(&mut signal, 3.0);
// 4.0 corresponds to applying the DFT/FFT four times, which does not change the signal at all.
frft.process_scaled(&mut signal, 4.0);
// The fractional fourier transform does also allow non integer exponents.
// 0.5 corresponds to applying the the DFT only "half".
frft.process_scaled(&mut signal, 0.5);
Dependencies
~3.5MB
~62K SLoC