| Crates.io | frfft1d |
| lib.rs | frfft1d |
| version | 0.4.0 |
| created_at | 2025-10-20 18:02:11.143733+00 |
| updated_at | 2025-10-20 18:46:39.574056+00 |
| description | This is an implementation of the one dimensional discrete fractional fourier transform. |
| homepage | |
| repository | https://github.com/laszlokorte/rust-frfft1d |
| max_upload_size | |
| id | 1892436 |
| size | 33,138 |
This is an implementation of the one dimensional discrete fractional fourier transform (DFrFT) in rust.
A visual preview of results of the discrete fractional fourier transform can be seen here.
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.
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);