aGrUM  0.13.2
gum::learning::RecordCounterThreadBase< IdSetAlloc, CountAlloc > Class Template Referenceabstract

The database-independent class for preparing the computation of the number of observations of tuples of variables in a database. More...

#include <recordCounter.h>

+ Inheritance diagram for gum::learning::RecordCounterThreadBase< IdSetAlloc, CountAlloc >:

Public Member Functions

Constructors / Destructors
 RecordCounterThreadBase (const std::vector< Size > &var_modalities)
 default constructor More...
 
 RecordCounterThreadBase (const RecordCounterThreadBase< IdSetAlloc, CountAlloc > &from)
 copy constructor More...
 
 RecordCounterThreadBase (RecordCounterThreadBase< IdSetAlloc, CountAlloc > &&from)
 move operator More...
 
virtual RecordCounterThreadBase< IdSetAlloc, CountAlloc > * copyFactory () const =0
 virtual copy constructor More...
 
virtual ~RecordCounterThreadBase ()
 destructor More...
 
Accessors / Modifiers
Idx addNodeSet (const std::vector< Idx, IdSetAlloc > &ids)
 adds a new target nodeset to be counted More...
 
void clearNodeSets () noexcept
 remove all the current target nodesets More...
 
virtual void count ()=0
 update all the countings of all the nodesets by parsing the database More...
 
virtual Size DBSize () noexcept=0
 returns the size of the database More...
 
virtual void setRange (Size min_index, Size max_index)=0
 sets the interval of records on which countings should be performed More...
 
const std::vector< double, CountAlloc > & getCounts (Idx nodeset_id) const noexcept
 returns the countings for the nodeset specified in argument More...
 

Protected Attributes

const std::vector< Size > * _modalities {nullptr}
 the modalities of the variables More...
 
std::vector< const std::vector< Idx, IdSetAlloc > * > _nodesets
 the nodesets whose observations will be counted More...
 
std::vector< std::vector< double, CountAlloc > > _countings
 the nodesets countings More...
 
const char _align [_cache_size] {}
 used to prevent cacheline omp parallel problems More...
 

Static Protected Attributes

static constexpr Size _cache_size {128}
 the size of the cache used to prevent cacheline omp parallel problems More...
 

Detailed Description

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
class gum::learning::RecordCounterThreadBase< IdSetAlloc, CountAlloc >

The database-independent class for preparing the computation of the number of observations of tuples of variables in a database.

A RecordCounterThreadBase just prepares structures for the computation of the number of records observed for each value of its target nodes in the database (a target node usually represents either a single Discrete Variable or a pair of Discrete Variables). It is not intended to be used as is but rather to be created by class RecordCounterThread.

Definition at line 73 of file recordCounter.h.

Constructor & Destructor Documentation

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
gum::learning::RecordCounterThreadBase< IdSetAlloc, CountAlloc >::RecordCounterThreadBase ( const std::vector< Size > &  var_modalities)

default constructor

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
gum::learning::RecordCounterThreadBase< IdSetAlloc, CountAlloc >::RecordCounterThreadBase ( const RecordCounterThreadBase< IdSetAlloc, CountAlloc > &  from)

copy constructor

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
gum::learning::RecordCounterThreadBase< IdSetAlloc, CountAlloc >::RecordCounterThreadBase ( RecordCounterThreadBase< IdSetAlloc, CountAlloc > &&  from)

move operator

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
virtual gum::learning::RecordCounterThreadBase< IdSetAlloc, CountAlloc >::~RecordCounterThreadBase ( )
virtual

destructor

Member Function Documentation

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
Idx gum::learning::RecordCounterThreadBase< IdSetAlloc, CountAlloc >::addNodeSet ( const std::vector< Idx, IdSetAlloc > &  ids)

adds a new target nodeset to be counted

Returns
the id of the nodeset counter created
template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
void gum::learning::RecordCounterThreadBase< IdSetAlloc, CountAlloc >::clearNodeSets ( )
noexcept

remove all the current target nodesets

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
virtual RecordCounterThreadBase< IdSetAlloc, CountAlloc >* gum::learning::RecordCounterThreadBase< IdSetAlloc, CountAlloc >::copyFactory ( ) const
pure virtual
template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
virtual void gum::learning::RecordCounterThreadBase< IdSetAlloc, CountAlloc >::count ( )
pure virtual

update all the countings of all the nodesets by parsing the database

Implemented in gum::learning::RecordCounterThread< RowGeneratorParser, IdSetAlloc, CountAlloc >.

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
virtual Size gum::learning::RecordCounterThreadBase< IdSetAlloc, CountAlloc >::DBSize ( )
pure virtualnoexcept
template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
const std::vector< double, CountAlloc >& gum::learning::RecordCounterThreadBase< IdSetAlloc, CountAlloc >::getCounts ( Idx  nodeset_id) const
noexcept

returns the countings for the nodeset specified in argument

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
virtual void gum::learning::RecordCounterThreadBase< IdSetAlloc, CountAlloc >::setRange ( Size  min_index,
Size  max_index 
)
pure virtual

sets the interval of records on which countings should be performed

Implemented in gum::learning::RecordCounterThread< RowGeneratorParser, IdSetAlloc, CountAlloc >.

Member Data Documentation

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
const char gum::learning::RecordCounterThreadBase< IdSetAlloc, CountAlloc >::_align[_cache_size] {}
protected

used to prevent cacheline omp parallel problems

Definition at line 141 of file recordCounter.h.

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
constexpr Size gum::learning::RecordCounterThreadBase< IdSetAlloc, CountAlloc >::_cache_size {128}
staticprotected

the size of the cache used to prevent cacheline omp parallel problems

Definition at line 138 of file recordCounter.h.

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
std::vector< std::vector< double, CountAlloc > > gum::learning::RecordCounterThreadBase< IdSetAlloc, CountAlloc >::_countings
protected

the nodesets countings

Definition at line 135 of file recordCounter.h.

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
const std::vector< Size >* gum::learning::RecordCounterThreadBase< IdSetAlloc, CountAlloc >::_modalities {nullptr}
protected

the modalities of the variables

Definition at line 129 of file recordCounter.h.

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
std::vector< const std::vector< Idx, IdSetAlloc >* > gum::learning::RecordCounterThreadBase< IdSetAlloc, CountAlloc >::_nodesets
protected

the nodesets whose observations will be counted

Definition at line 132 of file recordCounter.h.


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