#include <iostream>
#include <vector>
#include <chrono>
#include <algorithm>
#include <random>
#include <stdexcept>
using namespace std;
static
{
{
vect[i] = v;
bv_null[i] = true;
*bi = v;
if (i % 64 == 0)
{
bi.add_null(5);
i += 5;
}
}
}
static
unsigned value,
{
for (size_t i = 0; i < vect.size(); ++i)
{
if (vect[i] == value)
}
bv_res &= bv_null;
}
inline
{
cout <<
"( count = " << bv.
count() <<
")" <<
": [";
cout << *en << ", ";
cout << "]" << endl;
}
{
try
{
{
}
std::vector<unsigned> vect;
{
}
unsigned search_repeats = 500;
std::vector<unsigned> search_vect;
{
search_vect.reserve(search_repeats);
for (unsigned i = 0; i < search_repeats;)
{
{
search_vect.push_back(idx);
bv_tmp[idx] = 1;
++i;
}
}
}
{
for (unsigned i = 0; i < search_repeats; ++i)
{
unsigned vs = search_vect[i];
}
}
{
scanner.
find_eq(sv, search_vect.begin(), search_vect.end(), bv_res2);
}
{
std::cerr << "2. Search result mismatch!" << std::endl;
}
{
for (; it != it_end; ++it)
{
unsigned v = *it;
if (bv_search.test(v))
{
}
}
}
{
std::cerr << "3. Search result mismatch!" << std::endl;
}
}
catch(std::exception& ex)
{
std::cerr << ex.what() << std::endl;
return 1;
}
return 0;
}
Compressed bit-vector bvector<> container, set algebraic methods, traversal iterators.
Sparse constainer sparse_vector<> for integer types using bit-transposition transform.
Algorithms for bm::sparse_vector.
Timing utilities for benchmarking (internal)
pre-processor un-defines to avoid global space pollution (internal)
Constant iterator designed to enumerate "ON" bits.
bool valid() const BMNOEXCEPT
Checks if iterator is still valid.
Bitvector Bit-vector container with runtime compression of bits.
bool test(size_type n) const BMNOEXCEPT
returns true if bit n is set and false is bit n is 0.
size_type count() const BMNOEXCEPT
population count (count of ON bits)
enumerator first() const
Returns enumerator pointing on the first non-zero bit.
void init()
Explicit post-construction initialization. Must be caled to make sure safe use of *_no_check() method...
int compare(const bvector< Alloc > &bvect) const BMNOEXCEPT
Lexicographical comparison with a bitvector.
bvector< Alloc > & reset() BMNOEXCEPT
Clears every bit in the bitvector.
void set_bit_no_check(size_type n)
Set bit without checking preconditions (size, etc)
Utility class to collect performance measurements and statistics.
std::map< std::string, statistics > duration_map_type
test name to duration map
static void print_duration_map(TOut &tout, const duration_map_type &dmap, format fmt=ct_time)
algorithms for sparse_vector scan/search
void invert(const SV &sv, bvector_type &bv_out)
invert search result ("EQ" to "not EQ")
void find_eq(const SV &sv, value_type value, bvector_type &bv_out)
find all sparse vector elements EQ to search value
succinct sparse vector with runtime compression using bit-slicing / transposition method
void set(size_type idx, value_type v)
set specified element with bounds checking and automatic resize
const_iterator end() const BMNOEXCEPT
Provide const iterator access to the end
back_insert_iterator get_back_inserter()
Provide back insert iterator Back insert iterator implements buffered insertion, which is faster,...
friend back_insert_iterator
const_iterator begin() const BMNOEXCEPT
Provide const iterator access to container content
@ use_null
support "non-assigned" or "NULL" logic
@ BM_GAP
GAP compression is ON.
void combine_or(BV &bv, It first, It last)
OR Combine bitvector and the iterable sequence.
std::random_device rand_dev
bm::sparse_vector< bm::id_t, bm::bvector<> > sparse_vector_u32
static void vector_search(const std::vector< unsigned > &vect, const bm::bvector<> &bv_null, unsigned value, bm::bvector<> &bv_res)
void print_bvector(const bm::bvector<> &bv)
bm::chrono_taker ::duration_map_type timing_map
std::mt19937 gen(rand_dev())
std::uniform_int_distribution rand_dis(1, value_max)
static void generate_test_set(std::vector< unsigned > &vect, bm::bvector<> &bv_null, sparse_vector_u32 &sv)