57 template <
typename GUM_SCALAR >
64 template <
typename GUM_SCALAR >
72 template <
typename GUM_SCALAR >
77 template <
typename GUM_SCALAR >
84 bool stop_iteration =
false;
86 for (
Idx j = 1; j < this->
nbrDim(); j++) {
87 current =
fold_(this->
variable(j), i.
val(this->variable(j)), current, stop_iteration);
89 if (stop_iteration)
break;
95 template <
typename GUM_SCALAR >
107 return (i.
val(agg) == current) ? (GUM_SCALAR)1.0 : (GUM_SCALAR)0.0;
110 template <
typename GUM_SCALAR >
115 for (
Idx i = 1; i < this->
nbrDim(); i++) {
126 template <
typename GUM_SCALAR >
133 if (p->name() != this->name()) {
135 "Can not copy from a " << p->name() <<
" to a " << this->name());
141 template <
typename GUM_SCALAR >
147 template <
typename GUM_SCALAR >
149 static const std::string str =
"MultiDimAggregator";
154 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.
Idx val(Idx i) const
Returns the current value of the variable at position i.
MultiDimContainer()
Default constructor.
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.
const DiscreteVariable & variable(Idx i) const override
Returns a const ref to the ith var.
MultiDimReadOnly()
Default constructor.
Exception : operation not allowed.
<agrum/base/multidim/aggregators/multiDimAggregator.h>
void copyFrom(const MultiDimContainer< GUM_SCALAR > &src) const override
Copy of a multiDimICIModel.
virtual ~MultiDimAggregator()
Class destructor.
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 GUM_SCALAR get(const Instantiation &i) const override
bool isDecomposable() const
virtual std::string aggregatorName() const =0
std::string toString() const override
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 ...
MultiDimAggregator()
Default constructor.
bool decomposable_
decomposable_ indicates if the aggregator can be decomposed
const std::string & name() const override
Returns the real name of the multiDimArray.
virtual Idx neutralElt_() const =0
neutralElt_() is the result value for the first application of fold_
#define GUM_ERROR(type, msg)
Size Idx
Type for indexes.
Aggregators are functional description of CPTs.
std::ostream & operator<<(std::ostream &s, const MultiDimAggregator< GUM_SCALAR > &ag)
For friendly displaying the content of the array.
gum is the global namespace for all aGrUM entities