|
BitMagic-C++
|
Bitvector Bit-vector container with runtime compression of bits. More...
#include <bm.h>

Data Structures | |
| struct | statistics |
| Statistical information about bitset's memory allocation details. More... | |
| class | reference |
| Class reference implements an object for bit assignment. More... | |
| class | iterator_base |
| Base class for all iterators. More... | |
| class | insert_iterator |
| Output iterator iterator designed to set "ON" bits based on input sequence of integers (bit indeces). More... | |
| class | bulk_insert_iterator |
| Output iterator iterator designed to set "ON" bits based on input sequence of integers. More... | |
| class | enumerator |
| Constant iterator designed to enumerate "ON" bits. More... | |
| class | counted_enumerator |
| Constant iterator designed to enumerate "ON" bits counted_enumerator keeps bitcount, ie number of ON bits starting from the position 0 in the bit string up to the currently enumerated bit. More... | |
| struct | allocation_policy |
| memory allocation policy More... | |
Public Types | |
| enum | optmode { opt_none = 0 , opt_free_0 = 1 , opt_free_01 = 2 , opt_compress = 3 } |
| Optimization mode Every next level means additional checks (better compression vs time). More... | |
| typedef Alloc | allocator_type |
| typedef allocator_type::allocator_pool_type | allocator_pool_type |
| typedef blocks_manager< Alloc > | blocks_manager_type |
| typedef blocks_manager_type::block_idx_type | block_idx_type |
| typedef bvector_size_type | size_type |
| typedef bool | const_reference |
| typedef bm::alloc_pool_guard< allocator_pool_type, bvector< Alloc > > | mem_pool_guard |
| typedef rs_index< allocator_type > | blocks_count |
| typedef rs_index< allocator_type > | rs_index_type |
Public Member Functions | |
Construction, initialization, assignment | |
| bvector (strategy strat=BM_BIT, const gap_word_t *glevel_len=bm::gap_len_table< true >::_len, size_type bv_size=bm::id_max, const Alloc &alloc=Alloc()) | |
| Constructs bvector class. | |
| bvector (size_type bv_size, strategy strat=BM_BIT, const gap_word_t *glevel_len=bm::gap_len_table< true >::_len, const Alloc &alloc=Alloc()) | |
| Constructs bvector class. | |
| bvector (const bvector< Alloc > &bvect) | |
| Copy constructor. | |
| bvector (const bvector< Alloc > &bvect, size_type left, size_type right) | |
| Copy constructor for range copy [left..right]. | |
| bvector (const bvector< Alloc > &bvect, bm::finalization is_final) | |
| Copy-constructor for mutable/immutable initialization. | |
| ~bvector () BMNOEXCEPT | |
| void | init () |
| Explicit post-construction initialization. Must be caled to make sure safe use of *_no_check() methods. | |
| void | init (unsigned top_size, bool alloc_subs) |
| Explicit post-construction initialization. Must be caled right after construction strickly before any modificating calls to make sure safe use of *_no_check() methods. This init can do pre-allocation of top level structures. | |
| bvector & | operator= (const bvector< Alloc > &bvect) |
| Copy assignment operator. | |
| bvector (bvector< Alloc > &&bvect) BMNOEXCEPT | |
| Move constructor. | |
| bvector (std::initializer_list< size_type > il) | |
| Brace constructor. | |
| bvector & | operator= (bvector< Alloc > &&bvect) BMNOEXCEPT |
| Move assignment operator. | |
| void | copy (const bvector< Alloc > &bvect, bm::finalization is_final) |
| Copy bvector from the argument bvector. | |
| void | move_from (bvector< Alloc > &bvect) BMNOEXCEPT |
| Move bvector content from another bvector. | |
| void | swap (bvector< Alloc > &bvect) BMNOEXCEPT |
| Exchanges content of bv and this bvector. | |
| void | merge (bm::bvector< Alloc > &bvect) |
| Merge/move content from another vector. | |
| reference | operator[] (size_type n) |
| bool | operator[] (size_type n) const BMNOEXCEPT |
| void | operator&= (const bvector< Alloc > &bv) |
| void | operator^= (const bvector< Alloc > &bv) |
| void | operator|= (const bvector< Alloc > &bv) |
| void | operator-= (const bvector< Alloc > &bv) |
| bool | operator< (const bvector< Alloc > &bv) const |
| bool | operator<= (const bvector< Alloc > &bv) const |
| bool | operator> (const bvector< Alloc > &bv) const |
| bool | operator>= (const bvector< Alloc > &bv) const |
| bool | operator== (const bvector< Alloc > &bv) const BMNOEXCEPT |
| bool | operator!= (const bvector< Alloc > &bv) const BMNOEXCEPT |
| bvector< Alloc > | operator~ () const |
| Alloc | get_allocator () const |
| void | set_allocator_pool (allocator_pool_type *pool_ptr) BMNOEXCEPT |
| Set allocator pool for local (non-th readed) memory cyclic(lots of alloc-free ops) opertations. | |
| allocator_pool_type * | get_allocator_pool () BMNOEXCEPT |
| Get curent allocator pool (if set). | |
Read-only / immutable vector methods | |
| void | freeze () |
| Turn current vector to read-only (immutable vector). | |
| bool | is_ro () const BMNOEXCEPT |
| Returns true if vector is read-only. | |
Bit access/modification methods | |
| bool | set_bit (size_type n, bool val=true) |
| Sets bit n. | |
| bool | set_bit_and (size_type n, bool val=true) |
| Sets bit n using bit AND with the provided value. | |
| bool | inc (size_type n) |
| Increment the specified element. | |
| bool | set_bit_conditional (size_type n, bool val, bool condition) |
| Sets bit n only if current value equals the condition. | |
| bvector< Alloc > & | set (size_type n, bool val=true) |
| Sets bit n if val is true, clears bit n if val is false. | |
| bvector< Alloc > & | set () |
| Sets every bit in this bitset to 1. | |
| void | set (const size_type *ids, size_type ids_size, bm::sort_order so=bm::BM_UNKNOWN) |
| Set list of bits in this bitset to 1. | |
| void | keep (const size_type *ids, size_type ids_size, bm::sort_order so=bm::BM_UNKNOWN) |
| Keep list of bits in this bitset, others are cleared. | |
| void | clear (const size_type *ids, size_type ids_size, bm::sort_order so=bm::BM_UNKNOWN) |
| clear list of bits in this bitset | |
| void | swap (size_type idx1, size_type idx2) |
| swap values of bits | |
| void | set_bit_no_check (size_type n) |
| Set bit without checking preconditions (size, etc). | |
| bool | set_bit_no_check (size_type n, bool val) |
| Set specified bit without checking preconditions (size, etc). | |
| bvector< Alloc > & | set_range (size_type left, size_type right, bool value=true) |
| Sets all bits in the specified closed interval [left,right] Interval must be inside the bvector's size. This method DOES NOT resize vector. | |
| void | clear_range (size_type left, size_type right) |
| Sets all bits to zero in the specified closed interval [left,right] Interval must be inside the bvector's size. This method DOES NOT resize vector. | |
| void | keep_range (size_type left, size_type right) |
| Sets all bits to zero outside of the closed interval [left,right] Expected result: 00000...0[left, right]0....0000. | |
| void | copy_range (const bvector< Alloc > &bvect, size_type left, size_type right) |
| Copy all bits in the specified closed interval [left,right]. | |
| bool | clear_bit (size_type n) |
| Clears bit n. | |
| void | clear_bit_no_check (size_type n) |
| Clears bit n without precondiion checks. | |
| void | clear (bool free_mem=true) BMNOEXCEPT |
| Clears every bit in the bitvector. | |
| bvector< Alloc > & | reset () BMNOEXCEPT |
| Clears every bit in the bitvector. | |
| bvector< Alloc > & | flip (size_type n) |
| Flips bit n. | |
| bvector< Alloc > & | flip () |
| Flips all bits. | |
| insert_iterator | inserter () |
Size and capacity | |
By default bvector is dynamically sized, manual control methods available | |
| size_type | size () const BMNOEXCEPT |
| Returns bvector's capacity (number of bits it can store). | |
| void | resize (size_type new_size) |
| Change size of the bvector. | |
Population counting, ranks, ranges and intervals | |
| size_type | count () const BMNOEXCEPT |
| population count (count of ON bits) | |
| block_idx_type | count_blocks (unsigned *arr) const BMNOEXCEPT |
| Computes bitcount values for all bvector blocks. | |
| size_type | count_range (size_type left, size_type right, const rs_index_type &rs_idx) const BMNOEXCEPT |
| Returns count of 1 bits in the given range [left..right] Uses rank-select index to accelerate the search. | |
| size_type | count_range (size_type left, size_type right) const BMNOEXCEPT |
| Returns count of 1 bits in the given range [left..right]. | |
| size_type | count_range_no_check (size_type left, size_type right) const BMNOEXCEPT |
| size_type | count_range_no_check (size_type left, size_type right, const rs_index_type &rs_idx) const BMNOEXCEPT |
| bool | is_all_one_range (size_type left, size_type right) const BMNOEXCEPT |
| Returns true if all bits in the range are 1s (saturated interval) Function uses closed interval [left, right]. | |
| bool | any_range (size_type left, size_type right) const BMNOEXCEPT |
| Returns true if any bits in the range are 1s (non-empty interval) Function uses closed interval [left, right]. | |
| void | build_rs_index (rs_index_type *rs_idx, bvector< Alloc > *bv_blocks=0) const |
| compute running total of all blocks in bit vector (rank-select index) | |
| size_type | count_to (size_type n, const rs_index_type &rs_idx) const BMNOEXCEPT |
| Returns count of 1 bits (population) in [0..right] range. | |
| size_type | rank (size_type n, const rs_index_type &rs_idx) const BMNOEXCEPT |
| Returns rank of specified bit position (same as count_to()). | |
| size_type | rank_corrected (size_type n, const rs_index_type &rs_idx) const BMNOEXCEPT |
| Returns rank corrceted by the requested border value (as -1). | |
| size_type | count_to_test (size_type n, const rs_index_type &rs_idx) const BMNOEXCEPT |
| popcount in [0..right] range if test(right) == true | |
| size_type | recalc_count () BMNOEXCEPT |
| void | forget_count () BMNOEXCEPT |
Bit access (read-only) | |
| bool | get_bit (size_type n) const BMNOEXCEPT |
| returns true if bit n is set and false is bit n is 0. | |
| bool | test (size_type n) const BMNOEXCEPT |
| returns true if bit n is set and false is bit n is 0. | |
bit-shift and insert operations | |
| bool | shift_right () |
| Shift right by 1 bit, fill with zero return carry out. | |
| bool | shift_left () |
| Shift left by 1 bit, fill with zero return carry out. | |
| bool | insert (size_type n, bool value) |
| Insert bit into specified position All the vector content after insert position is shifted right. | |
| void | erase (size_type n) |
| Erase bit in the specified position All the vector content after erase position is shifted left. | |
Check for empty-ness of container | |
| bool | any () const BMNOEXCEPT |
| Returns true if any bits in this bitset are set, and otherwise returns false. | |
| bool | none () const BMNOEXCEPT |
| Returns true if no bits are set, otherwise returns false. | |
| bool | empty () const BMNOEXCEPT |
| Returns true if the set is empty (no bits are set, otherwise returns false) Please note that this is NOT a size check, it is an empty SET check (absense of 1s). | |
Scan and find bits and indexes | |
| bool | find (size_type &pos) const BMNOEXCEPT |
| Finds index of first 1 bit. | |
| bool | find (size_type from, size_type &pos) const BMNOEXCEPT |
| Find index of 1 bit starting from position. | |
| size_type | get_first () const BMNOEXCEPT |
| find first 1 bit in vector. Function may return 0 and this requires an extra check if bit 0 is actually set or bit-vector is empty | |
| size_type | get_next (size_type prev) const BMNOEXCEPT |
| Finds the number of the next bit ON. | |
| size_type | extract_next (size_type prev) |
| Finds the number of the next bit ON and sets it to 0. | |
| bool | find_reverse (size_type &pos) const BMNOEXCEPT |
| Finds last index of 1 bit. | |
| bool | find_reverse (size_type from, size_type &pos) const BMNOEXCEPT |
| Reverse finds next(prev) index of 1 bit. | |
| bool | find_range (size_type &first, size_type &last) const BMNOEXCEPT |
| Finds dynamic range of bit-vector [first, last]. | |
| bool | find_rank (size_type rank, size_type from, size_type &pos) const BMNOEXCEPT |
| Find bit-vector position for the specified rank(bitcount). | |
| bool | find_rank (size_type rank, size_type from, size_type &pos, const rs_index_type &rs_idx) const BMNOEXCEPT |
| Find bit-vector position for the specified rank(bitcount). | |
| bool | select (size_type rank, size_type &pos, const rs_index_type &rs_idx) const BMNOEXCEPT |
| select bit-vector position for the specified rank(bitcount) | |
Algebra of Sets operations | |
| bm::bvector< Alloc > & | bit_or (const bm::bvector< Alloc > &bv1, const bm::bvector< Alloc > &bv2, typename bm::bvector< Alloc >::optmode opt_mode=opt_none) |
| 3-operand OR : this := bv1 OR bv2 | |
| bm::bvector< Alloc > & | bit_xor (const bm::bvector< Alloc > &bv1, const bm::bvector< Alloc > &bv2, typename bm::bvector< Alloc >::optmode opt_mode=opt_none) |
| 3-operand XOR : this := bv1 XOR bv2 | |
| bm::bvector< Alloc > & | bit_and (const bm::bvector< Alloc > &bv1, const bm::bvector< Alloc > &bv2, typename bm::bvector< Alloc >::optmode opt_mode=opt_none) |
| 3-operand AND : this := bv1 AND bv2 | |
| bm::bvector< Alloc > & | bit_or_and (const bm::bvector< Alloc > &bv1, const bm::bvector< Alloc > &bv2, typename bm::bvector< Alloc >::optmode opt_mode=opt_none) |
| 3-operand AND where result is ORed into the terget vector : this |= bv1 AND bv2 TARGET := TARGET OR (BV1 AND BV2) | |
| bm::bvector< Alloc > & | bit_sub (const bm::bvector< Alloc > &bv1, const bm::bvector< Alloc > &bv2, typename bm::bvector< Alloc >::optmode opt_mode=opt_none) |
| 3-operand SUB : this := bv1 MINUS bv2 SUBtraction is also known as AND NOT | |
| bm::bvector< Alloc > & | bit_or (const bm::bvector< Alloc > &bv) |
| 2 operand logical OR | |
| bm::bvector< Alloc > & | bit_and (const bm::bvector< Alloc > &bv, optmode opt_mode=opt_none) |
| 2 operand logical AND | |
| bm::bvector< Alloc > & | bit_xor (const bm::bvector< Alloc > &bv) |
| 2 operand logical XOR | |
| bm::bvector< Alloc > & | bit_sub (const bm::bvector< Alloc > &bv) |
| 2 operand logical SUB(AND NOT). Also known as MINUS. | |
| bvector< Alloc > & | invert () |
| Invert/NEG all bits It should be noted, invert is affected by size() if size is set - it only inverts [0..size-1] bits. | |
| void | combine_operation (const bm::bvector< Alloc > &bvect, bm::operation opcode) |
| perform a set-algebra operation by operation code | |
| void | combine_operation_or (const bm::bvector< Alloc > &bvect) |
| perform a set-algebra operation OR | |
| void | combine_operation_and (const bm::bvector< Alloc > &bvect, optmode opt_mode) |
| perform a set-algebra operation AND | |
| void | combine_operation_sub (const bm::bvector< Alloc > &bvect) |
| perform a set-algebra operation MINUS (AND NOT) | |
| void | combine_operation_xor (const bm::bvector< Alloc > &bvect) |
| perform a set-algebra operation XOR | |
Iterator-traversal methods | |
| enumerator | first () const |
| Returns enumerator pointing on the first non-zero bit. | |
| enumerator | end () const |
| Returns enumerator pointing on the next bit after the last. | |
| enumerator | get_enumerator (size_type pos) const |
| Returns enumerator pointing on specified or the next available bit. | |
Memory management and compression | |
| void | calc_stat (struct bm::bvector< Alloc >::statistics *st) const BMNOEXCEPT |
| Calculates bitvector statistics. | |
| void | set_new_blocks_strat (strategy strat) |
| Sets new blocks allocation strategy. | |
| strategy | get_new_blocks_strat () const BMNOEXCEPT |
| Returns blocks allocation strategy. | |
| void | optimize (bm::word_t *temp_block=0, optmode opt_mode=opt_compress, statistics *stat=0) |
| Optimize memory bitvector's memory allocation. | |
| void | optimize_range (size_type left, size_type right, bm::word_t *temp_block, optmode opt_mode=opt_compress) |
| void | optimize_gap_size () |
| Optimize sizes of GAP blocks. | |
| void | set_gap_levels (const gap_word_t *glevel_len) |
| Sets new GAP lengths table. All GAP blocks will be reallocated to match the new scheme. | |
| bool | is_init () const BMNOEXCEPT |
| Return true if bvector is initialized at all. | |
| void | fill_alloc_digest (bvector< Alloc > &bv_blocks) const |
| Calculate blocks digest vector (for diagnostics purposes) 1 is added if NB is a real, allocated block. | |
Comparison | |
| int | compare (const bvector< Alloc > &bvect) const BMNOEXCEPT |
| Lexicographical comparison with a bitvector. | |
| bool | equal (const bvector< Alloc > &bvect) const BMNOEXCEPT |
| Equal comparison with an agr bit-vector. | |
| bool | find_first_mismatch (const bvector< Alloc > &bvect, size_type &pos, size_type search_to=bm::id_max) const BMNOEXCEPT |
| Find index of first bit different between this and the agr vector. | |
Friends | |
| class | iterator_base |
| class | enumerator |
| template<class BV> | |
| class | aggregator |
| template<class BV> | |
| class | operation_deserializer |
| template<class BV, class DEC> | |
| class | deserializer |
Open internals | |
| void | combine_operation_with_block (block_idx_type nb, const bm::word_t *arg_blk, bool arg_gap, bm::operation opcode) |
| const blocks_manager_type & | get_blocks_manager () const BMNOEXCEPT |
| get access to memory manager (internal) Use only if you are BitMagic library | |
| blocks_manager_type & | get_blocks_manager () BMNOEXCEPT |
| get access to memory manager (internal) Use only if you are BitMagic library | |
| void | import (const size_type *ids, size_type ids_size, bm::sort_order sorted_idx) |
| Import integers (set bits). | |
| void | import_sorted (const size_type *ids, const size_type ids_size, bool opt_flag) |
| Import sorted integers (set bits). | |
| void | set_range_no_check (size_type left, size_type right) |
| Set range without validity/bounds checking. | |
| void | clear_range_no_check (size_type left, size_type right) |
| Clear range without validity/bounds checking. | |
| static void | throw_bad_alloc () |
| void | sync_size () |
| Syncronize size if it got extended due to bulk import. | |
| void | import_block (const size_type *ids, block_idx_type nblock, size_type start, size_type stop) |
| size_type | check_or_next (size_type prev) const BMNOEXCEPT |
| bool | gap_block_set (bm::gap_word_t *gap_blk, bool val, block_idx_type nblock, unsigned nbit) |
| set bit in GAP block with GAP block length control | |
| void | gap_block_set_no_ret (bm::gap_word_t *gap_blk, bool val, block_idx_type nblock, unsigned nbit) |
| set bit in GAP block with GAP block length control | |
| size_type | check_or_next_extract (size_type prev) |
| check if specified bit is 1, and set it to 0 if specified bit is 0, scan for the next 1 and returns it if no 1 found returns 0 | |
| bool | and_bit_no_check (size_type n, bool val) |
| AND specified bit without checking preconditions (size, etc). | |
| bool | set_bit_conditional_impl (size_type n, bool val, bool condition) |
| void | combine_operation_with_block (block_idx_type nb, bool gap, bm::word_t *blk, const bm::word_t *arg_blk, bool arg_gap, bm::operation opcode) |
| bool | combine_operation_block_or (unsigned i, unsigned j, const bm::word_t *arg_blk1, const bm::word_t *arg_blk2) |
| bool | combine_operation_block_xor (unsigned i, unsigned j, const bm::word_t *arg_blk1, const bm::word_t *arg_blk2) |
| bool | combine_operation_block_and (unsigned i, unsigned j, const bm::word_t *arg_blk1, const bm::word_t *arg_blk2) |
| bool | combine_operation_block_and_or (unsigned i, unsigned j, const bm::word_t *arg_blk1, const bm::word_t *arg_blk2) |
| bool | combine_operation_block_sub (unsigned i, unsigned j, const bm::word_t *arg_blk1, const bm::word_t *arg_blk2) |
| void | combine_operation_block_or (unsigned i, unsigned j, bm::word_t *blk, const bm::word_t *arg_blk) |
| void | combine_operation_block_xor (unsigned i, unsigned j, bm::word_t *blk, const bm::word_t *arg_blk) |
| void | combine_operation_block_and (unsigned i, unsigned j, bm::word_t *blk, const bm::word_t *arg_blk) |
| void | combine_operation_block_sub (unsigned i, unsigned j, bm::word_t *blk, const bm::word_t *arg_blk) |
| void | copy_range_no_check (const bvector< Alloc > &bvect, size_type left, size_type right) |
Bitvector Bit-vector container with runtime compression of bits.
| typedef allocator_type::allocator_pool_type bm::bvector< Alloc >::allocator_pool_type |
| typedef Alloc bm::bvector< Alloc >::allocator_type |
| typedef blocks_manager_type::block_idx_type bm::bvector< Alloc >::block_idx_type |
| typedef rs_index<allocator_type> bm::bvector< Alloc >::blocks_count |
| typedef blocks_manager<Alloc> bm::bvector< Alloc >::blocks_manager_type |
| typedef bool bm::bvector< Alloc >::const_reference |
| typedef rs_index<allocator_type> bm::bvector< Alloc >::rs_index_type |
| typedef bvector_size_type bm::bvector< Alloc >::size_type |
| enum bm::bvector::optmode |
Optimization mode Every next level means additional checks (better compression vs time).
| Enumerator | |
|---|---|
| opt_none | no optimization |
| opt_free_0 | Free unused 0 blocks. |
| opt_free_01 | Free unused 0 and 1 blocks. |
| opt_compress | compress blocks when possible (GAP/prefix sum) |
|
inline |
Constructs bvector class.
| strat | - operation mode strategy, BM_BIT - default strategy, bvector use plain bitset blocks, (performance oriented strategy). BM_GAP - memory effitent strategy, bvector allocates blocks as array of intervals(gaps) and convert blocks into plain bitsets only when enthropy grows. |
| glevel_len |
|
| bv_size |
|
| alloc | - alllocator for this instance |
Definition at line 843 of file bm.h.
Referenced by build_rs_index(), bm::bvector< Alloc >::bulk_insert_iterator::bulk_insert_iterator(), clear(), compare(), copy(), copy_range(), copy_range_no_check(), fill_alloc_digest(), find_first_mismatch(), freeze(), bm::bvector< Alloc >::insert_iterator::insert_iterator(), invert(), keep(), move_from(), optimize_gap_size(), bm::bvector< Alloc >::reference::reference(), set(), set(), set_gap_levels(), set_range(), and swap().
|
inline |
|
inline |
|
inline |
Copy constructor for range copy [left..right].
|
inline |
|
inline |
|
inline |
|
inline |
|
protected |
AND specified bit without checking preconditions (size, etc).
Definition at line 4836 of file bm.h.
References BM_ASSERT, BMGAP_PTR, gap_block_set(), bm::gap_test_unr(), get_new_blocks_strat(), is_ro(), IS_VALID_ADDR, bm::set_block_mask, bm::set_block_shift, bm::set_word_mask, and bm::set_word_shift.
Referenced by set_bit_and().
| bool bm::bvector< Alloc >::any | ( | ) | const |
Returns true if any bits in this bitset are set, and otherwise returns false.
Definition at line 2451 of file bm.h.
References BMNOEXCEPT, and bm::for_each_nzblock_if().
Referenced by bm::bvector< dbg_alloc >::empty(), DNA_FingerprintScanner< bm::bvector<> >::Find(), main(), bm::bvector< dbg_alloc >::none(), and resolve_duplicates().
| bool bm::bvector< Alloc >::any_range | ( | size_type | left, |
| size_type | right ) const |
Returns true if any bits in the range are 1s (non-empty interval) Function uses closed interval [left, right].
| left | - index of first bit start checking |
| right | - index of last bit |
Definition at line 3422 of file bm.h.
References bm::block_any(), bm::block_any_range(), BM_ASSERT, BMNOEXCEPT, FULL_BLOCK_FAKE_ADDR, bm::gap_max_bits, bm::get_block_coord(), bm::id_max, bm::set_block_mask, bm::set_block_shift, bm::set_sub_array_size, test(), and bm::xor_swap().
Referenced by add_object(), and main().
|
inline |
| bm::bvector< Alloc > & bm::bvector< Alloc >::bit_and | ( | const bm::bvector< Alloc > & | bv1, |
| const bm::bvector< Alloc > & | bv2, | ||
| typename bm::bvector< Alloc >::optmode | opt_mode = opt_none ) |
3-operand AND : this := bv1 AND bv2
| bv1 | - Argument vector 1 |
| bv2 | - Argument vector 2 |
| opt_mode | - optimization compression (when it is performed on the fly it is faster than a separate call to optimize() |
Definition at line 6118 of file bm.h.
References bit_and(), BM_ASSERT, combine_operation_block_and(), FULL_BLOCK_FAKE_ADDR, FULL_SUB_BLOCK_REAL_ADDR, get_blocks_manager(), is_ro(), opt_compress, opt_none, and bm::set_sub_array_size.
Referenced by bit_and(), bit_or_and(), DemoAND(), keep(), main(), main(), bm::operator&(), bm::bvector< dbg_alloc >::operator&=(), and resolve_duplicates().
|
inline |
| bm::bvector< Alloc > & bm::bvector< Alloc >::bit_or | ( | const bm::bvector< Alloc > & | bv1, |
| const bm::bvector< Alloc > & | bv2, | ||
| typename bm::bvector< Alloc >::optmode | opt_mode = opt_none ) |
3-operand OR : this := bv1 OR bv2
| bv1 | - Argument vector 1 |
| bv2 | - Argument vector 2 |
| opt_mode | - optimization compression (when it is performed on the fly it is faster than a separate call to optimize() |
Definition at line 5906 of file bm.h.
References bit_or(), BM_ASSERT, combine_operation_block_or(), FULL_BLOCK_FAKE_ADDR, get_blocks_manager(), is_ro(), opt_compress, opt_none, and bm::set_sub_array_size.
Referenced by bit_or(), bit_or_and(), bit_sub(), DemoOR(), main(), merge(), bm::operator|(), bm::bvector< dbg_alloc >::operator|=(), and bm::sparse_vector_find_mismatch().
| bm::bvector< Alloc > & bm::bvector< Alloc >::bit_or_and | ( | const bm::bvector< Alloc > & | bv1, |
| const bm::bvector< Alloc > & | bv2, | ||
| typename bm::bvector< Alloc >::optmode | opt_mode = opt_none ) |
3-operand AND where result is ORed into the terget vector : this |= bv1 AND bv2 TARGET := TARGET OR (BV1 AND BV2)
| bv1 | - Argument vector 1 |
| bv2 | - Argument vector 2 |
| opt_mode | - optimization compression (when it is performed on the fly it is faster than a separate call to optimize() |
Definition at line 6213 of file bm.h.
References bit_and(), bit_or(), BM_ASSERT, combine_operation_block_and(), combine_operation_block_and_or(), FULL_BLOCK_FAKE_ADDR, FULL_SUB_BLOCK_REAL_ADDR, get_blocks_manager(), is_ro(), opt_compress, opt_none, and bm::set_sub_array_size.
Referenced by DemoAND_OR().
|
inline |
| bm::bvector< Alloc > & bm::bvector< Alloc >::bit_sub | ( | const bm::bvector< Alloc > & | bv1, |
| const bm::bvector< Alloc > & | bv2, | ||
| typename bm::bvector< Alloc >::optmode | opt_mode = opt_none ) |
3-operand SUB : this := bv1 MINUS bv2 SUBtraction is also known as AND NOT
| bv1 | - Argument vector 1 |
| bv2 | - Argument vector 2 |
| opt_mode | - optimization compression (when it is performed on the fly it is faster than a separate call to optimize() |
Definition at line 6330 of file bm.h.
References bit_or(), bit_sub(), BM_ASSERT, combine_operation_block_sub(), FULL_BLOCK_FAKE_ADDR, FULL_SUB_BLOCK_REAL_ADDR, get_blocks_manager(), is_ro(), opt_compress, opt_none, and bm::set_sub_array_size.
Referenced by bit_sub(), clear(), DemoSUB(), main(), bm::operator-(), and bm::bvector< dbg_alloc >::operator-=().
|
inline |
| bm::bvector< Alloc > & bm::bvector< Alloc >::bit_xor | ( | const bm::bvector< Alloc > & | bv1, |
| const bm::bvector< Alloc > & | bv2, | ||
| typename bm::bvector< Alloc >::optmode | opt_mode = opt_none ) |
3-operand XOR : this := bv1 XOR bv2
| bv1 | - Argument vector 1 |
| bv2 | - Argument vector 2 |
| opt_mode | - optimization compression (when it is performed on the fly it is faster than a separate call to optimize() |
Definition at line 6005 of file bm.h.
References bit_xor(), BM_ASSERT, combine_operation_block_xor(), FULL_BLOCK_FAKE_ADDR, FULL_SUB_BLOCK_REAL_ADDR, get_blocks_manager(), is_ro(), opt_compress, opt_none, and bm::set_sub_array_size.
Referenced by bit_xor(), DemoXOR(), bm::operator^(), bm::bvector< dbg_alloc >::operator^=(), and bm::sparse_vector_find_mismatch().
| void bm::bvector< Alloc >::build_rs_index | ( | rs_index_type * | rs_idx, |
| bvector< Alloc > * | bv_blocks = 0 ) const |
compute running total of all blocks in bit vector (rank-select index)
| rs_idx | - [out] pointer to index / count structure |
| bv_blocks | - [out] list of block ids in the vector (internal, optional) Function will fill full array of running totals |
Definition at line 2501 of file bm.h.
References bm::bit_block_calc_count_range(), bm::bit_block_calc_count_to(), BLOCK_ADDR_SAN, BM_ASSERT, BM_IS_GAP, BMGAP_PTR, bvector(), clear(), find_reverse(), FULL_BLOCK_FAKE_ADDR, bm::gap_bfind(), bm::gap_bit_count_range(), bm::gap_bit_count_to(), bm::gap_max_bits, bm::get_block_coord(), init(), bm::rs3_border0, bm::rs3_border0_1, bm::rs3_border1, bm::rs3_border1_1, set_bit_no_check(), bm::set_block_shift, set_range_no_check(), and bm::set_sub_array_size.
Referenced by bv_count_range_acc(), bv_count_to_acc(), bv_count_to_range_acc(), and main().
| void bm::bvector< Alloc >::calc_stat | ( | struct bm::bvector< Alloc >::statistics * | st | ) | const |
Calculates bitvector statistics.
| st | - pointer on statistics structure to be filled in. |
Function fills statistics structure containing information about how this vector uses memory and estimation of max. amount of memory bvector needs to serialize itself.
Definition at line 3978 of file bm.h.
References BM_ASSERT, BM_IS_GAP, BMGAP_PTR, BMNOEXCEPT, bm::find_not_null_ptr(), FULL_BLOCK_FAKE_ADDR, bm::gap_capacity(), bm::gap_length(), bm::gap_level(), bm::gap_levels, is_ro(), IS_VALID_ADDR, bm::set_block_size, and bm::set_sub_array_size.
Referenced by calc_memory_footprint(), convert_bv2bvs(), generate_bvector(), optimize(), optimize_gap_size(), print_statistics(), print_statistics(), and print_statistics().
|
protected |
Definition at line 5324 of file bm.h.
References bm::bit_block_find(), bm::bit_find_first(), bm::bits_in_array, BM_IS_GAP, BMGAP_PTR, BMNOEXCEPT, FULL_BLOCK_FAKE_ADDR, FULL_SUB_BLOCK_REAL_ADDR, bm::gap_block_find(), bm::gap_find_first(), bm::gap_max_bits, bm::get_block_coord(), bm::set_block_mask, bm::set_block_shift, and bm::set_sub_array_size.
Referenced by check_or_next_extract(), find(), bm::bvector< dbg_alloc >::get_first(), and bm::bvector< dbg_alloc >::get_next().
|
protected |
check if specified bit is 1, and set it to 0 if specified bit is 0, scan for the next 1 and returns it if no 1 found returns 0
Definition at line 5408 of file bm.h.
References BM_ASSERT, check_or_next(), clear_bit_no_check(), and is_ro().
Referenced by bm::bvector< dbg_alloc >::extract_next().
| void bm::bvector< Alloc >::clear | ( | bool | free_mem = true | ) |
Clears every bit in the bitvector.
| free_mem | if "true" (default) bvector frees the memory, otherwise sets blocks to 0. |
Definition at line 4135 of file bm.h.
References BM_ASSERT, BMNOEXCEPT, and is_ro().
| void bm::bvector< Alloc >::clear | ( | const size_type * | ids, |
| size_type | ids_size, | ||
| bm::sort_order | so = bm::BM_UNKNOWN ) |
clear list of bits in this bitset
This is equivalent of AND NOT (Set Substract), argument set as an array.
| ids | - pointer on array of indexes to set |
| ids_size | - size of the input (ids) |
| so | - sort order (use BM_SORTED for faster load) |
Definition at line 4149 of file bm.h.
References bit_sub(), BM_ASSERT, bvector(), find_reverse(), import(), is_ro(), and resize().
Referenced by build_rs_index(), bv_count_and(), combine_operation_and(), compute_seq_group_union(), copy_range(), DemoSUB(), destroy_map(), CSeqClusters::elect_leaders(), keep(), main(), bm::bvector< dbg_alloc >::reset(), speed_test_bv_index(), speed_test_bvs_index(), speed_test_sv_index(), speed_test_vect_index(), and CSeqClusters::union_all_groups().
|
inline |
Clears bit n.
| n | - bit's index to be cleaned. |
Definition at line 1247 of file bm.h.
Referenced by main().
| void bm::bvector< Alloc >::clear_bit_no_check | ( | size_type | n | ) |
Clears bit n without precondiion checks.
| n | - bit's index to be cleaned. |
Definition at line 4680 of file bm.h.
References BM_ASSERT, BM_ASSERT_THROW, BMGAP_PTR, gap_block_set_no_ret(), get_new_blocks_strat(), bm::id_max, is_ro(), bm::set_block_mask, bm::set_block_shift, bm::set_word_mask, and bm::set_word_shift.
Referenced by check_or_next_extract().
|
inline |
| void bm::bvector< Alloc >::clear_range_no_check | ( | size_type | left, |
| size_type | right ) |
Clear range without validity/bounds checking.
Definition at line 7904 of file bm.h.
References bm::bits_in_block, bm::BM_AND, BM_ASSERT, BM_IS_GAP, combine_operation_with_block(), bm::gap_init_range_block(), bm::get_block_coord(), bm::set_block_mask, and bm::set_block_shift.
Referenced by copy_range_no_check(), invert(), and set_range().
| void bm::bvector< Alloc >::combine_operation | ( | const bm::bvector< Alloc > & | bvect, |
| bm::operation | opcode ) |
perform a set-algebra operation by operation code
Definition at line 6750 of file bm.h.
References bm::BM_AND, BM_IS_GAP, bm::BM_SUB, combine_operation_with_block(), set_range(), and bm::set_sub_array_size.
Referenced by DemoAND(), DemoOR(), DemoSUB(), and DemoXOR().
| void bm::bvector< Alloc >::combine_operation_and | ( | const bm::bvector< Alloc > & | bvect, |
| optmode | opt_mode ) |
perform a set-algebra operation AND
Definition at line 6598 of file bm.h.
References bm::avx2_test_all_zero_wave(), BM_AND_OP, clear(), FULL_BLOCK_FAKE_ADDR, bm::set_sub_array_size, and bm::sse42_test_all_zero_wave().
Referenced by bm::bvector< dbg_alloc >::bit_and().
|
protected |
Definition at line 7469 of file bm.h.
References bm::bit_block_and(), bm::bit_block_copy(), bm::bit_is_all_zero(), BM_ASSERT, BM_IS_GAP, BMGAP_PTR, BMSET_PTRGAP, bm::calc_block_digest0(), empty(), bm::gap_and_to_bitset(), bm::gap_equiv_len, bm::gap_is_all_zero(), bm::gap_operation_and(), IS_FULL_BLOCK, and bm::word_bitcount64().
|
protected |
Definition at line 7027 of file bm.h.
References bm::bit_block_and_2way(), bm::bit_is_all_zero(), BM_IS_GAP, BMGAP_PTR, FULL_BLOCK_FAKE_ADDR, bm::gap_and_to_bitset(), bm::gap_equiv_len, and bm::gap_operation_and().
Referenced by bit_and(), and bit_or_and().
|
protected |
Definition at line 7112 of file bm.h.
References bm::bit_block_and_or_2way(), bm::bit_block_copy(), bm::bit_block_or(), BM_ASSERT, BM_IS_GAP, BMGAP_PTR, combine_operation_block_or(), FULL_BLOCK_FAKE_ADDR, bm::gap_add_to_bitset(), bm::gap_and_to_bitset(), bm::gap_equiv_len, bm::gap_operation_and(), and bm::is_bits_one().
Referenced by bit_or_and().
|
protected |
Definition at line 7286 of file bm.h.
References bm::bit_block_copy(), bm::bit_block_or(), BM_ASSERT, BM_IS_GAP, BMGAP_PTR, FULL_BLOCK_FAKE_ADDR, bm::gap_add_to_bitset(), bm::gap_equiv_len, bm::gap_operation_or(), bm::is_bits_one(), and IS_FULL_BLOCK.
|
protected |
Definition at line 6872 of file bm.h.
References bm::bit_block_or_2way(), BM_IS_GAP, BMGAP_PTR, FULL_BLOCK_FAKE_ADDR, bm::gap_add_to_bitset(), bm::gap_equiv_len, and bm::gap_operation_or().
Referenced by bit_or(), combine_operation_block_and_or(), and merge().
|
protected |
Definition at line 7573 of file bm.h.
References bm::bit_andnot_arr_ffmask(), bm::bit_is_all_zero(), bm::bit_operation_sub(), BM_ASSERT, BM_IS_GAP, BMGAP_PTR, empty(), bm::gap_convert_to_bitset_smart(), bm::gap_equiv_len, bm::gap_max_bits, bm::gap_operation_sub(), bm::gap_sub_to_bitset(), IS_FULL_BLOCK, and IS_VALID_ADDR.
|
protected |
Definition at line 7212 of file bm.h.
References bm::bit_block_sub(), bm::bit_block_sub_2way(), BM_ASSERT, BM_IS_GAP, BMGAP_PTR, FULL_BLOCK_FAKE_ADDR, FULL_BLOCK_REAL_ADDR, bm::gap_convert_to_bitset(), bm::gap_equiv_len, bm::gap_operation_sub(), and bm::gap_sub_to_bitset().
Referenced by bit_sub().
|
protected |
Definition at line 7365 of file bm.h.
References bm::bit_block_copy(), bm::bit_block_set(), bm::bit_block_xor(), bm::bit_invert(), BM_ASSERT, BM_IS_GAP, BMGAP_PTR, FULL_BLOCK_FAKE_ADDR, bm::gap_equiv_len, bm::gap_invert(), bm::gap_operation_xor(), bm::gap_xor_to_bitset(), and IS_FULL_BLOCK.
|
protected |
Definition at line 6945 of file bm.h.
References bm::bit_block_xor_2way(), BM_ASSERT, BM_IS_GAP, BMGAP_PTR, FULL_BLOCK_FAKE_ADDR, bm::gap_equiv_len, bm::gap_operation_xor(), bm::gap_xor_to_bitset(), and IS_FULL_BLOCK.
Referenced by bit_xor().
| void bm::bvector< Alloc >::combine_operation_or | ( | const bm::bvector< Alloc > & | bvect | ) |
perform a set-algebra operation OR
Definition at line 6427 of file bm.h.
References bm::avx2_test_all_eq_wave2(), BM_OR_OP, FULL_BLOCK_FAKE_ADDR, bm::set_sub_array_size, and bm::sse42_test_all_eq_wave2().
Referenced by bm::bvector< dbg_alloc >::bit_or().
| void bm::bvector< Alloc >::combine_operation_sub | ( | const bm::bvector< Alloc > & | bvect | ) |
perform a set-algebra operation MINUS (AND NOT)
Definition at line 6686 of file bm.h.
References bm::avx2_test_all_zero_wave(), BM_SUB_OP, FULL_BLOCK_FAKE_ADDR, bm::set_sub_array_size, and bm::sse42_test_all_zero_wave().
Referenced by bm::bvector< dbg_alloc >::bit_sub().
|
protected |
Definition at line 7654 of file bm.h.
References bm::all_bits_mask, bm::bit_andnot_arr_ffmask(), bm::bit_block_copy(), bm::bit_operation_and(), bm::bit_operation_or(), bm::bit_operation_sub(), bm::bit_operation_xor(), bm::BM_AND, BM_ASSERT, bm::BM_OR, bm::BM_SUB, bm::BM_XOR, BMGAP_PTR, bm::gap_convert_to_bitset_smart(), bm::gap_equiv_len, bm::gap_is_all_zero(), bm::gap_max_bits, bm::operation_functions< T >::gap_op_to_bit(), bm::operation_functions< T >::gap_operation(), IS_FULL_BLOCK, IS_VALID_ADDR, bm::set_block_size, and VECT_XOR_ARR_2_MASK.
| void bm::bvector< Alloc >::combine_operation_with_block | ( | block_idx_type | nb, |
| const bm::word_t * | arg_blk, | ||
| bool | arg_gap, | ||
| bm::operation | opcode ) |
Definition at line 5889 of file bm.h.
References BM_IS_GAP, combine_operation_with_block(), and bm::get_block_coord().
Referenced by clear_range_no_check(), combine_operation(), combine_operation_with_block(), and set_range_no_check().
| void bm::bvector< Alloc >::combine_operation_xor | ( | const bm::bvector< Alloc > & | bvect | ) |
perform a set-algebra operation XOR
Definition at line 6499 of file bm.h.
References bm::avx2_test_all_zero_wave2(), BM_XOR_OP, FULL_BLOCK_FAKE_ADDR, FULL_SUB_BLOCK_REAL_ADDR, bm::set_sub_array_size, and bm::sse42_test_all_zero_wave2().
Referenced by bm::bvector< dbg_alloc >::bit_xor().
| int bm::bvector< Alloc >::compare | ( | const bvector< Alloc > & | bvect | ) | const |
Lexicographical comparison with a bitvector.
Function compares current bitvector with the provided argument bit by bit and returns -1 if this bitvector less than the argument, 1 - greater, 0 - equal
Definition at line 3744 of file bm.h.
References bm::bit_is_all_zero(), bm::bitcmp(), BM_DECLARE_TEMP_BLOCK, BM_IS_GAP, BMGAP_PTR, BMNOEXCEPT, bvector(), FULL_BLOCK_FAKE_ADDR, FULL_BLOCK_REAL_ADDR, bm::gap_convert_to_bitset(), bm::gap_is_all_zero(), bm::gapcmp(), bm::set_block_size_op, and bm::set_sub_array_size.
Referenced by convert_bv2bvs(), fingerprint_compare(), main(), bm::bvector< dbg_alloc >::operator<(), bm::bvector< dbg_alloc >::operator<=(), bm::bvector< dbg_alloc >::operator>(), bm::bvector< dbg_alloc >::operator>=(), run_benchmark(), and run_benchmark().
| void bm::bvector< Alloc >::copy | ( | const bvector< Alloc > & | bvect, |
| bm::finalization | is_final ) |
Copy bvector from the argument bvector.
| bvect | - bit-vector to copy from |
| is_final | - BM_READONLY - copies as immutable, BM_READWRITE - copies as mutable even if the argument bvect is read-only vector, BM_UNDEFINED - follow the argument type as is |
Definition at line 2303 of file bm.h.
References BM_ASSERT, bvector(), bm::READONLY, bm::READWRITE, resize(), and bm::UNDEFINED.
Referenced by bm::bvector< dbg_alloc >::operator=().
| void bm::bvector< Alloc >::copy_range | ( | const bvector< Alloc > & | bvect, |
| size_type | left, | ||
| size_type | right ) |
Copy all bits in the specified closed interval [left,right].
| bvect | - source bit-vector |
| left | - interval start |
| right | - interval end (closed interval) |
Definition at line 7981 of file bm.h.
References bvector(), clear(), copy_range_no_check(), and bm::xor_swap().
Referenced by bm::base_sparse_vector< Val, BV, MAX_SIZE >::copy_range_slices(), and main().
|
protected |
Definition at line 8026 of file bm.h.
References BM_ASSERT, BM_ASSERT_THROW, bvector(), clear_range_no_check(), find_reverse(), bm::gap_max_bits, bm::id_max, and bm::set_block_shift.
Referenced by bm::bvector< dbg_alloc >::bvector(), and copy_range().
| bvector< Alloc >::size_type bm::bvector< Alloc >::count | ( | ) | const |
population count (count of ON bits)
Definition at line 2401 of file bm.h.
References BM_ASSERT, BMNOEXCEPT, bm::find_not_null_ptr(), FULL_BLOCK_FAKE_ADDR, bm::gap_max_bits, and bm::set_sub_array_size.
Referenced by bv_count_test(), CSeqClusters::clear_empty_groups(), compute_and_sim_row(), CSeqClusters::compute_avg_count(), compute_frequent_kmers(), compute_group(), compute_jaccard_clusters(), convert_bv2vect(), CSeqClusters::elect_leaders(), main(), main(), pre_heat(), print_bvector(), print_statistics(), print_statistics(), CSeqClusters::print_summary(), bm::bvector< dbg_alloc >::recalc_count(), run_benchmark(), and serialize_bvector().
| bvector< Alloc >::block_idx_type bm::bvector< Alloc >::count_blocks | ( | unsigned * | arr | ) | const |
Computes bitcount values for all bvector blocks.
| arr | - pointer on array of block bit counts |
Definition at line 2637 of file bm.h.
References BMNOEXCEPT, and bm::for_each_nzblock().
| bvector< Alloc >::size_type bm::bvector< Alloc >::count_range | ( | size_type | left, |
| size_type | right ) const |
Returns count of 1 bits in the given range [left..right].
| left | - index of first bit start counting from |
| right | - index of last bit |
Definition at line 3242 of file bm.h.
References BM_ASSERT, BMNOEXCEPT, count_range_no_check(), bm::id_max, and bm::xor_swap().
| bvector< Alloc >::size_type bm::bvector< Alloc >::count_range | ( | size_type | left, |
| size_type | right, | ||
| const rs_index_type & | rs_idx ) const |
Returns count of 1 bits in the given range [left..right] Uses rank-select index to accelerate the search.
| left | - index of first bit start counting from |
| right | - index of last bit |
| rs_idx | - block count structure to accelerate search |
Definition at line 3516 of file bm.h.
References BM_ASSERT_THROW, BMNOEXCEPT, count_range_no_check(), bm::id_max, and bm::xor_swap().
Referenced by bv_count_range(), bv_count_range_acc(), compute_historgam(), compute_rsc_historgam(), and CSeqClusters::elect_leaders().
| bvector< Alloc >::size_type bm::bvector< Alloc >::count_range_no_check | ( | size_type | left, |
| size_type | right ) const |
Returns count of 1 bits in the given range [left..right] Function expects that caller guarantees that left < right
Definition at line 3258 of file bm.h.
References bm::bit_block_calc_count_range(), bm::bits_in_block, BM_IS_GAP, BMGAP_PTR, BMNOEXCEPT, bm::for_each_nzblock_range(), bm::gap_bit_count_range(), bm::gap_bit_count_to(), bm::get_block_coord(), bm::set_block_mask, and bm::set_block_shift.
Referenced by count_range(), and count_range().
| bvector< Alloc >::size_type bm::bvector< Alloc >::count_range_no_check | ( | size_type | left, |
| size_type | right, | ||
| const rs_index_type & | rs_idx ) const |
Returns count of 1 bits in the given range [left..right] Function expects that caller guarantees that left < right
Definition at line 3530 of file bm.h.
References BM_ASSERT, BMNOEXCEPT, count_to(), and test().
| bvector< Alloc >::size_type bm::bvector< Alloc >::count_to | ( | size_type | n, |
| const rs_index_type & | rs_idx ) const |
Returns count of 1 bits (population) in [0..right] range.
This operation is also known as rank of bit N.
| n | - index of bit to rank |
| rs_idx | - rank-select to accelerate search should be prepared using build_rs_index |
Definition at line 3088 of file bm.h.
References BM_ASSERT, BM_IS_GAP, BMGAP_PTR, BMNOEXCEPT, FULL_BLOCK_FAKE_ADDR, bm::get_block_coord(), bm::id_max, bm::set_block_mask, and bm::set_block_shift.
Referenced by bv_count_to_acc(), bv_count_to_range_acc(), count_range_no_check(), and bm::bvector< dbg_alloc >::rank().
| bvector< Alloc >::size_type bm::bvector< Alloc >::count_to_test | ( | size_type | n, |
| const rs_index_type & | rs_idx ) const |
popcount in [0..right] range if test(right) == true
This is conditional rank operation, which is faster than test() plus count_to()
| n | - index of bit to test and rank |
| rs_idx | - rank-select index (block count structure to accelerate search) should be prepared using build_rs_index() |
Definition at line 3141 of file bm.h.
References bm::bit_block_calc_count_to(), BM_ASSERT, BM_IS_GAP, BMGAP_PTR, BMNOEXCEPT, FULL_BLOCK_FAKE_ADDR, bm::gap_bit_count_to(), bm::get_block_coord(), bm::id_max, bm::set_block_mask, bm::set_block_shift, bm::set_word_mask, and bm::set_word_shift.
|
inline |
Returns true if the set is empty (no bits are set, otherwise returns false) Please note that this is NOT a size check, it is an empty SET check (absense of 1s).
Definition at line 1562 of file bm.h.
Referenced by combine_operation_block_and(), and combine_operation_block_sub().
|
inline |
Returns enumerator pointing on the next bit after the last.
Definition at line 1877 of file bm.h.
Referenced by combine_or_test(), DemoAND(), DemoOR(), DemoSUB(), DemoXOR(), main(), speed_test_sv_index(), and speed_test_vect_index().
|
inline |
Equal comparison with an agr bit-vector.
Definition at line 2017 of file bm.h.
Referenced by main(), main(), bm::bvector< dbg_alloc >::operator!=(), bm::bvector< dbg_alloc >::operator==(), Set3VL_AndDemo(), and Set3VL_ORDemo().
| void bm::bvector< Alloc >::erase | ( | size_type | n | ) |
Erase bit in the specified position All the vector content after erase position is shifted left.
| n | - index of the bit to insert |
Definition at line 5646 of file bm.h.
References bm::bit_block_erase(), bm::bit_block_shift_l1_unr(), BM_ASSERT, BM_ASSERT_THROW, bm::BM_BIT, BM_IS_GAP, BMGAP_PTR, bm::find_not_null_ptr(), FULL_BLOCK_FAKE_ADDR, bm::gap_is_all_zero(), bm::gap_limit(), bm::gap_max_bits, bm::gap_shift_l1(), bm::get_block_coord(), bm::id_max, IS_FULL_BLOCK, is_ro(), IS_VALID_ADDR, set_bit_no_check(), bm::set_block_mask, bm::set_block_shift, bm::set_block_size, bm::set_sub_array_size, bm::set_top_array_size, and test().
Referenced by main(), and shift_left().
|
inline |
Finds the number of the next bit ON and sets it to 0.
| prev | - Index of the previously found bit. |
Definition at line 1619 of file bm.h.
Referenced by main().
| void bm::bvector< Alloc >::fill_alloc_digest | ( | bvector< Alloc > & | bv_blocks | ) | const |
Calculate blocks digest vector (for diagnostics purposes) 1 is added if NB is a real, allocated block.
| bv_blocks | - [out] bvector of blocks statistics |
Definition at line 4058 of file bm.h.
References bvector(), FULL_BLOCK_FAKE_ADDR, init(), IS_VALID_ADDR, set_bit_no_check(), and bm::set_sub_array_size.
| bool bm::bvector< Alloc >::find | ( | size_type & | pos | ) | const |
Finds index of first 1 bit.
| pos | - [out] index of the found 1 bit |
Definition at line 5093 of file bm.h.
References bm::bit_find_first(), bm::bits_in_array, BM_IS_GAP, BMGAP_PTR, BMNOEXCEPT, FULL_BLOCK_FAKE_ADDR, FULL_SUB_BLOCK_REAL_ADDR, bm::gap_find_first(), bm::gap_max_bits, and bm::set_sub_array_size.
Referenced by access_bench3(), find(), find_first_mismatch(), find_range(), and main().
| bool bm::bvector< Alloc >::find | ( | size_type | from, |
| size_type & | pos ) const |
Find index of 1 bit starting from position.
| from | - position to start search from, please note that if bit at from position is set then it will be found, function uses closed interval [from... |
| pos | - [out] index of the found 1 bit |
Definition at line 4896 of file bm.h.
References BMNOEXCEPT, check_or_next(), find(), and bm::id_max.
| bool bm::bvector< Alloc >::find_first_mismatch | ( | const bvector< Alloc > & | bvect, |
| size_type & | pos, | ||
| size_type | search_to = bm::id_max ) const |
Find index of first bit different between this and the agr vector.
| bvect | - argumnet vector to compare with |
| pos | - [out] position of the first difference |
| search_to | - search limiter [0..to] to avoid overscan (default: unlimited to the vectors end) |
Definition at line 3862 of file bm.h.
References BLOCK_ADDR_SAN, bm::block_find_first_diff(), BMNOEXCEPT, bvector(), find(), FULL_BLOCK_FAKE_ADDR, FULL_BLOCK_REAL_ADDR, bm::gap_max_bits, bm::get_block_coord(), bm::set_block_shift, and bm::set_sub_array_size.
Referenced by bm::bvector< dbg_alloc >::equal(), and main().
| bool bm::bvector< Alloc >::find_range | ( | size_type & | first, |
| size_type & | last ) const |
Finds dynamic range of bit-vector [first, last].
| first | - index of the first found 1 bit |
| last | - index of the last found 1 bit |
Definition at line 5139 of file bm.h.
References BM_ASSERT, BMNOEXCEPT, find(), and find_reverse().
Referenced by main().
| bool bm::bvector< Alloc >::find_rank | ( | size_type | rank, |
| size_type | from, | ||
| size_type & | pos ) const |
Find bit-vector position for the specified rank(bitcount).
Rank based search, counts number of 1s from specified position until finds the ranked position relative to start from position. In other words: range population count between from and pos == rank.
| rank | - rank to find (bitcount) |
| from | - start positioon for rank search |
| pos | - position with speciefied rank (relative to from position) |
Definition at line 5159 of file bm.h.
References bm::block_find_rank(), BM_ASSERT, BM_ASSERT_THROW, BMNOEXCEPT, bm::gap_max_bits, bm::id_max, bm::set_block_mask, bm::set_block_shift, bm::set_block_size, and bm::set_total_blocks.
| bool bm::bvector< Alloc >::find_rank | ( | size_type | rank, |
| size_type | from, | ||
| size_type & | pos, | ||
| const rs_index_type & | rs_idx ) const |
Find bit-vector position for the specified rank(bitcount).
Rank based search, counts number of 1s from specified position until finds the ranked position relative to start from position. In other words: range population count between from and pos == rank.
| rank | - rank to find (bitcount) |
| from | - start positioon for rank search |
| pos | - position with speciefied rank (relative to from position) |
| rs_idx | - rank-select index to accelarate search (should be prepared using build_rs_index) |
Definition at line 5212 of file bm.h.
References bm::block_find_rank(), BM_ASSERT, BM_ASSERT_THROW, BMNOEXCEPT, bm::id_max, bm::set_block_mask, bm::set_block_shift, and bm::set_block_size.
| bool bm::bvector< Alloc >::find_reverse | ( | size_type & | pos | ) | const |
Finds last index of 1 bit.
| pos | - [out] index of the last found 1 bit |
Definition at line 4911 of file bm.h.
References bm::bit_find_last(), BM_IS_GAP, BMGAP_PTR, BMNOEXCEPT, FULL_BLOCK_FAKE_ADDR, FULL_SUB_BLOCK_REAL_ADDR, bm::gap_find_last(), bm::gap_max_bits, and bm::set_sub_array_size.
Referenced by access_bench2(), access_bench3(), build_rs_index(), clear(), copy_range_no_check(), find_range(), keep(), main(), and sync_size().
| bool bm::bvector< Alloc >::find_reverse | ( | size_type | from, |
| size_type & | pos ) const |
Reverse finds next(prev) index of 1 bit.
| from | - index to search from |
| pos | - [out] found position index (undefined if method returns false) |
Definition at line 4968 of file bm.h.
References bm::bit_find_last(), bm::block_find_reverse(), BM_IS_GAP, BMGAP_PTR, BMNOEXCEPT, FULL_BLOCK_FAKE_ADDR, FULL_SUB_BLOCK_REAL_ADDR, bm::gap_find_last(), bm::gap_max_bits, bm::get_block_coord(), bm::get_block_start(), bm::set_block_mask, bm::set_block_shift, bm::set_sub_array_size, and test().
|
inline |
Returns enumerator pointing on the first non-zero bit.
Definition at line 1871 of file bm.h.
Referenced by bv2delta(), bv_counted_enumerator(), compute_kmer_histogram(), compute_random_clusters(), convert_bv2sv(), convert_bv2vect(), CSequenceColl::deserialize_k_mers(), CSeqClusters::elect_leaders(), generate_random_subset(), main(), print_bvector(), print_bvector(), print_sorted(), PrintKleeneVector(), speed_test_bv_index(), speed_test_bvs_index(), speed_test_sv_index(), speed_test_vect_index(), and DNA_FingerprintScanner< bm::bvector<> >::TranslateResults().
|
inline |
|
inline |
Flips bit n.
Definition at line 1273 of file bm.h.
Referenced by main().
|
inline |
| void bm::bvector< Alloc >::freeze | ( | ) |
Turn current vector to read-only (immutable vector).
After calling this method any modification (non-const methods) will cause undefined behavior (likely crash or assert)
Definition at line 8058 of file bm.h.
References bvector(), is_ro(), bm::READONLY, and swap().
Referenced by main().
|
protected |
set bit in GAP block with GAP block length control
Definition at line 4714 of file bm.h.
References bm::gap_length(), bm::gap_limit(), and bm::gap_set_value().
Referenced by and_bit_no_check(), inc(), set_bit_conditional_impl(), and set_bit_no_check().
|
protected |
set bit in GAP block with GAP block length control
Definition at line 4733 of file bm.h.
References bm::gap_length(), bm::gap_limit(), and bm::gap_set_value().
Referenced by clear_bit_no_check(), import_block(), set_bit_no_check(), and swap().
|
inline |
|
inline |
| bool bm::bvector< Alloc >::get_bit | ( | size_type | n | ) | const |
returns true if bit n is set and false is bit n is 0.
| n | - Index of the bit to check. |
Definition at line 3602 of file bm.h.
References BM_ASSERT, BM_ASSERT_THROW, BM_IS_GAP, BMGAP_PTR, BMNOEXCEPT, FULL_BLOCK_FAKE_ADDR, bm::gap_test_unr(), bm::get_block_coord(), bm::set_block_mask, bm::set_block_shift, bm::set_word_mask, and bm::set_word_shift.
Referenced by bm::bvector< dbg_alloc >::operator[](), and bm::bvector< dbg_alloc >::test().
|
inline |
|
inline |
get access to memory manager (internal) Use only if you are BitMagic library
Definition at line 2058 of file bm.h.
Referenced by bit_and(), bit_or(), bit_or_and(), bit_sub(), bit_xor(), bm::combine_or(), bm::combine_xor(), bm::find_interval_start(), bm::for_each_bit(), and bm::for_each_bit_range_no_check().
|
inline |
Returns enumerator pointing on specified or the next available bit.
Definition at line 1883 of file bm.h.
Referenced by bm::bvector< dbg_alloc >::first(), main(), and verify_histograms().
|
inline |
find first 1 bit in vector. Function may return 0 and this requires an extra check if bit 0 is actually set or bit-vector is empty
Definition at line 1600 of file bm.h.
Referenced by main(), print_bvector(), and CSeqClusters::take_group().
|
inline |
Returns blocks allocation strategy.
Definition at line 1920 of file bm.h.
Referenced by and_bit_no_check(), clear_bit_no_check(), inc(), insert(), set_bit_conditional_impl(), set_bit_no_check(), and set_bit_no_check().
|
inline |
Finds the number of the next bit ON.
| prev | - Index of the previously found bit. |
Definition at line 1609 of file bm.h.
Referenced by main(), and print_bvector().
| void bm::bvector< Alloc >::import | ( | const size_type * | ids, |
| size_type | ids_size, | ||
| bm::sort_order | sorted_idx ) |
Import integers (set bits).
(Fast, no checks).
Definition at line 4245 of file bm.h.
References BM_ASSERT, bm::BM_SORTED, bm::get_block_coord(), bm::idx_arr_block_lookup_u32(), bm::idx_arr_block_lookup_u64(), import_block(), is_ro(), and bm::set_block_shift.
|
protected |
Definition at line 4363 of file bm.h.
References BM_ASSERT, BM_DECLARE_TEMP_BLOCK, bm::BM_GAP, BM_IS_GAP, BMGAP_PTR, gap_block_set_no_ret(), bm::get_block_coord(), IS_FULL_BLOCK, opt_compress, bm::set_block_bits_u32(), bm::set_block_bits_u64(), bm::set_block_mask, bm::set_block_size, and bm::set_total_blocks.
Referenced by import(), and import_sorted().
| void bm::bvector< Alloc >::import_sorted | ( | const size_type * | ids, |
| const size_type | ids_size, | ||
| bool | opt_flag ) |
Import sorted integers (set bits).
(Fast, no checks).
Definition at line 4297 of file bm.h.
References BM_ASSERT, bm::get_block_coord(), bm::id_max, bm::idx_arr_block_lookup_u32(), bm::idx_arr_block_lookup_u64(), import_block(), opt_compress, bm::set_block_mask, and bm::set_block_shift.
Referenced by bm::str_sparse_vector< char, bm::bvector<>, 64 >::import_char_slice().
| bool bm::bvector< Alloc >::inc | ( | size_type | n | ) |
Increment the specified element.
Bit increment rules: 0 + 1 = 1 (no carry over) 1 + 1 = 0 (with carry over returned)
| n | - index of the bit to be set |
Definition at line 4751 of file bm.h.
References BM_ASSERT, BM_IS_GAP, BMGAP_PTR, gap_block_set(), bm::gap_test_unr(), get_new_blocks_strat(), is_ro(), IS_VALID_ADDR, bm::set_block_mask, bm::set_block_shift, bm::set_word_mask, and bm::set_word_shift.
Referenced by bm::bvector< dbg_alloc >::flip().
| void bm::bvector< Alloc >::init | ( | ) |
Explicit post-construction initialization. Must be caled to make sure safe use of *_no_check() methods.
Definition at line 2280 of file bm.h.
References BM_ASSERT, and is_ro().
Referenced by build_rs_index(), bv_set_bit_no_check_test(), bm::bvector< dbg_alloc >::bvector(), bm::basic_bmatrix< BV >::construct_bvector(), fill_alloc_digest(), load_snp_report(), main(), run_benchmark(), and vector_search().
| void bm::bvector< Alloc >::init | ( | unsigned | top_size, |
| bool | alloc_subs ) |
Explicit post-construction initialization. Must be caled right after construction strickly before any modificating calls to make sure safe use of *_no_check() methods. This init can do pre-allocation of top level structures.
| top_size | - request to do pre-allocation of the top level of a sparse bit-vector tree (can be up to 256 for 32-bit mode) |
| alloc_subs | - if true also allocates second level structures |
| bool bm::bvector< Alloc >::insert | ( | size_type | n, |
| bool | value ) |
Insert bit into specified position All the vector content after insert position is shifted right.
| n | - index of the bit to insert |
| value | - insert value |
Definition at line 5443 of file bm.h.
References bm::bit_block_insert(), bm::bit_block_shift_r1_unr(), BM_ASSERT, BM_ASSERT_THROW, BM_IS_GAP, BMGAP_PTR, FULL_BLOCK_FAKE_ADDR, bm::gap_insert(), bm::gap_limit(), bm::gap_max_bits, bm::gap_shift_r1(), bm::get_block_coord(), get_new_blocks_strat(), bm::id_max, IS_FULL_BLOCK, is_ro(), IS_VALID_ADDR, set(), set_bit_no_check(), bm::set_block_mask, bm::set_block_shift, bm::set_block_size, bm::set_sub_array_size, bm::set_top_array_size, bm::set_total_blocks, and bm::bvector< Alloc >::enumerator::value().
Referenced by main(), and shift_right().
|
inline |
Function erturns insert iterator for this bitvector
Definition at line 1287 of file bm.h.
Referenced by main(), and Set3VL_ValueDemo2().
| bvector< Alloc > & bm::bvector< Alloc >::invert | ( | ) |
Invert/NEG all bits It should be noted, invert is affected by size() if size is set - it only inverts [0..size-1] bits.
Definition at line 3550 of file bm.h.
References bm::bit_invert(), BM_ASSERT, BM_IS_GAP, BMGAP_PTR, bvector(), clear_range_no_check(), FULL_BLOCK_FAKE_ADDR, bm::gap_invert(), bm::id_max, IS_FULL_BLOCK, is_ro(), set_bit_no_check(), bm::set_sub_array_size, and bm::set_top_array_size.
Referenced by DemoINV(), bm::bvector< dbg_alloc >::flip(), main(), bm::bvector< dbg_alloc >::operator~(), and bm::sparse_vector_find_mismatch().
| bool bm::bvector< Alloc >::is_all_one_range | ( | size_type | left, |
| size_type | right ) const |
Returns true if all bits in the range are 1s (saturated interval) Function uses closed interval [left, right].
| left | - index of first bit start checking |
| right | - index of last bit |
Definition at line 3338 of file bm.h.
References bm::block_is_all_one_range(), BM_ASSERT, BMNOEXCEPT, bm::check_block_one(), FULL_BLOCK_FAKE_ADDR, bm::gap_max_bits, bm::get_block_coord(), bm::id_max, bm::set_block_mask, bm::set_block_shift, bm::set_sub_array_size, test(), and bm::xor_swap().
Referenced by main().
|
inline |
|
inline |
Returns true if vector is read-only.
Definition at line 1060 of file bm.h.
Referenced by and_bit_no_check(), bit_and(), bm::bvector< dbg_alloc >::bit_and(), bit_or(), bm::bvector< dbg_alloc >::bit_or(), bit_or_and(), bit_sub(), bm::bvector< dbg_alloc >::bit_sub(), bit_xor(), bm::bvector< dbg_alloc >::bit_xor(), calc_stat(), check_or_next_extract(), clear(), clear(), clear_bit_no_check(), erase(), freeze(), import(), inc(), init(), init(), insert(), invert(), keep(), keep_range(), main(), merge(), optimize(), optimize_range(), resize(), set(), set(), set(), set_bit(), set_bit_and(), set_bit_no_check(), set_bit_no_check(), set_gap_levels(), set_range(), shift_left(), shift_right(), swap(), and sync_size().
| void bm::bvector< Alloc >::keep | ( | const size_type * | ids, |
| size_type | ids_size, | ||
| bm::sort_order | so = bm::BM_UNKNOWN ) |
Keep list of bits in this bitset, others are cleared.
This is equivalent of AND (Set Intersect), argument set as an array.
| ids | - pointer on array of indexes to set |
| ids_size | - size of the input (ids) |
| so | - sort order (use BM_SORTED for faster load) |
Definition at line 4105 of file bm.h.
References bit_and(), BM_ASSERT, bvector(), clear(), find_reverse(), import(), is_ro(), and resize().
Referenced by DemoAND().
| void bm::bvector< Alloc >::keep_range | ( | size_type | left, |
| size_type | right ) |
Sets all bits to zero outside of the closed interval [left,right] Expected result: 00000...0[left, right]0....0000.
| left | - interval start |
| right | - interval end (closed interval) |
Definition at line 2353 of file bm.h.
References BM_ASSERT, is_ro(), and bm::xor_swap().
Referenced by main().
| void bm::bvector< Alloc >::merge | ( | bm::bvector< Alloc > & | bvect | ) |
Merge/move content from another vector.
Merge performs a logical OR operation, but the source vector is not immutable. Source content gets destroyed (memory moved) to create a union of two vectors. Merge operation can be more efficient than OR if argument is a temporary vector.
| bvect | - [in, out] - source vector (NOT immutable) |
Definition at line 5816 of file bm.h.
References bit_or(), BM_ASSERT, combine_operation_block_or(), FULL_BLOCK_FAKE_ADDR, is_ro(), and bm::set_sub_array_size.
Referenced by CKMerAcc::add(), DemoOR(), and main().
| void bm::bvector< Alloc >::move_from | ( | bvector< Alloc > & | bvect | ) |
Move bvector content from another bvector.
Definition at line 2340 of file bm.h.
References BMNOEXCEPT, and bvector().
Referenced by bm::bvector< dbg_alloc >::operator=().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
| void bm::bvector< Alloc >::optimize | ( | bm::word_t * | temp_block = 0, |
| optmode | opt_mode = opt_compress, | ||
| statistics * | stat = 0 ) |
Optimize memory bitvector's memory allocation.
Function analyze all blocks in the bitvector, compresses blocks with a regular structure, frees some memory. This function is recommended after a bulk modification of the bitvector using set_bit, clear_bit or logical operations.
Optionally function can calculate vector post optimization statistics
| temp_block | - externally allocated temp buffer for optimization BM_DECLARE_TEMP_BLOCK(tb) if NULL - it will allocated (and de-allocated upon exit) |
| opt_mode | - optimization level |
| stat | - statistics of memory consumption and serialization stat can also be computed by calc_stat() but it would require an extra pass |
Definition at line 3635 of file bm.h.
References BM_ASSERT, calc_stat(), bm::bv_statistics::gap_levels, bm::gap_levels, is_ro(), bm::bv_statistics::max_serialize_mem, bm::bv_statistics::memory_used, and bm::bv_statistics::reset().
Referenced by compute_seq_group_union(), generate_bvector(), generate_k_mers(), GenerateDemoVector(), main(), main(), make_BLOB(), serialize_bvector(), Set3VL_ValueDemo(), Set3VL_ValueDemo2(), speed_test_bv_index(), speed_test_bvs_index(), speed_test_sv_index(), speed_test_vect_index(), and write_as_bvector().
| void bm::bvector< Alloc >::optimize_gap_size | ( | ) |
Optimize sizes of GAP blocks.
This method runs an analysis to find optimal GAP levels for the specific vector. Current GAP compression algorithm uses several fixed GAP sizes. By default bvector uses some reasonable preset.
Definition at line 3700 of file bm.h.
References bvector(), calc_stat(), bm::gap_levels, bm::improve_gap_levels(), and set_gap_levels().
| void bm::bvector< Alloc >::optimize_range | ( | size_type | left, |
| size_type | right, | ||
| bm::word_t * | temp_block, | ||
| optmode | opt_mode = opt_compress ) |
Run partial vector optimization for the area [left..right] (specified in bit coordinates)
| left | - bit index to optimize from (approximate, rounded up to a nearest block) |
| right | - bit index to optimize to Please note that left and right define range in bit coordinates but later rounded to blocks |
| temp_block | - external scratch memory (MUST be pre-allocated) |
| opt_mode | - optimization level |
Definition at line 3671 of file bm.h.
References BM_ASSERT, bm::get_block_coord(), is_ro(), and bm::set_block_shift.
|
inline |
Returns rank of specified bit position (same as count_to()).
| n | - index of bit to rank |
| rs_idx | - rank-select index |
Definition at line 1433 of file bm.h.
Referenced by main(), bm::bvector< Alloc >::enumerator::skip(), and bm::bvector< Alloc >::enumerator::skip_to_rank().
| bvector< Alloc >::size_type bm::bvector< Alloc >::rank_corrected | ( | size_type | n, |
| const rs_index_type & | rs_idx ) const |
Returns rank corrceted by the requested border value (as -1).
This is rank function (bit-count) minus value of bit 'n' if bit-n is true function returns rank()-1 if false returns rank() faster than rank() + test().
| n | - index of bit to rank |
| rs_idx | - rank-select index |
Definition at line 3197 of file bm.h.
References BM_ASSERT, BM_IS_GAP, BMGAP_PTR, BMNOEXCEPT, FULL_BLOCK_FAKE_ADDR, bm::gap_bit_count_to(), bm::get_block_coord(), bm::id_max, bm::set_block_mask, bm::set_block_shift, bm::set_word_mask, and bm::set_word_shift.
Referenced by main().
|
inline |
|
inline |
Clears every bit in the bitvector.
Definition at line 1267 of file bm.h.
Referenced by bv_set_bit_test(), generate_test_set(), and main().
| void bm::bvector< Alloc >::resize | ( | size_type | new_size | ) |
Change size of the bvector.
| new_size | - new size in bits |
Definition at line 2463 of file bm.h.
References BM_ASSERT, is_ro(), and set_range().
Referenced by clear(), copy(), DemoAND(), DemoAND_OR(), DemoINV(), DemoOR(), DemoSUB(), DemoXOR(), keep(), main(), bm::bvector< dbg_alloc >::operator[](), pick_benchmark_set(), set_bit(), set_bit_conditional(), set_range(), bm::sparse_vector_find_mismatch(), and sync_size().
| bool bm::bvector< Alloc >::select | ( | size_type | rank, |
| size_type & | pos, | ||
| const rs_index_type & | rs_idx ) const |
select bit-vector position for the specified rank(bitcount)
Rank based search, counts number of 1s from specified position until finds the ranked position relative to start from position. Uses In other words: range population count between from and pos == rank.
| rank | - rank to find (bitcount) |
| pos | - position with speciefied rank (relative to from position) [out] |
| rs_idx | - block count structure to accelerate rank search |
Definition at line 5283 of file bm.h.
References bm::block_find_rank(), BM_ASSERT, BMNOEXCEPT, FULL_BLOCK_FAKE_ADDR, bm::gap_max_bits, bm::get_block_coord(), and bm::set_block_size.
Referenced by main().
| bvector< Alloc > & bm::bvector< Alloc >::set | ( | ) |
| void bm::bvector< Alloc >::set | ( | const size_type * | ids, |
| size_type | ids_size, | ||
| bm::sort_order | so = bm::BM_UNKNOWN ) |
Set list of bits in this bitset to 1.
Method implements optimized bulk setting of multiple bits at once. The best results are achieved when the imput comes sorted. This is equivalent of OR (Set Union), argument set as an array.
| ids | - pointer on array of indexes to set |
| ids_size | - size of the input (ids) |
| so | - sort order (use BM_SORTED for faster load) |
Definition at line 4088 of file bm.h.
References BM_ASSERT, is_ro(), and sync_size().
| bvector< Alloc > & bm::bvector< Alloc >::set | ( | size_type | n, |
| bool | val = true ) |
Sets bit n if val is true, clears bit n if val is false.
| n | - index of the bit to be set |
| val | - new bit value |
Definition at line 4188 of file bm.h.
References BM_ASSERT, bvector(), is_ro(), and set_bit().
Referenced by CKMerAcc::add(), bvector_bulk_set_test(), DemoOR(), CSeqClusters::elect_leaders(), fill_bvector(), fill_bvector(), fill_bvector(), generate_bvector(), main(), pick_benchmark_set(), run_benchmark(), and write_as_bvector().
|
inline |
Set allocator pool for local (non-th readed) memory cyclic(lots of alloc-free ops) opertations.
Definition at line 1040 of file bm.h.
Referenced by assign_to_best_cluster(), and assign_to_best_cluster_union().
| bool bm::bvector< Alloc >::set_bit | ( | size_type | n, |
| bool | val = true ) |
Sets bit n.
| n | - index of the bit to be set. |
| val | - new bit value |
Definition at line 4227 of file bm.h.
References BM_ASSERT, BM_ASSERT_THROW, bm::id_max, is_ro(), resize(), and set_bit_no_check().
Referenced by bv_set_bit_test(), bm::bvector< dbg_alloc >::clear_bit(), fill_bvector(), fill_bvector(), generate_random_vector(), main(), and set().
| bool bm::bvector< Alloc >::set_bit_and | ( | size_type | n, |
| bool | val = true ) |
Sets bit n using bit AND with the provided value.
| n | - index of the bit to be set. |
| val | - new bit value |
Definition at line 4213 of file bm.h.
References and_bit_no_check(), BM_ASSERT, BM_ASSERT_THROW, and is_ro().
| bool bm::bvector< Alloc >::set_bit_conditional | ( | size_type | n, |
| bool | val, | ||
| bool | condition ) |
Sets bit n only if current value equals the condition.
| n | - index of the bit to be set. |
| val | - new bit value |
| condition | - expected current value |
Definition at line 4199 of file bm.h.
References bm::id_max, resize(), and set_bit_conditional_impl().
Referenced by main().
|
protected |
Definition at line 4784 of file bm.h.
References BMGAP_PTR, gap_block_set(), get_new_blocks_strat(), IS_VALID_ADDR, bm::set_block_mask, bm::set_block_shift, bm::set_word_mask, and bm::set_word_shift.
Referenced by set_bit_conditional().
| void bm::bvector< Alloc >::set_bit_no_check | ( | size_type | n | ) |
Set bit without checking preconditions (size, etc).
Fast set bit method, without safety net. Make sure you call bvector<>::init() before setting bits with this function.
| n | - bit number |
Definition at line 4646 of file bm.h.
References BM_ASSERT, BM_ASSERT_THROW, BMGAP_PTR, gap_block_set_no_ret(), get_new_blocks_strat(), bm::id_max, is_ro(), IS_VALID_ADDR, bm::set_block_mask, bm::set_block_shift, bm::set_word_mask, and bm::set_word_shift.
Referenced by build_rs_index(), bv_set_bit_no_check_test(), bm::bvector< dbg_alloc >::bvector(), erase(), fill_alloc_digest(), insert(), invert(), load_snp_report(), main(), run_benchmark(), set_bit(), swap(), and vector_search().
| bool bm::bvector< Alloc >::set_bit_no_check | ( | size_type | n, |
| bool | val ) |
Set specified bit without checking preconditions (size, etc).
Definition at line 4597 of file bm.h.
References BM_ASSERT, BM_ASSERT_THROW, BMGAP_PTR, gap_block_set(), get_new_blocks_strat(), bm::id_max, is_ro(), IS_VALID_ADDR, bm::set_block_mask, bm::set_block_shift, bm::set_word_mask, and bm::set_word_shift.
| void bm::bvector< Alloc >::set_gap_levels | ( | const gap_word_t * | glevel_len | ) |
Sets new GAP lengths table. All GAP blocks will be reallocated to match the new scheme.
| glevel_len | - pointer on C-style array keeping GAP block sizes. |
Definition at line 3726 of file bm.h.
References BM_ASSERT, bvector(), bm::for_each_nzblock(), is_ro(), and set_gap_levels().
Referenced by optimize_gap_size(), and set_gap_levels().
|
inline |
Sets new blocks allocation strategy.
| strat | - Strategy code 0 - bitblocks allocation only. 1 - Blocks mutation mode (adaptive algorithm) |
Definition at line 1912 of file bm.h.
Referenced by main().
| bvector< Alloc > & bm::bvector< Alloc >::set_range | ( | size_type | left, |
| size_type | right, | ||
| bool | value = true ) |
Sets all bits in the specified closed interval [left,right] Interval must be inside the bvector's size. This method DOES NOT resize vector.
| left | - interval start |
| right | - interval end (closed interval) |
| value | - value to set interval in |
Definition at line 2368 of file bm.h.
References BM_ASSERT, BM_ASSERT_THROW, bvector(), clear_range_no_check(), bm::id_max, is_ro(), resize(), set_range(), set_range_no_check(), and bm::bvector< Alloc >::enumerator::value().
Referenced by add_object(), bv_count_and(), bm::bvector< dbg_alloc >::clear_range(), combine_operation(), compute_jaccard_clusters(), generate_bvector(), main(), main(), resize(), set(), and set_range().
| void bm::bvector< Alloc >::set_range_no_check | ( | size_type | left, |
| size_type | right ) |
Set range without validity/bounds checking.
Definition at line 7830 of file bm.h.
References bm::bits_in_block, BM_ASSERT, BM_IS_GAP, bm::BM_OR, combine_operation_with_block(), bm::gap_init_range_block(), bm::get_block_coord(), bm::set_block_mask, and bm::set_block_shift.
Referenced by build_rs_index(), and set_range().
| bool bm::bvector< Alloc >::shift_left | ( | ) |
| bool bm::bvector< Alloc >::shift_right | ( | ) |
Shift right by 1 bit, fill with zero return carry out.
Definition at line 5423 of file bm.h.
References BM_ASSERT, insert(), and is_ro().
Referenced by DNA_FingerprintScanner< bm::bvector<> >::Find(), and main().
|
inline |
Returns bvector's capacity (number of bits it can store).
return current size of the vector (bits)
Definition at line 1300 of file bm.h.
Referenced by bm::combine_or(), generate_k_mers(), print_bvector(), and run_benchmark().
| void bm::bvector< Alloc >::swap | ( | bvector< Alloc > & | bvect | ) |
Exchanges content of bv and this bvector.
Definition at line 3966 of file bm.h.
References BMNOEXCEPT, bvector(), and bm::xor_swap().
Referenced by freeze(), main(), and CSeqClusters::take_group().
| void bm::bvector< Alloc >::swap | ( | size_type | idx1, |
| size_type | idx2 ) |
swap values of bits
| idx1 | - index of bit to swap with |
| idx2 | - index of bit to swap with |
Definition at line 4406 of file bm.h.
References BM_ASSERT, BM_ASSERT_THROW, BM_IS_GAP, BMGAP_PTR, FULL_BLOCK_FAKE_ADDR, bm::gap_bfind(), gap_block_set_no_ret(), bm::gap_length(), bm::gap_limit(), bm::gap_set_value_cpos(), bm::gap_test_unr(), bm::get_block_coord(), bm::id_max, is_ro(), set_bit_no_check(), bm::set_block_mask, bm::set_block_shift, bm::set_word_mask, and bm::set_word_shift.
|
protected |
Syncronize size if it got extended due to bulk import.
Definition at line 2486 of file bm.h.
References BM_ASSERT, find_reverse(), bm::id_max, is_ro(), and resize().
Referenced by set().
|
inline |
returns true if bit n is set and false is bit n is 0.
| n | - Index of the bit to check. |
Definition at line 1502 of file bm.h.
Referenced by any_range(), compute_group(), count_range_no_check(), CSeqClusters::elect_leaders(), erase(), find_reverse(), is_all_one_range(), load_snp_report(), main(), pick_benchmark_set(), PrintKleeneVector(), and shift_left().
|
static |
|
friend |
|
friend |
|
friend |
Definition at line 793 of file bm.h.
Referenced by bm::bvector< dbg_alloc >::end(), and bm::bvector< dbg_alloc >::get_enumerator().
|
friend |