40 template <
typename GUM_SCALAR >
49 template <
typename GUM_SCALAR >
60 template <
typename GUM_SCALAR >
70 template <
typename GUM_SCALAR >
74 if (lg > std::numeric_limits< Idx >::max() / v.
domainSize()) {
84 template <
typename GUM_SCALAR >
89 if (variables.
size() == 1) {
94 _gaps.erase(variables[pos]);
96 for (
Idx i = pos + 1; i < variables.
size(); ++i) {
97 _gaps[variables[i]] /= v_size;
106 template <
typename GUM_SCALAR >
117 if (newval >= oldval) {
128 template <
typename GUM_SCALAR >
137 template <
typename GUM_SCALAR >
146 template <
typename GUM_SCALAR >
155 template <
typename GUM_SCALAR >
165 template <
typename GUM_SCALAR >
175 template <
typename GUM_SCALAR >
188 template <
typename GUM_SCALAR >
203 template <
typename GUM_SCALAR >
210 iter !=
_gaps.endSafe();
216 iter.key()->name() <<
" not present in the instantiation " << i);
232 template <
typename GUM_SCALAR >
235 for (
Idx i = 0; i < this->
nbrDim(); ++i) {
238 result.
chgVal(var, indice % domainSize);
242 GUM_ASSERT(indice == 0);
246 template <
typename GUM_SCALAR >
247 INLINE
const std::string
260 template <
typename GUM_SCALAR >
268 template <
typename GUM_SCALAR >
virtual void setLastNotification(const Instantiation &i)
Listen to setLast in a given Instantiation.
Instantiation & fromOffset(Instantiation &i, Size offset) const
Set the Instantiation to the values corresponding to the offset (in this array).
void _computeInstantiationValue(Instantiation &result, Size indice) const
For a given index of a value in the vector values, this method computes the corresponding instantiati...
void setDecNotification(const Instantiation &i)
Listen to increment in each recorded Instantiation.
Idx pos(const Key &key) const
Returns the position of the object passed in argument (if it exists).
Size toOffset(const Instantiation &i) const
Compute offset from an Instantiation (in this array).
virtual bool unregisterSlave(Instantiation &i)
Unregister i as a slave of this MultiDimAdressable.
Idx valFromPtr(const DiscreteVariable *pvar) const
Returns the current value of a given variable.
HashTable< const Instantiation *, Size > _offsets
The position in the array of each slave Instantiation.
virtual void setChangeNotification(const Instantiation &i)
Listen to an assignment of a value in a Instantiation.
Size size() const noexcept
Returns the size of the sequence.
virtual void erase(const DiscreteVariable &v) override
Removes a var from the variables of the multidimensional matrix.
The generic class for storing (ordered) sequences of objects.
Safe Const Iterators for hashtables.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
virtual const DiscreteVariable & variable(Idx i) const override
Returns a const ref to the ith var.
virtual const std::string toString() const
Returns a representation of this MultiDimContainer.
virtual void changeNotification(const Instantiation &i, const DiscreteVariable *const var, Idx oldval, Idx newval)
Listen to changes in a given Instantiation.
Instantiation & chgVal(const DiscreteVariable &v, Idx newval)
Assign newval to variable v in the Instantiation.
HashTable< const DiscreteVariable *, Size > _gaps
The gaps between consecutive values of a given variable.
Base class for discrete random variable.
virtual bool unregisterSlave(Instantiation &slave) override
Unregister i as a slave of this MultiDimAdressable.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
virtual ~MultiDimWithOffset()
Class destrucor.
virtual void add(const DiscreteVariable &v)
Adds a new var to the variables of the multidimensional matrix.
virtual Size domainSize() const =0
Abstract class for Multidimensional matrix stored as an array in memory and with an offset associated...
MultiDimWithOffset()
Class constructor.
void setIncNotification(const Instantiation &i)
Listen to increment in a given Instantiation.
virtual void erase(const DiscreteVariable &v)
Removes a var from the variables of the multidimensional matrix.
Size _getOffs(const Instantiation &i) const
Compute the offset of a Instantiation.
virtual void add(const DiscreteVariable &v) override
Adds a new var to the variables of the multidimensional matrix.
virtual const Sequence< const DiscreteVariable *> & variablesSequence() const override
Returns a const ref to the sequence of DiscreteVariable*.
virtual Idx nbrDim() const override
Returns the number of vars in the multidimensional container.
Class for assigning/browsing values to tuples of discrete variables.
virtual Size domainSize() const override
Returns the product of the variables domain size.
bool contains(const DiscreteVariable &v) const final
Indicates whether a given variable belongs to the Instantiation.
virtual void setFirstNotification(const Instantiation &i)
Listen to setFirst in a given Instantiation.
bool isMaster(const MultiDimAdressable *m) const
Indicates whether m is the master of this instantiation.
<agrum/multidim/multiDimImplementation.h>
Size Idx
Type for indexes.
virtual Idx pos(const DiscreteVariable &v) const override
Returns the index of a variable.
std::size_t Size
In aGrUM, hashed values are unsigned long int.
virtual bool registerSlave(Instantiation &i)
Register i as a slave of this MultiDimAdressable.
#define GUM_ERROR(type, msg)