You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For a zero-dimensional array a we usually expect a[] == a[1]. However this does not work with zero-D views of OffsetVectors
julia> a =OffsetArray(1:3, 0:2);
julia> b =@view a[0]
0-dimensional view(OffsetArray(::UnitRange{Int64}, 0:2), 0) with eltype Int64:1
julia> b[]
1
julia> b[1]
2
This happens because for FastContiguousSubArrays, the indexing produces b[1] -> a[1]. Perhaps the offset calculation for the view needs to be different for OffsetVectors?
fixes the issue in this particular case, however I'm not sure if this holds in general. I wonder if this is the correct resolution? In that case I can consider a PR.
The text was updated successfully, but these errors were encountered:
jishnub
changed the title
LinearIndexing zero-dimensional SubArray of OffsetVectors doesn't work as expected
LinearIndexing for a zero-dimensional view of an OffsetVector doesn't work as expected
Jul 17, 2020
For a zero-dimensional array
a
we usually expecta[] == a[1]
. However this does not work with zero-D views ofOffsetVector
sThis happens because for
FastContiguousSubArray
s, the indexing producesb[1] -> a[1]
. Perhaps the offset calculation for the view needs to be different forOffsetVector
s?It appears adding the method
fixes the issue in this particular case, however I'm not sure if this holds in general. I wonder if this is the correct resolution? In that case I can consider a PR.
The text was updated successfully, but these errors were encountered: