BitMagic-C++
bm::base_sparse_vector< Val, BV, MAX_SIZE > Class Template Reference

Base class for bit-transposed(bit-sliced) sparse vector construction. More...

#include <bmbmatrix.h>

Inheritance diagram for bm::base_sparse_vector< Val, BV, MAX_SIZE >:

Public Types

enum  bit_planes { sv_slices = (sizeof(Val) * 8 * MAX_SIZE + 1) , sv_value_slices = (sizeof(Val) * 8 * MAX_SIZE) }
enum  vector_capacity { max_vector_size = MAX_SIZE }
typedef Val value_type
typedef BV bvector_type
typedef BV::size_type size_type
typedef bvector_typebvector_type_ptr
typedef const bvector_typebvector_type_const_ptr
typedef const value_typeconst_reference
typedef BV::allocator_type allocator_type
typedef bvector_type::allocation_policy allocation_policy_type
typedef bvector_type::enumerator bvector_enumerator_type
typedef allocator_type::allocator_pool_type allocator_pool_type
typedef bm::basic_bmatrix< BV > bmatrix_type
typedef std::make_unsigned< value_type >::type unsigned_value_type

Public Member Functions

 base_sparse_vector ()
 base_sparse_vector (bm::null_support null_able, bool is_dynamic, allocation_policy_type ap=allocation_policy_type(), size_type bv_max_size=bm::id_max, const allocator_type &alloc=allocator_type())
 base_sparse_vector (const base_sparse_vector< Val, BV, MAX_SIZE > &bsv)
 base_sparse_vector (base_sparse_vector< Val, BV, MAX_SIZE > &&bsv) BMNOEXCEPT
void swap (base_sparse_vector< Val, BV, MAX_SIZE > &bsv) BMNOEXCEPT
size_type size () const BMNOEXCEPT
void resize (size_type new_size, bool set_null)
void clear_range (size_type left, size_type right, bool set_null)
void keep_range_no_check (size_type left, size_type right, bm::null_support slice_null)
void clear_all (bool free_mem=true) BMNOEXCEPT
 resize to zero, free memory
bool empty () const BMNOEXCEPT
void swap_elements (size_type idx1, size_type idx2)
 swap two vector elements
void optimize (bm::word_t *temp_block=0, typename bvector_type::optmode opt_mode=bvector_type::opt_compress, typename bvector_type::statistics *stat=0)
 run memory optimization for all bit-vector rows
void calc_stat (typename bvector_type::statistics *st) const BMNOEXCEPT
 Calculates memory statistics.
bool equal (const base_sparse_vector< Val, BV, MAX_SIZE > &sv, bm::null_support null_able=bm::use_null) const BMNOEXCEPT
 check if another sparse vector has the same content and size

Protected Types

typedef bvector_type::block_idx_type block_idx_type

Protected Member Functions

void copy_from (const base_sparse_vector< Val, BV, MAX_SIZE > &bsv)
void merge_matr (bmatrix_type &bmatr)
 Merge plane bvectors from an outside base matrix Note: outside base matrix gets destroyed.
void freeze_matr ()
 Turn on RO mode.
void clear_value_planes_from (unsigned plane_idx, size_type idx)
void insert_clear_value_planes_from (unsigned plane_idx, size_type idx)
void erase_column (size_type idx, bool erase_null)
void insert_null (size_type idx, bool not_null)
void bit_sub_rows (const bvector_type &bv, bool use_null)
 Set SUB (MINUS) operation on all existing bit-slices.
void bit_and_rows (const bvector_type &bv)
 Set AND (intersect) operation on all existing bit-slices.
void optimize_block (block_idx_type nb, typename BV::optmode opt_mode)
 plane index for the "NOT NULL" flags plane
void sync_ro () BMNOEXCEPT
 Sybc read-only state.
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)
 Perform copy_range() on a set of planes.

Static Protected Member Functions

static constexpr unsigned value_bits () BMNOEXCEPT
 Number of total bit-planes in the value type.

Protected Attributes

bmatrix_type bmatr_
 bit-transposed matrix
unsigned_value_type slice_mask_ = 0
 slice presence bit-mask
size_type size_ = 0
 array size
unsigned effective_slices_ =0
 number of bit slices actually allocated
bool is_ro_ =false
 read-only

Various traits

bool is_nullable () const BMNOEXCEPT
 check if container supports NULL(unassigned) values
bm::null_support get_null_support () const BMNOEXCEPT
 check if container supports NULL (unassigned) values
const bvector_typeget_null_bvector () const BMNOEXCEPT
 Get bit-vector of assigned values or NULL (if not constructed that way).
bool is_null (size_type idx) const BMNOEXCEPT
 test if specified element is NULL
void set_allocator_pool (allocator_pool_type *pool_ptr) BMNOEXCEPT
 Set allocation pool.
allocator_pool_typeget_allocator_pool () const BMNOEXCEPT
 Get allocation pool.
static constexpr bool is_signed () BMNOEXCEPT
 returns true if value type is signed integral type

Access to internals

bvector_type_ptr get_create_slice (unsigned i)
 get access to bit-plain, function checks and creates a plane
bvector_type_const_ptr get_slice (unsigned i) const BMNOEXCEPT
 get read-only access to bit-plane
unsigned effective_slices () const BMNOEXCEPT
 Number of effective bit-planes in the value type.
bvector_type_ptr slice (unsigned i) BMNOEXCEPT
 get access to bit-plane as is (can return NULL)
bvector_type_const_ptr slice (unsigned i) const BMNOEXCEPT
bvector_typeget_null_bvect () BMNOEXCEPT
void free_slice (unsigned i)
 free memory in bit-plane
bm::id64_t get_slice_mask (unsigned element_idx) const BMNOEXCEPT
const bmatrix_typeget_bmatrix () const BMNOEXCEPT
bmatrix_typeget_bmatrix () BMNOEXCEPT
 access to internal bit-matrix
void mark_null_idx (unsigned null_idx) BMNOEXCEPT
 Set NULL plain index.
static unsigned slices () BMNOEXCEPT
 get total number of bit-planes in the vector
static unsigned stored_slices () BMNOEXCEPT
 Number of stored bit-planes (value planes + extra.
static unsigned_value_type s2u (value_type v) BMNOEXCEPT
 Convert signed value type to unsigned representation.
static value_type u2s (unsigned_value_type v) BMNOEXCEPT
 Convert unsigned value type to signed representation.

Detailed Description

template<typename Val, typename BV, unsigned MAX_SIZE>
class bm::base_sparse_vector< Val, BV, MAX_SIZE >

Base class for bit-transposed(bit-sliced) sparse vector construction.

Keeps the basic housekeeping lements like matrix of sparse elements

Definition at line 351 of file bmbmatrix.h.

Member Typedef Documentation

◆ allocation_policy_type

template<typename Val, typename BV, unsigned MAX_SIZE>
typedef bvector_type::allocation_policy bm::base_sparse_vector< Val, BV, MAX_SIZE >::allocation_policy_type

Definition at line 372 of file bmbmatrix.h.

◆ allocator_pool_type

template<typename Val, typename BV, unsigned MAX_SIZE>
typedef allocator_type::allocator_pool_type bm::base_sparse_vector< Val, BV, MAX_SIZE >::allocator_pool_type

Definition at line 374 of file bmbmatrix.h.

◆ allocator_type

template<typename Val, typename BV, unsigned MAX_SIZE>
typedef BV::allocator_type bm::base_sparse_vector< Val, BV, MAX_SIZE >::allocator_type

Definition at line 371 of file bmbmatrix.h.

◆ block_idx_type

template<typename Val, typename BV, unsigned MAX_SIZE>
typedef bvector_type::block_idx_type bm::base_sparse_vector< Val, BV, MAX_SIZE >::block_idx_type
protected

Definition at line 675 of file bmbmatrix.h.

◆ bmatrix_type

template<typename Val, typename BV, unsigned MAX_SIZE>
typedef bm::basic_bmatrix<BV> bm::base_sparse_vector< Val, BV, MAX_SIZE >::bmatrix_type

Definition at line 375 of file bmbmatrix.h.

◆ bvector_enumerator_type

template<typename Val, typename BV, unsigned MAX_SIZE>
typedef bvector_type::enumerator bm::base_sparse_vector< Val, BV, MAX_SIZE >::bvector_enumerator_type

Definition at line 373 of file bmbmatrix.h.

◆ bvector_type

template<typename Val, typename BV, unsigned MAX_SIZE>
typedef BV bm::base_sparse_vector< Val, BV, MAX_SIZE >::bvector_type

Definition at line 366 of file bmbmatrix.h.

◆ bvector_type_const_ptr

template<typename Val, typename BV, unsigned MAX_SIZE>
typedef const bvector_type* bm::base_sparse_vector< Val, BV, MAX_SIZE >::bvector_type_const_ptr

Definition at line 369 of file bmbmatrix.h.

◆ bvector_type_ptr

template<typename Val, typename BV, unsigned MAX_SIZE>
typedef bvector_type* bm::base_sparse_vector< Val, BV, MAX_SIZE >::bvector_type_ptr

Definition at line 368 of file bmbmatrix.h.

◆ const_reference

template<typename Val, typename BV, unsigned MAX_SIZE>
typedef const value_type& bm::base_sparse_vector< Val, BV, MAX_SIZE >::const_reference

Definition at line 370 of file bmbmatrix.h.

◆ size_type

template<typename Val, typename BV, unsigned MAX_SIZE>
typedef BV::size_type bm::base_sparse_vector< Val, BV, MAX_SIZE >::size_type

Definition at line 367 of file bmbmatrix.h.

◆ unsigned_value_type

template<typename Val, typename BV, unsigned MAX_SIZE>
typedef std::make_unsigned<value_type>::type bm::base_sparse_vector< Val, BV, MAX_SIZE >::unsigned_value_type

Definition at line 376 of file bmbmatrix.h.

◆ value_type

template<typename Val, typename BV, unsigned MAX_SIZE>
typedef Val bm::base_sparse_vector< Val, BV, MAX_SIZE >::value_type

Definition at line 365 of file bmbmatrix.h.

Member Enumeration Documentation

◆ bit_planes

template<typename Val, typename BV, unsigned MAX_SIZE>
enum bm::base_sparse_vector::bit_planes
Enumerator
sv_slices 
sv_value_slices 

Definition at line 354 of file bmbmatrix.h.

◆ vector_capacity

template<typename Val, typename BV, unsigned MAX_SIZE>
enum bm::base_sparse_vector::vector_capacity
Enumerator
max_vector_size 

Definition at line 360 of file bmbmatrix.h.

Constructor & Destructor Documentation

◆ base_sparse_vector() [1/4]

template<class Val, class BV, unsigned MAX_SIZE>
bm::base_sparse_vector< Val, BV, MAX_SIZE >::base_sparse_vector ( )

Definition at line 1625 of file bmbmatrix.h.

References bmatr_, bm::id_max, and sv_slices.

Referenced by base_sparse_vector(), copy_from(), copy_range_slices(), equal(), and swap().

◆ base_sparse_vector() [2/4]

template<class Val, class BV, unsigned MAX_SIZE>
bm::base_sparse_vector< Val, BV, MAX_SIZE >::base_sparse_vector ( bm::null_support null_able,
bool is_dynamic,
allocation_policy_type ap = allocation_policy_type(),
size_type bv_max_size = bm::id_max,
const allocator_type & alloc = allocator_type() )

Definition at line 1632 of file bmbmatrix.h.

References bmatr_, slice_mask_, sv_slices, and bm::use_null.

◆ base_sparse_vector() [3/4]

template<class Val, class BV, unsigned MAX_SIZE>
bm::base_sparse_vector< Val, BV, MAX_SIZE >::base_sparse_vector ( const base_sparse_vector< Val, BV, MAX_SIZE > & bsv)

Definition at line 1652 of file bmbmatrix.h.

References base_sparse_vector(), bmatr_, effective_slices_, size_, and slice_mask_.

◆ base_sparse_vector() [4/4]

template<typename Val, typename BV, unsigned MAX_SIZE>
bm::base_sparse_vector< Val, BV, MAX_SIZE >::base_sparse_vector ( base_sparse_vector< Val, BV, MAX_SIZE > && bsv)
inline

move-ctor

Definition at line 391 of file bmbmatrix.h.

Member Function Documentation

◆ bit_and_rows()

template<typename Val, typename BV, unsigned MAX_SIZE>
void bm::base_sparse_vector< Val, BV, MAX_SIZE >::bit_and_rows ( const bvector_type & bv)
inlineprotected

Set AND (intersect) operation on all existing bit-slices.

Parameters
bv- argument vector row[i] -= bv

Definition at line 672 of file bmbmatrix.h.

◆ bit_sub_rows()

template<typename Val, typename BV, unsigned MAX_SIZE>
void bm::base_sparse_vector< Val, BV, MAX_SIZE >::bit_sub_rows ( const bvector_type & bv,
bool use_null )
inlineprotected

Set SUB (MINUS) operation on all existing bit-slices.

Parameters
bv- argument vector row[i] -= bv

Definition at line 665 of file bmbmatrix.h.

◆ calc_stat()

template<class Val, class BV, unsigned MAX_SIZE>
void bm::base_sparse_vector< Val, BV, MAX_SIZE >::calc_stat ( typename bvector_type::statistics * st) const

Calculates memory statistics.

Function fills statistics structure containing information about how this vector uses memory and estimation of max. amount of memory bvector needs to serialize itself.

Parameters
st- pointer on statistics structure to be filled in.
See also
statistics

Definition at line 1918 of file bmbmatrix.h.

References BM_ASSERT, bmatr_, BMNOEXCEPT, get_bmatrix(), and slices().

◆ clear_all()

template<class Val, class BV, unsigned MAX_SIZE>
void bm::base_sparse_vector< Val, BV, MAX_SIZE >::clear_all ( bool free_mem = true)

resize to zero, free memory

Parameters
free_mem- fully destroys the plane vectors if true

Definition at line 1759 of file bmbmatrix.h.

References bmatr_, BMNOEXCEPT, get_null_bvect(), bm::basic_bmatrix< BV >::get_row(), is_ro_, size_, slice_mask_, and slices().

Referenced by resize().

◆ clear_range()

template<typename Val, typename BV, unsigned MAX_SIZE>
void bm::base_sparse_vector< Val, BV, MAX_SIZE >::clear_range ( size_type left,
size_type right,
bool set_null )

◆ clear_value_planes_from()

template<class Val, class BV, unsigned MAX_SIZE>
void bm::base_sparse_vector< Val, BV, MAX_SIZE >::clear_value_planes_from ( unsigned plane_idx,
size_type idx )
protected

clear column in all value planes

Parameters
plane_idx- row (plane index to start from)
idx- bit (column) to clear

Definition at line 1934 of file bmbmatrix.h.

References bmatr_.

◆ copy_from()

template<class Val, class BV, unsigned MAX_SIZE>
void bm::base_sparse_vector< Val, BV, MAX_SIZE >::copy_from ( const base_sparse_vector< Val, BV, MAX_SIZE > & bsv)
protected

◆ copy_range_slices()

template<class Val, class BV, unsigned MAX_SIZE>
void bm::base_sparse_vector< Val, BV, MAX_SIZE >::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 )
protected

◆ effective_slices()

template<typename Val, typename BV, unsigned MAX_SIZE>
unsigned bm::base_sparse_vector< Val, BV, MAX_SIZE >::effective_slices ( ) const
inline

Number of effective bit-planes in the value type.

Definition at line 514 of file bmbmatrix.h.

◆ empty()

template<typename Val, typename BV, unsigned MAX_SIZE>
bool bm::base_sparse_vector< Val, BV, MAX_SIZE >::empty ( ) const
inline

return true if empty

Definition at line 417 of file bmbmatrix.h.

◆ equal()

template<class Val, class BV, unsigned MAX_SIZE>
bool bm::base_sparse_vector< Val, BV, MAX_SIZE >::equal ( const base_sparse_vector< Val, BV, MAX_SIZE > & sv,
bm::null_support null_able = bm::use_null ) const

check if another sparse vector has the same content and size

Parameters
sv- sparse vector for comparison
null_able- flag to consider NULL vector in comparison (default) or compare only value content planes
Returns
true, if it is the same

Definition at line 1961 of file bmbmatrix.h.

References base_sparse_vector(), BM_ASSERT, BMNOEXCEPT, get_null_bvector(), bm::basic_bmatrix< BV >::get_row(), bm::basic_bmatrix< BV >::rows(), slices(), and bm::use_null.

◆ erase_column()

template<class Val, class BV, unsigned MAX_SIZE>
void bm::base_sparse_vector< Val, BV, MAX_SIZE >::erase_column ( size_type idx,
bool erase_null )
protected

erase bit (column) from all planes

Parameters
idx- bit (column) to erase
erase_null- erase the NULL vector

Definition at line 1952 of file bmbmatrix.h.

References bmatr_.

◆ free_slice()

template<typename Val, typename BV, unsigned MAX_SIZE>
void bm::base_sparse_vector< Val, BV, MAX_SIZE >::free_slice ( unsigned i)
inline

free memory in bit-plane

Definition at line 536 of file bmbmatrix.h.

◆ freeze_matr()

template<typename Val, typename BV, unsigned MAX_SIZE>
void bm::base_sparse_vector< Val, BV, MAX_SIZE >::freeze_matr ( )
inlineprotected

Turn on RO mode.

Definition at line 633 of file bmbmatrix.h.

◆ get_allocator_pool()

template<typename Val, typename BV, unsigned MAX_SIZE>
allocator_pool_type * bm::base_sparse_vector< Val, BV, MAX_SIZE >::get_allocator_pool ( ) const
inline

Get allocation pool.

Definition at line 474 of file bmbmatrix.h.

◆ get_bmatrix() [1/2]

template<typename Val, typename BV, unsigned MAX_SIZE>
bmatrix_type & bm::base_sparse_vector< Val, BV, MAX_SIZE >::get_bmatrix ( )
inline

access to internal bit-matrix

Definition at line 559 of file bmbmatrix.h.

◆ get_bmatrix() [2/2]

template<typename Val, typename BV, unsigned MAX_SIZE>
const bmatrix_type & bm::base_sparse_vector< Val, BV, MAX_SIZE >::get_bmatrix ( ) const
inline

◆ get_create_slice()

template<class Val, class BV, unsigned MAX_SIZE>
base_sparse_vector< Val, BV, MAX_SIZE >::bvector_type_ptr bm::base_sparse_vector< Val, BV, MAX_SIZE >::get_create_slice ( unsigned i)

get access to bit-plain, function checks and creates a plane

Returns
bit-vector for the bit plain

Definition at line 1851 of file bmbmatrix.h.

References bmatr_, effective_slices_, and slice_mask_.

Referenced by copy_range_slices(), and merge_matr().

◆ get_null_bvect()

template<typename Val, typename BV, unsigned MAX_SIZE>
bvector_type * bm::base_sparse_vector< Val, BV, MAX_SIZE >::get_null_bvect ( )
inline

◆ get_null_bvector()

template<typename Val, typename BV, unsigned MAX_SIZE>
const bvector_type * bm::base_sparse_vector< Val, BV, MAX_SIZE >::get_null_bvector ( ) const
inline

Get bit-vector of assigned values or NULL (if not constructed that way).

Examples
strsvsample06.cpp, xsample02.cpp, and xsample03.cpp.

Definition at line 451 of file bmbmatrix.h.

Referenced by copy_range_slices(), equal(), generate_random_subset(), is_null(), main(), print_sorted(), and bm::str_sparse_vector< CharType, BV, STR_SIZE >::remap_from_impl().

◆ get_null_support()

template<typename Val, typename BV, unsigned MAX_SIZE>
bm::null_support bm::base_sparse_vector< Val, BV, MAX_SIZE >::get_null_support ( ) const
inline

check if container supports NULL (unassigned) values

Definition at line 444 of file bmbmatrix.h.

◆ get_slice()

template<typename Val, typename BV, unsigned MAX_SIZE>
bvector_type_const_ptr bm::base_sparse_vector< Val, BV, MAX_SIZE >::get_slice ( unsigned i) const
inline

get read-only access to bit-plane

Returns
bit-vector for the bit plane or NULL

Definition at line 497 of file bmbmatrix.h.

Referenced by get_slice_mask().

◆ get_slice_mask()

template<class Val, class BV, unsigned MAX_SIZE>
bm::id64_t bm::base_sparse_vector< Val, BV, MAX_SIZE >::get_slice_mask ( unsigned element_idx) const

return mask of allocated bit-planes 1 in the mask - means bit-plane N is present returns 64-bit unsigned mask for sub 64-bit types (like int) unallocated mask bits will be zero extended

Returns
64-bit mask

Definition at line 1870 of file bmbmatrix.h.

References BMNOEXCEPT, get_slice(), and bm::basic_bmatrix< BV >::rows().

◆ insert_clear_value_planes_from()

template<class Val, class BV, unsigned MAX_SIZE>
void bm::base_sparse_vector< Val, BV, MAX_SIZE >::insert_clear_value_planes_from ( unsigned plane_idx,
size_type idx )
protected

insert false (clear) column in all value planes

Parameters
plane_idx- row (plane index to start from)
idx- bit (column) to clear insert

Definition at line 1943 of file bmbmatrix.h.

References bmatr_.

◆ insert_null()

template<class Val, class BV, unsigned MAX_SIZE>
void bm::base_sparse_vector< Val, BV, MAX_SIZE >::insert_null ( size_type idx,
bool not_null )
protected

insert (NOT) NULL value

Definition at line 1840 of file bmbmatrix.h.

References get_null_bvect().

◆ is_null()

template<class Val, class BV, unsigned MAX_SIZE>
bool bm::base_sparse_vector< Val, BV, MAX_SIZE >::is_null ( size_type idx) const

test if specified element is NULL

Parameters
idx- element index
Returns
true if it is NULL false if it was assigned or container is not configured to support assignment flags
Examples
svsample05.cpp.

Definition at line 1830 of file bmbmatrix.h.

References BMNOEXCEPT, and get_null_bvector().

Referenced by print_svector().

◆ is_nullable()

template<typename Val, typename BV, unsigned MAX_SIZE>
bool bm::base_sparse_vector< Val, BV, MAX_SIZE >::is_nullable ( ) const
inline

◆ is_signed()

template<typename Val, typename BV, unsigned MAX_SIZE>
constexpr bool bm::base_sparse_vector< Val, BV, MAX_SIZE >::is_signed ( )
inlinestaticconstexpr

returns true if value type is signed integral type

Definition at line 433 of file bmbmatrix.h.

Referenced by s2u(), and u2s().

◆ keep_range_no_check()

template<class Val, class BV, unsigned MAX_SIZE>
void bm::base_sparse_vector< Val, BV, MAX_SIZE >::keep_range_no_check ( size_type left,
size_type right,
bm::null_support slice_null )

Definition at line 1798 of file bmbmatrix.h.

References clear_range(), size(), and bm::use_null.

◆ mark_null_idx()

template<typename Val, typename BV, unsigned MAX_SIZE>
void bm::base_sparse_vector< Val, BV, MAX_SIZE >::mark_null_idx ( unsigned null_idx)
inline

Set NULL plain index.

Definition at line 565 of file bmbmatrix.h.

◆ merge_matr()

template<class Val, class BV, unsigned MAX_SIZE>
void bm::base_sparse_vector< Val, BV, MAX_SIZE >::merge_matr ( bmatrix_type & bmatr)
protected

Merge plane bvectors from an outside base matrix Note: outside base matrix gets destroyed.

Definition at line 1705 of file bmbmatrix.h.

References BM_ASSERT, bmatr_, get_create_slice(), get_null_bvect(), bm::basic_bmatrix< BV >::get_null_idx(), bm::basic_bmatrix< BV >::get_row(), bm::basic_bmatrix< BV >::rows(), and slice_mask_.

◆ optimize()

template<class Val, class BV, unsigned MAX_SIZE>
void bm::base_sparse_vector< Val, BV, MAX_SIZE >::optimize ( bm::word_t * temp_block = 0,
typename bvector_type::optmode opt_mode = bvector_type::opt_compress,
typename bvector_type::statistics * stat = 0 )

run memory optimization for all bit-vector rows

Parameters
temp_block- pre-allocated memory block to avoid unnecessary re-allocs
opt_mode- requested compression depth
stat- memory allocation statistics after optimization

Definition at line 1888 of file bmbmatrix.h.

References bm::bv_statistics::add(), bmatr_, bm::basic_bmatrix< BV >::destruct_row(), get_null_bvect(), bm::basic_bmatrix< BV >::get_row(), bm::basic_bmatrix< BV >::rows(), slice_mask_, and slices().

◆ optimize_block()

template<typename Val, typename BV, unsigned MAX_SIZE>
void bm::base_sparse_vector< Val, BV, MAX_SIZE >::optimize_block ( block_idx_type nb,
typename BV::optmode opt_mode )
inlineprotected

plane index for the "NOT NULL" flags plane

optimize block in all matrix planes

Definition at line 685 of file bmbmatrix.h.

◆ resize()

template<class Val, class BV, unsigned MAX_SIZE>
void bm::base_sparse_vector< Val, BV, MAX_SIZE >::resize ( size_type new_size,
bool set_null )

Definition at line 1812 of file bmbmatrix.h.

References clear_all(), clear_range(), size(), and size_.

Referenced by copy_from().

◆ s2u()

template<class Val, class BV, unsigned MAX_SIZE>
base_sparse_vector< Val, BV, MAX_SIZE >::unsigned_value_type bm::base_sparse_vector< Val, BV, MAX_SIZE >::s2u ( value_type v)
static

Convert signed value type to unsigned representation.

Definition at line 2087 of file bmbmatrix.h.

References BMNOEXCEPT, and is_signed().

Referenced by bm::rsc_sparse_vector< unsigned, sparse_vector_u32 >::s2u().

◆ set_allocator_pool()

template<typename Val, typename BV, unsigned MAX_SIZE>
void bm::base_sparse_vector< Val, BV, MAX_SIZE >::set_allocator_pool ( allocator_pool_type * pool_ptr)
inline

Set allocation pool.

Definition at line 468 of file bmbmatrix.h.

◆ size()

template<typename Val, typename BV, unsigned MAX_SIZE>
size_type bm::base_sparse_vector< Val, BV, MAX_SIZE >::size ( ) const
inline

◆ slice() [1/2]

template<typename Val, typename BV, unsigned MAX_SIZE>
bvector_type_ptr bm::base_sparse_vector< Val, BV, MAX_SIZE >::slice ( unsigned i)
inline

get access to bit-plane as is (can return NULL)

Definition at line 521 of file bmbmatrix.h.

◆ slice() [2/2]

template<typename Val, typename BV, unsigned MAX_SIZE>
bvector_type_const_ptr bm::base_sparse_vector< Val, BV, MAX_SIZE >::slice ( unsigned i) const
inline

Definition at line 522 of file bmbmatrix.h.

◆ slices()

template<typename Val, typename BV, unsigned MAX_SIZE>
unsigned bm::base_sparse_vector< Val, BV, MAX_SIZE >::slices ( )
inlinestatic

get total number of bit-planes in the vector

Definition at line 503 of file bmbmatrix.h.

Referenced by calc_stat(), clear_all(), copy_from(), equal(), optimize(), bm::rsc_sparse_vector< unsigned, sparse_vector_u32 >::slices(), and sync_ro().

◆ stored_slices()

template<typename Val, typename BV, unsigned MAX_SIZE>
unsigned bm::base_sparse_vector< Val, BV, MAX_SIZE >::stored_slices ( )
inlinestatic

Number of stored bit-planes (value planes + extra.

Definition at line 508 of file bmbmatrix.h.

Referenced by bm::rsc_sparse_vector< unsigned, sparse_vector_u32 >::stored_slices().

◆ swap()

template<class Val, class BV, unsigned MAX_SIZE>
void bm::base_sparse_vector< Val, BV, MAX_SIZE >::swap ( base_sparse_vector< Val, BV, MAX_SIZE > & bsv)

◆ swap_elements()

template<typename Val, typename BV, unsigned MAX_SIZE>
void bm::base_sparse_vector< Val, BV, MAX_SIZE >::swap_elements ( size_type idx1,
size_type idx2 )
inline

swap two vector elements

Definition at line 420 of file bmbmatrix.h.

◆ sync_ro()

template<class Val, class BV, unsigned MAX_SIZE>
void bm::base_sparse_vector< Val, BV, MAX_SIZE >::sync_ro ( )
protected

Sybc read-only state.

Definition at line 2030 of file bmbmatrix.h.

References BMNOEXCEPT, bm::basic_bmatrix< BV >::get_row(), is_ro_, bm::basic_bmatrix< BV >::rows(), and slices().

◆ u2s()

template<class Val, class BV, unsigned MAX_SIZE>
base_sparse_vector< Val, BV, MAX_SIZE >::value_type bm::base_sparse_vector< Val, BV, MAX_SIZE >::u2s ( unsigned_value_type v)
static

Convert unsigned value type to signed representation.

Definition at line 2108 of file bmbmatrix.h.

References BMNOEXCEPT, and is_signed().

Referenced by bm::rsc_sparse_vector< unsigned, sparse_vector_u32 >::u2s().

◆ value_bits()

template<typename Val, typename BV, unsigned MAX_SIZE>
constexpr unsigned bm::base_sparse_vector< Val, BV, MAX_SIZE >::value_bits ( )
inlinestaticconstexprprotected

Number of total bit-planes in the value type.

Definition at line 678 of file bmbmatrix.h.

Referenced by bm::base_sparse_vector< Val, BV, 1 >::slices(), and bm::base_sparse_vector< Val, BV, 1 >::stored_slices().

Field Documentation

◆ bmatr_

◆ effective_slices_

template<typename Val, typename BV, unsigned MAX_SIZE>
unsigned bm::base_sparse_vector< Val, BV, MAX_SIZE >::effective_slices_ =0
protected

number of bit slices actually allocated

Definition at line 704 of file bmbmatrix.h.

Referenced by base_sparse_vector(), copy_from(), get_create_slice(), and swap().

◆ is_ro_

template<typename Val, typename BV, unsigned MAX_SIZE>
bool bm::base_sparse_vector< Val, BV, MAX_SIZE >::is_ro_ =false
protected

◆ size_

◆ slice_mask_

template<typename Val, typename BV, unsigned MAX_SIZE>
unsigned_value_type bm::base_sparse_vector< Val, BV, MAX_SIZE >::slice_mask_ = 0
protected

slice presence bit-mask

Definition at line 702 of file bmbmatrix.h.

Referenced by base_sparse_vector(), base_sparse_vector(), clear_all(), copy_from(), get_create_slice(), merge_matr(), optimize(), and swap().


The documentation for this class was generated from the following file: