You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This introduces a blocked version of logical indexing. With this PR, if
you index into array with an `AbstractBlockVector{Bool}`, it is
interpreted as a logical index but also uses the blocking of the index
to determine the block structure of the output array, for example:
```julia
julia> using BlockArrays
julia> a = randn(6, 6)
6×6 Matrix{Float64}:
-0.0577235 -0.12942 -0.10982 1.01086 0.196898 0.896616
-0.163481 -1.24784 1.01413 0.244657 -0.49961 -0.435926
1.64239 -0.930051 -0.923835 -0.789608 -0.53113 -0.0502656
0.0999888 -2.41073 -2.03078 0.019679 -0.857197 0.188939
-0.698236 -0.218804 -1.36086 0.77242 0.1388 1.97166
1.77482 -1.58258 -0.042804 1.30733 1.33004 0.930145
julia> mask = [true, true, false, false, true, false]
6-element Vector{Bool}:
1
1
0
0
1
0
julia> I = BlockedVector(mask, [3, 3])
2-blocked 6-element BlockedVector{Bool}:
1
1
0
─
0
1
0
julia> a[I, I]
2×2-blocked 3×3 BlockedMatrix{Float64}:
-0.0577235 -0.12942 │ 0.196898
-0.163481 -1.24784 │ -0.49961
───────────────────────┼───────────
-0.698236 -0.218804 │ 0.1388
```
Without this PR, the output of `a[I, I]` would not have been blocked.
0 commit comments