62 template <
typename GUM_ELEMENT >
65 static std::once_flag first;
66 std::call_once(first, []() {
86 template <
typename GUM_ELEMENT >
94 template <
typename GUM_ELEMENT >
103 template <
typename GUM_ELEMENT >
114 from.content_ =
nullptr;
120 template <
typename GUM_ELEMENT >
128 from.content_ =
nullptr;
131 template <
typename GUM_ELEMENT >
147 template <
typename GUM_ELEMENT >
156 template <
typename GUM_ELEMENT >
161 template <
typename GUM_ELEMENT >
170 template <
typename GUM_ELEMENT >
172 const GUM_ELEMENT& value)
const {
182 template <
typename GUM_ELEMENT >
189 template <
typename GUM_ELEMENT >
199 template <
typename GUM_ELEMENT >
212 template <
typename GUM_ELEMENT >
219 template <
typename GUM_ELEMENT >
226 template <
typename GUM_ELEMENT >
233 template <
typename GUM_ELEMENT >
240 template <
typename GUM_ELEMENT >
247 template <
typename GUM_ELEMENT >
252 template <
typename GUM_ELEMENT >
257 template <
typename GUM_ELEMENT >
262 template <
typename GUM_ELEMENT >
267 template <
typename GUM_ELEMENT >
272 template <
typename GUM_ELEMENT >
277 template <
typename GUM_ELEMENT >
282 template <
typename GUM_ELEMENT >
284 if (
content_ ==
nullptr)
return true;
288 template <
typename GUM_ELEMENT >
293 template <
typename GUM_ELEMENT >
304 template <
typename GUM_ELEMENT >
312 template <
typename GUM_ELEMENT >
320 template <
typename GUM_ELEMENT >
325 template <
typename GUM_ELEMENT >
338 template <
typename GUM_ELEMENT >
347 template <
typename GUM_ELEMENT >
349 std::function< GUM_ELEMENT(GUM_ELEMENT, GUM_ELEMENT) > f,
350 GUM_ELEMENT base)
const {
359 template <
typename GUM_ELEMENT >
365 template <
typename GUM_ELEMENT >
370 template <
typename GUM_ELEMENT >
375 template <
typename GUM_ELEMENT >
380 template <
typename GUM_ELEMENT >
385 template <
typename GUM_ELEMENT >
388 if (aContent !=
nullptr) {
399 template <
typename GUM_ELEMENT >
404 template <
typename GUM_ELEMENT >
407 this->
content()->replace(*x, *y);
410 template <
typename GUM_ELEMENT >
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.
Abstract base class for all multi dimensionnal containers.
MultiDimContainer & operator=(const MultiDimContainer< GUM_ELEMENT > &src)
Default constructor.
MultiDimContainer()
Default constructor.
void erase(const DiscreteVariable &var) final
Removes a var from the variables of the multidimensional matrix.
void populate(const std::vector< GUM_ELEMENT > &v) const final
Automatically fills this MultiDimContainer with the values in v.
MultiDimDecorator< GUM_SCALAR > * newFactory() const override=0
Idx pos(const DiscreteVariable &var) const final
Returns the index of a variable.
const MultiDimImplementation< GUM_ELEMENT > * content() const final
Returns the implementation for this object (may be *this).
void fill(const GUM_ELEMENT &d) const final
Default implementation of MultiDimContainer::set().
bool empty() const final
Returns true if no var is in *this.
void setLastNotification(const Instantiation &i) final
Listen to setLast in a given Instantiation.
const Sequence< const DiscreteVariable * > & variablesSequence() const final
Returns a const ref to the sequence of DiscreteVariable*.
MultiDimDecorator(MultiDimImplementation< GUM_ELEMENT > *aContent=nullptr, GUM_ELEMENT empty_value=(GUM_ELEMENT) 0)
Class constructor.
const DiscreteVariable & variable(Idx) const final
Returns a const ref to the ith var.
void swapContent_(MultiDimImplementation< GUM_ELEMENT > *aContent) const
protected method to swap the implementation behind the Tensor
void setDecNotification(const Instantiation &i) final
Listen to increment in each recorded Instantiation.
std::string toString() const override
Default implementation of MultiDimContainer::set().
MultiDimDecorator< GUM_ELEMENT > & operator=(const MultiDimDecorator &from) noexcept
copy operator
void beginMultipleChanges() final
Default implementation of MultiDimContainer::set().
void setIncNotification(const Instantiation &i) final
Listen to increment in a given Instantiation.
GUM_ELEMENT & get_(const Instantiation &i) const final
Return a data, given a Instantiation - final method.
virtual void notifyChange() const final
void replace_(const DiscreteVariable *x, const DiscreteVariable *y) override
This is called by MultiDimContainer::replace() to proceed with the replacing between x and y.
GUM_ELEMENT empty_value_
value of the MultiDimDecorator if no dimension.
bool contains(const DiscreteVariable &var) const final
Returns true if var is in *this.
Idx nbrDim() const final
Returns the number of vars in the multidimensional container.
GUM_ELEMENT reduce(std::function< GUM_ELEMENT(GUM_ELEMENT, GUM_ELEMENT) > f, GUM_ELEMENT base) const final
compute lfold for this container
~MultiDimDecorator() override
Class destructor.
void changeNotification(const Instantiation &i, const DiscreteVariable *const var, Idx oldval, Idx newval) final
Listen to changes in a given Instantiation.
void set(const Instantiation &i, const GUM_ELEMENT &value) const final
Default implementation of MultiDimContainer::set().
void setChangeNotification(const Instantiation &i) final
Listen to an assignment of a value in a Instantiation.
void setFirstNotification(const Instantiation &i) final
Listen to setFirst in a given Instantiation.
MultiDimImplementation< GUM_ELEMENT > * content_
The true container.
void add(const DiscreteVariable &v) final
Adds a new var to the variables of the multidimensional matrix.
Size domainSize() const final
Returns the product of the variables domain size.
bool unregisterSlave(Instantiation &i) final
Unregister i as a slave of this MultiDimAdressable.
void apply(std::function< GUM_ELEMENT(GUM_ELEMENT) > f) const final
Apply a function on every element of the container.
GUM_ELEMENT get(const Instantiation &i) const final
Default implementation of MultiDimContainer::get().
void endMultipleChanges() final
Default implementation of MultiDimContainer::set().
bool registerSlave(Instantiation &i) final
Register i as a slave of this MultiDimAdressable.
<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.
bool contains(std::string_view s, std::string_view needle)
true if needle in s
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