-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Accept non-AbstractArray
s in 2-arg axes
/size
#59512
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
base: master
Are you sure you want to change the base?
Conversation
should
|
Good point, perhaps we may require |
seems fair to me. as long as it is not the other way around (setting |
some overlap with my PR #59465 |
`Int` constructor instead of convert in `size` Co-authored-by: Neven Sajko <[email protected]>
`Int` constructor instead of convert in `axes` Co-authored-by: Neven Sajko <[email protected]>
@nanosoldier |
Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. |
With this change, any type that implements
axes(A)
getsaxes(A, d)
for free, and similarly forsize
. These would make it easier to accept array-like types such asBroadcasted
in functions that require indexing.One caveat is that the default assumption here is that for
d > ndims(A)
, we return a single-element axisOneTo
similar to what we do forAbstractArray
s. This may not always be meaningful for arbitrary types, and indexing with trailing unit indices might not be supported. Such types currently implementaxes(A, d)
for themselves and should continue doing so.