BitMagic-C++
|
Basic dense bit-matrix class. More...
#include <bmbmatrix.h>
Public Types | |
typedef BV | bvector_type |
typedef bvector_type * | bvector_type_ptr |
typedef BV::allocator_type | allocator_type |
typedef bvector_type::allocation_policy | allocation_policy_type |
typedef allocator_type::allocator_pool_type | allocator_pool_type |
typedef bvector_type::size_type | size_type |
typedef bvector_type::block_idx_type | block_idx_type |
typedef unsigned char | octet_type |
Public Member Functions | |
Construction, assignment | |
| |
basic_bmatrix (size_type rsize, allocation_policy_type ap=allocation_policy_type(), size_type bv_max_size=bm::id_max, const allocator_type &alloc=allocator_type()) | |
~basic_bmatrix () BMNOEXEPT | |
basic_bmatrix (const basic_bmatrix< BV > &bbm) | |
basic_bmatrix< BV > & | operator= (const basic_bmatrix< BV > &bbm) |
basic_bmatrix (basic_bmatrix< BV > &&bbm) BMNOEXEPT | |
basic_bmatrix< BV > & | operator= (basic_bmatrix< BV > &&bbm) BMNOEXEPT |
void | set_allocator_pool (allocator_pool_type *pool_ptr) |
content manipulation | |
| |
void | swap (basic_bmatrix< BV > &bbm) BMNOEXEPT |
void | copy_from (const basic_bmatrix< BV > &bbm) |
row access | |
| |
const bvector_type * | row (size_type i) const |
bvector_type_const_ptr | get_row (size_type i) const |
bvector_type * | get_row (size_type i) |
size_type | rows () const |
bvector_type_ptr | construct_row (size_type row) |
bvector_type_ptr | construct_row (size_type row, const bvector_type &bv) |
void | destruct_row (size_type row) |
octet access and transposition | |
| |
void | set_octet (size_type pos, size_type octet_idx, unsigned char octet) |
void | insert_octet (size_type pos, size_type octet_idx, unsigned char octet) |
unsigned char | get_octet (size_type pos, size_type octet_idx) const |
int | compare_octet (size_type pos, size_type octet_idx, char octet) const |
Utility function | |
| |
bool | test_4rows (unsigned i) const |
Test if 4 rows from i are not NULL. More... | |
const bm::word_t * | get_block (size_type p, unsigned i, unsigned j) const |
Get low level internal access to. More... | |
unsigned | get_half_octet (size_type pos, size_type row_idx) const |
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 More... | |
Data Fields | |
const typedef bvector_type * | bvector_type_const_ptr |
Protected Member Functions | |
void | allocate_rows (size_type rsize) |
void | free_rows () BMNOEXEPT |
bvector_type * | construct_bvector (const bvector_type *bv) const |
void | destruct_bvector (bvector_type *bv) const |
Static Protected Member Functions | |
static void | throw_bad_alloc () |
Protected Attributes | |
size_type | bv_size_ |
allocator_type | alloc_ |
allocation_policy_type | ap_ |
allocator_pool_type * | pool_ |
bvector_type_ptr * | bv_rows_ |
size_type | rsize_ |
Basic dense bit-matrix class.
Container of row-major bit-vectors, forming a bit-matrix. This class uses dense form of row storage. It is applicable as a build block for other sparse containers and succinct data structures, implementing high level abstractions.
Definition at line 53 of file bmbmatrix.h.
typedef bvector_type::allocation_policy bm::basic_bmatrix< BV >::allocation_policy_type |
Definition at line 60 of file bmbmatrix.h.
typedef allocator_type::allocator_pool_type bm::basic_bmatrix< BV >::allocator_pool_type |
Definition at line 61 of file bmbmatrix.h.
typedef BV::allocator_type bm::basic_bmatrix< BV >::allocator_type |
Definition at line 59 of file bmbmatrix.h.
typedef bvector_type::block_idx_type bm::basic_bmatrix< BV >::block_idx_type |
Definition at line 63 of file bmbmatrix.h.
typedef BV bm::basic_bmatrix< BV >::bvector_type |
Definition at line 56 of file bmbmatrix.h.
typedef bvector_type* bm::basic_bmatrix< BV >::bvector_type_ptr |
Definition at line 57 of file bmbmatrix.h.
typedef unsigned char bm::basic_bmatrix< BV >::octet_type |
Definition at line 64 of file bmbmatrix.h.
typedef bvector_type::size_type bm::basic_bmatrix< BV >::size_type |
Definition at line 62 of file bmbmatrix.h.
bm::basic_bmatrix< BV >::basic_bmatrix | ( | size_type | rsize, |
allocation_policy_type | ap = allocation_policy_type() , |
||
size_type | bv_max_size = bm::id_max , |
||
const allocator_type & | alloc = allocator_type() |
||
) |
Definition at line 473 of file bmbmatrix.h.
bm::basic_bmatrix< BV >::~basic_bmatrix |
Definition at line 490 of file bmbmatrix.h.
bm::basic_bmatrix< BV >::basic_bmatrix | ( | const basic_bmatrix< BV > & | bbm | ) |
copy-ctor
Definition at line 498 of file bmbmatrix.h.
bm::basic_bmatrix< BV >::basic_bmatrix | ( | basic_bmatrix< BV > && | bbm | ) |
move-ctor
Definition at line 512 of file bmbmatrix.h.
|
protected |
Definition at line 609 of file bmbmatrix.h.
int bm::basic_bmatrix< BV >::compare_octet | ( | size_type | pos, |
size_type | octet_idx, | ||
char | octet | ||
) | const |
Compare vector[pos] with octet
It uses regulat comparison of chars to comply with the (signed) char sort order.
pos | - column position in the matrix |
octet_idx | - octet based row position (1 octet - 8 rows) |
octet | - octet value to compare |
Definition at line 976 of file bmbmatrix.h.
|
protected |
Definition at line 731 of file bmbmatrix.h.
basic_bmatrix< BV >::bvector_type_ptr bm::basic_bmatrix< BV >::construct_row | ( | size_type | row | ) |
Make sure row is constructed, return bit-vector
Definition at line 681 of file bmbmatrix.h.
Referenced by bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::import_no_check().
basic_bmatrix< BV >::bvector_type_ptr bm::basic_bmatrix< BV >::construct_row | ( | size_type | row, |
const bvector_type & | bv | ||
) |
Make sure row is copy-constructed, return bit-vector
Definition at line 696 of file bmbmatrix.h.
void bm::basic_bmatrix< BV >::copy_from | ( | const basic_bmatrix< BV > & | bbm | ) |
Copy content
Definition at line 576 of file bmbmatrix.h.
Referenced by bm::basic_bmatrix< bm::bvector<> >::operator=().
|
protected |
Definition at line 756 of file bmbmatrix.h.
void bm::basic_bmatrix< BV >::destruct_row | ( | size_type | row | ) |
Definition at line 715 of file bmbmatrix.h.
Referenced by bm::base_sparse_vector< Val, BV, 1 >::free_plain().
|
protected |
Definition at line 630 of file bmbmatrix.h.
Referenced by bm::basic_bmatrix< bm::bvector<> >::operator=().
const bm::word_t * bm::basic_bmatrix< BV >::get_block | ( | size_type | p, |
unsigned | i, | ||
unsigned | j | ||
) | const |
Get low level internal access to.
Definition at line 770 of file bmbmatrix.h.
unsigned bm::basic_bmatrix< BV >::get_half_octet | ( | size_type | pos, |
size_type | row_idx | ||
) | const |
Definition at line 988 of file bmbmatrix.h.
unsigned char bm::basic_bmatrix< BV >::get_octet | ( | size_type | pos, |
size_type | octet_idx | ||
) | const |
return octet from the matrix
pos | - column position in the matrix |
octet_idx | - octet based row position (1 octet - 8 rows) |
Definition at line 877 of file bmbmatrix.h.
Referenced by bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::get().
basic_bmatrix< BV >::bvector_type * bm::basic_bmatrix< BV >::get_row | ( | size_type | i | ) |
Get row bit-vector
Definition at line 547 of file bmbmatrix.h.
const basic_bmatrix< BV >::bvector_type * bm::basic_bmatrix< BV >::get_row | ( | size_type | i | ) | const |
Get row bit-vector
Definition at line 537 of file bmbmatrix.h.
Referenced by bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::decode(), bm::base_sparse_vector< Val, BV, 1 >::equal(), bm::base_sparse_vector< Val, BV, 1 >::get_null_bvect(), bm::base_sparse_vector< Val, BV, 1 >::get_null_bvector(), bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::import_no_check(), bm::base_sparse_vector< Val, BV, 1 >::is_nullable(), bm::sparse_vector< unsigned, bm::bvector<> >::merge(), and bm::base_sparse_vector< Val, BV, 1 >::plain().
void bm::basic_bmatrix< BV >::insert_octet | ( | size_type | pos, |
size_type | octet_idx, | ||
unsigned char | octet | ||
) |
Bit-transpose and insert an octet and assign it to a bit-matrix
pos | - column position in the matrix |
octet_idx | - octet based row position (1 octet - 8 rows) |
octet | - value to assign |
Definition at line 828 of file bmbmatrix.h.
|
inline |
move assignmment operator
Definition at line 90 of file bmbmatrix.h.
|
inline |
Definition at line 79 of file bmbmatrix.h.
void bm::basic_bmatrix< BV >::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 1046 of file bmbmatrix.h.
const basic_bmatrix< BV >::bvector_type * bm::basic_bmatrix< BV >::row | ( | size_type | i | ) | const |
Get row bit-vector
Definition at line 527 of file bmbmatrix.h.
Referenced by bm::base_sparse_vector< Val, BV, 1 >::copy_from(), bm::sparse_vector< unsigned, bm::bvector<> >::copy_range(), bm::base_sparse_vector< Val, BV, 1 >::get_plain(), and bm::sparse_vector< unsigned, bm::bvector<> >::join().
|
inline |
get number of value rows
Definition at line 131 of file bmbmatrix.h.
|
inline |
Definition at line 101 of file bmbmatrix.h.
void bm::basic_bmatrix< BV >::set_octet | ( | size_type | pos, |
size_type | octet_idx, | ||
unsigned char | octet | ||
) |
Bit-transpose an octet and assign it to a bit-matrix
pos | - column position in the matrix |
octet_idx | - octet based row position (1 octet - 8 rows) |
octet | - value to assign |
Definition at line 785 of file bmbmatrix.h.
Referenced by bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::assign().
void bm::basic_bmatrix< BV >::swap | ( | basic_bmatrix< BV > & | bbm | ) |
Swap content
Definition at line 651 of file bmbmatrix.h.
Referenced by bm::base_sparse_vector< Val, BV, 1 >::base_sparse_vector(), and bm::basic_bmatrix< bm::bvector<> >::operator=().
bool bm::basic_bmatrix< BV >::test_4rows | ( | unsigned | i | ) | const |
Test if 4 rows from i are not NULL.
Definition at line 556 of file bmbmatrix.h.
|
inlinestaticprotected |
Definition at line 225 of file bmbmatrix.h.
|
protected |
Definition at line 229 of file bmbmatrix.h.
Referenced by bm::basic_bmatrix< bm::bvector<> >::copy_from().
|
protected |
Definition at line 230 of file bmbmatrix.h.
Referenced by bm::basic_bmatrix< bm::bvector<> >::copy_from().
|
protected |
Definition at line 233 of file bmbmatrix.h.
Referenced by bm::basic_bmatrix< bm::bvector<> >::copy_from().
|
protected |
Definition at line 228 of file bmbmatrix.h.
Referenced by bm::basic_bmatrix< bm::bvector<> >::copy_from().
const typedef bvector_type* bm::basic_bmatrix< BV >::bvector_type_const_ptr |
Definition at line 58 of file bmbmatrix.h.
|
protected |
Definition at line 231 of file bmbmatrix.h.
Referenced by bm::basic_bmatrix< bm::bvector<> >::set_allocator_pool().
|
protected |
Definition at line 234 of file bmbmatrix.h.
Referenced by bm::basic_bmatrix< bm::bvector<> >::copy_from(), and bm::basic_bmatrix< bm::bvector<> >::rows().