Skip to content

Should there be a integral and floating ABCs? #581

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
NeilGirdhar opened this issue Dec 23, 2022 · 3 comments
Closed

Should there be a integral and floating ABCs? #581

NeilGirdhar opened this issue Dec 23, 2022 · 3 comments
Labels
Question General question.

Comments

@NeilGirdhar
Copy link

That is, should np.integral, np.floating, and np.complexfloating base classes be available in the Array API? This would allow other packages to create their own subtypes. Jax for example has additional floating dtypes.

@rgommers
Copy link
Member

Hi @NeilGirdhar, thanks for asking. Whether dtypes should have a class hierarchy and how to check whether a dtype is of a certain kind was pretty extensively discussed in:

tl;dr not many libraries have a class hierarchy like numpy does, and it doesn't seem either necessary or a good idea to impose one in the standard

This would allow other packages to create their own subtypes. Jax for example has additional floating dtypes.

There should be no issue with JAX including additional dtypes in what isdtype does. Or have them work with dtype= keywords. Do you see a concrete problem with the current design?

@rgommers rgommers added the Question General question. label Dec 23, 2022
@NeilGirdhar
Copy link
Author

Thanks for the links. I've read over the discussion now.

There should be no issue with JAX including additional dtypes in what isdtype does. Or have them work with dtype= keywords. Do you see a concrete problem with the current design?

How are you supposed to do type annotations with the current design? How are type checkers supposed to verify that an array has a floating dtype for example? For example, https://github.com/NeilGirdhar/tjax/blob/main/tjax/_src/annotations.py#L24

@NeilGirdhar
Copy link
Author

I'm going to comment in that thread.

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

No branches or pull requests

2 participants