@@ -44,74 +44,69 @@ to_index(::BlockRange) = throw(ArgumentError("BlockRange must be converted by to
44
44
@inline to_indices (A, I:: Tuple{Block, Vararg{Any}} ) = to_indices (A, axes (A), I)
45
45
@inline to_indices (A, I:: Tuple{BlockRange, Vararg{Any}} ) = to_indices (A, axes (A), I)
46
46
47
- reindex (idxs:: Tuple{BlockSlice{<:BlockRange}, Vararg{Any}} ,
47
+ @propagate_inbounds reindex (idxs:: Tuple{BlockSlice{<:BlockRange}, Vararg{Any}} ,
48
48
subidxs:: Tuple{BlockSlice{<:BlockIndexRange}, Vararg{Any}} ) =
49
- (@_propagate_inbounds_meta ; ( BlockSlice (BlockIndexRange (Block (idxs[1 ]. block. indices[1 ][Int (subidxs[1 ]. block. block)]),
49
+ (BlockSlice (BlockIndexRange (Block (idxs[1 ]. block. indices[1 ][Int (subidxs[1 ]. block. block)]),
50
50
subidxs[1 ]. block. indices),
51
51
idxs[1 ]. indices[subidxs[1 ]. indices]),
52
- reindex (tail (idxs), tail (subidxs))... ))
53
- reindex (idxs:: Tuple{BlockSlice{<:BlockRange}, Vararg{Any}} ,
52
+ reindex (tail (idxs), tail (subidxs))... )
53
+ @propagate_inbounds reindex (idxs:: Tuple{BlockSlice{<:BlockRange}, Vararg{Any}} ,
54
54
subidxs:: Tuple{BlockSlice{<:Block}, Vararg{Any}} ) =
55
- (@_propagate_inbounds_meta ; ( BlockSlice (idxs[1 ]. block[Int (subidxs[1 ]. block)],
55
+ (BlockSlice (idxs[1 ]. block[Int (subidxs[1 ]. block)],
56
56
idxs[1 ]. indices[subidxs[1 ]. indices]),
57
- reindex (tail (idxs), tail (subidxs))... ))
57
+ reindex (tail (idxs), tail (subidxs))... )
58
58
59
- reindex (idxs:: Tuple{BlockedUnitRange, Vararg{Any}} ,
59
+ @propagate_inbounds reindex (idxs:: Tuple{BlockedUnitRange, Vararg{Any}} ,
60
60
subidxs:: Tuple{BlockSlice{<:Block}, Vararg{Any}} ) =
61
- (@_propagate_inbounds_meta ; ( BlockSlice (subidxs[1 ]. block,
61
+ (BlockSlice (subidxs[1 ]. block,
62
62
idxs[1 ][subidxs[1 ]. block]),
63
- reindex (tail (idxs), tail (subidxs))... ))
63
+ reindex (tail (idxs), tail (subidxs))... )
64
64
# _splatmap taken from Base:
65
65
_splatmap (f, :: Tuple{} ) = ()
66
66
_splatmap (f, t:: Tuple ) = (f (t[1 ])... , _splatmap (f, tail (t))... )
67
67
68
68
# De-reference blocks before creating a view to avoid taking `global2blockindex`
69
69
# path in `AbstractBlockStyle` broadcasting.
70
- @inline function Base. unsafe_view (
70
+ @propagate_inbounds function Base. unsafe_view (
71
71
A:: BlockArray{<:Any, N} ,
72
72
I:: Vararg{BlockSlice{<:BlockIndexRange{1}}, N} ) where {N}
73
- @_propagate_inbounds_meta
74
73
B = view (A, map (block, I)... )
75
74
return view (B, _splatmap (x -> x. block. indices, I)... )
76
75
end
77
76
78
- @inline function Base. unsafe_view (
77
+ @propagate_inbounds function Base. unsafe_view (
79
78
A:: PseudoBlockArray{<:Any, N} ,
80
79
I:: Vararg{BlockSlice{<:BlockIndexRange{1}}, N} ) where {N}
81
- @_propagate_inbounds_meta
82
80
return view (A. blocks, map (x -> x. indices, I)... )
83
81
end
84
82
85
- @inline function Base. unsafe_view (
83
+ @propagate_inbounds function Base. unsafe_view (
86
84
A:: ReshapedArray{<:Any, N, <:AbstractBlockArray{<:Any, M}} ,
87
85
I:: Vararg{BlockSlice{<:BlockIndexRange{1}}, N} ) where {N, M}
88
- @_propagate_inbounds_meta
89
86
# Note: assuming that I[M+1:end] are verified to be singletons
90
87
return reshape (view (A. parent, I[1 : M]. .. ), Val (N))
91
88
end
92
89
93
- @inline function Base. unsafe_view (
90
+ @propagate_inbounds function Base. unsafe_view (
94
91
A:: Array{<:Any, N} ,
95
92
I:: Vararg{BlockSlice{<:BlockIndexRange{1}}, N} ) where {N}
96
- @_propagate_inbounds_meta
97
93
return view (A, map (x -> x. indices, I)... )
98
94
end
99
95
100
96
# make sure we reindex correctrly
101
- function Base. _maybe_reindex (V, I:: Tuple{BlockSlice{<:BlockIndexRange{1}}, Vararg{Any}} , :: Tuple{} )
102
- @_inline_meta
97
+ @inline function Base. _maybe_reindex (V, I:: Tuple{BlockSlice{<:BlockIndexRange{1}}, Vararg{Any}} , :: Tuple{} )
103
98
@inbounds idxs = to_indices (V. parent, reindex (V. indices, I))
104
99
view (V. parent, idxs... )
105
100
end
106
101
107
102
108
103
# BlockSlices map the blocks and the indices
109
104
# this is loosely based on Slice reindex in subarray.jl
110
- reindex (idxs:: Tuple{BlockSlice{<:BlockRange}, Vararg{Any}} ,
105
+ @propagate_inbounds reindex (idxs:: Tuple{BlockSlice{<:BlockRange}, Vararg{Any}} ,
111
106
subidxs:: Tuple{BlockSlice{<:BlockRange}, Vararg{Any}} ) =
112
- (@_propagate_inbounds_meta ; ( BlockSlice (BlockRange (idxs[1 ]. block. indices[1 ][Int .(subidxs[1 ]. block)]),
107
+ (BlockSlice (BlockRange (idxs[1 ]. block. indices[1 ][Int .(subidxs[1 ]. block)]),
113
108
idxs[1 ]. indices[subidxs[1 ]. block]),
114
- reindex (tail (idxs), tail (subidxs))... ))
109
+ reindex (tail (idxs), tail (subidxs))... )
115
110
116
111
117
112
function reindex (idxs:: Tuple{BlockSlice{Block{1,Int}}, Vararg{Any}} ,
0 commit comments