1#ifndef BMSPARSEVEC_H__INCLUDED__
2#define BMSPARSEVEC_H__INCLUDED__
33#ifndef BM__H__INCLUDED__
36# error missing include (bm.h or bm64.h)
85template<
class Val,
class BV>
138 {
return bool(*
this) == bool(ref); }
186 {
return (pos_ == it.pos_) && (sv_ == it.sv_); }
190 {
return pos_ < it.pos_; }
192 {
return pos_ <= it.pos_; }
194 {
return pos_ > it.pos_; }
196 {
return pos_ >= it.pos_; }
286 this->
flush(); sv_ = bi.sv_; bv_null_ = bi.bv_null_;
289 this->set_not_null_ = bi.set_not_null_;
297 this->
flush(); sv_ = bi.sv_; bv_null_ = bi.bv_null_;
298 this->buffer_.swap(bi.buffer_);
299 this->buf_ptr_ = bi.buf_ptr_;
300 this->set_not_null_ = bi.set_not_null_;
365 bool set_not_null_ =
true;
372 friend const_iterator;
373 friend back_insert_iterator;
444 {
return this->
get(idx); }
622 bool set_not_null =
true);
632 bool set_not_null =
true);
660 bool zero_mem =
true)
const;
934 bool zero_mem = true) const;
943 bool zero_mem = true) const;
1031 bm::heap_matrix<
unsigned char,
1043 *idx_from = from; *idx_to = to;
return true;
1060 bool set_not_null =
true);
1099template<
class Val,
class BV>
1105:
parent_type(null_able, false, ap, bv_max_size, alloc)
1110template<
class Val,
class BV>
1118template<
class Val,
class BV>
1129template<
class Val,
class BV>
1135template<
class Val,
class BV>
1143template<
class Val,
class BV>
1147 throw std::range_error(err_msg);
1155template<
class Val,
class BV>
1158 BV::throw_bad_alloc();
1163template<
class Val,
class BV>
1171template<
class Val,
class BV>
1177 if constexpr (std::is_signed<value_type>::value)
1179 const unsigned tmp_size = 1024;
1182 while (i < arr_size)
1184 arr_tmp[k++] = this->
s2u(arr[i++]);
1187 import_u(arr_tmp, k, offset, set_not_null);
1188 k = 0; offset += tmp_size;
1193 import_u(arr_tmp, k, offset, set_not_null);
1204template<
class Val,
class BV>
1214 if (offset < this->
size_)
1221template<
class Val,
class BV>
1229 const unsigned bit_capacity =
sizeof(Val)*8;
1230 unsigned char b_list[bit_capacity];
1231 unsigned row_len[bit_capacity] = {0, };
1234 const unsigned transpose_window = 256;
1244 for (i = 0; i < arr_size; ++i)
1249 for (
unsigned j = 0; j < bcnt; ++j)
1251 unsigned p = b_list[j];
1252 unsigned rl = row_len[p];
1253 tm.
row(p)[rl] = bit_idx;
1256 if (rl == transpose_window)
1264 bv->import_sorted(r, rl,
false);
1272 unsigned rows = tm.
rows();
1273 for (
unsigned k = 0; k < rows; ++k)
1275 if (
unsigned rl = row_len[k])
1281 bv->import_sorted(row, rl,
false);
1286 if (i + offset > this->
size_)
1287 this->
size_ = i + offset;
1292 bv_null->set_range(offset, offset + arr_size - 1);
1299template<
class Val,
class BV>
1305 bool found = bv_null->find_reverse(this->
size_);
1306 this->
size_ += found;
1311template<
class Val,
class BV>
1316 if constexpr (std::is_signed<value_type>::value)
1318 const unsigned tmp_size = 1024;
1321 while (i < arr_size)
1323 arr_tmp[k++] = this->
s2u(arr[i++]);
1344template<
class Val,
class BV>
1354template<
class Val,
class BV>
1359 bool zero_mem)
const
1361 return extract(arr, dec_size, idx_from, zero_mem);
1366template<
class Val,
class BV>
1379 arr[0] = this->
get(idx[0]);
1385 bool sorted_block =
true;
1403 if (idx[r] < idx_prev)
1404 sorted_block =
false;
1411 sorted_block =
false;
1412 for (; r <
size; ++r)
1457 for (
unsigned j = 0; j < eff_planes; ++j)
1484 unsigned gap_value = gap_blk[gidx];
1488 for (++k; k < r; ++k)
1531template<
class Val,
class BV>
1536 bool zero_mem)
const
1563 for (
unsigned j = 0; j < planes; ++j)
1565 blk = this->
bmatr_.get_block(j, i0, j0);
1575 blk = this->
bmatr_.get_block(j, i0, j0);
1596 is_set = (blk[nword] & mask0);
1616template<
class Val,
class BV>
1621 bool zero_mem)
const
1641 typename BV::enumerator en(bv, offset);
1642 for (;en.valid(); ++en)
1658template<
class Val,
class BV>
1667 struct sv_decode_visitor_func
1672 : arr_(varr), mask_(mask), sv_off_(off)
1682 for (
unsigned i = 0; i < bits_size; ++i)
1683 arr_[bits[i] + base] |= m;
1688 auto base = bv_offset - sv_off_;
1691 arr_[i + base] |= m;
1710 sv_decode_visitor_func func(arr, 0, offset);
1726 return exported_size;
1731template<
class Val,
class BV>
1737 ::memcpy(&uv, &arr[i],
sizeof(uv));
1745template<
class Val,
class BV>
1749 if (idx >= this->
size_)
1751 return this->
get(idx);
1756template<
class Val,
class BV>
1767template<
class Val,
class BV>
1774 return this->
u2s(uv);
1781template<
class Val,
class BV>
1793 for (
unsigned j = 0; smask && j < eff_planes; j+=4, smask >>= 4)
1807template<
class Val,
class BV>
1815 if (N_bits > eff_planes)
1816 N_bits = eff_planes;
1819 for (
unsigned j = 0; j < N_bits; ++j)
1824 bool b = bv->test(idx);
1835template<
class Val,
class BV>
1848template<
class Val,
class BV>
1854 this->
size_ = idx+1;
1864template<
class Val,
class BV>
1868 this->
size_ = idx+1;
1875 bv_null->clear_bit_no_check(idx);
1882template<
class Val,
class BV>
1891template<
class Val,
class BV>
1898 this->
size_ += count;
1903template<
class Val,
class BV>
1915template<
class Val,
class BV>
1920 this->
size_ = idx+1;
1929template<
class Val,
class BV>
1938template<
class Val,
class BV>
1946 for (; i <= bsr; ++i)
1951 bv->insert(idx,
true);
1956 bv->insert(idx,
false);
1964 for (; i < eff_planes; ++i)
1967 bv->insert(idx,
false);
1974template<
class Val,
class BV>
1978 if (idx >= this->size_)
1981 this->size_ -= erase_null;
1987template<
class Val,
class BV>
1996template<
class Val,
class BV>
2002 bv_null->set_bit_no_check(idx);
2007template<
class Val,
class BV>
2019 this->
bmatr_.clear_slices_range(bsr, eff_planes, idx);
2024 for (
unsigned j = 0; j <= bsr; ++j)
2029 bv->set_bit_no_check(idx);
2031 else if (need_clear)
2041 bv->clear_bit_no_check(idx);
2051template<
class Val,
class BV>
2054 if (idx >= this->
size_)
2056 this->
size_ = idx+1;
2063 bv_null->set_bit_no_check(idx);
2068template<
class Val,
class BV>
2074 if (std::numeric_limits<value_type>::max() == v)
2084 if (
bool carry_over = bv->inc(idx); !carry_over)
2091template<
class Val,
class BV>
2100template<
class Val,
class BV>
2108template<
class Val,
class BV>
2118template<
class Val,
class BV>
2131template<
class Val,
class BV>
2147template<
class Val,
class BV>
2166template<
class Val,
class BV>
2173 bv->optimize_gap_size();
2179template<
class Val,
class BV>
2184 if (this->
size_ < arg_size)
2187 unsigned planes = (unsigned)this->
bmatr_.rows();
2191 for (
unsigned j = 0; j < planes; ++j)
2206template<
class Val,
class BV>
2211 if (this->
size_ < arg_size)
2223template<
class Val,
class BV>
2233 bv_null->set_range(0, arg_size-1);
2247template<
class Val,
class BV>
2262template<
class Val,
class BV>
2274template<
class Val,
class BV>
2279 for (
unsigned j = 0; j <
slices; ++j)
2282 bv->bit_and(bv_mask);
2288template<
class Val,
class BV>
2294 return (sv_value > val) - (sv_value < val);
2299template<
class Val,
class BV>
2308template<
class Val,
class BV>
2313 return it_type(
this);
2318template<
class Val,
class BV>
2322 this->
bmatr_.set_allocator_pool(pool_ptr);
2331template<
class Val,
class BV>
2333: sv_(0), pos_(
bm::
id_max), buf_ptr_(0)
2338template<
class Val,
class BV>
2341: sv_(it.sv_), pos_(it.pos_), buf_ptr_(0)
2346template<
class Val,
class BV>
2350: sv_(sv), buf_ptr_(0)
2358template<
class Val,
class BV>
2362: sv_(sv), buf_ptr_(0)
2370template<
class Val,
class BV>
2379template<
class Val,
class BV>
2385 if (pos_ >= sv_->size())
2401template<
class Val,
class BV>
2412 sv_->extract(buf_ptr_,
n_buf_size, pos_,
true);
2420template<
class Val,
class BV>
2431 if (++buf_ptr_ < buf_end)
2436 if (pos_ >= sv_->size())
2441 if (buf_ptr_ >= buf_end)
2448template<
class Val,
class BV>
2451 return sv_->is_null(pos_);
2460template<
class Val,
class BV>
2466template<
class Val,
class BV>
2474 bv_null_ = sv_->get_null_bvect();
2480 buf_ptr_ = 0; bv_null_ = 0;
2486template<
class Val,
class BV>
2489: sv_(bi.sv_), bv_null_(bi.bv_null_), buf_ptr_(0),
2490 set_not_null_(bi.set_not_null_),
2491 prev_nb_(bi.prev_nb_), opt_mode_(bi.opt_mode_)
2503template<
class Val,
class BV>
2506: sv_(bi.sv_), bv_null_(bi.bv_null_), buf_ptr_(bi.buf_ptr_),
2507 set_not_null_(bi.set_not_null_),
2508 prev_nb_(bi.prev_nb_), opt_mode_(bi.opt_mode_)
2510 buffer_.swap(bi.buffer_);
2511 buf_ptr_ = bi.buf_ptr_;
2516template<
class Val,
class BV>
2524template<
class Val,
class BV>
2539 bv_null_->set_bit_no_check(sz + buf_idx);
2545template<
class Val,
class BV>
2566template<
class Val,
class BV>
2575template<
class Val,
class BV>
2587 sv_->push_back_null(count);
2593template<
class Val,
class BV>
2601template<
class Val,
class BV>
2610 sv_->import_back_u(arr, arr_size,
false);
2615 sv_->optimize_block(prev_nb_, opt_mode_);
Algorithms for bvector<>.
basic bit-matrix class and utilities
#define IS_FULL_BLOCK(addr)
#define BM_ASSERT_THROW(x, xerrcode)
#define FULL_BLOCK_FAKE_ADDR
Utilities for bit transposition (internal) (experimental!).
void swap(base_sparse_vector< Val, BV, MAX_SIZE > &bsv) BMNOEXCEPT
void resize(size_type new_size, bool set_null)
unsigned effective_slices() const BMNOEXCEPT
unsigned_value_type slice_mask_
void merge_matr(bmatrix_type &bmatr)
static unsigned slices() BMNOEXCEPT
static value_type u2s(unsigned_value_type v) BMNOEXCEPT
const bvector_type * get_null_bvector() const BMNOEXCEPT
void copy_from(const base_sparse_vector< Val, BV, MAX_SIZE > &bsv)
static unsigned_value_type s2u(value_type v) BMNOEXCEPT
void clear_range(size_type left, size_type right, bool set_null)
bvector_type_ptr get_create_slice(unsigned i)
void erase_column(size_type idx, bool erase_null)
void swap_elements(size_type idx1, size_type idx2)
void copy_range_slices(const base_sparse_vector< Val, BV, MAX_SIZE > &bsv, typename base_sparse_vector< Val, BV, MAX_SIZE >::size_type left, typename base_sparse_vector< Val, BV, MAX_SIZE >::size_type right, bm::null_support slice_null)
static unsigned stored_slices() BMNOEXCEPT
static constexpr unsigned value_bits() BMNOEXCEPT
bool is_null(size_type idx) const BMNOEXCEPT
size_type size_
array size
void keep_range_no_check(size_type left, size_type right, bm::null_support slice_null)
std::make_unsigned< value_type >::type unsigned_value_type
const bmatrix_type & get_bmatrix() const BMNOEXCEPT
bvector_type * get_null_bvect() BMNOEXCEPT
void sync_ro() BMNOEXCEPT
void bit_sub_rows(const bvector_type &bv, bool use_null)
void clear_all(bool free_mem=true) BMNOEXCEPT
static constexpr bool is_signed() BMNOEXCEPT
void optimize(bm::word_t *temp_block=0, typename bvector_type::optmode opt_mode=bvector_type::opt_compress, typename bvector_type::statistics *stat=0)
void insert_null(size_type idx, bool not_null)
void calc_stat(typename bvector_type::statistics *st) const BMNOEXCEPT
bool is_nullable() const BMNOEXCEPT
bool equal(const base_sparse_vector< Val, BV, MAX_SIZE > &sv, bm::null_support null_able=bm::use_null) const BMNOEXCEPT
Basic dense bit-matrix class.
size_type get_null_idx() const BMNOEXCEPT
return index of the NULL vector
const bvector_type * row(size_type i) const BMNOEXCEPT
size_type rows() const BMNOEXCEPT
Constant iterator designed to enumerate "ON" bits.
optmode
Optimization mode Every next level means additional checks (better compression vs time).
@ opt_compress
compress blocks when possible (GAP/prefix sum)
allocator_type::allocator_pool_type allocator_pool_type
bvector_size_type size_type
blocks_manager_type::block_idx_type block_idx_type
void add_null(size_type count)
add a series of consequitve NULLs (no-value) to the container
bm::byte_buffer< allocator_type > buffer_type
bvector_type::allocator_type::allocator_pool_type allocator_pool_type
void operator=(value_type v)
push value to the vector
bvector_type::block_idx_type block_idx_type
void operator=(const back_insert_iterator &bi)
sparse_vector_type::unsigned_value_type unsigned_value_type
back_insert_iterator & operator++()
noop
sparse_vector_type::size_type size_type
bool flush()
flush the accumulated buffer
bvector_type * get_null_bvect() const BMNOEXCEPT
Get access to not-null vector.
back_insert_iterator & operator++(int)
noop
back_insert_iterator(back_insert_iterator &&bi) BMNOEXCEPT
move constructor
back_insert_iterator(const back_insert_iterator &bi)
void add_value_no_null(value_type v)
void add(value_type v)
add value to the container
void disable_set_null() BMNOEXCEPT
Reconfigure back inserter not to touch the NULL vector.
bool empty() const
return true if insertion buffer is empty
sparse_vector_type * sparse_vector_type_ptr
back_insert_iterator(sparse_vector_type *sv)
bvector_type::allocator_type allocator_type
back_insert_iterator & operator*()
noop
sparse_vector< Val, BV > sparse_vector_type
std::output_iterator_tag iterator_category
sparse_vector_type::value_type value_type
sparse_vector_type::bvector_type bvector_type
Const iterator to traverse the sparse vector.
const_iterator & operator++() BMNOEXCEPT
Advance to the next available value.
void go_to(size_type pos) BMNOEXCEPT
re-position to a specified position
std::input_iterator_tag iterator_category
bool operator==(const const_iterator &it) const BMNOEXCEPT
bool operator>(const const_iterator &it) const BMNOEXCEPT
friend class sparse_vector
bvector_type::allocator_type allocator_type
sparse_vector< Val, BV > sparse_vector_type
bool is_null() const BMNOEXCEPT
Get NULL status.
bool advance() BMNOEXCEPT
advance iterator forward by one
value_type operator*() const
Get current position (value).
sparse_vector_type::bvector_type bvector_type
bool operator!=(const const_iterator &it) const BMNOEXCEPT
bool operator<(const const_iterator &it) const BMNOEXCEPT
const_iterator operator++(int)
Advance to the next available value.
bool operator<=(const const_iterator &it) const BMNOEXCEPT
bool valid() const BMNOEXCEPT
Returns true if iterator is at a valid position.
const_iterator() BMNOEXCEPT
bm::byte_buffer< allocator_type > buffer_type
void invalidate() BMNOEXCEPT
Invalidate current iterator.
value_type value() const
Get current position (value).
void skip_zero_values() BMNOEXCEPT
sparse_vector_type::size_type size_type
size_type pos() const BMNOEXCEPT
Current position (index) in the vector.
sparse_vector_type * sparse_vector_type_ptr
sparse_vector_type::value_type value_type
bvector_type::allocator_type::allocator_pool_type allocator_pool_type
bool operator>=(const const_iterator &it) const BMNOEXCEPT
bool operator==(const reference &ref) const BMNOEXCEPT
bool is_null() const BMNOEXCEPT
reference & operator=(const reference &ref)
reference & operator=(value_type val)
reference(sparse_vector< Val, BV > &sv, size_type idx) BMNOEXCEPT
succinct sparse vector with runtime compression using bit-slicing / transposition method
void inc(size_type idx)
increment specified element by one
unsigned_value_type get_unsigned_bits(size_type idx, size_type N_bits) const BMNOEXCEPT
Get raw unsigned value first N bits.
bvector_type::size_type size_type
void set_value(size_type idx, value_type v, bool need_clear)
set value without checking boundaries
value_type at(size_type idx) const
access specified element with bounds checking
friend class sparse_vector_scanner
void set_null(size_type idx)
void set_value_no_null(size_type idx, value_type v, bool need_clear)
set value without checking boundaries or support of NULL
value_type get(size_type idx) const BMNOEXCEPT
get specified element without bounds checking
allocator_type::allocator_pool_type allocator_pool_type
void insert_value_no_null(size_type idx, value_type v)
insert value without checking boundaries or support of NULL
static constexpr bool is_str() BMNOEXCEPT
bool equal(const sparse_vector< unsigned, bm::bvector<> > &sv, bm::null_support null_able=bm::use_null) const BMNOEXCEPT
void sync(bool)
syncronize internal structures, build fast access index
const value_type & const_reference
void push_back(value_type v)
push value back into vector
void sync_size() BMNOEXCEPT
recalculate size to exclude tail NULL elements After this call size() will return the true size of th...
size_type size_internal() const BMNOEXCEPT
void push_back_no_null(value_type v)
push value back into vector without NULL semantics
void insert_value(size_type idx, value_type v)
insert value without checking boundaries
unsigned_value_type get_unsigned(size_type idx) const BMNOEXCEPT
get raw unsigned value
bvector_type * bvector_type_ptr
const remap_matrix_type * get_remap_matrix() const
unsigned char * init_remap_buffer() BMNOEXCEPT
void set_remap() BMNOEXCEPT
size_type size() const BMNOEXCEPT
void clear_all(bool free_mem, unsigned) BMNOEXCEPT
resize to zero, free memory
sparse_vector(const sparse_vector< Val, BV > &sv)
sparse_vector(sparse_vector< Val, BV > &&sv) BMNOEXCEPT
bvector_type::enumerator bvector_enumerator_type
void set(size_type idx, value_type v)
set specified element with bounds checking and automatic resize
void resize(size_type sz)
resize vector
bool try_get(size_type idx, value_type &v) const BMNOEXCEPT
get specified element with NOT NULL check
size_t remap_size() const BMNOEXCEPT
void clear(size_type idx, bool set_null)
clear specified element with bounds checking and automatic resize
static void throw_range_error(const char *err_msg)
throw range error
friend class rsc_sparse_vector
const_iterator end() const BMNOEXCEPT
back_insert_iterator get_back_inserter()
Provide back insert iterator Back insert iterator implements buffered insertion, which is faster,...
void resize_internal(size_type sz, bool set_null=true)
static constexpr bool is_compressed() BMNOEXCEPT
various type traits
constexpr bool is_remap() const BMNOEXCEPT
friend class sparse_vector_serializer
void inc_no_null(size_type idx, value_type v)
increment by v without chnaging NULL vector or size
bool resolve_range(size_type from, size_type to, size_type *idx_from, size_type *idx_to) const BMNOEXCEPT
void swap(size_type idx1, size_type idx2)
swap two vector elements between each other
friend back_insert_iterator
bvector_type::block_idx_type block_idx_type
void import_u_nocheck(const unsigned_value_type *arr, size_type arr_size, size_type offset, bool set_not_null)
void inc_no_null(size_type idx)
Increment element by 1 without chnaging NULL vector or size.
size_type gather(value_type *arr, const size_type *idx, size_type size, bm::sort_order sorted_idx) const
Gather elements to a C-style array.
void push_back_null(size_type count)
push back specified amount of NULL values
sparse_vector< Val, BV > & merge(sparse_vector< Val, BV > &sv)
merge with another sparse vector using OR operation Merge is different from join(),...
const unsigned char * get_remap_buffer() const BMNOEXCEPT
int compare(size_type idx, const value_type val) const BMNOEXCEPT
friend class sparse_vector_deserializer
bool empty() const BMNOEXCEPT
return true if vector is empty
~sparse_vector() BMNOEXCEPT
static bool find_rank(size_type rank, size_type &pos) BMNOEXCEPT
find position of compressed element by its rank
sparse_vector< Val, BV > & operator=(const sparse_vector< Val, BV > &sv)
void swap(sparse_vector< Val, BV > &sv) BMNOEXCEPT
content exchange
void set_null(const bvector_type &bv_idx)
Set NULL all elements set as 1 in the argument vector.
bm::heap_matrix< unsigned char, sizeof(value_type), 256, typename bvector_type::allocator_type > remap_matrix_type
unused remap matrix type for compatibility with the sparse serializer
remap_matrix_type * get_remap_matrix()
sparse_vector< Val, BV > & join(const sparse_vector< Val, BV > &sv)
join all with another sparse vector using OR operation
static size_type translate_address(size_type i) BMNOEXCEPT
void insert(size_type idx, value_type v)
insert specified element into container
void import_back(const value_type *arr, size_type arr_size, bool set_not_null=true)
Import list of elements from a C-style array (pushed back).
base_sparse_vector< Val, BV, 1 > parent_type
size_type extract_range(value_type *arr, size_type size, size_type offset, bool zero_mem=true) const
void calc_stat(struct sparse_vector< unsigned, bm::bvector<> >::statistics *st) const BMNOEXCEPT
size_type extract_planes(value_type *arr, size_type size, size_type offset, bool zero_mem=true) const
static void throw_bad_alloc()
throw bad alloc
void keep_range(size_type left, size_type right, bm::null_support slice_null=bm::use_null)
Keep only specified interval in the sparse vector, clear all other elements.
void import_u(const unsigned_value_type *arr, size_type arr_size, size_type offset, bool set_not_null)
Import list of elements from a C-style array.
void join_null_slice(const sparse_vector< Val, BV > &sv)
BV::allocator_type allocator_type
sparse_vector(bm::null_support null_able=bm::no_null, allocation_policy_type ap=allocation_policy_type(), size_type bv_max_size=bm::id_max, const allocator_type &alloc=allocator_type())
Sparse vector constructor.
void push_back_null()
push back NULL value
sparse_vector< Val, BV > & clear_range(size_type left, size_type right, bool set_null=false)
clear range (assign bit 0 for all planes)
void erase(size_type idx, bool erase_null=true)
erase specified element from container
size_type effective_size() const BMNOEXCEPT
size of sparse vector (may be different for RSC)
void clear() BMNOEXCEPT
resize to zero, free memory
size_type decode(value_type *arr, size_type idx_from, size_type dec_size, bool zero_mem=true) const
Bulk export list of elements to a C-style array.
value_type get_no_check(size_type idx) const BMNOEXCEPT
get specified element without checking boundary conditions
bm::basic_bmatrix< BV > bmatrix_type
void clear(const bvector_type &bv_idx)
Set vector elements spcified by argument bit-vector to zero Note that set to 0 elements are NOT going...
size_type extract(value_type *arr, size_type size, size_type offset=0, bool zero_mem=true) const BMNOEXCEPT2
Bulk export list of elements to a C-style array.
size_type effective_vector_max() const BMNOEXCEPT
Always 1 (non-matrix type).
void copy_range(const sparse_vector< Val, BV > &sv, size_type left, size_type right, bm::null_support slice_null=bm::use_null)
copy range of values from another sparse vector
const_iterator get_const_iterator(size_type idx) const BMNOEXCEPT
Get const_itertor re-positioned to specific element.
parent_type::unsigned_value_type unsigned_value_type
const_iterator begin() const BMNOEXCEPT
Provide const iterator access to container content.
bvector_type::allocation_policy allocation_policy_type
void import(const value_type *arr, size_type arr_size, size_type offset=0, bool set_not_null=true)
Import list of elements from a C-style array.
void import_back_u(const unsigned_value_type *arr, size_type arr_size, bool set_not_null=true)
Import list of elements from a C-style array (pushed back).
static void u2s_translate(value_type *arr, size_type sz) BMNOEXCEPT
void filter(const bvector_type &bv_mask)
Apply value filter, defined by mask vector.
const bvector_type * bvector_type_const_ptr
bool is_ro() const BMNOEXCEPT
Returns true if vector is read-only.
void set_allocator_pool(allocator_pool_type *pool_ptr) BMNOEXCEPT
Set allocator pool for local (non-threaded) memory cyclic(lots of alloc-free ops) opertations.
value_type operator[](size_type idx) const BMNOEXCEPT
get specified element without bounds checking
void optimize(bm::word_t *temp_block=0, typename bvector_type::optmode opt_mode=bvector_type::opt_compress, typename sparse_vector< unsigned, bm::bvector<> >::statistics *stat=0)
unsigned short bitscan(V w, B *bits) BMNOEXCEPT
Templated Bitscan with dynamic dispatch for best type.
void bit_block_gather_scatter(unsigned *BMRESTRICT arr, const bm::word_t *BMRESTRICT blk, const unsigned *BMRESTRICT idx, unsigned size, unsigned start, unsigned bit_idx) BMNOEXCEPT
bit index to word gather-scatter algorithm (SIMD)
unsigned bit_scan_reverse(T value) BMNOEXCEPT
sort_order
Sort order declaration.
null_support
NULL-able value support.
@ BM_UNSORTED
input set is NOT sorted
@ BM_SORTED
input set is sorted (ascending order)
@ BM_UNKNOWN
sort order unknown
@ BM_SORTED_UNIFORM
sorted and in one block (internal!)
@ use_null
support "non-assigned" or "NULL" logic
@ no_null
do not support NULL values
unsigned gap_test_unr(const T *BMRESTRICT buf, const unsigned pos) BMNOEXCEPT
Tests if bit = pos is true. Analog of bm::gap_test with SIMD unrolling.
int for_each_bit_range_no_check(const BV &bv, typename BV::size_type left, typename BV::size_type right, Func &bit_functor)
Implementation of for_each_bit_range without boilerplave checks.
const unsigned set_block_mask
unsigned gap_bfind(const T *BMRESTRICT buf, unsigned pos, unsigned *BMRESTRICT is_set) BMNOEXCEPT
BMFORCEINLINE void get_block_coord(BI_TYPE nb, unsigned &i, unsigned &j) BMNOEXCEPT
Recalc linear bvector block index into 2D matrix coordinates.
const unsigned set_word_shift
BMFORCEINLINE void xor_swap(W &x, W &y) BMNOEXCEPT
XOR swap two variables.
bm::id64_t idx_arr_block_lookup_u64(const bm::id64_t *idx, bm::id64_t size, bm::id64_t nb, bm::id64_t start) BMNOEXCEPT
block boundaries look ahead U32
unsigned idx_arr_block_lookup_u32(const unsigned *idx, unsigned size, unsigned nb, unsigned start) BMNOEXCEPT
block boundaries look ahead U32
unsigned short gap_word_t
const unsigned set_block_shift
const unsigned set_word_mask
bv_statistics() BMNOEXCEPT
void reset() BMNOEXCEPT
Reset statisctics.
void add(const bv_statistics &st) BMNOEXCEPT
Sum data from another sttructure.
Statistical information about bitset's memory allocation details.
Mini-matrix for bit transposition purposes.
static unsigned rows() BMNOEXCEPT
const T * row(unsigned row_idx) const BMNOEXCEPT