63 for (j = 0; j < 65535*8; i += 10, j++)
70 for (j = 0; j < 65535; i += 120, j++)
72 unsigned len = rand() % 64;
88 std::cout <<
"Bit-vector statistics: GAP (compressed blocks)=" << st.
gap_blocks 89 <<
", BIT (uncompressed blocks)=" << st.
bit_blocks 90 << std::endl << std::endl;
125 std::cout <<
"Count test finished." << cnt <<
"\r";
146 std::cout <<
"Count range test finished." << cnt <<
"\r";
172 std::cout <<
"Count range with blocks test finished." << cnt <<
"\r";
196 std::cout <<
"Count to with blocks test finished." << cnt <<
"\r";
229 std::cout <<
"Count range via count_to test finished." << cnt <<
"\r";
258 std::cout <<
"count AND finished." << cnt <<
"\r";
278 for (; en.
valid(); ++en)
286 std::cout <<
"counted_enumerator finished." << cnt <<
"\r";
301 std::cout << s <<
"\r";
360 catch(std::exception& ex)
362 std::cerr << ex.what() << std::endl;
Compressed bit-vector bvector<> container, set algebraic methods, traversal iterators.
size_t gap_blocks
Number of GAP blocks.
size_type count_range(size_type left, size_type right, const rs_index_type &rs_idx) const
Returns count of 1 bits in the given range [left..right] Uses rank-select index to accelerate the sea...
rs_index< allocator_type > rs_index_type
static void bv_count_range(const bm::bvector<> &bv)
count_range() test
void optimize(bm::word_t *temp_block=0, optmode opt_mode=opt_compress, statistics *stat=0)
Optimize memory bitvector's memory allocation.
static void generate_bvector(bm::bvector<> &bv)
generate pseudo-random bit-vector, mix of blocks
Timing utilities for benchmarking (internal)
static void bv_count_to_acc(const bm::bvector<> &bv)
count_to() test using pre-calculated rank-select index
static void bv_count_test(const bm::bvector<> &bv)
simple population count for the whole vector
void clear(const size_type *ids, size_type ids_size, bm::sort_order so=bm::BM_UNKNOWN)
clear list of bits in this bitset
Constant iterator designed to enumerate "ON" bits counted_enumerator keeps bitcount, ie number of ON bits starting from the position 0 in the bit string up to the currently enumerated bit.
#define BM_DECLARE_TEMP_BLOCK(x)
Statistical information about bitset's memory allocation details.
Algorithms for bvector<> (main include)
bm::chrono_taker::duration_map_type timing_map
void build_rs_index(rs_index_type *rs_idx, bvector< Alloc > *bv_blocks=0) const
compute running total of all blocks in bit vector (rank-select index)
std::uniform_int_distribution rand_dis(1, int(vector_max))
enumerator first() const
Returns enumerator pointing on the first non-zero bit.
static bm::bvector ::size_type pre_heat(const bm::bvector<> &bv)
"pre-heat" CPU to minimize dynamic overclocking effects
bvector< Alloc > & set(size_type n, bool val=true)
Sets bit n if val is true, clears bit n if val is false.
std::map< std::string, statistics > duration_map_type
test name to duration map
static void print_duration_map(const duration_map_type &dmap, format fmt=ct_time)
size_type count() const
population cout (count of ON bits)
bool valid() const
Checks if iterator is still valid.
static void bv_counted_enumerator(const bm::bvector<> &bv)
count_to implemented via bm::bvector<>::counted_enumerator
static void bv_count_and(const bm::bvector<> &bv)
count_range implemented via bm::count_and
bvector< Alloc > & set_range(size_type left, size_type right, bool value=true)
Sets all bits in the specified closed interval [left,right] Interval must be inside the bvector's siz...
Utility class to collect performance measurements and statistics.
void calc_stat(struct bm::bvector< Alloc >::statistics *st) const
Calculates bitvector statistics.
static void bv_count_range_acc(const bm::bvector<> &bv)
count_range() test using pre-calculated blocks bit count
size_t bit_blocks
Number of bit blocks.
const unsigned benchmark_count
static void bv_count_to_range_acc(const bm::bvector<> &bv)
count_range implemented via two count_to() calls using pre-calculated rank-select index ...
size_type count() const
Number of bits ON starting from the .
std::mt19937 gen(rand_dev())
std::random_device rand_dev
BV::size_type count_and(const BV &bv1, const BV &bv2)
Computes bitcount of AND operation of two bitsets.
size_type count_to(size_type n, const rs_index_type &rs_idx) const
Returns count of 1 bits (population) in [0..right] range.