66 template <
typename GUM_SCALAR >
77 template <
typename GUM_SCALAR >
89 template <
typename GUM_SCALAR >
95 template <
typename GUM_SCALAR >
102 template <
typename GUM_SCALAR >
108 template <
typename GUM_SCALAR >
114 template <
typename GUM_SCALAR >
120 template <
typename GUM_SCALAR >
126 template <
typename GUM_SCALAR >
131 template <
typename GUM_SCALAR >
136 template <
typename GUM_SCALAR >
141 template <
typename GUM_SCALAR >
146 template <
typename GUM_SCALAR >
155 case AggregateType::OR : {
158 case AggregateType::AND : {
161 case AggregateType::AMPLITUDE : {
162 return aggregator::Amplitude< GUM_SCALAR >().isDecomposable();
164 case AggregateType::MEDIAN : {
165 return aggregator::Median< GUM_SCALAR >().isDecomposable();
167 case AggregateType::EXISTS : {
168 return aggregator::Exists< GUM_SCALAR >(label()).isDecomposable();
170 case AggregateType::FORALL : {
173 case AggregateType::COUNT : {
176 case AggregateType::SUM : {
177 return aggregator::Sum< GUM_SCALAR >().isDecomposable();
185 template <
typename GUM_SCALAR >
190 template <
typename GUM_SCALAR >
195 template <
typename GUM_SCALAR >
200 template <
typename GUM_SCALAR >
205 template <
typename GUM_SCALAR >
208 case AggregateType::MIN : {
211 case AggregateType::MAX : {
214 case AggregateType::OR : {
217 case AggregateType::AND : {
220 case AggregateType::AMPLITUDE : {
223 case AggregateType::MEDIAN : {
226 case AggregateType::EXISTS : {
229 case AggregateType::FORALL : {
232 case AggregateType::COUNT : {
235 case AggregateType::SUM : {
236 return new aggregator::Sum< GUM_SCALAR >();
246 template <
typename GUM_SCALAR >
250 template <
typename GUM_SCALAR >
253 template <
typename GUM_SCALAR >
268 for (inst.setFirst(); !inst.end(); inst.inc()) {
269 if (
type().label_map()[inst.val(my_var)] == inst.val(cast_var)) {
270 cast->cpf().set(inst, 1);
272 cast->cpf().set(inst, 0);
279 template <
typename GUM_SCALAR >
284 template <
typename GUM_SCALAR >
Base class for discrete random variable.
Exception : fatal (unknown ?) error.
Class for assigning/browsing values to tuples of discrete variables.
<agrum/base/multidim/multiDimImplementation.h>
Exception : the element we looked for cannot be found.
Exception : operation not allowed.
bool isDecomposable() const
Idx label() const
Returns the label's index on which this aggregate applies.
virtual void addParent(const PRMClassElement< GUM_SCALAR > &elt)
See gum::PRMClassElement::addParent_().
virtual void addChild(const PRMClassElement< GUM_SCALAR > &elt)
See gum::PRMClassElement::addChild_().
virtual PRMType & type()
See gum::PRMClassElement::type().
AggregateType
The different type of aggregates we can have.
PRMAggregate< GUM_SCALAR > & operator=(const PRMAggregate< GUM_SCALAR > &source)
Copy operator. Don't use it.
virtual PRMAttribute< GUM_SCALAR > * getCastDescendant() const
See gum::PRMClassElement::elt_type().
PRMAggregate(const std::string &name, AggregateType aggType, const PRMType &rvType)
Default constructor.
AggregateType agg_type() const
Returns the aggregate of *this.
AggregateType _agg_type_
The AggregateType of this aggregate.
bool hasLabel() const
Returns true if the label is defined.
std::shared_ptr< Idx > sharedLabel() const
Returns the shared_ptr holding this Aggregate label.
void setLabel(Idx idx)
Set the aggregator's label.
std::string _label_value_
The AggregateType of this aggregate.
std::shared_ptr< Idx > _label_
Some aggregators applies only on a given label. This attribute must have the concerned Idx....
virtual Tensor< GUM_SCALAR > & cpf()
Aggregates don't have Tensor until they are instantiated as PRMAttribute, so this will raise an Opera...
virtual PRMClassElement< GUM_SCALAR >::ClassElementType elt_type() const
See gum::PRMClassElement::elt_type().
MultiDimImplementation< GUM_SCALAR > * buildImpl() const
Returns a pointer over an empty gum::MultiDimImplementation of the good type for this PRMAggregate.
PRMType * _type_
The random variable type of this aggregate It is deleted with the aggregate.
virtual ~PRMAggregate()
Destructor.
const std::string & labelValue() const
See gum::PRMClassElement::elt_type().
bool isDecomposable() const
Returns true if the aggregator is decomposable.
PRMAttribute is a member of a Class in a PRM.
virtual std::string cast(const PRMType &t) const
PRMClassElement(const std::string &name)
Default constructor of a PRMClassElement.
ClassElementType
Returns true if obj_ptr is of type PRMReferenceSlot.
std::string safeName_
The safe name of this PRMClassElement.
const std::string & name() const
Returns the name of this object.
static std::string LEFT_CAST()
Enumeration of the different types of objects handled by a PRM.
static std::string RIGHT_CAST()
Enumeration of the different types of objects handled by a PRM.
<agrum/PRM/elements/scalarAttribute.h>
virtual const Tensor< GUM_SCALAR > & cpf() const
See gum::PRMClassElement::cpf().
virtual PRMType & type()
See gum::PRMClassElement::type().
virtual void addParent(const PRMClassElement< GUM_SCALAR > &elt)
See gum::PRMClassElement::addParent_().
This is a decoration of the DiscreteVariable class.
DiscreteVariable & variable()
Return a reference on the DiscreteVariable contained in this.
#define GUM_ERROR(type, msg)
Size Idx
Type for indexes.
namespace for all probabilistic relational models entities
gum is the global namespace for all aGrUM entities