Just starting to use BitMagic and understand the intricacies of it.
When i run,
bm::bvector<> bv;
bm::sparse_vector<unsigned, bm::bvector<> > sv1 (bm::use_null);
bv.set_new_blocks_strat(bm::BM_GAP); // set DGAP compression mode ON
for (unsigned i = 0; i < 10000; i+= 533)
{
bv.set_bit(i);
sv1[i] = true;
}
cout << bv.calc_stat().memory_used << ", " << sv1.calc_stat().memory_used;
Returns
It seems that sparse vector occupies more space than the bvector. I want to store an integer list in this sparse vector basically and I don't understand why the sparse_vector takes more space than the bvector.
Any help on this will be appreciated. Thanks.
question from:https://stackoverflow.com/questions/65680328/bitmagic-where-are-the-use-cases-of-bmsparse-vector