aGrUM  0.13.2
gum::MultiDimDecorator< GUM_SCALAR > Class Template Referenceabstract

Decorator design pattern in order to separate implementations from multidimensional matrix concepts. More...

#include <agrum/multidim/multiDimDecorator.h>

+ Inheritance diagram for gum::MultiDimDecorator< GUM_SCALAR >:
+ Collaboration diagram for gum::MultiDimDecorator< GUM_SCALAR >:

Public Member Functions

Constructors / Destructors
 MultiDimDecorator (MultiDimImplementation< GUM_SCALAR > *aContent=nullptr, GUM_SCALAR empty_value=(GUM_SCALAR) 0)
 Class constructor. More...
 
 MultiDimDecorator (const MultiDimDecorator< GUM_SCALAR > &from)
 copy constructor & assignment More...
 
MultiDimDecorator< GUM_SCALAR > & operator= (const MultiDimDecorator &from) noexcept
 copy operator More...
 
 MultiDimDecorator (MultiDimDecorator< GUM_SCALAR > &&) noexcept
 Class move constructor. More...
 
MultiDimDecorator< GUM_SCALAR > & operator= (MultiDimDecorator &&from)
 assignment operator. More...
 
 ~MultiDimDecorator ()
 Class destructor. More...
 
MultiDimInterface implementation
virtual Idx nbrDim () const final
 Returns the number of vars in the multidimensional container. More...
 
virtual Size domainSize () const final
 Returns the product of the variables domain size. More...
 
virtual void add (const DiscreteVariable &v) final
 Adds a new var to the variables of the multidimensional matrix. More...
 
virtual void erase (const DiscreteVariable &var) final
 Removes a var from the variables of the multidimensional matrix. More...
 
virtual const Sequence< const DiscreteVariable * > & variablesSequence () const final
 Returns a const ref to the sequence of DiscreteVariable*. More...
 
virtual const DiscreteVariablevariable (Idx) const final
 Returns a const ref to the ith var. More...
 
virtual const DiscreteVariablevariable (const std::string &name) const final
 Returns the variable with the name. More...
 
virtual Idx pos (const DiscreteVariable &var) const final
 Returns the index of a variable. More...
 
virtual bool contains (const DiscreteVariable &var) const final
 Returns true if var is in *this. More...
 
virtual bool empty () const final
 Returns true if no var is in *this. More...
 
MultiDimAdressable implementation
virtual bool unregisterSlave (Instantiation &i) final
 Unregister i as a slave of this MultiDimAdressable. More...
 
virtual bool registerSlave (Instantiation &i) final
 Register i as a slave of this MultiDimAdressable. More...
 
virtual void changeNotification (const Instantiation &i, const DiscreteVariable *const var, Idx oldval, Idx newval) final
 Listen to changes in a given Instantiation. More...
 
virtual void setChangeNotification (const Instantiation &i) final
 Listen to an assignment of a value in a Instantiation. More...
 
virtual void setFirstNotification (const Instantiation &i) final
 Listen to setFirst in a given Instantiation. More...
 
virtual void setLastNotification (const Instantiation &i) final
 Listen to setLast in a given Instantiation. More...
 
virtual void setIncNotification (const Instantiation &i) final
 Listen to increment in a given Instantiation. More...
 
virtual void setDecNotification (const Instantiation &i) final
 Listen to increment in each recorded Instantiation. More...
 
virtual void notifyChange () const final
 
MultiDimContainer implementation
virtual void set (const Instantiation &i, const GUM_SCALAR &value) const final
 Default implementation of MultiDimContainer::set(). More...
 
virtual GUM_SCALAR get (const Instantiation &i) const final
 Default implementation of MultiDimContainer::get(). More...
 
virtual void fill (const GUM_SCALAR &d) const final
 Default implementation of MultiDimContainer::set(). More...
 
virtual void populate (const std::vector< GUM_SCALAR > &v) const final
 Automatically fills this MultiDimContainer with the values in v. More...
 
virtual void apply (std::function< GUM_SCALAR(GUM_SCALAR) > f) const final
 Apply a function on every element of the container. More...
 
virtual GUM_SCALAR reduce (std::function< GUM_SCALAR(GUM_SCALAR, GUM_SCALAR) > f, GUM_SCALAR base) const final
 compute lfold for this container More...
 
virtual MultiDimDecorator< GUM_SCALAR > * newFactory () const =0
 Default implementation of MultiDimContainer::set(). More...
 
virtual void beginMultipleChanges () final
 Default implementation of MultiDimContainer::set(). More...
 
virtual void endMultipleChanges () final
 Default implementation of MultiDimContainer::set(). More...
 
virtual void endMultipleChanges (const GUM_SCALAR &) final
 Default implementation of MultiDimContainer::set(). More...
 
virtual const std::string toString (const Instantiation *i) const
 Default implementation of MultiDimContainer::set(). More...
 
virtual const std::string toString () const
 Default implementation of MultiDimContainer::set(). More...
 
Various methods.
virtual const MultiDimImplementation< GUM_SCALAR > * content () const final
 Returns the implementation for this object (may be *this). More...
 
virtual MultiDimImplementation< GUM_SCALAR > * content () final
 Returns the implementation for this object (may be *this). More...
 
Accessors / Modifiers
GUM_SCALAR operator[] (const Instantiation &i) const
 An [] operator using a Instantiation as argument. More...
 
virtual void populate (std::initializer_list< GUM_SCALAR > l) const
 Automatically fills this MultiDimContainer with the values in l. More...
 
Copy methods.
virtual void copyFrom (const MultiDimContainer< GUM_SCALAR > &src) const
 Basic copy of a MultiDimContainer. More...
 
virtual void copyFrom (const MultiDimContainer< GUM_SCALAR > &src, Instantiation *p_i) const
 Basic copy of a MultiDimContainer. More...
 
virtual void extractFrom (const MultiDimContainer< GUM_SCALAR > &src, const Instantiation &mask)
 Basic extraction of a MultiDimContainer. More...
 
virtual MultiDimAdressablegetMasterRef ()
 In order to insure the dereference for decorators, we need to virtualize the access to master pointer. More...
 
virtual const MultiDimAdressablegetMasterRef () const
 In order to insure the dereference for decorators, we need to virtualize the access to master pointer. More...
 
virtual void copy (const MultiDimContainer< GUM_SCALAR > &src)
 Removes all variables in this MultiDimContainer and copy the content of src, variables included. More...
 
Various methods.
bool operator== (const MultiDimContainer< GUM_SCALAR > &p) const
 Test if this MultiDimContainer is equal to p. More...
 
bool operator!= (const MultiDimContainer< GUM_SCALAR > &p) const
 Test if this MultiDimContainer is different of p. More...
 
Accessors / Modifiers
void replace (const DiscreteVariable &x, const DiscreteVariable &y)
 Replace variables in this multidim. More...
 

Protected Attributes

MultiDimImplementation< GUM_SCALAR > * _content
 The true container. More...
 
GUM_SCALAR _empty_value
 value of the MultiDimDecorator if no dimension. More...
 

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. More...
 
void _swapContent (MultiDimImplementation< GUM_SCALAR > *aContent) const
 protecte method to swap the implementation behind the Potential More...
 
GUM_SCALAR & _get (const Instantiation &i) const final
 Return a data, given a Insantiation - final method. More...
 

Detailed Description

template<typename GUM_SCALAR>
class gum::MultiDimDecorator< GUM_SCALAR >

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.

Template Parameters
GUM_SCALARThe type of the scalar stored in this multidimensional matrix.

Definition at line 56 of file multiDimDecorator.h.

Constructor & Destructor Documentation

template<typename GUM_SCALAR >
INLINE gum::MultiDimDecorator< GUM_SCALAR >::MultiDimDecorator ( MultiDimImplementation< GUM_SCALAR > *  aContent = nullptr,
GUM_SCALAR  empty_value = (GUM_SCALAR)0 
)

Class constructor.

Parameters
aContentThe implementation used by this MultiDimDecorator.

Definition at line 64 of file multiDimDecorator_tpl.h.

65  :
66  _content(aContent),
67  _empty_value(empty_value) {
68  ___initPotentialOperators< GUM_SCALAR >();
69  GUM_CONSTRUCTOR(MultiDimDecorator);
70  }
MultiDimImplementation< GUM_SCALAR > * _content
The true container.
GUM_SCALAR _empty_value
value of the MultiDimDecorator if no dimension.
MultiDimDecorator(MultiDimImplementation< GUM_SCALAR > *aContent=nullptr, GUM_SCALAR empty_value=(GUM_SCALAR) 0)
Class constructor.
template<typename GUM_SCALAR >
INLINE gum::MultiDimDecorator< GUM_SCALAR >::MultiDimDecorator ( const MultiDimDecorator< GUM_SCALAR > &  from)

copy constructor & assignment

Definition at line 73 of file multiDimDecorator_tpl.h.

References gum::MultiDimDecorator< GUM_SCALAR >::_empty_value, gum::MultiDimDecorator< GUM_SCALAR >::content(), and gum::MultiDimDecorator< GUM_SCALAR >::operator=().

74  :
75  MultiDimContainer< GUM_SCALAR >(from) {
76  GUM_CONS_CPY(MultiDimDecorator);
77  ___initPotentialOperators< GUM_SCALAR >();
78  _empty_value = from._empty_value;
79  content()->copy(from.content());
80  }
GUM_SCALAR _empty_value
value of the MultiDimDecorator if no dimension.
virtual const MultiDimImplementation< GUM_SCALAR > * content() const final
Returns the implementation for this object (may be *this).
MultiDimDecorator(MultiDimImplementation< GUM_SCALAR > *aContent=nullptr, GUM_SCALAR empty_value=(GUM_SCALAR) 0)
Class constructor.

+ Here is the call graph for this function:

template<typename GUM_SCALAR >
INLINE gum::MultiDimDecorator< GUM_SCALAR >::MultiDimDecorator ( MultiDimDecorator< GUM_SCALAR > &&  from)
noexcept

Class move constructor.

Definition at line 102 of file multiDimDecorator_tpl.h.

References gum::MultiDimDecorator< GUM_SCALAR >::_content, gum::MultiDimDecorator< GUM_SCALAR >::_empty_value, and gum::MultiDimDecorator< GUM_SCALAR >::operator=().

103  :
104  MultiDimContainer< GUM_SCALAR >(
105  std::forward< MultiDimContainer< GUM_SCALAR > >(from)) {
106  GUM_CONS_MOV(MultiDimDecorator);
107 
108  _empty_value = from._empty_value;
109  _content = from._content;
110  from._content = nullptr;
111  }
MultiDimImplementation< GUM_SCALAR > * _content
The true container.
GUM_SCALAR _empty_value
value of the MultiDimDecorator if no dimension.
MultiDimDecorator(MultiDimImplementation< GUM_SCALAR > *aContent=nullptr, GUM_SCALAR empty_value=(GUM_SCALAR) 0)
Class constructor.

+ Here is the call graph for this function:

template<typename GUM_SCALAR >
INLINE gum::MultiDimDecorator< GUM_SCALAR >::~MultiDimDecorator ( )

Class destructor.

Definition at line 129 of file multiDimDecorator_tpl.h.

References gum::MultiDimDecorator< GUM_SCALAR >::_content.

129  {
130  if (_content != nullptr) { delete (_content); }
131 
132  GUM_DESTRUCTOR(MultiDimDecorator);
133  }
MultiDimImplementation< GUM_SCALAR > * _content
The true container.
MultiDimDecorator(MultiDimImplementation< GUM_SCALAR > *aContent=nullptr, GUM_SCALAR empty_value=(GUM_SCALAR) 0)
Class constructor.

Member Function Documentation

template<typename GUM_SCALAR >
INLINE GUM_SCALAR & gum::MultiDimDecorator< GUM_SCALAR >::_get ( const Instantiation i) const
finalprotectedvirtual

Return a data, given a Insantiation - final method.

Parameters
iThe instantiation.
Exceptions
NullElement
NotFound

Implements gum::MultiDimContainer< GUM_SCALAR >.

Definition at line 139 of file multiDimDecorator_tpl.h.

References GUM_ERROR.

139  {
140  GUM_ERROR(OperationNotAllowed, "_get in the implementation !");
141  }
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66
template<typename GUM_SCALAR >
INLINE void gum::MultiDimDecorator< GUM_SCALAR >::_replace ( const DiscreteVariable x,
const DiscreteVariable y 
)
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.

Parameters
xThe variable to replace in
yThe second variable to swap.

Implements gum::MultiDimInterface.

Definition at line 408 of file multiDimDecorator_tpl.h.

References gum::MultiDimDecorator< GUM_SCALAR >::content().

409  {
410  this->content()->replace(*x, *y);
411  }
virtual const MultiDimImplementation< GUM_SCALAR > * content() const final
Returns the implementation for this object (may be *this).

+ Here is the call graph for this function:

template<typename GUM_SCALAR >
INLINE void gum::MultiDimDecorator< GUM_SCALAR >::_swapContent ( MultiDimImplementation< GUM_SCALAR > *  aContent) const
protected

protecte method to swap the implementation behind the Potential

Warning
unsafe method for slave Instantiations !

Definition at line 385 of file multiDimDecorator_tpl.h.

References gum::MultiDimDecorator< GUM_SCALAR >::_content.

386  {
387  if (aContent != nullptr) {
388  // TODO : frees all slave instantiations
389  // TODO : control the dimensions ?
390  MultiDimImplementation< GUM_SCALAR >* tmp = _content;
391  _content = aContent;
392  // registers all instantiations
393  delete (tmp);
394  }
395  }
MultiDimImplementation< GUM_SCALAR > * _content
The true container.
template<typename GUM_SCALAR >
INLINE void gum::MultiDimDecorator< GUM_SCALAR >::add ( const DiscreteVariable v)
finalvirtual

Adds a new var to the variables of the multidimensional matrix.

See also
operator<<(MultiDimInterface& c, const DiscreteVariable& v)
Warning
Note that the variable passed in argument is not duplicated, that is, only a pointer toward the variable is kept by the MultiDimInterface.
Parameters
vThe new var.
Exceptions
DuplicateElementRaised if the variable already belongs to the sequence of variables.
OperationNotAllowedRaised if this object is non mutable.

Implements gum::MultiDimInterface.

Definition at line 173 of file multiDimDecorator_tpl.h.

References gum::MultiDimDecorator< GUM_SCALAR >::_content.

Referenced by gum::prm::gspan::StrictSearch< GUM_SCALAR >::__elimination_cost(), gum::prm::PRMSystem< GUM_SCALAR >::__groundPotential(), gum::prm::GroundedInference< GUM_SCALAR >::_evidenceAdded(), gum::prm::PRMInference< GUM_SCALAR >::addEvidence(), gum::BayesNetInference< GUM_SCALAR >::addEvidence(), gum::BayesNetInference< GUM_SCALAR >::chgEvidence(), gum::prm::copyPotential(), gum::learning::DAG2BNLearner::createBN(), gum::MarginalTargetedInference< GUM_SCALAR >::evidenceImpact(), gum::JointTargetedInference< GUM_SCALAR >::evidenceJointImpact(), gum::prm::PRMInference< GUM_SCALAR >::joint(), gum::prm::PRMInference< GUM_SCALAR >::marginal(), gum::prm::PRMInference< GUM_SCALAR >::operator=(), gum::Potential< GUM_SCALAR >::Potential(), gum::prm::PRMInference< GUM_SCALAR >::PRMInference(), and gum::Potential< GUM_SCALAR >::reorganize().

173  {
174  static_cast< MultiDimContainer< GUM_SCALAR >* >(_content)->add(v);
175  }
MultiDimImplementation< GUM_SCALAR > * _content
The true container.
virtual void add(const DiscreteVariable &v) final
Adds a new var to the variables of the multidimensional matrix.

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
void gum::MultiDimDecorator< GUM_SCALAR >::apply ( std::function< GUM_SCALAR(GUM_SCALAR) >  f) const
finalvirtual

Apply a function on every element of the container.

Parameters
fthe function to apply

Reimplemented from gum::MultiDimContainer< GUM_SCALAR >.

Definition at line 332 of file multiDimDecorator_tpl.h.

References gum::MultiDimDecorator< GUM_SCALAR >::_content, gum::MultiDimDecorator< GUM_SCALAR >::_empty_value, and gum::MultiDimDecorator< GUM_SCALAR >::empty().

Referenced by gum::Potential< GUM_SCALAR >::abs(), gum::Potential< GUM_SCALAR >::isNonZeroMap(), gum::Potential< GUM_SCALAR >::normalize(), gum::Potential< GUM_SCALAR >::operator-(), gum::Potential< GUM_SCALAR >::operator/(), gum::Potential< GUM_SCALAR >::scale(), gum::Potential< GUM_SCALAR >::sq(), and gum::Potential< GUM_SCALAR >::translate().

333  {
334  if (static_cast< MultiDimContainer< GUM_SCALAR >* >(_content)->empty()) {
336  } else {
337  _content->apply(f);
338  }
339  }
MultiDimImplementation< GUM_SCALAR > * _content
The true container.
GUM_SCALAR _empty_value
value of the MultiDimDecorator if no dimension.
virtual bool empty() const final
Returns true if no var is in *this.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
INLINE void gum::MultiDimDecorator< GUM_SCALAR >::beginMultipleChanges ( )
finalvirtual

Default implementation of MultiDimContainer::set().

Calls _get as a r-value.

Implements gum::MultiDimContainer< GUM_SCALAR >.

Definition at line 366 of file multiDimDecorator_tpl.h.

References gum::MultiDimDecorator< GUM_SCALAR >::_content.

Referenced by gum::BayesNet< GUM_SCALAR >::__copyPotentials(), gum::BayesNetInference< GUM_SCALAR >::__createHardEvidence(), gum::learning::DAG2BNLearner::createBN(), gum::Potential< GUM_SCALAR >::Potential(), and gum::Potential< GUM_SCALAR >::reorganize().

366  {
367  static_cast< MultiDimContainer< GUM_SCALAR >* >(_content)
369  }
virtual void beginMultipleChanges() final
Default implementation of MultiDimContainer::set().
MultiDimImplementation< GUM_SCALAR > * _content
The true container.

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
INLINE void gum::MultiDimDecorator< GUM_SCALAR >::changeNotification ( const Instantiation i,
const DiscreteVariable *const  var,
Idx  oldval,
Idx  newval 
)
finalvirtual

Listen to changes in a given Instantiation.

Parameters
iThe Instantiation to listen.
varThe changed dim.
oldvalThe old value.
newvalThe changed value.

Implements gum::MultiDimAdressable.

Definition at line 180 of file multiDimDecorator_tpl.h.

References gum::MultiDimDecorator< GUM_SCALAR >::_content.

184  {
185  static_cast< MultiDimContainer< GUM_SCALAR >* >(_content)->changeNotification(
186  i, var, oldval, newval);
187  }
MultiDimImplementation< GUM_SCALAR > * _content
The true container.
virtual void changeNotification(const Instantiation &i, const DiscreteVariable *const var, Idx oldval, Idx newval) final
Listen to changes in a given Instantiation.
template<typename GUM_SCALAR >
INLINE bool gum::MultiDimDecorator< GUM_SCALAR >::contains ( const DiscreteVariable v) const
finalvirtual

Returns true if var is in *this.

Parameters
vA DiscreteVariable.
Returns
Returns true if var is in *this.

Implements gum::MultiDimInterface.

Definition at line 268 of file multiDimDecorator_tpl.h.

References gum::MultiDimDecorator< GUM_SCALAR >::_content.

Referenced by gum::prm::StructuredInference< GUM_SCALAR >::_marginal(), gum::prm::PRMInference< GUM_SCALAR >::addEvidence(), gum::Potential< GUM_SCALAR >::KL(), gum::Potential< GUM_SCALAR >::putFirst(), and gum::Potential< GUM_SCALAR >::reorganize().

268  {
269  return static_cast< MultiDimContainer< GUM_SCALAR >* >(_content)->contains(d);
270  }
MultiDimImplementation< GUM_SCALAR > * _content
The true container.
virtual bool contains(const DiscreteVariable &var) const final
Returns true if var is in *this.

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
INLINE const MultiDimImplementation< GUM_SCALAR > * gum::MultiDimDecorator< GUM_SCALAR >::content ( ) const
finalvirtual

Returns the implementation for this object (may be *this).

Implements gum::MultiDimContainer< GUM_SCALAR >.

Definition at line 361 of file multiDimDecorator_tpl.h.

References gum::MultiDimDecorator< GUM_SCALAR >::_content.

Referenced by gum::MultiDimDecorator< GUM_SCALAR >::_replace(), gum::prm::copyPotential(), gum::Potential< GUM_SCALAR >::margMaxIn(), gum::Potential< GUM_SCALAR >::margMaxOut(), gum::Potential< GUM_SCALAR >::margMinIn(), gum::Potential< GUM_SCALAR >::margMinOut(), gum::Potential< GUM_SCALAR >::margProdIn(), gum::Potential< GUM_SCALAR >::margProdOut(), gum::Potential< GUM_SCALAR >::margSumIn(), gum::Potential< GUM_SCALAR >::margSumOut(), gum::Potential< GUM_SCALAR >::max(), gum::Potential< GUM_SCALAR >::min(), gum::MultiDimDecorator< GUM_SCALAR >::MultiDimDecorator(), gum::Potential< GUM_SCALAR >::newFactory(), gum::Potential< GUM_SCALAR >::operator*(), gum::Potential< GUM_SCALAR >::operator+(), gum::Potential< GUM_SCALAR >::operator-(), gum::Potential< GUM_SCALAR >::operator/(), gum::MultiDimDecorator< GUM_SCALAR >::operator=(), gum::Potential< GUM_SCALAR >::Potential(), gum::Potential< GUM_SCALAR >::product(), and gum::Potential< GUM_SCALAR >::sum().

361  {
362  return _content;
363  }
MultiDimImplementation< GUM_SCALAR > * _content
The true container.

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
INLINE MultiDimImplementation< GUM_SCALAR > * gum::MultiDimDecorator< GUM_SCALAR >::content ( )
finalvirtual

Returns the implementation for this object (may be *this).

Implements gum::MultiDimContainer< GUM_SCALAR >.

Definition at line 354 of file multiDimDecorator_tpl.h.

References gum::MultiDimDecorator< GUM_SCALAR >::_content.

354  {
355  return _content;
356  }
MultiDimImplementation< GUM_SCALAR > * _content
The true container.
template<typename GUM_SCALAR >
void gum::MultiDimContainer< GUM_SCALAR >::copy ( const MultiDimContainer< GUM_SCALAR > &  src)
virtualinherited

Removes all variables in this MultiDimContainer and copy the content of src, variables included.

Parameters
srcThe MultiDimContainer to copy.

Reimplemented in gum::MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy >, gum::MultiDimFunctionGraph< GUM_SCALAR >, and gum::MultiDimFunctionGraph< GUM_SCALAR, ExactTerminalNodePolicy >.

Definition at line 278 of file multiDimContainer_tpl.h.

References gum::MultiDimInterface::add(), gum::MultiDimContainer< GUM_SCALAR >::beginMultipleChanges(), gum::MultiDimContainer< GUM_SCALAR >::copyFrom(), gum::MultiDimContainer< GUM_SCALAR >::endMultipleChanges(), gum::MultiDimInterface::erase(), gum::MultiDimInterface::nbrDim(), and gum::MultiDimInterface::variable().

Referenced by gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__eraseArc(), and gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::disturbBN().

279  {
280  this->beginMultipleChanges();
281 
282  Size nbr = this->nbrDim();
283 
284  for (Idx i = 0; i < nbr; i++) {
285  this->erase(this->variable(0));
286  }
287 
288  for (Idx i = 0; i < src.nbrDim(); i++) {
289  this->add(src.variable(i));
290  }
291 
292  this->endMultipleChanges();
293  this->copyFrom(src);
294  }
virtual void endMultipleChanges()=0
Call this method after doing important changes in this MultiDimContainer.
virtual void add(const DiscreteVariable &v)=0
Adds a new var to the variables of the multidimensional matrix.
unsigned long Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:50
virtual Idx nbrDim() const =0
Returns the number of vars in the multidimensional container.
virtual void copyFrom(const MultiDimContainer< GUM_SCALAR > &src) const
Basic copy of a MultiDimContainer.
virtual const DiscreteVariable & variable(Idx i) const =0
Returns a const ref to the ith var.
virtual void beginMultipleChanges()=0
Call this method before doing important changes in this MultiDimContainer.
virtual void erase(const DiscreteVariable &v)=0
Removes a var from the variables of the multidimensional matrix.
unsigned long Idx
Type for indexes.
Definition: types.h:43

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
void gum::MultiDimContainer< GUM_SCALAR >::copyFrom ( const MultiDimContainer< GUM_SCALAR > &  src) const
virtualinherited

Basic copy of a MultiDimContainer.

This method is virtual because it should be optimized in certain MultiDimContainer.

Parameters
srcThe MultiDimContainer src which values are copied. This is a full copy with no verification of dimensions.
Exceptions
OperationNotAllowedRaised if src does not have the same domain size than this MultiDimContainer.

Reimplemented in gum::aggregator::MultiDimAggregator< GUM_SCALAR >, gum::MultiDimICIModel< GUM_SCALAR >, and gum::MultiDimArray< GUM_SCALAR >.

Definition at line 261 of file multiDimContainer_tpl.h.

References gum::MultiDimInterface::domainSize(), gum::Instantiation::end(), GUM_ERROR, and gum::Instantiation::setFirst().

Referenced by gum::BayesNet< GUM_SCALAR >::__copyPotentials(), gum::MultiDimContainer< GUM_SCALAR >::copy(), gum::MultiDimArray< GUM_SCALAR >::copyFrom(), gum::MultiDimICIModel< GUM_SCALAR >::copyFrom(), gum::aggregator::MultiDimAggregator< GUM_SCALAR >::copyFrom(), and gum::Potential< GUM_SCALAR >::reorganize().

262  {
263  if (src.domainSize() != domainSize()) {
264  GUM_ERROR(OperationNotAllowed, "Domain sizes do not fit");
265  }
266 
267  Instantiation i_dest(*this);
268  Instantiation i_src(src);
269 
270  for (i_dest.setFirst(), i_src.setFirst(); !i_dest.end(); ++i_dest, ++i_src) {
271  set(i_dest, src[i_src]);
272  }
273  }
virtual Size domainSize() const =0
Returns the product of the variables domain size.
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
void gum::MultiDimContainer< GUM_SCALAR >::copyFrom ( const MultiDimContainer< GUM_SCALAR > &  src,
Instantiation p_i 
) const
virtualinherited

Basic copy of a MultiDimContainer.

This method is virtual because it should be optimized in certain MultiDimContainer.

Parameters
srcThe MultiDimContainer src which values are copied.
p_iGive the order to iterate in this MultiDimContainer during the copy (nullptr will correctly copy if this is a reorganization of src).
Exceptions
OperationNotAllowedRaised if src does not have the same domain size than this MultiDimContainer.

Reimplemented in gum::MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy >, gum::MultiDimFunctionGraph< GUM_SCALAR >, and gum::MultiDimFunctionGraph< GUM_SCALAR, ExactTerminalNodePolicy >.

Definition at line 214 of file multiDimContainer_tpl.h.

References gum::MultiDimInterface::domainSize(), gum::Instantiation::end(), GUM_ERROR, gum::Instantiation::incIn(), and gum::Instantiation::setFirst().

215  {
216  if (src.domainSize() != domainSize()) {
217  GUM_ERROR(OperationNotAllowed, "Domain sizes do not fit");
218  }
219 
220  if (p_i == nullptr) { // if null, we just follow the same order
221  Instantiation i(src);
222  for (i.setFirst(); !i.end(); ++i) {
223  set(i, src[i]);
224  }
225  } else {
226  Instantiation i_dest(*this);
227  Instantiation i_src(src);
228  for (i_dest.setFirst(), i_src.setFirst(); !i_dest.end();
229  i_dest.incIn(*p_i), ++i_src) {
230  set(i_dest, src[i_src]);
231  }
232  }
233  }
virtual Size domainSize() const =0
Returns the product of the variables domain size.
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66

+ Here is the call graph for this function:

template<typename GUM_SCALAR >
INLINE Size gum::MultiDimDecorator< GUM_SCALAR >::domainSize ( ) const
finalvirtual

Returns the product of the variables domain size.

Returns
Returns the product of the variables domain size.

Implements gum::MultiDimInterface.

Definition at line 166 of file multiDimDecorator_tpl.h.

References gum::MultiDimDecorator< GUM_SCALAR >::_content.

Referenced by gum::prm::gspan::StrictSearch< GUM_SCALAR >::__elimination_cost(), gum::credal::CNMonteCarloSampling< GUM_SCALAR, BNInferenceEngine >::__verticesSampling(), gum::credal::CredalNet< GUM_SCALAR >::approximatedBinarization(), gum::credal::CredalNet< GUM_SCALAR >::fillConstraint(), gum::Potential< GUM_SCALAR >::fillWith(), gum::SimpleCPTGenerator< GUM_SCALAR >::generateCPT(), gum::SimpleUTGenerator::generateUT(), and gum::credal::CredalNet< GUM_SCALAR >::toString().

166  {
167  return static_cast< MultiDimContainer< GUM_SCALAR >* >(_content)->domainSize();
168  }
MultiDimImplementation< GUM_SCALAR > * _content
The true container.
virtual Size domainSize() const final
Returns the product of the variables domain size.

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
INLINE bool gum::MultiDimDecorator< GUM_SCALAR >::empty ( ) const
finalvirtual

Returns true if no var is in *this.

Returns
Returns true if no var is in *this.

Implements gum::MultiDimInterface.

Definition at line 273 of file multiDimDecorator_tpl.h.

References gum::MultiDimDecorator< GUM_SCALAR >::_content.

Referenced by gum::MultiDimDecorator< GUM_SCALAR >::apply(), gum::Potential< GUM_SCALAR >::entropy(), gum::MultiDimDecorator< GUM_SCALAR >::fill(), gum::Potential< GUM_SCALAR >::findAll(), gum::MultiDimDecorator< GUM_SCALAR >::get(), gum::Potential< GUM_SCALAR >::margMaxIn(), gum::Potential< GUM_SCALAR >::margMaxOut(), gum::Potential< GUM_SCALAR >::margMinIn(), gum::Potential< GUM_SCALAR >::margMinOut(), gum::Potential< GUM_SCALAR >::margProdIn(), gum::Potential< GUM_SCALAR >::margProdOut(), gum::Potential< GUM_SCALAR >::margSumIn(), gum::Potential< GUM_SCALAR >::margSumOut(), gum::Potential< GUM_SCALAR >::max(), gum::Potential< GUM_SCALAR >::maxNonOne(), gum::Potential< GUM_SCALAR >::min(), gum::Potential< GUM_SCALAR >::minNonZero(), gum::Potential< GUM_SCALAR >::normalize(), gum::Potential< GUM_SCALAR >::normalizeAsCPT(), gum::Potential< GUM_SCALAR >::operator*(), gum::Potential< GUM_SCALAR >::operator+(), gum::Potential< GUM_SCALAR >::operator-(), gum::Potential< GUM_SCALAR >::operator/(), gum::Potential< GUM_SCALAR >::operator==(), gum::MultiDimDecorator< GUM_SCALAR >::populate(), gum::Potential< GUM_SCALAR >::product(), gum::MultiDimDecorator< GUM_SCALAR >::reduce(), gum::Potential< GUM_SCALAR >::sum(), and gum::MultiDimDecorator< GUM_SCALAR >::toString().

273  {
274  if (_content == nullptr) return true;
275  return static_cast< MultiDimContainer< GUM_SCALAR >* >(_content)->empty();
276  }
MultiDimImplementation< GUM_SCALAR > * _content
The true container.
virtual bool empty() const final
Returns true if no var is in *this.

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
INLINE void gum::MultiDimDecorator< GUM_SCALAR >::endMultipleChanges ( )
finalvirtual

Default implementation of MultiDimContainer::set().

Calls _get as a r-value.

Implements gum::MultiDimContainer< GUM_SCALAR >.

Definition at line 372 of file multiDimDecorator_tpl.h.

References gum::MultiDimDecorator< GUM_SCALAR >::_content.

Referenced by gum::BayesNet< GUM_SCALAR >::__copyPotentials(), gum::learning::DAG2BNLearner::createBN(), gum::MultiDimDecorator< GUM_SCALAR >::endMultipleChanges(), gum::Potential< GUM_SCALAR >::Potential(), and gum::Potential< GUM_SCALAR >::reorganize().

372  {
373  static_cast< MultiDimContainer< GUM_SCALAR >* >(_content)
374  ->endMultipleChanges();
375  }
MultiDimImplementation< GUM_SCALAR > * _content
The true container.
virtual void endMultipleChanges() final
Default implementation of MultiDimContainer::set().

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
INLINE void gum::MultiDimDecorator< GUM_SCALAR >::endMultipleChanges ( const GUM_SCALAR &  x)
finalvirtual

Default implementation of MultiDimContainer::set().

Calls _get as a r-value.

Implements gum::MultiDimContainer< GUM_SCALAR >.

Definition at line 379 of file multiDimDecorator_tpl.h.

References gum::MultiDimDecorator< GUM_SCALAR >::_content, and gum::MultiDimDecorator< GUM_SCALAR >::endMultipleChanges().

379  {
380  static_cast< MultiDimContainer< GUM_SCALAR >* >(_content)->endMultipleChanges(
381  x);
382  }
MultiDimImplementation< GUM_SCALAR > * _content
The true container.
virtual void endMultipleChanges() final
Default implementation of MultiDimContainer::set().

+ Here is the call graph for this function:

template<typename GUM_SCALAR >
INLINE void gum::MultiDimDecorator< GUM_SCALAR >::erase ( const DiscreteVariable v)
finalvirtual

Removes a var from the variables of the multidimensional matrix.

See also
operator>>(MultiDimInterface& c, const DiscreteVariable& v)
Exceptions
OperationNotAllowedRaised if this object is non mutable.
NotFoundRaised if v does not belong to this.

Implements gum::MultiDimInterface.

Definition at line 243 of file multiDimDecorator_tpl.h.

References gum::MultiDimDecorator< GUM_SCALAR >::_content.

Referenced by gum::prm::gspan::StrictSearch< GUM_SCALAR >::__elimination_cost(), gum::prm::StructuredInference< GUM_SCALAR >::__removeBarrenNodes(), gum::prm::GroundedInference< GUM_SCALAR >::_evidenceRemoved(), and gum::prm::eliminateNode().

243  {
244  static_cast< MultiDimContainer< GUM_SCALAR >* >(_content)->erase(d);
245  }
MultiDimImplementation< GUM_SCALAR > * _content
The true container.
virtual void erase(const DiscreteVariable &var) final
Removes a var from the variables of the multidimensional matrix.

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
void gum::MultiDimContainer< GUM_SCALAR >::extractFrom ( const MultiDimContainer< GUM_SCALAR > &  src,
const Instantiation mask 
)
virtualinherited

Basic extraction of a MultiDimContainer.

This method is virtual because it should be optimized in certain MultiDimContainer.

Parameters
srcThe MultiDimContainer src which datas are copied.
maskpartial instantiation of variables of the Potential : the extraction will concern every variable not in the instantiation and the copy of data will use the values in this instantiation.

Definition at line 236 of file multiDimContainer_tpl.h.

References gum::MultiDimInterface::add(), gum::MultiDimContainer< GUM_SCALAR >::beginMultipleChanges(), gum::Instantiation::contains(), gum::Instantiation::end(), gum::MultiDimContainer< GUM_SCALAR >::endMultipleChanges(), gum::MultiDimInterface::erase(), GUM_ERROR, gum::Instantiation::incOut(), gum::MultiDimInterface::nbrDim(), gum::Instantiation::setFirstOut(), gum::Instantiation::setVals(), and gum::MultiDimInterface::variable().

Referenced by gum::Potential< GUM_SCALAR >::extract().

237  {
238  this->beginMultipleChanges();
239 
240  Size nbr = this->nbrDim();
241 
242  for (Idx i = 0; i < nbr; i++) {
243  this->erase(this->variable(0));
244  }
245 
246  for (Idx i = 0; i < src.nbrDim(); i++) {
247  if (!imask.contains(src.variable(i))) this->add(src.variable(i));
248  }
249 
250  if (this->nbrDim() == 0) { GUM_ERROR(FatalError, "Empty potential"); }
251 
252  this->endMultipleChanges();
253 
254  Instantiation inst(src);
255  inst.setVals(imask);
256  for (inst.setFirstOut(imask); !inst.end(); inst.incOut(imask))
257  set(inst, src[inst]);
258  }
virtual void endMultipleChanges()=0
Call this method after doing important changes in this MultiDimContainer.
virtual void add(const DiscreteVariable &v)=0
Adds a new var to the variables of the multidimensional matrix.
unsigned long Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:50
virtual Idx nbrDim() const =0
Returns the number of vars in the multidimensional container.
virtual const DiscreteVariable & variable(Idx i) const =0
Returns a const ref to the ith var.
virtual void beginMultipleChanges()=0
Call this method before doing important changes in this MultiDimContainer.
virtual void erase(const DiscreteVariable &v)=0
Removes a var from the variables of the multidimensional matrix.
unsigned long Idx
Type for indexes.
Definition: types.h:43
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
INLINE void gum::MultiDimDecorator< GUM_SCALAR >::fill ( const GUM_SCALAR &  d) const
finalvirtual

Default implementation of MultiDimContainer::set().

Calls _get as a r-value.

Implements gum::MultiDimContainer< GUM_SCALAR >.

Definition at line 285 of file multiDimDecorator_tpl.h.

References gum::MultiDimDecorator< GUM_SCALAR >::_content, gum::MultiDimDecorator< GUM_SCALAR >::_empty_value, and gum::MultiDimDecorator< GUM_SCALAR >::empty().

Referenced by gum::Potential< GUM_SCALAR >::fillWith().

285  {
286  if (static_cast< MultiDimContainer< GUM_SCALAR >* >(_content)->empty()) {
287  _empty_value = d;
288  } else {
289  static_cast< MultiDimContainer< GUM_SCALAR >* >(_content)->fill(d);
290  }
291  }
MultiDimImplementation< GUM_SCALAR > * _content
The true container.
GUM_SCALAR _empty_value
value of the MultiDimDecorator if no dimension.
virtual bool empty() const final
Returns true if no var is in *this.
virtual void fill(const GUM_SCALAR &d) const final
Default implementation of MultiDimContainer::set().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
INLINE GUM_SCALAR gum::MultiDimDecorator< GUM_SCALAR >::get ( const Instantiation i) const
finalvirtual

Default implementation of MultiDimContainer::get().

Calls _get as a l-value.

Reimplemented from gum::MultiDimContainer< GUM_SCALAR >.

Definition at line 145 of file multiDimDecorator_tpl.h.

References gum::MultiDimDecorator< GUM_SCALAR >::_content, gum::MultiDimDecorator< GUM_SCALAR >::_empty_value, and gum::MultiDimDecorator< GUM_SCALAR >::empty().

Referenced by gum::prm::StructuredBayesBall< GUM_SCALAR >::__isHardEvidence(), gum::prm::GroundedInference< GUM_SCALAR >::_evidenceAdded(), gum::prm::StructuredInference< GUM_SCALAR >::_marginal(), gum::prm::PRMInference< GUM_SCALAR >::addEvidence(), gum::credal::CredalNet< GUM_SCALAR >::bnToCredal(), gum::SimpleCPTDisturber< GUM_SCALAR >::disturbAugmCPT(), gum::SimpleCPTDisturber< GUM_SCALAR >::disturbReducCPT(), gum::Potential< GUM_SCALAR >::fillWith(), gum::Potential< GUM_SCALAR >::KL(), gum::prm::PRMInference< GUM_SCALAR >::marginal(), and gum::prm::o3prmr::O3prmrInterpreter::query().

145  {
146  if (static_cast< MultiDimContainer< GUM_SCALAR >* >(_content)->empty()) {
147  return _empty_value;
148  } else {
149  return static_cast< MultiDimContainer< GUM_SCALAR >* >(_content)->get(i);
150  }
151  }
MultiDimImplementation< GUM_SCALAR > * _content
The true container.
GUM_SCALAR _empty_value
value of the MultiDimDecorator if no dimension.
virtual bool empty() const final
Returns true if no var is in *this.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
INLINE MultiDimAdressable & gum::MultiDimContainer< GUM_SCALAR >::getMasterRef ( )
virtualinherited

In order to insure the dereference for decorators, we need to virtualize the access to master pointer.

Returns
Returns the ref to content as MultiDimAdressable&

Implements gum::MultiDimAdressable.

Reimplemented in gum::MultiDimBucket< GUM_SCALAR >.

Definition at line 297 of file multiDimContainer_tpl.h.

References gum::MultiDimContainer< GUM_SCALAR >::content().

297  {
298  return static_cast< MultiDimAdressable& >(*content());
299  }
virtual const MultiDimImplementation< GUM_SCALAR > * content() const =0
Returns the implementation for this object (may be *this).
MultiDimAdressable()
Default constructor.

+ Here is the call graph for this function:

template<typename GUM_SCALAR >
INLINE const MultiDimAdressable & gum::MultiDimContainer< GUM_SCALAR >::getMasterRef ( ) const
virtualinherited

In order to insure the dereference for decorators, we need to virtualize the access to master pointer.

Returns
Returns the master of this MultiDimAdressable.

Implements gum::MultiDimAdressable.

Reimplemented in gum::MultiDimBucket< GUM_SCALAR >.

Definition at line 303 of file multiDimContainer_tpl.h.

References gum::MultiDimContainer< GUM_SCALAR >::content().

303  {
304  return static_cast< const MultiDimAdressable& >(*content());
305  }
virtual const MultiDimImplementation< GUM_SCALAR > * content() const =0
Returns the implementation for this object (may be *this).
MultiDimAdressable()
Default constructor.

+ Here is the call graph for this function:

template<typename GUM_SCALAR >
INLINE Idx gum::MultiDimDecorator< GUM_SCALAR >::nbrDim ( ) const
finalvirtual

Returns the number of vars in the multidimensional container.

Returns
Returns the number of vars in the multidimensional container.

Implements gum::MultiDimInterface.

Definition at line 313 of file multiDimDecorator_tpl.h.

References gum::MultiDimDecorator< GUM_SCALAR >::_content.

Referenced by gum::GibbsOperator< GUM_SCALAR >::__GibbsSample(), gum::prm::SVED< GUM_SCALAR >::_marginal(), gum::prm::PRMInference< GUM_SCALAR >::addEvidence(), gum::BayesNet< GUM_SCALAR >::changePotential(), gum::BayesNetInference< GUM_SCALAR >::chgEvidence(), gum::Potential< GUM_SCALAR >::draw(), gum::Potential< GUM_SCALAR >::fillWith(), gum::BayesNetFragment< GUM_SCALAR >::installCPT(), gum::BayesNetFragment< GUM_SCALAR >::installMarginal(), gum::prm::PRMInference< GUM_SCALAR >::joint(), gum::Potential< GUM_SCALAR >::KL(), gum::prm::PRMInference< GUM_SCALAR >::marginal(), gum::Potential< GUM_SCALAR >::putFirst(), gum::Potential< GUM_SCALAR >::reorganize(), gum::MultiDimDecorator< GUM_SCALAR >::set(), and gum::BayesNetFragment< GUM_SCALAR >::uninstallCPT().

313  {
314  return static_cast< MultiDimContainer< GUM_SCALAR >* >(_content)->nbrDim();
315  }
virtual Idx nbrDim() const final
Returns the number of vars in the multidimensional container.
MultiDimImplementation< GUM_SCALAR > * _content
The true container.

+ Here is the caller graph for this function:

template<typename GUM_SCALAR>
virtual MultiDimDecorator< GUM_SCALAR >* gum::MultiDimDecorator< GUM_SCALAR >::newFactory ( ) const
pure virtual

Default implementation of MultiDimContainer::set().

Calls _get as a r-value.

Implements gum::MultiDimContainer< GUM_SCALAR >.

Implemented in gum::Potential< GUM_SCALAR >.

template<typename GUM_SCALAR >
INLINE void gum::MultiDimDecorator< GUM_SCALAR >::notifyChange ( ) const
finalvirtual

Definition at line 296 of file multiDimDecorator_tpl.h.

References GUM_ERROR.

296  {
297  /*( (MultiDimContainer<GUM_SCALAR> *) _content)->notifyChange();*/
298  GUM_ERROR(OperationNotAllowed, "Not implemented yet");
299  }
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66
template<typename GUM_SCALAR >
INLINE bool gum::MultiDimContainer< GUM_SCALAR >::operator!= ( const MultiDimContainer< GUM_SCALAR > &  p) const
inherited

Test if this MultiDimContainer is different of p.

Parameters
pThe MultiDimContainer to test for inequality.
Returns
Returns true if this MultiDimContainer is different of p.

Definition at line 157 of file multiDimContainer_tpl.h.

References gum::MultiDimContainer< GUM_SCALAR >::operator==().

Referenced by gum::MultiDimContainer< GUM_SCALAR >::operator==().

157  {
158  return !operator==(p);
159  }
bool operator==(const MultiDimContainer< GUM_SCALAR > &p) const
Test if this MultiDimContainer is equal to p.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
INLINE MultiDimDecorator< GUM_SCALAR > & gum::MultiDimDecorator< GUM_SCALAR >::operator= ( const MultiDimDecorator< GUM_SCALAR > &  from)
noexcept

copy operator

Definition at line 116 of file multiDimDecorator_tpl.h.

References gum::MultiDimDecorator< GUM_SCALAR >::_empty_value, gum::MultiDimDecorator< GUM_SCALAR >::content(), and gum::MultiDimContainer< GUM_SCALAR >::operator=().

Referenced by gum::MultiDimDecorator< GUM_SCALAR >::MultiDimDecorator(), and gum::Potential< GUM_SCALAR >::operator=().

116  {
117  GUM_OP_CPY(MultiDimDecorator);
118  ___initPotentialOperators< GUM_SCALAR >();
120  _empty_value = from._empty_value;
121  MultiDimDecorator< GUM_SCALAR >::content()->copy(*from.content());
122  return *this;
123  }
GUM_SCALAR _empty_value
value of the MultiDimDecorator if no dimension.
virtual const MultiDimImplementation< GUM_SCALAR > * content() const final
Returns the implementation for this object (may be *this).
MultiDimDecorator(MultiDimImplementation< GUM_SCALAR > *aContent=nullptr, GUM_SCALAR empty_value=(GUM_SCALAR) 0)
Class constructor.
MultiDimContainer & operator=(const MultiDimContainer< GUM_SCALAR > &src)
Default constructor.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
INLINE MultiDimDecorator< GUM_SCALAR > & gum::MultiDimDecorator< GUM_SCALAR >::operator= ( MultiDimDecorator< GUM_SCALAR > &&  from)

assignment operator.

Definition at line 85 of file multiDimDecorator_tpl.h.

References gum::MultiDimDecorator< GUM_SCALAR >::_content, gum::MultiDimDecorator< GUM_SCALAR >::_empty_value, and gum::MultiDimContainer< GUM_SCALAR >::operator=().

85  {
87  std::forward< MultiDimContainer< GUM_SCALAR > >(from));
88  GUM_OP_MOV(MultiDimDecorator);
89 
90  if (this != &from) {
91  if (_content != nullptr) delete (_content); // should be the case
92  _empty_value = from._empty_value;
93  _content = from._content;
94  from._content = nullptr;
95  }
96 
97  return *this;
98  }
MultiDimImplementation< GUM_SCALAR > * _content
The true container.
GUM_SCALAR _empty_value
value of the MultiDimDecorator if no dimension.
MultiDimDecorator(MultiDimImplementation< GUM_SCALAR > *aContent=nullptr, GUM_SCALAR empty_value=(GUM_SCALAR) 0)
Class constructor.
MultiDimContainer & operator=(const MultiDimContainer< GUM_SCALAR > &src)
Default constructor.

+ Here is the call graph for this function:

template<typename GUM_SCALAR >
bool gum::MultiDimContainer< GUM_SCALAR >::operator== ( const MultiDimContainer< GUM_SCALAR > &  p) const
inherited

Test if this MultiDimContainer is equal to p.

Parameters
pThe MultiDimContainer to test for equality.
Returns
Returns true if this MultiDimContainer is equal to p.

Definition at line 126 of file multiDimContainer_tpl.h.

References gum::MultiDimInterface::domainSize(), gum::Instantiation::end(), gum::MultiDimContainer< GUM_SCALAR >::get(), gum::MultiDimInterface::nbrDim(), gum::MultiDimContainer< GUM_SCALAR >::operator!=(), gum::Instantiation::setFirst(), and gum::MultiDimInterface::variablesSequence().

Referenced by gum::MultiDimContainer< GUM_SCALAR >::operator!=(), and gum::MultiDimContainer< GUM_SCALAR >::toString().

126  {
127  if ((nbrDim() == p.nbrDim()) && (domainSize() == p.domainSize())) {
128  if (nbrDim() == 0) return true;
129 
131  var_iterator;
132 
133  for (var_iterator iter = variablesSequence().beginSafe();
134  iter != variablesSequence().endSafe();
135  ++iter) {
136  if (!p.variablesSequence().exists(*iter)) { return false; }
137  }
138  } else {
139  return false;
140  }
141 
142  Instantiation i(*this);
143 
144  AlmostDifferent< GUM_SCALAR > cmp;
145 
146  for (i.setFirst(); !i.end(); ++i) {
147  if (cmp(get(i), p.get(i))) { return false; }
148  }
149 
150  return true;
151  }
virtual Idx nbrDim() const =0
Returns the number of vars in the multidimensional container.
virtual Size domainSize() const =0
Returns the product of the variables domain size.
virtual const Sequence< const DiscreteVariable * > & variablesSequence() const =0
Returns a const ref to the sequence of DiscreteVariable*.
SequenceIteratorSafe< Key > const_iterator_safe
Types for STL compliance.
Definition: sequence.h:1035

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
INLINE GUM_SCALAR gum::MultiDimContainer< GUM_SCALAR >::operator[] ( const Instantiation i) const
inherited

An [] operator using a Instantiation as argument.

Warning
If i variables set is disjoint with this MultiDimContainer then 0 is assumed for dimensions (i.e. variables) not prensent in the instantiation.
Parameters
iAn Instantiation.
Returns
Returns the adressed (GUM_SCALAR) value.

Definition at line 79 of file multiDimContainer_tpl.h.

Referenced by gum::MultiDimContainer< GUM_SCALAR >::~MultiDimContainer().

79  {
80  return get(i);
81  }

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
void gum::MultiDimDecorator< GUM_SCALAR >::populate ( const std::vector< GUM_SCALAR > &  v) const
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.

Size cpt = 0;
Instantiation i( *this );
for (i.setFirst(); !i.end(); ++i, ++cpt) {
set(i, v[cpt]);
}
Parameters
vVector of values.
Exceptions
SizeErrorRaised if v size's does not matches this MultiDimContainer domain size.

Reimplemented from gum::MultiDimContainer< GUM_SCALAR >.

Definition at line 318 of file multiDimDecorator_tpl.h.

References gum::MultiDimDecorator< GUM_SCALAR >::_content, gum::MultiDimDecorator< GUM_SCALAR >::_empty_value, gum::MultiDimDecorator< GUM_SCALAR >::empty(), and GUM_ERROR.

Referenced by gum::Potential< GUM_SCALAR >::fillWith(), and gum::SimpleUTGenerator::generateUT().

319  {
320  if (static_cast< MultiDimContainer< GUM_SCALAR >* >(_content)->empty()) {
321  if (v.size() == 1) {
322  _empty_value = v[0];
323  } else {
324  GUM_ERROR(SizeError, "Size do not match in populate")
325  }
326  } else {
327  _content->populate(v);
328  }
329  }
MultiDimImplementation< GUM_SCALAR > * _content
The true container.
GUM_SCALAR _empty_value
value of the MultiDimDecorator if no dimension.
virtual bool empty() const final
Returns true if no var is in *this.
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
void gum::MultiDimContainer< GUM_SCALAR >::populate ( std::initializer_list< GUM_SCALAR >  l) const
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.

Size cpt = 0;
Instantiation i( *this );
for (i.setFirst(); !i.end(); ++i, ++cpt) {
set(i, v[cpt]);
}
Parameters
lcontains the data.
Exceptions
SizeErrorRaised if l size's does not matches this MultiDimContainer domain size.

Reimplemented in gum::MultiDimBijArray< GUM_SCALAR >, gum::MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy >, gum::MultiDimFunctionGraph< GUM_SCALAR >, and gum::MultiDimFunctionGraph< GUM_SCALAR, ExactTerminalNodePolicy >.

Definition at line 178 of file multiDimContainer_tpl.h.

References gum::MultiDimInterface::domainSize(), and GUM_ERROR.

179  {
180  if (domainSize() != l.size()) {
181  GUM_ERROR(SizeError, "Sizes do not match in populate");
182  }
183 
184  Instantiation i(*this);
185  // insert all the elements
186  for (const auto& elt : l) {
187  set(i, elt);
188  ++i;
189  }
190  }
virtual Size domainSize() const =0
Returns the product of the variables domain size.
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66

+ Here is the call graph for this function:

template<typename GUM_SCALAR >
INLINE Idx gum::MultiDimDecorator< GUM_SCALAR >::pos ( const DiscreteVariable v) const
finalvirtual

Returns the index of a variable.

Parameters
vThe variable for which the index is returned.
Returns
Returns the index of a variable.
Exceptions
NotFoundRaised if v is not in this multidimensional matrix.

Implements gum::MultiDimInterface.

Definition at line 262 of file multiDimDecorator_tpl.h.

References gum::MultiDimDecorator< GUM_SCALAR >::_content.

Referenced by gum::credal::CredalNet< GUM_SCALAR >::approximatedBinarization().

262  {
263  return static_cast< MultiDimContainer< GUM_SCALAR >* >(_content)->pos(d);
264  }
MultiDimImplementation< GUM_SCALAR > * _content
The true container.
virtual Idx pos(const DiscreteVariable &var) const final
Returns the index of a variable.

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
GUM_SCALAR gum::MultiDimDecorator< GUM_SCALAR >::reduce ( std::function< GUM_SCALAR(GUM_SCALAR, GUM_SCALAR) >  f,
GUM_SCALAR  base 
) const
finalvirtual

compute lfold for this container

Parameters
fthe function to apply
basethe initial value

Reimplemented from gum::MultiDimContainer< GUM_SCALAR >.

Definition at line 342 of file multiDimDecorator_tpl.h.

References gum::MultiDimDecorator< GUM_SCALAR >::_content, and gum::MultiDimDecorator< GUM_SCALAR >::empty().

Referenced by gum::Potential< GUM_SCALAR >::entropy(), gum::Potential< GUM_SCALAR >::maxNonOne(), and gum::Potential< GUM_SCALAR >::minNonZero().

343  {
344  if (static_cast< MultiDimContainer< GUM_SCALAR >* >(_content)->empty()) {
345  return base;
346  } else {
347  return _content->reduce(f, base);
348  }
349  }
MultiDimImplementation< GUM_SCALAR > * _content
The true container.
virtual bool empty() const final
Returns true if no var is in *this.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
INLINE bool gum::MultiDimDecorator< GUM_SCALAR >::registerSlave ( Instantiation i)
finalvirtual

Register i as a slave of this MultiDimAdressable.

Parameters
iThe Instantiation to enslave.
Returns
Returns true if i becomes a slave of this MultiDimAdressable.

Implements gum::MultiDimAdressable.

Definition at line 237 of file multiDimDecorator_tpl.h.

References gum::MultiDimDecorator< GUM_SCALAR >::_content.

237  {
238  return static_cast< MultiDimContainer< GUM_SCALAR >* >(_content)
239  ->registerSlave(i);
240  }
MultiDimImplementation< GUM_SCALAR > * _content
The true container.
virtual bool registerSlave(Instantiation &i) final
Register i as a slave of this MultiDimAdressable.
INLINE void gum::MultiDimInterface::replace ( const DiscreteVariable x,
const DiscreteVariable y 
)
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.

Parameters
xThe variable in this which will be replaced.
yThe variable replacing y.
Exceptions
NotFoundRaised if x does not belong to this MultiDim.
OperationNotAllowedIf y and x are not interchangeable.
DuplicateElementIf y is already in this MultiDim.

Definition at line 33 of file multiDimInterface_inl.h.

References gum::MultiDimInterface::_replace(), gum::MultiDimInterface::contains(), gum::DiscreteVariable::domainSize(), and GUM_ERROR.

Referenced by gum::MultiDimBucket< GUM_SCALAR >::_replace(), and gum::MultiDimInterface::~MultiDimInterface().

34  {
35  if (!contains(x)) { GUM_ERROR(NotFound, "could not find the variable"); }
36 
37  if (contains(y)) {
38  GUM_ERROR(DuplicateElement, "variable already in MultiDim");
39  }
40 
41  if (x.domainSize() != y.domainSize()) {
42  GUM_ERROR(OperationNotAllowed, "incompatible variables");
43  }
44 
45  _replace(&x, &y);
46  }
virtual bool contains(const DiscreteVariable &v) const =0
Returns true if var is in *this.
virtual void _replace(const DiscreteVariable *x, const DiscreteVariable *y)=0
This is called by MultiDimContainer::replace() to proceed with the replacing between x and y...
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
INLINE void gum::MultiDimDecorator< GUM_SCALAR >::set ( const Instantiation i,
const GUM_SCALAR &  value 
) const
finalvirtual

Default implementation of MultiDimContainer::set().

Calls _get as a r-value.

Reimplemented from gum::MultiDimContainer< GUM_SCALAR >.

Definition at line 154 of file multiDimDecorator_tpl.h.

References gum::MultiDimDecorator< GUM_SCALAR >::_content, gum::MultiDimDecorator< GUM_SCALAR >::_empty_value, and gum::MultiDimDecorator< GUM_SCALAR >::nbrDim().

Referenced by gum::BayesNetFactory< GUM_SCALAR >::__fillProbaWithValuesTable(), gum::prm::PRMSystem< GUM_SCALAR >::__groundPotential(), gum::learning::DAG2BNLearner::__probaVarReordering(), gum::prm::GroundedInference< GUM_SCALAR >::_evidenceAdded(), gum::prm::StructuredInference< GUM_SCALAR >::_marginal(), gum::prm::PRMInference< GUM_SCALAR >::addEvidence(), gum::credal::CredalNet< GUM_SCALAR >::bnToCredal(), gum::BayesNetInference< GUM_SCALAR >::chgEvidence(), gum::MarginalTargetedInference< GUM_SCALAR >::evidenceImpact(), gum::JointTargetedInference< GUM_SCALAR >::evidenceJointImpact(), gum::credal::CredalNet< GUM_SCALAR >::fillConstraint(), gum::SimpleCPTGenerator< GUM_SCALAR >::generateCPT(), gum::credal::CredalNet< GUM_SCALAR >::idmLearning(), gum::prm::PRMInference< GUM_SCALAR >::marginal(), gum::prm::PRMInference< GUM_SCALAR >::operator=(), and gum::prm::PRMInference< GUM_SCALAR >::PRMInference().

155  {
156  if (static_cast< MultiDimContainer< GUM_SCALAR >* >(_content)->nbrDim() == 0) {
157  _empty_value = value;
158  } else {
159  static_cast< MultiDimContainer< GUM_SCALAR >* >(_content)->set(i, value);
160  }
161  }
virtual Idx nbrDim() const final
Returns the number of vars in the multidimensional container.
MultiDimImplementation< GUM_SCALAR > * _content
The true container.
GUM_SCALAR _empty_value
value of the MultiDimDecorator if no dimension.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
INLINE void gum::MultiDimDecorator< GUM_SCALAR >::setChangeNotification ( const Instantiation i)
finalvirtual

Listen to an assignment of a value in a Instantiation.

Parameters
iThe Instantiation to listen.

Implements gum::MultiDimAdressable.

Definition at line 192 of file multiDimDecorator_tpl.h.

References gum::MultiDimDecorator< GUM_SCALAR >::_content.

193  {
194  static_cast< MultiDimContainer< GUM_SCALAR >* >(_content)
196  }
MultiDimImplementation< GUM_SCALAR > * _content
The true container.
virtual void setChangeNotification(const Instantiation &i) final
Listen to an assignment of a value in a Instantiation.
template<typename GUM_SCALAR >
INLINE void gum::MultiDimDecorator< GUM_SCALAR >::setDecNotification ( const Instantiation i)
finalvirtual

Listen to increment in each recorded Instantiation.

Parameters
iThe Instantiation to listen.

Implements gum::MultiDimAdressable.

Definition at line 229 of file multiDimDecorator_tpl.h.

References gum::MultiDimDecorator< GUM_SCALAR >::_content.

229  {
230  static_cast< MultiDimContainer< GUM_SCALAR >* >(_content)->setDecNotification(
231  i);
232  }
MultiDimImplementation< GUM_SCALAR > * _content
The true container.
virtual void setDecNotification(const Instantiation &i) final
Listen to increment in each recorded Instantiation.
template<typename GUM_SCALAR >
INLINE void gum::MultiDimDecorator< GUM_SCALAR >::setFirstNotification ( const Instantiation i)
finalvirtual

Listen to setFirst in a given Instantiation.

Parameters
iThe Instantiation to listen.

Implements gum::MultiDimAdressable.

Definition at line 202 of file multiDimDecorator_tpl.h.

References gum::MultiDimDecorator< GUM_SCALAR >::_content.

202  {
203  static_cast< MultiDimContainer< GUM_SCALAR >* >(_content)
205  }
MultiDimImplementation< GUM_SCALAR > * _content
The true container.
virtual void setFirstNotification(const Instantiation &i) final
Listen to setFirst in a given Instantiation.
template<typename GUM_SCALAR >
INLINE void gum::MultiDimDecorator< GUM_SCALAR >::setIncNotification ( const Instantiation i)
finalvirtual

Listen to increment in a given Instantiation.

Parameters
iThe Instantiation to listen.

Implements gum::MultiDimAdressable.

Definition at line 220 of file multiDimDecorator_tpl.h.

References gum::MultiDimDecorator< GUM_SCALAR >::_content.

220  {
221  static_cast< MultiDimContainer< GUM_SCALAR >* >(_content)->setIncNotification(
222  i);
223  }
MultiDimImplementation< GUM_SCALAR > * _content
The true container.
virtual void setIncNotification(const Instantiation &i) final
Listen to increment in a given Instantiation.
template<typename GUM_SCALAR >
INLINE void gum::MultiDimDecorator< GUM_SCALAR >::setLastNotification ( const Instantiation i)
finalvirtual

Listen to setLast in a given Instantiation.

Parameters
iThe Instantiation to listen.

Implements gum::MultiDimAdressable.

Definition at line 211 of file multiDimDecorator_tpl.h.

References gum::MultiDimDecorator< GUM_SCALAR >::_content.

211  {
212  static_cast< MultiDimContainer< GUM_SCALAR >* >(_content)->setLastNotification(
213  i);
214  }
MultiDimImplementation< GUM_SCALAR > * _content
The true container.
virtual void setLastNotification(const Instantiation &i) final
Listen to setLast in a given Instantiation.
template<typename GUM_SCALAR >
INLINE const std::string gum::MultiDimDecorator< GUM_SCALAR >::toString ( const Instantiation i) const
virtual

Default implementation of MultiDimContainer::set().

Calls _get as a r-value.

Implements gum::MultiDimContainer< GUM_SCALAR >.

Definition at line 401 of file multiDimDecorator_tpl.h.

References gum::MultiDimDecorator< GUM_SCALAR >::_content.

401  {
402  return _content->toString(i);
403  }
MultiDimImplementation< GUM_SCALAR > * _content
The true container.
template<typename GUM_SCALAR >
INLINE const std::string gum::MultiDimDecorator< GUM_SCALAR >::toString ( ) const
virtual

Default implementation of MultiDimContainer::set().

Calls _get as a r-value.

Reimplemented from gum::MultiDimContainer< GUM_SCALAR >.

Reimplemented in gum::Potential< GUM_SCALAR >.

Definition at line 414 of file multiDimDecorator_tpl.h.

References gum::MultiDimDecorator< GUM_SCALAR >::_content, gum::MultiDimDecorator< GUM_SCALAR >::_empty_value, and gum::MultiDimDecorator< GUM_SCALAR >::empty().

Referenced by gum::Potential< GUM_SCALAR >::toString().

414  {
415  if (static_cast< MultiDimContainer< GUM_SCALAR >* >(_content)->empty()) {
416  std::stringstream ss;
417  ss << "<> :: " << _empty_value;
418  return ss.str();
419  } else {
420  return _content->toString();
421  }
422  }
MultiDimImplementation< GUM_SCALAR > * _content
The true container.
GUM_SCALAR _empty_value
value of the MultiDimDecorator if no dimension.
virtual bool empty() const final
Returns true if no var is in *this.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
INLINE bool gum::MultiDimDecorator< GUM_SCALAR >::unregisterSlave ( Instantiation i)
finalvirtual

Unregister i as a slave of this MultiDimAdressable.

Parameters
iThe Instantiation to free.
Returns
Returns true, whatever happens.

Implements gum::MultiDimAdressable.

Definition at line 279 of file multiDimDecorator_tpl.h.

References gum::MultiDimDecorator< GUM_SCALAR >::_content.

279  {
280  return static_cast< MultiDimContainer< GUM_SCALAR >* >(_content)
281  ->unregisterSlave(i);
282  }
MultiDimImplementation< GUM_SCALAR > * _content
The true container.
virtual bool unregisterSlave(Instantiation &i) final
Unregister i as a slave of this MultiDimAdressable.
template<typename GUM_SCALAR >
INLINE const DiscreteVariable & gum::MultiDimDecorator< GUM_SCALAR >::variable ( Idx  i) const
finalvirtual

Returns a const ref to the ith var.

param i An index of this multidimensional matrix.

Returns
Returns a const ref to the ith var.
Exceptions
NotFoundRaised if i does not reference a variable in this multidimensional matrix.

Implements gum::MultiDimInterface.

Definition at line 249 of file multiDimDecorator_tpl.h.

References gum::MultiDimDecorator< GUM_SCALAR >::_content.

Referenced by gum::BayesNetFactory< GUM_SCALAR >::__fillProbaWithValuesTable(), gum::credal::CredalNet< GUM_SCALAR >::__intervalToCredal(), gum::BayesNet< GUM_SCALAR >::changePotential(), gum::BayesNetInference< GUM_SCALAR >::chgEvidence(), gum::Potential< GUM_SCALAR >::draw(), gum::Potential< GUM_SCALAR >::fillWith(), gum::SimpleCPTGenerator< GUM_SCALAR >::generateCPT(), gum::BayesNetFragment< GUM_SCALAR >::installCPT(), gum::BayesNetFragment< GUM_SCALAR >::installMarginal(), gum::credal::CredalNet< GUM_SCALAR >::intervalToCredal(), gum::credal::CredalNet< GUM_SCALAR >::intervalToCredalWithFiles(), gum::credal::CredalNet< GUM_SCALAR >::lagrangeNormalization(), gum::Potential< GUM_SCALAR >::normalizeAsCPT(), gum::Potential< GUM_SCALAR >::putFirst(), gum::credal::CredalNet< GUM_SCALAR >::setCPT(), gum::credal::CredalNet< GUM_SCALAR >::setCPTs(), gum::BayesNetFragment< GUM_SCALAR >::uninstallCPT(), and gum::MultiDimDecorator< GUM_SCALAR >::variable().

249  {
250  return static_cast< MultiDimContainer< GUM_SCALAR >* >(_content)->variable(i);
251  }
MultiDimImplementation< GUM_SCALAR > * _content
The true container.
virtual const DiscreteVariable & variable(Idx) const final
Returns a const ref to the ith var.

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
INLINE const DiscreteVariable & gum::MultiDimDecorator< GUM_SCALAR >::variable ( const std::string &  name) const
finalvirtual

Returns the variable with the name.

Parameters
nameThe index of the variable
Returns
Returns the variable qith the name in the tuple. This function is not O(1)
Exceptions
NotFoundRaised if the element cannot be found.

Implements gum::MultiDimInterface.

Definition at line 255 of file multiDimDecorator_tpl.h.

References gum::MultiDimDecorator< GUM_SCALAR >::_content, and gum::MultiDimDecorator< GUM_SCALAR >::variable().

255  {
256  return static_cast< MultiDimContainer< GUM_SCALAR >* >(_content)->variable(
257  name);
258  }
MultiDimImplementation< GUM_SCALAR > * _content
The true container.
virtual const DiscreteVariable & variable(Idx) const final
Returns a const ref to the ith var.

+ Here is the call graph for this function:

template<typename GUM_SCALAR >
INLINE const Sequence< const DiscreteVariable * > & gum::MultiDimDecorator< GUM_SCALAR >::variablesSequence ( ) const
finalvirtual

Returns a const ref to the sequence of DiscreteVariable*.

Returns
Returns a const ref to the sequence of DiscreteVariable*.

Implements gum::MultiDimInterface.

Definition at line 305 of file multiDimDecorator_tpl.h.

References gum::MultiDimDecorator< GUM_SCALAR >::_content.

Referenced by gum::prm::StructuredInference< GUM_SCALAR >::__buildPatternGraph(), gum::prm::__print_pot__(), gum::learning::DAG2BNLearner::__probaVarReordering(), gum::BayesNetFactory< GUM_SCALAR >::__setCPTAndParents(), gum::Potential< GUM_SCALAR >::_complementVars(), gum::prm::SVED< GUM_SCALAR >::_marginal(), gum::prm::StructuredInference< GUM_SCALAR >::_marginal(), gum::learning::DAG2BNLearner::createBN(), gum::credal::CredalNet< GUM_SCALAR >::fillConstraint(), gum::Potential< GUM_SCALAR >::fillWith(), and gum::Potential< GUM_SCALAR >::KL().

305  {
306  return static_cast< MultiDimContainer< GUM_SCALAR >* >(_content)
307  ->variablesSequence();
308  }
MultiDimImplementation< GUM_SCALAR > * _content
The true container.
virtual const Sequence< const DiscreteVariable * > & variablesSequence() const final
Returns a const ref to the sequence of DiscreteVariable*.

+ Here is the caller graph for this function:

Member Data Documentation

template<typename GUM_SCALAR>
MultiDimImplementation< GUM_SCALAR >* gum::MultiDimDecorator< GUM_SCALAR >::_content
mutableprotected

The true container.

Definition at line 247 of file multiDimDecorator.h.

Referenced by gum::MultiDimDecorator< GUM_SCALAR >::_swapContent(), gum::MultiDimDecorator< GUM_SCALAR >::add(), gum::MultiDimDecorator< GUM_SCALAR >::apply(), gum::MultiDimDecorator< GUM_SCALAR >::beginMultipleChanges(), gum::MultiDimDecorator< GUM_SCALAR >::changeNotification(), gum::MultiDimDecorator< GUM_SCALAR >::contains(), gum::MultiDimDecorator< GUM_SCALAR >::content(), gum::MultiDimDecorator< GUM_SCALAR >::domainSize(), gum::MultiDimDecorator< GUM_SCALAR >::empty(), gum::MultiDimDecorator< GUM_SCALAR >::endMultipleChanges(), gum::Potential< GUM_SCALAR >::entropy(), gum::MultiDimDecorator< GUM_SCALAR >::erase(), gum::MultiDimDecorator< GUM_SCALAR >::fill(), gum::Potential< GUM_SCALAR >::findAll(), gum::MultiDimDecorator< GUM_SCALAR >::get(), gum::Potential< GUM_SCALAR >::margMaxIn(), gum::Potential< GUM_SCALAR >::margMaxOut(), gum::Potential< GUM_SCALAR >::margMinIn(), gum::Potential< GUM_SCALAR >::margMinOut(), gum::Potential< GUM_SCALAR >::margProdIn(), gum::Potential< GUM_SCALAR >::margProdOut(), gum::Potential< GUM_SCALAR >::margSumIn(), gum::Potential< GUM_SCALAR >::margSumOut(), gum::Potential< GUM_SCALAR >::max(), gum::Potential< GUM_SCALAR >::maxNonOne(), gum::Potential< GUM_SCALAR >::min(), gum::Potential< GUM_SCALAR >::minNonZero(), gum::MultiDimDecorator< GUM_SCALAR >::MultiDimDecorator(), gum::MultiDimDecorator< GUM_SCALAR >::nbrDim(), gum::Potential< GUM_SCALAR >::normalize(), gum::Potential< GUM_SCALAR >::normalizeAsCPT(), gum::MultiDimDecorator< GUM_SCALAR >::operator=(), gum::Potential< GUM_SCALAR >::operator==(), gum::MultiDimDecorator< GUM_SCALAR >::populate(), gum::MultiDimDecorator< GUM_SCALAR >::pos(), gum::Potential< GUM_SCALAR >::product(), gum::MultiDimDecorator< GUM_SCALAR >::reduce(), gum::MultiDimDecorator< GUM_SCALAR >::registerSlave(), gum::MultiDimDecorator< GUM_SCALAR >::set(), gum::MultiDimDecorator< GUM_SCALAR >::setChangeNotification(), gum::MultiDimDecorator< GUM_SCALAR >::setDecNotification(), gum::MultiDimDecorator< GUM_SCALAR >::setFirstNotification(), gum::MultiDimDecorator< GUM_SCALAR >::setIncNotification(), gum::MultiDimDecorator< GUM_SCALAR >::setLastNotification(), gum::Potential< GUM_SCALAR >::sum(), gum::MultiDimDecorator< GUM_SCALAR >::toString(), gum::MultiDimDecorator< GUM_SCALAR >::unregisterSlave(), gum::MultiDimDecorator< GUM_SCALAR >::variable(), gum::MultiDimDecorator< GUM_SCALAR >::variablesSequence(), and gum::MultiDimDecorator< GUM_SCALAR >::~MultiDimDecorator().

template<typename GUM_SCALAR>
GUM_SCALAR gum::MultiDimDecorator< GUM_SCALAR >::_empty_value
mutableprotected

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