Module index_raw

Source
Expand description

The raw functions for building and using rank/select indexes.

The functions here do minimal if any checking on the size or validity of indexes vs. the bitvectors they are used with, so you may run into panics from e.g. out of bounds accesses to slices. They should all be memory-safe though.

Structs§

IndexSizeError
Indicates the index storage was the wrong size for the bit vector it was used with.

Functions§

build_index_for
Build the index data for a given bitvector (O(n)).
check_index_size
Check an index is the right size for a given bitvector.
count_ones
Count the set bits using the index (fast O(1)).
count_zeros
Count the unset bits using the index (fast O(1)).
index_size_for
Calculate the storage size for an index for a given bitvector (O(1)).
rank_ones
Count the set bits before a position in the bits using the index (O(1)).
rank_zeros
Count the unset bits before a position in the bits using the index (O(1)).
select_ones
Find the position of a set bit by its rank using the index (O(log n)).
select_zeros
Find the position of an unset bit by its rank using the index (O(log n)).