63 std::cout <<
"<EMPTY SET>";
65 for (; first != last; ++first)
66 std::cout << *first <<
";";
67 std::cout << std::endl;
73 std::vector<bm_size_type> &v2,
74 std::vector<bm_size_type> &v3)
154 std::vector<bm_size_type> &v2,
155 std::vector<bm_size_type> &v3)
170 std::vector<bm_size_type> &v2,
171 std::vector<bm_size_type> &v3)
212 for (
unsigned i = 0; i <
sizeof(bits) /
sizeof(bits[0]); ++i)
214 bool b = bv1.
set_bit(bits[i],
true);
217 std::cout <<
"Number of bits changed:" << cnt << std::endl;
225 std::cout <<
"Bit 5 set:" << (b ?
" yes " :
" no ") << std::endl;
228 std::cout <<
"Bit 256 set:" << (b ?
" yes " :
" no ") << std::endl;
231 std::cout <<
"Bit 256 set:" << (b ?
" yes " :
" no ") << std::endl;
247 std::cout <<
"Bit 13 set:" << (b ?
" yes " :
" no ") << std::endl;
257 bm::combine_or(bv1, &bits[0], &bits[0] + (
sizeof(bits) /
sizeof(bits[0])));
279 std::cout <<
"Extracted p = " << p << std::endl;
295 std::vector<bm_size_type> v1, v2, v3;
298 for (
unsigned k = 0; k < 1000; ++k)
303 for (i = 0; i < v1.size(); ++i)
304 s = s + s* v1[i] + i;
305 for (i = 0; i < v2.size(); ++i)
306 s = s + s* v2[i] + i;
307 std::cout << s <<
"\r";
310 std::cout << std::endl <<
"Running benchmarks..." << std::endl;
319 std::cout << std::endl;
322 catch(std::exception& ex)
324 std::cerr << ex.what() << std::endl;
Compressed bit-vector bvector<> container, set algebraic methods, traversal iterators.
Algorithms for bvector<> (main include).
Timing utilities for benchmarking (internal).
Bitvector Bit-vector container with runtime compression of bits.
bvector< Alloc > & reset()
Clears every bit in the bitvector.
bool clear_bit(size_type n)
Clears bit n.
bvector< Alloc > & set(size_type n, bool val=true)
Sets bit n if val is true, clears bit n if val is false.
size_type extract_next(size_type prev)
Finds the number of the next bit ON and sets it to 0.
bool set_bit(size_type n, bool val=true)
Sets bit n.
enumerator first() const
Returns enumerator pointing on the first non-zero bit.
void swap(bvector< Alloc > &bvect) BMNOEXCEPT
Exchanges content of bv and this bvector.
void init()
Explicit post-construction initialization.
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...
bvector< Alloc > & flip(size_type n)
Flips bit n.
void clear(const size_type *ids, size_type ids_size, bm::sort_order so=bm::BM_UNKNOWN)
clear list of bits in this bitset
bool set_bit_conditional(size_type n, bool val, bool condition)
Sets bit n only if current value equals the condition.
enumerator end() const
Returns enumerator pointing on the next bit after the last.
void set_bit_no_check(size_type n)
Set bit without checking preconditions (size, etc).
Utility class to collect performance measurements and statistics.
static void print_duration_map(const duration_map_type &dmap, format fmt=ct_time)
std::map< std::string, statistics > duration_map_type
test name to duration map
void combine_or(BV &bv, It first, It last)
OR Combine bitvector and the iterable sequence.
const unsigned benchmark_count
bm::chrono_taker::duration_map_type timing_map
void PrintContainer(T first, T last)
static void combine_or_test(std::vector< bm_size_type > &v1, std::vector< bm_size_type > &v2, std::vector< bm_size_type > &v3)
static void generate_test_vectors(std::vector< bm_size_type > &v1, std::vector< bm_size_type > &v2, std::vector< bm_size_type > &v3)
static void bv_set_bit_no_check_test()
static void bvector_bulk_set_test(std::vector< bm_size_type > &v1, std::vector< bm_size_type > &v2, std::vector< bm_size_type > &v3)
static void bv_set_bit_test()
bm::bvector ::size_type bm_size_type