40 template <
typename GUM_SCALAR >
42 static bool first =
true;
66 template <
typename GUM_SCALAR >
70 _empty_value(empty_value) {
71 ___initPotentialOperators< GUM_SCALAR >();
75 template <
typename GUM_SCALAR >
80 ___initPotentialOperators< GUM_SCALAR >();
86 template <
typename GUM_SCALAR >
97 from._content =
nullptr;
104 template <
typename GUM_SCALAR >
108 std::forward< MultiDimContainer< GUM_SCALAR > >(from)) {
113 from._content =
nullptr;
117 template <
typename GUM_SCALAR >
121 ___initPotentialOperators< GUM_SCALAR >();
131 template <
typename GUM_SCALAR >
140 template <
typename GUM_SCALAR >
146 template <
typename GUM_SCALAR >
156 template <
typename GUM_SCALAR >
158 const GUM_SCALAR& value)
const {
168 template <
typename GUM_SCALAR >
175 template <
typename GUM_SCALAR >
179 "Empty variable " << v <<
" cannot be added in a Potential");
186 template <
typename GUM_SCALAR >
193 i, var, oldval, newval);
198 template <
typename GUM_SCALAR >
207 template <
typename GUM_SCALAR >
216 template <
typename GUM_SCALAR >
225 template <
typename GUM_SCALAR >
234 template <
typename GUM_SCALAR >
243 template <
typename GUM_SCALAR >
249 template <
typename GUM_SCALAR >
254 template <
typename GUM_SCALAR >
260 template <
typename GUM_SCALAR >
267 template <
typename GUM_SCALAR >
273 template <
typename GUM_SCALAR >
279 template <
typename GUM_SCALAR >
281 if (
_content ==
nullptr)
return true;
285 template <
typename GUM_SCALAR >
291 template <
typename GUM_SCALAR >
302 template <
typename GUM_SCALAR >
310 template <
typename GUM_SCALAR >
319 template <
typename GUM_SCALAR >
324 template <
typename GUM_SCALAR >
326 const std::vector< GUM_SCALAR >& v)
const {
338 template <
typename GUM_SCALAR >
340 std::function< GUM_SCALAR(GUM_SCALAR) > f)
const {
348 template <
typename GUM_SCALAR >
350 std::function< GUM_SCALAR(GUM_SCALAR, GUM_SCALAR) > f,
351 GUM_SCALAR base)
const {
360 template <
typename GUM_SCALAR >
367 template <
typename GUM_SCALAR >
373 template <
typename GUM_SCALAR >
379 template <
typename GUM_SCALAR >
385 template <
typename GUM_SCALAR >
392 template <
typename GUM_SCALAR >
395 if (aContent !=
nullptr) {
407 template <
typename GUM_SCALAR >
408 INLINE
const std::string
414 template <
typename GUM_SCALAR >
418 this->
content()->replace(*x, *y);
421 template <
typename GUM_SCALAR >
424 std::stringstream ss;
a class used to register projections over non-pointers types
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
void init()
Initialize the partial instantiation functions.
virtual void beginMultipleChanges() final
Default implementation of MultiDimContainer::set().
virtual Idx nbrDim() const final
Returns the number of vars in the multidimensional container.
MultiDimImplementation< GUM_SCALAR > * _content
The true container.
virtual Size domainSize() const final
Returns the product of the variables domain size.
virtual const std::string toString() const
Default implementation of MultiDimContainer::set().
virtual bool unregisterSlave(Instantiation &i) final
Unregister i as a slave of this MultiDimAdressable.
GUM_SCALAR & _get(const Instantiation &i) const final
Return a data, given a Insantiation - final method.
virtual GUM_SCALAR get(const Instantiation &i) const final
Default implementation of MultiDimContainer::get().
The generic class for storing (ordered) sequences of objects.
virtual void erase(const DiscreteVariable &var) final
Removes a var from the variables of the multidimensional matrix.
GUM_SCALAR _empty_value
value of the MultiDimDecorator if no dimension.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
MultiDimDecorator< GUM_SCALAR > & operator=(const MultiDimDecorator &from) noexcept
copy operator
Base class for discrete random variable.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Abstract base class for all multi dimensionnal containers.
a class used to register operators over non-pointers typesThis class is of course completely redundan...
virtual void changeNotification(const Instantiation &i, const DiscreteVariable *const var, Idx oldval, Idx newval) final
Listen to changes in a given Instantiation.
virtual void _replace(const DiscreteVariable *x, const DiscreteVariable *y)
This is called by MultiDimContainer::replace() to proceed with the replacing between x and y...
virtual bool empty() const final
Returns true if no var is in *this.
virtual const MultiDimImplementation< GUM_SCALAR > * content() const final
Returns the implementation for this object (may be *this).
virtual void populate(const std::vector< GUM_SCALAR > &v) const final
Automatically fills this MultiDimContainer with the values in v.
virtual Size domainSize() const =0
virtual void setLastNotification(const Instantiation &i) final
Listen to setLast in a given Instantiation.
MultiDimDecorator(MultiDimImplementation< GUM_SCALAR > *aContent=nullptr, GUM_SCALAR empty_value=(GUM_SCALAR) 0)
Class constructor.
virtual void setFirstNotification(const Instantiation &i) final
Listen to setFirst in a given Instantiation.
virtual void apply(std::function< GUM_SCALAR(GUM_SCALAR) > f) const final
Apply a function on every element of the container.
void _swapContent(MultiDimImplementation< GUM_SCALAR > *aContent) const
protecte method to swap the implementation behind the Potential
virtual bool registerSlave(Instantiation &i) final
Register i as a slave of this MultiDimAdressable.
virtual void endMultipleChanges() final
Default implementation of MultiDimContainer::set().
virtual GUM_SCALAR reduce(std::function< GUM_SCALAR(GUM_SCALAR, GUM_SCALAR) > f, GUM_SCALAR base) const final
compute lfold for this container
virtual void notifyChange() const final
virtual const DiscreteVariable & variable(Idx) const final
Returns a const ref to the ith var.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
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.
Class for assigning/browsing values to tuples of discrete variables.
virtual Idx pos(const DiscreteVariable &var) const final
Returns the index of a variable.
Decorator design pattern in order to separate implementations from multidimensional matrix concepts...
virtual void add(const DiscreteVariable &v) final
Adds a new var to the variables of the multidimensional matrix.
virtual void set(const Instantiation &i, const GUM_SCALAR &value) const final
Default implementation of MultiDimContainer::set().
<agrum/multidim/multiDimImplementation.h>
Size Idx
Type for indexes.
virtual void fill(const GUM_SCALAR &d) const final
Default implementation of MultiDimContainer::set().
std::size_t Size
In aGrUM, hashed values are unsigned long int.
~MultiDimDecorator()
Class destructor.
virtual const Sequence< const DiscreteVariable *> & variablesSequence() const final
Returns a const ref to the sequence of DiscreteVariable*.
virtual void setChangeNotification(const Instantiation &i) final
Listen to an assignment of a value in a Instantiation.
void ___initPotentialOperators()
virtual bool contains(const DiscreteVariable &var) const final
Returns true if var is in *this.
A class used to register instantiation functions over non-pointers types.
#define GUM_ERROR(type, msg)
a class used to register complete projections over non-pointers typesThis class is of course complete...
MultiDimContainer & operator=(const MultiDimContainer< GUM_SCALAR > &src)
Default constructor.