Skip to content

dtypes and arrays scalars #12

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

Merged
merged 21 commits into from
Jan 13, 2023
Merged

dtypes and arrays scalars #12

merged 21 commits into from
Jan 13, 2023

Conversation

ev-br
Copy link
Collaborator

@ev-br ev-br commented Jan 3, 2023

Address gh-9: implement the scalar type and array dtype hierarchy.

Implementation-wise it does a fairly weird thing of overriding __new__ so that e.g.
np.float32(1) constructs a zero-dim tensor, not a np.float32 instance.

See also #5 (comment) and below for a discussion about array scalars.

closes gh-9 when done.

@lezcano
Copy link
Collaborator

lezcano commented Jan 3, 2023

nit. Why don't you submit this as a merge into reductions to get a cleaner diff in the whole PR?

@ev-br
Copy link
Collaborator Author

ev-br commented Jan 4, 2023

Note that the initial review is at gh-13.

This was referenced Jan 4, 2023
ev-br added 11 commits January 5, 2023 16:38
Try to duck-type NumPy, only without array scalars, so that

* dtype('float32').type --> np.float32

and

* np.float32(3) --> array(3.0, dtype='float32)

IOW, the attempt is to only have zero-dim arrays (we have them anyway)
and have them everywhere where NumPy creates a scalar.
Try to duck-type NumPy, only without array scalars, so that

* dtype('float32').type --> np.float32

and

* np.float32(3) --> array(3.0, dtype='float32)

IOW, the attempt is to only have zero-dim arrays (we have them anyway)
and have them everywhere where NumPy creates a scalar.
So that current tests pass. This involves fixing a slew of small
issues all around but hey.
This is a stub, will need to decide and clearly articulate what exactly is a scalar.
@ev-br
Copy link
Collaborator Author

ev-br commented Jan 6, 2023

OK, this works up to test_scalarmath.
Fixing that one involves implementing a decent subset of ufuncs, so I'm going to take it to a separate branch.

@ev-br ev-br mentioned this pull request Jan 6, 2023
@ev-br ev-br changed the title WIP: dtypes and arrays scalars dtypes and arrays scalars Jan 6, 2023
@ev-br
Copy link
Collaborator Author

ev-br commented Jan 13, 2023

Ok, thanks for the reviews and discussions, let's merge this and iterate.

@ev-br ev-br merged commit bc75eb2 into main Jan 13, 2023
@ev-br ev-br deleted the dtypes2 branch January 13, 2023 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dtypes
2 participants