63 std::cout << sv.size() <<
": ";
64 for (
unsigned i = 0; i < sv.size(); ++i)
69 std::cout <<
"NULL, ";
72 typename SV::value_type v = sv.get(i);
73 std::cout << v <<
", ";
78 typename SV::value_type v = sv.get(i);
79 std::cout << v <<
", ";
82 std::cout << std::endl;
91 using value_type =
typename SV::value_type;
93 std::cout << sv.size() <<
": ";
94 for (
unsigned i = 0; i < sv.size(); ++i)
98 if (!sv.try_get(i, v))
99 std::cout <<
"NULL, ";
101 std::cout << v <<
", ";
106 std::cout << v <<
", ";
109 std::cout << std::endl;
123 for (
unsigned i = 0; i < 15; i+=3)
146 const unsigned char* buf = sv_lay.
buf();
147 size_t buf_size = sv_lay.
size();
149 vector<unsigned char> tmp_buf(buf_size);
150 ::memcpy(&tmp_buf[0], buf, buf_size);
158 std::cerr <<
"De-Serialization error!" << std::endl;
161 if (!csv3.
equal(csv2) )
163 cerr <<
"Error! Please report a bug to BitMagic project support." << endl;
171 if (!sv3.
equal(sv1) )
173 std::cerr <<
"Error! Please report a bug to BitMagic project support." << std::endl;
180 catch(std::exception& ex)
182 std::cerr << ex.what() << std::endl;
Compressed bit-vector bvector<> container, set algebraic methods, traversal iterators.
#define BM_DECLARE_TEMP_BLOCK(x)
Sparse constainer sparse_vector<> for integer types using bit-transposition transform.
Compressed sparse container rsc_sparse_vector<> for integer types.
Serialization for sparse_vector<>
pre-processor un-defines to avoid global space pollution (internal)
void load_from(const sparse_vector_type &sv_src)
Load compressed vector from a sparse vector (with NULLs)
void load_to(sparse_vector_type &sv) const
Exort compressed vector to a sparse vector (with NULLs)
void optimize(bm::word_t *temp_block=0, typename bvector_type::optmode opt_mode=bvector_type::opt_compress, statistics *stat=0)
run memory optimization for all vector slices
bool equal(const rsc_sparse_vector< Val, SV > &csv) const BMNOEXCEPT
check if another vector has the same content
succinct sparse vector with runtime compression using bit-slicing / transposition method
bool equal(const sparse_vector< Val, BV > &sv, bm::null_support null_able=bm::use_null) const BMNOEXCEPT
check if another sparse vector has the same content and size
@ use_null
support "non-assigned" or "NULL" logic
void sparse_vector_serialize(const SV &sv, sparse_vector_serial_layout< SV > &sv_layout, bm::word_t *temp_block=0)
Serialize sparse vector into a memory buffer(s) structure.
int sparse_vector_deserialize(SV &sv, const unsigned char *buf, bm::word_t *temp_block=0)
Deserialize sparse vector.
void print_svector2(const SV &sv, bool show_nulls=false)
Prints succinct vector using try_get() random access method.
void print_svector(const SV &sv, bool show_nulls=false)
Prints the vector using is_null() and get() Please note, that random access is not the fastest,...
bm::sparse_vector< unsigned, bm::bvector<> > sparse_vector_u32
bm::rsc_sparse_vector< unsigned, sparse_vector_u32 > rsc_sparse_vector_u32
layout class for serialization buffer structure
size_t size() const BMNOEXCEPT
return current serialized size
const unsigned char * buf() const BMNOEXCEPT
Return serialization buffer pointer.