aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
gum::MultiDimCombineAndProjectDefault< TABLE > Class Template Referencefinal

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

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

Inheritance diagram for gum::MultiDimCombineAndProjectDefault< TABLE >:
Collaboration diagram for gum::MultiDimCombineAndProjectDefault< TABLE >:

Public Types

using value_type = typename MultiDimCombineAndProject< TABLE >::value_type

Public Member Functions

Constructors / Destructors
 MultiDimCombineAndProjectDefault (TABLE(*combine)(const TABLE &, const TABLE &), TABLE(*project)(const TABLE &, const gum::VariableSet &))
 Default constructor.
 MultiDimCombineAndProjectDefault (const MultiDimCombineAndProjectDefault< TABLE > &)
 Copy constructor.
virtual ~MultiDimCombineAndProjectDefault ()
 Destructor.
virtual MultiDimCombineAndProjectDefault< TABLE > * clone () const
 virtual constructor
Accessors/Modifiers
Set< const IScheduleMultiDim * > schedule (Schedule &schedule, const Set< const IScheduleMultiDim * > &original_tables, const gum::VariableSet &del_vars, const bool is_result_persistent=false) const
 add to a given schedule the set of operations needed to perform all the combinations and projections

Private Member Functions

void _freeData_ (std::vector< const IScheduleMultiDim * > &tables, std::vector< ScheduleOperator * > &operations) const
 free the scheduling memory

Private Attributes

MultiDimCombination< TABLE > * _combination_
 the class used for the combinations
MultiDimProjection< TABLE > * _projection_
 the class used for the projections

Accessors/Modifiers

TABLE(*)(const TABLE &, const TABLE &) combinationFunction ()
 Returns the current combination function.
TABLE(*)(const TABLE &, const gum::VariableSet &) projectionFunction ()
 returns the current projection function
Set< const TABLE * > execute (const Set< const TABLE * > &set, const gum::VariableSet &del_vars) final
 creates and returns the result of the projection over the variables not in del_vars of the combination of the tables within set
std::pair< std::vector< ScheduleOperator * >, Set< const IScheduleMultiDim * > > operations (const Set< const IScheduleMultiDim * > &original_tables, const gum::VariableSet &del_vars, const bool is_result_persistent=false) const final
 returns the set of operations to perform to make all the combinations and projections
std::pair< std::vector< ScheduleOperator * >, Set< const IScheduleMultiDim * > > operations (const std::vector< const IScheduleMultiDim * > &original_tables, const gum::VariableSet &del_vars, const bool is_result_persistent=false) const final
 Returns the current combination function.
void setCombinationFunction (TABLE(*combine)(const TABLE &, const TABLE &)) final
 changes the function used for combining two TABLES
void setCombinationClass (const MultiDimCombination< TABLE > &comb_class) final
 changes the class that performs the combinations
void setProjectionFunction (TABLE(*proj)(const TABLE &, const gum::VariableSet &)) final
 Changes the function used for projecting TABLES.
void setProjectionClass (const MultiDimProjection< TABLE > &proj_class) final
 Changes the class that performs the projections.
double nbOperations (const Set< const TABLE * > &set, const gum::VariableSet &del_vars) const final
 returns a rough estimate of the number of operations that will be performed to compute the combination.
double nbOperations (const Set< const Sequence< const DiscreteVariable * > * > &set, const gum::VariableSet &del_vars) const final
 returns a rough estimate of the number of operations that will be performed to compute the combination.
std::pair< double, doublememoryUsage (const Set< const TABLE * > &set, const gum::VariableSet &del_vars) const final
 returns the memory consumption used during the combinations and projections
std::pair< double, doublememoryUsage (const Set< const Sequence< const DiscreteVariable * > * > &set, const gum::VariableSet &del_vars) const final
 returns the memory consumption used during the combinations and projections

Detailed Description

template<class TABLE>
class gum::MultiDimCombineAndProjectDefault< TABLE >

An efficient class for combining and projecting MultiDim tables.

Definition at line 66 of file multiDimCombineAndProjectDefault.h.

Member Typedef Documentation

◆ value_type

template<class TABLE>
using gum::MultiDimCombineAndProjectDefault< TABLE >::value_type = typename MultiDimCombineAndProject< TABLE >::value_type

Definition at line 68 of file multiDimCombineAndProjectDefault.h.

Constructor & Destructor Documentation

◆ MultiDimCombineAndProjectDefault() [1/2]

template<class TABLE>
gum::MultiDimCombineAndProjectDefault< TABLE >::MultiDimCombineAndProjectDefault ( TABLE(* combine )(const TABLE &, const TABLE &),
TABLE(* project )(const TABLE &, const gum::VariableSet &) )

Default constructor.

Referenced by MultiDimCombineAndProjectDefault(), and clone().

Here is the caller graph for this function:

◆ MultiDimCombineAndProjectDefault() [2/2]

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

Copy constructor.

References MultiDimCombineAndProjectDefault().

Here is the call graph for this function:

◆ ~MultiDimCombineAndProjectDefault()

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

Destructor.

Member Function Documentation

◆ _freeData_()

template<class TABLE>
void gum::MultiDimCombineAndProjectDefault< TABLE >::_freeData_ ( std::vector< const IScheduleMultiDim * > & tables,
std::vector< ScheduleOperator * > & operations ) const
private

free the scheduling memory

References _freeData_(), and operations().

Referenced by _freeData_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clone()

template<class TABLE>
virtual MultiDimCombineAndProjectDefault< TABLE > * gum::MultiDimCombineAndProjectDefault< TABLE >::clone ( ) const
virtual

virtual constructor

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

Implements gum::MultiDimCombineAndProject< TABLE >.

References MultiDimCombineAndProjectDefault().

Here is the call graph for this function:

◆ execute()

template<class TABLE>
Set< const TABLE * > gum::MultiDimCombineAndProjectDefault< TABLE >::execute ( const Set< const TABLE * > & set,
const gum::VariableSet & del_vars )
finalvirtual

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< TABLE >.

◆ memoryUsage() [1/2]

template<class TABLE>
std::pair< double, double > gum::MultiDimCombineAndProjectDefault< TABLE >::memoryUsage ( const Set< const Sequence< const DiscreteVariable * > * > & set,
const gum::VariableSet & del_vars ) const
finalvirtual

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< TABLE >.

References memoryUsage().

Here is the call graph for this function:

◆ memoryUsage() [2/2]

template<class TABLE>
std::pair< double, double > gum::MultiDimCombineAndProjectDefault< TABLE >::memoryUsage ( const Set< const TABLE * > & set,
const gum::VariableSet & del_vars ) const
finalvirtual

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< TABLE >.

References memoryUsage().

Referenced by memoryUsage(), and memoryUsage().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nbOperations() [1/2]

template<class TABLE>
double gum::MultiDimCombineAndProjectDefault< TABLE >::nbOperations ( const Set< const Sequence< const DiscreteVariable * > * > & set,
const gum::VariableSet & del_vars ) const
finalvirtual

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

Implements gum::MultiDimCombineAndProject< TABLE >.

References nbOperations().

Here is the call graph for this function:

◆ nbOperations() [2/2]

template<class TABLE>
double gum::MultiDimCombineAndProjectDefault< TABLE >::nbOperations ( const Set< const TABLE * > & set,
const gum::VariableSet & del_vars ) const
finalvirtual

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

Implements gum::MultiDimCombineAndProject< TABLE >.

References nbOperations().

Referenced by nbOperations(), and nbOperations().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operations() [1/2]

template<class TABLE>
std::pair< std::vector< ScheduleOperator * >, Set< const IScheduleMultiDim * > > gum::MultiDimCombineAndProjectDefault< TABLE >::operations ( const Set< const IScheduleMultiDim * > & original_tables,
const gum::VariableSet & del_vars,
const bool is_result_persistent = false ) const
finalvirtual

returns the set of operations to perform to make all the combinations and projections

Implements gum::MultiDimCombineAndProject< TABLE >.

Referenced by _freeData_(), and operations().

Here is the caller graph for this function:

◆ operations() [2/2]

template<class TABLE>
std::pair< std::vector< ScheduleOperator * >, Set< const IScheduleMultiDim * > > gum::MultiDimCombineAndProjectDefault< TABLE >::operations ( const std::vector< const IScheduleMultiDim * > & original_tables,
const gum::VariableSet & del_vars,
const bool is_result_persistent = false ) const
finalvirtual

Returns the current combination function.

Implements gum::MultiDimCombineAndProject< TABLE >.

References gum::MultiDimCombineAndProject< TABLE >::MultiDimCombineAndProject(), operations(), and gum::MultiDimCombineAndProject< TABLE >::schedule().

Here is the call graph for this function:

◆ schedule()

template<class TABLE>
Set< const IScheduleMultiDim * > gum::MultiDimCombineAndProject< TABLE >::schedule ( Schedule & schedule,
const Set< const IScheduleMultiDim * > & original_tables,
const gum::VariableSet & del_vars,
const bool is_result_persistent = false ) const
inherited

add to a given schedule the set of operations needed to perform all the combinations and projections

References schedule().

Referenced by gum::MultiDimCombineAndProjectDefault< TABLE >::operations(), and schedule().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setCombinationClass()

template<class TABLE>
void gum::MultiDimCombineAndProjectDefault< TABLE >::setCombinationClass ( const MultiDimCombination< TABLE > & comb_class)
finalvirtual

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.

Implements gum::MultiDimCombineAndProject< TABLE >.

References setCombinationClass().

Referenced by setCombinationClass().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setCombinationFunction()

template<class TABLE>
void gum::MultiDimCombineAndProjectDefault< TABLE >::setCombinationFunction ( TABLE(* combine )(const TABLE &, const TABLE &))
finalvirtual

changes the function used for combining two TABLES

Implements gum::MultiDimCombineAndProject< TABLE >.

References setCombinationFunction().

Referenced by setCombinationFunction().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setProjectionClass()

template<class TABLE>
void gum::MultiDimCombineAndProjectDefault< TABLE >::setProjectionClass ( const MultiDimProjection< TABLE > & proj_class)
finalvirtual

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.

Implements gum::MultiDimCombineAndProject< TABLE >.

References setProjectionClass().

Referenced by setProjectionClass().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setProjectionFunction()

template<class TABLE>
void gum::MultiDimCombineAndProjectDefault< TABLE >::setProjectionFunction ( TABLE(* proj )(const TABLE &, const gum::VariableSet &))
finalvirtual

Changes the function used for projecting TABLES.

Implements gum::MultiDimCombineAndProject< TABLE >.

References setProjectionFunction().

Referenced by setProjectionFunction().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ _combination_

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

the class used for the combinations

Definition at line 217 of file multiDimCombineAndProjectDefault.h.

◆ _projection_

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

the class used for the projections

Definition at line 220 of file multiDimCombineAndProjectDefault.h.

◆ combinationFunction

template<class TABLE>
TABLE(*)(const TABLE &, const TABLE &) gum::MultiDimCombineAndProjectDefault< TABLE >::combinationFunction()

Returns the current combination function.

Definition at line 150 of file multiDimCombineAndProjectDefault.h.

◆ projectionFunction

template<class TABLE>
TABLE(*)(const TABLE &, const gum::VariableSet &) gum::MultiDimCombineAndProjectDefault< TABLE >::projectionFunction()

returns the current projection function

Definition at line 164 of file multiDimCombineAndProjectDefault.h.


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