Skip to content
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

ENH: Add array API standard v2022.12 support to numpy.array_api #23881

Merged
merged 15 commits into from
Jun 14, 2023

Conversation

asmeurer
Copy link
Member

@asmeurer asmeurer commented Jun 5, 2023

Fixes #23880

Updates from the v2022.12 version of the spec:

- Add __complex__.
- __float__, __int__, and __bool__ are now more lenient in what dtypes they
  can operate on.
- Support complex scalars and dtypes in all operators (except those that
  should not operate on complex numbers).
- Disallow integer scalars that are out of the bounds of the array dtype.
- Update the tests accordingly.
This is a new function in the v2022.12 version of the array API standard which
is used for determining if a given dtype is part of a set of given dtype
categories. This will also eventually be added to the main NumPy namespace,
but for now only exists in numpy.array_api as a purely strict version.
@asmeurer
Copy link
Member Author

asmeurer commented Jun 6, 2023

OK, not sure what happened with the draft status, but this is ready to review.

It would also be nice to include #23789 in the 1.25 release as well.

@asmeurer
Copy link
Member Author

asmeurer commented Jun 6, 2023

Actually, let me see how hard it is to add the fft extension here.

@asmeurer
Copy link
Member Author

asmeurer commented Jun 6, 2023

Actually, let me see how hard it is to add the fft extension here.

The reason I'm hesitant is that we currently don't have any coverage of the fft extension in the array API test suite. As far as I know the standard fft API is identical to np.fft, but I'm not 100% sure about that.

I guess the biggest question is whether this is something that SciPy (or others?) will need soon for their own adding of array API support. @rgommers @tupui @tylerjereddy do you have any thoughts on how important it will be for SciPy's array API work for numpy.array_api.fft to be implemented (note that ffts already work the compat library because it's just np.fft)? Specifically whether it should be prioritized for NumPy 1.25 (to be released later this month).

If it's not critical, I would suggest omitting it for now, and adding it later this year when we have full fft support in the test suite. But if it is indeed something that will be important for SciPy, I can add basic wrappers, with minimal testing.

At any rate, everything else here is ready for review.

@asmeurer
Copy link
Member Author

asmeurer commented Jun 6, 2023

Based on #23880 (comment) I'm not going to implement fft stuff here.

Co-authored-by: Bas van Beek <43369155+BvB93@users.noreply.github.com>
@mattip
Copy link
Member

mattip commented Jun 14, 2023

Thanks @asmeurer for updating this.

@mattip mattip merged commit c178bac into numpy:main Jun 14, 2023
55 of 58 checks passed
@asmeurer
Copy link
Member Author

Thank you Matti. If you or someone could merge #23789 too that would be great. I've already reviewed it and it's ready to go as far as I'm concerned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ENH: Add 2022.12 support to numpy.array_api
4 participants