|
BitMagic-C++
|
Basic dense bit-matrix class. More...
#include <bmbmatrix.h>

Public Types | |
| typedef BV | bvector_type |
| typedef bvector_type * | bvector_type_ptr |
| typedef const bvector_type * | bvector_type_const_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 |
Protected Member Functions | |
| void | allocate_rows (size_type rsize) |
| void | free_rows () BMNOEXCEPT |
| 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 const bvector_type* bm::basic_bmatrix< BV >::bvector_type_const_ptr |
Definition at line 58 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 506 of file bmbmatrix.h.
References alloc_, allocate_rows(), ap_, bv_rows_, bv_size_, pool_, and rsize_.
Referenced by basic_bmatrix(), basic_bmatrix(), copy_from(), operator=(), operator=(), and swap().
| bm::basic_bmatrix< BV >::~basic_bmatrix | ( | ) |
Definition at line 523 of file bmbmatrix.h.
References BMNOEXCEPT, and free_rows().
| bm::basic_bmatrix< BV >::basic_bmatrix | ( | const basic_bmatrix< BV > & | bbm | ) |
copy-ctor
Definition at line 531 of file bmbmatrix.h.
References alloc_, ap_, basic_bmatrix(), bv_rows_, bv_size_, copy_from(), pool_, and rsize_.
| bm::basic_bmatrix< BV >::basic_bmatrix | ( | basic_bmatrix< BV > && | bbm | ) |
move-ctor
Definition at line 545 of file bmbmatrix.h.
References alloc_, ap_, basic_bmatrix(), BMNOEXCEPT, bv_rows_, bv_size_, pool_, rsize_, and swap().
|
protected |
Definition at line 643 of file bmbmatrix.h.
References alloc_, BM_ASSERT, bv_rows_, rsize_, and throw_bad_alloc().
Referenced by basic_bmatrix().
| 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 1012 of file bmbmatrix.h.
References BMNOEXCEPT, and get_octet().
|
protected |
Definition at line 765 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 715 of file bmbmatrix.h.
References BM_ASSERT, bv_rows_, construct_bvector(), row(), and rsize_.
Referenced by insert_octet(), and set_octet().
| 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 730 of file bmbmatrix.h.
References BM_ASSERT, bv_rows_, construct_bvector(), row(), and rsize_.
| void bm::basic_bmatrix< BV >::copy_from | ( | const basic_bmatrix< BV > & | bbm | ) |
Copy content
Definition at line 610 of file bmbmatrix.h.
References alloc_, ap_, basic_bmatrix(), bv_rows_, bv_size_, construct_bvector(), free_rows(), rsize_, and throw_bad_alloc().
Referenced by basic_bmatrix(), and operator=().
|
protected |
Definition at line 790 of file bmbmatrix.h.
Referenced by destruct_row(), and free_rows().
| void bm::basic_bmatrix< BV >::destruct_row | ( | size_type | row | ) |
Definition at line 749 of file bmbmatrix.h.
References BM_ASSERT, bv_rows_, destruct_bvector(), row(), and rsize_.
|
protected |
Definition at line 664 of file bmbmatrix.h.
References alloc_, BMNOEXCEPT, bv_rows_, destruct_bvector(), and rsize_.
Referenced by copy_from(), operator=(), and ~basic_bmatrix().
| 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 804 of file bmbmatrix.h.
References BMNOEXCEPT, and row().
Referenced by get_half_octet(), and get_octet().
| unsigned bm::basic_bmatrix< BV >::get_half_octet | ( | size_type | pos, |
| size_type | row_idx ) const |
Definition at line 1024 of file bmbmatrix.h.
References BM_IS_GAP, BMGAP_PTR, BMNOEXCEPT, FULL_BLOCK_FAKE_ADDR, bm::gap_test_unr(), get_block(), bm::set_array_mask, bm::set_array_shift, bm::set_block_mask, bm::set_block_shift, bm::set_word_mask, and bm::set_word_shift.
| 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 913 of file bmbmatrix.h.
References BM_IS_GAP, BMGAP_PTR, BMNOEXCEPT, FULL_BLOCK_FAKE_ADDR, bm::gap_test_unr(), get_block(), bm::set_array_mask, bm::set_array_shift, bm::set_block_mask, bm::set_block_shift, bm::set_word_mask, and bm::set_word_shift.
Referenced by compare_octet().
| basic_bmatrix< BV >::bvector_type * bm::basic_bmatrix< BV >::get_row | ( | size_type | i | ) |
Get row bit-vector. Can return NULL
Definition at line 580 of file bmbmatrix.h.
References BM_ASSERT, BMNOEXCEPT, bv_rows_, and rsize_.
| const basic_bmatrix< BV >::bvector_type * bm::basic_bmatrix< BV >::get_row | ( | size_type | i | ) | const |
Get row bit-vector. Can return NULL
Definition at line 570 of file bmbmatrix.h.
References BM_ASSERT, BMNOEXCEPT, bv_rows_, and rsize_.
Referenced by insert_octet(), bm::sparse_vector< Val, BV >::merge(), optimize(), optimize_block(), and set_octet().
| 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 864 of file bmbmatrix.h.
References BM_ASSERT, construct_row(), get_row(), row(), and rsize_.
|
inline |
move assignmment operator
Definition at line 90 of file bmbmatrix.h.
References basic_bmatrix(), BMNOEXCEPT, free_rows(), and swap().
|
inline |
Definition at line 79 of file bmbmatrix.h.
References basic_bmatrix(), and copy_from().
| 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 re-allocs |
| opt_mode | - requested compression depth |
| stat | - memory allocation statistics after optimization |
Definition at line 1082 of file bmbmatrix.h.
References bm::bv_statistics::add(), BM_DECLARE_TEMP_BLOCK, get_row(), bm::bv_statistics::reset(), and rsize_.
| void bm::basic_bmatrix< BV >::optimize_block | ( | block_idx_type | nb | ) |
Optimize block in all planes
Definition at line 1112 of file bmbmatrix.h.
References bm::get_block_coord(), get_row(), and rsize_.
| const basic_bmatrix< BV >::bvector_type * bm::basic_bmatrix< BV >::row | ( | size_type | i | ) | const |
Get row bit-vector. Can return NULL
Definition at line 560 of file bmbmatrix.h.
References BM_ASSERT, BMNOEXCEPT, bv_rows_, and rsize_.
Referenced by construct_row(), construct_row(), bm::base_sparse_vector< Val, BV, MAX_SIZE >::copy_from(), bm::base_sparse_vector< Val, BV, MAX_SIZE >::copy_range_plains(), destruct_row(), get_block(), insert_octet(), bm::sparse_vector< Val, BV >::join(), and set_octet().
|
inline |
get number of value rows
Definition at line 132 of file bmbmatrix.h.
References BMNOEXCEPT, and rsize_.
|
inline |
Definition at line 101 of file bmbmatrix.h.
References BMNOEXCEPT, and pool_.
| 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 821 of file bmbmatrix.h.
References BM_ASSERT, construct_row(), get_row(), row(), and rsize_.
| void bm::basic_bmatrix< BV >::swap | ( | basic_bmatrix< BV > & | bbm | ) |
Swap content
Definition at line 685 of file bmbmatrix.h.
References alloc_, ap_, basic_bmatrix(), BMNOEXCEPT, bv_rows_, bv_size_, pool_, rsize_, and bm::xor_swap().
Referenced by basic_bmatrix(), and operator=().
| bool bm::basic_bmatrix< BV >::test_4rows | ( | unsigned | i | ) | const |
Test if 4 rows from i are not NULL.
Definition at line 589 of file bmbmatrix.h.
References BM_ASSERT, BMNOEXCEPT, bv_rows_, and rsize_.
|
inlinestaticprotected |
Definition at line 233 of file bmbmatrix.h.
References throw_bad_alloc().
Referenced by allocate_rows(), copy_from(), and throw_bad_alloc().
|
protected |
Definition at line 238 of file bmbmatrix.h.
Referenced by allocate_rows(), basic_bmatrix(), basic_bmatrix(), basic_bmatrix(), construct_bvector(), copy_from(), free_rows(), and swap().
|
protected |
Definition at line 239 of file bmbmatrix.h.
Referenced by basic_bmatrix(), basic_bmatrix(), basic_bmatrix(), construct_bvector(), copy_from(), and swap().
|
protected |
Definition at line 242 of file bmbmatrix.h.
Referenced by allocate_rows(), basic_bmatrix(), basic_bmatrix(), basic_bmatrix(), construct_row(), construct_row(), copy_from(), destruct_row(), free_rows(), get_row(), get_row(), row(), swap(), and test_4rows().
|
protected |
Definition at line 237 of file bmbmatrix.h.
Referenced by basic_bmatrix(), basic_bmatrix(), basic_bmatrix(), construct_bvector(), copy_from(), and swap().
|
protected |
Definition at line 240 of file bmbmatrix.h.
Referenced by basic_bmatrix(), basic_bmatrix(), basic_bmatrix(), set_allocator_pool(), and swap().
|
protected |
Definition at line 243 of file bmbmatrix.h.
Referenced by allocate_rows(), basic_bmatrix(), basic_bmatrix(), basic_bmatrix(), construct_row(), construct_row(), copy_from(), destruct_row(), free_rows(), get_row(), get_row(), insert_octet(), optimize(), optimize_block(), row(), rows(), set_octet(), swap(), and test_4rows().