112 for (
size_t i = 0; i < vect.size(); ++i)
114 if (vect[i] == value)
124 cout <<
"( count = " << bv.
count() <<
")" <<
": [";
127 for (; en.
valid(); ++en)
152 scanner.
find_eq(sv, 25, bv_found);
156 scanner.
invert(sv, bv_found);
161 std::vector<unsigned> vect;
170 unsigned search_repeats = 500;
174 std::vector<unsigned> search_vect;
177 search_vect.reserve(search_repeats);
178 for (
unsigned i = 0; i < search_repeats;)
181 if (!bv_tmp.
test(idx))
183 search_vect.push_back(idx);
199 for (
unsigned i = 0; i < search_repeats; ++i)
201 unsigned vs = search_vect[i];
210 scanner.
find_eq(sv, search_vect.
begin(), search_vect.end(), bv_res2);
214 if (bv_res1.
compare(bv_res2) != 0)
216 std::cerr <<
"2. Search result mismatch!" << std::endl;
230 for (; it != it_end; ++it)
233 if (bv_search.
test(v))
241 if (bv_res1.
compare(bv_res3) != 0)
243 std::cerr <<
"3. Search result mismatch!" << std::endl;
250 catch(std::exception& ex)
252 std::cerr << ex.what() << std::endl;
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.
enumerator end() const
Returns enumerator pointing on the next bit after the last.
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)