Go to the documentation of this file.
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;
static void generate_test_set(std::vector< unsigned > &vect, bm::bvector<> &bv_null, sparse_vector_u32 &sv)
void invert(const SV &sv, typename SV::bvector_type &bv_out)
invert search result ("EQ" to "not EQ")
Algorithms for bm::sparse_vector.
friend back_insert_iterator
sparse vector with runtime compression using bit transposition method
Utility class to collect performance measurements and statistics.
bvector< Alloc > & reset()
Clears every bit in the bitvector.
bm::chrono_taker::duration_map_type timing_map
void set_bit_no_check(size_type n)
Set bit without checking preconditions (size, etc)
Sparse constainer sparse_vector<> for integer types using bit-transposition transform.
Constant iterator designed to enumerate "ON" bits.
algorithms for sparse_vector scan/search
int compare(const bvector< Alloc > &bvect) const BMNOEXCEPT
Lexicographical comparison with a bitvector.
void print_bvector(const bm::bvector<> &bv)
@ use_null
support "non-assigned" or "NULL" logic
static void vector_search(const std::vector< unsigned > &vect, const bm::bvector<> &bv_null, unsigned value, bm::bvector<> &bv_res)
size_type count() const BMNOEXCEPT
population cout (count of ON bits)
const_iterator end() const BMNOEXCEPT
Provide const iterator access to the end
bool valid() const BMNOEXCEPT
Checks if iterator is still valid. Analog of != 0 comparison for pointers.
void init()
Explicit post-construction initialization.
Timing utilities for benchmarking (internal)
bm::sparse_vector< bm::id_t, bm::bvector<> > sparse_vector_u32
const_iterator begin() const BMNOEXCEPT
Provide const iterator access to container content
@ BM_GAP
GAP compression is ON.
std::mt19937 gen(rand_dev())
bool test(size_type n) const BMNOEXCEPT
returns true if bit n is set and false is bit n is 0.
void combine_or(BV &bv, It first, It last)
OR Combine bitvector and the iterable sequence.
std::uniform_int_distribution rand_dis(1, value_max)
std::map< std::string, statistics > duration_map_type
test name to duration map
back_insert_iterator get_back_inserter()
Provide back insert iterator Back insert iterator implements buffered insertion, which is faster,...
enumerator end() const
Returns enumerator pointing on the next bit after the last.
static void print_duration_map(const duration_map_type &dmap, format fmt=ct_time)
std::random_device rand_dev
enumerator first() const
Returns enumerator pointing on the first non-zero bit.
Compressed bit-vector bvector<> container, set algebraic methods, traversal iterators.
void set(size_type idx, value_type v)
set specified element with bounds checking and automatic resize
void find_eq(const SV &sv, typename SV::value_type value, typename SV::bvector_type &bv_out)
find all sparse vector elements EQ to search value