60 template <
typename GUM_SCALAR >
68 template <
typename GUM_SCALAR >
78 template <
typename GUM_SCALAR >
88 template <
typename GUM_SCALAR >
92 if (lg > std::numeric_limits< Idx >::max() / v.
domainSize()) {
102 template <
typename GUM_SCALAR >
107 if (variables.
size() == 1) {
114 for (
Idx i =
pos + 1; i < variables.
size(); ++i) {
115 gaps_[variables[i]] /= v_size;
124 template <
typename GUM_SCALAR >
135 if (newval >= oldval) {
146 template <
typename GUM_SCALAR >
154 template <
typename GUM_SCALAR >
162 template <
typename GUM_SCALAR >
170 template <
typename GUM_SCALAR >
179 template <
typename GUM_SCALAR >
188 template <
typename GUM_SCALAR >
201 template <
typename GUM_SCALAR >
216 template <
typename GUM_SCALAR >
220 for (
auto iter =
gaps_.begin(); iter !=
gaps_.end(); ++iter)
255 template <
typename GUM_SCALAR >
258 for (
Idx i = 0; i < this->
nbrDim(); ++i) {
265 GUM_ASSERT(indice == 0);
269 template <
typename GUM_SCALAR >
282 template <
typename GUM_SCALAR >
289 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.
Instantiation & chgVal(const DiscreteVariable &v, Idx newval)
Assign newval to variable v in the Instantiation.
bool isMaster(const MultiDimAdressable *m) const
Indicates whether m is the master of this instantiation.
bool contains(const DiscreteVariable &v) const final
Indicates whether a given variable belongs to the Instantiation.
Idx valFromPtr(const DiscreteVariable *pvar) const
Returns the current value of a given variable.
Exception: at least one argument passed to a function is not what was expected.
virtual std::string toString() const
Returns a representation of this MultiDimContainer.
MultiDimImplementation()
Default constructor.
virtual Idx nbrDim() const override
Returns the number of vars in the multidimensional container.
virtual void add(const DiscreteVariable &v) override
Adds a new var to the variables of the multidimensional matrix.
virtual Size domainSize() const override
Returns the product of the variables domain size.
virtual const Sequence< const DiscreteVariable * > & variablesSequence() const override
Returns a const ref to the sequence of DiscreteVariable*.
virtual void erase(const DiscreteVariable &v) override
Removes a var from the variables of the multidimensional matrix.
virtual bool registerSlave(Instantiation &slave) override
Register i as a slave of this MultiDimAdressable.
const DiscreteVariable & variable(Idx i) const override
Returns a const ref to the ith var.
virtual bool unregisterSlave(Instantiation &slave) override
Unregister i as a slave of this MultiDimAdressable.
virtual Idx pos(const DiscreteVariable &v) const override
Returns the index of a variable.
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.
void setIncNotification(const Instantiation &i)
Listen to increment in a given Instantiation.
virtual void setChangeNotification(const Instantiation &i)
Listen to an assignment of a value in a Instantiation.
void setDecNotification(const Instantiation &i)
Listen to increment in each recorded Instantiation.
virtual void setLastNotification(const Instantiation &i)
Listen to setLast in a given Instantiation.
virtual bool unregisterSlave(Instantiation &i)
Unregister i as a slave of this MultiDimAdressable.
virtual void changeNotification(const Instantiation &i, const DiscreteVariable *const var, Idx oldval, Idx newval)
Listen to changes in a given Instantiation.
MultiDimWithOffset()
Class constructor.
Size getOffs_(const Instantiation &i) const
Compute the offset of a Instantiation.
void computeInstantiationValue_(Instantiation &result, Size indice) const
For a given index of a value in the vector values, this method computes the corresponding instantiati...
virtual void add(const DiscreteVariable &v)
Adds a new var to the variables of the multidimensional matrix.
virtual void setFirstNotification(const Instantiation &i)
Listen to setFirst in a given Instantiation.
virtual bool registerSlave(Instantiation &i)
Register i as a slave of this MultiDimAdressable.
Instantiation & fromOffset(Instantiation &i, Size offset) const
Set the Instantiation to the values corresponding to the offset (in this array).
Size toOffset(const Instantiation &i) const
Compute offset from an Instantiation (in this array).
virtual ~MultiDimWithOffset()
Class destrucor.
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.
Headers of gum::MultiDimImplementation.
Headers of the MultiDimWithOffset class.
gum is the global namespace for all aGrUM entities