Search Toolkit Book for bm::sparse_vector
succinct sparse vector with runtime compression using bit-slicing / transposition method More...
#include <util/bitset/bmsparsevec.h>
succinct sparse vector with runtime compression using bit-slicing / transposition method
Sparse vector implements variable bit-depth storage model. Initial data is bit-sliced into bit-vectors (all bits 0 become bv[0] so each element may use less memory than the original native data type. For example, 32-bit integer may only use 20 bits.
Container supports both signed and unsigned integer types.
Another level of compression is provided by bit-vector (BV template parameter) used for storing bit planes. bvector<> implements varians of on the fly block compression, so if a significant area of a sparse vector uses less bits - it will save memory. bm::bvector<> is a sparse data strucrture, so is bm::sparse_vector<>. It should be noted that as succinct data it works for both sparse or dense vectors.
Container also supports notion of NULL (unassigned value) which can be treated differently than 0.
Definition at line 86 of file bmsparsevec.h.
◆ allocation_policy_typetemplate<class Val , class BV >
Definition at line 97 of file bmsparsevec.h.
◆ allocator_pool_typetemplate<class Val , class BV >
Definition at line 99 of file bmsparsevec.h.
◆ allocator_typetemplate<class Val , class BV >
Definition at line 96 of file bmsparsevec.h.
◆ block_idx_typetemplate<class Val , class BV >
Definition at line 93 of file bmsparsevec.h.
◆ bmatrix_type ◆ bvector_enumerator_typetemplate<class Val , class BV >
Definition at line 98 of file bmsparsevec.h.
◆ bvector_typetemplate<class Val , class BV >
Definition at line 90 of file bmsparsevec.h.
◆ bvector_type_const_ptrtemplate<class Val , class BV >
Definition at line 94 of file bmsparsevec.h.
◆ bvector_type_ptrtemplate<class Val , class BV >
Definition at line 91 of file bmsparsevec.h.
◆ const_referencetemplate<class Val , class BV >
Definition at line 95 of file bmsparsevec.h.
◆ parent_type ◆ remap_matrix_typetemplate<class Val , class BV >
unused remap matrix type for compatibility with the sparse serializer
Definition at line 1032 of file bmsparsevec.h.
◆ size_typetemplate<class Val , class BV >
Definition at line 92 of file bmsparsevec.h.
◆ unsigned_value_type ◆ value_typetemplate<class Val , class BV >
Definition at line 89 of file bmsparsevec.h.
◆ buf_size_etemplate<class Val , class BV >
◆ octet_slicestemplate<class Val , class BV >
◆ sparse_vector() [1/3]template<class Val , class BV >
Sparse vector constructor.
Definition at line 1098 of file bmsparsevec.h.
◆ sparse_vector() [2/3]template<class Val , class BV >
◆ sparse_vector() [3/3]template<class Val , class BV >
◆ ~sparse_vector() ◆ at()template<class Val , class BV >
◆ begin()template<class Val , class BV >
◆ calc_stat()template<class Val , class BV >
◆ clear() [1/3]template<class Val , class BV >
◆ clear() [2/3]template<class Val , class BV >
Set vector elements spcified by argument bit-vector to zero Note that set to 0 elements are NOT going to tuned to NULL (NULL qualifier is preserved)
Definition at line 553 of file bmsparsevec.h.
◆ clear() [3/3]template<class Val , class BV >
◆ clear_all()template<class Val , class BV >
◆ clear_range()template<class Val , class BV >
clear range (assign bit 0 for all planes)
Definition at line 2120 of file bmsparsevec.h.
Referenced by TestSparseVector().
◆ compare()template<class Val , class BV >
Compare vector element with argument.
Definition at line 2289 of file bmsparsevec.h.
References val.
◆ copy_range()template<class Val , class BV >
◆ decode()template<class Val , class BV >
Bulk export list of elements to a C-style array.
For efficiency, this is left as a low level function, it does not do any bounds checking on the target array, it will override memory and crash if you are not careful with allocation and request size.
Definition at line 1354 of file bmsparsevec.h.
References arr.
Referenced by CheckSparseVectorGather(), CBedCoverageGraph::GetData(), CBedCoverageGraph::GetEstimatedFeatureCount(), and TestSparseVectorGatherDecode().
◆ effective_size()template<class Val , class BV >
size of sparse vector (may be different for RSC)
Definition at line 976 of file bmsparsevec.h.
◆ effective_vector_max()template<class Val , class BV >
◆ empty()template<class Val , class BV >
◆ end()template<class Val , class BV >
◆ equal()template<class Val , class BV >
◆ erase()template<class Val , class BV >
erase specified element from container
Definition at line 1975 of file bmsparsevec.h.
References BM_ASSERT.
Referenced by TestSparseVector().
◆ extract()template<class Val , class BV >
Bulk export list of elements to a C-style array.
Use of all extract() methods is restricted. Please consider decode() for the same purpose.
Definition at line 1658 of file bmsparsevec.h.
References arr, BM_ASSERT, BMNOEXCEPT, BMNOEXCEPT2, BMRESTRICT, bm::for_each_bit_range_no_check(), i, bm::id_max, mask, offset, and ncbi::grid::netcache::search::fields::size.
Referenced by TestSignedSparseVector(), and TestSparseVector().
◆ extract_planes()template<class Val , class BV >
◆ extract_range()template<class Val , class BV >
extract small window without use of masking vector
Definition at line 1531 of file bmsparsevec.h.
References arr, BM_ASSERT, BM_IS_GAP, BMGAP_PTR, bool, FULL_BLOCK_FAKE_ADDR, bm::gap_test_unr(), bm::get_block_coord(), IS_FULL_BLOCK, offset, bm::set_block_mask, bm::set_block_shift, bm::set_word_mask, bm::set_word_shift, and ncbi::grid::netcache::search::fields::size.
Referenced by TestSparseVector().
◆ filter()template<class Val , class BV >
◆ find_rank()template<class Val , class BV >
◆ freeze()template<class Val , class BV >
Turn sparse vector into immutable mode Read-only (immutable) vector uses less memory and allows faster searches.
Before freezing it is recommenede to call optimize() to get full memory saving effect
Definition at line 824 of file bmsparsevec.h.
Referenced by TestSparseVector().
◆ gather()template<class Val , class BV >
Gather elements to a C-style array.
Gather collects values from different locations, for best performance feed it with sorted list of indexes.
Faster than one-by-one random access.
For efficiency, this is left as a low level function, it does not do any bounds checking on the target array, it will override memory and crash if you are not careful with allocation and request size.
Definition at line 1366 of file bmsparsevec.h.
References arr, bm::bit_block_gather_scatter(), BM_ASSERT, BM_IS_GAP, bm::BM_SORTED, bm::BM_SORTED_UNIFORM, bm::BM_UNKNOWN, bm::BM_UNSORTED, BMGAP_PTR, FULL_BLOCK_FAKE_ADDR, bm::gap_bfind(), bm::gap_test_unr(), bm::get_block_coord(), i, bm::id_max, bm::idx_arr_block_lookup_u32(), bm::idx_arr_block_lookup_u64(), r(), bm::set_block_mask, bm::set_block_shift, and ncbi::grid::netcache::search::fields::size.
Referenced by CheckSparseVectorGather(), CheckSparseVectorGatherRandom(), TestSignedSparseVector(), and TestSparseVectorGatherDecode().
◆ get()template<class Val , class BV >
get specified element without bounds checking
Definition at line 1758 of file bmsparsevec.h.
References BM_ASSERT, i, and ncbi::grid::netcache::search::fields::size.
Referenced by CheckSparseVectorFilter(), CheckSparseVectorGather(), CheckSparseVectorGatherRandom(), bm::sparse_vector< unsigned, bm::bvector<> >::operator[](), TestCompressedSparseVectorAlgo(), TestSignedSparseVector(), TestSignedSparseVectorSerial(), TestSparseVector(), TestSparseVectorFilter(), TestSparseVectorSerial(), and TestSparseVectorSerialization2().
◆ get_back_inserter()template<class Val , class BV >
Provide back insert iterator Back insert iterator implements buffered insertion, which is faster, than random access or push_back.
Definition at line 587 of file bmsparsevec.h.
Referenced by CVCFVariantsBase::GetHistogram(), TestSignedSparseVector(), TestSignedSparseVectorScan(), TestSignedSparseVectorScanGT(), TestSparseVector(), TestSparseVectorGatherDecode(), TestSparseVectorInserter(), TestSparseVectorScan(), and TestSparseVectorScanGT().
◆ get_const_iterator()template<class Val , class BV >
Get const_itertor re-positioned to specific element.
Definition at line 580 of file bmsparsevec.h.
◆ get_no_check()template<class Val , class BV >
get specified element without checking boundary conditions
Definition at line 1769 of file bmsparsevec.h.
References i.
◆ get_remap_buffer() ◆ get_remap_matrix() [1/2] ◆ get_remap_matrix() [2/2] ◆ get_unsigned()template<class Val , class BV >
◆ get_unsigned_bits()template<class Val , class BV >
Get raw unsigned value first N bits.
Definition at line 1809 of file bmsparsevec.h.
References b, BM_ASSERT, and bm::id_max.
Referenced by TestSparseVector().
◆ import()template<class Val , class BV >
◆ import_back()template<class Val , class BV >
◆ import_back_u()template<class Val , class BV >
◆ import_u()template<class Val , class BV >
Import list of elements from a C-style array.
Definition at line 1203 of file bmsparsevec.h.
◆ import_u_nocheck()template<class Val , class BV >
Definition at line 1220 of file bmsparsevec.h.
References arr, bm::bitscan(), BM_ASSERT, i, offset, r(), row, bm::tmatrix< T, ROWS, COLS >::row(), and bm::tmatrix< T, ROWS, COLS >::rows().
◆ inc()template<class Val , class BV >
◆ inc_no_null() [1/2]template<class Val , class BV >
Increment element by 1 without chnaging NULL vector or size.
Definition at line 2069 of file bmsparsevec.h.
◆ inc_no_null() [2/2]template<class Val , class BV >
increment by v without chnaging NULL vector or size
Definition at line 2092 of file bmsparsevec.h.
◆ init_remap_buffer() ◆ insert()template<class Val , class BV >
◆ insert_value()template<class Val , class BV >
insert value without checking boundaries
Definition at line 1930 of file bmsparsevec.h.
◆ insert_value_no_null()template<class Val , class BV >
◆ is_compressed()template<class Val , class BV >
inlinestaticconstexprnoexcept ◆ is_remap()template<class Val , class BV >
inlineconstexprprotectednoexceptDefinition at line 1024 of file bmsparsevec.h.
◆ is_ro()template<class Val , class BV >
◆ is_str()template<class Val , class BV >
inlinestaticconstexprnoexceptDefinition at line 602 of file bmsparsevec.h.
◆ join()template<class Val , class BV >
join all with another sparse vector using OR operation
Definition at line 2181 of file bmsparsevec.h.
References bm::base_sparse_vector< Val, BV, MAX_SIZE >::bmatr_, bm::base_sparse_vector< Val, BV, MAX_SIZE >::get_bmatrix(), pythonpp::resize(), bm::basic_bmatrix< BV >::row(), bm::basic_bmatrix< BV >::rows(), and bm::sparse_vector< Val, BV >::size().
Referenced by TestSparseVector(), and TestSparseVector_Stress().
◆ join_null_slice()template<class Val , class BV >
◆ keep_range()template<class Val , class BV >
Keep only specified interval in the sparse vector, clear all other elements.
Definition at line 2263 of file bmsparsevec.h.
References bm::xor_swap().
Referenced by TestSparseVector().
◆ merge()template<class Val , class BV >
◆ operator=() [1/2]template<class Val , class BV >
◆ operator=() [2/2]template<class Val , class BV >
◆ operator[]() [1/2]template<class Val , class BV >
get specified element without bounds checking
Definition at line 442 of file bmsparsevec.h.
◆ operator[]() [2/2]template<class Val , class BV >
Operator to get write access to an element.
Definition at line 434 of file bmsparsevec.h.
◆ optimize()template<class Val , class BV >
run memory optimization for all vector planes
Definition at line 2148 of file bmsparsevec.h.
References st().
Referenced by CVCFVariantsBase::GetHistogram(), CTestBMApp::Run(), CVcfHistogram::Save(), TestCompressedSparseVectorAlgo(), TestCompressedSparseVectorScanGT(), TestCompressSparseSignedVector(), TestCompressSparseVector(), TestSignedSparseVector(), TestSignedSparseVectorScan(), TestSignedSparseVectorScanGT(), TestSparseVector(), TestSparseVector_Stress(), TestSparseVector_XOR_Scanner(), TestSparseVectorAlgo(), TestSparseVectorGatherDecode(), TestSparseVectorInserter(), TestSparseVectorRange(), TestSparseVectorScan(), TestSparseVectorScanGT(), TestSparseVectorSerialization2(), TestSparseVectorTransform(), CWigGraph::x_GetBigWigSummary(), and CBedCoverageGraph::x_SaveData().
◆ optimize_gap_size()template<class Val , class BV >
Optimize sizes of GAP blocks.
This method runs an analysis to find optimal GAP levels for all bit planes of the vector.
Definition at line 2167 of file bmsparsevec.h.
◆ push_back()template<class Val , class BV >
push value back into vector
Definition at line 1883 of file bmsparsevec.h.
Referenced by TestCompressedSparseVectorScanGT(), TestSignedSparseVector(), TestSignedSparseVectorScanGT(), TestSignedSparseVectorSerial(), TestSparseVector(), TestSparseVector_XOR_Scanner(), TestSparseVectorAlgo(), TestSparseVectorFilter(), TestSparseVectorRange(), TestSparseVectorScanGT(), and TestSparseVectorSerial().
◆ push_back_no_null()template<class Val , class BV >
push value back into vector without NULL semantics
Definition at line 1988 of file bmsparsevec.h.
◆ push_back_null() [1/2]template<class Val , class BV >
◆ push_back_null() [2/2]template<class Val , class BV >
◆ remap_size() ◆ resize()template<class Val , class BV >
◆ resize_internal() ◆ resolve_range() ◆ set()template<class Val , class BV >
set specified element with bounds checking and automatic resize
Definition at line 1849 of file bmsparsevec.h.
References ncbi::grid::netcache::search::fields::size.
Referenced by CVCFVariantsBase::GetHistogram(), TestCompressSparseSignedVector(), TestCompressSparseVector(), TestSignedSparseVector(), TestSignedSparseVectorScan(), TestSignedSparseVectorSerial(), TestSparseVector(), TestSparseVector_XOR_Scanner(), TestSparseVectorFilter(), TestSparseVectorInserter(), TestSparseVectorRange(), TestSparseVectorScan(), TestSparseVectorSerial(), TestSparseVectorSerialization2(), and TestSparseVectorTransform().
◆ set_allocator_pool()template<class Val , class BV >
Set allocator pool for local (non-threaded) memory cyclic(lots of alloc-free ops) opertations.
Definition at line 2319 of file bmsparsevec.h.
◆ set_null() [1/2]template<class Val , class BV >
Set NULL all elements set as 1 in the argument vector.
Function also clears all the values to 0.
Definition at line 545 of file bmsparsevec.h.
◆ set_null() [2/2]template<class Val , class BV >
◆ set_remap() ◆ set_value()template<class Val , class BV >
◆ set_value_no_null()template<class Val , class BV >
◆ size()template<class Val , class BV >
return size of the vector
Definition at line 728 of file bmsparsevec.h.
Referenced by CheckSparseVectorGather(), CheckSparseVectorGatherRandom(), bm::sparse_vector< Val, BV >::copy_range(), bm::sparse_vector< unsigned, bm::bvector<> >::effective_size(), bm::sparse_vector< unsigned, bm::bvector<> >::empty(), CVcfHistogram::InitHistogramGlyph(), bm::sparse_vector< Val, BV >::join(), bm::sparse_vector< Val, BV >::join_null_slice(), bm::sparse_vector< Val, BV >::merge(), TestUtil::PrintSequence(), bm::sparse_vector< unsigned, bm::bvector<> >::size_internal(), TestCompressSparseVector(), TestSignedSparseVector(), TestSignedSparseVectorScanGT(), TestSignedSparseVectorSerial(), TestSparseVector(), TestSparseVector_Stress(), TestSparseVectorFilter(), and TestSparseVectorSerial().
◆ size_internal() ◆ swap() [1/2]template<class Val , class BV >
◆ swap() [2/2]template<class Val , class BV >
◆ sync()template<class Val , class BV >
syncronize internal structures, build fast access index
Definition at line 903 of file bmsparsevec.h.
◆ sync_size()template<class Val , class BV >
◆ throw_bad_alloc()template<class Val , class BV >
◆ throw_range_error()template<class Val , class BV >
◆ translate_address()template<class Val , class BV >
address translation for this type of container
Definition at line 950 of file bmsparsevec.h.
◆ try_get()template<class Val , class BV >
get specified element with NOT NULL check
Definition at line 1836 of file bmsparsevec.h.
Referenced by TestSparseVector().
◆ u2s_translate()template<class Val , class BV >
◆ rsc_sparse_vectortemplate<class Val , class BV >
template<class V , class SV >
Definition at line 1085 of file bmsparsevec.h.
◆ sparse_vector_deserializertemplate<class Val , class BV >
template<class SVect >
Definition at line 1088 of file bmsparsevec.h.
◆ sparse_vector_scannertemplate<class Val , class BV >
template<class SVect , unsigned S_FACTOR>
Definition at line 1086 of file bmsparsevec.h.
◆ sparse_vector_serializertemplate<class Val , class BV >
template<class SVect >
Definition at line 1087 of file bmsparsevec.h.
◆ back_insert_iteratortemplate<class Val , class BV >
◆ const_iteratorThe documentation for this class was generated from the following files:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4