Skip to content

Commit fac28cb

Browse files
authored
Merge pull request #50 from mcabbott/linear
Fix linear indexing
2 parents 77cca56 + 62fd77f commit fac28cb

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/struct.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,10 @@ for (get_or_view, key_get, maybe_copy) in [
8787
KeyedArray(data, new_keys)
8888
end
8989

90-
# drop all, for A[:] and A[A .> 0] with ndims>=2
90+
# drop all, for A[:] or A[A .> 0] or A[1:2], with ndims>=2
9191
@inline $key_get(keys::Tuple{Any, Any, Vararg{Any}}, inds::Tuple{Base.LogicalIndex}) = ()
9292
@inline $key_get(keys::Tuple{Any, Any, Vararg{Any}}, inds::Tuple{Base.Slice}) = ()
93+
@inline $key_get(keys::Tuple{Any, Any, Vararg{Any}}, inds::Tuple{AbstractVector{<:Integer}}) = ()
9394

9495
# drop one, for integer index
9596
@inline $key_get(keys::Tuple, inds::Tuple{Integer, Vararg{Any}}) =

test/_basic.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ using Test, AxisKeys
2222
@test (R[2,:] .= 1:4) isa SubArray # dotview
2323
@test R[2,:] == KeyedArray(1:4, (10:10:40,))
2424

25-
@test R[:] == vec(R.data)
25+
@test R[1:end] == R[:] == vec(R.data)
26+
@test R[1:end] isa Vector # issue #48
2627
@test R[1:2, 1, 1] == R.data[1:2, 1, 1]
2728
@test axiskeys(R[:, [0.9,0.1,0.9,0.1] .> 0.5],2) == [10,30]
2829
@test ndims(R[R .> 0.5]) == 1

0 commit comments

Comments
 (0)