@@ -23,11 +23,8 @@ const Falses = Zeros{Bool, N, Axes} where {N, Axes}
23
23
24
24
# y[mask] = x when mask isa Trues (cf y[:] = x)
25
25
# Supported here only for arrays with standard OneTo axes.
26
- function Base. setindex! (y:: AbstractArray{T,N} , x,
27
- mask:: Trues{N, NTuple{N,Base.OneTo{Int}}} ,
28
- ) where {T,N}
29
- if axes (x) isa NTuple{N,Base. OneTo{Int}} &&
30
- axes (y) isa NTuple{N,Base. OneTo{Int}}
26
+ function Base. setindex! (y:: AbstractArray{T,N} , x, mask:: Trues{N, NTuple{N,Base.OneTo{Int}}} ) where {T,N}
27
+ if axes (x) isa NTuple{N,Base. OneTo{Int}} && axes (y) isa NTuple{N,Base. OneTo{Int}}
31
28
@boundscheck size (y) == size (mask) || throw (BoundsError (y, mask))
32
29
@boundscheck size (x) == size (mask) || throw (DimensionMismatch (
33
30
" tried to assign $(length (x)) elements to $(length (y)) destinations" ))
39
36
40
37
# x[mask] when mask isa Trues (cf x[trues(size(x))] or x[:])
41
38
# Supported here only for arrays with standard OneTo axes.
42
- function Base. getindex (x:: AbstractArray{T,N} ,
43
- mask:: Trues{N, NTuple{N,Base.OneTo{Int}}} ,
44
- ) where {T,N}
45
- if axes (x) isa NTuple{N,Base. OneTo{Int}} where N
39
+ function Base. getindex (x:: AbstractArray{T,N} , mask:: Trues{N, NTuple{N,Base.OneTo{Int}}} ) where {T,N}
40
+ if axes (x) isa NTuple{N,Base. OneTo{Int}}
46
41
@boundscheck size (x) == size (mask) || throw (BoundsError (x, mask))
47
42
return vec (x)
48
43
end
0 commit comments