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 >
98 from._content =
nullptr;
105 template <
typename GUM_SCALAR >
109 std::forward< MultiDimContainer< GUM_SCALAR > >(from)) {
114 from._content =
nullptr;
118 template <
typename GUM_SCALAR >
123 ___initPotentialOperators< GUM_SCALAR >();
133 template <
typename GUM_SCALAR >
142 template <
typename GUM_SCALAR >
148 template <
typename GUM_SCALAR >
158 template <
typename GUM_SCALAR >
160 const GUM_SCALAR& value)
const {
170 template <
typename GUM_SCALAR >
177 template <
typename GUM_SCALAR >
181 "Empty variable " << v <<
" cannot be added in a Potential");
188 template <
typename GUM_SCALAR >
195 i, var, oldval, newval);
200 template <
typename GUM_SCALAR >
209 template <
typename GUM_SCALAR >
218 template <
typename GUM_SCALAR >
227 template <
typename GUM_SCALAR >
236 template <
typename GUM_SCALAR >
245 template <
typename GUM_SCALAR >
251 template <
typename GUM_SCALAR >
256 template <
typename GUM_SCALAR >
261 template <
typename GUM_SCALAR >
267 template <
typename GUM_SCALAR >
274 template <
typename GUM_SCALAR >
280 template <
typename GUM_SCALAR >
286 template <
typename GUM_SCALAR >
288 if (
_content ==
nullptr)
return true;
292 template <
typename GUM_SCALAR >
298 template <
typename GUM_SCALAR >
309 template <
typename GUM_SCALAR >
317 template <
typename GUM_SCALAR >
326 template <
typename GUM_SCALAR >
331 template <
typename GUM_SCALAR >
333 const std::vector< GUM_SCALAR >& v)
const {
345 template <
typename GUM_SCALAR >
347 std::function< GUM_SCALAR(GUM_SCALAR) > f)
const {
355 template <
typename GUM_SCALAR >
357 std::function< GUM_SCALAR(GUM_SCALAR, GUM_SCALAR) > f,
358 GUM_SCALAR base)
const {
367 template <
typename GUM_SCALAR >
374 template <
typename GUM_SCALAR >
380 template <
typename GUM_SCALAR >
386 template <
typename GUM_SCALAR >
392 template <
typename GUM_SCALAR >
399 template <
typename GUM_SCALAR >
402 if (aContent !=
nullptr) {
414 template <
typename GUM_SCALAR >
415 INLINE
const std::string
421 template <
typename GUM_SCALAR >
425 this->
content()->replace(*x, *y);
428 template <
typename GUM_SCALAR >
431 std::stringstream ss;
a class used to register projections over non-pointers types
Copyright 2005-2020 Pierre-Henri WUILLEMIN () et Christophe GONZALES () info_at_agrum_dot_org.
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-2020 Pierre-Henri WUILLEMIN () et Christophe GONZALES () info_at_agrum_dot_org.
Copyright 2005-2020 Pierre-Henri WUILLEMIN () et Christophe GONZALES () info_at_agrum_dot_org.
MultiDimDecorator< GUM_SCALAR > & operator=(const MultiDimDecorator &from) noexcept
copy operator
Base class for discrete random variable.
Copyright 2005-2020 Pierre-Henri WUILLEMIN () et Christophe GONZALES () info_at_agrum_dot_org.
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-2020 Pierre-Henri WUILLEMIN () et Christophe GONZALES () info_at_agrum_dot_org.
Copyright 2005-2020 Pierre-Henri WUILLEMIN () et Christophe GONZALES () info_at_agrum_dot_org.
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/tools/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.