Skip to content

Commit d4c8b6a

Browse files
authored
ambiguities in getindex with BlockRange (#191)
* ambiguities in getindex with BlockRange * Update test_blockarrayinterface.jl
1 parent 2b9ccd0 commit d4c8b6a

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "BlockArrays"
22
uuid = "8e7c35d0-a365-5155-bbbb-fb81a777f24e"
3-
version = "0.16.6"
3+
version = "0.16.7"
44

55
[deps]
66
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"

src/abstractblockarray.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,9 @@ end
180180
@inline Base.getindex(A::AbstractMatrix, kr::AbstractVector, jr::Block) = ArrayLayouts.layout_getindex(A, kr, jr)
181181
@inline Base.getindex(A::AbstractMatrix, kr::BlockRange{1}, jr::BlockRange{1}) = ArrayLayouts.layout_getindex(A, kr, jr)
182182
@inline Base.getindex(A::LayoutMatrix, kr::BlockRange{1}, jr::BlockRange{1}) = ArrayLayouts.layout_getindex(A, kr, jr)
183-
@inline Base.getindex(A::AbstractTriangular{<:Any,<:LayoutMatrix}, kr::BlockRange{1}, jr::BlockRange{1}) = ArrayLayouts.layout_getindex(A, kr, jr)
183+
for Typ in (:AbstractTriangular, :Adjoint, :Transpose)
184+
@eval @inline Base.getindex(A::$Typ{<:Any,<:LayoutMatrix}, kr::BlockRange{1}, jr::BlockRange{1}) = ArrayLayouts.layout_getindex(A, kr, jr)
185+
end
184186

185187
###
186188
# permutedims

test/test_blockarrayinterface.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,12 @@ end
9595

9696
@test BlockArray(A') == A'
9797
@test BlockArray(transpose(A)) == transpose(A)
98+
99+
@test A'[Block.(1:2),Block.(1:3)] == A[Block.(1:3),Block.(1:2)]'
100+
@test transpose(A)[Block.(1:2),Block.(1:3)] == transpose(A[Block.(1:3),Block.(1:2)])
101+
102+
@test A'[Block.(1:2),Block(1)] == A[Block(1),Block.(1:2)]'
103+
@test A'[Block.(1),Block.(1:3)] == A[Block.(1:3),Block.(1)]'
98104
end
99105

100106
@testset "Diagonal BlockArray" begin

0 commit comments

Comments
 (0)