@@ -791,10 +791,16 @@ end
791791# subarrays
792792# ##
793793
794- sublayout (:: ApplyLayout{typeof(vcat)} , :: Type {<: Tuple {Vararg{Union{AbstractRange{Int},Int}}}}) = ApplyLayout {typeof(vcat)} ()
795- sublayout (:: ApplyLayout{typeof(hcat)} , :: Type {<: Tuple {Vararg{Union{AbstractRange{Int},Int}}}}) = ApplyLayout {typeof(hcat)} ()
794+ sublayout (:: ApplyLayout{typeof(vcat)} , :: Type{<:Tuple{AbstractRange{Int}}} ) = ApplyLayout {typeof(vcat)} ()
795+ sublayout (:: ApplyLayout{typeof(vcat)} , :: Type{<:Tuple{AbstractRange{Int},Int}} ) = ApplyLayout {typeof(vcat)} ()
796+ sublayout (:: ApplyLayout{typeof(vcat)} , :: Type{<:Tuple{AbstractRange{Int},AbstractRange{Int}}} ) = ApplyLayout {typeof(vcat)} ()
797+ sublayout (:: ApplyLayout{typeof(vcat)} , :: Type{<:Tuple{Int,AbstractRange{Int}}} ) = ApplyLayout {typeof(vcat)} () # a Vcat but with only 1 argument
798+
799+
796800# a row-slice of an Hcat is equivalent to a Vcat
797801sublayout (:: ApplyLayout{typeof(hcat)} , :: Type{<:Tuple{Int,AbstractRange{Int}}} ) = ApplyLayout {typeof(vcat)} ()
802+ sublayout (:: ApplyLayout{typeof(hcat)} , :: Type{<:Tuple{AbstractRange{Int},Int}} ) = ApplyLayout {typeof(hcat)} ()
803+ sublayout (:: ApplyLayout{typeof(hcat)} , :: Type{<:Tuple{AbstractRange{Int},AbstractRange{Int}}} ) = ApplyLayout {typeof(hcat)} ()
798804
799805_vcat_lastinds (sz) = _vcat_cumsum (sz... )
800806_vcat_firstinds (sz) = (1 , (1 .+ Base. front (_vcat_lastinds (sz))). .. )
@@ -816,13 +822,25 @@ function _vcat_sub_arguments(lay::ApplyLayout{typeof(vcat)}, A, V, kr)
816822 _reverse_if_neg_step (map (_view_vcat, arguments (lay, A), skr2), kr)
817823end
818824
819- function _vcat_sub_arguments (:: ApplyLayout{typeof(vcat)} , A, V, kr, jr)
820- sz = size .(arguments (A),1 )
825+ function _vcat_sub_arguments (lay :: ApplyLayout{typeof(vcat)} , A, V, kr, jr)
826+ sz = size .(arguments (lay, A),1 )
821827 skr = intersect .(_argsindices (sz), Ref (kr))
822828 skr2 = broadcast ((a,b) -> a .- b .+ 1 , skr, _vcat_firstinds (sz))
823829 _reverse_if_neg_step (_view_vcat .(arguments (A), skr2, Ref (jr)), kr)
824830end
825831
832+ function _vcat_sub_arguments (lay:: ApplyLayout{typeof(vcat)} , A, V, k:: Int , jr)
833+ args = arguments (lay, A)
834+ sz = size .(args,1 )
835+ for (a,inds, firstind) in zip (args, _argsindices (sz), _vcat_firstinds (sz))
836+ if k in inds
837+ return (_view_vcat (a, k - firstind + 1 , jr),)
838+ end
839+ end
840+
841+ () # no args
842+ end
843+
826844_vcat_sub_arguments (LAY:: ApplyLayout{typeof(vcat)} , A, V) = _vcat_sub_arguments (LAY, A, V, parentindices (V)... )
827845
828846
0 commit comments