48#ifndef GUM_MULTI_DIM_ARRAY_H
49#define GUM_MULTI_DIM_ARRAY_H
59 template <
typename GUM_ELEMENT >
74 template <
typename GUM_ELEMENT >
77 template <
typename GUM_ELEMENTBIS >
136 void apply(std::function< GUM_ELEMENT(GUM_ELEMENT) > f)
const override;
143 GUM_ELEMENT
reduce(std::function< GUM_ELEMENT(GUM_ELEMENT, GUM_ELEMENT) > f,
144 GUM_ELEMENT base)
const override;
164 void fill(
const GUM_ELEMENT& d)
const override;
169 const std::string&
name()
const override;
263 const GUM_ELEMENT*
data() const noexcept override;
269 GUM_ELEMENT*
data() noexcept override;
288#ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
Base class for discrete random variable.
Class for assigning/browsing values to tuples of discrete variables.
void commitMultipleChanges_() final
Synchronize content after MultipleChanges.
void add(const DiscreteVariable &v) override
Adds a variable.
const GUM_ELEMENT & unsafeGet(Idx offset) const
Returns the element stored in the multidimArray at a given offset.
GUM_ELEMENT reduce(std::function< GUM_ELEMENT(GUM_ELEMENT, GUM_ELEMENT) > f, GUM_ELEMENT base) const override
compute lfold for this container
void erase(const DiscreteVariable &v) override
Removes a variable.
void setByOffset(Idx offset, const GUM_ELEMENT &val)
Modifies the element stored in the multidimArray at a given offset.
friend class MultiDimBijArray
const GUM_ELEMENT * data() const noexcept override
Returns a pointer to the contiguous data buffer.
const std::string & name() const override
Returns the MultiDimArray name.
MultiDimContainer< GUM_ELEMENT > * newFactory() const override
Default constructor.
MultiDimArray(const MultiDimArray< GUM_ELEMENT > &src)
Copy constructor.
const GUM_ELEMENT & getByOffset(Idx offset) const
Returns the element stored in the multidimArray at a given offset.
void replace_(const DiscreteVariable *x, const DiscreteVariable *y) final
This is called by MultiDimContainer::replace() to proceed with the replacing between x and y.
std::vector< GUM_ELEMENT > values_
The true data : the values is mutable since we can change the value / in a const multiDimArray.
MultiDimArray()
Default constructor.
GUM_ELEMENT & get_(const Instantiation &i) const final
Return a data, given a Instantiation.
void fill(const GUM_ELEMENT &d) const override
Fills the MultiDimArray with the given value.
void copyFrom(const MultiDimContainer< GUM_ELEMENT > &src) const override
Copy from a other MultiDimContainer.
void unsafeSet(Idx offset, const GUM_ELEMENT &val)
Modifies the element stored in the multidimArray at a given offset.
void apply(std::function< GUM_ELEMENT(GUM_ELEMENT) > f) const override
Apply a function on every element of the container.
~MultiDimArray() override
Copy operator.
Size realSize() const override
Returns the real size of this MultiDimArray.
Decorator of a MultiDimArray, using a bijection over the variables.
Abstract base class for all multi dimensionnal containers.
MultiDimWithOffset()
Class constructor.
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Size Idx
Type for indexes.
Implementation of the MultiDimArray class.
Headers of the MultiDimWithOffset class.
gum is the global namespace for all aGrUM entities