37 template <
typename GUM_SCALAR >
39 static bool first =
true;
63 template <
typename GUM_SCALAR >
67 _empty_value(empty_value) {
68 ___initPotentialOperators< GUM_SCALAR >();
72 template <
typename GUM_SCALAR >
77 ___initPotentialOperators< GUM_SCALAR >();
83 template <
typename GUM_SCALAR >
94 from._content =
nullptr;
101 template <
typename GUM_SCALAR >
105 std::forward< MultiDimContainer< GUM_SCALAR > >(from)) {
110 from._content =
nullptr;
114 template <
typename GUM_SCALAR >
118 ___initPotentialOperators< GUM_SCALAR >();
128 template <
typename GUM_SCALAR >
137 template <
typename GUM_SCALAR >
143 template <
typename GUM_SCALAR >
153 template <
typename GUM_SCALAR >
155 const GUM_SCALAR& value)
const {
165 template <
typename GUM_SCALAR >
172 template <
typename GUM_SCALAR >
176 "Empty variable " << v <<
" cannot be added in a Potential");
183 template <
typename GUM_SCALAR >
190 i, var, oldval, newval);
195 template <
typename GUM_SCALAR >
204 template <
typename GUM_SCALAR >
213 template <
typename GUM_SCALAR >
222 template <
typename GUM_SCALAR >
231 template <
typename GUM_SCALAR >
240 template <
typename GUM_SCALAR >
246 template <
typename GUM_SCALAR >
251 template <
typename GUM_SCALAR >
257 template <
typename GUM_SCALAR >
264 template <
typename GUM_SCALAR >
270 template <
typename GUM_SCALAR >
276 template <
typename GUM_SCALAR >
278 if (
_content ==
nullptr)
return true;
282 template <
typename GUM_SCALAR >
288 template <
typename GUM_SCALAR >
299 template <
typename GUM_SCALAR >
307 template <
typename GUM_SCALAR >
316 template <
typename GUM_SCALAR >
321 template <
typename GUM_SCALAR >
323 const std::vector< GUM_SCALAR >& v)
const {
335 template <
typename GUM_SCALAR >
337 std::function< GUM_SCALAR(GUM_SCALAR) > f)
const {
345 template <
typename GUM_SCALAR >
347 std::function< GUM_SCALAR(GUM_SCALAR, GUM_SCALAR) > f,
348 GUM_SCALAR base)
const {
357 template <
typename GUM_SCALAR >
364 template <
typename GUM_SCALAR >
370 template <
typename GUM_SCALAR >
376 template <
typename GUM_SCALAR >
382 template <
typename GUM_SCALAR >
389 template <
typename GUM_SCALAR >
392 if (aContent !=
nullptr) {
404 template <
typename GUM_SCALAR >
405 INLINE
const std::string
411 template <
typename GUM_SCALAR >
415 this->
content()->replace(*x, *y);
418 template <
typename GUM_SCALAR >
421 std::stringstream ss;
a class used to register projections over non-pointers types
Headers for partial instantiation functions.
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.
Efficient functionals for combining multiDims.
Efficient functionals for projecting multidim tables over all their variables.
MultiDimDecorator< GUM_SCALAR > & operator=(const MultiDimDecorator &from) noexcept
copy operator
Base class for discrete random variable.
gum is the global namespace for all aGrUM entities
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.
Efficient functionals for projecting multiDimensional tables.
Headers for MultiDimDecorator.
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.