@@ -576,8 +576,10 @@ arguments(::ApplyLayout{typeof(vcat)}, V::SubArray{<:Any,2,<:Any,<:Tuple{<:Slice
576
576
arguments (:: ApplyLayout{typeof(hcat)} , V:: SubArray{<:Any,2,<:Any,<:Tuple{<:Any,<:Slice}} ) =
577
577
view .(arguments (parent (V)), Ref (parentindices (V)[1 ]), Ref (:))
578
578
579
- copyto! (dest:: AbstractArray{T,N} , src:: SubArray{T,N,<:Vcat{T,N}} ) where {T,N} = vcat_copyto! (dest, arguments (src)... )
580
- copyto! (dest:: AbstractMatrix{T} , src:: SubArray{T,2,<:Hcat{T}} ) where T = hcat_copyto! (dest, arguments (src)... )
579
+ copyto! (dest:: AbstractArray{T,N} , src:: SubArray{T,N,<:Vcat{T,N}} ) where {T,N} =
580
+ vcat_copyto! (dest, arguments (ApplyLayout {typeof(vcat)} (), src)... )
581
+ copyto! (dest:: AbstractMatrix{T} , src:: SubArray{T,2,<:Hcat{T}} ) where T =
582
+ hcat_copyto! (dest, arguments (ApplyLayout {typeof(hcat)} (), src)... )
581
583
582
584
583
585
_vcat_lastinds (sz) = _vcat_cumsum (sz... )
@@ -597,32 +599,35 @@ function _vcat_sub_arguments(::ApplyLayout{typeof(vcat)}, A, V)
597
599
_view_vcat .(arguments (A), skr2)
598
600
end
599
601
_vcat_sub_arguments (:: ApplyLayout{typeof(hcat)} , A, V) = arguments (ApplyLayout {typeof(hcat)} (), V)
602
+ _vcat_sub_arguments (:: PaddedLayout , A, V) = _vcat_sub_arguments (ApplyLayout {typeof(vcat)} (), A, V)
600
603
601
604
_vcat_sub_arguments (A, V) = _vcat_sub_arguments (MemoryLayout (typeof (A)), A, V)
602
605
arguments (:: ApplyLayout{typeof(vcat)} , V:: SubArray{<:Any,1} ) = _vcat_sub_arguments (parent (V), V)
603
606
604
- function arguments (:: ApplyLayout{typeof(vcat)} , V:: SubArray{<:Any,2} )
607
+ function arguments (L :: ApplyLayout{typeof(vcat)} , V:: SubArray{<:Any,2} )
605
608
A = parent (V)
609
+ args = arguments (L, A)
606
610
kr,jr = parentindices (V)
607
- sz = size .(arguments (A) ,1 )
611
+ sz = size .(args ,1 )
608
612
skr = intersect .(_argsindices (sz), Ref (kr))
609
613
skr2 = broadcast ((a,b) -> a .- b .+ 1 , skr, _vcat_firstinds (sz))
610
- _view_vcat .(arguments (A) , skr2, Ref (jr))
614
+ _view_vcat .(args , skr2, Ref (jr))
611
615
end
612
616
613
617
_view_hcat (a:: Number , kr, jr) = Fill (a,length (kr),length (jr))
614
618
_view_hcat (a, kr, jr) = view (a, kr, jr)
615
619
616
- function arguments (:: ApplyLayout{typeof(hcat)} , V:: SubArray )
620
+ function arguments (L :: ApplyLayout{typeof(hcat)} , V:: SubArray )
617
621
A = parent (V)
622
+ args = arguments (L, A)
618
623
kr,jr = parentindices (V)
619
- sz = size .(arguments (A) ,2 )
624
+ sz = size .(args ,2 )
620
625
sjr = intersect .(_argsindices (sz), Ref (jr))
621
626
sjr2 = broadcast ((a,b) -> a .- b .+ 1 , sjr, _vcat_firstinds (sz))
622
- _view_hcat .(arguments (A) , Ref (kr), sjr2)
627
+ _view_hcat .(args , Ref (kr), sjr2)
623
628
end
624
629
625
- function sub_materialize (:: ApplyLayout{typeof(vcat)} , V)
630
+ function sub_materialize (:: ApplyLayout{typeof(vcat)} , V:: AbstractMatrix )
626
631
ret = similar (V)
627
632
n = 0
628
633
_,jr = parentindices (V)
@@ -652,6 +657,26 @@ materialize!(M::MatMulMatAdd{<:AbstractColumnMajor,<:ApplyLayout{typeof(vcat)}})
652
657
materialize! (M:: MatMulVecAdd{<:AbstractColumnMajor,<:ApplyLayout{typeof(vcat)}} ) =
653
658
materialize! (MulAdd (M. α,M. A,Array (M. B),M. β,M. C))
654
659
660
+ sublayout (:: PaddedLayout{L} , :: Type{I} ) where {L,I<: Tuple{AbstractUnitRange} } =
661
+ PaddedLayout {typeof(sublayout(L(), I))} ()
662
+ sublayout (:: PaddedLayout{L} , :: Type{I} ) where {L,I<: Tuple{AbstractUnitRange,AbstractUnitRange} } =
663
+ PaddedLayout {typeof(sublayout(L(), I))} ()
664
+
665
+ function sub_materialize (:: PaddedLayout , v:: AbstractVector{T} ) where T
666
+ A = parent (v)
667
+ dat = paddeddata (A)
668
+ (kr,) = parentindices (v)
669
+ kr2 = kr ∩ axes (dat,1 )
670
+ Vcat (lazy_getindex (dat, kr2), Zeros {T} (length (kr) - length (kr2)))
671
+ end
672
+
673
+ function sub_materialize (:: PaddedLayout , v:: AbstractMatrix{T} ) where T
674
+ A = parent (v)
675
+ dat = paddeddata (A)
676
+ kr,jr = parentindices (v)
677
+ kr2 = kr ∩ axes (dat,1 )
678
+ Vcat (lazy_getindex (dat, kr2, jr), Zeros {T} (length (kr) - length (kr2), length (jr)))
679
+ end
655
680
656
681
# # print
657
682
0 commit comments