![]() |
aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
|
a binary Combination operator class used for scheduling inferences More...
#include <agrum/graphicalModels/inference/scheduleBinaryCombination.h>
Public Member Functions | |
Constructors / Destructors | |
| ScheduleBinaryCombination (const ScheduleMultiDim< TABLE1 > &table1, const ScheduleMultiDim< TABLE2 > &table2, TABLE_RES(*combine)(const TABLE1 &, const TABLE2 &), const bool is_result_persistent=false) | |
| default constructor | |
| ScheduleBinaryCombination (const ScheduleBinaryCombination< TABLE1, TABLE2, TABLE_RES > &from) | |
| copy constructor | |
| ScheduleBinaryCombination (ScheduleBinaryCombination< TABLE1, TABLE2, TABLE_RES > &&from) | |
| move constructor | |
| ScheduleBinaryCombination< TABLE1, TABLE2, TABLE_RES > * | clone () const final |
| virtual copy constructor | |
| virtual | ~ScheduleBinaryCombination () |
| destructor | |
Operators | |
| ScheduleBinaryCombination< TABLE1, TABLE2, TABLE_RES > & | operator= (const ScheduleBinaryCombination< TABLE1, TABLE2, TABLE_RES > &) |
| copy operator | |
| ScheduleBinaryCombination< TABLE1, TABLE2, TABLE_RES > & | operator= (ScheduleBinaryCombination< TABLE1, TABLE2, TABLE_RES > &&) |
| move operator | |
| bool | operator== (const ScheduleOperator &) const final |
| operator == | |
| bool | operator!= (const ScheduleOperator &) const final |
| operator != | |
| bool | operator== (const ScheduleBinaryCombination< TABLE1, TABLE2, TABLE_RES > &) const |
| operator == | |
| bool | operator!= (const ScheduleBinaryCombination< TABLE1, TABLE2, TABLE_RES > &) const |
| operator != | |
Accessors/Modifiers | |
| bool | hasSameArguments (const ScheduleOperator &) const final |
| checks whether two ScheduleCombination have the same parameters (same variables and same content) | |
| bool | hasSameArguments (const ScheduleBinaryCombination< TABLE1, TABLE2, TABLE_RES > &) const |
| checks whether two ScheduleCombination have the same parameters (same variables and same content) | |
| bool | hasSimilarArguments (const ScheduleOperator &) const final |
| checks whether two ScheduleCombination have similar parameters (same variables) | |
| bool | hasSimilarArguments (const ScheduleBinaryCombination< TABLE1, TABLE2, TABLE_RES > &) const |
| checks whether two ScheduleCombination have similar parameters (same variables) | |
| bool | isSameOperator (const ScheduleOperator &) const final |
| checks whether two ScheduleOperator perform the same set of operations | |
| bool | isSameOperator (const ScheduleBinaryCombination< TABLE1, TABLE2, TABLE_RES > &) const |
| checks whether two ScheduleOperator perform the same set of operations | |
| const ScheduleMultiDim< TABLE1 > & | arg1 () const |
| returns the first argument of the combination | |
| const ScheduleMultiDim< TABLE2 > & | arg2 () const |
| returns the first argument of the combination | |
| const Sequence< const IScheduleMultiDim * > & | args () const final |
| returns the sequence of arguments passed to the operator | |
| const ScheduleMultiDim< TABLE_RES > & | result () const |
| returns the result of the combination | |
| const Sequence< const IScheduleMultiDim * > & | results () const final |
| returns the ScheduleMultidim resulting from the operator | |
| void | updateArgs (const Sequence< const IScheduleMultiDim * > &new_args) final |
| modifies the arguments of the operator | |
| bool | isExecuted () const final |
| indicates whether the operator has been executed | |
| void | execute () final |
| executes the operator | |
| void | undo () final |
| undo a previous execution, if any | |
| double | nbOperations () const final |
| returns an estimation of the number of elementary operations needed to perform the ScheduleOperator | |
| std::pair< double, double > | memoryUsage () const final |
| returns the memory consumption used during the execution of the operator | |
| std::string | toString () const final |
| displays the content of the operator | |
| void | setCombinationFunction (TABLE_RES(*combine)(const TABLE1 &, const TABLE2 &)) |
| use a new combination function | |
Accessors/Modifiers | |
| ScheduleOperatorType | type () const |
| returns the type of the operator | |
| bool | implyDeletion () const |
| indicates whether the operator deletes some of its arguments | |
| void | makeResultsPersistent (const bool is_persistent) |
| makes the results of the operator persistent or not | |
| bool | hasPersistentResults () const |
| shows whether the operator has persistent results | |
Private Attributes | |
| const ScheduleMultiDim< TABLE1 > * | _arg1_ {nullptr} |
| the first argument of the combination | |
| const ScheduleMultiDim< TABLE2 > * | _arg2_ {nullptr} |
| the second argument of the combination | |
| Sequence< const IScheduleMultiDim * > | _args_ |
| the sequence of arguments passed to the operator | |
| ScheduleMultiDim< TABLE_RES > * | _result_ {nullptr} |
| the result of the combination | |
| Sequence< const IScheduleMultiDim * > | _results_ |
| the sequence of ScheduleMultidim output by the operator | |
| TABLE_RES(* | _combine_ )(const TABLE1 &, const TABLE2 &) |
| the function actually used to perform the combination | |
| ScheduleOperatorType | _op_type_ |
| the name of the operator to perform | |
| bool | _imply_deletion_ |
| indicates whether the operator will delete some of the ScheduleMultiDim passed as its arguments | |
| bool | _result_persistent_ |
| is the result persistent | |
a binary Combination operator class used for scheduling inferences
To be quite generic, the ScheduleBinaryCombination takes in argument the function that produces the result of the combination of the "real" tables contained within the ScheduleMultiDims to be combined. Note that executing a ScheduleBinaryCombination will always produce a freshly allocated table. The following code gives an example of the usage of ScheduleBinaryCombination:
Definition at line 102 of file scheduleBinaryCombination.h.
| gum::ScheduleBinaryCombination< TABLE1, TABLE2, TABLE_RES >::ScheduleBinaryCombination | ( | const ScheduleMultiDim< TABLE1 > & | table1, |
| const ScheduleMultiDim< TABLE2 > & | table2, | ||
| TABLE_RES(* | combine )(const TABLE1 &, const TABLE2 &), | ||
| const bool | is_result_persistent = false ) |
default constructor
| table1 | the first ScheduleMultiDim to combine with the other table |
| table2 | the second table involved in the combination |
| combine | a function taking two (real) tables in argument and returning the result of their combination |
| is_result_persistent | this boolean indicates whether the result of the binary combination is persistent, i.e., whether it should be kept in memory when the operator itself is deleted from memory. |
Referenced by ScheduleBinaryCombination(), ScheduleBinaryCombination(), ~ScheduleBinaryCombination(), clone(), hasSameArguments(), hasSimilarArguments(), isSameOperator(), operator!=(), operator=(), operator=(), and operator==().
| gum::ScheduleBinaryCombination< TABLE1, TABLE2, TABLE_RES >::ScheduleBinaryCombination | ( | const ScheduleBinaryCombination< TABLE1, TABLE2, TABLE_RES > & | from | ) |
| gum::ScheduleBinaryCombination< TABLE1, TABLE2, TABLE_RES >::ScheduleBinaryCombination | ( | ScheduleBinaryCombination< TABLE1, TABLE2, TABLE_RES > && | from | ) |
|
virtual |
destructor
References ScheduleBinaryCombination().
| const ScheduleMultiDim< TABLE1 > & gum::ScheduleBinaryCombination< TABLE1, TABLE2, TABLE_RES >::arg1 | ( | ) | const |
| const ScheduleMultiDim< TABLE2 > & gum::ScheduleBinaryCombination< TABLE1, TABLE2, TABLE_RES >::arg2 | ( | ) | const |
|
finalvirtual |
returns the sequence of arguments passed to the operator
Implements gum::ScheduleOperator.
References args().
Referenced by args().
|
finalvirtual |
virtual copy constructor
Implements gum::ScheduleOperator.
References ScheduleBinaryCombination().
|
finalvirtual |
executes the operator
This method guarantees that the result of the combination is a stored into a newly allocated table
Implements gum::ScheduleOperator.
References execute().
Referenced by execute().
|
inherited |
shows whether the operator has persistent results
| bool gum::ScheduleBinaryCombination< TABLE1, TABLE2, TABLE_RES >::hasSameArguments | ( | const ScheduleBinaryCombination< TABLE1, TABLE2, TABLE_RES > & | ) | const |
checks whether two ScheduleCombination have the same parameters (same variables and same content)
Parameters having the same variables and the same content are essentially identical but they may have different Ids (so that they may not be ==).
References ScheduleBinaryCombination(), and hasSameArguments().
|
finalvirtual |
checks whether two ScheduleCombination have the same parameters (same variables and same content)
Parameters having the same variables and the same content are essentially identical but they may have different Ids (so that they may not be ==).
Implements gum::ScheduleOperator.
References gum::ScheduleOperator::ScheduleOperator(), and hasSameArguments().
Referenced by hasSameArguments(), and hasSameArguments().
| bool gum::ScheduleBinaryCombination< TABLE1, TABLE2, TABLE_RES >::hasSimilarArguments | ( | const ScheduleBinaryCombination< TABLE1, TABLE2, TABLE_RES > & | ) | const |
checks whether two ScheduleCombination have similar parameters (same variables)
References ScheduleBinaryCombination(), and hasSimilarArguments().
|
finalvirtual |
checks whether two ScheduleCombination have similar parameters (same variables)
Implements gum::ScheduleOperator.
References gum::ScheduleOperator::ScheduleOperator(), and hasSimilarArguments().
Referenced by hasSimilarArguments(), and hasSimilarArguments().
|
inherited |
indicates whether the operator deletes some of its arguments
|
finalvirtual |
indicates whether the operator has been executed
Implements gum::ScheduleOperator.
References isExecuted().
Referenced by isExecuted().
| bool gum::ScheduleBinaryCombination< TABLE1, TABLE2, TABLE_RES >::isSameOperator | ( | const ScheduleBinaryCombination< TABLE1, TABLE2, TABLE_RES > & | ) | const |
checks whether two ScheduleOperator perform the same set of operations
References ScheduleBinaryCombination(), and isSameOperator().
|
finalvirtual |
checks whether two ScheduleOperator perform the same set of operations
Reimplemented from gum::ScheduleOperator.
References gum::ScheduleOperator::ScheduleOperator(), and isSameOperator().
Referenced by isSameOperator(), and isSameOperator().
|
inherited |
makes the results of the operator persistent or not
Unlike non-persistent results, a persistent one is not destroyed when the operator itself is destroyed
|
finalvirtual |
returns the memory consumption used during the execution of the operator
Actually, this function does not return a precise account of the memory used by the ScheduleOperator but a rough estimate based on the sizes of the tables involved in the operator.
Implements gum::ScheduleOperator.
References memoryUsage().
Referenced by memoryUsage().
|
finalvirtual |
returns an estimation of the number of elementary operations needed to perform the ScheduleOperator
Implements gum::ScheduleOperator.
References nbOperations().
Referenced by nbOperations().
| bool gum::ScheduleBinaryCombination< TABLE1, TABLE2, TABLE_RES >::operator!= | ( | const ScheduleBinaryCombination< TABLE1, TABLE2, TABLE_RES > & | ) | const |
operator !=
Two operators are different if and only if they either have different ScheduleMultiDim arguments or they perform different operations (e.g., one performs an addition and another one a subtraction). Different ScheduleMultiDim arguments means that the latter differ by their Ids.
References ScheduleBinaryCombination().
|
finalvirtual |
operator !=
Two operators are different if and only if they either have different ScheduleMultiDim arguments or they perform different operations (e.g., one performs an addition and another one a subtraction). different ScheduleMultiDim arguments means that the latter differ by their Ids.
Reimplemented from gum::ScheduleOperator.
References gum::ScheduleOperator::ScheduleOperator().
| ScheduleBinaryCombination< TABLE1, TABLE2, TABLE_RES > & gum::ScheduleBinaryCombination< TABLE1, TABLE2, TABLE_RES >::operator= | ( | const ScheduleBinaryCombination< TABLE1, TABLE2, TABLE_RES > & | ) |
| ScheduleBinaryCombination< TABLE1, TABLE2, TABLE_RES > & gum::ScheduleBinaryCombination< TABLE1, TABLE2, TABLE_RES >::operator= | ( | ScheduleBinaryCombination< TABLE1, TABLE2, TABLE_RES > && | ) |
| bool gum::ScheduleBinaryCombination< TABLE1, TABLE2, TABLE_RES >::operator== | ( | const ScheduleBinaryCombination< TABLE1, TABLE2, TABLE_RES > & | ) | const |
operator ==
Two operators are identical if and only if they have equal arguments and they perform the same operation (e.g., both perform additions). By Equal arguments, we mean that these ScheduleMultiDims have the same IDs
References ScheduleBinaryCombination().
|
finalvirtual |
operator ==
Two operators are identical if and only if they have equal (==) arguments and they perform the same operations (e.g., both perform additions). By Equal arguments, we mean that these ScheduleMultiDims have the same IDs
Reimplemented from gum::ScheduleOperator.
References gum::ScheduleOperator::ScheduleOperator().
| const ScheduleMultiDim< TABLE_RES > & gum::ScheduleBinaryCombination< TABLE1, TABLE2, TABLE_RES >::result | ( | ) | const |
returns the result of the combination
References result().
Referenced by result().
|
finalvirtual |
returns the ScheduleMultidim resulting from the operator
Implements gum::ScheduleOperator.
References results().
Referenced by results().
| void gum::ScheduleBinaryCombination< TABLE1, TABLE2, TABLE_RES >::setCombinationFunction | ( | TABLE_RES(* | combine )(const TABLE1 &, const TABLE2 &) | ) |
use a new combination function
References setCombinationFunction().
Referenced by setCombinationFunction().
|
finalvirtual |
displays the content of the operator
Implements gum::ScheduleOperator.
References toString().
Referenced by toString().
|
inherited |
returns the type of the operator
Referenced by ScheduleOperator().
|
finalvirtual |
undo a previous execution, if any
Implements gum::ScheduleOperator.
References undo().
Referenced by undo().
|
finalvirtual |
modifies the arguments of the operator
| SizeError | is raised if the number of elements in new_args does not correspond to the number of arguments expected by the ScheduleOperator. |
| TypeError | is raised if at least one element of new_args does not have a type compatible with what the ScheduleOperator expects. |
Implements gum::ScheduleOperator.
References updateArgs().
Referenced by updateArgs().
|
private |
the first argument of the combination
Definition at line 289 of file scheduleBinaryCombination.h.
|
private |
the second argument of the combination
Definition at line 292 of file scheduleBinaryCombination.h.
|
private |
the sequence of arguments passed to the operator
This method is convenient when using ScheduleOperator rather than directly using ScheduleBinaryCombination
Definition at line 297 of file scheduleBinaryCombination.h.
|
private |
the function actually used to perform the combination
Definition at line 310 of file scheduleBinaryCombination.h.
|
privateinherited |
indicates whether the operator will delete some of the ScheduleMultiDim passed as its arguments
Definition at line 246 of file scheduleOperator.h.
|
privateinherited |
the name of the operator to perform
Definition at line 242 of file scheduleOperator.h.
|
private |
the result of the combination
Definition at line 300 of file scheduleBinaryCombination.h.
|
privateinherited |
is the result persistent
Definition at line 249 of file scheduleOperator.h.
|
private |
the sequence of ScheduleMultidim output by the operator
Definition at line 307 of file scheduleBinaryCombination.h.