61 template <
typename GUM_SCALAR >
64 static std::once_flag first;
65 std::call_once(first, []() {
85 template <
typename GUM_SCALAR >
93 template <
typename GUM_SCALAR >
102 template <
typename GUM_SCALAR >
113 from.content_ =
nullptr;
119 template <
typename GUM_SCALAR >
127 from.content_ =
nullptr;
130 template <
typename GUM_SCALAR >
145 template <
typename GUM_SCALAR >
154 template <
typename GUM_SCALAR >
159 template <
typename GUM_SCALAR >
168 template <
typename GUM_SCALAR >
170 const GUM_SCALAR& value)
const {
180 template <
typename GUM_SCALAR >
187 template <
typename GUM_SCALAR >
197 template <
typename GUM_SCALAR >
210 template <
typename GUM_SCALAR >
217 template <
typename GUM_SCALAR >
224 template <
typename GUM_SCALAR >
231 template <
typename GUM_SCALAR >
238 template <
typename GUM_SCALAR >
245 template <
typename GUM_SCALAR >
250 template <
typename GUM_SCALAR >
255 template <
typename GUM_SCALAR >
260 template <
typename GUM_SCALAR >
265 template <
typename GUM_SCALAR >
271 template <
typename GUM_SCALAR >
276 template <
typename GUM_SCALAR >
281 template <
typename GUM_SCALAR >
283 if (
content_ ==
nullptr)
return true;
287 template <
typename GUM_SCALAR >
292 template <
typename GUM_SCALAR >
303 template <
typename GUM_SCALAR >
311 template <
typename GUM_SCALAR >
319 template <
typename GUM_SCALAR >
324 template <
typename GUM_SCALAR >
337 template <
typename GUM_SCALAR >
346 template <
typename GUM_SCALAR >
349 GUM_SCALAR base)
const {
358 template <
typename GUM_SCALAR >
364 template <
typename GUM_SCALAR >
370 template <
typename GUM_SCALAR >
375 template <
typename GUM_SCALAR >
380 template <
typename GUM_SCALAR >
385 template <
typename GUM_SCALAR >
388 if (aContent !=
nullptr) {
399 template <
typename GUM_SCALAR >
404 template <
typename GUM_SCALAR >
407 this->
content()->replace(*x, *y);
410 template <
typename GUM_SCALAR >
413 std::stringstream ss;
Base class for discrete random variable.
virtual Size domainSize() const =0
Class for assigning/browsing values to tuples of discrete variables.
Exception: at least one argument passed to a function is not what was expected.
MultiDimContainer & operator=(const MultiDimContainer< GUM_SCALAR > &src)
Default constructor.
MultiDimContainer()
Default constructor.
Decorator design pattern in order to separate implementations from multidimensional matrix concepts.
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 const Sequence< const DiscreteVariable * > & variablesSequence() const final
Returns a const ref to the sequence of DiscreteVariable*.
virtual void setLastNotification(const Instantiation &i) final
Listen to setLast in a given Instantiation.
virtual void setDecNotification(const Instantiation &i) final
Listen to increment in each recorded Instantiation.
GUM_SCALAR empty_value_
value of the MultiDimDecorator if no dimension.
MultiDimDecorator< GUM_SCALAR > & operator=(const MultiDimDecorator &from) noexcept
copy operator
~MultiDimDecorator()
Class destructor.
virtual GUM_SCALAR reduce(std::function< GUM_SCALAR(GUM_SCALAR, GUM_SCALAR) > f, GUM_SCALAR base) const final
compute lfold for this container
virtual Idx pos(const DiscreteVariable &var) const final
Returns the index of a variable.
virtual bool empty() const final
Returns true if no var is in *this.
virtual std::string toString() const
Default implementation of MultiDimContainer::set().
virtual Idx nbrDim() const final
Returns the number of vars in the multidimensional container.
MultiDimDecorator(MultiDimImplementation< GUM_SCALAR > *aContent=nullptr, GUM_SCALAR empty_value=(GUM_SCALAR) 0)
Class constructor.
virtual void endMultipleChanges() final
Default implementation of MultiDimContainer::set().
virtual void erase(const DiscreteVariable &var) final
Removes a var from the variables of the multidimensional matrix.
virtual GUM_SCALAR get(const Instantiation &i) const final
Default implementation of MultiDimContainer::get().
virtual void populate(const std::vector< GUM_SCALAR > &v) const final
Automatically fills this MultiDimContainer with the values in v.
virtual bool unregisterSlave(Instantiation &i) final
Unregister i as a slave of this MultiDimAdressable.
MultiDimImplementation< GUM_SCALAR > * content_
The true container.
virtual bool registerSlave(Instantiation &i) final
Register i as a slave of this MultiDimAdressable.
virtual void add(const DiscreteVariable &v) final
Adds a new var to the variables of the multidimensional matrix.
virtual void setFirstNotification(const Instantiation &i) final
Listen to setFirst in a given Instantiation.
virtual bool contains(const DiscreteVariable &var) const final
Returns true if var is in *this.
virtual void changeNotification(const Instantiation &i, const DiscreteVariable *const var, Idx oldval, Idx newval) final
Listen to changes 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
protected method to swap the implementation behind the Tensor
virtual void beginMultipleChanges() final
Default implementation of MultiDimContainer::set().
virtual void fill(const GUM_SCALAR &d) const final
Default implementation of MultiDimContainer::set().
virtual void setChangeNotification(const Instantiation &i) final
Listen to an assignment of a value in a Instantiation.
virtual Size domainSize() const final
Returns the product of the variables domain size.
virtual void notifyChange() const final
virtual const MultiDimImplementation< GUM_SCALAR > * content() const final
Returns the implementation for this object (may be *this).
virtual MultiDimDecorator< GUM_SCALAR > * newFactory() const =0
Default implementation of MultiDimContainer::set().
virtual void setIncNotification(const Instantiation &i) final
Listen to increment in a given Instantiation.
virtual const DiscreteVariable & variable(Idx) const final
Returns a const ref to the ith var.
virtual void set(const Instantiation &i, const GUM_SCALAR &value) const final
Default implementation of MultiDimContainer::set().
GUM_SCALAR & get_(const Instantiation &i) const final
Return a data, given a Instantiation - final method.
<agrum/base/multidim/multiDimImplementation.h>
Exception : operation not allowed.
The generic class for storing (ordered) sequences of objects.
Exception : problem with size.
Efficient functionals for projecting multidim tables over all their variables.
#define GUM_ERROR(type, msg)
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Size Idx
Type for indexes.
Headers for MultiDimDecorator.
gum is the global namespace for all aGrUM entities
void _initTensorOperators__()
Efficient functionals for combining multiDims.
Headers for partial instantiation functions.
Efficient functionals for projecting multiDimensional tables.
a class used to register complete projections over non-pointers types
a class used to register operators over non-pointers types
A class used to register instantiation functions over non-pointers types.
void init()
Initialize the partial instantiation functions.
a class used to register projections over non-pointers types