fft2d icon indicating copy to clipboard operation
fft2d copied to clipboard

F32 support

Open martinber opened this issue 2 years ago • 0 comments

This my try for #4.

The first commit implements it only for the FFT in the slice module which is the only case I'm interested to use, but I also tried to do it for the entire library in the second commit.

Regarding the first commit:

  • I had to add the Default trait because it was used in some functions. An alternative I think is to replace every T::default() with a T::zero() since FftNum implements the Zero trait
  • I added a quick test to see if at least is compiles for f32 and f64

Regarding the second commit:

  • Apparently for ndarray module we also need the Clone trait, unless we change a bit the code
  • Something similar happens in the slice::dct where we need Copy, but I guess it is fixable

Anyway, I leave up to you to think if adding all of these parametrizations make sense. I wonder if this change will make problems for users since we are changing the API. Maybe we can modify things a bit so we do not need the Default, Copy and Clone traits, leaving only the FftNum and DctNum traits as required

In any case, I'm just evaluating Rust for some application and needed f32 2D FFTs support, if there is no interest in this I guess I will make a small fork that only includes the 5 functions of the slice module

Thank you in any case!

martinber avatar May 18 '23 15:05 martinber