Go to the documentation of this file.
51 cout << sv.
size() <<
": [ EMPTY ]" << endl;
54 cout << sv.
size() <<
": [ ";
55 for (
unsigned i = 0; i < sv.
size(); ++i)
57 unsigned v = sv.
at(i);
76 cout <<
"( count = " << bv.
count() <<
")" <<
": [";
78 for (; en.
valid(); ++en)
102 sv_transform.
set(2, 25);
103 sv_transform.
set(3, 35);
104 sv_transform.
set(7, 75);
105 sv_transform.
set(1000, 2000);
106 sv_transform.
set(256, 2001);
117 func.
run(bv_in, sv_transform, bv_out);
119 std::cout <<
"re-mapped vector:" << endl;
128 bool found = func.
remap(1, sv_transform, to);
130 std::cout << from <<
" not mapped" << std::endl;
132 std::cout << from <<
" mapped to " << to << std::endl;
140 sv_transform2.
set(2, 25);
141 sv_transform2.
set(3, 35);
142 sv_transform2.
set(7, 75);
143 sv_transform2.
set(1000, 2000);
144 sv_transform2.
set(256, 2001);
146 found = func.
remap(1, sv_transform2, to);
148 std::cout << from <<
" not mapped" << std::endl;
150 std::cout << from <<
" mapped to " << to << std::endl;
156 func.
run(bv_in, sv_transform2, bv_out);
158 std::cout <<
"re-mapped vector2:" << endl;
162 catch(std::exception& ex)
164 std::cerr << ex.what() << std::endl;
Algorithms for bm::sparse_vector.
sparse vector with runtime compression using bit transposition method
Sparse constainer sparse_vector<> for integer types using bit-transposition transform.
Constant iterator designed to enumerate "ON" bits.
support "non-assigned" or "NULL" logic
static void print_svector(const sparse_vector_u32 &sv)
size_type count() const BMNOEXCEPT
population cout (count of ON bits)
void print_bvector(const bm::bvector<> &bv)
bool valid() const BMNOEXCEPT
Checks if iterator is still valid. Analog of != 0 comparison for pointers.
size_type size() const BMNOEXCEPT
return size of the vector
bool is_null(size_type idx) const BMNOEXCEPT
test if specified element is NULL
bm::sparse_vector< bm::id_t, bm::bvector<> > sparse_vector_u32
value_type at(size_type idx) const
access specified element with bounds checking
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