array-api icon indicating copy to clipboard operation
array-api copied to clipboard

Add FFT extension to the spec

Open steff456 opened this issue 4 years ago • 9 comments

This PR focuses on adding the FFT as an extension to the array spec.

The current APIs added in this PR are:

  • [x] Standard FFT: fft, ifft, fftn, ifftn
  • [x] Real FFT: rfft, irfft, rfftn, irfftn
  • [x] Hermitian FFT: hfft, ihfft
  • [x] Helper Routines: fftfreq, rfftfreq, fftshift, ifftshift
  • [x] Update to rst and create function stubs

They follow the summary available at #159

steff456 avatar Jun 04 '21 05:06 steff456

@leofang I already made the changes, please let me know if there's something else we can improve here :)

steff456 avatar Jul 19 '21 14:07 steff456

Are we ready to merge this now, or is there more to do? The complex number support is available now.

rgommers avatar Jul 23 '22 17:07 rgommers

@rgommers I'll do a final pass through. Everything should be more or less complete. I can merge after.

kgryte avatar Jul 24 '22 22:07 kgryte

@kgryte let me know if I need to do any changes regarding the types of the docs, @rgommers I will also review to see if there's something that needs to be tweaked for this PR

steff456 avatar Jul 25 '22 15:07 steff456

I already made,

  • A general revision round
  • Merged with master to have the latest changes including the rename of the main folder
  • Addressed the last comment that depended on the complex number support

Let me know if there's something else that I need to fix but I think this is almost ready 🎉

steff456 avatar Jul 28 '22 22:07 steff456

I already did the changes with your last review, so just for recap this is the state of inputs/outputs for each function:

Name Input Output
fft real & complex floating-point complex floating-point
ifft real & complex floating-point complex floating-point
fftn real & complex floating-point complex floating-point
ifftn real & complex floating-point complex floating-point
rfft real floating-point complex floating-point
irfft complex floating-point real floating-point
rfftn real floating-point complex floating-point
irfftn complex floating-point real floating-point
hfft real floating-point real floating-point
ihfft real floating-point real floating-point

Let me know if there's something wrong in this table :)!

steff456 avatar Aug 01 '22 20:08 steff456

I'll try to take another look before Thursday, sorry a bit swamped...

leofang avatar Aug 01 '22 20:08 leofang

@steff456 The table looks correct. Thanks for putting that together.

kgryte avatar Aug 22 '22 17:08 kgryte

Another note: As discussed in a prior meeting it is preferable to add a note that the output dtype will be consistent with the input dtype (ex: we don't always promote to complex128 as NumPy currently does even if the input is in single precision), but I think if we word it correctly when addressing #478 this need should be automatically resolved.

leofang avatar Sep 11 '22 03:09 leofang

Hi @steff456 Do you have local changes that you have not pushed? If not, may I edit in your branch directly?

leofang avatar Oct 05 '22 17:10 leofang

Hi @leofang, go ahead and make changes! Thanks a lot 😬

steff456 avatar Oct 05 '22 17:10 steff456

@kgryte @rgommers @peterbell10 @toslunar @steff456 @oleksandr-pavlyk This should be ready now. Any chance any of you can take a look? Otherwise, I'll self-merge before the next Array API meeting (Oct 20).

leofang avatar Oct 15 '22 20:10 leofang

Thanks @leofang! I had a quick browse, it looks like it is in good shape. I'll defer to @kgryte for a last in-depth look if he wants to.

rgommers avatar Oct 16 '22 09:10 rgommers

Announced in the meeting, let's merge. We can follow up with additional PRs if needed.

leofang avatar Oct 20 '22 17:10 leofang