aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
gum::MultiDimCombineAndProjectDefault< GUM_SCALAR, TABLE > Class Template Reference

An efficient class for combining and projecting MultiDim tables. More...

#include <agrum/tools/multidim/operators/multiDimCombineAndProjectDefault.h>

+ Inheritance diagram for gum::MultiDimCombineAndProjectDefault< GUM_SCALAR, TABLE >:
+ Collaboration diagram for gum::MultiDimCombineAndProjectDefault< GUM_SCALAR, TABLE >:

Public Member Functions

Constructors / Destructors
 MultiDimCombineAndProjectDefault (TABLE< GUM_SCALAR > *(*combine)(const TABLE< GUM_SCALAR > &, const TABLE< GUM_SCALAR > &), TABLE< GUM_SCALAR > *(*project)(const TABLE< GUM_SCALAR > &, const Set< const DiscreteVariable * > &))
 Default constructor. More...
 
 MultiDimCombineAndProjectDefault (const MultiDimCombineAndProjectDefault< GUM_SCALAR, TABLE > &)
 Copy constructor. More...
 
virtual ~MultiDimCombineAndProjectDefault ()
 Destructor. More...
 
virtual MultiDimCombineAndProjectDefault< GUM_SCALAR, TABLE > * newFactory () const
 virtual constructor More...
 
Accessors/Modifiers
virtual Set< const TABLE< GUM_SCALAR > *> combineAndProject (Set< const TABLE< GUM_SCALAR > * > set, Set< const DiscreteVariable * > del_vars)
 creates and returns the result of the projection over the variables not in del_vars of the combination of the tables within set More...
 
virtual void setCombineFunction (TABLE< GUM_SCALAR > *(*combine)(const TABLE< GUM_SCALAR > &, const TABLE< GUM_SCALAR > &))
 changes the function used for combining two TABLES More...
 
virtual void setCombinationClass (const MultiDimCombination< GUM_SCALAR, TABLE > &comb_class)
 changes the class that performs the combinations More...
 
virtual TABLE< GUM_SCALAR > *(*)(const TABLE< GUM_SCALAR > &, const TABLE< GUM_SCALAR > &) combineFunction ()
 Returns the current combination function. More...
 
virtual void setProjectFunction (TABLE< GUM_SCALAR > *(*proj)(const TABLE< GUM_SCALAR > &, const Set< const DiscreteVariable * > &))
 Changes the function used for projecting TABLES. More...
 
virtual void setProjectionClass (const MultiDimProjection< GUM_SCALAR, TABLE > &proj_class)
 Changes the class that performs the projections. More...
 
virtual TABLE< GUM_SCALAR > *(*)(const TABLE< GUM_SCALAR > &, const Set< const DiscreteVariable *> &) projectFunction ()
 returns the current projection function More...
 
virtual float nbOperations (const Set< const TABLE< GUM_SCALAR > * > &set, const Set< const DiscreteVariable * > &del_vars) const
 returns a rough estimate of the number of operations that will be performed to compute the combination. More...
 
virtual float nbOperations (const Set< const Sequence< const DiscreteVariable * > * > &set, Set< const DiscreteVariable * > del_vars) const
 returns a rough estimate of the number of operations that will be performed to compute the combination. More...
 
virtual std::pair< long, long > memoryUsage (const Set< const TABLE< GUM_SCALAR > * > &set, const Set< const DiscreteVariable * > &del_vars) const
 returns the memory consumption used during the combinations and projections More...
 
virtual std::pair< long, long > memoryUsage (const Set< const Sequence< const DiscreteVariable * > * > &set, Set< const DiscreteVariable * > del_vars) const
 returns the memory consumption used during the combinations and projections More...
 

Detailed Description

template<typename GUM_SCALAR, template< typename > class TABLE>
class gum::MultiDimCombineAndProjectDefault< GUM_SCALAR, TABLE >

An efficient class for combining and projecting MultiDim tables.

Definition at line 47 of file multiDimCombineAndProjectDefault.h.

Constructor & Destructor Documentation

◆ MultiDimCombineAndProjectDefault() [1/2]

template<typename GUM_SCALAR , template< typename > class TABLE>
gum::MultiDimCombineAndProjectDefault< GUM_SCALAR, TABLE >::MultiDimCombineAndProjectDefault ( TABLE< GUM_SCALAR > *(*)(const TABLE< GUM_SCALAR > &, const TABLE< GUM_SCALAR > &)  combine,
TABLE< GUM_SCALAR > *(*)(const TABLE< GUM_SCALAR > &, const Set< const DiscreteVariable * > &)  project 
)

Default constructor.

◆ MultiDimCombineAndProjectDefault() [2/2]

template<typename GUM_SCALAR , template< typename > class TABLE>
gum::MultiDimCombineAndProjectDefault< GUM_SCALAR, TABLE >::MultiDimCombineAndProjectDefault ( const MultiDimCombineAndProjectDefault< GUM_SCALAR, TABLE > &  )

Copy constructor.

◆ ~MultiDimCombineAndProjectDefault()

template<typename GUM_SCALAR , template< typename > class TABLE>
virtual gum::MultiDimCombineAndProjectDefault< GUM_SCALAR, TABLE >::~MultiDimCombineAndProjectDefault ( )
virtual

Destructor.

Member Function Documentation

◆ combineAndProject()

template<typename GUM_SCALAR , template< typename > class TABLE>
virtual Set< const TABLE< GUM_SCALAR >* > gum::MultiDimCombineAndProjectDefault< GUM_SCALAR, TABLE >::combineAndProject ( Set< const TABLE< GUM_SCALAR > * >  set,
Set< const DiscreteVariable * >  del_vars 
)
virtual

creates and returns the result of the projection over the variables not in del_vars of the combination of the tables within set

Returns
a new freshly created TABLE which is the result of the projection of the combination of all the TABLES passed in argument
Exceptions
InvalidArgumentsNumberexception is thrown if the set passed in argument contains less than two elements.

Implements gum::MultiDimCombineAndProject< GUM_SCALAR, TABLE >.

◆ combineFunction()

template<typename GUM_SCALAR , template< typename > class TABLE>
virtual TABLE< GUM_SCALAR >*(*)(const TABLE< GUM_SCALAR >&, const TABLE< GUM_SCALAR >&) gum::MultiDimCombineAndProjectDefault< GUM_SCALAR, TABLE >::combineFunction ( )
virtual

Returns the current combination function.

Reimplemented from gum::MultiDimCombineAndProject< GUM_SCALAR, TABLE >.

◆ memoryUsage() [1/2]

template<typename GUM_SCALAR , template< typename > class TABLE>
virtual std::pair< long, long > gum::MultiDimCombineAndProjectDefault< GUM_SCALAR, TABLE >::memoryUsage ( const Set< const TABLE< GUM_SCALAR > * > &  set,
const Set< const DiscreteVariable * > &  del_vars 
) const
virtual

returns the memory consumption used during the combinations and projections

Actually, this function does not return a precise account of the memory used by the MultiDimCombineAndProject but a rough estimate based on the size of the tables involved in the combinations and projections.

Returns
a pair of memory consumption: the first one is the maximum amount of memory used during the set of combinations and projections performed, and the second one is the amount of memory still used at the end of the function ( the memory used by the resulting tables )

◆ memoryUsage() [2/2]

template<typename GUM_SCALAR , template< typename > class TABLE>
virtual std::pair< long, long > gum::MultiDimCombineAndProjectDefault< GUM_SCALAR, TABLE >::memoryUsage ( const Set< const Sequence< const DiscreteVariable * > * > &  set,
Set< const DiscreteVariable * >  del_vars 
) const
virtual

returns the memory consumption used during the combinations and projections

Actually, this function does not return a precise account of the memory used by the MultiDimCombineAndProject but a rough estimate based on the size of the tables involved in the combinations and projections.

Returns
a pair of memory consumption: the first one is the maximum amount of memory used during the set of combinations and projections performed, and the second one is the amount of memory still used at the end of the function ( the memory used by the resulting tables )

Implements gum::MultiDimCombineAndProject< GUM_SCALAR, TABLE >.

◆ nbOperations() [1/2]

template<typename GUM_SCALAR , template< typename > class TABLE>
virtual float gum::MultiDimCombineAndProjectDefault< GUM_SCALAR, TABLE >::nbOperations ( const Set< const TABLE< GUM_SCALAR > * > &  set,
const Set< const DiscreteVariable * > &  del_vars 
) const
virtual

returns a rough estimate of the number of operations that will be performed to compute the combination.

Implements gum::MultiDimCombineAndProject< GUM_SCALAR, TABLE >.

◆ nbOperations() [2/2]

template<typename GUM_SCALAR , template< typename > class TABLE>
virtual float gum::MultiDimCombineAndProjectDefault< GUM_SCALAR, TABLE >::nbOperations ( const Set< const Sequence< const DiscreteVariable * > * > &  set,
Set< const DiscreteVariable * >  del_vars 
) const
virtual

returns a rough estimate of the number of operations that will be performed to compute the combination.

◆ newFactory()

template<typename GUM_SCALAR , template< typename > class TABLE>
virtual MultiDimCombineAndProjectDefault< GUM_SCALAR, TABLE >* gum::MultiDimCombineAndProjectDefault< GUM_SCALAR, TABLE >::newFactory ( ) const
virtual

virtual constructor

Returns
a new fresh MultiDimCombineAndProjectDefault with the same combination and projection functions.

Implements gum::MultiDimCombineAndProject< GUM_SCALAR, TABLE >.

◆ projectFunction()

template<typename GUM_SCALAR , template< typename > class TABLE>
virtual TABLE< GUM_SCALAR >*(*)(const TABLE< GUM_SCALAR >&, const Set< const DiscreteVariable* >&) gum::MultiDimCombineAndProjectDefault< GUM_SCALAR, TABLE >::projectFunction ( )
virtual

returns the current projection function

Reimplemented from gum::MultiDimCombineAndProject< GUM_SCALAR, TABLE >.

◆ setCombinationClass()

template<typename GUM_SCALAR , template< typename > class TABLE>
virtual void gum::MultiDimCombineAndProjectDefault< GUM_SCALAR, TABLE >::setCombinationClass ( const MultiDimCombination< GUM_SCALAR, TABLE > &  comb_class)
virtual

changes the class that performs the combinations

Combinations are performed by pair, the CombineFunction being the function used to combine 2 tables, thus producing a new one. Of course, when we have to combine, say T1 * T2 * T3 * T4, there are several ways to do this computation. For instance, we might first compute T1 * T2, then T3 * T4, and finally compute the product of the resulting two tables. Or we might compute T1 * T2, then combine the result with T3, and then combine the last result with T4. The CombinationClass is responsible for determining which of these possibilities will actually be used. Function setCombinationClass allows to change the combinationClass and, thus, the way all those tables will be combined.

◆ setCombineFunction()

template<typename GUM_SCALAR , template< typename > class TABLE>
virtual void gum::MultiDimCombineAndProjectDefault< GUM_SCALAR, TABLE >::setCombineFunction ( TABLE< GUM_SCALAR > *(*)(const TABLE< GUM_SCALAR > &, const TABLE< GUM_SCALAR > &)  combine)
virtual

changes the function used for combining two TABLES

Implements gum::MultiDimCombineAndProject< GUM_SCALAR, TABLE >.

◆ setProjectFunction()

template<typename GUM_SCALAR , template< typename > class TABLE>
virtual void gum::MultiDimCombineAndProjectDefault< GUM_SCALAR, TABLE >::setProjectFunction ( TABLE< GUM_SCALAR > *(*)(const TABLE< GUM_SCALAR > &, const Set< const DiscreteVariable * > &)  proj)
virtual

Changes the function used for projecting TABLES.

Implements gum::MultiDimCombineAndProject< GUM_SCALAR, TABLE >.

◆ setProjectionClass()

template<typename GUM_SCALAR , template< typename > class TABLE>
virtual void gum::MultiDimCombineAndProjectDefault< GUM_SCALAR, TABLE >::setProjectionClass ( const MultiDimProjection< GUM_SCALAR, TABLE > &  proj_class)
virtual

Changes the class that performs the projections.

As for the combination class, it is possible to change the projection class, thus defining a new projection behaviour.

Member Data Documentation

◆ _combination_

template<typename GUM_SCALAR , template< typename > class TABLE>
MultiDimCombination< GUM_SCALAR, TABLE >* gum::MultiDimCombineAndProjectDefault< GUM_SCALAR, TABLE >::_combination_
private

the class used for the combinations

Definition at line 187 of file multiDimCombineAndProjectDefault.h.

◆ _projection_

template<typename GUM_SCALAR , template< typename > class TABLE>
MultiDimProjection< GUM_SCALAR, TABLE >* gum::MultiDimCombineAndProjectDefault< GUM_SCALAR, TABLE >::_projection_
private

the class used for the projections

Definition at line 190 of file multiDimCombineAndProjectDefault.h.


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