mpizenberg / fft2d

Fourier transform for 2D data such as images
Mozilla Public License 2.0
19 stars 5 forks source link

Support for f32 #4

Open martinber opened 1 year ago

martinber commented 1 year ago

Hello, is there any reason why the functions in the slice module are not generic for f32 and f64? I think it is only a matter of allowing any type with the trait rustfft::FftNum. For example changing

pub fn fft_2d(width: usize, height: usize, img_buffer: &mut [Complex<f64>]) {

to

pub fn fft_2d<T: rustfft::FftNum>(width: usize, height: usize, img_buffer: &mut [Complex<T>]) {

Or am I missing something? Thanks!

mpizenberg commented 1 year ago

I don't remember of a specific reason except not spending time trying to figure out the correct generics. So I just specified what I needed at the time. If you want to make a PR, don't hesitate to contribute. It just needs a clear explanation of the PR content as I don't have much time to spend reviewing.