34 namespace aggregator {
37 template <
typename GUM_SCALAR >
44 template <
typename GUM_SCALAR >
52 template <
typename GUM_SCALAR >
57 template <
typename GUM_SCALAR >
65 bool stop_iteration =
false;
67 for (
Idx j = 1; j < this->
nbrDim(); j++) {
69 this->
variable(j), i.
val(this->variable(j)), current, stop_iteration);
71 if (stop_iteration)
break;
77 template <
typename GUM_SCALAR >
82 "Not enough variable for an aggregator : " << *
this);
91 return (i.
val(agg) == current) ? (GUM_SCALAR)1.0 : (GUM_SCALAR)0.0;
94 template <
typename GUM_SCALAR >
99 for (
Idx i = 1; i < this->
nbrDim(); i++) {
109 template <
typename GUM_SCALAR >
116 if (p->name() != this->
name()) {
118 "Can not copy from a " << p->name() <<
" to a " 126 template <
typename GUM_SCALAR >
128 static const std::string str =
"MultiDimAggregator";
133 template <
typename GUM_SCALAR >
virtual ~MultiDimAggregator()
Class destructor.
MultiDimAggregator()
Default constructor.
const std::string toString() const override
const std::string & name() const override
Returns the real name of the multiDimArray.
virtual Idx _fold(const DiscreteVariable &v, Idx i1, Idx i2, bool &stop_iteration) const =0
_fold is applied on value i1 for variable v. the actual result for precedent applications is i2...
virtual std::string aggregatorName() const =0
virtual const DiscreteVariable & variable(Idx i) const override
Returns a const ref to the ith var.
Base class for discrete random variable.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Abstract base class for all multi dimensionnal containers.
void copyFrom(const MultiDimContainer< GUM_SCALAR > &src) const override
Copy of a multiDimICIModel.
Abstract base class for all multi dimensionnal read only structure.
<agrum/multidim/aggregators/multiDimAggregator.h>
Idx val(Idx i) const
Returns the current value of the variable at position i.
virtual Size domainSize() const =0
virtual Idx _neutralElt() const =0
_neutralElt() is the result value for the first application of _fold
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
virtual void copyFrom(const MultiDimContainer< GUM_SCALAR > &src) const
Basic copy of a MultiDimContainer.
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 Idx _buildValue(const gum::Instantiation &i) const
by default, _buildValue uses a "fold" scheme and the user has to implement _neutralElt and _fold but ...
Size Idx
Type for indexes.
virtual GUM_SCALAR get(const Instantiation &i) const override
std::ostream & operator<<(std::ostream &s, const MultiDimAggregator< GUM_SCALAR > &ag)
For friendly displaying the content of the array.
#define GUM_ERROR(type, msg)