68 template < GUM_Numeric GUM_SCALAR >
80 template < GUM_Numeric GUM_SCALAR >
93 template < GUM_Numeric GUM_SCALAR >
99 template < GUM_Numeric GUM_SCALAR >
106 template < GUM_Numeric GUM_SCALAR >
112 template < GUM_Numeric GUM_SCALAR >
118 template < GUM_Numeric GUM_SCALAR >
124 template < GUM_Numeric GUM_SCALAR >
130 template < GUM_Numeric GUM_SCALAR >
135 template < GUM_Numeric GUM_SCALAR >
140 template < GUM_Numeric GUM_SCALAR >
145 template < GUM_Numeric GUM_SCALAR >
150 template < GUM_Numeric GUM_SCALAR >
189 template < GUM_Numeric GUM_SCALAR >
194 template < GUM_Numeric GUM_SCALAR >
199 template < GUM_Numeric GUM_SCALAR >
204 template < GUM_Numeric GUM_SCALAR >
209 template < GUM_Numeric GUM_SCALAR >
250 template < GUM_Numeric GUM_SCALAR >
254 template < GUM_Numeric GUM_SCALAR >
257 template < GUM_Numeric GUM_SCALAR >
259 if (!
type().isSubType()) {
264 cast->addParent(*
this);
270 if (
type().label_map()[inst.
val(my_var)] == inst.
val(cast_var)) {
271 cast->cpf().set(inst, 1);
273 cast->cpf().set(inst, 0);
280 template < GUM_Numeric GUM_SCALAR >
285 template < GUM_Numeric GUM_SCALAR >
290 template < GUM_Numeric GUM_SCALAR >
293 const auto strLower =
toLower(str);
294 if (strLower ==
"min") {
296 }
else if (strLower ==
"max") {
298 }
else if (strLower ==
"count") {
300 }
else if (strLower ==
"exists") {
302 }
else if (strLower ==
"or") {
304 }
else if (strLower ==
"and") {
306 }
else if (strLower ==
"forall") {
308 }
else if (strLower ==
"amplitude") {
310 }
else if (strLower ==
"median") {
312 }
else if (strLower ==
"sum") {
315 std::string msg =
"Unknown aggregate: ";
Headers of gum::PRMAggregate.
Base class for discrete random variable.
Exception : fatal (unknown ?) error.
Class for assigning/browsing values to tuples of discrete variables.
bool end() const
Returns true if the Instantiation reached the end.
void inc()
Operator increment.
Idx val(Idx i) const
Returns the current value of the variable at position i.
void setFirst()
Assign the first values to the tuple of the Instantiation.
Exception : the element we looked for cannot be found.
Exception : operation not allowed.
bool isDecomposable() const
PRMAttribute< GUM_SCALAR > * getCastDescendant() const override
See gum::PRMClassElement::elt_type().
PRMType & type() override
See gum::PRMClassElement::type().
void addParent(const PRMClassElement< GUM_SCALAR > &elt) override
See gum::PRMClassElement::addParent_().
std::shared_ptr< Idx > sharedLabel() const
Returns the shared_ptr holding this Aggregate label.
void addChild(const PRMClassElement< GUM_SCALAR > &elt) override
See gum::PRMClassElement::addChild_().
PRMAggregate(std::string_view name, AggregateType aggType, const PRMType &rvType)
Default constructor.
AggregateType
The different type of aggregates we can have.
void setLabel(Idx idx)
Set the aggregator's label.
PRMAggregate< GUM_SCALAR > & operator=(const PRMAggregate< GUM_SCALAR > &source)
Copy operator. Don't use it.
bool hasLabel() const
Returns true if the label is defined.
~PRMAggregate() override
Destructor.
AggregateType _agg_type_
The AggregateType of this aggregate.
AggregateType agg_type() const
Returns the aggregate of *this.
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....
MultiDimImplementation< GUM_SCALAR > * buildImpl() const
Returns a pointer over an empty gum::MultiDimImplementation of the good type for this PRMAggregate.
virtual Tensor< GUM_SCALAR > & cpf()
Aggregates don't have Tensor until they are instantiated as PRMAttribute, so this will raise an Opera...
const std::string & labelValue() const
See gum::PRMClassElement::elt_type().
static AggregateType str2enum(std::string_view str)
Static method which returns the AggregateType given its string representation.
PRMType * _type_
The random variable type of this aggregate It is deleted with the aggregate.
PRMClassElement< GUM_SCALAR >::ClassElementType elt_type() const override
See gum::PRMClassElement::elt_type().
Idx label() const
Returns the label's index on which this aggregate applies.
bool isDecomposable() const
Returns true if the aggregator is decomposable.
PRMAttribute is a member of a Class in a PRM.
PRMClassElement(std::string_view name)
Default constructor of a PRMClassElement.
virtual std::string cast(const PRMType &t) const
Returns the name of the cast descendant with PRMType t of this 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 RIGHT_CAST()
Enumeration of the different types of objects handled by a PRM.
static std::string LEFT_CAST()
Enumeration of the different types of objects handled by a PRM.
<agrum/PRM/elements/scalarAttribute.h>
This is a decoration of the DiscreteVariable class.
#define GUM_ERROR(type, msg)
Size Idx
Type for indexes.
std::string toLower(std::string_view str)
Returns the lowercase version of str.
namespace for all probabilistic relational models entities
gum is the global namespace for all aGrUM entities