-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
slicedim
inconsistency for BitVector
vs. other AbstractVector
s
#20233
Comments
I suspect the 0-dimensional array is the more consistent choice. As you pointed out, if |
Well, for the slicedim(x, d, i) =
if d <= N
getindex(x, indices(x,1), ..., indices(x,d-1), i, indices(x,d+1), ..., indices(x,N))
else
getindex(x, indices(x,1), ..., indices(x,N), 1, ..., 1, i)
end where Edit: Actually, the If we special-case |
The docstring says "Equivalent to |
Hmm, that is interesting. I may be biased by the old meaning of |
I'd say returning an array is more consistent and would avoid type stability issues. If that were the decision to follow then the docs would also have to be modified. |
I think the docs just haven't been updated to the APL indexing changes. |
@pabloferz It would not avoid type stability issues to return a (suitable subtype of) @andreasnoack But the APL indexing changes did not change the behavior when indexing a 1d array with an integer, did they? That always returned a single element, not wrapped in an array of any kind, or am I missing something? But speaking of the APL indexing changes, would it make sense to do something like the opposite here and always return an array of the same dimensionality as was passed in? I.e. for the getindex(x, indices(x,1), ..., indices(x,d-1), i:i, indices(x,d+1), ..., indices(x,N)) Seems a bit backwards, but doesn't make it necessarily wrong. |
slicedim
inconsistency for BitArray
vs. other AbstractArray
sslicedim
inconsistency for BitVector
vs. other AbstractVector
s
There are cases for and against but even though it could be considered inconsistent with APL indexing, we are preserving the dimensions in |
I don't think I've ever actually used |
Change here would be breaking, so unless the decision to live with the present inconsistency, should be done by 1.0. |
This is worth changing. Right now BitVectors aren't obeying the docs which says that |
For consistency with
getindex
, the latter should probably just giveBool
, or else the former should giveArray{Float64,0}
. Found by working on #20154, which would fix this by making the latter giveBool
.The text was updated successfully, but these errors were encountered: