diff --git a/Project.toml b/Project.toml index 04dca196..a0415692 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "LazyArrays" uuid = "5078a376-72f3-5289-bfd5-ec5146d43c02" -version = "1.8.1" +version = "1.8.2" [deps] ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a" diff --git a/src/lazyconcat.jl b/src/lazyconcat.jl index 1a47af39..e6ef9151 100644 --- a/src/lazyconcat.jl +++ b/src/lazyconcat.jl @@ -806,10 +806,10 @@ end # subarrays ### -sublayout(::ApplyLayout{typeof(vcat)}, _) = ApplyLayout{typeof(vcat)}() -sublayout(::ApplyLayout{typeof(hcat)}, _) = ApplyLayout{typeof(hcat)}() +sublayout(::ApplyLayout{typeof(vcat)}, ::Type{<:Tuple{Vararg{Union{AbstractVector{Int},Int}}}}) = ApplyLayout{typeof(vcat)}() +sublayout(::ApplyLayout{typeof(hcat)}, ::Type{<:Tuple{Vararg{Union{AbstractVector{Int},Int}}}}) = ApplyLayout{typeof(hcat)}() # a row-slice of an Hcat is equivalent to a Vcat -sublayout(::ApplyLayout{typeof(hcat)}, ::Type{<:Tuple{Number,AbstractVector}}) = ApplyLayout{typeof(vcat)}() +sublayout(::ApplyLayout{typeof(hcat)}, ::Type{<:Tuple{Int,AbstractVector{Int}}}) = ApplyLayout{typeof(vcat)}() _vcat_lastinds(sz) = _vcat_cumsum(sz...) _vcat_firstinds(sz) = (1, (1 .+ Base.front(_vcat_lastinds(sz)))...) diff --git a/test/concattests.jl b/test/concattests.jl index 71cb28a5..54363e9d 100644 --- a/test/concattests.jl +++ b/test/concattests.jl @@ -2,7 +2,7 @@ using LazyArrays, FillArrays, LinearAlgebra, ArrayLayouts, Test, Base64 using StaticArrays import LazyArrays: MemoryLayout, DenseColumnMajor, materialize!, call, paddeddata, MulAdd, Applied, ApplyLayout, DefaultApplyStyle, sub_materialize, resizedata!, - CachedVector, ApplyLayout, arguments, BroadcastVector + CachedVector, ApplyLayout, arguments, BroadcastVector, LazyLayout @testset "concat" begin @@ -611,4 +611,12 @@ import LazyArrays: MemoryLayout, DenseColumnMajor, materialize!, call, paddeddat @test v isa AbstractVector{Any} @test stringmime("text/plain", v) == "vcat()" end + + @testset "matrix indexing" begin + a = Vcat(2, Ones(5)) + h = Hcat([2,3], Ones(2,5)) + @test MemoryLayout(view(a, [1 2; 1 2])) isa LazyLayout + @test MemoryLayout(view(h, [1 2; 1 2], 1)) isa LazyLayout + @test h[[1 2; 1 2],:] == Matrix(h)[[1 2; 1 2],:] + end end