|
BitMagic-C++
|
algorithms for sparse_vector scan/search More...
#include <bmsparsevec_algo.h>
Data Structures | |
| class | pipeline |
| Pipeline to run multiple searches against a particular SV faster using cache optimizations. More... | |
Public Types | |
| typedef SV::bvector_type | bvector_type |
| typedef const bvector_type * | bvector_type_const_ptr |
| typedef bvector_type * | bvector_type_ptr |
| typedef SV::value_type | value_type |
| typedef SV::size_type | size_type |
| typedef bvector_type::allocator_type | allocator_type |
| typedef allocator_type::allocator_pool_type | allocator_pool_type |
| typedef bm::aggregator< bvector_type > | aggregator_type |
| typedef bm::heap_vector< value_type, typename bvector_type::allocator_type, true > | remap_vector_type |
| typedef bm::heap_vector< bvector_type *, allocator_type, true > | bvect_vector_type |
| typedef aggregator_type::bv_count_vector_type | bv_count_vector_type |
| typedef aggregator_type::run_options | run_options |
| Scanner options to control execution. | |
Public Member Functions | |
| sparse_vector_scanner () | |
| void | bind (const SV &sv, bool sorted) |
| bind sparse vector for all searches | |
| void | reset_binding () BMNOEXCEPT |
| reset sparse vector binding | |
| template<bool BOUND> | |
| bool | bfind_eq_str_impl (const SV &sv, const typename SV::value_type *str, size_t in_len, bool remaped, typename SV::size_type &pos) |
| template<bool BOUND> | |
| int | compare_str (const SV &sv, size_type idx, const value_type *BMRESTRICT str) const BMNOEXCEPT |
Find in scalar vector | |
| void | find_eq (const SV &sv, value_type value, bvector_type &bv_out) |
| find all sparse vector elements EQ to search value | |
| template<typename BII> | |
| void | find_eq (const SV &sv, value_type value, BII bi) |
| find all sparse vector elements EQ to search value | |
| bool | find_eq (const SV &sv, value_type value, size_type &pos) |
| find first sparse vector element | |
| bool | bfind (const SV &sv, const value_type val, size_type &pos) |
| binary search for position in the sorted sparse vector | |
| void | find_gt (const SV &sv, value_type val, bvector_type &bv_out) |
| find all elements sparse vector element greater (>) than value | |
| void | find_ge (const SV &sv, value_type val, bvector_type &bv_out) |
| find all elements sparse vector element greater or equal (>=) than value | |
| void | find_lt (const SV &sv, value_type val, bvector_type &bv_out) |
| find all elements sparse vector element less (<) than value | |
| void | find_le (const SV &sv, value_type val, bvector_type &bv_out) |
| find all elements sparse vector element less or equal (<=) than value | |
| void | find_range (const SV &sv, value_type from, value_type to, bvector_type &bv_out) |
| find all elements sparse vector element in closed range [left..right] interval | |
Find in bit-transposed string vector | |
| enum | search_algo_params { linear_cutoff1 = 16 , linear_cutoff2 = 128 } |
| enum | code { sub_bfind_block_cnt = S_FACTOR , sub_block_l1_size = bm::gap_max_bits / S_FACTOR } |
| typedef bm::dynamic_heap_matrix< value_type, allocator_type > | heap_matrix_type |
| typedef bm::dynamic_heap_matrix< value_type, allocator_type > | matrix_search_buf_type |
| typedef bm::heap_vector< bm::id64_t, typename bvector_type::allocator_type, true > | mask_vector_type |
| bool | find_eq_str (const SV &sv, const value_type *str, bvector_type &bv_out) |
| find sparse vector elements (string) | |
| bool | find_eq_str (const value_type *str, bvector_type &bv_out) |
| find sparse vector elementa (string) in the attached SV | |
| bool | find_eq_str (const SV &sv, const value_type *str, size_type &pos) |
| find first sparse vector element (string) | |
| bool | find_eq_str (const value_type *str, size_type &pos) |
| binary find first sparse vector element (string) Sparse vector must be attached (bind()) | |
| bool | find_eq_str_prefix (const SV &sv, const value_type *str, bvector_type &bv_out) |
| find sparse vector elements with a given prefix (string) | |
| template<class TPipe> | |
| void | find_eq_str (TPipe &pipe) |
| find sparse vector elements using search pipeline | |
| bool | bfind_eq_str (const SV &sv, const value_type *str, size_type &pos) |
| binary find first sparse vector element (string). | |
| bool | lower_bound_str (const SV &sv, const value_type *str, size_type &pos) |
| lower bound search for an array position | |
| bool | bfind_eq_str (const value_type *str, size_type &pos) |
| binary find first sparse vector element (string) Sparse vector must be sorted and attached (use method bind()) | |
| bool | bfind_eq_str (const value_type *str, size_t len, size_type &pos) |
| binary find first sparse vector element (string) Sparse vector must be sorted and attached (use method bind()) | |
| void | find_zero (const SV &sv, bvector_type &bv_out, bool null_correct=true) |
| find all sparse vector elements EQ to 0 | |
| void | find_nonzero (const SV &sv, bvector_type &bv_out) |
| Find non-zero elements Output vector is computed as a logical OR (join) of all planes. | |
| void | find_positive (const SV &sv, bvector_type &bv_out) |
| Find positive (greter than zero elements) Output vector is computed as a logical OR (join) of all planes. | |
| void | invert (const SV &sv, bvector_type &bv_out) |
| invert search result ("EQ" to "not EQ") | |
| template<typename It> | |
| void | find_eq (const SV &sv, It start, It end, bvector_type &bv_out) |
| find all values A IN (C, D, E, F) | |
| void | find_eq_with_nulls_horizontal (const SV &sv, value_type value, bvector_type &bv_out) |
| For testing purposes only. | |
| void | find_gt_horizontal (const SV &sv, value_type value, bvector_type &bv_out, bool null_correct=true) |
| For testing purposes only. | |
| void | correct_nulls (const SV &sv, bvector_type &bv_out) |
| Exclude possible NULL values from the result vector. | |
| allocator_pool_type & | get_bvector_alloc_pool () BMNOEXCEPT |
| Return allocator pool for blocks (Can be used to improve performance of repeated searches with the same scanner). | |
| template<bool BOUND> | |
| bool | bfind_eq_str_impl (const SV &sv, const value_type *str, size_t in_len, bool remaped, size_type &pos) |
| void | set_search_range (size_type from, size_type to) BMNOEXCEPT |
| set search boundaries (hint for the aggregator) | |
| void | reset_search_range () BMNOEXCEPT |
| reset (disable) search range | |
| bool | find_eq_with_nulls (const SV &sv, value_type value, bvector_type &bv_out, size_type search_limit=0) |
| find value (may include NULL indexes) | |
| bool | find_first_eq (const SV &sv, value_type value, size_type &idx) |
| find first value (may include NULL indexes) | |
| bool | find_first_eq (const SV &sv, const value_type *str, size_t in_len, size_type &idx, bool remaped, unsigned prefix_len) |
| find first string value (may include NULL indexes) | |
| bool | find_eq_str_impl (const SV &sv, const value_type *str, bvector_type &bv_out, bool prefix_sub) |
| find EQ str / prefix impl | |
| bool | prepare_and_sub_aggregator (const SV &sv, value_type value) |
| Prepare aggregator for AND-SUB (EQ) search. | |
| bool | prepare_and_sub_aggregator (const SV &sv, const value_type *str, unsigned octet_start, bool prefix_sub) |
| Prepare aggregator for AND-SUB (EQ) search (string). | |
| void | decompress (const SV &sv, bvector_type &bv_out) |
| Rank-Select decompression for RSC vectors. | |
| template<bool BOUND> | |
| int | compare_str (const SV &sv, size_type idx, const value_type *str) const BMNOEXCEPT |
| compare sv[idx] with input str | |
| int | compare (const SV &sv, size_type idx, const value_type val) BMNOEXCEPT |
| compare sv[idx] with input value | |
| void | aggregate_OR_slices (bvector_type &bv_target, const SV &sv, unsigned from, unsigned total_planes) |
| void | resize_buffers () |
| sparse_vector_scanner (const sparse_vector_scanner &)=delete | |
| void | operator= (const sparse_vector_scanner &)=delete |
| static bool | remap_tosv (remap_vector_type &remap_vect_target, const value_type *str, const SV &sv) |
| Remap input value into SV char encodings. | |
| static void | aggregate_AND_OR_slices (bvector_type &bv_target, const bvector_type &bv_mask, const SV &sv, unsigned from, unsigned total_planes) |
| static constexpr int | gt_slice_limit () noexcept |
| Return the slice limit for signed/unsigned vector value types. | |
| template<typename AGG> | |
| static void | add_agg_char (AGG &agg, const SV &sv, int octet_idx, bm::id64_t planes_mask, unsigned value) |
| Addd char to aggregator (AND-SUB). | |
algorithms for sparse_vector scan/search
Scanner uses properties of bit-vector planes to answer questions like "find all sparse vector elements equivalent to XYZ".
Class uses fast algorithms based on properties of bit-planes. This is NOT a brute force, direct scan, scanner uses search space pruning and cache optimizations to run the search.
S_FACTOR - Sampling factor for search. Can be: [ 4, 8, 16, 32, 64 ]. Default: 16. Lower sampling facor (4, 8) lowers memory footprint for the scanner class instance Higher - improves search performance (at the expense for memory for sampled elements) Sampling factor is used for binary search in bound string sparse vector, so memory consumption depends on sampling and max string length.
Definition at line 581 of file bmsparsevec_algo.h.
| typedef bm::aggregator<bvector_type> bm::sparse_vector_scanner< SV, S_FACTOR >::aggregator_type |
Definition at line 593 of file bmsparsevec_algo.h.
| typedef allocator_type::allocator_pool_type bm::sparse_vector_scanner< SV, S_FACTOR >::allocator_pool_type |
Definition at line 591 of file bmsparsevec_algo.h.
| typedef bvector_type::allocator_type bm::sparse_vector_scanner< SV, S_FACTOR >::allocator_type |
Definition at line 590 of file bmsparsevec_algo.h.
| typedef aggregator_type::bv_count_vector_type bm::sparse_vector_scanner< SV, S_FACTOR >::bv_count_vector_type |
Definition at line 600 of file bmsparsevec_algo.h.
| typedef bm::heap_vector<bvector_type*, allocator_type, true> bm::sparse_vector_scanner< SV, S_FACTOR >::bvect_vector_type |
Definition at line 598 of file bmsparsevec_algo.h.
| typedef SV::bvector_type bm::sparse_vector_scanner< SV, S_FACTOR >::bvector_type |
Definition at line 584 of file bmsparsevec_algo.h.
| typedef const bvector_type* bm::sparse_vector_scanner< SV, S_FACTOR >::bvector_type_const_ptr |
Definition at line 585 of file bmsparsevec_algo.h.
| typedef bvector_type* bm::sparse_vector_scanner< SV, S_FACTOR >::bvector_type_ptr |
Definition at line 586 of file bmsparsevec_algo.h.
|
protected |
Definition at line 1150 of file bmsparsevec_algo.h.
|
protected |
Definition at line 1155 of file bmsparsevec_algo.h.
|
protected |
Definition at line 1151 of file bmsparsevec_algo.h.
| typedef bm::heap_vector<value_type, typename bvector_type::allocator_type, true> bm::sparse_vector_scanner< SV, S_FACTOR >::remap_vector_type |
Definition at line 596 of file bmsparsevec_algo.h.
| typedef aggregator_type::run_options bm::sparse_vector_scanner< SV, S_FACTOR >::run_options |
Scanner options to control execution.
Definition at line 606 of file bmsparsevec_algo.h.
| typedef SV::size_type bm::sparse_vector_scanner< SV, S_FACTOR >::size_type |
Definition at line 588 of file bmsparsevec_algo.h.
| typedef SV::value_type bm::sparse_vector_scanner< SV, S_FACTOR >::value_type |
Definition at line 587 of file bmsparsevec_algo.h.
|
protected |
| Enumerator | |
|---|---|
| sub_bfind_block_cnt | |
| sub_block_l1_size | |
Definition at line 1200 of file bmsparsevec_algo.h.
|
protected |
| Enumerator | |
|---|---|
| linear_cutoff1 | |
| linear_cutoff2 | |
Definition at line 1144 of file bmsparsevec_algo.h.
| bm::sparse_vector_scanner< SV, S_FACTOR >::sparse_vector_scanner | ( | ) |
Definition at line 1582 of file bmsparsevec_algo.h.
References bm::id_max.
Referenced by operator=(), and sparse_vector_scanner().
|
protecteddelete |
References sparse_vector_scanner().
|
inlinestaticprotected |
Addd char to aggregator (AND-SUB).
Definition at line 1162 of file bmsparsevec_algo.h.
References bm::bitscan(), BM_ASSERT, and bm::word_bitcount().
Referenced by bm::sparse_vector_scanner< SV, S_FACTOR >::pipeline< Opt >::add(), and prepare_and_sub_aggregator().
|
staticprotected |
Definition at line 2282 of file bmsparsevec_algo.h.
References BM_ASSERT.
Referenced by compare_str(), and find_gt_horizontal().
|
protected |
Definition at line 2263 of file bmsparsevec_algo.h.
References BM_ASSERT.
Referenced by compare_str(), and find_gt_horizontal().
| bool bm::sparse_vector_scanner< SV, S_FACTOR >::bfind | ( | const SV & | sv, |
| const value_type | val, | ||
| typename SV::size_type & | pos ) |
binary search for position in the sorted sparse vector
Method assumes the sparse array is sorted, if value is found pos returns its index, if not found, pos would contain index where it could be inserted to maintain the order
| sv | - input sparse vector |
| val | - value to search for |
| pos | - output sparse vector element index (actual index if found or insertion point if not found) |
Definition at line 2730 of file bmsparsevec_algo.h.
References BM_ASSERT, compare(), linear_cutoff1, and linear_cutoff2.
Referenced by insertion_sort().
| bool bm::sparse_vector_scanner< SV, S_FACTOR >::bfind_eq_str | ( | const SV & | sv, |
| const value_type * | str, | ||
| size_type & | pos ) |
binary find first sparse vector element (string).
Sparse vector must be sorted.
| sv | - sparse vector of strings to search |
| str | - string prefix to search for |
| pos | - [out] first position found |
Definition at line 2638 of file bmsparsevec_algo.h.
References bfind_eq_str_impl(), and resize_buffers().
Referenced by bfind_eq_str(), find_eq_str(), main(), and run_benchmark().
| bool bm::sparse_vector_scanner< SV, S_FACTOR >::bfind_eq_str | ( | const value_type * | str, |
| size_t | len, | ||
| size_type & | pos ) |
binary find first sparse vector element (string) Sparse vector must be sorted and attached (use method bind())
| str | - string prefix to search for |
| len | - string length |
| pos | - [out] first position found |
Definition at line 2691 of file bmsparsevec_algo.h.
References bfind_eq_str_impl(), and BM_ASSERT.
| bool bm::sparse_vector_scanner< SV, S_FACTOR >::bfind_eq_str | ( | const value_type * | str, |
| size_type & | pos ) |
binary find first sparse vector element (string) Sparse vector must be sorted and attached (use method bind())
| str | - string prefix to search for |
| pos | - [out] first position found |
References bfind_eq_str(), find_nonzero(), find_positive(), find_zero(), and invert().
| bool bm::sparse_vector_scanner< SV, S_FACTOR >::bfind_eq_str_impl | ( | const SV & | sv, |
| const typename SV::value_type * | str, | ||
| size_t | in_len, | ||
| bool | remaped, | ||
| typename SV::size_type & | pos ) |
Definition at line 2479 of file bmsparsevec_algo.h.
References BM_ASSERT, compare_str(), find_first_eq(), find_zero(), bm::gap_max_bits, reset_search_range(), bm::set_block_shift, set_search_range(), sub_bfind_block_cnt, and sub_block_l1_size.
|
protected |
References BMNOEXCEPT, decompress(), find_eq_str_impl(), find_eq_with_nulls(), find_first_eq(), and prepare_and_sub_aggregator().
Referenced by bfind_eq_str(), and bfind_eq_str().
| void bm::sparse_vector_scanner< SV, S_FACTOR >::bind | ( | const SV & | sv, |
| bool | sorted ) |
bind sparse vector for all searches
| sv | - input sparse vector to bind for searches |
| sorted | - source index is sorted, build index for binary search |
Definition at line 1594 of file bmsparsevec_algo.h.
References resize_buffers().
Referenced by main(), and run_benchmark().
|
protected |
compare sv[idx] with input value
Definition at line 3059 of file bmsparsevec_algo.h.
References BMNOEXCEPT.
Referenced by bfind(), and compare_str().
| int bm::sparse_vector_scanner< SV, S_FACTOR >::compare_str | ( | const SV & | sv, |
| size_type | idx, | ||
| const value_type *BMRESTRICT | str ) const |
Definition at line 2986 of file bmsparsevec_algo.h.
References BM_ASSERT, BMNOEXCEPT, BMRESTRICT, bm::set_block_mask, and bm::set_block_shift.
|
protected |
compare sv[idx] with input str
References aggregate_AND_OR_slices(), aggregate_OR_slices(), BMNOEXCEPT, compare(), and compare_str().
Referenced by bfind_eq_str_impl(), compare_str(), and lower_bound_str().
| void bm::sparse_vector_scanner< SV, S_FACTOR >::correct_nulls | ( | const SV & | sv, |
| bvector_type & | bv_out ) |
Exclude possible NULL values from the result vector.
| sv | - input sparse vector |
| bv_out | - output bit-bector of non-zero elements |
Definition at line 1679 of file bmsparsevec_algo.h.
Referenced by find_eq(), find_eq(), find_ge(), find_gt_horizontal(), find_zero(), and invert().
|
protected |
Rank-Select decompression for RSC vectors.
Definition at line 3191 of file bmsparsevec_algo.h.
References BM_ASSERT.
Referenced by bfind_eq_str_impl(), find_eq(), find_gt_horizontal(), and find_zero().
|
inline |
find all values A IN (C, D, E, F)
| sv | - input sparse vector |
| start | - start iterator (set to search) |
| end | - end iterator (set to search) |
| bv_out | - output bit-bector of non-zero elements |
Definition at line 990 of file bmsparsevec_algo.h.
References BM_ASSERT, correct_nulls(), find_eq(), and find_eq_with_nulls().
| void bm::sparse_vector_scanner< SV, S_FACTOR >::find_eq | ( | const SV & | sv, |
| value_type | value, | ||
| BII | bi ) |
find all sparse vector elements EQ to search value
Find all sparse vector elements equivalent to specified value
| sv | - input sparse vector |
| value | - value to search for |
| bi | - back insert iterator for the search results |
Definition at line 3096 of file bmsparsevec_algo.h.
References find_zero(), and prepare_and_sub_aggregator().
| void bm::sparse_vector_scanner< SV, S_FACTOR >::find_eq | ( | const SV & | sv, |
| typename SV::value_type | value, | ||
| typename SV::bvector_type & | bv_out ) |
find all sparse vector elements EQ to search value
Find all sparse vector elements equivalent to specified value
| sv | - input sparse vector |
| value | - value to search for |
| bv_out | - search result bit-vector (search result is a vector of 1s when sv[i] == value) |
Definition at line 3071 of file bmsparsevec_algo.h.
References correct_nulls(), decompress(), find_eq_with_nulls(), and find_zero().
Referenced by compute_frequent_kmers(), find_eq(), find_eq(), find_ge(), find_gt_horizontal(), main(), and run_benchmark().
| bool bm::sparse_vector_scanner< SV, S_FACTOR >::find_eq | ( | const SV & | sv, |
| typename SV::value_type | value, | ||
| typename SV::size_type & | pos ) |
find first sparse vector element
Find all sparse vector elements equivalent to specified value. Works well if sperse vector represents unordered set
| sv | - input sparse vector |
| value | - value to search for |
| pos | - output found sparse vector element index |
Definition at line 3130 of file bmsparsevec_algo.h.
References find_eq(), find_first_eq(), and bm::conditional< b >::test().
| bool bm::sparse_vector_scanner< SV, S_FACTOR >::find_eq_str | ( | const SV & | sv, |
| const value_type * | str, | ||
| bvector_type & | bv_out ) |
find sparse vector elements (string)
| sv | - sparse vector of strings to search |
| str | - string to search for |
| bv_out | - search result bit-vector (search result masks 1 elements) |
References find_eq_str().
Referenced by find_eq_str(), find_eq_str(), find_eq_str(), find_eq_str(), main(), main(), and run_benchmark().
| bool bm::sparse_vector_scanner< SV, S_FACTOR >::find_eq_str | ( | const SV & | sv, |
| const value_type * | str, | ||
| size_type & | pos ) |
find first sparse vector element (string)
| sv | - sparse vector of strings to search |
| str | - string to search for |
| pos | - [out] index of the first found |
References find_eq_str().
| bool bm::sparse_vector_scanner< SV, S_FACTOR >::find_eq_str | ( | const value_type * | str, |
| bvector_type & | bv_out ) |
find sparse vector elementa (string) in the attached SV
| str | - string to search for |
| bv_out | - search result bit-vector (search result masks 1 elements) |
References find_eq_str().
| bool bm::sparse_vector_scanner< SV, S_FACTOR >::find_eq_str | ( | const value_type * | str, |
| size_type & | pos ) |
binary find first sparse vector element (string) Sparse vector must be attached (bind())
| str | - string to search for |
| pos | - [out] index of the first found |
References bfind_eq_str(), find_eq_str(), find_eq_str_prefix(), and lower_bound_str().
| void bm::sparse_vector_scanner< SV, S_FACTOR >::find_eq_str | ( | TPipe & | pipe | ) |
find sparse vector elements using search pipeline
| pipe | - pipeline to run |
Definition at line 2461 of file bmsparsevec_algo.h.
|
protected |
find EQ str / prefix impl
aggregator search
Definition at line 2409 of file bmsparsevec_algo.h.
References BM_ASSERT, find_zero(), prepare_and_sub_aggregator(), and remap_tosv().
Referenced by bfind_eq_str_impl(), and find_eq_str_prefix().
| bool bm::sparse_vector_scanner< SV, S_FACTOR >::find_eq_str_prefix | ( | const SV & | sv, |
| const value_type * | str, | ||
| bvector_type & | bv_out ) |
find sparse vector elements with a given prefix (string)
| sv | - sparse vector of strings to search |
| str | - string prefix to search for "123" is a prefix for "1234567" |
| bv_out | - search result bit-vector (search result masks 1 elements) |
Definition at line 2300 of file bmsparsevec_algo.h.
References find_eq_str_impl().
Referenced by find_eq_str(), and main().
|
protected |
find value (may include NULL indexes)
Definition at line 1690 of file bmsparsevec_algo.h.
References find_zero(), and prepare_and_sub_aggregator().
Referenced by bfind_eq_str_impl(), find_eq(), and find_eq().
| void bm::sparse_vector_scanner< SV, S_FACTOR >::find_eq_with_nulls_horizontal | ( | const SV & | sv, |
| value_type | value, | ||
| bvector_type & | bv_out ) |
For testing purposes only.
Definition at line 1933 of file bmsparsevec_algo.h.
References bm::bitscan(), BM_ASSERT, and find_zero().
|
protected |
find first string value (may include NULL indexes)
Definition at line 1745 of file bmsparsevec_algo.h.
References BM_ASSERT, and prepare_and_sub_aggregator().
|
protected |
find first value (may include NULL indexes)
Definition at line 1721 of file bmsparsevec_algo.h.
References BM_ASSERT, and prepare_and_sub_aggregator().
Referenced by bfind_eq_str_impl(), bfind_eq_str_impl(), and find_eq().
| void bm::sparse_vector_scanner< SV, S_FACTOR >::find_ge | ( | const SV & | sv, |
| value_type | val, | ||
| bvector_type & | bv_out ) |
find all elements sparse vector element greater or equal (>=) than value
| sv | - input sparse vector |
| value | - value to search for |
| bv_out | - search result bit-vector (search result is a vector of 1s when sv[i] >= value) |
Definition at line 1997 of file bmsparsevec_algo.h.
References correct_nulls(), find_eq(), and find_gt_horizontal().
Referenced by find_lt(), find_range(), and main().
| void bm::sparse_vector_scanner< SV, S_FACTOR >::find_gt | ( | const SV & | sv, |
| value_type | val, | ||
| bvector_type & | bv_out ) |
find all elements sparse vector element greater (>) than value
| sv | - input sparse vector |
| value | - value to search for |
| bv_out | - search result bit-vector (search result is a vector of 1s when sv[i] > value) |
Definition at line 1985 of file bmsparsevec_algo.h.
References find_gt_horizontal().
Referenced by find_le(), find_range(), and main().
| void bm::sparse_vector_scanner< SV, S_FACTOR >::find_gt_horizontal | ( | const SV & | sv, |
| value_type | value, | ||
| bvector_type & | bv_out, | ||
| bool | null_correct = true ) |
For testing purposes only.
Definition at line 2077 of file bmsparsevec_algo.h.
References aggregate_AND_OR_slices(), aggregate_OR_slices(), bm::bitscan(), BM_ASSERT, correct_nulls(), decompress(), find_eq(), find_positive(), find_zero(), and gt_slice_limit().
| void bm::sparse_vector_scanner< SV, S_FACTOR >::find_le | ( | const SV & | sv, |
| value_type | val, | ||
| bvector_type & | bv_out ) |
find all elements sparse vector element less or equal (<=) than value
| sv | - input sparse vector |
| value | - value to search for |
| bv_out | - search result bit-vector (search result is a vector of 1s when sv[i] <= value) |
Definition at line 2048 of file bmsparsevec_algo.h.
References find_gt(), and invert().
Referenced by main().
| void bm::sparse_vector_scanner< SV, S_FACTOR >::find_lt | ( | const SV & | sv, |
| value_type | val, | ||
| bvector_type & | bv_out ) |
find all elements sparse vector element less (<) than value
| sv | - input sparse vector |
| value | - value to search for |
| bv_out | - search result bit-vector (search result is a vector of 1s when sv[i] < value) |
Definition at line 2036 of file bmsparsevec_algo.h.
References find_ge(), and invert().
Referenced by main().
| void bm::sparse_vector_scanner< SV, S_FACTOR >::find_nonzero | ( | const SV & | sv, |
| typename SV::bvector_type & | bv_out ) |
Find non-zero elements Output vector is computed as a logical OR (join) of all planes.
| sv | - input sparse vector |
| bv_out | - output bit-bector of non-zero elements |
Definition at line 3160 of file bmsparsevec_algo.h.
Referenced by bfind_eq_str(), and find_zero().
| void bm::sparse_vector_scanner< SV, S_FACTOR >::find_positive | ( | const SV & | sv, |
| typename SV::bvector_type & | bv_out ) |
Find positive (greter than zero elements) Output vector is computed as a logical OR (join) of all planes.
| sv | - input sparse vector |
| bv_out | - output bit-bector of non-zero elements |
Definition at line 3175 of file bmsparsevec_algo.h.
References BM_ASSERT.
Referenced by bfind_eq_str(), and find_gt_horizontal().
| void bm::sparse_vector_scanner< SV, S_FACTOR >::find_range | ( | const SV & | sv, |
| value_type | from, | ||
| value_type | to, | ||
| bvector_type & | bv_out ) |
find all elements sparse vector element in closed range [left..right] interval
| sv | - input sparse vector |
| from | - range from |
| to | - range to |
| bv_out | - search result bit-vector (search result is a vector of 1s when sv[i] <= value) |
Definition at line 2059 of file bmsparsevec_algo.h.
References find_ge(), find_gt(), and bm::xor_swap().
Referenced by main().
| void bm::sparse_vector_scanner< SV, S_FACTOR >::find_zero | ( | const SV & | sv, |
| bvector_type & | bv_out, | ||
| bool | null_correct = true ) |
find all sparse vector elements EQ to 0
| sv | - input sparse vector |
| bv_out | - output bit-vector (search result masks 1 elements) |
| null_correct | - flag to perform NULL correction |
Definition at line 1634 of file bmsparsevec_algo.h.
References correct_nulls(), decompress(), find_nonzero(), bm::id_max, and invert().
Referenced by bm::set2set_11_transform< SV >::attach_sv(), bfind_eq_str(), bfind_eq_str_impl(), find_eq(), find_eq(), find_eq_str_impl(), find_eq_with_nulls(), find_eq_with_nulls_horizontal(), and find_gt_horizontal().
|
inline |
Return allocator pool for blocks (Can be used to improve performance of repeated searches with the same scanner).
Definition at line 1042 of file bmsparsevec_algo.h.
References BMNOEXCEPT.
Referenced by main().
|
inlinestaticconstexprprotectednoexcept |
Return the slice limit for signed/unsigned vector value types.
Definition at line 1123 of file bmsparsevec_algo.h.
References gt_slice_limit().
Referenced by find_gt_horizontal(), and gt_slice_limit().
| void bm::sparse_vector_scanner< SV, S_FACTOR >::invert | ( | const SV & | sv, |
| bvector_type & | bv_out ) |
invert search result ("EQ" to "not EQ")
| sv | - input sparse vector |
| bv_out | - output bit-bector of non-zero elements |
Definition at line 1661 of file bmsparsevec_algo.h.
References correct_nulls().
Referenced by bfind_eq_str(), find_le(), find_lt(), find_zero(), and main().
| bool bm::sparse_vector_scanner< SV, S_FACTOR >::lower_bound_str | ( | const SV & | sv, |
| const value_type * | str, | ||
| size_type & | pos ) |
lower bound search for an array position
Method assumes the sparse array is sorted
| sv | - input sparse vector |
| str | - value to search for |
| pos | - output sparse vector element index |
Definition at line 2851 of file bmsparsevec_algo.h.
References BM_ASSERT, compare_str(), linear_cutoff1, and linear_cutoff2.
Referenced by find_eq_str(), insertion_sort(), and insertion_sort().
|
protecteddelete |
References sparse_vector_scanner().
|
protected |
Prepare aggregator for AND-SUB (EQ) search (string).
Definition at line 1845 of file bmsparsevec_algo.h.
References add_agg_char(), and BM_ASSERT.
|
protected |
Prepare aggregator for AND-SUB (EQ) search.
Definition at line 1892 of file bmsparsevec_algo.h.
References bm::bitscan(), and BM_ASSERT.
Referenced by bfind_eq_str_impl(), find_eq(), find_eq_str_impl(), find_eq_with_nulls(), find_first_eq(), and find_first_eq().
|
staticprotected |
Remap input value into SV char encodings.
Definition at line 2395 of file bmsparsevec_algo.h.
Referenced by bm::sparse_vector_scanner< SV, S_FACTOR >::pipeline< Opt >::add(), and find_eq_str_impl().
| void bm::sparse_vector_scanner< SV, S_FACTOR >::reset_binding | ( | ) |
reset sparse vector binding
Definition at line 1625 of file bmsparsevec_algo.h.
References BMNOEXCEPT.
|
protected |
reset (disable) search range
Definition at line 3223 of file bmsparsevec_algo.h.
References BMNOEXCEPT.
Referenced by bfind_eq_str_impl().
|
inlineprotected |
Definition at line 1131 of file bmsparsevec_algo.h.
Referenced by bfind_eq_str(), and bind().
|
protected |
set search boundaries (hint for the aggregator)
Definition at line 3213 of file bmsparsevec_algo.h.
References BM_ASSERT, and BMNOEXCEPT.
Referenced by bfind_eq_str_impl().