![]() |
aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
|
Decorator design pattern in order to separate implementations from multidimensional matrix concepts. More...
#include <agrum/base/multidim/multiDimDecorator.h>
Public Member Functions | |
Constructors / Destructors | |
| MultiDimDecorator (MultiDimImplementation< GUM_SCALAR > *aContent=nullptr, GUM_SCALAR empty_value=(GUM_SCALAR) 0) | |
| Class constructor. | |
| MultiDimDecorator (const MultiDimDecorator< GUM_SCALAR > &from) | |
| copy constructor & assignment | |
| MultiDimDecorator< GUM_SCALAR > & | operator= (const MultiDimDecorator &from) noexcept |
| copy operator | |
| MultiDimDecorator (MultiDimDecorator< GUM_SCALAR > &&) noexcept | |
| Class move constructor. | |
| MultiDimDecorator< GUM_SCALAR > & | operator= (MultiDimDecorator &&from) |
| assignment operator. | |
| ~MultiDimDecorator () | |
| Class destructor. | |
MultiDimInterface implementation | |
| virtual Idx | nbrDim () const final |
| Returns the number of vars in the multidimensional container. | |
| virtual Size | domainSize () const final |
| Returns the product of the variables domain size. | |
| virtual void | add (const DiscreteVariable &v) final |
| Adds a new var to the variables of the multidimensional matrix. | |
| virtual void | erase (const DiscreteVariable &var) final |
| Removes a var from the variables of the multidimensional matrix. | |
| virtual void | erase (const std::string &name) final |
| virtual const Sequence< const DiscreteVariable * > & | variablesSequence () const final |
| Returns a const ref to the sequence of DiscreteVariable*. | |
| virtual const DiscreteVariable & | variable (Idx) const final |
| Returns a const ref to the ith var. | |
| virtual const DiscreteVariable & | variable (const std::string &name) const final |
| Returns the variable with the name. | |
| virtual Idx | pos (const DiscreteVariable &var) const final |
| Returns the index of a variable. | |
| virtual bool | contains (const DiscreteVariable &var) const final |
| Returns true if var is in *this. | |
| virtual bool | empty () const final |
| Returns true if no var is in *this. | |
MultiDimAddressable implementation | |
| virtual bool | unregisterSlave (Instantiation &i) final |
| Unregister i as a slave of this MultiDimAdressable. | |
| virtual bool | registerSlave (Instantiation &i) final |
| Register i as a slave of this MultiDimAdressable. | |
| virtual void | changeNotification (const Instantiation &i, const DiscreteVariable *const var, Idx oldval, Idx newval) final |
| Listen to changes in a given Instantiation. | |
| virtual void | setChangeNotification (const Instantiation &i) final |
| Listen to an assignment of a value in a Instantiation. | |
| virtual void | setFirstNotification (const Instantiation &i) final |
| Listen to setFirst in a given Instantiation. | |
| virtual void | setLastNotification (const Instantiation &i) final |
| Listen to setLast in a given Instantiation. | |
| virtual void | setIncNotification (const Instantiation &i) final |
| Listen to increment in a given Instantiation. | |
| virtual void | setDecNotification (const Instantiation &i) final |
| Listen to increment in each recorded Instantiation. | |
| virtual void | notifyChange () const final |
MultiDimContainer implementation | |
| virtual void | set (const Instantiation &i, const GUM_SCALAR &value) const final |
| Default implementation of MultiDimContainer::set(). | |
| virtual GUM_SCALAR | get (const Instantiation &i) const final |
| Default implementation of MultiDimContainer::get(). | |
| virtual void | fill (const GUM_SCALAR &d) const final |
| Default implementation of MultiDimContainer::set(). | |
| virtual void | populate (const std::vector< GUM_SCALAR > &v) const final |
| Automatically fills this MultiDimContainer with the values in v. | |
| virtual void | apply (std::function< GUM_SCALAR(GUM_SCALAR) > f) const final |
| Apply a function on every element of the container. | |
| virtual GUM_SCALAR | reduce (std::function< GUM_SCALAR(GUM_SCALAR, GUM_SCALAR) > f, GUM_SCALAR base) const final |
| compute lfold for this container | |
| virtual MultiDimDecorator< GUM_SCALAR > * | newFactory () const =0 |
| Default implementation of MultiDimContainer::set(). | |
| virtual void | beginMultipleChanges () final |
| Default implementation of MultiDimContainer::set(). | |
| virtual void | endMultipleChanges () final |
| Default implementation of MultiDimContainer::set(). | |
| virtual void | endMultipleChanges (const GUM_SCALAR &) final |
| Default implementation of MultiDimContainer::set(). | |
| virtual std::string | toString (const Instantiation *i) const |
| Default implementation of MultiDimContainer::set(). | |
| virtual std::string | toString () const |
| Default implementation of MultiDimContainer::set(). | |
Various methods. | |
| virtual const MultiDimImplementation< GUM_SCALAR > * | content () const final |
| Returns the implementation for this object (may be *this). | |
| virtual MultiDimImplementation< GUM_SCALAR > * | content () final |
| Returns the implementation for this object (may be *this). | |
Accessors / Modifiers | |
| GUM_SCALAR | operator[] (const Instantiation &i) const |
| An [] operator using a Instantiation as argument. | |
| virtual void | populate (std::initializer_list< GUM_SCALAR > l) const |
| Automatically fills this MultiDimContainer with the values in l. | |
Copy methods. | |
| virtual void | copyFrom (const MultiDimContainer< GUM_SCALAR > &src) const |
| Basic copy of a MultiDimContainer. | |
| virtual void | copyFrom (const MultiDimContainer< GUM_SCALAR > &src, Instantiation *p_i) const |
| Basic copy of a MultiDimContainer. | |
| virtual void | extractFrom (const MultiDimContainer< GUM_SCALAR > &src, const Instantiation &mask) |
| Basic extraction of a MultiDimContainer. | |
| virtual MultiDimAdressable & | getMasterRef () |
| In order to insure the dereference for decorators, we need to virtualize the access to master pointer. | |
| virtual const MultiDimAdressable & | getMasterRef () const |
| In order to insure the dereference for decorators, we need to virtualize the access to master pointer. | |
| virtual void | copy (const MultiDimContainer< GUM_SCALAR > &src) |
| Removes all variables in this MultiDimContainer and copy the content of src, variables included. | |
Various methods. | |
| bool | operator== (const MultiDimContainer< GUM_SCALAR > &p) const |
| Test if this MultiDimContainer is equal to p. | |
| bool | operator!= (const MultiDimContainer< GUM_SCALAR > &p) const |
| Test if this MultiDimContainer is different of p. | |
Accessors / Modifiers | |
| void | replace (const DiscreteVariable &x, const DiscreteVariable &y) |
| Replace variables in this multidim. | |
Protected Member Functions | |
| virtual void | replace_ (const DiscreteVariable *x, const DiscreteVariable *y) |
| This is called by MultiDimContainer::replace() to proceed with the replacing between x and y. | |
| void | swapContent_ (MultiDimImplementation< GUM_SCALAR > *aContent) const |
| protected method to swap the implementation behind the Tensor | |
| GUM_SCALAR & | get_ (const Instantiation &i) const final |
| Return a data, given a Instantiation - final method. | |
Protected Attributes | |
| MultiDimImplementation< GUM_SCALAR > * | content_ |
| The true container. | |
| GUM_SCALAR | empty_value_ |
| value of the MultiDimDecorator if no dimension. | |
Decorator design pattern in order to separate implementations from multidimensional matrix concepts.
A MultiDimDecorator is a virtual class for all encapsulation of MultiDimImplementation, for example probability, utility, etc. It implements a decorator design pattern in order to have a array, tree, sparse or matrix (...) implementation of MultiDimImplementation.
| GUM_SCALAR | The type of the scalar stored in this multidimensional matrix. |
Definition at line 81 of file multiDimDecorator.h.
| INLINE gum::MultiDimDecorator< GUM_SCALAR >::MultiDimDecorator | ( | MultiDimImplementation< GUM_SCALAR > * | aContent = nullptr, |
| GUM_SCALAR | empty_value = (GUM_SCALAR)0 ) |
Class constructor.
| aContent | The implementation used by this MultiDimDecorator. |
Definition at line 86 of file multiDimDecorator_tpl.h.
References MultiDimDecorator(), gum::_initTensorOperators__(), content_, and empty_value_.
Referenced by MultiDimDecorator(), MultiDimDecorator(), MultiDimDecorator(), gum::Tensor< GUM_SCALAR >::Tensor(), gum::Tensor< GUM_SCALAR >::Tensor(), gum::Tensor< GUM_SCALAR >::Tensor(), gum::Tensor< GUM_SCALAR >::Tensor(), ~MultiDimDecorator(), newFactory(), operator=(), operator=(), and gum::Tensor< GUM_SCALAR >::operator=().
| INLINE gum::MultiDimDecorator< GUM_SCALAR >::MultiDimDecorator | ( | const MultiDimDecorator< GUM_SCALAR > & | from | ) |
copy constructor & assignment
Definition at line 94 of file multiDimDecorator_tpl.h.
References gum::MultiDimContainer< GUM_SCALAR >::MultiDimContainer(), MultiDimDecorator(), gum::_initTensorOperators__(), content(), and empty_value_.
|
noexcept |
Class move constructor.
Definition at line 120 of file multiDimDecorator_tpl.h.
References gum::MultiDimContainer< GUM_SCALAR >::MultiDimContainer(), MultiDimDecorator(), content_, and empty_value_.
| INLINE gum::MultiDimDecorator< GUM_SCALAR >::~MultiDimDecorator | ( | ) |
Class destructor.
Definition at line 146 of file multiDimDecorator_tpl.h.
References MultiDimDecorator(), and content_.
|
finalvirtual |
Adds a new var to the variables of the multidimensional matrix.
| v | The new var. |
| DuplicateElement | Raised if the variable already belongs to the sequence of variables. |
| OperationNotAllowed | Raised if this object is non mutable. |
Implements gum::MultiDimInterface.
Definition at line 188 of file multiDimDecorator_tpl.h.
References gum::MultiDimContainer< GUM_SCALAR >::MultiDimContainer(), add(), content_, gum::DiscreteVariable::domainSize(), and GUM_ERROR.
Referenced by gum::Tensor< GUM_SCALAR >::Tensor(), gum::Tensor< GUM_SCALAR >::Tensor(), add(), gum::Tensor< GUM_SCALAR >::evEq(), gum::Tensor< GUM_SCALAR >::evGt(), gum::Tensor< GUM_SCALAR >::evIn(), and gum::Tensor< GUM_SCALAR >::evLt().
|
finalvirtual |
Apply a function on every element of the container.
| f | the function to apply |
Reimplemented from gum::MultiDimContainer< GUM_SCALAR >.
Definition at line 338 of file multiDimDecorator_tpl.h.
References gum::MultiDimContainer< GUM_SCALAR >::MultiDimContainer(), content_, empty(), and empty_value_.
Referenced by gum::Tensor< GUM_SCALAR >::abs(), gum::Tensor< GUM_SCALAR >::inverse(), gum::Tensor< GUM_SCALAR >::log2(), gum::Tensor< GUM_SCALAR >::normalize(), gum::Tensor< GUM_SCALAR >::scale(), gum::Tensor< GUM_SCALAR >::sgn(), gum::Tensor< GUM_SCALAR >::sq(), and gum::Tensor< GUM_SCALAR >::translate().
|
finalvirtual |
Default implementation of MultiDimContainer::set().
Calls get_ as a r-value.
Implements gum::MultiDimContainer< GUM_SCALAR >.
Definition at line 371 of file multiDimDecorator_tpl.h.
References gum::MultiDimContainer< GUM_SCALAR >::MultiDimContainer(), beginMultipleChanges(), and content_.
Referenced by gum::Tensor< GUM_SCALAR >::Tensor(), and beginMultipleChanges().
|
finalvirtual |
Listen to changes in a given Instantiation.
| i | The Instantiation to listen. |
| var | The changed dim. |
| oldval | The old value. |
| newval | The changed value. |
Implements gum::MultiDimAdressable.
Definition at line 198 of file multiDimDecorator_tpl.h.
References gum::MultiDimContainer< GUM_SCALAR >::MultiDimContainer(), changeNotification(), and content_.
Referenced by changeNotification().
|
finalvirtual |
Returns true if var is in *this.
| v | A DiscreteVariable. |
Implements gum::MultiDimInterface.
Definition at line 277 of file multiDimDecorator_tpl.h.
References gum::MultiDimContainer< GUM_SCALAR >::MultiDimContainer(), contains(), and content_.
Referenced by contains(), gum::Tensor< GUM_SCALAR >::KL(), gum::Tensor< GUM_SCALAR >::putFirst(), and gum::Tensor< GUM_SCALAR >::reorganize().
|
finalvirtual |
Returns the implementation for this object (may be *this).
Implements gum::MultiDimContainer< GUM_SCALAR >.
Definition at line 366 of file multiDimDecorator_tpl.h.
References content_.
Referenced by MultiDimDecorator(), gum::Tensor< GUM_SCALAR >::Tensor(), gum::Tensor< GUM_SCALAR >::Tensor(), gum::Tensor< GUM_SCALAR >::max(), gum::Tensor< GUM_SCALAR >::maxIn(), gum::Tensor< GUM_SCALAR >::maxOut(), gum::Tensor< GUM_SCALAR >::memoryFootprint(), gum::Tensor< GUM_SCALAR >::min(), gum::Tensor< GUM_SCALAR >::minIn(), gum::Tensor< GUM_SCALAR >::minOut(), newFactory(), gum::Tensor< GUM_SCALAR >::newFactory(), gum::Tensor< GUM_SCALAR >::operator*(), gum::Tensor< GUM_SCALAR >::operator+(), gum::Tensor< GUM_SCALAR >::operator-(), gum::Tensor< GUM_SCALAR >::operator/(), operator=(), gum::Tensor< GUM_SCALAR >::prodIn(), gum::Tensor< GUM_SCALAR >::prodOut(), gum::Tensor< GUM_SCALAR >::product(), replace_(), gum::Tensor< GUM_SCALAR >::sum(), gum::Tensor< GUM_SCALAR >::sumIn(), gum::Tensor< GUM_SCALAR >::sumOut(), and gum::Tensor< GUM_SCALAR >::toString().
|
finalvirtual |
Returns the implementation for this object (may be *this).
Implements gum::MultiDimContainer< GUM_SCALAR >.
Definition at line 359 of file multiDimDecorator_tpl.h.
References content_.
|
virtualinherited |
Removes all variables in this MultiDimContainer and copy the content of src, variables included.
| src | The MultiDimContainer to copy. |
Reimplemented in gum::MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy >, gum::MultiDimFunctionGraph< bool >, gum::MultiDimFunctionGraph< bool, ExactTerminalNodePolicy >, gum::MultiDimFunctionGraph< double >, gum::MultiDimFunctionGraph< double, ExactTerminalNodePolicy >, gum::MultiDimFunctionGraph< gum::ActionSet, gum::SetTerminalNodePolicy >, gum::MultiDimFunctionGraph< GUM_SCALAR, ExactTerminalNodePolicy >, gum::MultiDimFunctionGraph< Size >, and gum::MultiDimFunctionGraph< Size, ExactTerminalNodePolicy >.
Definition at line 288 of file multiDimContainer_tpl.h.
References MultiDimContainer(), beginMultipleChanges(), gum::MultiDimInterface::erase(), gum::MultiDimInterface::nbrDim(), and gum::MultiDimInterface::variable().
Referenced by gum::TreeRegress< GUM_SCALAR, COMBINEOPERATOR, PROJECTOPERATOR, TerminalNodePolicy >::compute().
|
virtualinherited |
Basic copy of a MultiDimContainer.
This method is virtual because it should be optimized in certain MultiDimContainer.
| src | The MultiDimContainer src which values are copied. This is a full copy with no verification of dimensions. |
| OperationNotAllowed | Raised if src does not have the same domain size than this MultiDimContainer. |
Reimplemented in gum::aggregator::MultiDimAggregator< GUM_SCALAR >, gum::MultiDimArray< GUM_SCALAR >, and gum::MultiDimICIModel< GUM_SCALAR >.
Definition at line 271 of file multiDimContainer_tpl.h.
References MultiDimContainer(), gum::MultiDimInterface::domainSize(), and GUM_ERROR.
Referenced by gum::aggregator::MultiDimAggregator< GUM_SCALAR >::copyFrom(), gum::MultiDimArray< GUM_SCALAR >::copyFrom(), and gum::MultiDimICIModel< GUM_SCALAR >::copyFrom().
|
virtualinherited |
Basic copy of a MultiDimContainer.
This method is virtual because it should be optimized in certain MultiDimContainer.
| src | The MultiDimContainer src which values are copied. |
| p_i | Give the order to iterate in this MultiDimContainer during the copy (nullptr will correctly copy if this is a reorganization of src). |
| OperationNotAllowed | Raised if src does not have the same domain size than this MultiDimContainer. |
Reimplemented in gum::MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy >, and gum::MultiDimFunctionGraph< GUM_SCALAR, ExactTerminalNodePolicy >.
Definition at line 225 of file multiDimContainer_tpl.h.
References MultiDimContainer(), gum::MultiDimInterface::domainSize(), and GUM_ERROR.
|
finalvirtual |
Returns the product of the variables domain size.
Implements gum::MultiDimInterface.
Definition at line 181 of file multiDimDecorator_tpl.h.
References gum::MultiDimContainer< GUM_SCALAR >::MultiDimContainer(), content_, and domainSize().
Referenced by domainSize(), gum::SimpleUTGenerator::generateUT(), gum::SimpleUTGenerator::generateUT(), gum::InfluenceDiagram< GUM_SCALAR >::operator==(), gum::Tensor< GUM_SCALAR >::random(), gum::Tensor< GUM_SCALAR >::randomCPT(), and gum::Tensor< GUM_SCALAR >::randomDistribution().
|
finalvirtual |
Returns true if no var is in *this.
Implements gum::MultiDimInterface.
Definition at line 282 of file multiDimDecorator_tpl.h.
References gum::MultiDimContainer< GUM_SCALAR >::MultiDimContainer(), content_, and empty().
Referenced by apply(), empty(), gum::Tensor< GUM_SCALAR >::expectedValue(), fill(), get(), gum::Tensor< GUM_SCALAR >::max(), gum::Tensor< GUM_SCALAR >::maxIn(), gum::Tensor< GUM_SCALAR >::maxNonOne(), gum::Tensor< GUM_SCALAR >::maxOut(), gum::Tensor< GUM_SCALAR >::min(), gum::Tensor< GUM_SCALAR >::minIn(), gum::Tensor< GUM_SCALAR >::minNonZero(), gum::Tensor< GUM_SCALAR >::minOut(), gum::Tensor< GUM_SCALAR >::normalize(), gum::Tensor< GUM_SCALAR >::normalizeAsCPT(), gum::Tensor< GUM_SCALAR >::operator*(), gum::Tensor< GUM_SCALAR >::operator+(), gum::Tensor< GUM_SCALAR >::operator-(), gum::Tensor< GUM_SCALAR >::operator/(), gum::Tensor< GUM_SCALAR >::operator==(), populate(), gum::Tensor< GUM_SCALAR >::prodIn(), gum::Tensor< GUM_SCALAR >::prodOut(), gum::Tensor< GUM_SCALAR >::product(), reduce(), gum::Tensor< GUM_SCALAR >::sum(), gum::Tensor< GUM_SCALAR >::sumIn(), gum::Tensor< GUM_SCALAR >::sumOut(), and toString().
|
finalvirtual |
Default implementation of MultiDimContainer::set().
Calls get_ as a r-value.
Implements gum::MultiDimContainer< GUM_SCALAR >.
Definition at line 376 of file multiDimDecorator_tpl.h.
References gum::MultiDimContainer< GUM_SCALAR >::MultiDimContainer(), content_, and endMultipleChanges().
Referenced by gum::Tensor< GUM_SCALAR >::Tensor(), endMultipleChanges(), endMultipleChanges(), and newFactory().
|
finalvirtual |
Default implementation of MultiDimContainer::set().
Calls get_ as a r-value.
Implements gum::MultiDimContainer< GUM_SCALAR >.
Definition at line 381 of file multiDimDecorator_tpl.h.
References gum::MultiDimContainer< GUM_SCALAR >::MultiDimContainer(), content_, and endMultipleChanges().
|
finalvirtual |
Removes a var from the variables of the multidimensional matrix.
| OperationNotAllowed | Raised if this object is non mutable. |
| NotFound | Raised if v does not belong to this. |
Implements gum::MultiDimInterface.
Definition at line 251 of file multiDimDecorator_tpl.h.
References gum::MultiDimContainer< GUM_SCALAR >::MultiDimContainer(), content_, and erase().
Referenced by erase(), and erase().
|
finalvirtual |
Definition at line 256 of file multiDimDecorator_tpl.h.
References erase(), and variable().
|
virtualinherited |
Basic extraction of a MultiDimContainer.
This method is virtual because it should be optimized in certain MultiDimContainer.
| src | The MultiDimContainer src which datas are copied. |
| mask | partial instantiation of variables of the Tensor : the |
extraction will concern every variable not in the instantiation and the copy of data will use the (relevant) values in this instantiation.
Definition at line 247 of file multiDimContainer_tpl.h.
References MultiDimContainer(), and beginMultipleChanges().
|
finalvirtual |
Default implementation of MultiDimContainer::set().
Calls get_ as a r-value.
Implements gum::MultiDimContainer< GUM_SCALAR >.
Definition at line 293 of file multiDimDecorator_tpl.h.
References gum::MultiDimContainer< GUM_SCALAR >::MultiDimContainer(), content_, empty(), empty_value_, and fill().
Referenced by fill(), and gum::Tensor< GUM_SCALAR >::fillWith().
|
finalvirtual |
Default implementation of MultiDimContainer::get().
Calls get_ as a l-value.
Reimplemented from gum::MultiDimContainer< GUM_SCALAR >.
Definition at line 160 of file multiDimDecorator_tpl.h.
References gum::MultiDimContainer< GUM_SCALAR >::MultiDimContainer(), content_, empty(), empty_value_, and get().
Referenced by gum::Tensor< GUM_SCALAR >::draw(), gum::Tensor< GUM_SCALAR >::entropy(), gum::Tensor< GUM_SCALAR >::expectedValue(), gum::Tensor< GUM_SCALAR >::findAll(), get(), gum::Tensor< GUM_SCALAR >::KL(), gum::Tensor< GUM_SCALAR >::normalizeAsCPT(), gum::InfluenceDiagram< GUM_SCALAR >::operator==(), gum::prm::o3prmr::O3prmrInterpreter::query(), and gum::Tensor< GUM_SCALAR >::toString().
|
finalprotectedvirtual |
Return a data, given a Instantiation - final method.
| i | The instantiation. |
| NullElement | |
| NotFound |
Implements gum::MultiDimContainer< GUM_SCALAR >.
Definition at line 155 of file multiDimDecorator_tpl.h.
References GUM_ERROR.
|
virtualinherited |
In order to insure the dereference for decorators, we need to virtualize the access to master pointer.
Implements gum::MultiDimAdressable.
Reimplemented in gum::MultiDimBucket< GUM_SCALAR >.
Definition at line 306 of file multiDimContainer_tpl.h.
References gum::MultiDimAdressable::MultiDimAdressable(), and content().
|
virtualinherited |
In order to insure the dereference for decorators, we need to virtualize the access to master pointer.
Implements gum::MultiDimAdressable.
Reimplemented in gum::MultiDimBucket< GUM_SCALAR >.
Definition at line 311 of file multiDimContainer_tpl.h.
References gum::MultiDimAdressable::MultiDimAdressable(), and content().
|
finalvirtual |
Returns the number of vars in the multidimensional container.
Implements gum::MultiDimInterface.
Definition at line 320 of file multiDimDecorator_tpl.h.
References gum::MultiDimContainer< GUM_SCALAR >::MultiDimContainer(), content_, and nbrDim().
Referenced by gum::GibbsOperator< GUM_SCALAR >::_GibbsSample_(), gum::Tensor< GUM_SCALAR >::draw(), gum::Tensor< GUM_SCALAR >::fillWith(), gum::Tensor< GUM_SCALAR >::isEvidence(), gum::Tensor< GUM_SCALAR >::KL(), nbrDim(), gum::Tensor< GUM_SCALAR >::normalizeAsCPT(), gum::InfluenceDiagram< GUM_SCALAR >::operator==(), gum::Tensor< GUM_SCALAR >::putFirst(), gum::Tensor< GUM_SCALAR >::putFirst(), gum::Tensor< GUM_SCALAR >::reorganize(), and set().
|
pure virtual |
Default implementation of MultiDimContainer::set().
Calls get_ as a r-value.
Implements gum::MultiDimContainer< GUM_SCALAR >.
Implemented in gum::Tensor< GUM_SCALAR >.
References MultiDimDecorator(), content(), endMultipleChanges(), replace_(), swapContent_(), and toString().
Referenced by operator=().
|
finalvirtual |
Definition at line 304 of file multiDimDecorator_tpl.h.
References GUM_ERROR.
|
inherited |
Test if this MultiDimContainer is different of p.
| p | The MultiDimContainer to test for inequality. |
Definition at line 171 of file multiDimContainer_tpl.h.
References MultiDimContainer().
|
noexcept |
copy operator
Definition at line 131 of file multiDimDecorator_tpl.h.
References MultiDimDecorator(), gum::_initTensorOperators__(), content(), content_, empty_value_, newFactory(), and gum::MultiDimContainer< GUM_SCALAR >::operator=().
Referenced by gum::Tensor< GUM_SCALAR >::operator=(), and gum::Tensor< GUM_SCALAR >::operator=().
| INLINE MultiDimDecorator< GUM_SCALAR > & gum::MultiDimDecorator< GUM_SCALAR >::operator= | ( | MultiDimDecorator< GUM_SCALAR > && | from | ) |
assignment operator.
Definition at line 104 of file multiDimDecorator_tpl.h.
References gum::MultiDimContainer< GUM_SCALAR >::MultiDimContainer(), MultiDimDecorator(), content_, empty_value_, and gum::MultiDimContainer< GUM_SCALAR >::operator=().
|
inherited |
Test if this MultiDimContainer is equal to p.
| p | The MultiDimContainer to test for equality. |
Definition at line 146 of file multiDimContainer_tpl.h.
References MultiDimContainer(), gum::MultiDimInterface::domainSize(), gum::MultiDimInterface::nbrDim(), and gum::MultiDimInterface::variablesSequence().
|
inherited |
An [] operator using a Instantiation as argument.
| i | An Instantiation. |
Definition at line 101 of file multiDimContainer_tpl.h.
References get().
|
virtualinherited |
Automatically fills this MultiDimContainer with the values in l.
The order used to fill this MultiDimContainer is the same as with an instantiation over it.
| l | contains the data. |
| SizeError | Raised if l size's does not matches this MultiDimContainer domain size. |
Reimplemented in gum::MultiDimBijArray< GUM_SCALAR >, and gum::MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy >.
Definition at line 191 of file multiDimContainer_tpl.h.
References gum::MultiDimInterface::domainSize(), GUM_ERROR, and set().
|
finalvirtual |
Automatically fills this MultiDimContainer with the values in v.
The order used to fill this MultiDimContainer is the same as with an instantiation over it.
| v | Vector of values. |
| SizeError | Raised if v size's does not matches this MultiDimContainer domain size. |
Reimplemented from gum::MultiDimContainer< GUM_SCALAR >.
Definition at line 325 of file multiDimDecorator_tpl.h.
References gum::MultiDimContainer< GUM_SCALAR >::MultiDimContainer(), content_, empty(), empty_value_, and GUM_ERROR.
Referenced by gum::Tensor< GUM_SCALAR >::fillWith(), gum::SimpleUTGenerator::generateUT(), and gum::SimpleUTGenerator::generateUT().
|
finalvirtual |
Returns the index of a variable.
| v | The variable for which the index is returned. |
| NotFound | Raised if v is not in this multidimensional matrix. |
Implements gum::MultiDimInterface.
Definition at line 272 of file multiDimDecorator_tpl.h.
References gum::MultiDimContainer< GUM_SCALAR >::MultiDimContainer(), content_, and pos().
Referenced by pos().
|
finalvirtual |
compute lfold for this container
| f | the function to apply |
| base | the initial value |
Reimplemented from gum::MultiDimContainer< GUM_SCALAR >.
Definition at line 348 of file multiDimDecorator_tpl.h.
References gum::MultiDimContainer< GUM_SCALAR >::MultiDimContainer(), content_, and empty().
Referenced by gum::Tensor< GUM_SCALAR >::maxNonOne(), and gum::Tensor< GUM_SCALAR >::minNonZero().
|
finalvirtual |
Register i as a slave of this MultiDimAdressable.
| i | The Instantiation to enslave. |
Implements gum::MultiDimAdressable.
Definition at line 246 of file multiDimDecorator_tpl.h.
References gum::MultiDimContainer< GUM_SCALAR >::MultiDimContainer(), content_, and registerSlave().
Referenced by registerSlave().
|
inherited |
Replace variables in this multidim.
If x is in this MultiDim and y has the same domain size, then x will be replace by y in this MultiDim.
| x | The variable in this which will be replaced. |
| y | The variable replacing y. |
| NotFound | Raised if x does not belong to this MultiDim. |
| OperationNotAllowed | If y and x are not interchangeable. |
| DuplicateElement | If y is already in this MultiDim. |
Definition at line 56 of file multiDimInterface_inl.h.
References contains(), gum::DiscreteVariable::domainSize(), GUM_ERROR, and replace_().
|
protectedvirtual |
This is called by MultiDimContainer::replace() to proceed with the replacing between x and y.
This is called only when everything have been checked.
| x | The variable to replace in |
| y | The second variable to swap. |
Implements gum::MultiDimInterface.
Definition at line 405 of file multiDimDecorator_tpl.h.
References content().
Referenced by newFactory().
|
finalvirtual |
Default implementation of MultiDimContainer::set().
Calls get_ as a r-value.
Reimplemented from gum::MultiDimContainer< GUM_SCALAR >.
Definition at line 169 of file multiDimDecorator_tpl.h.
References gum::MultiDimContainer< GUM_SCALAR >::MultiDimContainer(), content_, empty_value_, nbrDim(), and set().
Referenced by gum::Tensor< GUM_SCALAR >::evEq(), gum::Tensor< GUM_SCALAR >::evGt(), gum::Tensor< GUM_SCALAR >::evIn(), gum::Tensor< GUM_SCALAR >::evLt(), gum::Tensor< GUM_SCALAR >::fillWith(), gum::Tensor< GUM_SCALAR >::fillWith(), gum::Tensor< GUM_SCALAR >::normalizeAsCPT(), gum::Tensor< GUM_SCALAR >::randomCPT(), and set().
|
finalvirtual |
Listen to an assignment of a value in a Instantiation.
| i | The Instantiation to listen. |
Implements gum::MultiDimAdressable.
Definition at line 211 of file multiDimDecorator_tpl.h.
References gum::MultiDimContainer< GUM_SCALAR >::MultiDimContainer(), content_, and setChangeNotification().
Referenced by setChangeNotification().
|
finalvirtual |
Listen to increment in each recorded Instantiation.
| i | The Instantiation to listen. |
Implements gum::MultiDimAdressable.
Definition at line 239 of file multiDimDecorator_tpl.h.
References gum::MultiDimContainer< GUM_SCALAR >::MultiDimContainer(), content_, and setDecNotification().
Referenced by setDecNotification().
|
finalvirtual |
Listen to setFirst in a given Instantiation.
| i | The Instantiation to listen. |
Implements gum::MultiDimAdressable.
Definition at line 218 of file multiDimDecorator_tpl.h.
References gum::MultiDimContainer< GUM_SCALAR >::MultiDimContainer(), content_, and setFirstNotification().
Referenced by setFirstNotification().
|
finalvirtual |
Listen to increment in a given Instantiation.
| i | The Instantiation to listen. |
Implements gum::MultiDimAdressable.
Definition at line 232 of file multiDimDecorator_tpl.h.
References gum::MultiDimContainer< GUM_SCALAR >::MultiDimContainer(), content_, and setIncNotification().
Referenced by setIncNotification().
|
finalvirtual |
Listen to setLast in a given Instantiation.
| i | The Instantiation to listen. |
Implements gum::MultiDimAdressable.
Definition at line 225 of file multiDimDecorator_tpl.h.
References gum::MultiDimContainer< GUM_SCALAR >::MultiDimContainer(), content_, and setLastNotification().
Referenced by setLastNotification().
|
protected |
protected method to swap the implementation behind the Tensor
Definition at line 386 of file multiDimDecorator_tpl.h.
References content_.
Referenced by newFactory().
|
virtual |
Default implementation of MultiDimContainer::set().
Calls get_ as a r-value.
Reimplemented from gum::MultiDimContainer< GUM_SCALAR >.
Reimplemented in gum::Tensor< GUM_SCALAR >.
Definition at line 411 of file multiDimDecorator_tpl.h.
References gum::MultiDimContainer< GUM_SCALAR >::MultiDimContainer(), content_, empty(), and empty_value_.
|
virtual |
Default implementation of MultiDimContainer::set().
Calls get_ as a r-value.
Implements gum::MultiDimContainer< GUM_SCALAR >.
Definition at line 400 of file multiDimDecorator_tpl.h.
References content_.
Referenced by newFactory().
|
finalvirtual |
Unregister i as a slave of this MultiDimAdressable.
| i | The Instantiation to free. |
Implements gum::MultiDimAdressable.
Definition at line 288 of file multiDimDecorator_tpl.h.
References gum::MultiDimContainer< GUM_SCALAR >::MultiDimContainer(), content_, and unregisterSlave().
Referenced by unregisterSlave().
|
finalvirtual |
Returns the variable with the name.
| name | The index of the variable |
| NotFound | Raised if the element cannot be found. |
Implements gum::MultiDimInterface.
Definition at line 267 of file multiDimDecorator_tpl.h.
References gum::MultiDimContainer< GUM_SCALAR >::MultiDimContainer(), content_, and variable().
|
finalvirtual |
Returns a const ref to the ith var.
param i An index of this multidimensional matrix.
| NotFound | Raised if i does not reference a variable in this multidimensional matrix. |
Implements gum::MultiDimInterface.
Definition at line 261 of file multiDimDecorator_tpl.h.
References gum::MultiDimContainer< GUM_SCALAR >::MultiDimContainer(), content_, and variable().
Referenced by gum::Tensor< GUM_SCALAR >::draw(), erase(), gum::Tensor< GUM_SCALAR >::fillWith(), gum::Tensor< GUM_SCALAR >::normalizeAsCPT(), gum::Tensor< GUM_SCALAR >::operator&(), gum::Tensor< GUM_SCALAR >::operator|(), gum::Tensor< GUM_SCALAR >::putFirst(), gum::Tensor< GUM_SCALAR >::putFirst(), gum::Tensor< GUM_SCALAR >::randomCPT(), variable(), and variable().
|
finalvirtual |
Returns a const ref to the sequence of DiscreteVariable*.
Implements gum::MultiDimInterface.
Definition at line 313 of file multiDimDecorator_tpl.h.
References gum::MultiDimContainer< GUM_SCALAR >::MultiDimContainer(), content_, and variablesSequence().
Referenced by gum::Tensor< GUM_SCALAR >::complementVars_(), gum::learning::DAG2BNLearner::createBNwithEM(), gum::Tensor< GUM_SCALAR >::fillWith(), gum::Tensor< GUM_SCALAR >::KL(), gum::Tensor< GUM_SCALAR >::maxOut(), gum::Tensor< GUM_SCALAR >::minOut(), gum::Tensor< GUM_SCALAR >::prodOut(), gum::Tensor< GUM_SCALAR >::sumOut(), and variablesSequence().
|
mutableprotected |
The true container.
Definition at line 271 of file multiDimDecorator.h.
Referenced by MultiDimDecorator(), MultiDimDecorator(), ~MultiDimDecorator(), add(), apply(), beginMultipleChanges(), changeNotification(), contains(), content(), content(), domainSize(), empty(), endMultipleChanges(), endMultipleChanges(), erase(), gum::Tensor< GUM_SCALAR >::expectedValue(), fill(), get(), gum::Tensor< GUM_SCALAR >::max(), gum::Tensor< GUM_SCALAR >::maxIn(), gum::Tensor< GUM_SCALAR >::maxNonOne(), gum::Tensor< GUM_SCALAR >::maxOut(), gum::Tensor< GUM_SCALAR >::min(), gum::Tensor< GUM_SCALAR >::minIn(), gum::Tensor< GUM_SCALAR >::minNonZero(), gum::Tensor< GUM_SCALAR >::minOut(), nbrDim(), gum::Tensor< GUM_SCALAR >::normalize(), gum::Tensor< GUM_SCALAR >::normalizeAsCPT(), operator=(), operator=(), gum::Tensor< GUM_SCALAR >::operator==(), populate(), pos(), gum::Tensor< GUM_SCALAR >::prodIn(), gum::Tensor< GUM_SCALAR >::prodOut(), gum::Tensor< GUM_SCALAR >::product(), reduce(), registerSlave(), set(), setChangeNotification(), setDecNotification(), setFirstNotification(), setIncNotification(), setLastNotification(), gum::Tensor< GUM_SCALAR >::sum(), gum::Tensor< GUM_SCALAR >::sumIn(), gum::Tensor< GUM_SCALAR >::sumOut(), swapContent_(), toString(), toString(), unregisterSlave(), variable(), variable(), and variablesSequence().
|
mutableprotected |
value of the MultiDimDecorator if no dimension.
Definition at line 285 of file multiDimDecorator.h.
Referenced by MultiDimDecorator(), MultiDimDecorator(), MultiDimDecorator(), gum::Tensor< GUM_SCALAR >::Tensor(), apply(), fill(), get(), gum::Tensor< GUM_SCALAR >::max(), gum::Tensor< GUM_SCALAR >::maxIn(), gum::Tensor< GUM_SCALAR >::maxNonOne(), gum::Tensor< GUM_SCALAR >::maxOut(), gum::Tensor< GUM_SCALAR >::min(), gum::Tensor< GUM_SCALAR >::minIn(), gum::Tensor< GUM_SCALAR >::minNonZero(), gum::Tensor< GUM_SCALAR >::minOut(), gum::Tensor< GUM_SCALAR >::normalize(), gum::Tensor< GUM_SCALAR >::normalizeAsCPT(), gum::Tensor< GUM_SCALAR >::operator*(), gum::Tensor< GUM_SCALAR >::operator+(), gum::Tensor< GUM_SCALAR >::operator-(), gum::Tensor< GUM_SCALAR >::operator/(), operator=(), operator=(), gum::Tensor< GUM_SCALAR >::operator==(), populate(), gum::Tensor< GUM_SCALAR >::prodIn(), gum::Tensor< GUM_SCALAR >::prodOut(), gum::Tensor< GUM_SCALAR >::product(), set(), gum::Tensor< GUM_SCALAR >::sum(), gum::Tensor< GUM_SCALAR >::sumIn(), gum::Tensor< GUM_SCALAR >::sumOut(), and toString().