mkl_fft icon indicating copy to clipboard operation
mkl_fft copied to clipboard

top-level documentation for inverse real needs clarification

Open mdarnold1 opened this issue 5 years ago • 3 comments

The top-level documentation does not make it clear that the inverse real transforms are real to complex (not complex to real as some users will expect).

Also, this functionality is very much less useful than complex to real, which is something to consider for future work. I know that this is available through the numpy interface, but numpy lacks the overwrite flag.

mdarnold1 avatar May 29 '20 03:05 mdarnold1

Were you looking for mkl_fft.rfft_numpy and mkl_fft.irfft_numpy?

In [8]: mkl_fft.rfft_numpy(np.arange(-4, 4, dtype='d'))
Out[8]:
array([-4.+0.j        , -4.+9.65685425j, -4.+4.j        , -4.+1.65685425j,
       -4.+0.j        ])

In [9]: mkl_fft.irfft_numpy(_)
Out[9]: array([-4., -3., -2., -1.,  0.,  1.,  2.,  3.])

I must point out that they also do not support overwrite_x keyword, because the transform may require one element more that the input array:

In [10]: mkl_fft.rfftn_numpy(np.arange(-4,4, dtype='d')).nbytes                                                                                         
Out[10]: 80

In [11]: np.arange(-4,4, dtype='d').nbytes                                                                                                              
Out[11]: 64  

oleksandr-pavlyk avatar Jun 05 '20 14:06 oleksandr-pavlyk

Yes I'm aware of the numpy versions. On closer inspection of mkl_fft.rfft & mkl_fft.irfft, I see that they are inverses (my mistake), but I still think the top level documentation should explain the data format for both of these.

mdarnold1 avatar Jun 12 '20 00:06 mdarnold1

With respect to overwrite, yes I understand that the input has to be padded which does present some difficult choices for the interface, but it would be nice to have this capability.

mdarnold1 avatar Jun 12 '20 00:06 mdarnold1