![]() |
aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
|
a Wrapper for multi-dimensional tables used for scheduling inferences More...
#include <agrum/base/graphicalModels/inference/scheduler/scheduleMultiDim.h>
Classes | |
| struct | ElementType |
| metaprogramming to get the types of the elements stored into the ScheduleMultidims More... | |
| struct | ElementType< CONTAINER< T, Args... > > |
Public Member Functions | |
Constructors / Destructors | |
| ScheduleMultiDim (const TABLE &table, const bool copy, const Idx id=0) | |
| constructs a ScheduleMultiDim by copying/referencing table | |
| ScheduleMultiDim (TABLE &&table, const Idx id=0) | |
| constructs a ScheduleMultiDim by moving a table inside it | |
| ScheduleMultiDim (const Sequence< const DiscreteVariable * > &vars, const Idx id=0) | |
| construct a ScheduleMultiDim for a multidimensional table yet to be built | |
| ScheduleMultiDim (const ScheduleMultiDim< TABLE > &from) | |
| copy constructor | |
| ScheduleMultiDim (ScheduleMultiDim< TABLE > &&from) | |
| move constructor | |
| virtual ScheduleMultiDim< TABLE > * | clone () const |
| virtual copy constructor | |
| virtual ScheduleMultiDim< TABLE > * | clone (bool force_copy) const |
| virtual copy constructor enabling to force a copy of the content | |
| virtual | ~ScheduleMultiDim () |
| destructor | |
Operators | |
| ScheduleMultiDim< TABLE > & | operator= (const ScheduleMultiDim< TABLE > &from) |
| copy operator | |
| ScheduleMultiDim< TABLE > & | operator= (ScheduleMultiDim< TABLE > &&from) |
| move operator | |
| virtual bool | operator== (const ScheduleMultiDim< TABLE > &) const |
| checks whether two ScheduleMultiDim have exactly the same ID | |
| virtual bool | operator== (const IScheduleMultiDim &) const |
| checks whether two ScheduleMultiDim have the same ID and type | |
| virtual bool | operator!= (const ScheduleMultiDim< TABLE > &) const |
| checks whether two ScheduleMultiDim have different IDs | |
| virtual bool | operator!= (const IScheduleMultiDim &) const |
| checks whether two ScheduleMultiDim have different IDs or types | |
Accessors/Modifiers | |
| virtual bool | hasSameVariables (const IScheduleMultiDim &m) const |
| checks whether two ScheduleMultiDim have the same variables and types | |
| virtual bool | hasSameVariables (const ScheduleMultiDim< TABLE > &m) const |
| checks whether two ScheduleMultiDim have the same variables | |
| virtual bool | hasSameContent (const IScheduleMultiDim &) const |
| checks whether two ScheduleMultiDim contain precisely the same table | |
| virtual bool | hasSameContent (const ScheduleMultiDim< TABLE > &) const |
| checks whether two ScheduleMultiDim contain precisely the same table | |
| bool | isAbstract () const final |
| returns whether the ScheduleMultiDim contains a real table or not | |
| bool | containsMultiDim () const final |
| indicates whether the ScheduleMultiDim contains a table and possesses it | |
| void | makeAbstract () final |
| if the ScheduleMultiDim is not abstract, make it abstract again | |
| TABLE * | exportMultiDim () |
| returns the contained multidimensional table, if any, and make the ScheduleMultiDim abstract | |
| const TABLE & | multiDim () const |
| returns the table actually contained in the ScheduleMultiDim | |
| const Sequence< const DiscreteVariable * > & | variablesSequence () const final |
| returns the set of variables involved in the ScheduleMultiDim | |
| Size | domainSize () const final |
| returns the domain size the table would have after its creation | |
| double | sizeOfContent () const final |
| returns the sizeof of the elements stored into the ScheduleMultiDim | |
| void | setMultiDim (const TABLE &table, const bool copy) |
| assigns a new table inside the wrapper | |
| void | setMultiDim (TABLE &&pot) |
| sets by move a new table inside the wrapper | |
| std::string | toString () const final |
| displays the content of the ScheduleMultiDim | |
Protected Attributes | |
| Idx | id_ |
| the unique Id of the ScheduleMultiDim | |
Private Member Functions | |
| void | _removeTable_ () |
| remove the table if it is contained in the ScheduleMultiDim | |
Static Private Member Functions | |
| static Idx | _newId_ () |
| returns a new distinct ID for each abstract scheduleMultiDim | |
Private Attributes | |
| TABLE * | _table_ {nullptr} |
| the multidimensional table stored into the ScheduleMultiDim | |
| bool | _table_contained_ {true} |
| indicates whether table is contained or referenced | |
| Sequence< const DiscreteVariable * > | _var_sequence_ |
| returns the sequence of variables of the table | |
| Size | _domain_size_ {Size(1)} |
| the domain size of the table | |
Static Private Attributes | |
| static std::atomic< Idx > | _multidim_id_ |
Accessors/Modifiers | |
| Idx | id () const |
| returns the id of the ScheduleMultiDim | |
| static void | resetIdGenerator () |
| reset the id generator to 0 | |
a Wrapper for multi-dimensional tables used for scheduling inferences
A ScheduleMultiDim is a wrapper that contains either a "real" multidmensional table or a nullptr if this table has not been computed yet (by an executor).
Here is a brief piece of code that should highlight the concept:
So, to summarize the key idea underlying Schedule* classes: these classes encapsulate operations to perform and multidim tables that should be passed as argument to these operations. But nothing is actually computed until the execute() methods of the scheduled operators are executed.
Definition at line 118 of file scheduleMultiDim.h.
|
explicit |
constructs a ScheduleMultiDim by copying/referencing table
| table | the multidimensional table that we wish to be contained into the ScheduleMultiDim |
| copy | indicates whether the ScheduleMultiDim should use internally a copy of table or rather if it should just use a reference on an already created table. |
| id | if specified and different from 0, this will be the id of the constructed ScheduleMultiDim, else an Id is automatically provided to the ScheduleMultiDim. |
Referenced by ScheduleMultiDim(), ScheduleMultiDim(), clone(), clone(), hasSameContent(), hasSameVariables(), operator!=(), operator=(), operator=(), and operator==().
|
explicit |
constructs a ScheduleMultiDim by moving a table inside it
| table | the multidimensional table that we wish to be contained into the ScheduleMultiDim |
| id | if specified and different from 0, this will be the id of the constructed ScheduleMultiDim, else an Id is automatically provided to the ScheduleMultiDim. |
|
explicit |
construct a ScheduleMultiDim for a multidimensional table yet to be built
The ScheduleMultiDim created is abstract, i.e., it does not contain a proper multidimensional table yet. However, the variables of the latter need be known to optimize inference processes
| id | if specified and different from 0, this will be the id of the constructed ScheduleMultiDim, else an Id is automatically provided to the ScheduleMultiDim. |
| gum::ScheduleMultiDim< TABLE >::ScheduleMultiDim | ( | const ScheduleMultiDim< TABLE > & | from | ) |
| gum::ScheduleMultiDim< TABLE >::ScheduleMultiDim | ( | ScheduleMultiDim< TABLE > && | from | ) |
|
virtual |
destructor
|
staticprivateinherited |
returns a new distinct ID for each abstract scheduleMultiDim
|
private |
remove the table if it is contained in the ScheduleMultiDim
|
virtual |
virtual copy constructor
Implements gum::IScheduleMultiDim.
References ScheduleMultiDim().
|
virtual |
virtual copy constructor enabling to force a copy of the content
Implements gum::IScheduleMultiDim.
References ScheduleMultiDim().
|
finalvirtual |
indicates whether the ScheduleMultiDim contains a table and possesses it
Non-abstract ScheduleMultiDim can either contain a multidimensional table or they can reference an external table. This method indicates whether we are in the first case (true) or the second case (false) described above.
Implements gum::IScheduleMultiDim.
References containsMultiDim().
Referenced by containsMultiDim().
|
finalvirtual |
returns the domain size the table would have after its creation
Implements gum::IScheduleMultiDim.
References domainSize().
Referenced by domainSize().
| TABLE * gum::ScheduleMultiDim< TABLE >::exportMultiDim | ( | ) |
returns the contained multidimensional table, if any, and make the ScheduleMultiDim abstract
| NullElement | is raised if the ScheduleMultiDim is abstract |
| OperationNotAllowed | is raised if the ScheduleMultiDim does not own (contain) its table |
References exportMultiDim().
Referenced by exportMultiDim().
|
virtual |
checks whether two ScheduleMultiDim contain precisely the same table
By "contain precisely the same table", we mean that the actual tables pointed to by the ScheduleMultiDim are the same (i.e., either they are both not yet allocated but have the same sequences of variables or they have the same content)
Implements gum::IScheduleMultiDim.
References gum::IScheduleMultiDim::IScheduleMultiDim().
|
virtual |
checks whether two ScheduleMultiDim contain precisely the same table
By "contain precisely the same table", we mean that the actual tables pointed to by the ScheduleMultiDim are the same (i.e., either they are both not yet allocated but have the same sequences of variables or they have the same content)
References ScheduleMultiDim().
|
virtual |
checks whether two ScheduleMultiDim have the same variables and types
Method hasSameVariables tests whether two ScheduleMultiDim contain the same sequences of variables. It is weaker than operator== in the sense that we do not check for the ScheduleMultiDim's ID nor for the content of the table stored into the IScheduleMultiDim, if any.
| m | the ScheduleMultiDim with which we test similarity. |
Implements gum::IScheduleMultiDim.
References gum::IScheduleMultiDim::IScheduleMultiDim().
|
virtual |
checks whether two ScheduleMultiDim have the same variables
Method hasSameVariables tests whether two ScheduleMultiDim contain the same sequences of variables. It is weaker than operator== in the sense that we do not check for the ScheduleMultiDim's ID nor for the content of the table stored into the IScheduleMultiDim, if any.
| m | the ScheduleMultiDim with which we test similarity. |
References ScheduleMultiDim().
|
inherited |
returns the id of the ScheduleMultiDim
Each ScheduleMultiDim has an Id that enables to find it easily. This is especially useful when copying schedule trees.
|
finalvirtual |
returns whether the ScheduleMultiDim contains a real table or not
Implements gum::IScheduleMultiDim.
|
finalvirtual |
if the ScheduleMultiDim is not abstract, make it abstract again
When a ScheduleMultiDim contains a multidimensional table, making it abstract is equivalent to freeing the table from memory and saying that the ScheduleMultiDim contains a null pointer. If the ScheduleMultiDim contains only a reference on an external table, then this table is kept untouched, but the ScheduleMultiDim now points toward a null pointer. Of course, if the ScheduleMultiDim was already abstract, then nothing is executed.
Implements gum::IScheduleMultiDim.
References makeAbstract().
Referenced by makeAbstract().
| const TABLE & gum::ScheduleMultiDim< TABLE >::multiDim | ( | ) | const |
returns the table actually contained in the ScheduleMultiDim
| NullElement | exception is thrown if the table does not exist yet (because it has not been computed yet) |
References multiDim().
Referenced by multiDim().
|
virtual |
checks whether two ScheduleMultiDim have different IDs or types
Two ScheduleMultiDim having different IDs should mean that they either contain the different sequences of variables and/or different tables.
Reimplemented from gum::IScheduleMultiDim.
References gum::IScheduleMultiDim::IScheduleMultiDim().
|
virtual |
checks whether two ScheduleMultiDim have different IDs
Two ScheduleMultiDim having different IDs should mean that they either contain the different sequences of variables and/or different tables.
References ScheduleMultiDim().
| ScheduleMultiDim< TABLE > & gum::ScheduleMultiDim< TABLE >::operator= | ( | const ScheduleMultiDim< TABLE > & | from | ) |
| ScheduleMultiDim< TABLE > & gum::ScheduleMultiDim< TABLE >::operator= | ( | ScheduleMultiDim< TABLE > && | from | ) |
|
virtual |
checks whether two ScheduleMultiDim have the same ID and type
Two ScheduleMultiDim having the same ID should imply that they also contain the same sequences of variables and the same tables.
Reimplemented from gum::IScheduleMultiDim.
References gum::IScheduleMultiDim::IScheduleMultiDim().
|
virtual |
checks whether two ScheduleMultiDim have exactly the same ID
Two ScheduleMultiDim having the same ID should imply that they also contain the same sequences of variables and the same tables.
References ScheduleMultiDim().
|
staticinherited |
reset the id generator to 0
This method is essentially useful for performing aGrUM's testunits (depending on the order in which they are executed, the results could be difficult to predict without ensuring that, at the beginning of a testunit, the id of the first ScheduleMultiDim is always 1).
| void gum::ScheduleMultiDim< TABLE >::setMultiDim | ( | const TABLE & | table, |
| const bool | copy ) |
assigns a new table inside the wrapper
| table | the multidimensional table that we wish to be contained into the ScheduleMultiDim |
| copy | indicates whether the ScheduleMultiDim should use internally a copy of table or rather if it should just use a reference on table |
References setMultiDim().
Referenced by setMultiDim(), and setMultiDim().
| void gum::ScheduleMultiDim< TABLE >::setMultiDim | ( | TABLE && | pot | ) |
sets by move a new table inside the wrapper
References setMultiDim().
|
finalvirtual |
returns the sizeof of the elements stored into the ScheduleMultiDim
This method is useful for determining schedules' memory usage: this is actually equal to the number of elements times the sizeof of these elements. The goal of sizeOfContent is to return this sizeof
Implements gum::IScheduleMultiDim.
References sizeOfContent().
Referenced by sizeOfContent().
|
finalvirtual |
displays the content of the ScheduleMultiDim
Implements gum::IScheduleMultiDim.
References toString().
Referenced by toString().
|
finalvirtual |
returns the set of variables involved in the ScheduleMultiDim
Implements gum::IScheduleMultiDim.
References variablesSequence().
Referenced by variablesSequence().
|
private |
|
staticprivateinherited |
Definition at line 208 of file IScheduleMultiDim.h.
|
private |
the multidimensional table stored into the ScheduleMultiDim
Definition at line 314 of file scheduleMultiDim.h.
|
private |
indicates whether table is contained or referenced
Definition at line 317 of file scheduleMultiDim.h.
|
private |
returns the sequence of variables of the table
Definition at line 320 of file scheduleMultiDim.h.
|
protectedinherited |
the unique Id of the ScheduleMultiDim
Definition at line 200 of file IScheduleMultiDim.h.