-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
AllIndices
type for identity indexing
#24069
Comments
How is this different from |
julia> A = rand(2,2)
2×2 Array{Float64,2}:
0.138581 0.120538
0.528131 0.11805
julia> A[:]
4-element Array{Float64,1}:
0.138581
0.528131
0.120538
0.11805 |
This could be solved with #5405 as a base case (just the ellipsis). |
Now this is a duplicate of #5405. A single ellipsis represents this operation well, and it's now in EllipsisNotation.jl as |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
With the proposal for #22858, I've been thinking it could be useful to have a type which commonly represents "AllIndices". So
A[AllIndices()]
would returnA
, making it the identity indexing element in some sense.The reason is so that this could handle non-standard indexing. In some algorithms you might want the user to specify some indices that they "want to save", and you can default to
AllIndices
. In many of these cases, you haven't built the array yet and may be getting a non-standard type from the user, so defaulting toeachindex
or something like that isn't possible. Currently a way to handle this is to default the chosen indices tonothing
, and if you seenothing
you treat it asAllIndices
applied to the type by iteratingeachindex
after the array is built.The name could change of course.
The text was updated successfully, but these errors were encountered: