BitMagic-C++

Integer set to set transformation (functional image in groups theory) https://en.wikipedia.org/wiki/Image_(mathematics). More...

#include <bmsparsevec_algo.h>

Collaboration diagram for bm::set2set_11_transform< SV >:

Data Structures

struct  gather_buffer

Public Types

typedef SV::bvector_type bvector_type
typedef SV::value_type value_type
typedef SV::size_type size_type
typedef bvector_type::allocator_type::allocator_pool_type allocator_pool_type

Public Member Functions

 set2set_11_transform ()
 ~set2set_11_transform ()
const bvector_typeget_bv_zero () const
 Get read access to zero-elements vector Zero vector gets populated after attach_sv() is called or as a side-effect of remap() with immediate sv param.
void remap (const bvector_type &bv_in, bvector_type &bv_out)
 Perform remapping (Image function) (based on attached translation table).
void remap (const bvector_type &bv_in, const SV &sv_brel, bvector_type &bv_out)
 Perform remapping (Image function).
bool remap (size_type id_from, const SV &sv_brel, size_type &id_to)
 Remap single set element.
void run (const bvector_type &bv_in, const SV &sv_brel, bvector_type &bv_out)
 Run remap transformation.
void attach_sv (const SV *sv_brel, bool compute_stats=false)
 Attach a translation table vector for remapping (Image function).

Protected Types

enum  gather_window_size { sv_g_size = 1024 * 8 }
typedef gather_buffer< sv_g_sizegather_buffer_type

Protected Member Functions

void one_pass_run (const bvector_type &bv_in, const SV &sv_brel, bvector_type &bv_out)
 set2set_11_transform (const set2set_11_transform &)=delete
void operator= (const set2set_11_transform &)=delete

Protected Attributes

const SV * sv_ptr_
 current translation table vector
gather_buffer_typegb_
 intermediate buffers
bvector_type bv_product_
 temp vector
bool have_stats_
 flag of statistics presense
bvector_type bv_zero_
 bit-vector for zero elements
allocator_pool_type pool_

Detailed Description

template<typename SV>
class bm::set2set_11_transform< SV >

Integer set to set transformation (functional image in groups theory) https://en.wikipedia.org/wiki/Image_(mathematics).

Input sets gets translated through the function, which is defined as "one to one (or NULL)" binary relation object (sparse_vector). Also works for M:1 relationships.

Examples
svsample05.cpp.

Definition at line 1246 of file bmsparsevec_algo.h.

Member Typedef Documentation

◆ allocator_pool_type

template<typename SV>
typedef bvector_type::allocator_type::allocator_pool_type bm::set2set_11_transform< SV >::allocator_pool_type

Definition at line 1252 of file bmsparsevec_algo.h.

◆ bvector_type

template<typename SV>
typedef SV::bvector_type bm::set2set_11_transform< SV >::bvector_type

Definition at line 1249 of file bmsparsevec_algo.h.

◆ gather_buffer_type

template<typename SV>
typedef gather_buffer<sv_g_size> bm::set2set_11_transform< SV >::gather_buffer_type
protected

Definition at line 1341 of file bmsparsevec_algo.h.

◆ size_type

template<typename SV>
typedef SV::size_type bm::set2set_11_transform< SV >::size_type

Definition at line 1251 of file bmsparsevec_algo.h.

◆ value_type

template<typename SV>
typedef SV::value_type bm::set2set_11_transform< SV >::value_type

Definition at line 1250 of file bmsparsevec_algo.h.

Member Enumeration Documentation

◆ gather_window_size

template<typename SV>
enum bm::set2set_11_transform::gather_window_size
protected
Enumerator
sv_g_size 

Definition at line 1337 of file bmsparsevec_algo.h.

Constructor & Destructor Documentation

◆ set2set_11_transform() [1/2]

template<typename SV>
bm::set2set_11_transform< SV >::set2set_11_transform ( )

Definition at line 1366 of file bmsparsevec_algo.h.

References gb_, have_stats_, and sv_ptr_.

Referenced by operator=(), and set2set_11_transform().

◆ ~set2set_11_transform()

template<typename SV>
bm::set2set_11_transform< SV >::~set2set_11_transform ( )

Definition at line 1382 of file bmsparsevec_algo.h.

References gb_.

◆ set2set_11_transform() [2/2]

template<typename SV>
bm::set2set_11_transform< SV >::set2set_11_transform ( const set2set_11_transform< SV > & )
protecteddelete

Member Function Documentation

◆ attach_sv()

template<typename SV>
void bm::set2set_11_transform< SV >::attach_sv ( const SV * sv_brel,
bool compute_stats = false )

Attach a translation table vector for remapping (Image function).

Parameters
sv_brel- binary relation sparse vector pointer (pass NULL to detach)
compute_stats- flag to perform computation of some statistics later used in remapping. This only make sense for series of remappings on the same translation vector.
See also
remap

Definition at line 1392 of file bmsparsevec_algo.h.

References bv_zero_, bm::sparse_vector_scanner< SV, S_FACTOR >::find_zero(), have_stats_, pool_, and sv_ptr_.

Referenced by remap().

◆ get_bv_zero()

template<typename SV>
const bvector_type & bm::set2set_11_transform< SV >::get_bv_zero ( ) const
inline

Get read access to zero-elements vector Zero vector gets populated after attach_sv() is called or as a side-effect of remap() with immediate sv param.

Definition at line 1263 of file bmsparsevec_algo.h.

References bv_zero_.

◆ one_pass_run()

template<typename SV>
void bm::set2set_11_transform< SV >::one_pass_run ( const bvector_type & bv_in,
const SV & sv_brel,
bvector_type & bv_out )
protected

Definition at line 1555 of file bmsparsevec_algo.h.

◆ operator=()

template<typename SV>
void bm::set2set_11_transform< SV >::operator= ( const set2set_11_transform< SV > & )
protecteddelete

◆ remap() [1/3]

template<typename SV>
void bm::set2set_11_transform< SV >::remap ( const bvector_type & bv_in,
bvector_type & bv_out )

Perform remapping (Image function) (based on attached translation table).

Parameters
bv_in- input set, defined as a bit-vector
bv_out- output set as a bit-vector
See also
attach_sv
Examples
svsample05.cpp.

Definition at line 1458 of file bmsparsevec_algo.h.

References BM_ASSERT, bm::BM_SORTED, bm::BM_SORTED_UNIFORM, bv_product_, bv_zero_, gb_, have_stats_, pool_, bm::set_block_shift, sv_g_size, sv_ptr_, and bm::bvector< Alloc >::iterator_base::valid().

Referenced by main(), remap(), and run().

◆ remap() [2/3]

template<typename SV>
void bm::set2set_11_transform< SV >::remap ( const bvector_type & bv_in,
const SV & sv_brel,
bvector_type & bv_out )

Perform remapping (Image function).

Parameters
bv_in- input set, defined as a bit-vector
sv_brel- binary relation (translation table) sparse vector
bv_out- output set as a bit-vector

Definition at line 1441 of file bmsparsevec_algo.h.

References attach_sv(), bv_product_, bv_zero_, pool_, and remap().

◆ remap() [3/3]

template<typename SV>
bool bm::set2set_11_transform< SV >::remap ( size_type id_from,
const SV & sv_brel,
size_type & id_to )

Remap single set element.

Parameters
id_from- input value
sv_brel- translation table sparse vector
id_to- out value
Returns
- true if value was found and remapped

Definition at line 1420 of file bmsparsevec_algo.h.

◆ run()

template<typename SV>
void bm::set2set_11_transform< SV >::run ( const bvector_type & bv_in,
const SV & sv_brel,
bvector_type & bv_out )
inline

Run remap transformation.

Parameters
bv_in- input set, defined as a bit-vector
sv_brel- translation table sparse vector
bv_out- output set as a bit-vector
See also
remap
Examples
svsample05.cpp.

Definition at line 1304 of file bmsparsevec_algo.h.

References remap().

Referenced by main().

Field Documentation

◆ bv_product_

template<typename SV>
bvector_type bm::set2set_11_transform< SV >::bv_product_
protected

temp vector

Definition at line 1351 of file bmsparsevec_algo.h.

Referenced by remap(), and remap().

◆ bv_zero_

template<typename SV>
bvector_type bm::set2set_11_transform< SV >::bv_zero_
protected

bit-vector for zero elements

Definition at line 1354 of file bmsparsevec_algo.h.

Referenced by attach_sv(), get_bv_zero(), remap(), and remap().

◆ gb_

template<typename SV>
gather_buffer_type* bm::set2set_11_transform< SV >::gb_
protected

intermediate buffers

Definition at line 1350 of file bmsparsevec_algo.h.

Referenced by remap(), set2set_11_transform(), and ~set2set_11_transform().

◆ have_stats_

template<typename SV>
bool bm::set2set_11_transform< SV >::have_stats_
protected

flag of statistics presense

Definition at line 1353 of file bmsparsevec_algo.h.

Referenced by attach_sv(), remap(), and set2set_11_transform().

◆ pool_

template<typename SV>
allocator_pool_type bm::set2set_11_transform< SV >::pool_
protected

Definition at line 1356 of file bmsparsevec_algo.h.

Referenced by attach_sv(), remap(), and remap().

◆ sv_ptr_

template<typename SV>
const SV* bm::set2set_11_transform< SV >::sv_ptr_
protected

current translation table vector

Definition at line 1349 of file bmsparsevec_algo.h.

Referenced by attach_sv(), remap(), and set2set_11_transform().


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