31 namespace aggregator {
34 template <
typename GUM_SCALAR >
41 template <
typename GUM_SCALAR >
49 template <
typename GUM_SCALAR >
54 template <
typename GUM_SCALAR >
62 bool stop_iteration =
false;
64 for (
Idx j = 1; j < this->
nbrDim(); j++) {
66 this->
variable(j), i.
val(this->variable(j)), current, stop_iteration);
68 if (stop_iteration)
break;
74 template <
typename GUM_SCALAR >
79 "Not enough variable for an aggregator : " << *
this);
88 return (i.
val(agg) == current) ? (GUM_SCALAR)1.0 : (GUM_SCALAR)0.0;
91 template <
typename GUM_SCALAR >
96 for (
Idx i = 1; i < this->
nbrDim(); i++) {
106 template <
typename GUM_SCALAR >
113 if (p->name() != this->
name()) {
115 "Can not copy from a " << p->name() <<
" to a " 123 template <
typename GUM_SCALAR >
125 static const std::string str =
"MultiDimAggregator";
130 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.
gum is the global namespace for all aGrUM entities
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
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)