|
BitMagic-C++
|
Base class for bit-transposed sparse vector construction. More...
#include <bmbmatrix.h>

Public Types | |
| enum | bit_plains { sv_plains = (sizeof(Val) * 8 * MAX_SIZE + 1) , sv_value_plains = (sizeof(Val) * 8 * MAX_SIZE) } |
| enum | vector_capacity { max_vector_size = MAX_SIZE } |
| typedef Val | value_type |
| typedef BV | bvector_type |
| typedef BV::size_type | size_type |
| typedef bvector_type * | bvector_type_ptr |
| typedef const bvector_type * | bvector_type_const_ptr |
| typedef const value_type & | const_reference |
| typedef BV::allocator_type | allocator_type |
| typedef bvector_type::allocation_policy | allocation_policy_type |
| typedef bvector_type::enumerator | bvector_enumerator_type |
| typedef allocator_type::allocator_pool_type | allocator_pool_type |
| typedef bm::basic_bmatrix< BV > | bmatrix_type |
Public Member Functions | |
| base_sparse_vector () | |
| base_sparse_vector (bm::null_support null_able, allocation_policy_type ap, size_type bv_max_size, const allocator_type &alloc) | |
| base_sparse_vector (const base_sparse_vector< Val, BV, MAX_SIZE > &bsv) | |
| base_sparse_vector (base_sparse_vector< Val, BV, MAX_SIZE > &&bsv) BMNOEXCEPT | |
| void | swap (base_sparse_vector< Val, BV, MAX_SIZE > &bsv) BMNOEXCEPT |
| size_type | size () const BMNOEXCEPT |
| void | resize (size_type new_size) |
| void | clear_range (size_type left, size_type right, bool set_null) |
| void | clear () BMNOEXCEPT |
| resize to zero, free memory | |
| bool | empty () const BMNOEXCEPT |
| void | optimize (bm::word_t *temp_block=0, typename bvector_type::optmode opt_mode=bvector_type::opt_compress, typename bvector_type::statistics *stat=0) |
| run memory optimization for all bit-vector rows | |
| void | calc_stat (typename bvector_type::statistics *st) const BMNOEXCEPT |
| Calculates memory statistics. | |
| bool | equal (const base_sparse_vector< Val, BV, MAX_SIZE > &sv, bm::null_support null_able=bm::use_null) const BMNOEXCEPT |
| check if another sparse vector has the same content and size | |
Various traits | |
| bool | is_nullable () const BMNOEXCEPT |
| check if container supports NULL(unassigned) values | |
| const bvector_type * | get_null_bvector () const BMNOEXCEPT |
| Get bit-vector of assigned values or NULL (if not constructed that way). | |
| bool | is_null (size_type idx) const BMNOEXCEPT |
| test if specified element is NULL | |
Protected Types | |
| typedef bvector_type::block_idx_type | block_idx_type |
Protected Member Functions | |
| void | copy_from (const base_sparse_vector< Val, BV, MAX_SIZE > &bsv) |
| void | clear_value_plains_from (unsigned plain_idx, size_type idx) |
| void | insert_clear_value_plains_from (unsigned plain_idx, size_type idx) |
| void | erase_column (size_type idx) |
| void | insert_null (size_type idx, bool not_null) |
| void | optimize_block (block_idx_type nb) |
| optimize block in all matrix plains | |
| void | copy_range_plains (const base_sparse_vector< Val, BV, MAX_SIZE > &bsv, typename base_sparse_vector< Val, BV, MAX_SIZE >::size_type left, typename base_sparse_vector< Val, BV, MAX_SIZE >::size_type right, bm::null_support splice_null) |
| Perform copy_range() on a set of plains. | |
Static Protected Member Functions | |
| static unsigned | value_bits () BMNOEXCEPT |
| Number of total bit-plains in the value type. | |
| static unsigned | null_plain () BMNOEXCEPT |
| plain index for the "NOT NULL" flags plain | |
Protected Attributes | |
| bmatrix_type | bmatr_ |
| bit-transposed matrix | |
| size_type | size_ |
| array size | |
| unsigned | effective_plains_ |
Access to internals | |
| bvector_type_ptr | get_plain (unsigned i) |
| get access to bit-plain, function checks and creates a plain | |
| bvector_type_const_ptr | get_plain (unsigned i) const BMNOEXCEPT |
| get read-only access to bit-plain | |
| unsigned | effective_plains () const BMNOEXCEPT |
| Number of effective bit-plains in the value type. | |
| bvector_type_ptr | plain (unsigned i) BMNOEXCEPT |
| get access to bit-plain as is (can return NULL) | |
| bvector_type_const_ptr | plain (unsigned i) const BMNOEXCEPT |
| bvector_type * | get_null_bvect () |
| void | free_plain (unsigned i) |
| free memory in bit-plain | |
| bm::id64_t | get_plains_mask (unsigned element_idx) const BMNOEXCEPT |
| const bmatrix_type & | get_bmatrix () const BMNOEXCEPT |
| static unsigned | plains () BMNOEXCEPT |
| get total number of bit-plains in the vector | |
| static unsigned | stored_plains () BMNOEXCEPT |
| Number of stored bit-plains (value plains + extra. | |
Base class for bit-transposed sparse vector construction.
Definition at line 253 of file bmbmatrix.h.
| typedef bvector_type::allocation_policy bm::base_sparse_vector< Val, BV, MAX_SIZE >::allocation_policy_type |
Definition at line 274 of file bmbmatrix.h.
| typedef allocator_type::allocator_pool_type bm::base_sparse_vector< Val, BV, MAX_SIZE >::allocator_pool_type |
Definition at line 276 of file bmbmatrix.h.
| typedef BV::allocator_type bm::base_sparse_vector< Val, BV, MAX_SIZE >::allocator_type |
Definition at line 273 of file bmbmatrix.h.
|
protected |
Definition at line 468 of file bmbmatrix.h.
| typedef bm::basic_bmatrix<BV> bm::base_sparse_vector< Val, BV, MAX_SIZE >::bmatrix_type |
Definition at line 277 of file bmbmatrix.h.
| typedef bvector_type::enumerator bm::base_sparse_vector< Val, BV, MAX_SIZE >::bvector_enumerator_type |
Definition at line 275 of file bmbmatrix.h.
| typedef BV bm::base_sparse_vector< Val, BV, MAX_SIZE >::bvector_type |
Definition at line 268 of file bmbmatrix.h.
| typedef const bvector_type* bm::base_sparse_vector< Val, BV, MAX_SIZE >::bvector_type_const_ptr |
Definition at line 271 of file bmbmatrix.h.
| typedef bvector_type* bm::base_sparse_vector< Val, BV, MAX_SIZE >::bvector_type_ptr |
Definition at line 270 of file bmbmatrix.h.
| typedef const value_type& bm::base_sparse_vector< Val, BV, MAX_SIZE >::const_reference |
Definition at line 272 of file bmbmatrix.h.
| typedef BV::size_type bm::base_sparse_vector< Val, BV, MAX_SIZE >::size_type |
Definition at line 269 of file bmbmatrix.h.
| typedef Val bm::base_sparse_vector< Val, BV, MAX_SIZE >::value_type |
Definition at line 267 of file bmbmatrix.h.
| enum bm::base_sparse_vector::bit_plains |
| Enumerator | |
|---|---|
| sv_plains | |
| sv_value_plains | |
Definition at line 256 of file bmbmatrix.h.
| enum bm::base_sparse_vector::vector_capacity |
| Enumerator | |
|---|---|
| max_vector_size | |
Definition at line 262 of file bmbmatrix.h.
| bm::base_sparse_vector< Val, BV, MAX_SIZE >::base_sparse_vector | ( | ) |
Definition at line 1135 of file bmbmatrix.h.
References bmatr_, effective_plains_, bm::id_max, size_, and sv_plains.
Referenced by base_sparse_vector(), copy_from(), copy_range_plains(), equal(), and swap().
| bm::base_sparse_vector< Val, BV, MAX_SIZE >::base_sparse_vector | ( | bm::null_support | null_able, |
| allocation_policy_type | ap, | ||
| size_type | bv_max_size, | ||
| const allocator_type & | alloc ) |
Definition at line 1145 of file bmbmatrix.h.
References bmatr_, effective_plains_, null_plain(), size_, sv_plains, and bm::use_null.
| bm::base_sparse_vector< Val, BV, MAX_SIZE >::base_sparse_vector | ( | const base_sparse_vector< Val, BV, MAX_SIZE > & | bsv | ) |
Definition at line 1164 of file bmbmatrix.h.
References base_sparse_vector(), bmatr_, effective_plains_, and size_.
|
inline |
move-ctor
Definition at line 291 of file bmbmatrix.h.
| void bm::base_sparse_vector< Val, BV, MAX_SIZE >::calc_stat | ( | typename bvector_type::statistics * | st | ) | const |
Calculates memory statistics.
Function fills statistics structure containing information about how this vector uses memory and estimation of max. amount of memory bvector needs to serialize itself.
| st | - pointer on statistics structure to be filled in. |
Definition at line 1375 of file bmbmatrix.h.
References bm::bv_statistics::add(), BM_ASSERT, bmatr_, BMNOEXCEPT, and stored_plains().
| void bm::base_sparse_vector< Val, BV, MAX_SIZE >::clear | ( | ) |
resize to zero, free memory
Definition at line 1223 of file bmbmatrix.h.
References bmatr_, BMNOEXCEPT, get_null_bvect(), plains(), size_, and value_bits().
Referenced by resize().
| void bm::base_sparse_vector< Val, BV, MAX_SIZE >::clear_range | ( | size_type | left, |
| size_type | right, | ||
| bool | set_null ) |
Definition at line 1239 of file bmbmatrix.h.
References bmatr_, clear_range(), get_null_bvect(), plains(), and value_bits().
Referenced by clear_range(), and resize().
|
protected |
clear column in all value plains
| plain_idx | - row (plain index to start from) |
| idx | - bit (column) to clear |
Definition at line 1406 of file bmbmatrix.h.
References bmatr_, and sv_value_plains.
|
protected |
Definition at line 1175 of file bmbmatrix.h.
References base_sparse_vector(), bmatr_, effective_plains_, null_plain(), plains(), resize(), bm::basic_bmatrix< BV >::row(), size(), size_, and stored_plains().
|
protected |
Perform copy_range() on a set of plains.
Definition at line 1504 of file bmbmatrix.h.
References base_sparse_vector(), bmatr_, get_null_bvect(), get_null_bvector(), get_plain(), plains(), bm::basic_bmatrix< BV >::row(), stored_plains(), and bm::use_null.
|
inline |
Number of effective bit-plains in the value type.
Definition at line 370 of file bmbmatrix.h.
|
inline |
return true if empty
Definition at line 312 of file bmbmatrix.h.
| bool bm::base_sparse_vector< Val, BV, MAX_SIZE >::equal | ( | const base_sparse_vector< Val, BV, MAX_SIZE > & | sv, |
| bm::null_support | null_able = bm::use_null ) const |
check if another sparse vector has the same content and size
| sv | - sparse vector for comparison |
| null_able | - flag to consider NULL vector in comparison (default) or compare only value content plains |
Definition at line 1447 of file bmbmatrix.h.
References base_sparse_vector(), BM_ASSERT, bmatr_, BMNOEXCEPT, get_null_bvector(), plains(), size_, and bm::use_null.
|
protected |
erase bit (column) from all plains
| idx | - bit (column) to erase |
Definition at line 1434 of file bmbmatrix.h.
References bmatr_, and sv_value_plains.
|
inline |
free memory in bit-plain
Definition at line 385 of file bmbmatrix.h.
|
inline |
get read-only access to inetrnal bit-matrix
Definition at line 401 of file bmbmatrix.h.
|
inline |
Definition at line 380 of file bmbmatrix.h.
Referenced by clear(), clear_range(), copy_range_plains(), insert_null(), and optimize().
|
inline |
Get bit-vector of assigned values or NULL (if not constructed that way).
Definition at line 329 of file bmbmatrix.h.
Referenced by copy_range_plains(), equal(), generate_random_subset(), is_null(), main(), and print_sorted().
| base_sparse_vector< Val, BV, MAX_SIZE >::bvector_type_ptr bm::base_sparse_vector< Val, BV, MAX_SIZE >::get_plain | ( | unsigned | i | ) |
get access to bit-plain, function checks and creates a plain
Definition at line 1307 of file bmbmatrix.h.
References bmatr_, effective_plains_, and value_bits().
Referenced by copy_range_plains(), and get_plains_mask().
|
inline |
get read-only access to bit-plain
Definition at line 358 of file bmbmatrix.h.
| bm::id64_t bm::base_sparse_vector< Val, BV, MAX_SIZE >::get_plains_mask | ( | unsigned | element_idx | ) | const |
return mask of allocated bit-plains 1 in the mask - means bit-plain N is present returns 64-bit unsigned mask for sub 64-bit types (like int) unallocated mask bits will be zero extended
Definition at line 1323 of file bmbmatrix.h.
References BM_ASSERT, BMNOEXCEPT, get_plain(), and plains().
|
protected |
insert false (clear) column in all value plains
| plain_idx | - row (plain index to start from) |
| idx | - bit (column) to clear insert |
Definition at line 1420 of file bmbmatrix.h.
References bmatr_, and sv_value_plains.
|
protected |
| bool bm::base_sparse_vector< Val, BV, MAX_SIZE >::is_null | ( | size_type | idx | ) | const |
test if specified element is NULL
| idx | - element index |
Definition at line 1285 of file bmbmatrix.h.
References BMNOEXCEPT, and get_null_bvector().
Referenced by print_svector().
|
inline |
check if container supports NULL(unassigned) values
Definition at line 322 of file bmbmatrix.h.
Referenced by bm::sparse_vector< Val, BV >::join(), and bm::sparse_vector< Val, BV >::merge().
|
inlinestaticprotected |
plain index for the "NOT NULL" flags plain
Definition at line 477 of file bmbmatrix.h.
Referenced by base_sparse_vector(), copy_from(), bm::base_sparse_vector< Val, BV, 1 >::get_null_bvect(), bm::base_sparse_vector< Val, BV, 1 >::get_null_bvector(), and bm::base_sparse_vector< Val, BV, 1 >::is_nullable().
| void bm::base_sparse_vector< Val, BV, MAX_SIZE >::optimize | ( | bm::word_t * | temp_block = 0, |
| typename bvector_type::optmode | opt_mode = bvector_type::opt_compress, | ||
| typename bvector_type::statistics * | stat = 0 ) |
run memory optimization for all bit-vector rows
| temp_block | - pre-allocated memory block to avoid unnecessary re-allocs |
| opt_mode | - requested compression depth |
| stat | - memory allocation statistics after optimization |
Definition at line 1345 of file bmbmatrix.h.
References bm::bv_statistics::add(), bmatr_, get_null_bvect(), and stored_plains().
|
inlineprotected |
optimize block in all matrix plains
Definition at line 480 of file bmbmatrix.h.
|
inline |
get access to bit-plain as is (can return NULL)
Definition at line 376 of file bmbmatrix.h.
Referenced by bm::str_sparse_vector< char, bm::bvector<>, 64 >::import_no_check().
|
inline |
Definition at line 377 of file bmbmatrix.h.
|
inlinestatic |
get total number of bit-plains in the vector
Definition at line 363 of file bmbmatrix.h.
Referenced by clear(), clear_range(), copy_from(), copy_range_plains(), equal(), get_plains_mask(), and bm::rsc_sparse_vector< unsigned, sparse_vector_u32 >::plains().
| void bm::base_sparse_vector< Val, BV, MAX_SIZE >::resize | ( | size_type | new_size | ) |
Definition at line 1267 of file bmbmatrix.h.
References clear(), clear_range(), size(), and size_.
Referenced by copy_from().
|
inline |
Definition at line 302 of file bmbmatrix.h.
Referenced by copy_from(), bm::base_sparse_vector< Val, BV, 1 >::empty(), and resize().
|
inlinestatic |
Number of stored bit-plains (value plains + extra.
Definition at line 366 of file bmbmatrix.h.
Referenced by calc_stat(), copy_from(), copy_range_plains(), optimize(), and bm::rsc_sparse_vector< unsigned, sparse_vector_u32 >::stored_plains().
| void bm::base_sparse_vector< Val, BV, MAX_SIZE >::swap | ( | base_sparse_vector< Val, BV, MAX_SIZE > & | bsv | ) |
Definition at line 1208 of file bmbmatrix.h.
References base_sparse_vector(), bmatr_, BMNOEXCEPT, effective_plains_, size_, and bm::xor_swap().
|
inlinestaticprotected |
Number of total bit-plains in the value type.
Definition at line 471 of file bmbmatrix.h.
Referenced by clear(), clear_range(), get_plain(), bm::base_sparse_vector< Val, BV, 1 >::null_plain(), bm::base_sparse_vector< Val, BV, 1 >::plains(), and bm::base_sparse_vector< Val, BV, 1 >::stored_plains().
|
protected |
bit-transposed matrix
Definition at line 495 of file bmbmatrix.h.
Referenced by bm::str_sparse_vector< char, bm::bvector<>, 64 >::assign(), base_sparse_vector(), base_sparse_vector(), base_sparse_vector(), calc_stat(), clear(), clear_range(), clear_value_plains_from(), copy_from(), copy_range_plains(), bm::str_sparse_vector< char, bm::bvector<>, 64 >::decode(), equal(), erase_column(), bm::str_sparse_vector< char, bm::bvector<>, 64 >::get(), get_plain(), bm::str_sparse_vector< char, bm::bvector<>, 64 >::import_no_check(), insert_clear_value_plains_from(), bm::sparse_vector< Val, BV >::join(), bm::sparse_vector< Val, BV >::merge(), optimize(), and swap().
|
protected |
Definition at line 497 of file bmbmatrix.h.
Referenced by base_sparse_vector(), base_sparse_vector(), base_sparse_vector(), copy_from(), get_plain(), and swap().
|
protected |
array size
Definition at line 496 of file bmbmatrix.h.
Referenced by bm::str_sparse_vector< char, bm::bvector<>, 64 >::assign(), base_sparse_vector(), base_sparse_vector(), base_sparse_vector(), clear(), copy_from(), equal(), bm::str_sparse_vector< char, bm::bvector<>, 64 >::import(), bm::str_sparse_vector< char, bm::bvector<>, 64 >::import_no_check(), bm::str_sparse_vector< char, bm::bvector<>, 64 >::push_back(), bm::str_sparse_vector< char, bm::bvector<>, 64 >::push_back(), resize(), bm::sparse_vector< unsigned, bm::bvector<> >::size(), bm::str_sparse_vector< char, bm::bvector<>, 64 >::size(), and swap().