@@ -174,13 +174,12 @@ function blockedunitrange_getindices(
174174 a:: AbstractBlockedUnitRange , indices:: AbstractVector{Bool}
175175)
176176 blocked_indices = BlockedVector (indices, axes (a))
177- return mortar (
178- map (Base. OneTo (blocklength (blocked_indices))) do b
179- binds = blocked_indices[Block (b)]
180- bstart = blockfirsts (only (axes (blocked_indices)))[b]
181- return findall (binds) .+ (bstart - 1 )
182- end ,
183- )
177+ bs = map (Base. OneTo (blocklength (blocked_indices))) do b
178+ binds = blocked_indices[Block (b)]
179+ bstart = blockfirsts (only (axes (blocked_indices)))[b]
180+ return findall (binds) .+ (bstart - 1 )
181+ end
182+ return mortar (filter (! isempty, bs))
184183end
185184
186185# TODO : Move this to a `BlockArraysExtensions` library.
@@ -224,12 +223,11 @@ Base.copy(a::BlockIndexVector) = BlockIndexVector(a.block, copy(a.indices))
224223
225224function to_blockindices (a:: AbstractBlockedUnitRange{<:Integer} , I:: AbstractArray{Bool} )
226225 I_blocks = blocks (BlockedVector (I, blocklengths (a)))
227- return mortar (
228- map (eachindex (I_blocks)) do b
229- I_b = findall (I_blocks[b])
230- BlockIndexVector (Block (b), I_b)
231- end ,
232- )
226+ I′_blocks = map (eachindex (I_blocks)) do b
227+ I_b = findall (I_blocks[b])
228+ BlockIndexVector (Block (b), I_b)
229+ end
230+ return mortar (filter (! isempty, I′_blocks))
233231end
234232
235233# This handles non-blocked slices.
0 commit comments