53 const unsigned max_coll = 50000;
56 for (
unsigned i = 10; i < max_coll; i += rand() % 3)
63 std::random_device rd;
65 std::shuffle(vec.begin(), vec.end(), g);
79 for (
const unsigned u : vec)
81 bool found = scanner.
bfind(sv, u, pos);
103 std::sort(vec.begin(), vec.end());
105 vector<unsigned>::const_iterator vit = vec.begin();
108 for (; it != it_end; ++it, ++vit)
113 cerr <<
"Mismatch at:" << u <<
"!=" << *vit << endl;
118 cout <<
"Sort validation Ok." << endl;
120 catch(std::exception& ex)
122 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.
pre-processor un-defines to avoid global space pollution (internal)
algorithms for sparse_vector scan/search
bool bfind(const SV &sv, const value_type val, size_type &pos)
binary search for position in the sorted sparse vector
succinct sparse vector with runtime compression using bit-slicing / transposition method
bvector_type::size_type size_type
const_iterator end() const BMNOEXCEPT
Provide const iterator access to the end
void insert(size_type idx, value_type v)
insert specified element into container
const_iterator begin() const BMNOEXCEPT
Provide const iterator access to container content
void optimize(bm::word_t *temp_block=0, typename bvector_type::optmode opt_mode=bvector_type::opt_compress, typename sparse_vector< Val, BV >::statistics *stat=0)
run memory optimization for all vector planes
static void insertion_sort(sparse_vector_u32 &sv, const vector< unsigned > &vec)
bm::sparse_vector< bm::id_t, bm::bvector<> > sparse_vector_u32
static void generate_set(vector< unsigned > &vec)