Skip to content

API: Support float32 in fft? #23522

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
seberg opened this issue Apr 3, 2023 · 7 comments
Closed

API: Support float32 in fft? #23522

seberg opened this issue Apr 3, 2023 · 7 comments
Labels
Project Possible project, may require specific skills and long commitment

Comments

@seberg
Copy link
Member

seberg commented Apr 3, 2023

We currently convert float32 to 64 there! That isn't nice, lets change it?

(Sorry the reason for the brief thing was that I accidentally also opened an issue).

@seberg seberg changed the title Support float32 in fft API: Support float32 in fft? Apr 3, 2023
@mhvk
Copy link
Contributor

mhvk commented Apr 3, 2023

See also #17801

@rkern
Copy link
Member

rkern commented Apr 3, 2023

Now that we allow C++ judiciously, there is a C++ version of PocketFFT that supports float, double and long double. I think that ought to be relatively straightforward to drop in place of our C PocketFFT implementation. If it's as simple as that, I'd say that crosses the threshold for me in favor of adding it to numpy (as opposed to continue to point people to use scipy.fft for a more full-featured implementation).

@seberg
Copy link
Member Author

seberg commented Apr 4, 2023

Yeah, this may have to be a silent API change, which is why I opened this: It may be good to do in a 2.0 release.

Implementing it could be started now, if we are unsure about it just disabling the promotion to double, that could be hidden behind NPY_NUMPY2_BEHAVIOR=1.

(I am not convinced that we absolutely cannot do it in a 1.x release, but I guess it may be an easier decision...)


Just N.B. since long double was mentioned: there is also talk about trying to get away with dropping long-double support. Unfortunately, many platforms have poor long-double support even though it is C99 (and a decent number just use double which is C99 conform of course)...

@mhvk
Copy link
Contributor

mhvk commented Apr 4, 2023

I think it would be fine in a 1.x release, but as you note, either way we could implement it now.

@mreineck
Copy link
Contributor

I would be very happy about this kind of change, since it brings the implementation in sync with scipy. In the long run scipy may even be able to drop its own copy of the C++ sources and call into numpy instead, correct? That could certainly help reduce binary sizes.

@leofang
Copy link
Contributor

leofang commented Apr 14, 2023

FYI CuPy already supports single-precision FFT and it's one of documented deviations from NumPy:
https://docs.cupy.dev/en/stable/reference/fft.html#code-compatibility-features

@rgommers rgommers moved this to 📋 Candidate in NumPy 2.0 Roadmap May 19, 2023
@seberg seberg added the Project Possible project, may require specific skills and long commitment label Oct 25, 2023
@rgommers rgommers moved this from 📋 Candidate to Descoped in NumPy 2.0 Roadmap Dec 18, 2023
@mreineck
Copy link
Contributor

I think this should be implemented now, correct? (#25711)

@seberg seberg closed this as completed Feb 12, 2024
@github-project-automation github-project-automation bot moved this from Descoped to 🏗 In progress in NumPy 2.0 Roadmap Feb 12, 2024
@mattip mattip moved this from 🏗 In progress to ✅ Done in NumPy 2.0 Roadmap Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Project Possible project, may require specific skills and long commitment
Projects
Status: Done
Development

No branches or pull requests

5 participants