BitMagic-C++
Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Attributes
bm::bv_ref_vector< BV > Class Template Reference

List of reference bit-vectors with their true index associations. More...

#include <bmxor.h>

Public Types

typedef BV bvector_type
 
typedef bvector_type::size_type size_type
 
typedef bvector_typebvector_type_ptr
 
typedef const bvector_typebvector_type_const_ptr
 
typedef bvector_type::allocator_type bv_allocator_type
 
typedef bm::block_match_chain< size_typeblock_match_chain_type
 
typedef bm::dynamic_heap_matrix< block_match_chain_type, bv_allocator_typematrix_chain_type
 

Public Member Functions

void reset ()
 reset the collection (resize(0)) More...
 
void add (const bvector_type *bv, size_type ref_idx)
 Add reference vector. More...
 
size_type size () const BMNOEXCEPT
 Get reference list size. More...
 
const bvector_typeget_bv (size_type idx) const BMNOEXCEPT
 Get reference vector by the index in this ref-vector. More...
 
size_type get_row_idx (size_type idx) const BMNOEXCEPT
 Get reference row index by the index in this ref-vector. More...
 
size_type find (std::size_t ref_idx) const BMNOEXCEPT
 Find vector index by the reference index. More...
 
size_type find_bv (const bvector_type *bv) const BMNOEXCEPT
 Find vector index by the pointer. More...
 
void fill_alloc_digest (bvector_type &bv_blocks) const
 Fill block allocation digest for all vectors in the reference collection. More...
 
template<class BMATR >
void build (const BMATR &bmatr)
 Reset and build vector of references from a basic bit-matrix all NULL rows are skipped, not added to the ref.vector. More...
 
template<typename BMATR >
void add_vectors (const BMATR &bmatr)
 Append basic bit-matrix to the list of reference vectors. More...
 
template<class SV >
void add_sparse_vector (const SV &sv)
 Add bit-transposed sparse vector as a bit-matrix. More...
 
void resize_xor_matrix (matrix_chain_type &matr, size_type total_blocks) const
 Utility function to resize matrix based on number of vectors and blocks. More...
 
bool build_nb_digest_and_xor_matrix (matrix_chain_type &matr, bvector_type &bv_blocks) const
 Calculate blocks digest and resize XOR distance matrix based on total number of available blocks. More...
 

Static Public Member Functions

static size_type not_found () BMNOEXCEPT
 not-found value for find methods More...
 

Protected Types

typedef bm::heap_vector< bvector_type_const_ptr, bv_allocator_type, true > bvptr_vector_type
 
typedef bm::heap_vector< std::size_t, bv_allocator_type, true > bv_plane_vector_type
 

Protected Attributes

unsigned rows_acc_ = 0
 total rows accumulator More...
 
bvptr_vector_type ref_bvects_
 reference vector pointers More...
 
bv_plane_vector_type ref_bvects_rows_
 reference vector row idxs More...
 

Detailed Description

template<typename BV>
class bm::bv_ref_vector< BV >

List of reference bit-vectors with their true index associations.

Each referece vector would have two alternative indexes:

Examples
rscsample05.cpp.

Definition at line 623 of file bmxor.h.

Member Function Documentation

◆ add()

template<typename BV >
void bm::bv_ref_vector< BV >::add ( const bvector_type bv,
size_type  ref_idx 
)
inline

Add reference vector.

Parameters
bv- bvector pointer
ref_idx- reference (row) index

Definition at line 652 of file bmxor.h.

References BM_ASSERT, bm::bv_ref_vector< BV >::ref_bvects_, and bm::bv_ref_vector< BV >::ref_bvects_rows_.

Referenced by bm::bv_ref_vector< BV >::add_vectors().

◆ add_sparse_vector()

template<typename BV >
template<class SV >
void bm::bv_ref_vector< BV >::add_sparse_vector ( const SV &  sv)
inline

Add bit-transposed sparse vector as a bit-matrix.

See also
add_vectors
Examples
rscsample05.cpp.

Definition at line 739 of file bmxor.h.

References bm::bv_ref_vector< BV >::add_vectors().

Referenced by serialize_df2().

◆ add_vectors()

template<typename BV >
template<typename BMATR >
void bm::bv_ref_vector< BV >::add_vectors ( const BMATR &  bmatr)
inline

Append basic bit-matrix to the list of reference vectors.

See also
build
add_sparse_vector
Examples
rscsample05.cpp.

Definition at line 726 of file bmxor.h.

References bm::bv_ref_vector< BV >::add(), and bm::bv_ref_vector< BV >::rows_acc_.

Referenced by bm::bv_ref_vector< BV >::add_sparse_vector(), bm::bv_ref_vector< BV >::build(), and deserialize_df2().

◆ build()

template<typename BV >
template<class BMATR >
void bm::bv_ref_vector< BV >::build ( const BMATR &  bmatr)
inline

Reset and build vector of references from a basic bit-matrix all NULL rows are skipped, not added to the ref.vector.

See also
add_vectors

Definition at line 716 of file bmxor.h.

References bm::bv_ref_vector< BV >::add_vectors(), and bm::bv_ref_vector< BV >::reset().

◆ build_nb_digest_and_xor_matrix()

template<typename BV >
bool bm::bv_ref_vector< BV >::build_nb_digest_and_xor_matrix ( matrix_chain_type matr,
bvector_type bv_blocks 
) const
inline

Calculate blocks digest and resize XOR distance matrix based on total number of available blocks.

Returns
true if created ok (false if no blocks found)

Definition at line 759 of file bmxor.h.

References bm::bv_ref_vector< BV >::fill_alloc_digest(), and bm::bv_ref_vector< BV >::resize_xor_matrix().

Referenced by bm::compute_sim_matrix_plan_builder< BV >::build_plan(), and bm::xor_scanner< BV >::compute_sim_model().

◆ fill_alloc_digest()

template<typename BV >
void bm::bv_ref_vector< BV >::fill_alloc_digest ( bvector_type bv_blocks) const
inline

Fill block allocation digest for all vectors in the reference collection.

Parameters
bv_blocks- [out] bvector of blocks statistics

Definition at line 699 of file bmxor.h.

References BM_DECLARE_TEMP_BLOCK, bm::bv_ref_vector< BV >::fill_alloc_digest(), bm::bv_ref_vector< BV >::ref_bvects_, and bm::bv_ref_vector< BV >::size().

Referenced by bm::bv_ref_vector< BV >::build_nb_digest_and_xor_matrix(), and bm::bv_ref_vector< BV >::fill_alloc_digest().

◆ find()

template<typename BV >
size_type bm::bv_ref_vector< BV >::find ( std::size_t  ref_idx) const
inline

Find vector index by the reference index.

Returns
~0 if not found

Definition at line 676 of file bmxor.h.

References bm::bv_ref_vector< BV >::not_found(), bm::bv_ref_vector< BV >::ref_bvects_rows_, and bm::bv_ref_vector< BV >::size().

◆ find_bv()

template<typename BV >
size_type bm::bv_ref_vector< BV >::find_bv ( const bvector_type bv) const
inline

Find vector index by the pointer.

Returns
~0 if not found

Definition at line 687 of file bmxor.h.

References bm::bv_ref_vector< BV >::not_found(), bm::bv_ref_vector< BV >::ref_bvects_, and bm::bv_ref_vector< BV >::size().

Referenced by bm::sv_serialization_plan_builder< SV >::build_plan().

◆ get_bv()

template<typename BV >
const bvector_type* bm::bv_ref_vector< BV >::get_bv ( size_type  idx) const
inline

Get reference vector by the index in this ref-vector.

Definition at line 663 of file bmxor.h.

References bm::bv_ref_vector< BV >::ref_bvects_.

Referenced by bm::xor_scanner< BV >::get_ref_block().

◆ get_row_idx()

template<typename BV >
size_type bm::bv_ref_vector< BV >::get_row_idx ( size_type  idx) const
inline

Get reference row index by the index in this ref-vector.

Definition at line 667 of file bmxor.h.

References bm::bv_ref_vector< BV >::ref_bvects_rows_.

◆ not_found()

template<typename BV >
static size_type bm::bv_ref_vector< BV >::not_found ( )
inlinestatic

not-found value for find methods

Definition at line 672 of file bmxor.h.

Referenced by bm::sv_serialization_plan_builder< SV >::build_plan(), bm::bv_ref_vector< BV >::find(), and bm::bv_ref_vector< BV >::find_bv().

◆ reset()

template<typename BV >
void bm::bv_ref_vector< BV >::reset ( )
inline

◆ resize_xor_matrix()

template<typename BV >
void bm::bv_ref_vector< BV >::resize_xor_matrix ( matrix_chain_type matr,
size_type  total_blocks 
) const
inline

Utility function to resize matrix based on number of vectors and blocks.

Definition at line 746 of file bmxor.h.

References bm::bv_ref_vector< BV >::ref_bvects_.

Referenced by bm::bv_ref_vector< BV >::build_nb_digest_and_xor_matrix().

◆ size()

template<typename BV >
size_type bm::bv_ref_vector< BV >::size ( ) const
inline

Field Documentation

◆ ref_bvects_

template<typename BV >
bvptr_vector_type bm::bv_ref_vector< BV >::ref_bvects_
protected

◆ ref_bvects_rows_

template<typename BV >
bv_plane_vector_type bm::bv_ref_vector< BV >::ref_bvects_rows_
protected

◆ rows_acc_

template<typename BV >
unsigned bm::bv_ref_vector< BV >::rows_acc_ = 0
protected

total rows accumulator

Definition at line 775 of file bmxor.h.

Referenced by bm::bv_ref_vector< BV >::add_vectors(), and bm::bv_ref_vector< BV >::reset().


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