56 template <
typename GUM_SCALAR >
63 template <
typename GUM_SCALAR >
71 template <
typename GUM_SCALAR >
78 template <
typename GUM_SCALAR >
89 template <
typename GUM_SCALAR >
94 template <
typename GUM_SCALAR >
97 GUM_SCALAR base)
const {
102 template <
typename GUM_SCALAR >
112 template <
typename GUM_SCALAR >
121 template <
typename GUM_SCALAR >
126 if (variables.
size() == 1) {
140 if (
pos != variables.
size() - 1) {
144 for (
Idx i = 0, j = 0; i < size; i += gap_w) {
145 Idx last = i + gap_v;
147 for (
Idx k = i; k < last; ++k, ++j)
160 template <
typename GUM_SCALAR >
166 template <
typename GUM_SCALAR >
174 template <
typename GUM_SCALAR >
182 template <
typename GUM_SCALAR >
188 template <
typename GUM_SCALAR >
194 template <
typename GUM_SCALAR >
199 template <
typename GUM_SCALAR >
205 template <
typename GUM_SCALAR >
212 template <
typename GUM_SCALAR >
220 template <
typename GUM_SCALAR >
223 static const std::string str(
"MultiDimArray");
227 template <
typename GUM_SCALAR >
Base class for discrete random variable.
virtual Size domainSize() const =0
Class for assigning/browsing values to tuples of discrete variables.
bool isMaster(const MultiDimAdressable *m) const
Indicates whether m is the master of this instantiation.
const GUM_SCALAR & getByOffset(Idx offset) const
Returns the element stored in the multidimArray at a given offset.
virtual void erase(const DiscreteVariable &v)
Removes a variable.
void commitMultipleChanges_() final
Synchronize content after MultipleChanges.
const GUM_SCALAR & unsafeGet(Idx offset) const
Returns the element stored in the multidimArray at a given offset.
virtual void copyFrom(const MultiDimContainer< GUM_SCALAR > &src) const
Copy from a other MultiDimContainer.
virtual ~MultiDimArray()
Copy operator.
virtual void apply(std::function< GUM_SCALAR(GUM_SCALAR) > f) const
Apply a function on every element of the container.
std::vector< GUM_SCALAR > values_
The true data : the values is mutable since we can change the value / in a const multiDimArray.
void setByOffset(Idx offset, const GUM_SCALAR &val)
Modifies the element stored in the multidimArray at a given offset.
virtual void fill(const GUM_SCALAR &d) const
Fills the MultiDimArray with the given value.
virtual GUM_SCALAR reduce(std::function< GUM_SCALAR(GUM_SCALAR, GUM_SCALAR) > f, GUM_SCALAR base) const
compute lfold for this container
MultiDimArray()
Default constructor.
virtual Size realSize() const
Returns the real size of this MultiDimArray.
void replace_(const DiscreteVariable *x, const DiscreteVariable *y) final
Replace variable x by y.
GUM_SCALAR & get_(const Instantiation &i) const final
Return a data, given a Instantiation.
virtual const std::string & name() const
Returns the MultiDimArray name.
void unsafeSet(Idx offset, const GUM_SCALAR &val)
Modifies the element stored in the multidimArray at a given offset.
virtual void add(const DiscreteVariable &v)
Adds a variable.
virtual MultiDimContainer< GUM_SCALAR > * newFactory() const
Default constructor.
Abstract base class for all multi dimensionnal containers.
virtual void copyFrom(const MultiDimContainer< GUM_SCALAR > &src) const
Basic copy of a MultiDimContainer.
virtual bool empty() const override
Returns true if no var is in *this.
virtual Size domainSize() const override
Returns the product of the variables domain size.
virtual void replace_(const DiscreteVariable *x, const DiscreteVariable *y) override
Replace variable x by y.
virtual const Sequence< const DiscreteVariable * > & variablesSequence() const override
Returns a const ref to the sequence of DiscreteVariable*.
virtual Idx pos(const DiscreteVariable &v) const override
Returns the index of a variable.
bool isInMultipleChangeMethod_() const
Get the actual change method of this MultiDimImplementation.
HashTable< const Instantiation *, Size > offsets_
The position in the array of each slave Instantiation.
virtual void erase(const DiscreteVariable &v)
Removes a var from the variables of the multidimensional matrix.
HashTable< const DiscreteVariable *, Size > gaps_
The gaps between consecutive values of a given variable.
MultiDimWithOffset()
Class constructor.
Size getOffs_(const Instantiation &i) const
Compute the offset of a Instantiation.
virtual void add(const DiscreteVariable &v)
Adds a new var to the variables of the multidimensional matrix.
Exception : out of bound.
Size size() const noexcept
Returns the size of the sequence.
Idx pos(const Key &key) const
Returns the position of the object passed in argument (if it exists).
The generic class for storing (ordered) sequences of objects.
#define GUM_ERROR(type, msg)
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Size Idx
Type for indexes.
Header of the MultiDimArray class.
Headers of the MultiDimWithOffset class.
gum is the global namespace for all aGrUM entities