BitMagic-C++
rscsample01.cpp File Reference

Example: rsc_sparse_vector<> usage. More...

#include <iostream>
#include <vector>
#include "bm.h"
#include "bmsparsevec.h"
#include "bmsparsevec_compr.h"
#include "bmsparsevec_serial.h"
#include "bmundef.h"
Include dependency graph for rscsample01.cpp:

Go to the source code of this file.

Typedefs

typedef bm::sparse_vector< unsigned, bm::bvector<> > sparse_vector_u32
typedef bm::rsc_sparse_vector< unsigned, sparse_vector_u32rsc_sparse_vector_u32

Functions

template<class SV>
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, const_iterator is preferred in many cases (better performance).
template<class SV>
void print_svector2 (const SV &sv, bool show_nulls=false)
 Prints succinct vector using try_get() random access method.
int main (void)

Detailed Description

Example: rsc_sparse_vector<> usage.

rsc_sparse_vector<> is a sparse vector which uses bit-transposition and rank-select succinct method of compression of NULL (unassigned) values. Unassigned values are dropped (as transposed columns) from the bit-matrix.

rsc_sparse_vector<> is basically a read-only structure, which can be used for compact data storage and search. Random access to elements is possible with a penalty of bit-vector Rank or Select operations.

Definition in file rscsample01.cpp.

Typedef Documentation

◆ rsc_sparse_vector_u32

Definition at line 54 of file rscsample01.cpp.

◆ sparse_vector_u32

Definition at line 53 of file rscsample01.cpp.

Function Documentation

◆ main()

◆ print_svector()

template<class SV>
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, const_iterator is preferred in many cases (better performance).

Definition at line 61 of file rscsample01.cpp.

Referenced by main().

◆ print_svector2()

template<class SV>
void print_svector2 ( const SV & sv,
bool show_nulls = false )

Prints succinct vector using try_get() random access method.

Examples
rscsample01.cpp.

Definition at line 89 of file rscsample01.cpp.

Referenced by main().