Bits Loops
TanayLabUtilities.BitsLoops
—
Module
Efficient iterations on bits.
TanayLabUtilities.BitsLoops.@foreach_true_index
—
Macro
@foreach_true_index bits index begin
...use index...
end
Iterate on all indices for which
bits
are
true
and invoke
body(index)
for each. This efficiently skips 64-but chunks so is reasonably efficient for sparse bit vectors. It also does this with no allocations (unlike using
findall
).
TanayLabUtilities.BitsLoops.@foreach_true_index_position
—
Macro
@foreach_true_index_position bits index position begin
...use index and position...
end
Similar to
@foreach_true_index
but calls
body
with both the index of the entry and its position (the number of true values before it).